fleetlens 0.16.6 → 0.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/build-manifest.json +3 -3
  3. package/app/apps/web/.next/prerender-manifest.json +3 -3
  4. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
  13. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  14. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  15. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  16. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  17. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  18. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  19. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  20. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  21. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  22. package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
  23. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  24. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  25. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  26. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  28. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  29. package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
  30. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
  31. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  32. package/app/apps/web/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0sr4wr_.js +1 -1
  33. package/app/apps/web/.next/server/chunks/packages_parser_dist_06d9se1._.js +1 -1
  34. package/app/apps/web/.next/server/chunks/packages_parser_dist_10ihc3~._.js +1 -1
  35. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0-zxvif._.js +1 -1
  36. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__01wj6p0._.js +1 -1
  37. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0f3q8gt._.js +1 -1
  38. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ygwqfa._.js +1 -1
  39. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0z0wa91._.js +1 -1
  40. package/app/apps/web/.next/server/chunks/ssr/[root-of-the-server]__12s3gv9._.js +1 -1
  41. package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
  42. package/app/apps/web/.next/server/chunks/ssr/apps_web_0epqfet._.js +1 -1
  43. package/app/apps/web/.next/server/chunks/ssr/apps_web_0~aj0~u._.js +1 -1
  44. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_0x014hn._.js +1 -1
  45. package/app/apps/web/.next/server/chunks/ssr/apps_web_components_usage-charts-dashboard_tsx_0bgr_uv._.js +1 -1
  46. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
  47. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
  48. package/app/apps/web/.next/server/chunks/ssr/packages_parser_dist_0mx_509._.js +1 -1
  49. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  50. package/app/apps/web/.next/server/middleware-manifest.json +5 -5
  51. package/app/apps/web/.next/server/pages/500.html +1 -1
  52. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  53. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  54. package/app/apps/web/.next/static/chunks/0d~6j~aj2vr1t.js +1 -0
  55. package/app/apps/web/.next/static/chunks/0guxw7.w8n21l.js +14 -0
  56. package/app/apps/web/.next/static/chunks/{0-z49mtd-zwgv.js → 0~opjw4gew2-w.js} +1 -1
  57. package/app/apps/web/app/settings/page.tsx +1 -1
  58. package/app/apps/web/app/usage/page.tsx +157 -2
  59. package/app/apps/web/components/menubar-install-banner.tsx +1 -1
  60. package/app/apps/web/components/menubar-install.tsx +1 -1
  61. package/app/apps/web/components/usage-chart-range.tsx +9 -3
  62. package/app/apps/web/components/usage-chart.tsx +9 -3
  63. package/app/apps/web/components/usage-charts-dashboard.tsx +10 -3
  64. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  65. package/app/apps/web/lib/format.test.ts +10 -0
  66. package/app/apps/web/lib/format.ts +6 -4
  67. package/app/apps/web/lib/usage-data.ts +9 -0
  68. package/app/apps/web/package.json +1 -1
  69. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  70. package/dist/daemon-worker.js +994 -328
  71. package/dist/index.js +1085 -413
  72. package/menubar/FleetlensMenubar.app/Contents/Info.plist +2 -2
  73. package/menubar/FleetlensMenubar.app/Contents/MacOS/FleetlensMenubar +0 -0
  74. package/package.json +1 -1
  75. package/app/apps/web/.next/static/chunks/0rrcj195v1nd..js +0 -1
  76. package/app/apps/web/.next/static/chunks/1350ox0.qybjo.js +0 -14
  77. /package/app/apps/web/.next/static/{8slBxbEObd72azKwDvtmy → Zna-9B0LUDyz-sTA_YAsM}/_buildManifest.js +0 -0
  78. /package/app/apps/web/.next/static/{8slBxbEObd72azKwDvtmy → Zna-9B0LUDyz-sTA_YAsM}/_clientMiddlewareManifest.js +0 -0
  79. /package/app/apps/web/.next/static/{8slBxbEObd72azKwDvtmy → Zna-9B0LUDyz-sTA_YAsM}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[39587,t=>{"use strict";let e={kind:"claude-code",displayName:"Claude Code",shortLabel:"Claude",accentColor:"var(--af-accent)",iconChar:"✦"},i={kind:"codex",displayName:"Codex (OpenAI)",shortLabel:"Codex",accentColor:"rgb(16, 163, 127)",iconChar:"◆"},s={kind:"gemini",displayName:"Gemini CLI",shortLabel:"Gemini",accentColor:"rgb(124, 92, 246)",iconChar:"✺"},a={kind:"antigravity",displayName:"Antigravity",shortLabel:"Agy",accentColor:"rgb(236, 72, 153)",iconChar:"⏃"},n={kind:"cowork",displayName:"Cowork",shortLabel:"Cowork",accentColor:"rgb(217, 119, 87)",iconChar:"⌘"},o={kind:"grok",displayName:"Grok Build",shortLabel:"Grok",accentColor:"rgb(100, 116, 139)",iconChar:"◈"},r=[e,i,s,a,n,{kind:"zai",displayName:"Z.ai",shortLabel:"Z.ai",accentColor:"rgb(59, 130, 246)",iconChar:"Z"},o];r.map(t=>t.kind),t.s(["ANTIGRAVITY_METADATA",0,a,"CLAUDE_CODE_METADATA",0,e,"CODEX_METADATA",0,i,"COWORK_METADATA",0,n,"GEMINI_METADATA",0,s,"GROK_METADATA",0,o,"agentMetadata",0,r])},36521,t=>{"use strict";let e=[/<system_instruction\b[^>]*>[\s\S]*?<\/system_instruction>\s*/gi],i=["<command-name>","<local-command-stdout>","<local-command-caveat>","<task-notification>","Base directory for this skill:","This session is being continued from a previous conversation","A session-scoped Stop hook is now active"];function s(t){if(!t)return t;let i=t;for(let t of e)i=i.replace(t,"");return i.trim()}t.s(["isFrameworkInjectedUserInput",0,function(t){if(!t)return!1;let e=s(t);if(!e)return!0;for(let t of i)if(e.startsWith(t))return!0;return!1},"stripFrameworkBoilerplate",0,s])},79357,t=>{"use strict";let e={input:0,output:0,cacheRead:0,cacheWrite:0},i=["/.claude/worktrees/","/.worktrees/","/claude/worktrees/"],s=/\/conductor\/workspaces\/[^/]+\/([^/]+)(?:\/|$)/;function a(t){for(let e of i){let i=t.lastIndexOf(e);if(i>=0)return{idx:i,marker:e}}return null}function n(t){let e=s.exec(t);if(!e)return null;let i=e[1],a=+!!e[0].endsWith("/");return{canonicalEndIdx:e.index+e[0].length-i.length-1-a,workspaceName:i}}let o="/.superset/worktrees/",r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function l(t){let e=t.indexOf(o);if(e<0)return null;let i=t.slice(e+o.length).split("/").filter(Boolean);if(0===i.length)return null;let s=r.test(i[0])?i[1]??i[0]:i[0];return{canonical:t.slice(0,e)+o+s,workspaceName:s}}function u(t){let e=t.replace(/\/{2,}/g,"/"),i=a(e);if(i)return e.slice(0,i.idx);let s=n(e);if(s)return e.slice(0,s.canonicalEndIdx);let o=l(e);return o?o.canonical:e}function d(t){let e=t.replace(/\/{2,}/g,"/"),i=a(e);if(i){let t=e.slice(i.idx+i.marker.length),s=t.indexOf("/");return s>=0?t.slice(0,s):t}let s=n(e);if(s)return s.workspaceName;let o=l(e);return o?o.workspaceName:null}function c(t){let e=u(t),i=e.replace(/\/+$/,"").split("/").filter(Boolean);return i[i.length-1]||e}function m(t){let i={sessionCount:t.length,totalDurationMs:0,totalAirTimeMs:0,totalTokens:{...e},totalToolCalls:0,totalTurns:0,avgTurnsPerSession:0,avgDurationMs:0,totalLinesAdded:0,totalLinesRemoved:0,totalFilesEdited:0};for(let e of t)i.totalDurationMs+=e.durationMs??0,i.totalAirTimeMs+=e.airTimeMs??e.durationMs??0,i.totalTokens.input+=e.totalUsage.input,i.totalTokens.output+=e.totalUsage.output,i.totalTokens.cacheRead+=e.totalUsage.cacheRead,i.totalTokens.cacheWrite+=e.totalUsage.cacheWrite,i.totalToolCalls+=e.toolCallCount??0,i.totalTurns+=e.turnCount??0,i.totalLinesAdded+=e.linesAdded??0,i.totalLinesRemoved+=e.linesRemoved??0,i.totalFilesEdited+=e.filesEdited??0;return t.length>0&&(i.avgTurnsPerSession=i.totalTurns/t.length,i.avgDurationMs=i.totalDurationMs/t.length),i}t.s(["canonicalProjectName",0,u,"computeBurstsFromSessions",0,function(t,e={}){let i=[];for(let e of t)e.activeSegments&&0!==e.activeSegments.length&&i.push({id:e.id,projectDir:e.projectDir,segments:e.activeSegments});return function(t,e){let i=e.minDurationMs??6e4,s=e.mergeGapMs??6e5,a=e.minActive??2,n=[];for(let e of t)for(let t of e.segments)t.endMs<=t.startMs||(n.push({ms:t.startMs,delta:1,sessionId:e.id}),n.push({ms:t.endMs,delta:-1,sessionId:e.id}));n.sort((t,e)=>t.ms-e.ms||e.delta-t.delta);let o=new Map,r=[],l=null;for(let t of n){if(1===t.delta)o.set(t.sessionId,(o.get(t.sessionId)??0)+1);else{let e=(o.get(t.sessionId)??0)-1;e<=0?o.delete(t.sessionId):o.set(t.sessionId,e)}let e=o.size;if(e>=a)if(l)for(let i of(l.endMs=t.ms,e>l.peak&&(l.peak=e),o.keys()))l.sessionIds.add(i);else l={startMs:t.ms,endMs:t.ms,peak:e,sessionIds:new Set(o.keys())};else l&&(l.endMs=t.ms,r.push(l),l=null)}l&&r.push(l);let u=r.filter(t=>t.endMs-t.startMs>=i),d=[];for(let t of u){let e=d[d.length-1];if(e&&t.startMs-e.endMs<=s)for(let i of(e.endMs=t.endMs,t.peak>e.peak&&(e.peak=t.peak),t.sessionIds))e.sessionIds.add(i);else d.push({startMs:t.startMs,endMs:t.endMs,peak:t.peak,sessionIds:new Set(t.sessionIds)})}let c=new Map;for(let e of t)c.set(e.id,e.projectDir);return d.map(t=>{let e=Array.from(new Set(Array.from(t.sessionIds).map(t=>c.get(t)).filter(t=>!!t)));return{startMs:t.startMs,endMs:t.endMs,peak:t.peak,sessionIds:Array.from(t.sessionIds),projectDirs:e,crossProject:e.length>1}})}(i,e)},"groupByProject",0,function(t){let e=new Map,i=function(t){let e=new Map;for(let i of t)i.repoName&&e.set(c(i.projectName),i.repoName);return t=>t.repoName??e.get(c(t.projectName))??c(t.projectName)}(t);for(let s of t){let t=i(s),a=e.get(t);a||(a={projectDir:t,projectName:t,sessions:[],rawProjectDirs:[],worktreeCount:0,metrics:m([]),perAgent:[],lastActiveMs:void 0},e.set(t,a)),a.sessions.push(s),a.rawProjectDirs.includes(s.projectDir)||a.rawProjectDirs.push(s.projectDir);let n=s.lastTimestamp?Date.parse(s.lastTimestamp):void 0;n&&(!a.lastActiveMs||n>a.lastActiveMs)&&(a.lastActiveMs=n)}for(let t of e.values()){t.metrics=m(t.sessions);let e=new Set;for(let i of t.sessions){let t=i.worktreeName??d(i.projectName)??(i.cwd?d(i.cwd):null);t&&e.add(t)}t.worktreeCount=e.size;let i=new Map;for(let e of t.sessions){let t=e.agent??"claude-code",s=i.get(t);s||(s={agent:t,sessions:0},i.set(t,s)),s.sessions+=1}t.perAgent=Array.from(i.values()).sort((t,e)=>e.sessions-t.sessions)}return Array.from(e.values()).sort((t,e)=>(e.lastActiveMs??0)-(t.lastActiveMs??0))},"projectKey",0,c,"toLocalDay",0,function(t){let e=new Date(t),i=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${i}-${s}-${a}`},"worktreeName",0,d])},43427,20629,t=>{"use strict";let e;t.s(["agentSources",()=>es,"appendUsageSnapshot",()=>er,"cclensHome",()=>et,"cclensPath",()=>ee,"getAnySession",()=>en,"invalidateFile",()=>ei,"listAllSessions",()=>ea,"pruneUsageAgent",()=>el],43427);var i=t.i(2157),s=t.i(60526),a=t.i(50227),n=t.i(39587),o=t.i(36521),r=t.i(79357);let l={input:0,output:0,cacheRead:0,cacheWrite:0};function u(t,e=200){let i=t.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();return i.length>e?i.slice(0,e-1)+"…":i}let d=/^\s*<teammate-message\s+teammate_id="([^"]+)"[^>]*>([\s\S]*?)<\/teammate-message>/;function c(t){let e=t.match(d);if(!e)return;let i=e[1],s=e[2].trim(),a="message";if(s.startsWith("{"))try{let t=JSON.parse(s);"idle_notification"===t.type?a="idle-notification":"shutdown_request"===t.type?a="shutdown-request":"shutdown_approved"===t.type?a="shutdown-approved":"task_assignment"===t.type?a="task-assignment":"teammate_terminated"===t.type&&(a="teammate-terminated")}catch{}return{teammateId:i,body:s,kind:a}}function m(t){if(!t||"object"!=typeof t)return;let e=t=>"number"==typeof t?t:0;return{input:e(t.input_tokens),output:e(t.output_tokens),cacheRead:e(t.cache_read_input_tokens),cacheWrite:e(t.cache_creation_input_tokens)}}function p(t){let e,i,s,a,n,d,p,f,g,y,h,w=[];for(let e=0;e<t.length;e++){let i=function(t,e){if(!t||"object"!=typeof t)return null;let i=String(t.type??""),s=t.uuid,a=t.parentUuid??null,n=t.timestamp;if("assistant"===i){let o,r,l,d=t.message??{},c=d.content??[],p=m(d.usage),f=d.model,g=t.requestId,y=d.id,h=d.stop_reason,w=c[0],M="agent";return w?.type==="thinking"?(M="agent-thinking",o="[thinking] "+u(w.thinking,140)):w?.type==="tool_use"?(M="tool-call",r=w.name,l=w.id,o=`${w.name} `+u(JSON.stringify(w.input??{}),100)):o=w?.type==="text"?u(w.text,200):`<assistant:${w?.type??"empty"}>`,{index:e,uuid:s,parentUuid:a,timestamp:n,role:M,rawType:i,preview:o,blocks:c,usage:p,model:f,requestId:g,messageId:y,stopReason:h,toolName:r,toolUseId:l,raw:t}}if("user"===i){let r=(t.message??{}).content;if("string"==typeof r){let l=(0,o.stripFrameworkBoilerplate)(r),d=c(l);return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"user",rawType:i,preview:u(l,200),blocks:l?[{type:"text",text:l}]:[],raw:t,teammateMessage:d}}if(Array.isArray(r)){let l=r[0];if(l?.type==="tool_result")return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"tool-result",rawType:i,preview:u("string"==typeof l.content?l.content:JSON.stringify(l.content),200),blocks:r,toolUseId:l.tool_use_id,toolResult:t.toolUseResult,raw:t};let d=r.find(t=>t?.type==="text"),m=d?(0,o.stripFrameworkBoilerplate)(d.text):"",p=d?r.map(t=>t===d?{type:"text",text:m}:t):r,f=m?c(m):void 0;return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"user",rawType:i,preview:m?u(m,200):u(JSON.stringify(r),200),blocks:p,raw:t,teammateMessage:f}}}if("attachment"===i){let o=t.attachment??{},r=String(o.type??"attachment"),l=`<attachment: ${r}>`;return"string"==typeof o.content&&o.content.length>0?l=`[${r}] `+u(o.content,140):Array.isArray(o.addedNames)&&(l=`[${r}] +${o.addedNames.length} names`),{index:e,uuid:s,parentUuid:a,timestamp:n,role:"system",rawType:i,preview:l,blocks:[{type:"text",text:JSON.stringify(o,null,2)}],attachmentType:r,raw:t}}return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"meta",rawType:i||"unknown",preview:`${i}: ${u(JSON.stringify(t),140)}`,blocks:[{type:"text",text:JSON.stringify(t,null,2)}],raw:t}}(t[e],e);i&&w.push(i)}for(let t of w){if(!t.timestamp)continue;let s=Date.parse(t.timestamp);!Number.isNaN(s)&&((void 0===e||s<e)&&(e=s),(void 0===i||s>i)&&(i=s))}let M=void 0!==e?new Date(e).toISOString():void 0,v=void 0!==i?new Date(i).toISOString():void 0;for(let t of w){if(!t.timestamp)continue;let i=Date.parse(t.timestamp);Number.isNaN(i)||void 0!==e&&(t.tOffsetMs=Math.max(0,i-e))}let k=w.filter(t=>{let e;return t.timestamp&&("user"===(e=t.role)||"agent"===e||"agent-thinking"===e||"tool-call"===e||"tool-result"===e)}).map(t=>({e:t,ms:Date.parse(t.timestamp)})).filter(t=>!Number.isNaN(t.ms)).sort((t,e)=>t.ms-e.ms);for(let t=1;t<k.length;t++)k[t].e.gapMs=Math.max(0,k[t].ms-k[t-1].ms);let _=w.filter(t=>t.timestamp).map(t=>Date.parse(t.timestamp)).filter(t=>!Number.isNaN(t)).sort((t,e)=>t-e),N=[],T=0;if(_.length>0){let t=_[0],e=_[0];for(let i=1;i<_.length;i++){let s=_[i],a=s-e;a>18e4?(N.push({startMs:t,endMs:e}),t=s):a>0&&(T+=a),e=s}N.push({startMs:t,endMs:e})}let j=new Map,b=[];for(let t of w){if(!t.timestamp)continue;let e=Date.parse(t.timestamp);if(!Number.isNaN(e)){if("assistant"===t.rawType&&t.usage&&t.messageId){let i=j.get(t.messageId);i?(i.siblings.push(t),e<i.ms&&(i.rep=t,i.ms=e)):j.set(t.messageId,{rep:t,ms:e,siblings:[t]})}else if("system"===t.rawType){let i=t.raw;if(i?.subtype!=="compact_boundary")continue;let s=i.compactMetadata??{};b.push({ms:e,trigger:"manual"===s.trigger?"manual":"auto",preTokens:"number"==typeof s.preTokens?s.preTokens:0})}}}let I=[...j.values()].sort((t,e)=>t.ms-e.ms);b.sort((t,e)=>t.ms-e.ms);let C=0,x=0,S=(t,e)=>{for(let i of t.siblings)i.coldResume=e;C++,x+=e.writeTokens},A=new Set;for(let t of b){let e,i=I.find(e=>e.ms>t.ms&&(e.rep.usage?.cacheWrite??0)>=1e3);if(!i)continue;for(let i=I.length-1;i>=0;i--)if(I[i].ms<=t.ms){e=I[i].ms;break}let s=i.rep.usage,a=s.cacheWrite+s.cacheRead;S(i,{trigger:"compact",gapMs:void 0!==e?i.ms-e:0,writeTokens:s.cacheWrite,writeRatio:a>0?s.cacheWrite/a:0,compact:{trigger:t.trigger,preTokens:t.preTokens}}),A.add(i.rep.messageId)}for(let t=1;t<I.length;t++){let e=I[t-1],i=I[t];if(A.has(i.rep.messageId))continue;let s=i.rep.usage,a=s.cacheWrite+s.cacheRead,n=a>0?s.cacheWrite/a:0,o=i.ms-e.ms;o>3e5&&s.cacheWrite>=1e3&&n>=.3&&S(i,{trigger:"idle",gapMs:o,writeTokens:s.cacheWrite,writeRatio:n})}let P={...l},D=new Set,U="",R=!1,B=!1,F=0,O=0,z=0,$=0,W=new Set,E=new Map,J=void 0!==e?(0,r.toLocalDay)(e):void 0,L=t=>{let e;if(t){let i=Date.parse(t);Number.isNaN(i)||(e=(0,r.toLocalDay)(i))}if(!(e=e??J))return;let i=E.get(e);return i||(i={toolCalls:0,turns:0,tokens:{...l}},E.set(e,i)),i};for(let t of w){if("tool-call"===t.role){F++;let e=L(t.timestamp);e&&e.toolCalls++;let i=t.blocks.find(t=>t&&"tool_use"===t.type);if(i){let t=i.input??{};if("TeamCreate"===i.name&&(R=!0),"SendMessage"===i.name){let e="string"==typeof t.to?t.to:"";e&&"team-lead"!==e&&(B=!0)}let e="string"==typeof t.file_path?t.file_path:void 0;if("Edit"===i.name&&e){W.add(e);let i="string"==typeof t.old_string?t.old_string:"",s="string"==typeof t.new_string?t.new_string:"",a=i?i.split("\n").length:0,n=s?s.split("\n").length:0;z+=Math.max(0,n-a),$+=Math.max(0,a-n)}else if("Write"===i.name&&e){W.add(e);let i="string"==typeof t.content?t.content:"";z+=i?i.split("\n").length:0}}}if("user"===t.role){let e=function(t){let e=t?.content;if("string"==typeof e)return e;if(Array.isArray(e)){for(let t of e)if(t&&"object"==typeof t&&"text"===t.type&&"string"==typeof t.text)return t.text}return""}(t.raw?.message),i=(0,o.isFrameworkInjectedUserInput)(e),s=void 0!==t.teammateMessage&&!f;if(!i&&!s){g||(g=t.teammateMessage?t.teammateMessage.body:t.preview),O++;let e=L(t.timestamp);e&&e.turns++,h=t.preview}}"agent"===t.role&&(y=t.preview)}for(let e of t)if(e&&"object"==typeof e&&("string"!=typeof e.sessionId||U||(U=e.sessionId),"string"!=typeof e.cwd||a||(a=e.cwd),"string"!=typeof e.gitBranch||n||(n=e.gitBranch),"string"!=typeof e.entrypoint||d||(d=e.entrypoint),"string"!=typeof e.teamName||p||(p=e.teamName),"string"!=typeof e.agentName||f||(f=e.agentName),"assistant"===e.type)){let t=e.message;if(t){"string"!=typeof t.model||s||(s=t.model);let i="string"==typeof t.id?t.id:void 0;if(i&&D.has(i))continue;i&&D.add(i);let a=m(t.usage);if(a){P.input+=a.input,P.output+=a.output,P.cacheRead+=a.cacheRead,P.cacheWrite+=a.cacheWrite;let t=L("string"==typeof e.timestamp?e.timestamp:void 0);t&&(t.tokens.input+=a.input,t.tokens.output+=a.output,t.tokens.cacheRead+=a.cacheRead,t.tokens.cacheWrite+=a.cacheWrite)}}}return{events:w,meta:{sessionId:U,firstTimestamp:M,lastTimestamp:v,durationMs:void 0!==e&&void 0!==i?i-e:void 0,eventCount:w.length,model:s,cwd:a,gitBranch:n,entrypoint:d,totalUsage:P,status:"idle",firstUserPreview:g,lastUserPreview:h,lastAgentPreview:y,toolCallCount:F,turnCount:O,dailyBreakdown:Array.from(E.entries()).map(([t,e])=>({day:t,toolCalls:e.toolCalls,turns:e.turns,tokens:e.tokens})).sort((t,e)=>t.day.localeCompare(e.day)),airTimeMs:T,activeSegments:N,linesAdded:z,linesRemoved:$,filesEdited:W.size,coldResumeCount:C,cacheRebuildTokens:x,teamName:p,agentName:f,isTeamLead:void 0!==p&&void 0===f&&(R||B)}}}let f=/^(?:(?:https?|ssh|git):\/\/)?(?:[^@/]+@)?([^/:]+)[:/](.+?)(?:\.git)?\/?$/;function g(t){try{return(0,i.realpathSync)(t)}catch{return t}}function y(t){let e=g(t.replace(/\/{2,}/g,"/"));try{let t=function(t){let e;if(!t||!(0,a.isAbsolute)(t))return null;let n=(e=g((0,s.homedir)()),t===e||t.startsWith(`${e}/`)?e:void 0);for(let e=t.replace(/\/+$/,"")||t;;e=(0,a.dirname)(e)){if(e===n)return null;let t=function(t){let e=(0,a.join)(t,".git"),s=(0,i.statSync)(e,{throwIfNoEntry:!1});if(!s)return null;if(s.isDirectory())return{root:t,gitDir:e,commonDir:e};let n=function(t,e){let i=e.match(/^gitdir:\s*(.+)\s*$/m);if(!i)return;let s=i[1].trim();return(0,a.isAbsolute)(s)?s:(0,a.resolve)(t,s)}(t,(0,i.readFileSync)(e,"utf8"));return n?{root:t,gitDir:n,commonDir:function(t){let e=(0,a.join)(t,"commondir");if(!(0,i.existsSync)(e))return;let s=(0,i.readFileSync)(e,"utf8").trim();if(s)return(0,a.isAbsolute)(s)?s:(0,a.resolve)(t,s)}(n)}:{root:t}}(e);if(t)return t;if((0,a.dirname)(e)===e)return null}}(e);if(t){let s=g(function(t){if(t)return".git"===(0,a.basename)(t)?(0,a.dirname)(t):void 0}(t.commonDir)??t.root),n=g(t.root),o=s!==n?(0,r.worktreeName)(e)??(0,a.basename)(t.root):void 0,l={projectName:s};o&&(l.worktreeName=o);let u=function(t){let e=t.commonDir??t.gitDir;if(!e)return;let s=(0,a.join)(e,"config");if(!(0,i.existsSync)(s))return;let n=function(t){let e=!1;for(let i of t.split("\n")){let t=i.trim();if(t.startsWith("[")){e=/^\[remote\s+"origin"\]/.test(t);continue}if(!e)continue;let s=t.match(/^url\s*=\s*(.+)$/);if(s)return s[1].trim()}}((0,i.readFileSync)(s,"utf8"));return n?function(t){let e=t.match(f);if(!e)return;let i=e[1],s=e[2].split("/").filter(Boolean);if(s.length<2)return;let a=s[s.length-1],n=s.slice(0,-1).join("/");return{host:i,owner:n,name:a,url:t,webUrl:`https://${i}/${n}/${a}`}}(n):void 0}(t);return u&&(l.remote=u,l.repoName=u.name),l}}catch{}let n=(0,r.canonicalProjectName)(e),o=(0,r.worktreeName)(e)??void 0;return o?{projectName:n,worktreeName:o}:{projectName:n}}let h=a.default.join(s.default.homedir(),".claude","projects");function w(t){return t.startsWith("-")?"/"+t.slice(1).replace(/-/g,"/"):t}let M=a.default.join(s.default.homedir(),".cclens","runtime").replace(/[/.]/g,"-");async function v(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}function k(t){return t.replace(/\.jsonl$/i,"")}let _=new Map,N=new Map,T=new Map,j=null;function b(t){_.delete(t),N.delete(t),T.delete(t),j=null}async function I(t=h){let e;if(j&&j.root===t&&Date.now()-j.capturedAtMs<1e3)return j.files;try{e=await i.promises.readdir(t,{withFileTypes:!0})}catch{return[]}let s=e.filter(t=>t.isDirectory()&&t.name!==M).map(t=>t.name),n=(await Promise.all(s.map(async e=>{let s,n=a.default.join(t,e);try{s=await i.promises.readdir(n)}catch{return[]}let o=s.filter(t=>t.endsWith(".jsonl"));return(await Promise.all(o.map(async t=>{let s=a.default.join(n,t);try{let a=await i.promises.stat(s);return{projectDir:e,fileName:t,fullPath:s,mtimeMs:a.mtimeMs,sizeBytes:a.size}}catch{return null}}))).filter(t=>null!==t)}))).flat();return j={files:n,capturedAtMs:Date.now(),root:t},n}let C={input:0,output:0,cacheRead:0,cacheWrite:0};function x(t,e,i,s,a){for(let n of t){if(!n||"object"!=typeof n||"assistant"!==n.type)continue;let t=n.message;if(!t)continue;let o="string"==typeof t.id?t.id:void 0,l="string"==typeof n.requestId?n.requestId:void 0,u=null!=o&&null!=l?`${o}:${l}`:void 0;if(u&&e.has(u))continue;u&&e.add(u);let d=t.usage;if(d){let t=t=>"number"==typeof t?t:0,e=t(d.input_tokens),o=t(d.output_tokens),l=t(d.cache_read_input_tokens),u=t(d.cache_creation_input_tokens);if(i.input+=e,i.output+=o,i.cacheRead+=l,i.cacheWrite+=u,s){let t,i="string"==typeof n.timestamp?n.timestamp:void 0;if(i){let e=Date.parse(i);Number.isNaN(e)||(t=(0,r.toLocalDay)(e))}if(t=t??a){let i=s.get(t);i||(i={...C},s.set(t,i)),i.input+=e,i.output+=o,i.cacheRead+=l,i.cacheWrite+=u}}}}}async function S(t,e,s,n){let o,r={...C},l=new Set,u=new Map;x(t,l,r,u,n);let d=a.default.join(e,s,"subagents");try{o=await i.promises.readdir(d)}catch{return{usage:r,perDay:u}}let c=o.filter(t=>t.endsWith(".jsonl"));return 0===c.length||await Promise.all(c.map(async t=>{try{let e=await v(a.default.join(d,t));x(e,l,r,u,n)}catch{}})),{usage:r,perDay:u}}async function A(t,e){let s,n=a.default.join(t,e,"workflows");try{s=await i.promises.readdir(n)}catch{return{workflowCount:0,spawnedAgentCount:0,spans:[]}}let o=s.filter(t=>t.startsWith("wf_")&&t.endsWith(".json"));if(0===o.length)return{workflowCount:0,spawnedAgentCount:0,spans:[]};let r=0,l=[];return{workflowCount:(await Promise.all(o.map(async t=>{try{let e=JSON.parse(await i.promises.readFile(a.default.join(n,t),"utf8"));return"number"==typeof e.agentCount&&(r+=e.agentCount),"number"==typeof e.startTime&&"number"==typeof e.durationMs&&e.durationMs>0&&l.push({startMs:e.startTime,endMs:e.startTime+e.durationMs}),!0}catch{return!1}}))).filter(Boolean).length,spawnedAgentCount:r,spans:l}}async function P(t,e){let s;try{s=await i.promises.readdir(t,{withFileTypes:!0})}catch{return 0}return(await Promise.all(s.map(async s=>{let n=a.default.join(t,s.name);try{if(s.isDirectory())return e>0?await P(n,e-1):0;return(await i.promises.stat(n)).mtimeMs}catch{return 0}}))).reduce((t,e)=>Math.max(t,e),0)}async function D(t,e){let i=a.default.join(t,e),[s,n]=await Promise.all([P(a.default.join(i,"subagents"),2),P(a.default.join(i,"workflows"),0)]),o=Math.max(s,n);return o>0?o:void 0}async function U(t,e){let i=await D(a.default.dirname(e.fullPath),t.id),s=t.lastTimestamp?Date.parse(t.lastTimestamp):0,n=Math.max(Number.isFinite(s)?s:0,i??0);return n>0?{...t,lastActivityMs:n}:t}function R(t,e){if(0===e.length)return{};let i=[...t??[],...e].filter(t=>t.endMs>t.startMs).sort((t,e)=>t.startMs-e.startMs);if(0===i.length)return{};let s=[{...i[0]}];for(let t=1;t<i.length;t++){let e=i[t],a=s[s.length-1];e.startMs<=a.endMs?a.endMs=Math.max(a.endMs,e.endMs):s.push({...e})}let a=s.reduce((t,e)=>t+(e.endMs-e.startMs),0);return{activeSegments:s,airTimeMs:a}}async function B(t,e,i){let s=k(i.fileName),n=a.default.dirname(i.fullPath),o=t.firstTimestamp?(0,r.toLocalDay)(Date.parse(t.firstTimestamp)):void 0,{usage:l,perDay:u}=await S(e,n,s,o);t.totalUsage=l,t.dailyBreakdown=function(t,e,i){let s=new Map((t??[]).map(t=>[t.day,t])),a=[...new Set([...s.keys(),...e.keys()])].sort((t,e)=>t.localeCompare(e)).map(t=>({day:t,toolCalls:s.get(t)?.toolCalls??0,turns:s.get(t)?.turns??0,tokens:{...e.get(t)??C}}));if(a.length>0){let t=a.reduce((t,e)=>({input:t.input+e.tokens.input,output:t.output+e.tokens.output,cacheRead:t.cacheRead+e.tokens.cacheRead,cacheWrite:t.cacheWrite+e.tokens.cacheWrite}),{...C}),e=a[0].tokens;e.input+=i.input-t.input,e.output+=i.output-t.output,e.cacheRead+=i.cacheRead-t.cacheRead,e.cacheWrite+=i.cacheWrite-t.cacheWrite}return a}(t.dailyBreakdown,u,l)}async function F(t){let e=_.get(t.fullPath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes)return e.meta;try{let e=await v(t.fullPath),{meta:i}=p(e);await B(i,e,t);let s=k(t.fileName),n=a.default.dirname(t.fullPath),o=await A(n,s),r=i.cwd??w(t.projectDir),l=y(r),u={...i,id:s,filePath:t.fullPath,projectDir:t.projectDir,projectName:l.projectName,worktreeName:l.worktreeName,repoName:l.repoName,...o.workflowCount>0?{workflowCount:o.workflowCount,spawnedAgentCount:o.spawnedAgentCount}:{},...R(i.activeSegments,o.spans)};return _.set(t.fullPath,{meta:u,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),u}catch{return null}}async function O(t){let e=N.get(t.fullPath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes)return e.detail;try{let e=await v(t.fullPath),{meta:i,events:s}=p(e),n=k(t.fileName);await B(i,e,t);let o=await A(a.default.dirname(t.fullPath),n),r=i.cwd??w(t.projectDir),l=y(r),u={...i,id:n,filePath:t.fullPath,projectDir:t.projectDir,projectName:l.projectName,worktreeName:l.worktreeName,repoName:l.repoName,events:s,...o.workflowCount>0?{workflowCount:o.workflowCount,spawnedAgentCount:o.spawnedAgentCount}:{},...R(i.activeSegments,o.spans)};N.set(t.fullPath,{detail:u,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes});let d={...u};return delete d.events,_.set(t.fullPath,{meta:d,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),u}catch{return null}}async function z(t={}){let{root:e=h,limit:i=500,projectDir:s}=t,a=await I(e);s&&(a=a.filter(t=>t.projectDir===s)),a.sort((t,e)=>e.mtimeMs-t.mtimeMs);let n=a.slice(0,i);return(await Promise.all(n.map(async t=>{let e=await F(t);return e?U(e,t):null}))).filter(t=>null!==t)}async function $(t,e={}){let{root:i=h}=e,s=(await I(i)).find(e=>k(e.fileName)===t);if(!s)return null;let n=await O(s);if(!n)return n;let o=n.firstTimestamp?Date.parse(n.firstTimestamp):void 0,r=a.default.join(a.default.dirname(s.fullPath),k(s.fileName),"subagents"),l=a.default.join(a.default.dirname(s.fullPath),k(s.fileName),"workflows"),[u,d]=await Promise.all([E(r,o,n.events),J(l,o,n.events)]),c=d.reduce((t,e)=>t+e.agentCount,0);return U({...n,subagents:u,workflows:d,...d.length>0?{workflowCount:d.length,spawnedAgentCount:c}:{}},s)}function W(t){let e,i,s,a,n,o={...C},r=new Set,l=0,u=0,d=0,c=new Map;for(let m of t){if(!m||"object"!=typeof m)continue;l++;let t="string"==typeof m.timestamp?Date.parse(m.timestamp):NaN;if(!Number.isNaN(t)&&((void 0===e||t<e)&&(e=t),(void 0===i||t>i)&&(i=t)),void 0===n&&"user"===m.type&&(null===m.parentUuid||void 0===m.parentUuid)){let t=m.message,e=t?.content;if("string"==typeof e)n=e;else if(Array.isArray(e)){let t=e.find(t=>t&&"object"==typeof t&&"text"===t.type);t?.text&&(n=t.text)}}if("assistant"===m.type){let t=m.message;if(!t)continue;a||"string"!=typeof t.model||(a=t.model);let e="string"==typeof t.id?t.id:void 0,i="string"==typeof m.requestId?m.requestId:void 0,n=null!=e&&null!=i?`${e}:${i}`:void 0,l=!n||!r.has(n);if(n&&l&&r.add(n),l){u++;let e=t.usage;if(e){let t=t=>"number"==typeof t?t:0;o.input+=t(e.input_tokens),o.output+=t(e.output_tokens),o.cacheRead+=t(e.cache_read_input_tokens),o.cacheWrite+=t(e.cache_creation_input_tokens)}}let p=t.content;if(Array.isArray(p))for(let t of p)t&&"object"==typeof t&&("text"===t.type&&"string"==typeof t.text?s=t.text:"tool_use"===t.type&&"string"==typeof t.name&&(d++,c.set(t.name,(c.get(t.name)??0)+1)))}}let m=Array.from(c.entries()).map(([t,e])=>({name:t,count:e})).sort((t,e)=>e.count-t.count);return{startMs:e,endMs:i,totalUsage:o,eventCount:l,finalPreview:void 0!==s?s.replace(/\s+/g," ").trim().slice(0,240):void 0,finalText:s,model:a,toolCalls:m,toolCallCount:d,assistantMessageCount:u,initialPrompt:n}}async function E(t,e,s){let n;try{n=await i.promises.readdir(t)}catch{return[]}let o=new Map,r=[];for(let t of s)if("tool-call"===t.role&&"Agent"===t.toolName)for(let e of t.blocks){if(e?.type!=="tool_use"||"Agent"!==e.name)continue;let i=e.input??{},s="string"==typeof i.description?i.description:void 0,a=t.timestamp?Date.parse(t.timestamp):void 0,n={toolUseId:e.id,parentUuid:t.uuid??"",runInBackground:!0===i.run_in_background,prompt:"string"==typeof i.prompt?i.prompt:void 0,tsMs:a};s&&o.set(s,n),void 0!==a&&r.push(n)}r.sort((t,e)=>(t.tsMs??0)-(e.tsMs??0));let l=n.filter(t=>t.startsWith("agent-")&&t.endsWith(".jsonl"));return(await Promise.all(l.map(async s=>{let n,l=s.replace(/^agent-/,"").replace(/\.jsonl$/,""),u=a.default.join(t,s),d=a.default.join(t,`agent-${l}.meta.json`),c={};try{let t=await i.promises.readFile(d,"utf8");c=JSON.parse(t)}catch{}try{n=await v(u)}catch{return null}let m=W(n),p=c.description&&c.description.trim().length>0?c.description:void 0,f=p?o.get(p):function(t){let e;if(void 0===t)return;let i=1/0;for(let s of r){if(void 0===s.tsMs)continue;let a=Math.abs(t-s.tsMs);a<i&&a<=2e3&&(e=s,i=a)}return e}(m.startMs),g=p??(m.initialPrompt?m.initialPrompt.replace(/\s+/g," ").trim().slice(0,80):"(no description)"),y=f?.prompt??m.initialPrompt,h=void 0!==e&&void 0!==m.startMs?Math.max(0,m.startMs-e):void 0,w=void 0!==e&&void 0!==m.endMs?Math.max(0,m.endMs-e):void 0,M=void 0!==m.startMs&&void 0!==m.endMs?m.endMs-m.startMs:void 0;return{agentId:l,agentType:c.agentType??"unknown",description:g,startMs:m.startMs,endMs:m.endMs,durationMs:M,startTOffsetMs:h,endTOffsetMs:w,eventCount:m.eventCount,totalUsage:m.totalUsage,parentUuid:f?.parentUuid,parentToolUseId:f?.toolUseId,runInBackground:f?.runInBackground,prompt:y,finalPreview:m.finalPreview,finalText:m.finalText,model:m.model,toolCalls:m.toolCalls,toolCallCount:m.toolCallCount,assistantMessageCount:m.assistantMessageCount}}))).filter(t=>null!==t).sort((t,e)=>(t.startMs??0)-(e.startMs??0))}async function J(t,e,s){let n;try{n=await i.promises.readdir(t)}catch{return[]}let o=n.filter(t=>t.startsWith("wf_")&&t.endsWith(".json"));if(0===o.length)return[];let r=[];for(let t of s){if("tool-call"!==t.role||"Workflow"!==t.toolName)continue;let e=t.timestamp?Date.parse(t.timestamp):NaN;if(!Number.isNaN(e))for(let i of t.blocks)i?.type==="tool_use"&&"Workflow"===i.name&&r.push({toolUseId:i.id,parentUuid:t.uuid??"",tsMs:e})}r.sort((t,e)=>t.tsMs-e.tsMs);let l=t=>"number"==typeof t?t:void 0,u=t=>"string"==typeof t&&t.length>0?t:void 0;return(await Promise.all(o.map(async s=>{let n;try{n=JSON.parse(await i.promises.readFile(a.default.join(t,s),"utf8"))}catch{return null}let o=u(n.runId)??s.replace(/\.json$/,""),d=l(n.startTime),c=l(n.durationMs),m=void 0!==d&&void 0!==c?d+c:void 0,p=void 0!==e&&void 0!==d?Math.max(0,d-e):void 0,f=void 0!==e&&void 0!==m?Math.max(0,m-e):void 0,g=Array.isArray(n.phases)?n.phases.filter(t=>!!t&&"object"==typeof t&&"string"==typeof t.title).map(t=>({title:t.title,detail:u(t.detail)})):[],y=Array.isArray(n.logs)?n.logs.filter(t=>"string"==typeof t):[],h=(t,e)=>{let i=u(t);return void 0===i?void 0:i.length>e?i.slice(0,e)+"…":i},w=(Array.isArray(n.workflowProgress)?n.workflowProgress:[]).filter(t=>!!t&&"object"==typeof t&&"workflow_agent"===t.type).map(t=>({index:l(t.index)??0,label:u(t.label)??"(agent)",phaseIndex:l(t.phaseIndex),phaseTitle:u(t.phaseTitle),agentId:u(t.agentId),model:u(t.model),state:u(t.state),startedAt:l(t.startedAt),durationMs:l(t.durationMs),tokens:l(t.tokens),toolCalls:l(t.toolCalls),lastToolSummary:h(t.lastToolSummary,200),promptPreview:h(t.promptPreview,600),resultPreview:h(t.resultPreview,600)})).sort((t,e)=>t.index-e.index),M=(t=>{let e,i;if(void 0===t||0===r.length)return;let s=1/0,a=1/0;for(let n of r){let o=Math.abs(t-n.tsMs);!(o>6e4)&&(o<a&&(i=n,a=o),n.tsMs<=t&&o<s&&(e=n,s=o))}return e??i})(d);return{runId:o,name:u(n.workflowName)??o,description:u(n.summary),status:u(n.status)??"unknown",agentCount:l(n.agentCount)??0,toolCallCount:l(n.totalToolCalls)??0,totalTokens:l(n.totalTokens)??0,durationMs:c,startMs:d,endMs:m,startTOffsetMs:p,endTOffsetMs:f,model:u(n.defaultModel),phases:g,logs:y,agents:w,parentToolUseId:M?.toolUseId,parentUuid:M?.parentUuid}}))).filter(t=>null!==t).sort((t,e)=>(t.startMs??0)-(e.startMs??0))}async function L(t,e,i,s={}){let n,o,r,l,u,d,{root:c=h}=s;if(!/^[\w.-]+$/.test(e)||!/^[\w.-]+$/.test(i))return null;let m=(await I(c)).find(e=>k(e.fileName)===t);if(!m)return null;let p=a.default.join(a.default.dirname(m.fullPath),t,"subagents","workflows",e,`agent-${i}.jsonl`);try{n=await v(p)}catch{return null}let f=new Set;for(let t of n){if(!t||"object"!=typeof t)continue;let e=t.message?.content;if(Array.isArray(e))for(let t of e)t&&"object"==typeof t&&"tool_result"===t.type&&!0===t.is_error&&"string"==typeof t.tool_use_id&&f.add(t.tool_use_id)}let g=[],y=new Map,w={...C},M=new Set,_=0,N=0;for(let t of n){if(!t||"object"!=typeof t)continue;N++;let e="string"==typeof t.timestamp?Date.parse(t.timestamp):NaN;if(!Number.isNaN(e)&&((void 0===u||e<u)&&(u=e),(void 0===d||e>d)&&(d=e)),void 0===o&&"user"===t.type&&(null===t.parentUuid||void 0===t.parentUuid)){let e=t.message?.content;if("string"==typeof e)o=e;else if(Array.isArray(e)){let t=e.find(t=>t&&"object"==typeof t&&"text"===t.type);t?.text&&(o=t.text)}}if("assistant"!==t.type)continue;let i=t.message;if(!i)continue;l||"string"!=typeof i.model||(l=i.model);let s="string"==typeof i.id?i.id:void 0,a="string"==typeof t.requestId?t.requestId:void 0,n=null!=s&&null!=a?`${s}:${a}`:void 0,c=!n||!M.has(n);if(n&&c&&M.add(n),c){_++;let t=i.usage;if(t){let e=t=>"number"==typeof t?t:0;w.input+=e(t.input_tokens),w.output+=e(t.output_tokens),w.cacheRead+=e(t.cache_read_input_tokens),w.cacheWrite+=e(t.cache_creation_input_tokens)}}let m=i.content;if(Array.isArray(m)){for(let t of m)if(t&&"object"==typeof t){if("text"===t.type&&"string"==typeof t.text)r=t.text;else if("tool_use"===t.type&&"string"==typeof t.name&&(y.set(t.name,(y.get(t.name)??0)+1),g.length<2e3)){let e=function(t){if(!t||"object"!=typeof t)return"";let e=e=>"string"==typeof t[e]?t[e]:void 0;return e("command")??e("file_path")??e("path")??e("pattern")??e("url")??e("description")??e("query")??e("prompt")??e("old_string")??JSON.stringify(t)}(t.input),i=e.replace(/\s+/g," ").trim().slice(0,160),s=e.length>4e3?e.slice(0,4e3)+"…":e;g.push({index:g.length+1,tool:t.name,preview:i,full:s.length>i.length||s.includes("\n")?s:void 0,isError:"string"==typeof t.id&&f.has(t.id)})}}}}return{agentId:i,prompt:o,finalText:r,steps:g,toolCalls:Array.from(y.entries()).map(([t,e])=>({name:t,count:e})).sort((t,e)=>e.count-t.count),toolCallCount:g.length,assistantMessageCount:_,eventCount:N,totalUsage:w,model:l,durationMs:void 0!==u&&void 0!==d?d-u:void 0}}let G={...n.CLAUDE_CODE_METADATA,defaultRoot:h,async listSessions(t){let e=await z(t);for(let t of e)t.agent||(t.agent="claude-code");return e},async getSession(t,e){let i=await $(t,e);return i&&!i.agent&&(i.agent="claude-code"),i}};t.s(["DEFAULT_ROOT",0,h,"claudeCodeSource",0,G,"getSession",0,$,"invalidateClaudeCodeFile",0,b,"listSessions",0,z,"loadWorkflowAgentDetail",0,L,"summarizeSubagentLines",0,W],20629);let q=a.default.join(s.default.homedir(),".codex","sessions"),H=/^rollout-(\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2})-([0-9a-f-]+)\.jsonl$/;async function K(t){return i.promises.readdir(t).catch(()=>[])}async function Y(t){let e=[];for(let s of(await K(t))){if(!/^\d{4}$/.test(s))continue;let n=a.default.join(t,s);for(let t of(await K(n))){if(!/^\d{2}$/.test(t))continue;let s=a.default.join(n,t);for(let t of(await K(s))){if(!/^\d{2}$/.test(t))continue;let n=a.default.join(s,t);for(let t of(await K(n))){let s=H.exec(t);if(!s)continue;let o=a.default.join(n,t),r=await i.promises.stat(o).catch(()=>null);r&&e.push({filePath:o,sessionId:s[2],mtimeMs:r.mtimeMs,sizeBytes:r.size})}}}}return e}async function Z(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}function Q(t){return t.replace(/\s+/g," ").trim().slice(0,200)}function V(t,e){let i,s,a,n,r,l,u,d,c,m,p,f,g=[],h={input:0,output:0,cacheRead:0,cacheWrite:0},w=0,M=0,v=[],k=0;for(let t of e){if("object"!=typeof t||null===t)continue;let e="string"==typeof t.timestamp?t.timestamp:void 0;if(e){i||(i=e),s=e;let t=Date.parse(e);Number.isFinite(t)&&v.push(t)}let y="string"==typeof t.type?t.type:"",N=t.payload??{},T="string"==typeof N.type?N.type:"";if("session_meta"===y){"string"==typeof N.cwd&&(a=N.cwd),void 0===d&&"string"==typeof N.thread_source&&(d=N.thread_source),void 0===c&&"string"==typeof N.session_id&&(c=N.session_id),void 0===m&&"string"==typeof N.parent_thread_id&&(m=N.parent_thread_id),void 0===p&&"string"==typeof N.agent_nickname&&(p=N.agent_nickname),void 0===f&&"string"==typeof N.agent_path&&(f=N.agent_path);continue}if("turn_context"===y){"string"==typeof N.cwd&&(a=N.cwd),"string"==typeof N.model&&(n=N.model);continue}if("event_msg"===y&&"token_count"===T){let t=N.info??null,e=t?.total_token_usage??null;e&&(h.input=X(e.input_tokens)??h.input,h.output=X(e.output_tokens)??h.output,h.cacheRead=X(e.cached_input_tokens)??h.cacheRead);continue}if("event_msg"===y&&"user_message"===T){let i="string"==typeof N.message?N.message:"",s=Q(i),a=(0,o.isFrameworkInjectedUserInput)(i);i&&!a&&(r||(r=s),l=s,M+=1),g.push({index:k++,timestamp:e,role:"user",rawType:"event_msg/user_message",preview:s,blocks:i?[{type:"text",text:i}]:[],raw:t});continue}if("event_msg"===y&&"agent_message"===T){let i="string"==typeof N.message?N.message:"",s=Q(i);i&&(u=s),g.push({index:k++,timestamp:e,role:"agent",rawType:"event_msg/agent_message",preview:s,blocks:i?[{type:"text",text:i}]:[],model:n,raw:t});continue}if("response_item"===y&&"reasoning"===T){let i=(N.summary??[]).map(t=>"string"==typeof t.text?t.text:"").join("\n").trim();g.push({index:k++,timestamp:e,role:"agent-thinking",rawType:"response_item/reasoning",preview:Q(i),blocks:i?[{type:"thinking",thinking:i}]:[],model:n,raw:t});continue}if("response_item"===y&&"message"===T&&"assistant"===N.role){let i=(N.content??[]).map(t=>"string"==typeof t.text?t.text:"").join("\n").trim(),s=Q(i);i&&(u=s),g.push({index:k++,timestamp:e,role:"agent",rawType:"response_item/message",preview:s,blocks:i?[{type:"text",text:i}]:[],model:n,raw:t});continue}if("response_item"===y&&"function_call"===T){var _;let i="string"==typeof N.name?N.name:"(unknown)",s="string"==typeof N.call_id?N.call_id:void 0,a="string"==typeof N.arguments?N.arguments:"",o=function(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}(a);w+=1,g.push({index:k++,timestamp:e,role:"tool-call",rawType:"response_item/function_call",preview:`${i}(${(_=a).length<=80?_:_.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:s??`codex-${k}`,name:i,input:o}],toolName:i,toolUseId:s,model:n,raw:t});continue}if("response_item"===y&&"function_call_output"===T){let i="string"==typeof N.call_id?N.call_id:void 0,s="string"==typeof N.output?N.output:"",a=/process exited with code [1-9]/i.test(s);g.push({index:k++,timestamp:e,role:"tool-result",rawType:"response_item/function_call_output",preview:Q(s),blocks:[{type:"tool_result",tool_use_id:i??"",content:s,is_error:a}],toolUseId:i,toolResult:s,raw:t});continue}g.push({index:k++,timestamp:e,role:"meta",rawType:T?`${y}/${T}`:y,preview:"",blocks:[],raw:t})}if(h.input>0||h.output>0){let e=-1;for(let t=g.length-1;t>=0;t--){let i=g[t].role;if("agent"===i||"agent-thinking"===i||"tool-call"===i){e=t;break}}if(e>=0){let i=g[e];i.messageId=`codex-${t.sessionId}-total`,i.usage={input:h.input,output:h.output,cacheRead:h.cacheRead,cacheWrite:0}}}let N=i?Date.parse(i):void 0;if(void 0!==N&&Number.isFinite(N)){let t;for(let e of g){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-N),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let T=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++)e[t]-a>18e4&&(i.push({startMs:s,endMs:a}),s=e[t]),a=e[t];return i.push({startMs:s,endMs:a}),i}(v),j=T.reduce((t,e)=>t+(e.endMs-e.startMs),0),b=i&&s?Date.parse(s)-Date.parse(i):void 0,I=a?y(a):void 0,C=I?.projectName??"(unknown)",x=a?a.replace(/^\//,"-").replace(/\//g,"-"):"(unknown)";return{meta:{agent:"codex",id:t.sessionId,filePath:t.filePath,projectName:C,worktreeName:I?.worktreeName,repoName:I?.repoName,projectDir:x,sessionId:t.sessionId,firstTimestamp:i,lastTimestamp:s,durationMs:b&&Number.isFinite(b)?b:void 0,eventCount:g.length,model:n,cwd:a,totalUsage:h,status:"idle",firstUserPreview:r,lastUserPreview:l,lastAgentPreview:u,toolCallCount:w,turnCount:M,airTimeMs:j,activeSegments:T},events:g,threadSource:d,rootSessionId:c,parentThreadId:m,agentNickname:p,agentPath:f}}function X(t){return"number"==typeof t&&Number.isFinite(t)?t:void 0}let tt=new Map,te=new Map;async function ti(t){let e=await Y(t),i=[];for(let t of e){let e=tt.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes){i.push({file:t,meta:e.meta,threadSource:e.threadSource,rootSessionId:e.rootSessionId,parentThreadId:e.parentThreadId,agentNickname:e.agentNickname,agentPath:e.agentPath});continue}try{let e=await Z(t.filePath),s=V(t,e);tt.set(t.filePath,{meta:s.meta,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes,threadSource:s.threadSource,rootSessionId:s.rootSessionId,parentThreadId:s.parentThreadId,agentNickname:s.agentNickname,agentPath:s.agentPath}),i.push({file:t,meta:s.meta,threadSource:s.threadSource,rootSessionId:s.rootSessionId,parentThreadId:s.parentThreadId,agentNickname:s.agentNickname,agentPath:s.agentPath})}catch{}}return i}async function ts(t={}){let e=t.root??q,i=await ti(e),s=new Map;for(let t of i){if("subagent"!==t.threadSource||!t.rootSessionId)continue;let e=s.get(t.rootSessionId);e?e.push(t):s.set(t.rootSessionId,[t])}let a=[];for(let t of i){if("subagent"===t.threadSource)continue;let e=s.get(t.meta.id);if(!e||0===e.length){a.push(t.meta);continue}let i={...t.meta,spawnedAgentCount:e.length,totalUsage:{input:t.meta.totalUsage.input+e.reduce((t,e)=>t+e.meta.totalUsage.input,0),output:t.meta.totalUsage.output+e.reduce((t,e)=>t+e.meta.totalUsage.output,0),cacheRead:t.meta.totalUsage.cacheRead+e.reduce((t,e)=>t+e.meta.totalUsage.cacheRead,0),cacheWrite:t.meta.totalUsage.cacheWrite+e.reduce((t,e)=>t+e.meta.totalUsage.cacheWrite,0)},toolCallCount:(t.meta.toolCallCount??0)+e.reduce((t,e)=>t+(e.meta.toolCallCount??0),0)};for(let t of e)t.meta.lastTimestamp&&(!i.lastTimestamp||t.meta.lastTimestamp>i.lastTimestamp)&&(i.lastTimestamp=t.meta.lastTimestamp);a.push(i)}return(a.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?a.slice(0,t.limit):a}async function ta(t,e={}){let i=e.root??q,s=await ti(i),a=s.find(e=>e.meta.id===t&&"subagent"!==e.threadSource);if(!a){let e=s.find(e=>e.meta.id===t);if(!e)return null;let i=te.get(e.file.filePath);if(i&&i.mtimeMs===e.file.mtimeMs&&i.sizeBytes===e.file.sizeBytes)return i.detail;let a=await Z(e.file.filePath),{meta:n,events:o}=V(e.file,a),r={...n,events:o};return te.set(e.file.filePath,{detail:r,mtimeMs:e.file.mtimeMs,sizeBytes:e.file.sizeBytes}),r}let n=a.file,o=te.get(n.filePath);if(o&&o.mtimeMs===n.mtimeMs&&o.sizeBytes===n.sizeBytes)return o.detail;let r=await Z(n.filePath),{meta:l,events:u}=V(n,r),d=s.filter(e=>"subagent"===e.threadSource&&e.rootSessionId===t),c=l.firstTimestamp?Date.parse(l.firstTimestamp):void 0,m=d.map(t=>{let e,i,s,a,n;return i=(e=t.meta).firstTimestamp?Date.parse(e.firstTimestamp):void 0,s=e.lastTimestamp?Date.parse(e.lastTimestamp):void 0,a=void 0!==i&&Number.isFinite(i)?i:void 0,n=void 0!==s&&Number.isFinite(s)?s:void 0,{agentId:e.id,agentType:t.agentNickname??t.agentPath??"subagent",description:t.agentPath??t.agentNickname??e.id,startMs:a,endMs:n,durationMs:e.durationMs,startTOffsetMs:void 0!==c&&void 0!==a?Math.max(0,a-c):void 0,endTOffsetMs:void 0!==c&&void 0!==n?Math.max(0,n-c):void 0,eventCount:e.eventCount,totalUsage:e.totalUsage,model:e.model,toolCallCount:e.toolCallCount,finalPreview:e.lastAgentPreview}}).sort((t,e)=>(t.startMs??0)-(e.startMs??0)),p={...l,events:u,...m.length>0?{subagents:m,spawnedAgentCount:m.length}:{}};return te.set(n.filePath,{detail:p,mtimeMs:n.mtimeMs,sizeBytes:n.sizeBytes}),p}let tn=a.default.join(s.default.homedir(),".gemini","tmp"),to=a.default.join(s.default.homedir(),".gemini","projects.json"),tr=/^session-.+\.(jsonl|json)$/;async function tl(t){return i.promises.readdir(t).catch(()=>[])}async function tu(t){let e=[];for(let s of(await tl(t))){let n=a.default.join(t,s,"chats");for(let t of(await tl(n))){if(!tr.test(t))continue;let o=a.default.join(n,t),r=await i.promises.stat(o).catch(()=>null);if(!r||!r.isFile())continue;let l=t.replace(/\.(jsonl|json)$/,"").split("-").pop()??t;e.push({filePath:o,slug:s,filenameId:l,format:t.endsWith(".jsonl")?"jsonl":"legacy-json",mtimeMs:r.mtimeMs,sizeBytes:r.size})}}return e}let td=null;async function tc(){let t,e=await i.promises.stat(to).catch(()=>null);if(!e)return new Map;if(td&&td.mtimeMs===e.mtimeMs)return td.slugToCwd;let s=await i.promises.readFile(to,"utf8").catch(()=>"");try{t=JSON.parse(s)}catch{t={}}let a=new Map;for(let[e,i]of Object.entries(t.projects??{}))"string"==typeof i&&a.set(i,e);return td={mtimeMs:e.mtimeMs,slugToCwd:a},a}function tm(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"string"==typeof t.type}async function tp(t){let e=await i.promises.readFile(t.filePath,"utf8");if("legacy-json"===t.format){let t;try{t=JSON.parse(e)}catch{return{meta:{},messages:[]}}return{meta:{sessionId:"string"==typeof t.sessionId?t.sessionId:void 0,projectHash:"string"==typeof t.projectHash?t.projectHash:void 0,startTime:"string"==typeof t.startTime?t.startTime:void 0,lastUpdated:"string"==typeof t.lastUpdated?t.lastUpdated:void 0,summary:"string"==typeof t.summary?t.summary:void 0},messages:(Array.isArray(t.messages)?t.messages:[]).filter(tm)}}let s={},a=new Map,n=[];for(let t of e.split("\n")){let e,i=t.trim();if(i){var o,r;try{e=JSON.parse(i)}catch{continue}if((o=e)&&"object"==typeof o&&"$rewindTo"in o){let t=e.$rewindTo,i=n.indexOf(t);if(i>=0){for(let t of n.slice(i))a.delete(t);n.length=i}continue}if((r=e)&&"object"==typeof r&&"$set"in r){Object.assign(s,e.$set);continue}if(tm(e)){a.has(e.id)||n.push(e.id),a.set(e.id,e);continue}if("object"==typeof e&&null!==e){let t=e;"string"!=typeof t.sessionId||s.sessionId||(s.sessionId=t.sessionId,"string"==typeof t.projectHash&&(s.projectHash=t.projectHash),"string"==typeof t.startTime&&(s.startTime=t.startTime),"string"==typeof t.lastUpdated&&(s.lastUpdated=t.lastUpdated),"string"==typeof t.summary&&(s.summary=t.summary))}}}let l=[];for(let t of n){let e=a.get(t);e&&l.push(e)}return{meta:s,messages:l}}function tf(t){return t.replace(/\s+/g," ").trim().slice(0,200)}function tg(t){if(!t)return"";if("string"==typeof t)return t;let e=Array.isArray(t)?t:[t],i=[];for(let t of e){if(!t||"object"!=typeof t)continue;if("string"==typeof t.text){i.push(t.text);continue}let e=t.functionResponse;if(e){let t=e.response;"string"==typeof t?i.push(t):t&&"object"==typeof t&&("string"==typeof t.output?i.push(t.output):"string"==typeof t.error?i.push(`error: ${t.error}`):i.push(JSON.stringify(t)))}}return i.join("\n")}async function ty(t){let e,i,s,a,n,r,{meta:l,messages:u}=await tp(t),d=(await tc()).get(t.slug),c=[],m={input:0,output:0,cacheRead:0,cacheWrite:0},p=0,f=0,g=[],h=0;function w(t){if(c.push(t),t.timestamp&&"meta"!==t.role){e||(e=t.timestamp),i=t.timestamp;let s=Date.parse(t.timestamp);Number.isFinite(s)&&g.push(s)}}for(let t of u){let e=t.timestamp;if("user"===t.type){let i=tg(t.displayContent??t.content),s=tf(i),r=(0,o.isFrameworkInjectedUserInput)(i);i&&!r&&(a||(a=s),n=s,f+=1),w({index:h++,timestamp:e,role:"user",rawType:"gemini/user",preview:s,blocks:i?[{type:"text",text:i}]:[],messageId:t.id,raw:t});continue}if("gemini"===t.type){let i;"string"==typeof t.model&&(s=t.model);let a=tg(t.content),n=tf(a);if(a&&(r=n),t.tokens){let e=t.tokens,s={input:e.input??0,output:e.output??0,cacheRead:e.cached??0,cacheWrite:0};i=s,m.input+=s.input,m.output+=s.output,m.cacheRead+=s.cacheRead}for(let i of t.thoughts??[]){let t=[i.subject,i.description].filter(Boolean).join(": ");t&&w({index:h++,timestamp:i.timestamp??e,role:"agent-thinking",rawType:"gemini/thought",preview:tf(t),blocks:[{type:"thinking",thinking:t}],model:s,raw:i})}for(let o of(a?w({index:h++,timestamp:e,role:"agent",rawType:"gemini/agent",preview:n,blocks:[{type:"text",text:a}],messageId:t.id,model:s,usage:i,raw:t}):i&&w({index:h++,timestamp:e,role:"agent",rawType:"gemini/agent",preview:"",blocks:[],messageId:t.id,model:s,usage:i,raw:t}),t.toolCalls??[])){p+=1;let t=o.args?JSON.stringify(o.args):"";w({index:h++,timestamp:o.timestamp??e,role:"tool-call",rawType:"gemini/tool_call",preview:`${o.name}(${t.length<=80?t:t.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:o.id,name:o.name,input:o.args??{}}],toolName:o.name,toolUseId:o.id,model:s,raw:o});let i=(o.status??"").toLowerCase();if("success"===i||"error"===i||"cancelled"===i){let t=tg(o.result);w({index:h++,timestamp:o.timestamp??e,role:"tool-result",rawType:"gemini/tool_result",preview:tf(t),blocks:[{type:"tool_result",tool_use_id:o.id,content:t,is_error:"error"===i||"cancelled"===i}],toolUseId:o.id,toolResult:t,raw:o})}}continue}if("info"===t.type||"warning"===t.type||"error"===t.type){let i=tg(t.content);w({index:h++,timestamp:e,role:"meta",rawType:`gemini/${t.type}`,preview:tf(i),blocks:i?[{type:"text",text:i}]:[],raw:t});continue}}let M=e?Date.parse(e):void 0;if(void 0!==M&&Number.isFinite(M)){let t;for(let e of c){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-M),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let v=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++)e[t]-a>18e4&&(i.push({startMs:s,endMs:a}),s=e[t]),a=e[t];return i.push({startMs:s,endMs:a}),i}(g),k=v.reduce((t,e)=>t+(e.endMs-e.startMs),0),_=e&&i?Date.parse(i)-Date.parse(e):void 0,N=l.sessionId??t.filenameId,T=d?y(d):void 0,j=T?.projectName??t.slug,b=d?d.replace(/^\//,"-").replace(/\//g,"-"):t.slug;return{meta:{agent:"gemini",id:N,filePath:t.filePath,projectName:j,worktreeName:T?.worktreeName,repoName:T?.repoName,projectDir:b,sessionId:N,firstTimestamp:e,lastTimestamp:i,durationMs:_&&Number.isFinite(_)?_:void 0,eventCount:c.length,model:s,cwd:d,totalUsage:m,status:"idle",firstUserPreview:a,lastUserPreview:n,lastAgentPreview:r,toolCallCount:p,turnCount:f,airTimeMs:k,activeSegments:v},events:c}}let th=new Map,tw=new Map;async function tM(t={}){let e=t.root??tn,i=await tu(e),s=[];for(let t of i){let e=th.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes){s.push(e.meta);continue}try{let{meta:e}=await ty(t);th.set(t.filePath,{meta:e,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),s.push(e)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function tv(t,e={}){let i,s=e.root??tn,a=await tu(s);for(let e of a)if(e.filenameId===t||t.startsWith(e.filenameId)){i=e;break}if(!i)for(let e of a){let{meta:s}=await ty(e).catch(()=>({meta:{id:""}}));if(s.id===t){i=e;break}}if(!i)return null;let n=tw.get(i.filePath);if(n&&n.mtimeMs===i.mtimeMs&&n.sizeBytes===i.sizeBytes)return n.detail;let{meta:o,events:r}=await ty(i),l={...o,events:r};return tw.set(i.filePath,{detail:l,mtimeMs:i.mtimeMs,sizeBytes:i.sizeBytes}),l}let tk=a.default.join(s.default.homedir(),".gemini","antigravity-cli");async function t_(t){return i.promises.readdir(t).catch(()=>[])}let tN=null;async function tT(t){let e=a.default.join(t,"history.jsonl"),s=await i.promises.stat(e).catch(()=>null);if(!s)return new Map;if(tN&&tN.mtimeMs===s.mtimeMs)return tN.slugToCwd;let n=await i.promises.readFile(e,"utf8").catch(()=>""),o=new Map;for(let t of n.split("\n")){let e=t.trim();if(e)try{let t=JSON.parse(e);t.conversationId&&t.workspace&&o.set(t.conversationId,t.workspace)}catch{}}return tN={mtimeMs:s.mtimeMs,slugToCwd:o},o}async function tj(t){let e=await tT(t),s=[],n=a.default.join(t,"brain");for(let t of(await t_(n))){let o=a.default.join(n,t,".system_generated","logs","transcript.jsonl"),r=await i.promises.stat(o).catch(()=>null);r&&r.isFile()&&s.push({filePath:o,conversationId:t,cwd:e.get(t),mtimeMs:r.mtimeMs,sizeBytes:r.size})}return s}function tb(t){return t.replace(/\s+/g," ").trim().slice(0,200)}async function tI(t){let e,s,a,n,r,l,u=await i.promises.readFile(t.filePath,"utf8"),d=[],c=0,m=0,p=[],f=0;function g(t){if(d.push(t),t.timestamp&&"meta"!==t.role){e||(e=t.timestamp),s=t.timestamp;let i=Date.parse(t.timestamp);Number.isFinite(i)&&p.push(i)}}let h=[],w=[],M=new Map;for(let t of u.split("\n")){let e=t.trim();if(e)try{let t=JSON.parse(e),i=t.step_index;"number"==typeof i?M.has(i)?w[M.get(i)]=t:(M.set(i,w.length),w.push(t)):w.push(t)}catch{}}for(let t of w){let e=t.created_at||t.timestamp;if("USER_INPUT"===t.type){if("string"==typeof t.content){let e=t.content.match(/Model Selection` from .*? to (.*?)\.\s*No need to/);if(e){let t=e[1].trim();a=t=t.replace(/\s*\(.*?\)\s*$/,"").trim()}else{let e=t.content.match(/Model Selection` from .*? to ([^\n]+)/);if(e){let t=e[1].trim();t.endsWith(".")&&(t=t.slice(0,-1).trim()),a=t=t.replace(/\s*\(.*?\)\s*$/,"").trim()}}}let i=t.content||"",s=i.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/);s&&(i=s[1].trim());let l=tb(i),u=(0,o.isFrameworkInjectedUserInput)(i);i&&!u&&(n||(n=l),r=l,m+=1),g({index:f++,timestamp:e,role:"user",rawType:"antigravity/user",preview:l,blocks:i?[{type:"text",text:i}]:[],messageId:t.step_index?.toString(),raw:t});continue}if("PLANNER_RESPONSE"===t.type){let i=t.thinking,s=t.content;if(i&&g({index:f++,timestamp:e,role:"agent-thinking",rawType:"antigravity/thought",preview:tb(i),blocks:[{type:"thinking",thinking:i}],model:a,raw:t}),s){let i=tb(s);l=i,g({index:f++,timestamp:e,role:"agent",rawType:"antigravity/agent",preview:i,blocks:[{type:"text",text:s}],messageId:t.step_index?.toString(),model:a,raw:t})}let n=t.tool_calls||[];for(let i=0;i<n.length;i++){let s=n[i];c+=1;let o=`tool-${t.step_index}-${i}`,r=s.args?JSON.stringify(s.args):"";h.push({id:o,name:s.name}),g({index:f++,timestamp:e,role:"tool-call",rawType:"antigravity/tool_call",preview:`${s.name}(${r.length<=80?r:r.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:o,name:s.name,input:s.args||{}}],toolName:s.name,toolUseId:o,model:a,raw:s})}continue}if("MODEL"===t.source&&"PLANNER_RESPONSE"!==t.type&&"ERROR_MESSAGE"!==t.type&&h.length>0){let i=h.shift(),s=i?i.id:`tool-${t.step_index}-unknown`,a="string"==typeof t.content?t.content:JSON.stringify(t.content||""),n="ERROR"===t.status||"FAILED"===t.status||"CANCELED"===t.status||!!t.error;g({index:f++,timestamp:e,role:"tool-result",rawType:"antigravity/tool_result",preview:tb(a),blocks:[{type:"tool_result",tool_use_id:s,content:a,is_error:n}],toolUseId:s,toolResult:a,raw:t});continue}let i=t.content||t.error||"";g({index:f++,timestamp:e,role:"meta",rawType:`antigravity/${t.type?.toLowerCase()||"unknown"}`,preview:tb(i),blocks:i?[{type:"text",text:i}]:[],raw:t})}let v=e?Date.parse(e):void 0;if(void 0!==v&&Number.isFinite(v)){let t;for(let e of d){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-v),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let k=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++)e[t]-a>18e4&&(i.push({startMs:s,endMs:a}),s=e[t]),a=e[t];return i.push({startMs:s,endMs:a}),i}(p),_=k.reduce((t,e)=>t+(e.endMs-e.startMs),0),N=e&&s?Date.parse(s)-Date.parse(e):void 0,T=t.conversationId,j=t.cwd,b=j?y(j):void 0,I=b?.projectName??t.conversationId,C=j?j.replace(/^\//,"-").replace(/\//g,"-"):t.conversationId;return{meta:{agent:"antigravity",id:T,filePath:t.filePath,projectName:I,worktreeName:b?.worktreeName,repoName:b?.repoName,projectDir:C,sessionId:T,firstTimestamp:e,lastTimestamp:s,durationMs:N&&Number.isFinite(N)?N:void 0,eventCount:d.length,model:a,cwd:j,totalUsage:{input:0,output:0,cacheRead:0,cacheWrite:0},status:"idle",firstUserPreview:n,lastUserPreview:r,lastAgentPreview:l,toolCallCount:c,turnCount:m,airTimeMs:_,activeSegments:k},events:d}}let tC=new Map,tx=new Map;async function tS(t={}){let e=t.root??tk,i=await tj(e),s=[];for(let t of i){let e=tC.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes&&e.cwd===t.cwd){s.push(e.meta);continue}try{let{meta:e}=await tI(t);tC.set(t.filePath,{meta:e,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes,cwd:t.cwd}),s.push(e)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function tA(t,e={}){let i,s=e.root??tk;for(let e of(await tj(s)))if(e.conversationId===t){i=e;break}if(!i)return null;let a=tx.get(i.filePath);if(a&&a.mtimeMs===i.mtimeMs&&a.sizeBytes===i.sizeBytes&&a.cwd===i.cwd)return a.detail;let{meta:n,events:o}=await tI(i),r={...n,events:o};return tx.set(i.filePath,{detail:r,mtimeMs:i.mtimeMs,sizeBytes:i.sizeBytes,cwd:i.cwd}),r}let tP=(e=s.default.homedir(),a.default.join(e,".config","Claude","local-agent-mode-sessions")),tD=/^local_[0-9a-f-]+$/;async function tU(t){return i.promises.readdir(t).catch(()=>[])}async function tR(t){let e=await i.promises.stat(t).catch(()=>null);return e?e.mtimeMs:0}async function tB(t){let e=[];for(let s of(await tU(t))){let n=a.default.join(t,s);for(let t of(await tU(n))){let s=a.default.join(n,t),o=await tR(a.default.join(s,"spaces.json"));for(let t of(await tU(s))){if(!tD.test(t))continue;let n=a.default.join(s,t,"audit.jsonl"),r=await i.promises.stat(n).catch(()=>null);if(!r||!r.isFile()||0===r.size)continue;let l=a.default.join(s,`${t}.json`),u=await tR(l);e.push({sessionId:t,auditPath:n,metaPath:l,workspaceDir:s,auditMtimeMs:r.mtimeMs,auditSize:r.size,metaMtimeMs:u,spacesMtimeMs:o})}}}return e}let tF=new Map;async function tO(t){let e=a.default.join(t,"spaces.json"),s=await i.promises.stat(e).catch(()=>null);if(!s)return new Map;let n=tF.get(t);if(n&&n.mtimeMs===s.mtimeMs)return n.spaceIdToPath;let o=await i.promises.readFile(e,"utf8").catch(()=>""),r=new Map;try{for(let t of JSON.parse(o).spaces??[]){let e="string"==typeof t.id?t.id:void 0,i=(Array.isArray(t.folders)?t.folders:[])[0],s="string"==typeof i?.path?i.path:void 0;e&&s&&r.set(e,s)}}catch{}return tF.set(t,{mtimeMs:s.mtimeMs,spaceIdToPath:r}),r}async function tz(t){let e=await i.promises.readFile(t,"utf8").catch(()=>"");if(!e)return{};try{let t=JSON.parse(e);return{spaceId:"string"==typeof t.spaceId?t.spaceId:void 0,userSelectedFolders:Array.isArray(t.userSelectedFolders)?t.userSelectedFolders.filter(t=>"string"==typeof t):void 0,cwd:"string"==typeof t.cwd?t.cwd:void 0,model:"string"==typeof t.model?t.model:void 0,title:"string"==typeof t.title?t.title:void 0,createdAt:"number"==typeof t.createdAt?t.createdAt:void 0,lastActivityAt:"number"==typeof t.lastActivityAt?t.lastActivityAt:void 0}}catch{return{}}}async function t$(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}async function tW(t){let e,[i,s,a]=await Promise.all([t$(t.auditPath),tz(t.metaPath),tO(t.workspaceDir)]),n=(e=new Map,i.forEach((t,s)=>{if("string"!=typeof t.uuid)return;let a=e.get(t.uuid);void 0===a?e.set(t.uuid,s):void 0===i[a].timestamp&&void 0!==t.timestamp&&e.set(t.uuid,s)}),i.filter((t,i)=>"string"!=typeof t.uuid||e.get(t.uuid)===i)),{mainLines:o,subagentGroups:r}=function(t){let e=[],i=new Map;for(let s of t){let t=s.parent_tool_use_id;if("string"==typeof t){let e=i.get(t);e?e.push(s):i.set(t,[s])}else e.push(s)}return{mainLines:e,subagentGroups:i}}(n),{meta:l,events:u}=p(o),d=function(t,e,i){if(0===t.size)return[];let s=new Map;for(let i of e){let e=i.message?.content;if(Array.isArray(e)){for(let a of e)if(a&&"object"==typeof a){if("tool_use"===a.type&&"Agent"===a.name&&"string"==typeof a.id){let t=a.input??{},e=s.get(a.id)??{};"string"==typeof i.uuid&&(e.parentUuid=i.uuid),"string"==typeof t.description&&(e.description=t.description),"string"==typeof t.subagent_type&&(e.agentType=t.subagent_type),"string"==typeof t.prompt&&(e.prompt=t.prompt),s.set(a.id,e)}else if("tool_result"===a.type&&"string"==typeof a.tool_use_id&&t.has(a.tool_use_id)){let t=s.get(a.tool_use_id)??{};t.finalText=function(t){if("string"==typeof t)return t;if(Array.isArray(t)){let e=[];for(let i of t)if(i&&"object"==typeof i&&"text"===i.type){let t=i.text;"string"==typeof t&&e.push(t)}if(e.length)return e.join("\n")}}(a.content)??t.finalText,s.set(a.tool_use_id,t)}}}}let a=[];for(let[e,n]of t){let t=W(n),o=s.get(e)??{},r=o.finalText??t.finalText,l=r?r.replace(/\s+/g," ").trim().slice(0,240):t.finalPreview,u=void 0!==i&&void 0!==t.startMs?Math.max(0,t.startMs-i):void 0,d=void 0!==i&&void 0!==t.endMs?Math.max(0,t.endMs-i):void 0,c=void 0!==t.startMs&&void 0!==t.endMs?t.endMs-t.startMs:void 0;a.push({agentId:e,agentType:o.agentType??"unknown",description:o.description??(o.prompt?o.prompt.replace(/\s+/g," ").trim().slice(0,80):"(no description)"),startMs:t.startMs,endMs:t.endMs,durationMs:c,startTOffsetMs:u,endTOffsetMs:d,eventCount:t.eventCount,totalUsage:t.totalUsage,parentUuid:o.parentUuid,parentToolUseId:e,runInBackground:!1,finalPreview:l,finalText:r,prompt:o.prompt,model:t.model,toolCalls:t.toolCalls,toolCallCount:t.toolCallCount,assistantMessageCount:t.assistantMessageCount})}return a.sort((t,e)=>(t.startMs??0)-(e.startMs??0)),a}(r,n,l.firstTimestamp?Date.parse(l.firstTimestamp):void 0),{projectName:c,projectDir:m,cwd:f}=function(t,e){let i;if(t.spaceId&&(i=e.get(t.spaceId)),!i&&t.userSelectedFolders&&t.userSelectedFolders.length>0&&(i=t.userSelectedFolders[0]),!i)return{projectName:"cowork:unspaced",projectDir:"cowork-unspaced"};let s=y(i);return{projectName:s.projectName,worktreeName:s.worktreeName,projectDir:i.replace(/^\//,"-").replace(/\//g,"-"),cwd:i}}(s,a);return{meta:{...l,agent:"cowork",id:t.sessionId,sessionId:t.sessionId,filePath:t.auditPath,projectName:c,projectDir:m,cwd:f??l.cwd,model:l.model??s.model},events:u,subagents:d}}function tE(t){return{auditMtimeMs:t.auditMtimeMs,auditSize:t.auditSize,metaMtimeMs:t.metaMtimeMs,spacesMtimeMs:t.spacesMtimeMs}}function tJ(t,e){return t.auditMtimeMs===e.auditMtimeMs&&t.auditSize===e.auditSize&&t.metaMtimeMs===e.metaMtimeMs&&t.spacesMtimeMs===e.spacesMtimeMs}let tL=new Map,tG=new Map;async function tq(t={}){let e=t.root??tP,i=await tB(e),s=[];for(let t of i){let e=tE(t),i=tL.get(t.auditPath);if(i&&tJ(i.key,e)){s.push(i.meta);continue}try{let{meta:i}=await tW(t);tL.set(t.auditPath,{meta:i,key:e}),s.push(i)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function tH(t,e={}){let i=e.root??tP,s=(await tB(i)).find(e=>e.sessionId===t);if(!s)return null;let a=tE(s),n=tG.get(s.auditPath);if(n&&tJ(n.key,a))return n.detail;let{meta:o,events:r,subagents:l}=await tW(s),u={...o,events:r,...l.length?{subagents:l}:{}};return tG.set(s.auditPath,{detail:u,key:a}),u}function tK(){let t=process.env.GROK_HOME||a.default.join(s.default.homedir(),".grok");return a.default.join(t,"sessions")}let tY=a.default.join(s.default.homedir(),".grok","sessions");async function tZ(t){return i.promises.readdir(t).catch(()=>[])}async function tQ(t){let e=await i.promises.readFile(t,"utf8").catch(()=>null);if(null==e)return null;try{return JSON.parse(e)}catch{return null}}async function tV(t,e){let s=a.default.join(t,".cwd"),n=await i.promises.readFile(s,"utf8").catch(()=>null);if(n&&n.trim())return n.trim();try{return decodeURIComponent(e)}catch{return e}}async function tX(t){let e=[];for(let s of(await tZ(t))){if("session_search.sqlite"===s||s.startsWith("."))continue;let n=a.default.join(t,s),o=await i.promises.stat(n).catch(()=>null);if(!o?.isDirectory())continue;let r=await tV(n,s);for(let t of(await tZ(n))){if("prompt_history.jsonl"===t||t.startsWith("."))continue;let o=a.default.join(n,t),l=a.default.join(o,"summary.json"),u=a.default.join(o,"updates.jsonl"),d=a.default.join(o,"signals.json"),[c,m,p]=await Promise.all([i.promises.stat(l).catch(()=>null),i.promises.stat(u).catch(()=>null),i.promises.stat(d).catch(()=>null)]);if(!c?.isFile())continue;let f=Math.max(c.mtimeMs,m?.mtimeMs??0),g=(m?.size??0)+c.size;e.push({dirPath:o,updatesPath:u,summaryPath:l,signalsPath:p?.isFile()?d:null,sessionId:t,groupName:s,decodedCwd:r,mtimeMs:f,sizeBytes:g})}}return e}function t0(){return{input:0,output:0,cacheRead:0,cacheWrite:0}}function t1(t){return t.replace(/\s+/g," ").trim().slice(0,200)}function t2(t){return t?"string"==typeof t?t:"string"==typeof t.text?t.text:"":""}async function t8(t){let e,s,a,n,r,[l,u,d]=await Promise.all([tQ(t.summaryPath),t.signalsPath?tQ(t.signalsPath):Promise.resolve(null),i.promises.readFile(t.updatesPath,"utf8").catch(()=>"")]),c=l?.info?.id??t.sessionId,m=l?.info?.cwd??t.decodedCwd,p=l?.current_model_id??u?.primaryModelId??u?.modelsUsed?.[0],f=[],g=t0();u?.contextTokensUsed&&u.contextTokensUsed>0&&(g.input=u.contextTokensUsed);let h=0,w=0,M=[],v=0,k=new Set,_=0;function N(t){f.push(t),function(t,i){if(!t||"meta"===i)return;e||(e=t),s=t;let a=Date.parse(t);Number.isFinite(a)&&M.push(a)}(t.timestamp,t.role)}let T=null;function j(){if(!T)return;let t=T.texts.join(""),e=t1(t);if("user"===T.kind){let i=!t||(0,o.isFrameworkInjectedUserInput)(t);t&&!i&&(a||(a=e),n=e,w+=1),t&&N({index:v++,timestamp:T.firstTs,role:"user",rawType:"grok/user_message",preview:e,blocks:[{type:"text",text:t}],messageId:T.promptId,raw:1===T.raw.length?T.raw[0]:T.raw})}else"agent"===T.kind?(t&&(r=e),t&&N({index:v++,timestamp:T.firstTs,role:"agent",rawType:"grok/agent_message",preview:e,blocks:[{type:"text",text:t}],messageId:T.promptId,model:T.model??p,raw:1===T.raw.length?T.raw[0]:T.raw})):"thought"===T.kind&&t&&N({index:v++,timestamp:T.firstTs,role:"agent-thinking",rawType:"grok/agent_thought",preview:e,blocks:[{type:"thinking",thinking:t}],messageId:T.promptId,model:T.model??p,raw:1===T.raw.length?T.raw[0]:T.raw});T=null}function b(t,e,i,s,a,n){(e||"user"!==t)&&(T&&T.kind!==t&&j(),T||(T={kind:t,texts:[],firstTs:i,lastTs:i,model:a,promptId:s,raw:[]}),e&&T.texts.push(e),T.lastTs=i??T.lastTs,a&&(T.model=a),s&&(T.promptId=s),T.raw.push(n))}for(let t of d.split("\n")){let e,i=t.trim();if(!i)continue;try{e=JSON.parse(i)}catch{continue}let s=e.params?.update;if(!s||"object"!=typeof s)continue;let a=s.sessionUpdate;if(!a)continue;let n=function(t){let e=t.params?._meta,i=e&&"number"==typeof e.agentTimestampMs?e.agentTimestampMs:void 0;if(null!=i&&Number.isFinite(i))return new Date(i).toISOString();let s=t.timestamp;if("number"==typeof s&&Number.isFinite(s))return new Date(s>1e12?s:1e3*s).toISOString()}(e),o=e.params?._meta??{},r=s._meta??{},l="string"==typeof o.promptId&&o.promptId||"string"==typeof r.promptId&&r.promptId||void 0,u="string"==typeof r.modelId&&r.modelId||"string"==typeof o.modelId&&o.modelId||void 0;u&&(p=u);let d=o.totalTokens;if("number"==typeof d&&d>_&&(_=d),"user_message_chunk"===a){b("user",t2(s.content),n,l,u,e);continue}if("agent_message_chunk"===a){b("agent",t2(s.content),n,l,u,e);continue}if("agent_thought_chunk"===a){b("thought",t2(s.content),n,l,u,e);continue}if(j(),"tool_call"===a){let t="string"==typeof s.toolCallId?s.toolCallId:`grok-${v}`,i=function(t){let e=t._meta;if(e&&"object"==typeof e){let t=e["x.ai/tool"];if(t&&"object"==typeof t){let e=t.name;if("string"==typeof e&&e)return e}}return"string"==typeof t.title&&t.title?(!t.title.includes(" ")&&!t.title.includes("`"),t.title):"tool"}(s),a=s.rawInput??{},o=a?JSON.stringify(a):"";h+=1,N({index:v++,timestamp:n,role:"tool-call",rawType:"grok/tool_call",preview:`${i}(${o.length<=80?o:o.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:t,name:i,input:a}],toolName:i,toolUseId:t,model:p,raw:e});continue}if("tool_call_update"===a){let t=function(t){let e=t.status;return"string"==typeof e?e:e&&"object"==typeof e&&"string"==typeof e.status?e.status:void 0}(s);if("completed"!==t&&"failed"!==t&&"error"!==t&&"cancelled"!==t)continue;let i="string"==typeof s.toolCallId?s.toolCallId:"";if(i&&k.has(i))continue;i&&k.add(i);let a=function(t){let e=t.content;if(Array.isArray(e)){let t=[];for(let i of e){if(!i||"object"!=typeof i)continue;if("string"==typeof i.text&&i.text){t.push(i.text);continue}let e=i.content;"string"==typeof e&&e?t.push(e):e&&"object"==typeof e&&"string"==typeof e.text&&t.push(e.text)}if(t.length)return t.join("\n")}let i=t.rawOutput;if(null==i)return"";if("string"==typeof i)return i;if("object"==typeof i){if("string"==typeof i.output_for_prompt)return i.output_for_prompt;if("string"==typeof i.summary_for_prompt)return i.summary_for_prompt;if(i.Content&&"object"==typeof i.Content){let t=i.Content;if("string"==typeof t.content)return t.content}if(i.TodosUpdated&&"object"==typeof i.TodosUpdated){let t=i.TodosUpdated;if("string"==typeof t.summary_for_prompt)return t.summary_for_prompt}if(Array.isArray(i.stdout)||Array.isArray(i.output))try{return JSON.stringify({type:i.type,exit_code:i.exit_code,note:"binary/stdout omitted"})}catch{return""}try{return JSON.stringify(i)}catch{return""}}return String(i)}(s),o="failed"===t||"error"===t||"cancelled"===t;N({index:v++,timestamp:n,role:"tool-result",rawType:"grok/tool_result",preview:t1(a),blocks:[{type:"tool_result",tool_use_id:i,content:a,is_error:o||void 0}],toolUseId:i||void 0,toolResult:a,raw:e});continue}if("turn_completed"===a)continue}j(),0===g.input&&_>0&&(g.input=_),!e&&l?.created_at&&(e=l.created_at),s||(s=l?.last_active_at??l?.updated_at??e),u?.toolCallCount!=null&&u.toolCallCount>h&&(h=u.toolCallCount),u?.turnCount!=null&&u.turnCount>w&&(w=u.turnCount);let I=e?Date.parse(e):void 0;if(void 0!==I&&Number.isFinite(I)){let t;for(let e of f){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-I),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let C=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++){let n=e[t];n-a>18e4&&(i.push({startMs:s,endMs:a}),s=n),a=n}return i.push({startMs:s,endMs:a}),i}(M),x=C.reduce((t,e)=>t+(e.endMs-e.startMs),0),S=e&&s?Date.parse(s)-Date.parse(e):void 0,A=m?y(m):void 0,P=A?.projectName??m??t.decodedCwd,D=t.groupName||(m?encodeURIComponent(m):"(unknown)");if(!a){let t=l?.generated_title||l?.session_summary;t&&(a=t1(t))}let U=await t4(t.dirPath);return{meta:{agent:"grok",id:c,filePath:t.updatesPath,projectName:P,worktreeName:A?.worktreeName,repoName:A?.repoName,projectDir:D,sessionId:c,firstTimestamp:e,lastTimestamp:s,lastActivityMs:s?Date.parse(s):void 0,durationMs:S&&Number.isFinite(S)?S:void 0,eventCount:f.length,model:p,cwd:m,gitBranch:l?.head_branch,agentName:l?.agent_name,totalUsage:g,status:"idle",firstUserPreview:a,lastUserPreview:n,lastAgentPreview:r,toolCallCount:h,turnCount:w,linesAdded:u?.agentLinesAdded,linesRemoved:u?.agentLinesRemoved,airTimeMs:x,activeSegments:C,...U>0?{spawnedAgentCount:U}:{}},events:f,sessionKind:l?.session_kind}}async function t4(t){let e=a.default.join(t,"subagents"),s=await tZ(e),n=0;for(let t of s){let s=await i.promises.stat(a.default.join(e,t)).catch(()=>null);s?.isDirectory()&&(n+=1)}return n}async function t3(t,e){let i=a.default.join(t.dirPath,"subagents"),s=await tZ(i),n=a.default.dirname(t.dirPath),o=[];for(let t of s){let s=a.default.join(i,t,"meta.json"),r=await tQ(s);if(!r)continue;let l=r.child_session_id??r.subagent_id??t,u=a.default.join(n,l),[d,c]=await Promise.all([tQ(a.default.join(u,"summary.json")),tQ(a.default.join(u,"signals.json"))]),m=d?.created_at?Date.parse(d.created_at):void 0,p=d?.last_active_at??d?.updated_at,f=p?Date.parse(p):void 0,g=void 0!==m&&Number.isFinite(m)?m:void 0,y=void 0!==f&&Number.isFinite(f)?f:void 0,h=t0();c?.contextTokensUsed&&(h.input=c.contextTokensUsed),o.push({agentId:l,agentType:r.subagent_type??d?.agent_name??"subagent",description:r.description&&r.description.trim()||d?.generated_title||d?.session_summary||l,startMs:g,endMs:y,durationMs:void 0!==g&&void 0!==y?Math.max(0,y-g):void 0,startTOffsetMs:void 0!==e&&void 0!==g?Math.max(0,g-e):void 0,endTOffsetMs:void 0!==e&&void 0!==y?Math.max(0,y-e):void 0,eventCount:d?.num_messages??d?.num_chat_messages??0,totalUsage:h,prompt:"string"==typeof r.prompt?r.prompt:void 0,model:d?.current_model_id??c?.primaryModelId,toolCallCount:c?.toolCallCount})}return o.sort((t,e)=>(t.startMs??0)-(e.startMs??0)),o}let t9=new Map,t6=new Map;async function t7(t={}){let e=t.root??tK(),i=await tX(e),s=[];for(let t of i){let e=await tQ(t.summaryPath);if(e?.session_kind==="subagent")continue;let i=t9.get(t.dirPath);if(i&&i.mtimeMs===t.mtimeMs&&i.sizeBytes===t.sizeBytes){s.push(i.meta);continue}try{let{meta:e,sessionKind:i}=await t8(t);if("subagent"===i)continue;t9.set(t.dirPath,{meta:e,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),s.push(e)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function t5(t,e={}){let i=e.root??tK(),s=await tX(i),a=s.find(e=>e.sessionId===t);if(!a){for(let e of s)try{let{meta:i,events:s}=await t8(e);if(i.id===t){let t={...i,events:s};return t6.set(e.dirPath,{detail:t,mtimeMs:e.mtimeMs,sizeBytes:e.sizeBytes}),t}}catch{}return null}let n=t6.get(a.dirPath);if(n&&n.mtimeMs===a.mtimeMs&&n.sizeBytes===a.sizeBytes)return n.detail;let{meta:o,events:r}=await t8(a),l=o.firstTimestamp?Date.parse(o.firstTimestamp):void 0,u=await t3(a,void 0!==l&&Number.isFinite(l)?l:void 0),d={...o,events:r,...u.length>0?{subagents:u,spawnedAgentCount:u.length}:{}};return t6.set(a.dirPath,{detail:d,mtimeMs:a.mtimeMs,sizeBytes:a.sizeBytes}),t9.set(a.dirPath,{meta:{...o,...u.length>0?{spawnedAgentCount:u.length}:{}},mtimeMs:a.mtimeMs,sizeBytes:a.sizeBytes}),d}function et(){return process.env.CCLENS_HOME||a.default.join(s.default.homedir(),".cclens")}function ee(...t){return a.default.join(et(),...t)}function ei(t){b(t)}let es=[G,{...n.CODEX_METADATA,defaultRoot:q,listSessions:async t=>ts(t),getSession:async t=>ta(t)},{...n.GEMINI_METADATA,defaultRoot:tn,listSessions:async t=>tM(t),getSession:async t=>tv(t)},{...n.ANTIGRAVITY_METADATA,defaultRoot:tk,listSessions:async t=>tS(t),getSession:async t=>tA(t)},{...n.COWORK_METADATA,defaultRoot:tP,listSessions:async t=>tq(t),getSession:async t=>tH(t)},{...n.GROK_METADATA,defaultRoot:tY,listSessions:async t=>t7(t),getSession:async(t,e)=>t5(t,e)}];async function ea(t={}){let e=await Promise.all(es.map(e=>e.listSessions(t))),i=[];for(let t of e)i.push(...t);return(i.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?i.slice(0,t.limit):i}async function en(t){for(let e of es){let i=await e.getSession(t);if(i)return i}return null}function eo(){return ee("usage.jsonl")}function er(t){let e=eo();(0,i.mkdirSync)(a.default.dirname(e),{recursive:!0}),(0,i.appendFileSync)(e,JSON.stringify(t)+"\n","utf8")}function el(t){let e=eo();if(!(0,i.existsSync)(e))return;let s=(0,i.readFileSync)(e,"utf8").split("\n").filter(e=>{if(!e.trim())return!1;try{return JSON.parse(e).agent!==t}catch{return!0}});(0,i.mkdirSync)(a.default.dirname(e),{recursive:!0}),(0,i.writeFileSync)(e,s.join("\n")+(s.length?"\n":""),"utf8")}}];
1
+ module.exports=[39587,t=>{"use strict";let e={kind:"claude-code",displayName:"Claude Code",shortLabel:"Claude",accentColor:"var(--af-accent)",iconChar:"✦"},i={kind:"codex",displayName:"Codex (OpenAI)",shortLabel:"Codex",accentColor:"rgb(16, 163, 127)",iconChar:"◆"},s={kind:"copilot",displayName:"GitHub Copilot CLI",shortLabel:"Copilot",accentColor:"rgb(137, 87, 229)",iconChar:"∞"},a={kind:"gemini",displayName:"Gemini CLI",shortLabel:"Gemini",accentColor:"rgb(124, 92, 246)",iconChar:"✺"},n={kind:"antigravity",displayName:"Antigravity",shortLabel:"Agy",accentColor:"rgb(236, 72, 153)",iconChar:"⏃"},o={kind:"cowork",displayName:"Cowork",shortLabel:"Cowork",accentColor:"rgb(217, 119, 87)",iconChar:"⌘"},r={kind:"grok",displayName:"Grok Build",shortLabel:"Grok",accentColor:"rgb(100, 116, 139)",iconChar:"◈"},l=[e,i,s,a,n,o,{kind:"zai",displayName:"Z.ai",shortLabel:"Z.ai",accentColor:"rgb(59, 130, 246)",iconChar:"Z"},r];l.map(t=>t.kind),t.s(["ANTIGRAVITY_METADATA",0,n,"CLAUDE_CODE_METADATA",0,e,"CODEX_METADATA",0,i,"COPILOT_METADATA",0,s,"COWORK_METADATA",0,o,"GEMINI_METADATA",0,a,"GROK_METADATA",0,r,"agentMetadata",0,l])},36521,t=>{"use strict";let e=[/<system_instruction\b[^>]*>[\s\S]*?<\/system_instruction>\s*/gi],i=["<command-name>","<local-command-stdout>","<local-command-caveat>","<task-notification>","Base directory for this skill:","This session is being continued from a previous conversation","A session-scoped Stop hook is now active"];function s(t){if(!t)return t;let i=t;for(let t of e)i=i.replace(t,"");return i.trim()}t.s(["isFrameworkInjectedUserInput",0,function(t){if(!t)return!1;let e=s(t);if(!e)return!0;for(let t of i)if(e.startsWith(t))return!0;return!1},"stripFrameworkBoilerplate",0,s])},79357,t=>{"use strict";let e={input:0,output:0,cacheRead:0,cacheWrite:0},i=["/.claude/worktrees/","/.worktrees/","/claude/worktrees/"],s=/\/conductor\/workspaces\/[^/]+\/([^/]+)(?:\/|$)/;function a(t){for(let e of i){let i=t.lastIndexOf(e);if(i>=0)return{idx:i,marker:e}}return null}function n(t){let e=s.exec(t);if(!e)return null;let i=e[1],a=+!!e[0].endsWith("/");return{canonicalEndIdx:e.index+e[0].length-i.length-1-a,workspaceName:i}}let o="/.superset/worktrees/",r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function l(t){let e=t.indexOf(o);if(e<0)return null;let i=t.slice(e+o.length).split("/").filter(Boolean);if(0===i.length)return null;let s=r.test(i[0])?i[1]??i[0]:i[0];return{canonical:t.slice(0,e)+o+s,workspaceName:s}}function u(t){let e=t.replace(/\/{2,}/g,"/"),i=a(e);if(i)return e.slice(0,i.idx);let s=n(e);if(s)return e.slice(0,s.canonicalEndIdx);let o=l(e);return o?o.canonical:e}function c(t){let e=t.replace(/\/{2,}/g,"/"),i=a(e);if(i){let t=e.slice(i.idx+i.marker.length),s=t.indexOf("/");return s>=0?t.slice(0,s):t}let s=n(e);if(s)return s.workspaceName;let o=l(e);return o?o.workspaceName:null}function d(t){let e=u(t),i=e.replace(/\/+$/,"").split("/").filter(Boolean);return i[i.length-1]||e}function m(t){let i={sessionCount:t.length,totalDurationMs:0,totalAirTimeMs:0,totalTokens:{...e},totalToolCalls:0,totalTurns:0,avgTurnsPerSession:0,avgDurationMs:0,totalLinesAdded:0,totalLinesRemoved:0,totalFilesEdited:0};for(let e of t)i.totalDurationMs+=e.durationMs??0,i.totalAirTimeMs+=e.airTimeMs??e.durationMs??0,i.totalTokens.input+=e.totalUsage.input,i.totalTokens.output+=e.totalUsage.output,i.totalTokens.cacheRead+=e.totalUsage.cacheRead,i.totalTokens.cacheWrite+=e.totalUsage.cacheWrite,i.totalToolCalls+=e.toolCallCount??0,i.totalTurns+=e.turnCount??0,i.totalLinesAdded+=e.linesAdded??0,i.totalLinesRemoved+=e.linesRemoved??0,i.totalFilesEdited+=e.filesEdited??0;return t.length>0&&(i.avgTurnsPerSession=i.totalTurns/t.length,i.avgDurationMs=i.totalDurationMs/t.length),i}t.s(["canonicalProjectName",0,u,"computeBurstsFromSessions",0,function(t,e={}){let i=[];for(let e of t)e.activeSegments&&0!==e.activeSegments.length&&i.push({id:e.id,projectDir:e.projectDir,segments:e.activeSegments});return function(t,e){let i=e.minDurationMs??6e4,s=e.mergeGapMs??6e5,a=e.minActive??2,n=[];for(let e of t)for(let t of e.segments)t.endMs<=t.startMs||(n.push({ms:t.startMs,delta:1,sessionId:e.id}),n.push({ms:t.endMs,delta:-1,sessionId:e.id}));n.sort((t,e)=>t.ms-e.ms||e.delta-t.delta);let o=new Map,r=[],l=null;for(let t of n){if(1===t.delta)o.set(t.sessionId,(o.get(t.sessionId)??0)+1);else{let e=(o.get(t.sessionId)??0)-1;e<=0?o.delete(t.sessionId):o.set(t.sessionId,e)}let e=o.size;if(e>=a)if(l)for(let i of(l.endMs=t.ms,e>l.peak&&(l.peak=e),o.keys()))l.sessionIds.add(i);else l={startMs:t.ms,endMs:t.ms,peak:e,sessionIds:new Set(o.keys())};else l&&(l.endMs=t.ms,r.push(l),l=null)}l&&r.push(l);let u=r.filter(t=>t.endMs-t.startMs>=i),c=[];for(let t of u){let e=c[c.length-1];if(e&&t.startMs-e.endMs<=s)for(let i of(e.endMs=t.endMs,t.peak>e.peak&&(e.peak=t.peak),t.sessionIds))e.sessionIds.add(i);else c.push({startMs:t.startMs,endMs:t.endMs,peak:t.peak,sessionIds:new Set(t.sessionIds)})}let d=new Map;for(let e of t)d.set(e.id,e.projectDir);return c.map(t=>{let e=Array.from(new Set(Array.from(t.sessionIds).map(t=>d.get(t)).filter(t=>!!t)));return{startMs:t.startMs,endMs:t.endMs,peak:t.peak,sessionIds:Array.from(t.sessionIds),projectDirs:e,crossProject:e.length>1}})}(i,e)},"groupByProject",0,function(t){let e=new Map,i=function(t){let e=new Map;for(let i of t)i.repoName&&e.set(d(i.projectName),i.repoName);return t=>t.repoName??e.get(d(t.projectName))??d(t.projectName)}(t);for(let s of t){let t=i(s),a=e.get(t);a||(a={projectDir:t,projectName:t,sessions:[],rawProjectDirs:[],worktreeCount:0,metrics:m([]),perAgent:[],lastActiveMs:void 0},e.set(t,a)),a.sessions.push(s),a.rawProjectDirs.includes(s.projectDir)||a.rawProjectDirs.push(s.projectDir);let n=s.lastTimestamp?Date.parse(s.lastTimestamp):void 0;n&&(!a.lastActiveMs||n>a.lastActiveMs)&&(a.lastActiveMs=n)}for(let t of e.values()){t.metrics=m(t.sessions);let e=new Set;for(let i of t.sessions){let t=i.worktreeName??c(i.projectName)??(i.cwd?c(i.cwd):null);t&&e.add(t)}t.worktreeCount=e.size;let i=new Map;for(let e of t.sessions){let t=e.agent??"claude-code",s=i.get(t);s||(s={agent:t,sessions:0},i.set(t,s)),s.sessions+=1}t.perAgent=Array.from(i.values()).sort((t,e)=>e.sessions-t.sessions)}return Array.from(e.values()).sort((t,e)=>(e.lastActiveMs??0)-(t.lastActiveMs??0))},"projectKey",0,d,"toLocalDay",0,function(t){let e=new Date(t),i=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${i}-${s}-${a}`},"worktreeName",0,c])},43427,20629,t=>{"use strict";let e;t.s(["agentSources",()=>eh,"appendUsageSnapshot",()=>ek,"cclensHome",()=>ef,"cclensPath",()=>eg,"getAnySession",()=>eM,"invalidateFile",()=>ey,"listAllSessions",()=>ew,"pruneUsageAgent",()=>e_],43427);var i=t.i(2157),s=t.i(60526),a=t.i(50227),n=t.i(39587),o=t.i(36521),r=t.i(79357);let l={input:0,output:0,cacheRead:0,cacheWrite:0};function u(t,e=200){let i=t.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();return i.length>e?i.slice(0,e-1)+"…":i}let c=/^\s*<teammate-message\s+teammate_id="([^"]+)"[^>]*>([\s\S]*?)<\/teammate-message>/;function d(t){let e=t.match(c);if(!e)return;let i=e[1],s=e[2].trim(),a="message";if(s.startsWith("{"))try{let t=JSON.parse(s);"idle_notification"===t.type?a="idle-notification":"shutdown_request"===t.type?a="shutdown-request":"shutdown_approved"===t.type?a="shutdown-approved":"task_assignment"===t.type?a="task-assignment":"teammate_terminated"===t.type&&(a="teammate-terminated")}catch{}return{teammateId:i,body:s,kind:a}}function m(t){if(!t||"object"!=typeof t)return;let e=t=>"number"==typeof t?t:0;return{input:e(t.input_tokens),output:e(t.output_tokens),cacheRead:e(t.cache_read_input_tokens),cacheWrite:e(t.cache_creation_input_tokens)}}function p(t){let e,i,s,a,n,c,p,f,g,y,h,w=[];for(let e=0;e<t.length;e++){let i=function(t,e){if(!t||"object"!=typeof t)return null;let i=String(t.type??""),s=t.uuid,a=t.parentUuid??null,n=t.timestamp;if("assistant"===i){let o,r,l,c=t.message??{},d=c.content??[],p=m(c.usage),f=c.model,g=t.requestId,y=c.id,h=c.stop_reason,w=d[0],M="agent";return w?.type==="thinking"?(M="agent-thinking",o="[thinking] "+u(w.thinking,140)):w?.type==="tool_use"?(M="tool-call",r=w.name,l=w.id,o=`${w.name} `+u(JSON.stringify(w.input??{}),100)):o=w?.type==="text"?u(w.text,200):`<assistant:${w?.type??"empty"}>`,{index:e,uuid:s,parentUuid:a,timestamp:n,role:M,rawType:i,preview:o,blocks:d,usage:p,model:f,requestId:g,messageId:y,stopReason:h,toolName:r,toolUseId:l,raw:t}}if("user"===i){let r=(t.message??{}).content;if("string"==typeof r){let l=(0,o.stripFrameworkBoilerplate)(r),c=d(l);return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"user",rawType:i,preview:u(l,200),blocks:l?[{type:"text",text:l}]:[],raw:t,teammateMessage:c}}if(Array.isArray(r)){let l=r[0];if(l?.type==="tool_result")return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"tool-result",rawType:i,preview:u("string"==typeof l.content?l.content:JSON.stringify(l.content),200),blocks:r,toolUseId:l.tool_use_id,toolResult:t.toolUseResult,raw:t};let c=r.find(t=>t?.type==="text"),m=c?(0,o.stripFrameworkBoilerplate)(c.text):"",p=c?r.map(t=>t===c?{type:"text",text:m}:t):r,f=m?d(m):void 0;return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"user",rawType:i,preview:m?u(m,200):u(JSON.stringify(r),200),blocks:p,raw:t,teammateMessage:f}}}if("attachment"===i){let o=t.attachment??{},r=String(o.type??"attachment"),l=`<attachment: ${r}>`;return"string"==typeof o.content&&o.content.length>0?l=`[${r}] `+u(o.content,140):Array.isArray(o.addedNames)&&(l=`[${r}] +${o.addedNames.length} names`),{index:e,uuid:s,parentUuid:a,timestamp:n,role:"system",rawType:i,preview:l,blocks:[{type:"text",text:JSON.stringify(o,null,2)}],attachmentType:r,raw:t}}return{index:e,uuid:s,parentUuid:a,timestamp:n,role:"meta",rawType:i||"unknown",preview:`${i}: ${u(JSON.stringify(t),140)}`,blocks:[{type:"text",text:JSON.stringify(t,null,2)}],raw:t}}(t[e],e);i&&w.push(i)}for(let t of w){if(!t.timestamp)continue;let s=Date.parse(t.timestamp);!Number.isNaN(s)&&((void 0===e||s<e)&&(e=s),(void 0===i||s>i)&&(i=s))}let M=void 0!==e?new Date(e).toISOString():void 0,v=void 0!==i?new Date(i).toISOString():void 0;for(let t of w){if(!t.timestamp)continue;let i=Date.parse(t.timestamp);Number.isNaN(i)||void 0!==e&&(t.tOffsetMs=Math.max(0,i-e))}let k=w.filter(t=>{let e;return t.timestamp&&("user"===(e=t.role)||"agent"===e||"agent-thinking"===e||"tool-call"===e||"tool-result"===e)}).map(t=>({e:t,ms:Date.parse(t.timestamp)})).filter(t=>!Number.isNaN(t.ms)).sort((t,e)=>t.ms-e.ms);for(let t=1;t<k.length;t++)k[t].e.gapMs=Math.max(0,k[t].ms-k[t-1].ms);let _=w.filter(t=>t.timestamp).map(t=>Date.parse(t.timestamp)).filter(t=>!Number.isNaN(t)).sort((t,e)=>t-e),N=[],T=0;if(_.length>0){let t=_[0],e=_[0];for(let i=1;i<_.length;i++){let s=_[i],a=s-e;a>18e4?(N.push({startMs:t,endMs:e}),t=s):a>0&&(T+=a),e=s}N.push({startMs:t,endMs:e})}let j=new Map,b=[];for(let t of w){if(!t.timestamp)continue;let e=Date.parse(t.timestamp);if(!Number.isNaN(e)){if("assistant"===t.rawType&&t.usage&&t.messageId){let i=j.get(t.messageId);i?(i.siblings.push(t),e<i.ms&&(i.rep=t,i.ms=e)):j.set(t.messageId,{rep:t,ms:e,siblings:[t]})}else if("system"===t.rawType){let i=t.raw;if(i?.subtype!=="compact_boundary")continue;let s=i.compactMetadata??{};b.push({ms:e,trigger:"manual"===s.trigger?"manual":"auto",preTokens:"number"==typeof s.preTokens?s.preTokens:0})}}}let I=[...j.values()].sort((t,e)=>t.ms-e.ms);b.sort((t,e)=>t.ms-e.ms);let C=0,x=0,S=(t,e)=>{for(let i of t.siblings)i.coldResume=e;C++,x+=e.writeTokens},A=new Set;for(let t of b){let e,i=I.find(e=>e.ms>t.ms&&(e.rep.usage?.cacheWrite??0)>=1e3);if(!i)continue;for(let i=I.length-1;i>=0;i--)if(I[i].ms<=t.ms){e=I[i].ms;break}let s=i.rep.usage,a=s.cacheWrite+s.cacheRead;S(i,{trigger:"compact",gapMs:void 0!==e?i.ms-e:0,writeTokens:s.cacheWrite,writeRatio:a>0?s.cacheWrite/a:0,compact:{trigger:t.trigger,preTokens:t.preTokens}}),A.add(i.rep.messageId)}for(let t=1;t<I.length;t++){let e=I[t-1],i=I[t];if(A.has(i.rep.messageId))continue;let s=i.rep.usage,a=s.cacheWrite+s.cacheRead,n=a>0?s.cacheWrite/a:0,o=i.ms-e.ms;o>3e5&&s.cacheWrite>=1e3&&n>=.3&&S(i,{trigger:"idle",gapMs:o,writeTokens:s.cacheWrite,writeRatio:n})}let P={...l},D=new Set,U="",R=!1,B=!1,z=0,F=0,O=0,$=0,W=new Set,E=new Map,L=void 0!==e?(0,r.toLocalDay)(e):void 0,J=t=>{let e;if(t){let i=Date.parse(t);Number.isNaN(i)||(e=(0,r.toLocalDay)(i))}if(!(e=e??L))return;let i=E.get(e);return i||(i={toolCalls:0,turns:0,tokens:{...l}},E.set(e,i)),i};for(let t of w){if("tool-call"===t.role){z++;let e=J(t.timestamp);e&&e.toolCalls++;let i=t.blocks.find(t=>t&&"tool_use"===t.type);if(i){let t=i.input??{};if("TeamCreate"===i.name&&(R=!0),"SendMessage"===i.name){let e="string"==typeof t.to?t.to:"";e&&"team-lead"!==e&&(B=!0)}let e="string"==typeof t.file_path?t.file_path:void 0;if("Edit"===i.name&&e){W.add(e);let i="string"==typeof t.old_string?t.old_string:"",s="string"==typeof t.new_string?t.new_string:"",a=i?i.split("\n").length:0,n=s?s.split("\n").length:0;O+=Math.max(0,n-a),$+=Math.max(0,a-n)}else if("Write"===i.name&&e){W.add(e);let i="string"==typeof t.content?t.content:"";O+=i?i.split("\n").length:0}}}if("user"===t.role){let e=function(t){let e=t?.content;if("string"==typeof e)return e;if(Array.isArray(e)){for(let t of e)if(t&&"object"==typeof t&&"text"===t.type&&"string"==typeof t.text)return t.text}return""}(t.raw?.message),i=(0,o.isFrameworkInjectedUserInput)(e),s=void 0!==t.teammateMessage&&!f;if(!i&&!s){g||(g=t.teammateMessage?t.teammateMessage.body:t.preview),F++;let e=J(t.timestamp);e&&e.turns++,h=t.preview}}"agent"===t.role&&(y=t.preview)}for(let e of t)if(e&&"object"==typeof e&&("string"!=typeof e.sessionId||U||(U=e.sessionId),"string"!=typeof e.cwd||a||(a=e.cwd),"string"!=typeof e.gitBranch||n||(n=e.gitBranch),"string"!=typeof e.entrypoint||c||(c=e.entrypoint),"string"!=typeof e.teamName||p||(p=e.teamName),"string"!=typeof e.agentName||f||(f=e.agentName),"assistant"===e.type)){let t=e.message;if(t){"string"!=typeof t.model||s||(s=t.model);let i="string"==typeof t.id?t.id:void 0;if(i&&D.has(i))continue;i&&D.add(i);let a=m(t.usage);if(a){P.input+=a.input,P.output+=a.output,P.cacheRead+=a.cacheRead,P.cacheWrite+=a.cacheWrite;let t=J("string"==typeof e.timestamp?e.timestamp:void 0);t&&(t.tokens.input+=a.input,t.tokens.output+=a.output,t.tokens.cacheRead+=a.cacheRead,t.tokens.cacheWrite+=a.cacheWrite)}}}return{events:w,meta:{sessionId:U,firstTimestamp:M,lastTimestamp:v,durationMs:void 0!==e&&void 0!==i?i-e:void 0,eventCount:w.length,model:s,cwd:a,gitBranch:n,entrypoint:c,totalUsage:P,status:"idle",firstUserPreview:g,lastUserPreview:h,lastAgentPreview:y,toolCallCount:z,turnCount:F,dailyBreakdown:Array.from(E.entries()).map(([t,e])=>({day:t,toolCalls:e.toolCalls,turns:e.turns,tokens:e.tokens})).sort((t,e)=>t.day.localeCompare(e.day)),airTimeMs:T,activeSegments:N,linesAdded:O,linesRemoved:$,filesEdited:W.size,coldResumeCount:C,cacheRebuildTokens:x,teamName:p,agentName:f,isTeamLead:void 0!==p&&void 0===f&&(R||B)}}}let f=/^(?:(?:https?|ssh|git):\/\/)?(?:[^@/]+@)?([^/:]+)[:/](.+?)(?:\.git)?\/?$/;function g(t){try{return(0,i.realpathSync)(t)}catch{return t}}function y(t){let e=g(t.replace(/\/{2,}/g,"/"));try{let t=function(t){let e;if(!t||!(0,a.isAbsolute)(t))return null;let n=(e=g((0,s.homedir)()),t===e||t.startsWith(`${e}/`)?e:void 0);for(let e=t.replace(/\/+$/,"")||t;;e=(0,a.dirname)(e)){if(e===n)return null;let t=function(t){let e=(0,a.join)(t,".git"),s=(0,i.statSync)(e,{throwIfNoEntry:!1});if(!s)return null;if(s.isDirectory())return{root:t,gitDir:e,commonDir:e};let n=function(t,e){let i=e.match(/^gitdir:\s*(.+)\s*$/m);if(!i)return;let s=i[1].trim();return(0,a.isAbsolute)(s)?s:(0,a.resolve)(t,s)}(t,(0,i.readFileSync)(e,"utf8"));return n?{root:t,gitDir:n,commonDir:function(t){let e=(0,a.join)(t,"commondir");if(!(0,i.existsSync)(e))return;let s=(0,i.readFileSync)(e,"utf8").trim();if(s)return(0,a.isAbsolute)(s)?s:(0,a.resolve)(t,s)}(n)}:{root:t}}(e);if(t)return t;if((0,a.dirname)(e)===e)return null}}(e);if(t){let s=g(function(t){if(t)return".git"===(0,a.basename)(t)?(0,a.dirname)(t):void 0}(t.commonDir)??t.root),n=g(t.root),o=s!==n?(0,r.worktreeName)(e)??(0,a.basename)(t.root):void 0,l={projectName:s};o&&(l.worktreeName=o);let u=function(t){let e=t.commonDir??t.gitDir;if(!e)return;let s=(0,a.join)(e,"config");if(!(0,i.existsSync)(s))return;let n=function(t){let e=!1;for(let i of t.split("\n")){let t=i.trim();if(t.startsWith("[")){e=/^\[remote\s+"origin"\]/.test(t);continue}if(!e)continue;let s=t.match(/^url\s*=\s*(.+)$/);if(s)return s[1].trim()}}((0,i.readFileSync)(s,"utf8"));return n?function(t){let e=t.match(f);if(!e)return;let i=e[1],s=e[2].split("/").filter(Boolean);if(s.length<2)return;let a=s[s.length-1],n=s.slice(0,-1).join("/");return{host:i,owner:n,name:a,url:t,webUrl:`https://${i}/${n}/${a}`}}(n):void 0}(t);return u&&(l.remote=u,l.repoName=u.name),l}}catch{}let n=(0,r.canonicalProjectName)(e),o=(0,r.worktreeName)(e)??void 0;return o?{projectName:n,worktreeName:o}:{projectName:n}}let h=a.default.join(s.default.homedir(),".claude","projects");function w(t){return t.startsWith("-")?"/"+t.slice(1).replace(/-/g,"/"):t}let M=a.default.join(s.default.homedir(),".cclens","runtime").replace(/[/.]/g,"-");async function v(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}function k(t){return t.replace(/\.jsonl$/i,"")}let _=new Map,N=new Map,T=new Map,j=null;function b(t){_.delete(t),N.delete(t),T.delete(t),j=null}async function I(t=h){let e;if(j&&j.root===t&&Date.now()-j.capturedAtMs<1e3)return j.files;try{e=await i.promises.readdir(t,{withFileTypes:!0})}catch{return[]}let s=e.filter(t=>t.isDirectory()&&t.name!==M).map(t=>t.name),n=(await Promise.all(s.map(async e=>{let s,n=a.default.join(t,e);try{s=await i.promises.readdir(n)}catch{return[]}let o=s.filter(t=>t.endsWith(".jsonl"));return(await Promise.all(o.map(async t=>{let s=a.default.join(n,t);try{let a=await i.promises.stat(s);return{projectDir:e,fileName:t,fullPath:s,mtimeMs:a.mtimeMs,sizeBytes:a.size}}catch{return null}}))).filter(t=>null!==t)}))).flat();return j={files:n,capturedAtMs:Date.now(),root:t},n}let C={input:0,output:0,cacheRead:0,cacheWrite:0};function x(t,e,i,s,a){for(let n of t){if(!n||"object"!=typeof n||"assistant"!==n.type)continue;let t=n.message;if(!t)continue;let o="string"==typeof t.id?t.id:void 0,l="string"==typeof n.requestId?n.requestId:void 0,u=null!=o&&null!=l?`${o}:${l}`:void 0;if(u&&e.has(u))continue;u&&e.add(u);let c=t.usage;if(c){let t=t=>"number"==typeof t?t:0,e=t(c.input_tokens),o=t(c.output_tokens),l=t(c.cache_read_input_tokens),u=t(c.cache_creation_input_tokens);if(i.input+=e,i.output+=o,i.cacheRead+=l,i.cacheWrite+=u,s){let t,i="string"==typeof n.timestamp?n.timestamp:void 0;if(i){let e=Date.parse(i);Number.isNaN(e)||(t=(0,r.toLocalDay)(e))}if(t=t??a){let i=s.get(t);i||(i={...C},s.set(t,i)),i.input+=e,i.output+=o,i.cacheRead+=l,i.cacheWrite+=u}}}}}async function S(t,e,s,n){let o,r={...C},l=new Set,u=new Map;x(t,l,r,u,n);let c=a.default.join(e,s,"subagents");try{o=await i.promises.readdir(c)}catch{return{usage:r,perDay:u}}let d=o.filter(t=>t.endsWith(".jsonl"));return 0===d.length||await Promise.all(d.map(async t=>{try{let e=await v(a.default.join(c,t));x(e,l,r,u,n)}catch{}})),{usage:r,perDay:u}}async function A(t,e){let s,n=a.default.join(t,e,"workflows");try{s=await i.promises.readdir(n)}catch{return{workflowCount:0,spawnedAgentCount:0,spans:[]}}let o=s.filter(t=>t.startsWith("wf_")&&t.endsWith(".json"));if(0===o.length)return{workflowCount:0,spawnedAgentCount:0,spans:[]};let r=0,l=[];return{workflowCount:(await Promise.all(o.map(async t=>{try{let e=JSON.parse(await i.promises.readFile(a.default.join(n,t),"utf8"));return"number"==typeof e.agentCount&&(r+=e.agentCount),"number"==typeof e.startTime&&"number"==typeof e.durationMs&&e.durationMs>0&&l.push({startMs:e.startTime,endMs:e.startTime+e.durationMs}),!0}catch{return!1}}))).filter(Boolean).length,spawnedAgentCount:r,spans:l}}async function P(t,e){let s;try{s=await i.promises.readdir(t,{withFileTypes:!0})}catch{return 0}return(await Promise.all(s.map(async s=>{let n=a.default.join(t,s.name);try{if(s.isDirectory())return e>0?await P(n,e-1):0;return(await i.promises.stat(n)).mtimeMs}catch{return 0}}))).reduce((t,e)=>Math.max(t,e),0)}async function D(t,e){let i=a.default.join(t,e),[s,n]=await Promise.all([P(a.default.join(i,"subagents"),2),P(a.default.join(i,"workflows"),0)]),o=Math.max(s,n);return o>0?o:void 0}async function U(t,e){let i=await D(a.default.dirname(e.fullPath),t.id),s=t.lastTimestamp?Date.parse(t.lastTimestamp):0,n=Math.max(Number.isFinite(s)?s:0,i??0);return n>0?{...t,lastActivityMs:n}:t}function R(t,e){if(0===e.length)return{};let i=[...t??[],...e].filter(t=>t.endMs>t.startMs).sort((t,e)=>t.startMs-e.startMs);if(0===i.length)return{};let s=[{...i[0]}];for(let t=1;t<i.length;t++){let e=i[t],a=s[s.length-1];e.startMs<=a.endMs?a.endMs=Math.max(a.endMs,e.endMs):s.push({...e})}let a=s.reduce((t,e)=>t+(e.endMs-e.startMs),0);return{activeSegments:s,airTimeMs:a}}async function B(t,e,i){let s=k(i.fileName),n=a.default.dirname(i.fullPath),o=t.firstTimestamp?(0,r.toLocalDay)(Date.parse(t.firstTimestamp)):void 0,{usage:l,perDay:u}=await S(e,n,s,o);t.totalUsage=l,t.dailyBreakdown=function(t,e,i){let s=new Map((t??[]).map(t=>[t.day,t])),a=[...new Set([...s.keys(),...e.keys()])].sort((t,e)=>t.localeCompare(e)).map(t=>({day:t,toolCalls:s.get(t)?.toolCalls??0,turns:s.get(t)?.turns??0,tokens:{...e.get(t)??C}}));if(a.length>0){let t=a.reduce((t,e)=>({input:t.input+e.tokens.input,output:t.output+e.tokens.output,cacheRead:t.cacheRead+e.tokens.cacheRead,cacheWrite:t.cacheWrite+e.tokens.cacheWrite}),{...C}),e=a[0].tokens;e.input+=i.input-t.input,e.output+=i.output-t.output,e.cacheRead+=i.cacheRead-t.cacheRead,e.cacheWrite+=i.cacheWrite-t.cacheWrite}return a}(t.dailyBreakdown,u,l)}async function z(t){let e=_.get(t.fullPath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes)return e.meta;try{let e=await v(t.fullPath),{meta:i}=p(e);await B(i,e,t);let s=k(t.fileName),n=a.default.dirname(t.fullPath),o=await A(n,s),r=i.cwd??w(t.projectDir),l=y(r),u={...i,id:s,filePath:t.fullPath,projectDir:t.projectDir,projectName:l.projectName,worktreeName:l.worktreeName,repoName:l.repoName,...o.workflowCount>0?{workflowCount:o.workflowCount,spawnedAgentCount:o.spawnedAgentCount}:{},...R(i.activeSegments,o.spans)};return _.set(t.fullPath,{meta:u,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),u}catch{return null}}async function F(t){let e=N.get(t.fullPath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes)return e.detail;try{let e=await v(t.fullPath),{meta:i,events:s}=p(e),n=k(t.fileName);await B(i,e,t);let o=await A(a.default.dirname(t.fullPath),n),r=i.cwd??w(t.projectDir),l=y(r),u={...i,id:n,filePath:t.fullPath,projectDir:t.projectDir,projectName:l.projectName,worktreeName:l.worktreeName,repoName:l.repoName,events:s,...o.workflowCount>0?{workflowCount:o.workflowCount,spawnedAgentCount:o.spawnedAgentCount}:{},...R(i.activeSegments,o.spans)};N.set(t.fullPath,{detail:u,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes});let c={...u};return delete c.events,_.set(t.fullPath,{meta:c,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),u}catch{return null}}async function O(t={}){let{root:e=h,limit:i=500,projectDir:s}=t,a=await I(e);s&&(a=a.filter(t=>t.projectDir===s)),a.sort((t,e)=>e.mtimeMs-t.mtimeMs);let n=a.slice(0,i);return(await Promise.all(n.map(async t=>{let e=await z(t);return e?U(e,t):null}))).filter(t=>null!==t)}async function $(t,e={}){let{root:i=h}=e,s=(await I(i)).find(e=>k(e.fileName)===t);if(!s)return null;let n=await F(s);if(!n)return n;let o=n.firstTimestamp?Date.parse(n.firstTimestamp):void 0,r=a.default.join(a.default.dirname(s.fullPath),k(s.fileName),"subagents"),l=a.default.join(a.default.dirname(s.fullPath),k(s.fileName),"workflows"),[u,c]=await Promise.all([E(r,o,n.events),L(l,o,n.events)]),d=c.reduce((t,e)=>t+e.agentCount,0);return U({...n,subagents:u,workflows:c,...c.length>0?{workflowCount:c.length,spawnedAgentCount:d}:{}},s)}function W(t){let e,i,s,a,n,o={...C},r=new Set,l=0,u=0,c=0,d=new Map;for(let m of t){if(!m||"object"!=typeof m)continue;l++;let t="string"==typeof m.timestamp?Date.parse(m.timestamp):NaN;if(!Number.isNaN(t)&&((void 0===e||t<e)&&(e=t),(void 0===i||t>i)&&(i=t)),void 0===n&&"user"===m.type&&(null===m.parentUuid||void 0===m.parentUuid)){let t=m.message,e=t?.content;if("string"==typeof e)n=e;else if(Array.isArray(e)){let t=e.find(t=>t&&"object"==typeof t&&"text"===t.type);t?.text&&(n=t.text)}}if("assistant"===m.type){let t=m.message;if(!t)continue;a||"string"!=typeof t.model||(a=t.model);let e="string"==typeof t.id?t.id:void 0,i="string"==typeof m.requestId?m.requestId:void 0,n=null!=e&&null!=i?`${e}:${i}`:void 0,l=!n||!r.has(n);if(n&&l&&r.add(n),l){u++;let e=t.usage;if(e){let t=t=>"number"==typeof t?t:0;o.input+=t(e.input_tokens),o.output+=t(e.output_tokens),o.cacheRead+=t(e.cache_read_input_tokens),o.cacheWrite+=t(e.cache_creation_input_tokens)}}let p=t.content;if(Array.isArray(p))for(let t of p)t&&"object"==typeof t&&("text"===t.type&&"string"==typeof t.text?s=t.text:"tool_use"===t.type&&"string"==typeof t.name&&(c++,d.set(t.name,(d.get(t.name)??0)+1)))}}let m=Array.from(d.entries()).map(([t,e])=>({name:t,count:e})).sort((t,e)=>e.count-t.count);return{startMs:e,endMs:i,totalUsage:o,eventCount:l,finalPreview:void 0!==s?s.replace(/\s+/g," ").trim().slice(0,240):void 0,finalText:s,model:a,toolCalls:m,toolCallCount:c,assistantMessageCount:u,initialPrompt:n}}async function E(t,e,s){let n;try{n=await i.promises.readdir(t)}catch{return[]}let o=new Map,r=[];for(let t of s)if("tool-call"===t.role&&"Agent"===t.toolName)for(let e of t.blocks){if(e?.type!=="tool_use"||"Agent"!==e.name)continue;let i=e.input??{},s="string"==typeof i.description?i.description:void 0,a=t.timestamp?Date.parse(t.timestamp):void 0,n={toolUseId:e.id,parentUuid:t.uuid??"",runInBackground:!0===i.run_in_background,prompt:"string"==typeof i.prompt?i.prompt:void 0,tsMs:a};s&&o.set(s,n),void 0!==a&&r.push(n)}r.sort((t,e)=>(t.tsMs??0)-(e.tsMs??0));let l=n.filter(t=>t.startsWith("agent-")&&t.endsWith(".jsonl"));return(await Promise.all(l.map(async s=>{let n,l=s.replace(/^agent-/,"").replace(/\.jsonl$/,""),u=a.default.join(t,s),c=a.default.join(t,`agent-${l}.meta.json`),d={};try{let t=await i.promises.readFile(c,"utf8");d=JSON.parse(t)}catch{}try{n=await v(u)}catch{return null}let m=W(n),p=d.description&&d.description.trim().length>0?d.description:void 0,f=p?o.get(p):function(t){let e;if(void 0===t)return;let i=1/0;for(let s of r){if(void 0===s.tsMs)continue;let a=Math.abs(t-s.tsMs);a<i&&a<=2e3&&(e=s,i=a)}return e}(m.startMs),g=p??(m.initialPrompt?m.initialPrompt.replace(/\s+/g," ").trim().slice(0,80):"(no description)"),y=f?.prompt??m.initialPrompt,h=void 0!==e&&void 0!==m.startMs?Math.max(0,m.startMs-e):void 0,w=void 0!==e&&void 0!==m.endMs?Math.max(0,m.endMs-e):void 0,M=void 0!==m.startMs&&void 0!==m.endMs?m.endMs-m.startMs:void 0;return{agentId:l,agentType:d.agentType??"unknown",description:g,startMs:m.startMs,endMs:m.endMs,durationMs:M,startTOffsetMs:h,endTOffsetMs:w,eventCount:m.eventCount,totalUsage:m.totalUsage,parentUuid:f?.parentUuid,parentToolUseId:f?.toolUseId,runInBackground:f?.runInBackground,prompt:y,finalPreview:m.finalPreview,finalText:m.finalText,model:m.model,toolCalls:m.toolCalls,toolCallCount:m.toolCallCount,assistantMessageCount:m.assistantMessageCount}}))).filter(t=>null!==t).sort((t,e)=>(t.startMs??0)-(e.startMs??0))}async function L(t,e,s){let n;try{n=await i.promises.readdir(t)}catch{return[]}let o=n.filter(t=>t.startsWith("wf_")&&t.endsWith(".json"));if(0===o.length)return[];let r=[];for(let t of s){if("tool-call"!==t.role||"Workflow"!==t.toolName)continue;let e=t.timestamp?Date.parse(t.timestamp):NaN;if(!Number.isNaN(e))for(let i of t.blocks)i?.type==="tool_use"&&"Workflow"===i.name&&r.push({toolUseId:i.id,parentUuid:t.uuid??"",tsMs:e})}r.sort((t,e)=>t.tsMs-e.tsMs);let l=t=>"number"==typeof t?t:void 0,u=t=>"string"==typeof t&&t.length>0?t:void 0;return(await Promise.all(o.map(async s=>{let n;try{n=JSON.parse(await i.promises.readFile(a.default.join(t,s),"utf8"))}catch{return null}let o=u(n.runId)??s.replace(/\.json$/,""),c=l(n.startTime),d=l(n.durationMs),m=void 0!==c&&void 0!==d?c+d:void 0,p=void 0!==e&&void 0!==c?Math.max(0,c-e):void 0,f=void 0!==e&&void 0!==m?Math.max(0,m-e):void 0,g=Array.isArray(n.phases)?n.phases.filter(t=>!!t&&"object"==typeof t&&"string"==typeof t.title).map(t=>({title:t.title,detail:u(t.detail)})):[],y=Array.isArray(n.logs)?n.logs.filter(t=>"string"==typeof t):[],h=(t,e)=>{let i=u(t);return void 0===i?void 0:i.length>e?i.slice(0,e)+"…":i},w=(Array.isArray(n.workflowProgress)?n.workflowProgress:[]).filter(t=>!!t&&"object"==typeof t&&"workflow_agent"===t.type).map(t=>({index:l(t.index)??0,label:u(t.label)??"(agent)",phaseIndex:l(t.phaseIndex),phaseTitle:u(t.phaseTitle),agentId:u(t.agentId),model:u(t.model),state:u(t.state),startedAt:l(t.startedAt),durationMs:l(t.durationMs),tokens:l(t.tokens),toolCalls:l(t.toolCalls),lastToolSummary:h(t.lastToolSummary,200),promptPreview:h(t.promptPreview,600),resultPreview:h(t.resultPreview,600)})).sort((t,e)=>t.index-e.index),M=(t=>{let e,i;if(void 0===t||0===r.length)return;let s=1/0,a=1/0;for(let n of r){let o=Math.abs(t-n.tsMs);!(o>6e4)&&(o<a&&(i=n,a=o),n.tsMs<=t&&o<s&&(e=n,s=o))}return e??i})(c);return{runId:o,name:u(n.workflowName)??o,description:u(n.summary),status:u(n.status)??"unknown",agentCount:l(n.agentCount)??0,toolCallCount:l(n.totalToolCalls)??0,totalTokens:l(n.totalTokens)??0,durationMs:d,startMs:c,endMs:m,startTOffsetMs:p,endTOffsetMs:f,model:u(n.defaultModel),phases:g,logs:y,agents:w,parentToolUseId:M?.toolUseId,parentUuid:M?.parentUuid}}))).filter(t=>null!==t).sort((t,e)=>(t.startMs??0)-(e.startMs??0))}async function J(t,e,i,s={}){let n,o,r,l,u,c,{root:d=h}=s;if(!/^[\w.-]+$/.test(e)||!/^[\w.-]+$/.test(i))return null;let m=(await I(d)).find(e=>k(e.fileName)===t);if(!m)return null;let p=a.default.join(a.default.dirname(m.fullPath),t,"subagents","workflows",e,`agent-${i}.jsonl`);try{n=await v(p)}catch{return null}let f=new Set;for(let t of n){if(!t||"object"!=typeof t)continue;let e=t.message?.content;if(Array.isArray(e))for(let t of e)t&&"object"==typeof t&&"tool_result"===t.type&&!0===t.is_error&&"string"==typeof t.tool_use_id&&f.add(t.tool_use_id)}let g=[],y=new Map,w={...C},M=new Set,_=0,N=0;for(let t of n){if(!t||"object"!=typeof t)continue;N++;let e="string"==typeof t.timestamp?Date.parse(t.timestamp):NaN;if(!Number.isNaN(e)&&((void 0===u||e<u)&&(u=e),(void 0===c||e>c)&&(c=e)),void 0===o&&"user"===t.type&&(null===t.parentUuid||void 0===t.parentUuid)){let e=t.message?.content;if("string"==typeof e)o=e;else if(Array.isArray(e)){let t=e.find(t=>t&&"object"==typeof t&&"text"===t.type);t?.text&&(o=t.text)}}if("assistant"!==t.type)continue;let i=t.message;if(!i)continue;l||"string"!=typeof i.model||(l=i.model);let s="string"==typeof i.id?i.id:void 0,a="string"==typeof t.requestId?t.requestId:void 0,n=null!=s&&null!=a?`${s}:${a}`:void 0,d=!n||!M.has(n);if(n&&d&&M.add(n),d){_++;let t=i.usage;if(t){let e=t=>"number"==typeof t?t:0;w.input+=e(t.input_tokens),w.output+=e(t.output_tokens),w.cacheRead+=e(t.cache_read_input_tokens),w.cacheWrite+=e(t.cache_creation_input_tokens)}}let m=i.content;if(Array.isArray(m)){for(let t of m)if(t&&"object"==typeof t){if("text"===t.type&&"string"==typeof t.text)r=t.text;else if("tool_use"===t.type&&"string"==typeof t.name&&(y.set(t.name,(y.get(t.name)??0)+1),g.length<2e3)){let e=function(t){if(!t||"object"!=typeof t)return"";let e=e=>"string"==typeof t[e]?t[e]:void 0;return e("command")??e("file_path")??e("path")??e("pattern")??e("url")??e("description")??e("query")??e("prompt")??e("old_string")??JSON.stringify(t)}(t.input),i=e.replace(/\s+/g," ").trim().slice(0,160),s=e.length>4e3?e.slice(0,4e3)+"…":e;g.push({index:g.length+1,tool:t.name,preview:i,full:s.length>i.length||s.includes("\n")?s:void 0,isError:"string"==typeof t.id&&f.has(t.id)})}}}}return{agentId:i,prompt:o,finalText:r,steps:g,toolCalls:Array.from(y.entries()).map(([t,e])=>({name:t,count:e})).sort((t,e)=>e.count-t.count),toolCallCount:g.length,assistantMessageCount:_,eventCount:N,totalUsage:w,model:l,durationMs:void 0!==u&&void 0!==c?c-u:void 0}}let q={...n.CLAUDE_CODE_METADATA,defaultRoot:h,async listSessions(t){let e=await O(t);for(let t of e)t.agent||(t.agent="claude-code");return e},async getSession(t,e){let i=await $(t,e);return i&&!i.agent&&(i.agent="claude-code"),i}};t.s(["DEFAULT_ROOT",0,h,"claudeCodeSource",0,q,"getSession",0,$,"invalidateClaudeCodeFile",0,b,"listSessions",0,O,"loadWorkflowAgentDetail",0,J,"summarizeSubagentLines",0,W],20629);let G=a.default.join(s.default.homedir(),".codex","sessions"),H=/^rollout-(\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2})-([0-9a-f-]+)\.jsonl$/;async function K(t){return i.promises.readdir(t).catch(()=>[])}async function Y(t){let e=[];for(let s of(await K(t))){if(!/^\d{4}$/.test(s))continue;let n=a.default.join(t,s);for(let t of(await K(n))){if(!/^\d{2}$/.test(t))continue;let s=a.default.join(n,t);for(let t of(await K(s))){if(!/^\d{2}$/.test(t))continue;let n=a.default.join(s,t);for(let t of(await K(n))){let s=H.exec(t);if(!s)continue;let o=a.default.join(n,t),r=await i.promises.stat(o).catch(()=>null);r&&e.push({filePath:o,sessionId:s[2],mtimeMs:r.mtimeMs,sizeBytes:r.size})}}}}return e}async function Z(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}function Q(t){return t.replace(/\s+/g," ").trim().slice(0,200)}function V(t,e){let i,s,a,n,r,l,u,c,d,m,p,f,g=[],h={input:0,output:0,cacheRead:0,cacheWrite:0},w=0,M=0,v=[],k=0;for(let t of e){if("object"!=typeof t||null===t)continue;let e="string"==typeof t.timestamp?t.timestamp:void 0;if(e){i||(i=e),s=e;let t=Date.parse(e);Number.isFinite(t)&&v.push(t)}let y="string"==typeof t.type?t.type:"",N=t.payload??{},T="string"==typeof N.type?N.type:"";if("session_meta"===y){"string"==typeof N.cwd&&(a=N.cwd),void 0===c&&"string"==typeof N.thread_source&&(c=N.thread_source),void 0===d&&"string"==typeof N.session_id&&(d=N.session_id),void 0===m&&"string"==typeof N.parent_thread_id&&(m=N.parent_thread_id),void 0===p&&"string"==typeof N.agent_nickname&&(p=N.agent_nickname),void 0===f&&"string"==typeof N.agent_path&&(f=N.agent_path);continue}if("turn_context"===y){"string"==typeof N.cwd&&(a=N.cwd),"string"==typeof N.model&&(n=N.model);continue}if("event_msg"===y&&"token_count"===T){let t=N.info??null,e=t?.total_token_usage??null;e&&(h.input=X(e.input_tokens)??h.input,h.output=X(e.output_tokens)??h.output,h.cacheRead=X(e.cached_input_tokens)??h.cacheRead);continue}if("event_msg"===y&&"user_message"===T){let i="string"==typeof N.message?N.message:"",s=Q(i),a=(0,o.isFrameworkInjectedUserInput)(i);i&&!a&&(r||(r=s),l=s,M+=1),g.push({index:k++,timestamp:e,role:"user",rawType:"event_msg/user_message",preview:s,blocks:i?[{type:"text",text:i}]:[],raw:t});continue}if("event_msg"===y&&"agent_message"===T){let i="string"==typeof N.message?N.message:"",s=Q(i);i&&(u=s),g.push({index:k++,timestamp:e,role:"agent",rawType:"event_msg/agent_message",preview:s,blocks:i?[{type:"text",text:i}]:[],model:n,raw:t});continue}if("response_item"===y&&"reasoning"===T){let i=(N.summary??[]).map(t=>"string"==typeof t.text?t.text:"").join("\n").trim();g.push({index:k++,timestamp:e,role:"agent-thinking",rawType:"response_item/reasoning",preview:Q(i),blocks:i?[{type:"thinking",thinking:i}]:[],model:n,raw:t});continue}if("response_item"===y&&"message"===T&&"assistant"===N.role){let i=(N.content??[]).map(t=>"string"==typeof t.text?t.text:"").join("\n").trim(),s=Q(i);i&&(u=s),g.push({index:k++,timestamp:e,role:"agent",rawType:"response_item/message",preview:s,blocks:i?[{type:"text",text:i}]:[],model:n,raw:t});continue}if("response_item"===y&&"function_call"===T){var _;let i="string"==typeof N.name?N.name:"(unknown)",s="string"==typeof N.call_id?N.call_id:void 0,a="string"==typeof N.arguments?N.arguments:"",o=function(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}(a);w+=1,g.push({index:k++,timestamp:e,role:"tool-call",rawType:"response_item/function_call",preview:`${i}(${(_=a).length<=80?_:_.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:s??`codex-${k}`,name:i,input:o}],toolName:i,toolUseId:s,model:n,raw:t});continue}if("response_item"===y&&"function_call_output"===T){let i="string"==typeof N.call_id?N.call_id:void 0,s="string"==typeof N.output?N.output:"",a=/process exited with code [1-9]/i.test(s);g.push({index:k++,timestamp:e,role:"tool-result",rawType:"response_item/function_call_output",preview:Q(s),blocks:[{type:"tool_result",tool_use_id:i??"",content:s,is_error:a}],toolUseId:i,toolResult:s,raw:t});continue}g.push({index:k++,timestamp:e,role:"meta",rawType:T?`${y}/${T}`:y,preview:"",blocks:[],raw:t})}if(h.input>0||h.output>0){let e=-1;for(let t=g.length-1;t>=0;t--){let i=g[t].role;if("agent"===i||"agent-thinking"===i||"tool-call"===i){e=t;break}}if(e>=0){let i=g[e];i.messageId=`codex-${t.sessionId}-total`,i.usage={input:h.input,output:h.output,cacheRead:h.cacheRead,cacheWrite:0}}}let N=i?Date.parse(i):void 0;if(void 0!==N&&Number.isFinite(N)){let t;for(let e of g){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-N),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let T=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++)e[t]-a>18e4&&(i.push({startMs:s,endMs:a}),s=e[t]),a=e[t];return i.push({startMs:s,endMs:a}),i}(v),j=T.reduce((t,e)=>t+(e.endMs-e.startMs),0),b=i&&s?Date.parse(s)-Date.parse(i):void 0,I=a?y(a):void 0,C=I?.projectName??"(unknown)",x=a?a.replace(/^\//,"-").replace(/\//g,"-"):"(unknown)";return{meta:{agent:"codex",id:t.sessionId,filePath:t.filePath,projectName:C,worktreeName:I?.worktreeName,repoName:I?.repoName,projectDir:x,sessionId:t.sessionId,firstTimestamp:i,lastTimestamp:s,durationMs:b&&Number.isFinite(b)?b:void 0,eventCount:g.length,model:n,cwd:a,totalUsage:h,status:"idle",firstUserPreview:r,lastUserPreview:l,lastAgentPreview:u,toolCallCount:w,turnCount:M,airTimeMs:j,activeSegments:T},events:g,threadSource:c,rootSessionId:d,parentThreadId:m,agentNickname:p,agentPath:f}}function X(t){return"number"==typeof t&&Number.isFinite(t)?t:void 0}let tt=new Map,te=new Map;async function ti(t){let e=await Y(t),i=[];for(let t of e){let e=tt.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes){i.push({file:t,meta:e.meta,threadSource:e.threadSource,rootSessionId:e.rootSessionId,parentThreadId:e.parentThreadId,agentNickname:e.agentNickname,agentPath:e.agentPath});continue}try{let e=await Z(t.filePath),s=V(t,e);tt.set(t.filePath,{meta:s.meta,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes,threadSource:s.threadSource,rootSessionId:s.rootSessionId,parentThreadId:s.parentThreadId,agentNickname:s.agentNickname,agentPath:s.agentPath}),i.push({file:t,meta:s.meta,threadSource:s.threadSource,rootSessionId:s.rootSessionId,parentThreadId:s.parentThreadId,agentNickname:s.agentNickname,agentPath:s.agentPath})}catch{}}return i}async function ts(t={}){let e=t.root??G,i=await ti(e),s=new Map;for(let t of i){if("subagent"!==t.threadSource||!t.rootSessionId)continue;let e=s.get(t.rootSessionId);e?e.push(t):s.set(t.rootSessionId,[t])}let a=[];for(let t of i){if("subagent"===t.threadSource)continue;let e=s.get(t.meta.id);if(!e||0===e.length){a.push(t.meta);continue}let i={...t.meta,spawnedAgentCount:e.length,totalUsage:{input:t.meta.totalUsage.input+e.reduce((t,e)=>t+e.meta.totalUsage.input,0),output:t.meta.totalUsage.output+e.reduce((t,e)=>t+e.meta.totalUsage.output,0),cacheRead:t.meta.totalUsage.cacheRead+e.reduce((t,e)=>t+e.meta.totalUsage.cacheRead,0),cacheWrite:t.meta.totalUsage.cacheWrite+e.reduce((t,e)=>t+e.meta.totalUsage.cacheWrite,0)},toolCallCount:(t.meta.toolCallCount??0)+e.reduce((t,e)=>t+(e.meta.toolCallCount??0),0)};for(let t of e)t.meta.lastTimestamp&&(!i.lastTimestamp||t.meta.lastTimestamp>i.lastTimestamp)&&(i.lastTimestamp=t.meta.lastTimestamp);a.push(i)}return(a.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?a.slice(0,t.limit):a}async function ta(t,e={}){let i=e.root??G,s=await ti(i),a=s.find(e=>e.meta.id===t&&"subagent"!==e.threadSource);if(!a){let e=s.find(e=>e.meta.id===t);if(!e)return null;let i=te.get(e.file.filePath);if(i&&i.mtimeMs===e.file.mtimeMs&&i.sizeBytes===e.file.sizeBytes)return i.detail;let a=await Z(e.file.filePath),{meta:n,events:o}=V(e.file,a),r={...n,events:o};return te.set(e.file.filePath,{detail:r,mtimeMs:e.file.mtimeMs,sizeBytes:e.file.sizeBytes}),r}let n=a.file,o=te.get(n.filePath);if(o&&o.mtimeMs===n.mtimeMs&&o.sizeBytes===n.sizeBytes)return o.detail;let r=await Z(n.filePath),{meta:l,events:u}=V(n,r),c=s.filter(e=>"subagent"===e.threadSource&&e.rootSessionId===t),d=l.firstTimestamp?Date.parse(l.firstTimestamp):void 0,m=c.map(t=>{let e,i,s,a,n;return i=(e=t.meta).firstTimestamp?Date.parse(e.firstTimestamp):void 0,s=e.lastTimestamp?Date.parse(e.lastTimestamp):void 0,a=void 0!==i&&Number.isFinite(i)?i:void 0,n=void 0!==s&&Number.isFinite(s)?s:void 0,{agentId:e.id,agentType:t.agentNickname??t.agentPath??"subagent",description:t.agentPath??t.agentNickname??e.id,startMs:a,endMs:n,durationMs:e.durationMs,startTOffsetMs:void 0!==d&&void 0!==a?Math.max(0,a-d):void 0,endTOffsetMs:void 0!==d&&void 0!==n?Math.max(0,n-d):void 0,eventCount:e.eventCount,totalUsage:e.totalUsage,model:e.model,toolCallCount:e.toolCallCount,finalPreview:e.lastAgentPreview}}).sort((t,e)=>(t.startMs??0)-(e.startMs??0)),p={...l,events:u,...m.length>0?{subagents:m,spawnedAgentCount:m.length}:{}};return te.set(n.filePath,{detail:p,mtimeMs:n.mtimeMs,sizeBytes:n.sizeBytes}),p}let tn=a.default.join(s.default.homedir(),".copilot","session-state");function to(t){return"object"==typeof t&&null!==t?t:void 0}function tr(t){return"string"==typeof t?t:void 0}function tl(t){return"number"==typeof t&&Number.isFinite(t)?t:void 0}function tu(t){return("string"==typeof t?t:JSON.stringify(t??"")).replace(/\s+/g," ").trim().slice(0,200)}function tc(t,e){return tl(to(t?.[e])?.tokenCount)}async function td(t){let e=await i.promises.readdir(t,{withFileTypes:!0}).catch(()=>[]),s=[];for(let n of e){if(!n.isDirectory())continue;let e=a.default.join(t,n.name,"events.jsonl"),o=await i.promises.stat(e).catch(()=>null);o?.isFile()&&s.push({filePath:e,sessionId:n.name,mtimeMs:o.mtimeMs,sizeBytes:o.size})}return s}async function tm(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}function tp(t,e){var i;let s,a,n,r,l,u,c,d,m,p,f,g,h=e.map(to).filter(t=>void 0!==t),w=new Set;for(let t of h){if("tool.execution_start"!==t.type)continue;let e=tr(to(t.data)?.toolCallId);e&&w.add(e)}let M=[],v=[],k={input:0,output:0,cacheRead:0,cacheWrite:0},_=0,N=0,T=0,j=!1,b=0;function I(t){M.push({index:b++,...t})}for(let t of h){let e=tr(t.type)??"",i=to(t.data)??{},y=tr(t.timestamp);if(y){let t=Date.parse(y);Number.isFinite(t)&&(v.push(t),s=void 0===s?t:Math.min(s,t),a=void 0===a?t:Math.max(a,t))}if("session.start"===e){let s=to(i.context);n=tr(s?.cwd)??n,r=tr(s?.repository)??r,l=tr(s?.branch)??l,I({timestamp:y,role:"meta",rawType:e,preview:"Copilot session started",blocks:[],raw:t});continue}if("session.model_change"===e){let t=tr(i.newModel);t&&"auto"!==t&&(u=t)}else"session.auto_mode_resolved"===e?u=tr(i.chosenModel)??u:("assistant.turn_start"===e||"assistant.message"===e)&&(u=tr(i.model)??u);if("system.message"===e){I({timestamp:y,role:"system",rawType:e,preview:"Copilot system instructions",blocks:[],raw:t});continue}if("user.message"===e){let s=tr(i.content)??"",a=tu(s);s&&!(0,o.isFrameworkInjectedUserInput)(s)&&(c??=a,d=a,N+=1),I({timestamp:y,role:"user",rawType:e,preview:a,blocks:s?[{type:"text",text:s}]:[],raw:t});continue}if("assistant.message"===e){let s=tr(i.content)??"";if(T+=tl(i.outputTokens)??0,s){let a=tu(s);m=a,I({timestamp:y,role:"agent",rawType:e,messageId:tr(i.messageId),preview:a,blocks:[{type:"text",text:s}],model:u,raw:t})}for(let e of Array.isArray(i.toolRequests)?i.toolRequests:[]){let i=to(e);if(!i)continue;let s=tr(i.toolCallId);if(s&&w.has(s))continue;let a=tr(i.name)??"(unknown)",n=to(i.arguments)??i.arguments??null;_+=1,I({timestamp:y,role:"tool-call",rawType:"assistant.message/tool_request",preview:`${a}(${tu(n).slice(0,80)})`,blocks:[{type:"tool_use",id:s??`copilot-${b}`,name:a,input:n}],toolName:a,toolUseId:s,model:u,raw:t})}continue}if("tool.execution_start"===e){let s=tr(i.toolCallId),a=tr(i.toolName)??"(unknown)",n=i.arguments??null;_+=1,I({timestamp:y,role:"tool-call",rawType:e,preview:`${a}(${tu(n).slice(0,80)})`,blocks:[{type:"tool_use",id:s??`copilot-${b}`,name:a,input:n}],toolName:a,toolUseId:s,model:tr(i.model)??u,raw:t});continue}if("tool.execution_complete"===e){let s=tr(i.toolCallId),a=to(i.result),n=a&&"content"in a?a.content:i.result,o=!1!==i.success;I({timestamp:y,role:"tool-result",rawType:e,preview:tu(n),blocks:[{type:"tool_result",tool_use_id:s??"",content:n,is_error:!o}],toolUseId:s,toolResult:i.result,raw:t});continue}if("assistant.reasoning"===e){let s=tr(i.content)??"";I({timestamp:y,role:"agent-thinking",rawType:e,preview:tu(s),blocks:s?[{type:"thinking",thinking:s}]:[],model:u,raw:t});continue}if("session.shutdown"===e){j=!0,u=tr(i.currentModel)??u;let t=to(i.tokenDetails);k.input=tc(t,"input")??k.input,k.output=tc(t,"output")??T,k.cacheRead=tc(t,"cache_read")??k.cacheRead,k.cacheWrite=tc(t,"cache_write")??k.cacheWrite;let e=to(i.codeChanges);p=tl(e?.linesAdded),f=tl(e?.linesRemoved);let s=e?.filesModified;g=Array.isArray(s)?s.length:void 0}I({timestamp:y,role:"meta",rawType:e,preview:"",blocks:[],raw:t})}if(0===k.output&&(k.output=T),k.input||k.output||k.cacheRead||k.cacheWrite){let e=[...M].reverse().find(t=>"agent"===t.role||"agent-thinking"===t.role||"tool-call"===t.role);e&&(e.messageId=`copilot-${t.sessionId}-total`,e.usage={...k})}let C=void 0===s?void 0:new Date(s).toISOString(),x=void 0===a?void 0:new Date(a).toISOString();if(void 0!==s){let t;for(let e of M){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-s),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let S=function(t){let e=[...new Set(t)].sort((t,e)=>t-e);if(0===e.length)return[];let i=[],s=e[0],a=s;for(let t=1;t<e.length;t++){let n=e[t];n-a>18e4&&(i.push({startMs:s,endMs:a}),s=n),a=n}return i.push({startMs:s,endMs:a}),i}(v),A=S.reduce((t,e)=>t+e.endMs-e.startMs,0),P=n?y(n):void 0,D=P?.repoName??r?.split("/").filter(Boolean).at(-1);return{meta:{agent:"copilot",id:t.sessionId,filePath:t.filePath,projectName:P?.projectName??n??"(unknown)",worktreeName:P?.worktreeName,repoName:D,projectDir:(i=n)?i.replace(/^\//,"-").replace(/\//g,"-"):"(unknown)",sessionId:t.sessionId,firstTimestamp:C,lastTimestamp:x,lastActivityMs:t.mtimeMs,durationMs:void 0!==s&&void 0!==a?a-s:void 0,eventCount:M.length,model:u,cwd:n,gitBranch:l,totalUsage:k,status:j||Date.now()-t.mtimeMs>18e4?"idle":"running",firstUserPreview:c,lastUserPreview:d,lastAgentPreview:m,toolCallCount:_,turnCount:N,linesAdded:p,linesRemoved:f,filesEdited:g,airTimeMs:A,activeSegments:S},events:M}}let tf=new Map,tg=new Map;async function ty(t){let e=await td(t),i=[];for(let t of e){let e=tf.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes){i.push({file:t,meta:e.meta});continue}try{let e=await tm(t.filePath),{meta:s}=tp(t,e);tf.set(t.filePath,{meta:s,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),i.push({file:t,meta:s})}catch{}}return i}async function th(t={}){let e=t.root??tn,i=(await ty(e)).map(t=>t.meta);return i.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0===t.limit?i:i.slice(0,t.limit)}async function tw(t,e={}){let i=e.root??tn,s=(await ty(i)).find(e=>e.meta.id===t);if(!s)return null;let a=tg.get(s.file.filePath);if(a&&a.mtimeMs===s.file.mtimeMs&&a.sizeBytes===s.file.sizeBytes)return a.detail;let n=await tm(s.file.filePath),{meta:o,events:r}=tp(s.file,n),l={...o,events:r};return tg.set(s.file.filePath,{detail:l,mtimeMs:s.file.mtimeMs,sizeBytes:s.file.sizeBytes}),l}let tM=a.default.join(s.default.homedir(),".gemini","tmp"),tv=a.default.join(s.default.homedir(),".gemini","projects.json"),tk=/^session-.+\.(jsonl|json)$/;async function t_(t){return i.promises.readdir(t).catch(()=>[])}async function tN(t){let e=[];for(let s of(await t_(t))){let n=a.default.join(t,s,"chats");for(let t of(await t_(n))){if(!tk.test(t))continue;let o=a.default.join(n,t),r=await i.promises.stat(o).catch(()=>null);if(!r||!r.isFile())continue;let l=t.replace(/\.(jsonl|json)$/,"").split("-").pop()??t;e.push({filePath:o,slug:s,filenameId:l,format:t.endsWith(".jsonl")?"jsonl":"legacy-json",mtimeMs:r.mtimeMs,sizeBytes:r.size})}}return e}let tT=null;async function tj(){let t,e=await i.promises.stat(tv).catch(()=>null);if(!e)return new Map;if(tT&&tT.mtimeMs===e.mtimeMs)return tT.slugToCwd;let s=await i.promises.readFile(tv,"utf8").catch(()=>"");try{t=JSON.parse(s)}catch{t={}}let a=new Map;for(let[e,i]of Object.entries(t.projects??{}))"string"==typeof i&&a.set(i,e);return tT={mtimeMs:e.mtimeMs,slugToCwd:a},a}function tb(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"string"==typeof t.type}async function tI(t){let e=await i.promises.readFile(t.filePath,"utf8");if("legacy-json"===t.format){let t;try{t=JSON.parse(e)}catch{return{meta:{},messages:[]}}return{meta:{sessionId:"string"==typeof t.sessionId?t.sessionId:void 0,projectHash:"string"==typeof t.projectHash?t.projectHash:void 0,startTime:"string"==typeof t.startTime?t.startTime:void 0,lastUpdated:"string"==typeof t.lastUpdated?t.lastUpdated:void 0,summary:"string"==typeof t.summary?t.summary:void 0},messages:(Array.isArray(t.messages)?t.messages:[]).filter(tb)}}let s={},a=new Map,n=[];for(let t of e.split("\n")){let e,i=t.trim();if(i){var o,r;try{e=JSON.parse(i)}catch{continue}if((o=e)&&"object"==typeof o&&"$rewindTo"in o){let t=e.$rewindTo,i=n.indexOf(t);if(i>=0){for(let t of n.slice(i))a.delete(t);n.length=i}continue}if((r=e)&&"object"==typeof r&&"$set"in r){Object.assign(s,e.$set);continue}if(tb(e)){a.has(e.id)||n.push(e.id),a.set(e.id,e);continue}if("object"==typeof e&&null!==e){let t=e;"string"!=typeof t.sessionId||s.sessionId||(s.sessionId=t.sessionId,"string"==typeof t.projectHash&&(s.projectHash=t.projectHash),"string"==typeof t.startTime&&(s.startTime=t.startTime),"string"==typeof t.lastUpdated&&(s.lastUpdated=t.lastUpdated),"string"==typeof t.summary&&(s.summary=t.summary))}}}let l=[];for(let t of n){let e=a.get(t);e&&l.push(e)}return{meta:s,messages:l}}function tC(t){return t.replace(/\s+/g," ").trim().slice(0,200)}function tx(t){if(!t)return"";if("string"==typeof t)return t;let e=Array.isArray(t)?t:[t],i=[];for(let t of e){if(!t||"object"!=typeof t)continue;if("string"==typeof t.text){i.push(t.text);continue}let e=t.functionResponse;if(e){let t=e.response;"string"==typeof t?i.push(t):t&&"object"==typeof t&&("string"==typeof t.output?i.push(t.output):"string"==typeof t.error?i.push(`error: ${t.error}`):i.push(JSON.stringify(t)))}}return i.join("\n")}async function tS(t){let e,i,s,a,n,r,{meta:l,messages:u}=await tI(t),c=(await tj()).get(t.slug),d=[],m={input:0,output:0,cacheRead:0,cacheWrite:0},p=0,f=0,g=[],h=0;function w(t){if(d.push(t),t.timestamp&&"meta"!==t.role){e||(e=t.timestamp),i=t.timestamp;let s=Date.parse(t.timestamp);Number.isFinite(s)&&g.push(s)}}for(let t of u){let e=t.timestamp;if("user"===t.type){let i=tx(t.displayContent??t.content),s=tC(i),r=(0,o.isFrameworkInjectedUserInput)(i);i&&!r&&(a||(a=s),n=s,f+=1),w({index:h++,timestamp:e,role:"user",rawType:"gemini/user",preview:s,blocks:i?[{type:"text",text:i}]:[],messageId:t.id,raw:t});continue}if("gemini"===t.type){let i;"string"==typeof t.model&&(s=t.model);let a=tx(t.content),n=tC(a);if(a&&(r=n),t.tokens){let e=t.tokens,s={input:e.input??0,output:e.output??0,cacheRead:e.cached??0,cacheWrite:0};i=s,m.input+=s.input,m.output+=s.output,m.cacheRead+=s.cacheRead}for(let i of t.thoughts??[]){let t=[i.subject,i.description].filter(Boolean).join(": ");t&&w({index:h++,timestamp:i.timestamp??e,role:"agent-thinking",rawType:"gemini/thought",preview:tC(t),blocks:[{type:"thinking",thinking:t}],model:s,raw:i})}for(let o of(a?w({index:h++,timestamp:e,role:"agent",rawType:"gemini/agent",preview:n,blocks:[{type:"text",text:a}],messageId:t.id,model:s,usage:i,raw:t}):i&&w({index:h++,timestamp:e,role:"agent",rawType:"gemini/agent",preview:"",blocks:[],messageId:t.id,model:s,usage:i,raw:t}),t.toolCalls??[])){p+=1;let t=o.args?JSON.stringify(o.args):"";w({index:h++,timestamp:o.timestamp??e,role:"tool-call",rawType:"gemini/tool_call",preview:`${o.name}(${t.length<=80?t:t.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:o.id,name:o.name,input:o.args??{}}],toolName:o.name,toolUseId:o.id,model:s,raw:o});let i=(o.status??"").toLowerCase();if("success"===i||"error"===i||"cancelled"===i){let t=tx(o.result);w({index:h++,timestamp:o.timestamp??e,role:"tool-result",rawType:"gemini/tool_result",preview:tC(t),blocks:[{type:"tool_result",tool_use_id:o.id,content:t,is_error:"error"===i||"cancelled"===i}],toolUseId:o.id,toolResult:t,raw:o})}}continue}if("info"===t.type||"warning"===t.type||"error"===t.type){let i=tx(t.content);w({index:h++,timestamp:e,role:"meta",rawType:`gemini/${t.type}`,preview:tC(i),blocks:i?[{type:"text",text:i}]:[],raw:t});continue}}let M=e?Date.parse(e):void 0;if(void 0!==M&&Number.isFinite(M)){let t;for(let e of d){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-M),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let v=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++)e[t]-a>18e4&&(i.push({startMs:s,endMs:a}),s=e[t]),a=e[t];return i.push({startMs:s,endMs:a}),i}(g),k=v.reduce((t,e)=>t+(e.endMs-e.startMs),0),_=e&&i?Date.parse(i)-Date.parse(e):void 0,N=l.sessionId??t.filenameId,T=c?y(c):void 0,j=T?.projectName??t.slug,b=c?c.replace(/^\//,"-").replace(/\//g,"-"):t.slug;return{meta:{agent:"gemini",id:N,filePath:t.filePath,projectName:j,worktreeName:T?.worktreeName,repoName:T?.repoName,projectDir:b,sessionId:N,firstTimestamp:e,lastTimestamp:i,durationMs:_&&Number.isFinite(_)?_:void 0,eventCount:d.length,model:s,cwd:c,totalUsage:m,status:"idle",firstUserPreview:a,lastUserPreview:n,lastAgentPreview:r,toolCallCount:p,turnCount:f,airTimeMs:k,activeSegments:v},events:d}}let tA=new Map,tP=new Map;async function tD(t={}){let e=t.root??tM,i=await tN(e),s=[];for(let t of i){let e=tA.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes){s.push(e.meta);continue}try{let{meta:e}=await tS(t);tA.set(t.filePath,{meta:e,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),s.push(e)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function tU(t,e={}){let i,s=e.root??tM,a=await tN(s);for(let e of a)if(e.filenameId===t||t.startsWith(e.filenameId)){i=e;break}if(!i)for(let e of a){let{meta:s}=await tS(e).catch(()=>({meta:{id:""}}));if(s.id===t){i=e;break}}if(!i)return null;let n=tP.get(i.filePath);if(n&&n.mtimeMs===i.mtimeMs&&n.sizeBytes===i.sizeBytes)return n.detail;let{meta:o,events:r}=await tS(i),l={...o,events:r};return tP.set(i.filePath,{detail:l,mtimeMs:i.mtimeMs,sizeBytes:i.sizeBytes}),l}let tR=a.default.join(s.default.homedir(),".gemini","antigravity-cli");async function tB(t){return i.promises.readdir(t).catch(()=>[])}let tz=null;async function tF(t){let e=a.default.join(t,"history.jsonl"),s=await i.promises.stat(e).catch(()=>null);if(!s)return new Map;if(tz&&tz.mtimeMs===s.mtimeMs)return tz.slugToCwd;let n=await i.promises.readFile(e,"utf8").catch(()=>""),o=new Map;for(let t of n.split("\n")){let e=t.trim();if(e)try{let t=JSON.parse(e);t.conversationId&&t.workspace&&o.set(t.conversationId,t.workspace)}catch{}}return tz={mtimeMs:s.mtimeMs,slugToCwd:o},o}async function tO(t){let e=await tF(t),s=[],n=a.default.join(t,"brain");for(let t of(await tB(n))){let o=a.default.join(n,t,".system_generated","logs","transcript.jsonl"),r=await i.promises.stat(o).catch(()=>null);r&&r.isFile()&&s.push({filePath:o,conversationId:t,cwd:e.get(t),mtimeMs:r.mtimeMs,sizeBytes:r.size})}return s}function t$(t){return t.replace(/\s+/g," ").trim().slice(0,200)}async function tW(t){let e,s,a,n,r,l,u=await i.promises.readFile(t.filePath,"utf8"),c=[],d=0,m=0,p=[],f=0;function g(t){if(c.push(t),t.timestamp&&"meta"!==t.role){e||(e=t.timestamp),s=t.timestamp;let i=Date.parse(t.timestamp);Number.isFinite(i)&&p.push(i)}}let h=[],w=[],M=new Map;for(let t of u.split("\n")){let e=t.trim();if(e)try{let t=JSON.parse(e),i=t.step_index;"number"==typeof i?M.has(i)?w[M.get(i)]=t:(M.set(i,w.length),w.push(t)):w.push(t)}catch{}}for(let t of w){let e=t.created_at||t.timestamp;if("USER_INPUT"===t.type){if("string"==typeof t.content){let e=t.content.match(/Model Selection` from .*? to (.*?)\.\s*No need to/);if(e){let t=e[1].trim();a=t=t.replace(/\s*\(.*?\)\s*$/,"").trim()}else{let e=t.content.match(/Model Selection` from .*? to ([^\n]+)/);if(e){let t=e[1].trim();t.endsWith(".")&&(t=t.slice(0,-1).trim()),a=t=t.replace(/\s*\(.*?\)\s*$/,"").trim()}}}let i=t.content||"",s=i.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/);s&&(i=s[1].trim());let l=t$(i),u=(0,o.isFrameworkInjectedUserInput)(i);i&&!u&&(n||(n=l),r=l,m+=1),g({index:f++,timestamp:e,role:"user",rawType:"antigravity/user",preview:l,blocks:i?[{type:"text",text:i}]:[],messageId:t.step_index?.toString(),raw:t});continue}if("PLANNER_RESPONSE"===t.type){let i=t.thinking,s=t.content;if(i&&g({index:f++,timestamp:e,role:"agent-thinking",rawType:"antigravity/thought",preview:t$(i),blocks:[{type:"thinking",thinking:i}],model:a,raw:t}),s){let i=t$(s);l=i,g({index:f++,timestamp:e,role:"agent",rawType:"antigravity/agent",preview:i,blocks:[{type:"text",text:s}],messageId:t.step_index?.toString(),model:a,raw:t})}let n=t.tool_calls||[];for(let i=0;i<n.length;i++){let s=n[i];d+=1;let o=`tool-${t.step_index}-${i}`,r=s.args?JSON.stringify(s.args):"";h.push({id:o,name:s.name}),g({index:f++,timestamp:e,role:"tool-call",rawType:"antigravity/tool_call",preview:`${s.name}(${r.length<=80?r:r.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:o,name:s.name,input:s.args||{}}],toolName:s.name,toolUseId:o,model:a,raw:s})}continue}if("MODEL"===t.source&&"PLANNER_RESPONSE"!==t.type&&"ERROR_MESSAGE"!==t.type&&h.length>0){let i=h.shift(),s=i?i.id:`tool-${t.step_index}-unknown`,a="string"==typeof t.content?t.content:JSON.stringify(t.content||""),n="ERROR"===t.status||"FAILED"===t.status||"CANCELED"===t.status||!!t.error;g({index:f++,timestamp:e,role:"tool-result",rawType:"antigravity/tool_result",preview:t$(a),blocks:[{type:"tool_result",tool_use_id:s,content:a,is_error:n}],toolUseId:s,toolResult:a,raw:t});continue}let i=t.content||t.error||"";g({index:f++,timestamp:e,role:"meta",rawType:`antigravity/${t.type?.toLowerCase()||"unknown"}`,preview:t$(i),blocks:i?[{type:"text",text:i}]:[],raw:t})}let v=e?Date.parse(e):void 0;if(void 0!==v&&Number.isFinite(v)){let t;for(let e of c){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-v),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let k=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++)e[t]-a>18e4&&(i.push({startMs:s,endMs:a}),s=e[t]),a=e[t];return i.push({startMs:s,endMs:a}),i}(p),_=k.reduce((t,e)=>t+(e.endMs-e.startMs),0),N=e&&s?Date.parse(s)-Date.parse(e):void 0,T=t.conversationId,j=t.cwd,b=j?y(j):void 0,I=b?.projectName??t.conversationId,C=j?j.replace(/^\//,"-").replace(/\//g,"-"):t.conversationId;return{meta:{agent:"antigravity",id:T,filePath:t.filePath,projectName:I,worktreeName:b?.worktreeName,repoName:b?.repoName,projectDir:C,sessionId:T,firstTimestamp:e,lastTimestamp:s,durationMs:N&&Number.isFinite(N)?N:void 0,eventCount:c.length,model:a,cwd:j,totalUsage:{input:0,output:0,cacheRead:0,cacheWrite:0},status:"idle",firstUserPreview:n,lastUserPreview:r,lastAgentPreview:l,toolCallCount:d,turnCount:m,airTimeMs:_,activeSegments:k},events:c}}let tE=new Map,tL=new Map;async function tJ(t={}){let e=t.root??tR,i=await tO(e),s=[];for(let t of i){let e=tE.get(t.filePath);if(e&&e.mtimeMs===t.mtimeMs&&e.sizeBytes===t.sizeBytes&&e.cwd===t.cwd){s.push(e.meta);continue}try{let{meta:e}=await tW(t);tE.set(t.filePath,{meta:e,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes,cwd:t.cwd}),s.push(e)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function tq(t,e={}){let i,s=e.root??tR;for(let e of(await tO(s)))if(e.conversationId===t){i=e;break}if(!i)return null;let a=tL.get(i.filePath);if(a&&a.mtimeMs===i.mtimeMs&&a.sizeBytes===i.sizeBytes&&a.cwd===i.cwd)return a.detail;let{meta:n,events:o}=await tW(i),r={...n,events:o};return tL.set(i.filePath,{detail:r,mtimeMs:i.mtimeMs,sizeBytes:i.sizeBytes,cwd:i.cwd}),r}let tG=(e=s.default.homedir(),a.default.join(e,".config","Claude","local-agent-mode-sessions")),tH=/^local_[0-9a-f-]+$/;async function tK(t){return i.promises.readdir(t).catch(()=>[])}async function tY(t){let e=await i.promises.stat(t).catch(()=>null);return e?e.mtimeMs:0}async function tZ(t){let e=[];for(let s of(await tK(t))){let n=a.default.join(t,s);for(let t of(await tK(n))){let s=a.default.join(n,t),o=await tY(a.default.join(s,"spaces.json"));for(let t of(await tK(s))){if(!tH.test(t))continue;let n=a.default.join(s,t,"audit.jsonl"),r=await i.promises.stat(n).catch(()=>null);if(!r||!r.isFile()||0===r.size)continue;let l=a.default.join(s,`${t}.json`),u=await tY(l);e.push({sessionId:t,auditPath:n,metaPath:l,workspaceDir:s,auditMtimeMs:r.mtimeMs,auditSize:r.size,metaMtimeMs:u,spacesMtimeMs:o})}}}return e}let tQ=new Map;async function tV(t){let e=a.default.join(t,"spaces.json"),s=await i.promises.stat(e).catch(()=>null);if(!s)return new Map;let n=tQ.get(t);if(n&&n.mtimeMs===s.mtimeMs)return n.spaceIdToPath;let o=await i.promises.readFile(e,"utf8").catch(()=>""),r=new Map;try{for(let t of JSON.parse(o).spaces??[]){let e="string"==typeof t.id?t.id:void 0,i=(Array.isArray(t.folders)?t.folders:[])[0],s="string"==typeof i?.path?i.path:void 0;e&&s&&r.set(e,s)}}catch{}return tQ.set(t,{mtimeMs:s.mtimeMs,spaceIdToPath:r}),r}async function tX(t){let e=await i.promises.readFile(t,"utf8").catch(()=>"");if(!e)return{};try{let t=JSON.parse(e);return{spaceId:"string"==typeof t.spaceId?t.spaceId:void 0,userSelectedFolders:Array.isArray(t.userSelectedFolders)?t.userSelectedFolders.filter(t=>"string"==typeof t):void 0,cwd:"string"==typeof t.cwd?t.cwd:void 0,model:"string"==typeof t.model?t.model:void 0,title:"string"==typeof t.title?t.title:void 0,createdAt:"number"==typeof t.createdAt?t.createdAt:void 0,lastActivityAt:"number"==typeof t.lastActivityAt?t.lastActivityAt:void 0}}catch{return{}}}async function t0(t){let e=await i.promises.readFile(t,"utf8"),s=[];for(let t of e.split("\n")){let e=t.trim();if(e)try{s.push(JSON.parse(e))}catch{}}return s}async function t1(t){let e,[i,s,a]=await Promise.all([t0(t.auditPath),tX(t.metaPath),tV(t.workspaceDir)]),n=(e=new Map,i.forEach((t,s)=>{if("string"!=typeof t.uuid)return;let a=e.get(t.uuid);void 0===a?e.set(t.uuid,s):void 0===i[a].timestamp&&void 0!==t.timestamp&&e.set(t.uuid,s)}),i.filter((t,i)=>"string"!=typeof t.uuid||e.get(t.uuid)===i)),{mainLines:o,subagentGroups:r}=function(t){let e=[],i=new Map;for(let s of t){let t=s.parent_tool_use_id;if("string"==typeof t){let e=i.get(t);e?e.push(s):i.set(t,[s])}else e.push(s)}return{mainLines:e,subagentGroups:i}}(n),{meta:l,events:u}=p(o),c=function(t,e,i){if(0===t.size)return[];let s=new Map;for(let i of e){let e=i.message?.content;if(Array.isArray(e)){for(let a of e)if(a&&"object"==typeof a){if("tool_use"===a.type&&"Agent"===a.name&&"string"==typeof a.id){let t=a.input??{},e=s.get(a.id)??{};"string"==typeof i.uuid&&(e.parentUuid=i.uuid),"string"==typeof t.description&&(e.description=t.description),"string"==typeof t.subagent_type&&(e.agentType=t.subagent_type),"string"==typeof t.prompt&&(e.prompt=t.prompt),s.set(a.id,e)}else if("tool_result"===a.type&&"string"==typeof a.tool_use_id&&t.has(a.tool_use_id)){let t=s.get(a.tool_use_id)??{};t.finalText=function(t){if("string"==typeof t)return t;if(Array.isArray(t)){let e=[];for(let i of t)if(i&&"object"==typeof i&&"text"===i.type){let t=i.text;"string"==typeof t&&e.push(t)}if(e.length)return e.join("\n")}}(a.content)??t.finalText,s.set(a.tool_use_id,t)}}}}let a=[];for(let[e,n]of t){let t=W(n),o=s.get(e)??{},r=o.finalText??t.finalText,l=r?r.replace(/\s+/g," ").trim().slice(0,240):t.finalPreview,u=void 0!==i&&void 0!==t.startMs?Math.max(0,t.startMs-i):void 0,c=void 0!==i&&void 0!==t.endMs?Math.max(0,t.endMs-i):void 0,d=void 0!==t.startMs&&void 0!==t.endMs?t.endMs-t.startMs:void 0;a.push({agentId:e,agentType:o.agentType??"unknown",description:o.description??(o.prompt?o.prompt.replace(/\s+/g," ").trim().slice(0,80):"(no description)"),startMs:t.startMs,endMs:t.endMs,durationMs:d,startTOffsetMs:u,endTOffsetMs:c,eventCount:t.eventCount,totalUsage:t.totalUsage,parentUuid:o.parentUuid,parentToolUseId:e,runInBackground:!1,finalPreview:l,finalText:r,prompt:o.prompt,model:t.model,toolCalls:t.toolCalls,toolCallCount:t.toolCallCount,assistantMessageCount:t.assistantMessageCount})}return a.sort((t,e)=>(t.startMs??0)-(e.startMs??0)),a}(r,n,l.firstTimestamp?Date.parse(l.firstTimestamp):void 0),{projectName:d,projectDir:m,cwd:f}=function(t,e){let i;if(t.spaceId&&(i=e.get(t.spaceId)),!i&&t.userSelectedFolders&&t.userSelectedFolders.length>0&&(i=t.userSelectedFolders[0]),!i)return{projectName:"cowork:unspaced",projectDir:"cowork-unspaced"};let s=y(i);return{projectName:s.projectName,worktreeName:s.worktreeName,projectDir:i.replace(/^\//,"-").replace(/\//g,"-"),cwd:i}}(s,a);return{meta:{...l,agent:"cowork",id:t.sessionId,sessionId:t.sessionId,filePath:t.auditPath,projectName:d,projectDir:m,cwd:f??l.cwd,model:l.model??s.model},events:u,subagents:c}}function t2(t){return{auditMtimeMs:t.auditMtimeMs,auditSize:t.auditSize,metaMtimeMs:t.metaMtimeMs,spacesMtimeMs:t.spacesMtimeMs}}function t8(t,e){return t.auditMtimeMs===e.auditMtimeMs&&t.auditSize===e.auditSize&&t.metaMtimeMs===e.metaMtimeMs&&t.spacesMtimeMs===e.spacesMtimeMs}let t4=new Map,t3=new Map;async function t9(t={}){let e=t.root??tG,i=await tZ(e),s=[];for(let t of i){let e=t2(t),i=t4.get(t.auditPath);if(i&&t8(i.key,e)){s.push(i.meta);continue}try{let{meta:i}=await t1(t);t4.set(t.auditPath,{meta:i,key:e}),s.push(i)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function t7(t,e={}){let i=e.root??tG,s=(await tZ(i)).find(e=>e.sessionId===t);if(!s)return null;let a=t2(s),n=t3.get(s.auditPath);if(n&&t8(n.key,a))return n.detail;let{meta:o,events:r,subagents:l}=await t1(s),u={...o,events:r,...l.length?{subagents:l}:{}};return t3.set(s.auditPath,{detail:u,key:a}),u}function t6(){let t=process.env.GROK_HOME||a.default.join(s.default.homedir(),".grok");return a.default.join(t,"sessions")}let t5=a.default.join(s.default.homedir(),".grok","sessions");async function et(t){return i.promises.readdir(t).catch(()=>[])}async function ee(t){let e=await i.promises.readFile(t,"utf8").catch(()=>null);if(null==e)return null;try{return JSON.parse(e)}catch{return null}}async function ei(t,e){let s=a.default.join(t,".cwd"),n=await i.promises.readFile(s,"utf8").catch(()=>null);if(n&&n.trim())return n.trim();try{return decodeURIComponent(e)}catch{return e}}async function es(t){let e=[];for(let s of(await et(t))){if("session_search.sqlite"===s||s.startsWith("."))continue;let n=a.default.join(t,s),o=await i.promises.stat(n).catch(()=>null);if(!o?.isDirectory())continue;let r=await ei(n,s);for(let t of(await et(n))){if("prompt_history.jsonl"===t||t.startsWith("."))continue;let o=a.default.join(n,t),l=a.default.join(o,"summary.json"),u=a.default.join(o,"updates.jsonl"),c=a.default.join(o,"signals.json"),[d,m,p]=await Promise.all([i.promises.stat(l).catch(()=>null),i.promises.stat(u).catch(()=>null),i.promises.stat(c).catch(()=>null)]);if(!d?.isFile())continue;let f=Math.max(d.mtimeMs,m?.mtimeMs??0),g=(m?.size??0)+d.size;e.push({dirPath:o,updatesPath:u,summaryPath:l,signalsPath:p?.isFile()?c:null,sessionId:t,groupName:s,decodedCwd:r,mtimeMs:f,sizeBytes:g})}}return e}function ea(){return{input:0,output:0,cacheRead:0,cacheWrite:0}}function en(t){return t.replace(/\s+/g," ").trim().slice(0,200)}function eo(t){return t?"string"==typeof t?t:"string"==typeof t.text?t.text:"":""}async function er(t){let e,s,a,n,r,[l,u,c]=await Promise.all([ee(t.summaryPath),t.signalsPath?ee(t.signalsPath):Promise.resolve(null),i.promises.readFile(t.updatesPath,"utf8").catch(()=>"")]),d=l?.info?.id??t.sessionId,m=l?.info?.cwd??t.decodedCwd,p=l?.current_model_id??u?.primaryModelId??u?.modelsUsed?.[0],f=[],g=ea();u?.contextTokensUsed&&u.contextTokensUsed>0&&(g.input=u.contextTokensUsed);let h=0,w=0,M=[],v=0,k=new Set,_=0;function N(t){f.push(t),function(t,i){if(!t||"meta"===i)return;e||(e=t),s=t;let a=Date.parse(t);Number.isFinite(a)&&M.push(a)}(t.timestamp,t.role)}let T=null;function j(){if(!T)return;let t=T.texts.join(""),e=en(t);if("user"===T.kind){let i=!t||(0,o.isFrameworkInjectedUserInput)(t);t&&!i&&(a||(a=e),n=e,w+=1),t&&N({index:v++,timestamp:T.firstTs,role:"user",rawType:"grok/user_message",preview:e,blocks:[{type:"text",text:t}],messageId:T.promptId,raw:1===T.raw.length?T.raw[0]:T.raw})}else"agent"===T.kind?(t&&(r=e),t&&N({index:v++,timestamp:T.firstTs,role:"agent",rawType:"grok/agent_message",preview:e,blocks:[{type:"text",text:t}],messageId:T.promptId,model:T.model??p,raw:1===T.raw.length?T.raw[0]:T.raw})):"thought"===T.kind&&t&&N({index:v++,timestamp:T.firstTs,role:"agent-thinking",rawType:"grok/agent_thought",preview:e,blocks:[{type:"thinking",thinking:t}],messageId:T.promptId,model:T.model??p,raw:1===T.raw.length?T.raw[0]:T.raw});T=null}function b(t,e,i,s,a,n){(e||"user"!==t)&&(T&&T.kind!==t&&j(),T||(T={kind:t,texts:[],firstTs:i,lastTs:i,model:a,promptId:s,raw:[]}),e&&T.texts.push(e),T.lastTs=i??T.lastTs,a&&(T.model=a),s&&(T.promptId=s),T.raw.push(n))}for(let t of c.split("\n")){let e,i=t.trim();if(!i)continue;try{e=JSON.parse(i)}catch{continue}let s=e.params?.update;if(!s||"object"!=typeof s)continue;let a=s.sessionUpdate;if(!a)continue;let n=function(t){let e=t.params?._meta,i=e&&"number"==typeof e.agentTimestampMs?e.agentTimestampMs:void 0;if(null!=i&&Number.isFinite(i))return new Date(i).toISOString();let s=t.timestamp;if("number"==typeof s&&Number.isFinite(s))return new Date(s>1e12?s:1e3*s).toISOString()}(e),o=e.params?._meta??{},r=s._meta??{},l="string"==typeof o.promptId&&o.promptId||"string"==typeof r.promptId&&r.promptId||void 0,u="string"==typeof r.modelId&&r.modelId||"string"==typeof o.modelId&&o.modelId||void 0;u&&(p=u);let c=o.totalTokens;if("number"==typeof c&&c>_&&(_=c),"user_message_chunk"===a){b("user",eo(s.content),n,l,u,e);continue}if("agent_message_chunk"===a){b("agent",eo(s.content),n,l,u,e);continue}if("agent_thought_chunk"===a){b("thought",eo(s.content),n,l,u,e);continue}if(j(),"tool_call"===a){let t="string"==typeof s.toolCallId?s.toolCallId:`grok-${v}`,i=function(t){let e=t._meta;if(e&&"object"==typeof e){let t=e["x.ai/tool"];if(t&&"object"==typeof t){let e=t.name;if("string"==typeof e&&e)return e}}return"string"==typeof t.title&&t.title?(!t.title.includes(" ")&&!t.title.includes("`"),t.title):"tool"}(s),a=s.rawInput??{},o=a?JSON.stringify(a):"";h+=1,N({index:v++,timestamp:n,role:"tool-call",rawType:"grok/tool_call",preview:`${i}(${o.length<=80?o:o.slice(0,79)+"…"})`,blocks:[{type:"tool_use",id:t,name:i,input:a}],toolName:i,toolUseId:t,model:p,raw:e});continue}if("tool_call_update"===a){let t=function(t){let e=t.status;return"string"==typeof e?e:e&&"object"==typeof e&&"string"==typeof e.status?e.status:void 0}(s);if("completed"!==t&&"failed"!==t&&"error"!==t&&"cancelled"!==t)continue;let i="string"==typeof s.toolCallId?s.toolCallId:"";if(i&&k.has(i))continue;i&&k.add(i);let a=function(t){let e=t.content;if(Array.isArray(e)){let t=[];for(let i of e){if(!i||"object"!=typeof i)continue;if("string"==typeof i.text&&i.text){t.push(i.text);continue}let e=i.content;"string"==typeof e&&e?t.push(e):e&&"object"==typeof e&&"string"==typeof e.text&&t.push(e.text)}if(t.length)return t.join("\n")}let i=t.rawOutput;if(null==i)return"";if("string"==typeof i)return i;if("object"==typeof i){if("string"==typeof i.output_for_prompt)return i.output_for_prompt;if("string"==typeof i.summary_for_prompt)return i.summary_for_prompt;if(i.Content&&"object"==typeof i.Content){let t=i.Content;if("string"==typeof t.content)return t.content}if(i.TodosUpdated&&"object"==typeof i.TodosUpdated){let t=i.TodosUpdated;if("string"==typeof t.summary_for_prompt)return t.summary_for_prompt}if(Array.isArray(i.stdout)||Array.isArray(i.output))try{return JSON.stringify({type:i.type,exit_code:i.exit_code,note:"binary/stdout omitted"})}catch{return""}try{return JSON.stringify(i)}catch{return""}}return String(i)}(s),o="failed"===t||"error"===t||"cancelled"===t;N({index:v++,timestamp:n,role:"tool-result",rawType:"grok/tool_result",preview:en(a),blocks:[{type:"tool_result",tool_use_id:i,content:a,is_error:o||void 0}],toolUseId:i||void 0,toolResult:a,raw:e});continue}if("turn_completed"===a)continue}j(),0===g.input&&_>0&&(g.input=_),!e&&l?.created_at&&(e=l.created_at),s||(s=l?.last_active_at??l?.updated_at??e),u?.toolCallCount!=null&&u.toolCallCount>h&&(h=u.toolCallCount),u?.turnCount!=null&&u.turnCount>w&&(w=u.turnCount);let I=e?Date.parse(e):void 0;if(void 0!==I&&Number.isFinite(I)){let t;for(let e of f){if(!e.timestamp)continue;let i=Date.parse(e.timestamp);Number.isFinite(i)&&(e.tOffsetMs=Math.max(0,i-I),void 0!==t&&(e.gapMs=Math.max(0,i-t)),t=i)}}let C=function(t){if(0===t.length)return[];let e=[...t].sort((t,e)=>t-e),i=[],s=e[0],a=e[0];for(let t=1;t<e.length;t++){let n=e[t];n-a>18e4&&(i.push({startMs:s,endMs:a}),s=n),a=n}return i.push({startMs:s,endMs:a}),i}(M),x=C.reduce((t,e)=>t+(e.endMs-e.startMs),0),S=e&&s?Date.parse(s)-Date.parse(e):void 0,A=m?y(m):void 0,P=A?.projectName??m??t.decodedCwd,D=t.groupName||(m?encodeURIComponent(m):"(unknown)");if(!a){let t=l?.generated_title||l?.session_summary;t&&(a=en(t))}let U=await el(t.dirPath);return{meta:{agent:"grok",id:d,filePath:t.updatesPath,projectName:P,worktreeName:A?.worktreeName,repoName:A?.repoName,projectDir:D,sessionId:d,firstTimestamp:e,lastTimestamp:s,lastActivityMs:s?Date.parse(s):void 0,durationMs:S&&Number.isFinite(S)?S:void 0,eventCount:f.length,model:p,cwd:m,gitBranch:l?.head_branch,agentName:l?.agent_name,totalUsage:g,status:"idle",firstUserPreview:a,lastUserPreview:n,lastAgentPreview:r,toolCallCount:h,turnCount:w,linesAdded:u?.agentLinesAdded,linesRemoved:u?.agentLinesRemoved,airTimeMs:x,activeSegments:C,...U>0?{spawnedAgentCount:U}:{}},events:f,sessionKind:l?.session_kind}}async function el(t){let e=a.default.join(t,"subagents"),s=await et(e),n=0;for(let t of s){let s=await i.promises.stat(a.default.join(e,t)).catch(()=>null);s?.isDirectory()&&(n+=1)}return n}async function eu(t,e){let i=a.default.join(t.dirPath,"subagents"),s=await et(i),n=a.default.dirname(t.dirPath),o=[];for(let t of s){let s=a.default.join(i,t,"meta.json"),r=await ee(s);if(!r)continue;let l=r.child_session_id??r.subagent_id??t,u=a.default.join(n,l),[c,d]=await Promise.all([ee(a.default.join(u,"summary.json")),ee(a.default.join(u,"signals.json"))]),m=c?.created_at?Date.parse(c.created_at):void 0,p=c?.last_active_at??c?.updated_at,f=p?Date.parse(p):void 0,g=void 0!==m&&Number.isFinite(m)?m:void 0,y=void 0!==f&&Number.isFinite(f)?f:void 0,h=ea();d?.contextTokensUsed&&(h.input=d.contextTokensUsed),o.push({agentId:l,agentType:r.subagent_type??c?.agent_name??"subagent",description:r.description&&r.description.trim()||c?.generated_title||c?.session_summary||l,startMs:g,endMs:y,durationMs:void 0!==g&&void 0!==y?Math.max(0,y-g):void 0,startTOffsetMs:void 0!==e&&void 0!==g?Math.max(0,g-e):void 0,endTOffsetMs:void 0!==e&&void 0!==y?Math.max(0,y-e):void 0,eventCount:c?.num_messages??c?.num_chat_messages??0,totalUsage:h,prompt:"string"==typeof r.prompt?r.prompt:void 0,model:c?.current_model_id??d?.primaryModelId,toolCallCount:d?.toolCallCount})}return o.sort((t,e)=>(t.startMs??0)-(e.startMs??0)),o}let ec=new Map,ed=new Map;async function em(t={}){let e=t.root??t6(),i=await es(e),s=[];for(let t of i){let e=await ee(t.summaryPath);if(e?.session_kind==="subagent")continue;let i=ec.get(t.dirPath);if(i&&i.mtimeMs===t.mtimeMs&&i.sizeBytes===t.sizeBytes){s.push(i.meta);continue}try{let{meta:e,sessionKind:i}=await er(t);if("subagent"===i)continue;ec.set(t.dirPath,{meta:e,mtimeMs:t.mtimeMs,sizeBytes:t.sizeBytes}),s.push(e)}catch{}}return(s.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?s.slice(0,t.limit):s}async function ep(t,e={}){let i=e.root??t6(),s=await es(i),a=s.find(e=>e.sessionId===t);if(!a){for(let e of s)try{let{meta:i,events:s}=await er(e);if(i.id===t){let t={...i,events:s};return ed.set(e.dirPath,{detail:t,mtimeMs:e.mtimeMs,sizeBytes:e.sizeBytes}),t}}catch{}return null}let n=ed.get(a.dirPath);if(n&&n.mtimeMs===a.mtimeMs&&n.sizeBytes===a.sizeBytes)return n.detail;let{meta:o,events:r}=await er(a),l=o.firstTimestamp?Date.parse(o.firstTimestamp):void 0,u=await eu(a,void 0!==l&&Number.isFinite(l)?l:void 0),c={...o,events:r,...u.length>0?{subagents:u,spawnedAgentCount:u.length}:{}};return ed.set(a.dirPath,{detail:c,mtimeMs:a.mtimeMs,sizeBytes:a.sizeBytes}),ec.set(a.dirPath,{meta:{...o,...u.length>0?{spawnedAgentCount:u.length}:{}},mtimeMs:a.mtimeMs,sizeBytes:a.sizeBytes}),c}function ef(){return process.env.CCLENS_HOME||a.default.join(s.default.homedir(),".cclens")}function eg(...t){return a.default.join(ef(),...t)}function ey(t){b(t)}let eh=[q,{...n.CODEX_METADATA,defaultRoot:G,listSessions:async t=>ts(t),getSession:async t=>ta(t)},{...n.COPILOT_METADATA,defaultRoot:tn,listSessions:async t=>th(t),getSession:async(t,e)=>tw(t,e)},{...n.GEMINI_METADATA,defaultRoot:tM,listSessions:async t=>tD(t),getSession:async t=>tU(t)},{...n.ANTIGRAVITY_METADATA,defaultRoot:tR,listSessions:async t=>tJ(t),getSession:async t=>tq(t)},{...n.COWORK_METADATA,defaultRoot:tG,listSessions:async t=>t9(t),getSession:async t=>t7(t)},{...n.GROK_METADATA,defaultRoot:t5,listSessions:async t=>em(t),getSession:async(t,e)=>ep(t,e)}];async function ew(t={}){let e=await Promise.all(eh.map(e=>e.listSessions(t))),i=[];for(let t of e)i.push(...t);return(i.sort((t,e)=>(e.firstTimestamp??"").localeCompare(t.firstTimestamp??"")),void 0!==t.limit)?i.slice(0,t.limit):i}async function eM(t){for(let e of eh){let i=await e.getSession(t);if(i)return i}return null}function ev(){return eg("usage.jsonl")}function ek(t){let e=ev();(0,i.mkdirSync)(a.default.dirname(e),{recursive:!0}),(0,i.appendFileSync)(e,JSON.stringify(t)+"\n","utf8")}function e_(t){let e=ev();if(!(0,i.existsSync)(e))return;let s=(0,i.readFileSync)(e,"utf8").split("\n").filter(e=>{if(!e.trim())return!1;try{return JSON.parse(e).agent!==t}catch{return!0}});(0,i.mkdirSync)(a.default.dirname(e),{recursive:!0}),(0,i.writeFileSync)(e,s.join("\n")+(s.length?"\n":""),"utf8")}}];
2
2
 
3
3
  //# sourceMappingURL=packages_parser_dist_10ihc3~._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},71306,(a,b,c)=>{b.exports=a.r(18622)},79847,a=>{a.n(a.i(3343))},9185,a=>{a.n(a.i(29432))},72842,a=>{a.n(a.i(75164))},54897,a=>{a.n(a.i(30106))},56157,a=>{a.n(a.i(18970))},94331,a=>{a.n(a.i(60644))},15988,a=>{a.n(a.i(56952))},25766,a=>{a.n(a.i(77341))},29725,a=>{a.n(a.i(94290))},5785,a=>{a.n(a.i(90588))},74793,a=>{a.n(a.i(33169))},85826,a=>{a.n(a.i(18866))},21565,a=>{a.n(a.i(41763))},65911,a=>{a.n(a.i(8950))},25128,a=>{a.n(a.i(91562))},40781,a=>{a.n(a.i(49670))},69411,a=>{a.n(a.i(75700))},63081,a=>{a.n(a.i(276))},62837,a=>{a.n(a.i(40795))},34607,a=>{a.n(a.i(11614))},96338,a=>{a.n(a.i(21751))},50642,a=>{a.n(a.i(12213))},32242,a=>{a.n(a.i(22693))},88530,a=>{a.n(a.i(10531))},8583,a=>{a.n(a.i(1082))},38534,a=>{a.n(a.i(98175))},70408,a=>{a.n(a.i(9095))},22922,a=>{a.n(a.i(96772))},78294,a=>{a.n(a.i(71717))},16625,a=>{a.n(a.i(85034))},88648,a=>{a.n(a.i(68113))},51914,a=>{a.n(a.i(66482))},25466,a=>{a.n(a.i(91505))},87067,a=>{"use strict";let b={input:1,output:5,cacheRead:.1,cacheWrite:1.25},c={input:3,output:15,cacheRead:.3,cacheWrite:3.75},d={input:5,output:25,cacheRead:.5,cacheWrite:6.25};a.s(["estimateCostMulti",0,function(a){return a.reduce((a,e)=>{var f;let g;return a+(f=e.totalUsage,g=function(a){if(!a)return d;let e=a.toLowerCase();return e.includes("haiku")?b:e.includes("sonnet")?c:d}(e.model),f.input/1e6*g.input+f.output/1e6*g.output+f.cacheRead/1e6*g.cacheRead+f.cacheWrite/1e6*g.cacheWrite)},0)},"formatCost",0,function(a){return a<.01?"<$0.01":a<1||a<100?`$${a.toFixed(2)}`:a<1e3?`$${a.toFixed(1)}`:`$${a.toLocaleString(void 0,{maximumFractionDigits:0})}`},"formatDuration",0,function(a){if(void 0===a)return"—";if(a<1e3)return`${a}ms`;let b=Math.round(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60),d=b%60;if(c<60)return d?`${c}m ${d}s`:`${c}m`;let e=Math.floor(c/60),f=c%60;return f?`${e}h ${f}m`:`${e}h`},"formatGap",0,function(a){if(a<1e3)return`${a}ms`;let b=a/1e3;if(b<60)return`${b.toFixed(1)}s`;let c=Math.floor(b/60);if(c<60){let a=Math.round(b%60);return`${c}m ${a}s`}let d=Math.floor(c/60),e=c%60;if(d<24)return e?`${d}h ${e}m`:`${d}h`;let f=Math.floor(d/24),g=d%24;return g?`${f}d ${g}h`:`${f}d`},"formatRelative",0,function(a){let b=Date.parse(a);if(Number.isNaN(b))return a;let c=Math.round((Date.now()-b)/1e3);if(c<60)return`${c}s ago`;let d=Math.round(c/60);if(d<60)return`${d}m ago`;let e=Math.round(d/60);if(e<24)return`${e}h ago`;let f=Math.round(e/24);return`${f}d ago`},"formatTokens",0,function(a){return a<1e3?String(a):a<1e4?(a/1e3).toFixed(1)+"k":a<1e6?Math.round(a/1e3)+"k":a<1e7?(a/1e6).toFixed(2)+"M":(a/1e6).toFixed(1)+"M"},"prettyProjectName",0,function(a,b=35){let c=a.split("/").filter(Boolean),d=c.lastIndexOf(".worktrees");if(d>0&&d<c.length-1){let a=c[d-1],e=c[d+1],f=`${a}/${e}`;return f.length<=b?f:"…"+f.slice(f.length-b+1)}let e=c.length>=2?`${c[c.length-2]}/${c[c.length-1]}`:c[c.length-1]??a;return e.length<=b?e:"…"+e.slice(e.length-b+1)}])},27470,a=>{a.v("/_next/static/media/icon.0h9o_.fpzdvkq.svg"+(globalThis.NEXT_CLIENT_ASSET_SUFFIX||""))},21192,a=>{"use strict";let b={src:a.i(27470).default,width:32,height:32};a.s(["default",0,b])},69349,a=>{"use strict";a.s(["SyncedProjectsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call SyncedProjectsForm() from the server but SyncedProjectsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/synced-projects-form.tsx <module evaluation>","SyncedProjectsForm")},84537,a=>{"use strict";a.s(["SyncedProjectsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call SyncedProjectsForm() from the server but SyncedProjectsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/synced-projects-form.tsx","SyncedProjectsForm")},56509,a=>{"use strict";a.i(69349);var b=a.i(84537);a.n(b)},60931,a=>{"use strict";a.s(["ForceSyncButton",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ForceSyncButton() from the server but ForceSyncButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/force-sync-button.tsx <module evaluation>","ForceSyncButton")},86872,a=>{"use strict";a.s(["ForceSyncButton",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ForceSyncButton() from the server but ForceSyncButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/force-sync-button.tsx","ForceSyncButton")},35770,a=>{"use strict";a.i(60931);var b=a.i(86872);a.n(b)},64181,a=>{"use strict";var b=a.i(7997),c=a.i(20192),d=a.i(78991),e=a.i(56509);async function f(){let a=(0,c.readTeamConfig)();if(!a)return null;if(a.setupPending)return(0,b.jsxs)("section",{className:"space-y-2",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Synced projects"}),(0,b.jsxs)("p",{className:"text-sm text-gray-500",children:["Setup isn’t finished yet — finish the"," ",(0,b.jsx)("a",{className:"underline",href:"/team/onboarding",children:"onboarding wizard"})," ","to choose which projects sync to your team."]})]});let f=await (0,d.listSyncProjectRows)();return(0,b.jsxs)("section",{className:"space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Synced projects"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Choose which projects share metrics with your team. Saving a changed selection re-pushes your full history so the server matches it — excluded projects disappear, newly included ones backfill."}),(0,b.jsx)(e.SyncedProjectsForm,{projects:f,initial:a.syncProjects??{autoIncludeNew:!0,included:[],excluded:[]}})]})}var g=a.i(60511),h=a.i(87067),i=a.i(35770);let j={green:"var(--af-success, #10b981)",amber:"var(--af-warning, #f59e0b)",red:"var(--af-error, #ef4444)"};function k(){let a=(0,g.readTeamConnection)();if(!a.paired)return null;let{lastPush:c,health:d}=a,e=!!process.env.FLEETLENS_CLI_BIN;return(0,b.jsxs)("section",{id:"team",className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Sync activity"}),(0,b.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:j[d],display:"inline-block"}})]}),(0,b.jsxs)("dl",{className:"grid grid-cols-[8rem_1fr] gap-y-1 text-sm text-gray-600",children:[(0,b.jsx)("dt",{children:"Last sync"}),(0,b.jsx)("dd",{suppressHydrationWarning:!0,children:"none"===c.kind?"Waiting for the first sync — the daemon pushes every 5 minutes.":`${(0,h.formatRelative)(c.at)} (${new Date(c.at).toLocaleString()})`})]}),"ok"===c.kind&&(0,b.jsxs)("div",{className:"af-panel p-4 space-y-3 text-sm",children:[(0,b.jsxs)("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:["Last push",c.payload.dailyRollup?` — ${c.payload.dailyRollup.day}`:""]}),c.payload.dailyRollup&&(0,b.jsxs)("dl",{className:"grid grid-cols-[10rem_1fr] gap-y-1 text-sm text-gray-700",children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Agent time"}),(0,b.jsx)("dd",{children:(0,h.formatDuration)(c.payload.dailyRollup.agentTimeMs)}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Session count"}),(0,b.jsx)("dd",{children:c.payload.dailyRollup.sessions}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Tool call count"}),(0,b.jsx)("dd",{children:c.payload.dailyRollup.toolCalls}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Turn count"}),(0,b.jsx)("dd",{children:c.payload.dailyRollup.turns}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Token total"}),(0,b.jsx)("dd",{children:(0,h.formatTokens)(c.payload.dailyRollup.tokens.input+c.payload.dailyRollup.tokens.output+c.payload.dailyRollup.tokens.cacheRead+c.payload.dailyRollup.tokens.cacheWrite)}),c.payload.planTier&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Plan tier"}),(0,b.jsx)("dd",{children:c.payload.planTier})]})]}),!c.payload.dailyRollup&&c.payload.planTier&&(0,b.jsxs)("dl",{className:"grid grid-cols-[10rem_1fr] gap-y-1 text-sm text-gray-700",children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Plan tier"}),(0,b.jsx)("dd",{children:c.payload.planTier})]}),!c.payload.dailyRollup&&!c.payload.planTier&&(0,b.jsx)("div",{className:"text-gray-500",children:"Live utilization snapshot only — no new daily activity."}),(0,b.jsxs)("details",{className:"text-xs",children:[(0,b.jsx)("summary",{className:"cursor-pointer text-gray-500 hover:text-gray-700",children:"Show raw JSON payload"}),(0,b.jsx)("pre",{className:"af-panel mt-2 p-3 font-mono text-[11px] whitespace-pre-wrap overflow-x-auto",children:JSON.stringify(c.payload,null,2)})]})]}),"error"===c.kind&&(0,b.jsxs)("div",{className:"af-panel-danger p-4 text-sm",children:[(0,b.jsx)("div",{className:"font-medium",children:"Last sync failed"}),(0,b.jsx)("div",{children:c.error})]}),(0,b.jsx)(i.ForceSyncButton,{cliAvailable:e})]})}a.s(["default",0,function(){var a;let d=(0,c.readTeamConfig)();if(!d)return(0,b.jsxs)("main",{className:"mx-auto max-w-3xl p-6 space-y-6",children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:"Team sync"}),(0,b.jsxs)("section",{className:"af-card border-dashed text-sm space-y-3",children:[(0,b.jsx)("p",{className:"font-medium",children:"Not paired with any team."}),(0,b.jsx)("p",{className:"text-gray-600",children:"To pair this machine with a Fleetlens team server, run from a terminal:"}),(0,b.jsx)("pre",{className:"bg-gray-100 dark:bg-gray-900 p-3 rounded text-xs overflow-x-auto",children:"fleetlens team join <server-url> <invite-token>"}),(0,b.jsx)("p",{className:"text-gray-600",children:"Your team admin can generate an invite token from the team server’s Settings page."})]})]});let e=(0,c.toTeamConfigView)(d),g=d.syncProjects,h=g?g.autoIncludeNew?`Syncing: all projects except ${g.excluded.length} excluded`:`Syncing: only ${g.included.length} selected project${1===g.included.length?"":"s"}`:null;return(0,b.jsxs)("main",{className:"mx-auto max-w-3xl p-6 space-y-8",children:[(0,b.jsxs)("header",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:"Team sync"}),(0,b.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"What your daemon shares with your team server."})]}),d.setupPending&&(0,b.jsxs)("div",{className:"border border-amber-400/40 bg-amber-400/10 rounded-lg p-4 text-sm",children:["Setup isn’t finished — nothing is syncing yet."," ",(0,b.jsx)("a",{className:"underline font-medium",href:"/team/onboarding",children:"Finish onboarding"})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Pairing"}),(0,b.jsx)("span",{className:"text-xs uppercase tracking-wide text-green-700 dark:text-green-400",children:"Connected"})]}),(0,b.jsxs)("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1.5 text-sm",children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Team slug"}),(0,b.jsx)("dd",{className:"font-mono",children:e.teamSlug}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Server"}),(0,b.jsx)("dd",{className:"font-mono break-all",children:(0,b.jsxs)("a",{href:e.serverUrl,target:"_blank",rel:"noreferrer",className:"hover:underline",children:[e.serverUrl," ",(0,b.jsx)("span",{"aria-hidden":!0,children:"↗"})]})}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Member ID"}),(0,b.jsx)("dd",{className:"font-mono break-all text-xs",children:e.memberId}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Bearer token"}),(0,b.jsx)("dd",{className:"font-mono text-xs",children:e.bearerTokenMasked}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Paired"}),(0,b.jsx)("dd",{children:new Date(e.pairedAt).toLocaleString()}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Last day pushed"}),(0,b.jsx)("dd",{children:(a=e.lastSyncedDay)?a:"never"}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Last usage snapshot"}),(0,b.jsx)("dd",{children:function(a){if(!a)return"never";let b=Date.parse(a);if(Number.isNaN(b))return a;let c=Date.now()-b;return c<0?new Date(b).toLocaleString():c<6e4?`${Math.round(c/1e3)}s ago`:c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:new Date(b).toLocaleString()}(e.lastSyncedUsageSnapshotAt)})]})]}),(0,b.jsx)("section",{className:"af-card",children:(0,b.jsx)(k,{})}),(0,b.jsx)("section",{className:"af-card",children:(0,b.jsx)(f,{})}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"What gets shared"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:h??"Syncing: all projects (no selection set)."}),(0,b.jsxs)("ul",{className:"text-sm space-y-2",children:[(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Daily rollup"})," — agent time, session count, tool calls, turns, token totals."]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Rich rollup"})," (Entry-derived counts) for each synced project: working-shape distribution, top skills, subagents dispatched, long-autonomous turns, plan-mode usage, brainstorm warmups, tool errors, PRs/commits/pushes. Project labels only; never raw prompts or agent output."]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Plan utilization snapshot"}),"— current 5h + 7d utilization windows, per Anthropic’s rate-limit API."]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Enriched extras"})," — outcome / helpfulness / goal minute mix, derived locally by your AI-features pipeline (no new model calls ride along with the push)."]})]}),(0,b.jsxs)("div",{className:"af-panel p-4 text-sm space-y-2",children:[(0,b.jsx)("div",{className:"font-medium",children:"What does NOT leave your machine"}),(0,b.jsxs)("ul",{className:"list-disc list-inside text-gray-600 space-y-1",children:[(0,b.jsx)("li",{children:"Session transcripts, prompts, or assistant responses"}),(0,b.jsx)("li",{children:"Absolute paths, file contents, or tool-call payloads"}),(0,b.jsx)("li",{children:"Anything from projects you exclude above"}),(0,b.jsx)("li",{children:"Anything from sessions older than the start-of-day rollup window"})]})]})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Disconnect"}),(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"To leave the team and stop all syncing, run:"}),(0,b.jsx)("pre",{className:"bg-gray-100 dark:bg-gray-900 p-3 rounded text-xs",children:"fleetlens team leave"})]})]})},"dynamic",0,"force-dynamic"],64181)},84356,a=>{a.n(a.i(64181))}];
1
+ module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},71306,(a,b,c)=>{b.exports=a.r(18622)},79847,a=>{a.n(a.i(3343))},9185,a=>{a.n(a.i(29432))},72842,a=>{a.n(a.i(75164))},54897,a=>{a.n(a.i(30106))},56157,a=>{a.n(a.i(18970))},94331,a=>{a.n(a.i(60644))},15988,a=>{a.n(a.i(56952))},25766,a=>{a.n(a.i(77341))},29725,a=>{a.n(a.i(94290))},5785,a=>{a.n(a.i(90588))},74793,a=>{a.n(a.i(33169))},85826,a=>{a.n(a.i(18866))},21565,a=>{a.n(a.i(41763))},65911,a=>{a.n(a.i(8950))},25128,a=>{a.n(a.i(91562))},40781,a=>{a.n(a.i(49670))},69411,a=>{a.n(a.i(75700))},63081,a=>{a.n(a.i(276))},62837,a=>{a.n(a.i(40795))},34607,a=>{a.n(a.i(11614))},96338,a=>{a.n(a.i(21751))},50642,a=>{a.n(a.i(12213))},32242,a=>{a.n(a.i(22693))},88530,a=>{a.n(a.i(10531))},8583,a=>{a.n(a.i(1082))},38534,a=>{a.n(a.i(98175))},70408,a=>{a.n(a.i(9095))},22922,a=>{a.n(a.i(96772))},78294,a=>{a.n(a.i(71717))},16625,a=>{a.n(a.i(85034))},88648,a=>{a.n(a.i(68113))},51914,a=>{a.n(a.i(66482))},25466,a=>{a.n(a.i(91505))},87067,a=>{"use strict";let b={input:1,output:5,cacheRead:.1,cacheWrite:1.25},c={input:3,output:15,cacheRead:.3,cacheWrite:3.75},d={input:5,output:25,cacheRead:.5,cacheWrite:6.25},e={input:.25,output:2,cacheRead:.025,cacheWrite:.25};a.s(["estimateCostMulti",0,function(a){return a.reduce((a,f)=>{var g;let h;return a+(g=f.totalUsage,h=function(a){if(!a)return d;let f=a.toLowerCase();return f.includes("gpt-5-mini")?e:f.includes("haiku")?b:f.includes("sonnet")?c:d}(f.model),g.input/1e6*h.input+g.output/1e6*h.output+g.cacheRead/1e6*h.cacheRead+g.cacheWrite/1e6*h.cacheWrite)},0)},"formatCost",0,function(a){return a<.01?"<$0.01":a<1||a<100?`$${a.toFixed(2)}`:a<1e3?`$${a.toFixed(1)}`:`$${a.toLocaleString(void 0,{maximumFractionDigits:0})}`},"formatDuration",0,function(a){if(void 0===a)return"—";if(a<1e3)return`${a}ms`;let b=Math.round(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60),d=b%60;if(c<60)return d?`${c}m ${d}s`:`${c}m`;let e=Math.floor(c/60),f=c%60;return f?`${e}h ${f}m`:`${e}h`},"formatGap",0,function(a){if(a<1e3)return`${a}ms`;let b=a/1e3;if(b<60)return`${b.toFixed(1)}s`;let c=Math.floor(b/60);if(c<60){let a=Math.round(b%60);return`${c}m ${a}s`}let d=Math.floor(c/60),e=c%60;if(d<24)return e?`${d}h ${e}m`:`${d}h`;let f=Math.floor(d/24),g=d%24;return g?`${f}d ${g}h`:`${f}d`},"formatRelative",0,function(a){let b=Date.parse(a);if(Number.isNaN(b))return a;let c=Math.round((Date.now()-b)/1e3);if(c<60)return`${c}s ago`;let d=Math.round(c/60);if(d<60)return`${d}m ago`;let e=Math.round(d/60);if(e<24)return`${e}h ago`;let f=Math.round(e/24);return`${f}d ago`},"formatTokens",0,function(a){return a<1e3?String(a):a<1e4?(a/1e3).toFixed(1)+"k":a<1e6?Math.round(a/1e3)+"k":a<1e7?(a/1e6).toFixed(2)+"M":(a/1e6).toFixed(1)+"M"},"prettyProjectName",0,function(a,b=35){let c=a.split("/").filter(Boolean),d=c.lastIndexOf(".worktrees");if(d>0&&d<c.length-1){let a=c[d-1],e=c[d+1],f=`${a}/${e}`;return f.length<=b?f:"…"+f.slice(f.length-b+1)}let e=c.length>=2?`${c[c.length-2]}/${c[c.length-1]}`:c[c.length-1]??a;return e.length<=b?e:"…"+e.slice(e.length-b+1)}])},27470,a=>{a.v("/_next/static/media/icon.0h9o_.fpzdvkq.svg"+(globalThis.NEXT_CLIENT_ASSET_SUFFIX||""))},21192,a=>{"use strict";let b={src:a.i(27470).default,width:32,height:32};a.s(["default",0,b])},69349,a=>{"use strict";a.s(["SyncedProjectsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call SyncedProjectsForm() from the server but SyncedProjectsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/synced-projects-form.tsx <module evaluation>","SyncedProjectsForm")},84537,a=>{"use strict";a.s(["SyncedProjectsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call SyncedProjectsForm() from the server but SyncedProjectsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/synced-projects-form.tsx","SyncedProjectsForm")},56509,a=>{"use strict";a.i(69349);var b=a.i(84537);a.n(b)},60931,a=>{"use strict";a.s(["ForceSyncButton",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ForceSyncButton() from the server but ForceSyncButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/force-sync-button.tsx <module evaluation>","ForceSyncButton")},86872,a=>{"use strict";a.s(["ForceSyncButton",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ForceSyncButton() from the server but ForceSyncButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/team/force-sync-button.tsx","ForceSyncButton")},35770,a=>{"use strict";a.i(60931);var b=a.i(86872);a.n(b)},64181,a=>{"use strict";var b=a.i(7997),c=a.i(20192),d=a.i(78991),e=a.i(56509);async function f(){let a=(0,c.readTeamConfig)();if(!a)return null;if(a.setupPending)return(0,b.jsxs)("section",{className:"space-y-2",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Synced projects"}),(0,b.jsxs)("p",{className:"text-sm text-gray-500",children:["Setup isn’t finished yet — finish the"," ",(0,b.jsx)("a",{className:"underline",href:"/team/onboarding",children:"onboarding wizard"})," ","to choose which projects sync to your team."]})]});let f=await (0,d.listSyncProjectRows)();return(0,b.jsxs)("section",{className:"space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Synced projects"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Choose which projects share metrics with your team. Saving a changed selection re-pushes your full history so the server matches it — excluded projects disappear, newly included ones backfill."}),(0,b.jsx)(e.SyncedProjectsForm,{projects:f,initial:a.syncProjects??{autoIncludeNew:!0,included:[],excluded:[]}})]})}var g=a.i(60511),h=a.i(87067),i=a.i(35770);let j={green:"var(--af-success, #10b981)",amber:"var(--af-warning, #f59e0b)",red:"var(--af-error, #ef4444)"};function k(){let a=(0,g.readTeamConnection)();if(!a.paired)return null;let{lastPush:c,health:d}=a,e=!!process.env.FLEETLENS_CLI_BIN;return(0,b.jsxs)("section",{id:"team",className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Sync activity"}),(0,b.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:j[d],display:"inline-block"}})]}),(0,b.jsxs)("dl",{className:"grid grid-cols-[8rem_1fr] gap-y-1 text-sm text-gray-600",children:[(0,b.jsx)("dt",{children:"Last sync"}),(0,b.jsx)("dd",{suppressHydrationWarning:!0,children:"none"===c.kind?"Waiting for the first sync — the daemon pushes every 5 minutes.":`${(0,h.formatRelative)(c.at)} (${new Date(c.at).toLocaleString()})`})]}),"ok"===c.kind&&(0,b.jsxs)("div",{className:"af-panel p-4 space-y-3 text-sm",children:[(0,b.jsxs)("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:["Last push",c.payload.dailyRollup?` — ${c.payload.dailyRollup.day}`:""]}),c.payload.dailyRollup&&(0,b.jsxs)("dl",{className:"grid grid-cols-[10rem_1fr] gap-y-1 text-sm text-gray-700",children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Agent time"}),(0,b.jsx)("dd",{children:(0,h.formatDuration)(c.payload.dailyRollup.agentTimeMs)}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Session count"}),(0,b.jsx)("dd",{children:c.payload.dailyRollup.sessions}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Tool call count"}),(0,b.jsx)("dd",{children:c.payload.dailyRollup.toolCalls}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Turn count"}),(0,b.jsx)("dd",{children:c.payload.dailyRollup.turns}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Token total"}),(0,b.jsx)("dd",{children:(0,h.formatTokens)(c.payload.dailyRollup.tokens.input+c.payload.dailyRollup.tokens.output+c.payload.dailyRollup.tokens.cacheRead+c.payload.dailyRollup.tokens.cacheWrite)}),c.payload.planTier&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Plan tier"}),(0,b.jsx)("dd",{children:c.payload.planTier})]})]}),!c.payload.dailyRollup&&c.payload.planTier&&(0,b.jsxs)("dl",{className:"grid grid-cols-[10rem_1fr] gap-y-1 text-sm text-gray-700",children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Plan tier"}),(0,b.jsx)("dd",{children:c.payload.planTier})]}),!c.payload.dailyRollup&&!c.payload.planTier&&(0,b.jsx)("div",{className:"text-gray-500",children:"Live utilization snapshot only — no new daily activity."}),(0,b.jsxs)("details",{className:"text-xs",children:[(0,b.jsx)("summary",{className:"cursor-pointer text-gray-500 hover:text-gray-700",children:"Show raw JSON payload"}),(0,b.jsx)("pre",{className:"af-panel mt-2 p-3 font-mono text-[11px] whitespace-pre-wrap overflow-x-auto",children:JSON.stringify(c.payload,null,2)})]})]}),"error"===c.kind&&(0,b.jsxs)("div",{className:"af-panel-danger p-4 text-sm",children:[(0,b.jsx)("div",{className:"font-medium",children:"Last sync failed"}),(0,b.jsx)("div",{children:c.error})]}),(0,b.jsx)(i.ForceSyncButton,{cliAvailable:e})]})}a.s(["default",0,function(){var a;let d=(0,c.readTeamConfig)();if(!d)return(0,b.jsxs)("main",{className:"mx-auto max-w-3xl p-6 space-y-6",children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:"Team sync"}),(0,b.jsxs)("section",{className:"af-card border-dashed text-sm space-y-3",children:[(0,b.jsx)("p",{className:"font-medium",children:"Not paired with any team."}),(0,b.jsx)("p",{className:"text-gray-600",children:"To pair this machine with a Fleetlens team server, run from a terminal:"}),(0,b.jsx)("pre",{className:"bg-gray-100 dark:bg-gray-900 p-3 rounded text-xs overflow-x-auto",children:"fleetlens team join <server-url> <invite-token>"}),(0,b.jsx)("p",{className:"text-gray-600",children:"Your team admin can generate an invite token from the team server’s Settings page."})]})]});let e=(0,c.toTeamConfigView)(d),g=d.syncProjects,h=g?g.autoIncludeNew?`Syncing: all projects except ${g.excluded.length} excluded`:`Syncing: only ${g.included.length} selected project${1===g.included.length?"":"s"}`:null;return(0,b.jsxs)("main",{className:"mx-auto max-w-3xl p-6 space-y-8",children:[(0,b.jsxs)("header",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:"Team sync"}),(0,b.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"What your daemon shares with your team server."})]}),d.setupPending&&(0,b.jsxs)("div",{className:"border border-amber-400/40 bg-amber-400/10 rounded-lg p-4 text-sm",children:["Setup isn’t finished — nothing is syncing yet."," ",(0,b.jsx)("a",{className:"underline font-medium",href:"/team/onboarding",children:"Finish onboarding"})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Pairing"}),(0,b.jsx)("span",{className:"text-xs uppercase tracking-wide text-green-700 dark:text-green-400",children:"Connected"})]}),(0,b.jsxs)("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1.5 text-sm",children:[(0,b.jsx)("dt",{className:"text-gray-500",children:"Team slug"}),(0,b.jsx)("dd",{className:"font-mono",children:e.teamSlug}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Server"}),(0,b.jsx)("dd",{className:"font-mono break-all",children:(0,b.jsxs)("a",{href:e.serverUrl,target:"_blank",rel:"noreferrer",className:"hover:underline",children:[e.serverUrl," ",(0,b.jsx)("span",{"aria-hidden":!0,children:"↗"})]})}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Member ID"}),(0,b.jsx)("dd",{className:"font-mono break-all text-xs",children:e.memberId}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Bearer token"}),(0,b.jsx)("dd",{className:"font-mono text-xs",children:e.bearerTokenMasked}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Paired"}),(0,b.jsx)("dd",{children:new Date(e.pairedAt).toLocaleString()}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Last day pushed"}),(0,b.jsx)("dd",{children:(a=e.lastSyncedDay)?a:"never"}),(0,b.jsx)("dt",{className:"text-gray-500",children:"Last usage snapshot"}),(0,b.jsx)("dd",{children:function(a){if(!a)return"never";let b=Date.parse(a);if(Number.isNaN(b))return a;let c=Date.now()-b;return c<0?new Date(b).toLocaleString():c<6e4?`${Math.round(c/1e3)}s ago`:c<36e5?`${Math.round(c/6e4)}m ago`:c<864e5?`${Math.round(c/36e5)}h ago`:new Date(b).toLocaleString()}(e.lastSyncedUsageSnapshotAt)})]})]}),(0,b.jsx)("section",{className:"af-card",children:(0,b.jsx)(k,{})}),(0,b.jsx)("section",{className:"af-card",children:(0,b.jsx)(f,{})}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"What gets shared"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:h??"Syncing: all projects (no selection set)."}),(0,b.jsxs)("ul",{className:"text-sm space-y-2",children:[(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Daily rollup"})," — agent time, session count, tool calls, turns, token totals."]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Rich rollup"})," (Entry-derived counts) for each synced project: working-shape distribution, top skills, subagents dispatched, long-autonomous turns, plan-mode usage, brainstorm warmups, tool errors, PRs/commits/pushes. Project labels only; never raw prompts or agent output."]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Plan utilization snapshot"}),"— current 5h + 7d utilization windows, per Anthropic’s rate-limit API."]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("strong",{children:"Enriched extras"})," — outcome / helpfulness / goal minute mix, derived locally by your AI-features pipeline (no new model calls ride along with the push)."]})]}),(0,b.jsxs)("div",{className:"af-panel p-4 text-sm space-y-2",children:[(0,b.jsx)("div",{className:"font-medium",children:"What does NOT leave your machine"}),(0,b.jsxs)("ul",{className:"list-disc list-inside text-gray-600 space-y-1",children:[(0,b.jsx)("li",{children:"Session transcripts, prompts, or assistant responses"}),(0,b.jsx)("li",{children:"Absolute paths, file contents, or tool-call payloads"}),(0,b.jsx)("li",{children:"Anything from projects you exclude above"}),(0,b.jsx)("li",{children:"Anything from sessions older than the start-of-day rollup window"})]})]})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Disconnect"}),(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"To leave the team and stop all syncing, run:"}),(0,b.jsx)("pre",{className:"bg-gray-100 dark:bg-gray-900 p-3 rounded text-xs",children:"fleetlens team leave"})]})]})},"dynamic",0,"force-dynamic"],64181)},84356,a=>{a.n(a.i(64181))}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0-zxvif._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},71306,(a,b,c)=>{b.exports=a.r(18622)},79847,a=>{a.n(a.i(3343))},9185,a=>{a.n(a.i(29432))},72842,a=>{a.n(a.i(75164))},54897,a=>{a.n(a.i(30106))},56157,a=>{a.n(a.i(18970))},94331,a=>{a.n(a.i(60644))},15988,a=>{a.n(a.i(56952))},25766,a=>{a.n(a.i(77341))},29725,a=>{a.n(a.i(94290))},5785,a=>{a.n(a.i(90588))},74793,a=>{a.n(a.i(33169))},85826,a=>{a.n(a.i(18866))},21565,a=>{a.n(a.i(41763))},65911,a=>{a.n(a.i(8950))},25128,a=>{a.n(a.i(91562))},40781,a=>{a.n(a.i(49670))},69411,a=>{a.n(a.i(75700))},63081,a=>{a.n(a.i(276))},62837,a=>{a.n(a.i(40795))},34607,a=>{a.n(a.i(11614))},96338,a=>{a.n(a.i(21751))},50642,a=>{a.n(a.i(12213))},32242,a=>{a.n(a.i(22693))},88530,a=>{a.n(a.i(10531))},8583,a=>{a.n(a.i(1082))},38534,a=>{a.n(a.i(98175))},70408,a=>{a.n(a.i(9095))},22922,a=>{a.n(a.i(96772))},78294,a=>{a.n(a.i(71717))},16625,a=>{a.n(a.i(85034))},88648,a=>{a.n(a.i(68113))},51914,a=>{a.n(a.i(66482))},25466,a=>{a.n(a.i(91505))},27470,a=>{a.v("/_next/static/media/icon.0h9o_.fpzdvkq.svg"+(globalThis.NEXT_CLIENT_ASSET_SUFFIX||""))},21192,a=>{"use strict";let b={src:a.i(27470).default,width:32,height:32};a.s(["default",0,b])},29884,a=>{"use strict";a.s(["AiFeaturesForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AiFeaturesForm() from the server but AiFeaturesForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/settings/ai-features-form.tsx <module evaluation>","AiFeaturesForm")},32669,a=>{"use strict";a.s(["AiFeaturesForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AiFeaturesForm() from the server but AiFeaturesForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/settings/ai-features-form.tsx","AiFeaturesForm")},60496,a=>{"use strict";a.i(29884);var b=a.i(32669);a.n(b)},2464,a=>{"use strict";a.s(["AutostartToggle",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AutostartToggle() from the server but AutostartToggle is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/autostart-toggle.tsx <module evaluation>","AutostartToggle")},62242,a=>{"use strict";a.s(["AutostartToggle",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AutostartToggle() from the server but AutostartToggle is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/autostart-toggle.tsx","AutostartToggle")},80164,a=>{"use strict";a.i(2464);var b=a.i(62242);a.n(b)},49709,a=>{"use strict";a.s(["MenubarInstall",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call MenubarInstall() from the server but MenubarInstall is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/menubar-install.tsx <module evaluation>","MenubarInstall")},66224,a=>{"use strict";a.s(["MenubarInstall",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call MenubarInstall() from the server but MenubarInstall is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/menubar-install.tsx","MenubarInstall")},92607,a=>{"use strict";a.i(49709);var b=a.i(66224);a.n(b)},68958,a=>{"use strict";a.s(["ZaiCredentialsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ZaiCredentialsForm() from the server but ZaiCredentialsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/zai-credentials-form.tsx <module evaluation>","ZaiCredentialsForm")},80880,a=>{"use strict";a.s(["ZaiCredentialsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ZaiCredentialsForm() from the server but ZaiCredentialsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/zai-credentials-form.tsx","ZaiCredentialsForm")},70763,a=>{"use strict";a.i(68958);var b=a.i(80880);a.n(b)},50910,a=>{"use strict";var b=a.i(7997);a.i(37075);var c=a.i(68787),d=a.i(60496),e=a.i(2157),f=a.i(60526),g=a.i(50227),h=a.i(23895);let i=(0,g.join)((0,f.homedir)(),"Library","LaunchAgents","com.fleetlens.daemon.plist");var j=a.i(80164);a.i(74533);let k="FleetlensMenubar.app",l=(0,g.join)((0,f.homedir)(),"Applications",k);var m=a.i(92607),n=a.i(74874),o=a.i(70763);a.s(["default",0,function(){let a,f,p,q,r,s=(0,c.readSettings)(),t=(0,n.readCredentialsMasked)();return(0,b.jsxs)("main",{className:"mx-auto max-w-3xl p-6 space-y-8",children:[(0,b.jsxs)("header",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:"Settings"}),(0,b.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Local machine preferences. Team-sync management lives on the Team page."})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Daemon auto-start"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Brings the dashboard, plan-usage polling, and team sync back after a reboot. Team pairing turns this on by default."}),(0,b.jsx)(j.AutostartToggle,{initial:function(){let a="darwin"===process.platform,b=a&&(0,e.existsSync)(i),c=!1;try{let a=JSON.parse((0,e.readFileSync)((0,g.join)((0,h.cclensHome)(),"autostart.json"),"utf8"));c=!0===a.optedOut}catch{}return{supported:a,installed:b,optedOut:c}}()})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Menu bar widget"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Native macOS menu bar widget showing live Claude Code / Codex / Z.ai plan utilization, reset countdowns, and burn-rate. Installs to ~/Applications and updates as the daemon polls."}),(0,b.jsx)(m.MenubarInstall,{initial:(f=(a="darwin"===process.platform)&&(0,e.existsSync)(l),q=(p=process.env.FLEETLENS_CLI_BIN)?(0,g.join)((0,g.dirname)(p),"..","menubar",k):null,r=a&&!!q&&(0,e.existsSync)(q),{supported:a,installed:f,running:f&&!1,bundled:r})})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Z.ai API key"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Optional. Add your Z.ai (GLM Coding Plan) API key so the daemon can track your Z.ai usage alongside Claude Code and Codex. The key is stored in ~/.cclens/credentials.json — nothing leaves your machine except the same API calls Z.ai's own subscription UI makes."}),(0,b.jsx)(o.ZaiCredentialsForm,{initial:t})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"AI Features"}),(0,b.jsxs)("p",{className:"text-sm text-gray-500",children:["When enabled, Fleetlens synthesizes daily digests and per-entry narratives by spawning your local ",(0,b.jsx)("code",{children:"claude"})," CLI (uses your existing Claude Code auth — no API key required)."]}),(0,b.jsx)(d.AiFeaturesForm,{initial:{enabled:s.ai_features.enabled,autoBackfillLastWeek:s.ai_features.autoBackfillLastWeek,autoBackfillYesterday:s.ai_features.autoBackfillYesterday}})]})]})}],50910)},58019,a=>{a.n(a.i(50910))}];
1
+ module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},71306,(a,b,c)=>{b.exports=a.r(18622)},79847,a=>{a.n(a.i(3343))},9185,a=>{a.n(a.i(29432))},72842,a=>{a.n(a.i(75164))},54897,a=>{a.n(a.i(30106))},56157,a=>{a.n(a.i(18970))},94331,a=>{a.n(a.i(60644))},15988,a=>{a.n(a.i(56952))},25766,a=>{a.n(a.i(77341))},29725,a=>{a.n(a.i(94290))},5785,a=>{a.n(a.i(90588))},74793,a=>{a.n(a.i(33169))},85826,a=>{a.n(a.i(18866))},21565,a=>{a.n(a.i(41763))},65911,a=>{a.n(a.i(8950))},25128,a=>{a.n(a.i(91562))},40781,a=>{a.n(a.i(49670))},69411,a=>{a.n(a.i(75700))},63081,a=>{a.n(a.i(276))},62837,a=>{a.n(a.i(40795))},34607,a=>{a.n(a.i(11614))},96338,a=>{a.n(a.i(21751))},50642,a=>{a.n(a.i(12213))},32242,a=>{a.n(a.i(22693))},88530,a=>{a.n(a.i(10531))},8583,a=>{a.n(a.i(1082))},38534,a=>{a.n(a.i(98175))},70408,a=>{a.n(a.i(9095))},22922,a=>{a.n(a.i(96772))},78294,a=>{a.n(a.i(71717))},16625,a=>{a.n(a.i(85034))},88648,a=>{a.n(a.i(68113))},51914,a=>{a.n(a.i(66482))},25466,a=>{a.n(a.i(91505))},27470,a=>{a.v("/_next/static/media/icon.0h9o_.fpzdvkq.svg"+(globalThis.NEXT_CLIENT_ASSET_SUFFIX||""))},21192,a=>{"use strict";let b={src:a.i(27470).default,width:32,height:32};a.s(["default",0,b])},29884,a=>{"use strict";a.s(["AiFeaturesForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AiFeaturesForm() from the server but AiFeaturesForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/settings/ai-features-form.tsx <module evaluation>","AiFeaturesForm")},32669,a=>{"use strict";a.s(["AiFeaturesForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AiFeaturesForm() from the server but AiFeaturesForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/app/settings/ai-features-form.tsx","AiFeaturesForm")},60496,a=>{"use strict";a.i(29884);var b=a.i(32669);a.n(b)},2464,a=>{"use strict";a.s(["AutostartToggle",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AutostartToggle() from the server but AutostartToggle is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/autostart-toggle.tsx <module evaluation>","AutostartToggle")},62242,a=>{"use strict";a.s(["AutostartToggle",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call AutostartToggle() from the server but AutostartToggle is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/autostart-toggle.tsx","AutostartToggle")},80164,a=>{"use strict";a.i(2464);var b=a.i(62242);a.n(b)},49709,a=>{"use strict";a.s(["MenubarInstall",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call MenubarInstall() from the server but MenubarInstall is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/menubar-install.tsx <module evaluation>","MenubarInstall")},66224,a=>{"use strict";a.s(["MenubarInstall",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call MenubarInstall() from the server but MenubarInstall is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/menubar-install.tsx","MenubarInstall")},92607,a=>{"use strict";a.i(49709);var b=a.i(66224);a.n(b)},68958,a=>{"use strict";a.s(["ZaiCredentialsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ZaiCredentialsForm() from the server but ZaiCredentialsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/zai-credentials-form.tsx <module evaluation>","ZaiCredentialsForm")},80880,a=>{"use strict";a.s(["ZaiCredentialsForm",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call ZaiCredentialsForm() from the server but ZaiCredentialsForm is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/apps/web/components/zai-credentials-form.tsx","ZaiCredentialsForm")},70763,a=>{"use strict";a.i(68958);var b=a.i(80880);a.n(b)},50910,a=>{"use strict";var b=a.i(7997);a.i(37075);var c=a.i(68787),d=a.i(60496),e=a.i(2157),f=a.i(60526),g=a.i(50227),h=a.i(23895);let i=(0,g.join)((0,f.homedir)(),"Library","LaunchAgents","com.fleetlens.daemon.plist");var j=a.i(80164);a.i(74533);let k="FleetlensMenubar.app",l=(0,g.join)((0,f.homedir)(),"Applications",k);var m=a.i(92607),n=a.i(74874),o=a.i(70763);a.s(["default",0,function(){let a,f,p,q,r,s=(0,c.readSettings)(),t=(0,n.readCredentialsMasked)();return(0,b.jsxs)("main",{className:"mx-auto max-w-3xl p-6 space-y-8",children:[(0,b.jsxs)("header",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:"Settings"}),(0,b.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Local machine preferences. Team-sync management lives on the Team page."})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Daemon auto-start"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Brings the dashboard, plan-usage polling, and team sync back after a reboot. Team pairing turns this on by default."}),(0,b.jsx)(j.AutostartToggle,{initial:function(){let a="darwin"===process.platform,b=a&&(0,e.existsSync)(i),c=!1;try{let a=JSON.parse((0,e.readFileSync)((0,g.join)((0,h.cclensHome)(),"autostart.json"),"utf8"));c=!0===a.optedOut}catch{}return{supported:a,installed:b,optedOut:c}}()})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Menu bar widget"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Native macOS menu bar widget showing live Claude Code / Codex / Copilot / Z.ai plan utilization, reset countdowns, and burn-rate. Installs to ~/Applications and updates as the daemon polls."}),(0,b.jsx)(m.MenubarInstall,{initial:(f=(a="darwin"===process.platform)&&(0,e.existsSync)(l),q=(p=process.env.FLEETLENS_CLI_BIN)?(0,g.join)((0,g.dirname)(p),"..","menubar",k):null,r=a&&!!q&&(0,e.existsSync)(q),{supported:a,installed:f,running:f&&!1,bundled:r})})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"Z.ai API key"}),(0,b.jsx)("p",{className:"text-sm text-gray-500",children:"Optional. Add your Z.ai (GLM Coding Plan) API key so the daemon can track your Z.ai usage alongside Claude Code and Codex. The key is stored in ~/.cclens/credentials.json — nothing leaves your machine except the same API calls Z.ai's own subscription UI makes."}),(0,b.jsx)(o.ZaiCredentialsForm,{initial:t})]}),(0,b.jsxs)("section",{className:"af-card space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-medium",children:"AI Features"}),(0,b.jsxs)("p",{className:"text-sm text-gray-500",children:["When enabled, Fleetlens synthesizes daily digests and per-entry narratives by spawning your local ",(0,b.jsx)("code",{children:"claude"})," CLI (uses your existing Claude Code auth — no API key required)."]}),(0,b.jsx)(d.AiFeaturesForm,{initial:{enabled:s.ai_features.enabled,autoBackfillLastWeek:s.ai_features.autoBackfillLastWeek,autoBackfillYesterday:s.ai_features.autoBackfillYesterday}})]})]})}],50910)},58019,a=>{a.n(a.i(50910))}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__01wj6p0._.js.map