agentgraphed 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +26 -26
- package/.next/standalone/.next/app-path-routes-manifest.json +6 -6
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/ingest-local/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/quota-probe/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/dashboard/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/project/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/session/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page.js +3 -3
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/[id]/page.js +3 -3
- package/.next/standalone/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +3 -3
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/timeline/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +6 -6
- package/.next/standalone/.next/server/functions-config-manifest.json +2 -2
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/app/page-c48deeb5e00abe37.js +1 -0
- package/.next/standalone/.next/static/chunks/app/sessions/[id]/page-67a6219eb293120e.js +1 -0
- package/.next/standalone/.next/static/chunks/app/settings/page-14247a62a25a93c7.js +1 -0
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/src/lib/pricing-data/litellm.meta.json +1 -1
- package/.next/static/chunks/app/page-c48deeb5e00abe37.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/page-67a6219eb293120e.js +1 -0
- package/.next/static/chunks/app/settings/page-14247a62a25a93c7.js +1 -0
- package/CHANGELOG.md +10 -0
- package/README.md +4 -0
- package/package.json +1 -1
- package/src/lib/pricing-data/litellm.meta.json +1 -1
- package/.next/standalone/.next/static/chunks/app/page-a3c60158eb6e8a4c.js +0 -1
- package/.next/standalone/.next/static/chunks/app/sessions/[id]/page-bd098facac562ae1.js +0 -1
- package/.next/standalone/.next/static/chunks/app/settings/page-655af37dd2ec318b.js +0 -1
- package/.next/standalone/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/.next/standalone/node_modules/better-sqlite3/lib/database.js +0 -90
- package/.next/standalone/node_modules/better-sqlite3/lib/index.js +0 -3
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/.next/standalone/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/.next/standalone/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/.next/standalone/node_modules/better-sqlite3/lib/util.js +0 -12
- package/.next/standalone/node_modules/better-sqlite3/package.json +0 -54
- package/.next/static/chunks/app/page-a3c60158eb6e8a4c.js +0 -1
- package/.next/static/chunks/app/sessions/[id]/page-bd098facac562ae1.js +0 -1
- package/.next/static/chunks/app/settings/page-655af37dd2ec318b.js +0 -1
- /package/.next/standalone/.next/static/{sgmNXxdNgpIfrW53A0qbg → M8f0qGBcpu_1RY2qRa9uE}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{sgmNXxdNgpIfrW53A0qbg → M8f0qGBcpu_1RY2qRa9uE}/_ssgManifest.js +0 -0
- /package/.next/static/{sgmNXxdNgpIfrW53A0qbg → M8f0qGBcpu_1RY2qRa9uE}/_buildManifest.js +0 -0
- /package/.next/static/{sgmNXxdNgpIfrW53A0qbg → M8f0qGBcpu_1RY2qRa9uE}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__RSC_SERVER_MANIFEST="{\"node\":{\"
|
|
1
|
+
self.__RSC_SERVER_MANIFEST="{\"node\":{\"0075e29f7be2a76827ef14a5be56b4c7ba7f4a97b2\":{\"workers\":{\"app/settings/page\":{\"moduleId\":\"55734\",\"async\":false}},\"layer\":{\"app/settings/page\":\"rsc\"},\"filename\":\"app/settings/page.tsx\",\"exportedName\":\"$$RSC_SERVER_ACTION_1\"},\"402932f87031716fa678fc8d41cec1aef65a76af75\":{\"workers\":{\"app/settings/page\":{\"moduleId\":\"55734\",\"async\":false}},\"layer\":{\"app/settings/page\":\"rsc\"},\"filename\":\"app/settings/page.tsx\",\"exportedName\":\"$$RSC_SERVER_ACTION_0\"},\"401c586918197adb9b5d67a828a5ee10093e2ba47e\":{\"workers\":{\"app/page\":{\"moduleId\":\"92871\",\"async\":false},\"app/settings/page\":{\"moduleId\":\"28870\",\"async\":false}},\"layer\":{\"app/page\":\"action-browser\",\"app/settings/page\":\"action-browser\"},\"filename\":\"app/settings/classify-actions.ts\",\"exportedName\":\"estimateAction\"},\"40752214370b8809166db2a79808d35c6f895b8e96\":{\"workers\":{\"app/page\":{\"moduleId\":\"92871\",\"async\":false},\"app/settings/page\":{\"moduleId\":\"28870\",\"async\":false}},\"layer\":{\"app/page\":\"action-browser\",\"app/settings/page\":\"action-browser\"},\"filename\":\"app/settings/classify-actions.ts\",\"exportedName\":\"classifyAction\"},\"4036417922bbc667f36cb1952fb5ad4b808ef92548\":{\"workers\":{\"app/sessions/[id]/page\":{\"moduleId\":\"94249\",\"async\":false}},\"layer\":{\"app/sessions/[id]/page\":\"action-browser\"},\"filename\":\"app/sessions/[id]/actions.ts\",\"exportedName\":\"generateContextAction\"},\"40bde21f7e91870d097bffbaa46e22458192f4ebee\":{\"workers\":{\"app/settings/page\":{\"moduleId\":\"28870\",\"async\":false}},\"layer\":{\"app/settings/page\":\"action-browser\"},\"filename\":\"app/settings/llm-actions.ts\",\"exportedName\":\"clearKeyAction\"},\"40e3997692e89950cbd9aa3a93c357e243f8902d4a\":{\"workers\":{\"app/settings/page\":{\"moduleId\":\"28870\",\"async\":false}},\"layer\":{\"app/settings/page\":\"action-browser\"},\"filename\":\"app/settings/llm-actions.ts\",\"exportedName\":\"saveLlmAction\"},\"40e407fba4c4c47f0eee9e15086a3d5aa99c5378c6\":{\"workers\":{\"app/settings/page\":{\"moduleId\":\"28870\",\"async\":false}},\"layer\":{\"app/settings/page\":\"action-browser\"},\"filename\":\"app/settings/llm-actions.ts\",\"exportedName\":\"setAutoClassifyAction\"}},\"edge\":{},\"encryptionKey\":\"process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY\"}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{"
|
|
1
|
+
{"node":{"0075e29f7be2a76827ef14a5be56b4c7ba7f4a97b2":{"workers":{"app/settings/page":{"moduleId":"55734","async":false}},"layer":{"app/settings/page":"rsc"},"filename":"app/settings/page.tsx","exportedName":"$$RSC_SERVER_ACTION_1"},"402932f87031716fa678fc8d41cec1aef65a76af75":{"workers":{"app/settings/page":{"moduleId":"55734","async":false}},"layer":{"app/settings/page":"rsc"},"filename":"app/settings/page.tsx","exportedName":"$$RSC_SERVER_ACTION_0"},"401c586918197adb9b5d67a828a5ee10093e2ba47e":{"workers":{"app/page":{"moduleId":"92871","async":false},"app/settings/page":{"moduleId":"28870","async":false}},"layer":{"app/page":"action-browser","app/settings/page":"action-browser"},"filename":"app/settings/classify-actions.ts","exportedName":"estimateAction"},"40752214370b8809166db2a79808d35c6f895b8e96":{"workers":{"app/page":{"moduleId":"92871","async":false},"app/settings/page":{"moduleId":"28870","async":false}},"layer":{"app/page":"action-browser","app/settings/page":"action-browser"},"filename":"app/settings/classify-actions.ts","exportedName":"classifyAction"},"4036417922bbc667f36cb1952fb5ad4b808ef92548":{"workers":{"app/sessions/[id]/page":{"moduleId":"94249","async":false}},"layer":{"app/sessions/[id]/page":"action-browser"},"filename":"app/sessions/[id]/actions.ts","exportedName":"generateContextAction"},"40bde21f7e91870d097bffbaa46e22458192f4ebee":{"workers":{"app/settings/page":{"moduleId":"28870","async":false}},"layer":{"app/settings/page":"action-browser"},"filename":"app/settings/llm-actions.ts","exportedName":"clearKeyAction"},"40e3997692e89950cbd9aa3a93c357e243f8902d4a":{"workers":{"app/settings/page":{"moduleId":"28870","async":false}},"layer":{"app/settings/page":"action-browser"},"filename":"app/settings/llm-actions.ts","exportedName":"saveLlmAction"},"40e407fba4c4c47f0eee9e15086a3d5aa99c5378c6":{"workers":{"app/settings/page":{"moduleId":"28870","async":false}},"layer":{"app/settings/page":"action-browser"},"filename":"app/settings/llm-actions.ts","exportedName":"setAutoClassifyAction"}},"edge":{},"encryptionKey":"hS2urbZ2FB0onmKk4qmrgrG/PTwdojqTRq6/AlulOhY="}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{15179:(e,t,r)=>{"use strict";r.d(t,{v:()=>o});var n=r(30926);let o=(0,n.createServerReference)("40752214370b8809166db2a79808d35c6f895b8e96",n.callServer,void 0,n.findSourceMapURL,"classifyAction")},15433:(e,t,r)=>{"use strict";r.d(t,{ClassifyChip:()=>a});var n=r(95155),o=r(12115),s=r(20063),i=r(15179);function a(e){let{count:t,estimatedUsd:r}=e,a=(0,s.useRouter)(),[l,c]=(0,o.useState)("idle"),[d,u]=(0,o.useState)(null),[m,p]=(0,o.useState)(null),[h,x]=(0,o.useTransition)(),f=()=>{if("idle"===l)return void c("confirm");"confirm"===l&&x(async()=>{let e=await (0,i.v)("uncategorized");if(!e.ok){u(e.error),c("err"),setTimeout(()=>c("idle"),4e3);return}p({classified:e.classified,costUsd:e.costUsd}),c("done"),a.refresh(),setTimeout(()=>c("idle"),3e3)})};return"done"===l&&m?(0,n.jsxs)("div",{className:"text-[11px] font-mono px-2 py-0.5 rounded bg-secondary/10 text-secondary border border-secondary/30",children:["✓ classified ",m.classified," \xb7 $",m.costUsd.toFixed(4)]}):"err"===l?(0,n.jsx)("div",{className:"text-[11px] font-mono px-2 py-0.5 rounded bg-error/10 text-error border border-error/30",title:null!=d?d:"",children:"✗ failed"}):"confirm"===l?(0,n.jsx)("button",{onClick:f,disabled:h,className:"text-[11px] font-mono px-2 py-0.5 rounded bg-primary/15 text-primary border border-primary/40 hover:bg-primary/25 transition-colors disabled:opacity-60",title:"Click again to confirm — sends prompts to your configured provider",children:h?"… classifying":"confirm \xb7 run for ~$".concat(r.toFixed(4))}):(0,n.jsxs)("button",{onClick:f,className:"text-[11px] font-mono px-2 py-0.5 rounded text-ink-mute hover:text-primary hover:bg-surface-2 transition-colors",title:"Send their first prompts to your configured LLM to assign a title + category. ~$0.0001 per session.",children:[t," unclassified \xb7 classify"]})}},17834:(e,t,r)=>{"use strict";r.d(t,{ShareButton:()=>s});var n=r(95155),o=r(12115);function s(e){let{imageUrl:t,className:r}=e,[s,c]=(0,o.useState)("idle"),[d,u]=(0,o.useState)(null),m=async()=>{c("busy"),u(null);try{var e;let r=await fetch(t);if(!r.ok)throw Error("HTTP ".concat(r.status));let n=await r.blob();if("undefined"==typeof ClipboardItem||!(null==(e=navigator.clipboard)?void 0:e.write))throw Error("clipboard image unsupported");let o=new ClipboardItem({"image/png":n});await navigator.clipboard.write([o]),c("done"),setTimeout(()=>c("idle"),2400)}catch(e){try{let e=await fetch(t),r=await e.blob(),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download="agentgraphed-stats.png",document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout(()=>URL.revokeObjectURL(n),5e3),u("Saved to Downloads (clipboard image unsupported)"),c("err"),setTimeout(()=>c("idle"),4e3)}catch(t){u(t.message||e.message),c("err"),setTimeout(()=>c("idle"),3e3)}}};return(0,n.jsx)("button",{onClick:m,disabled:"busy"===s,"aria-label":"Share",title:"busy"===s?"Generating image…":"done"===s?"Image copied to clipboard":"err"===s?null!=d?d:"Try again":"Copy share image to clipboard",className:"btn-icon ".concat("done"===s?"text-secondary":""," ").concat(null!=r?r:""),children:"busy"===s?(0,n.jsx)(l,{}):"done"===s?(0,n.jsx)(a,{}):(0,n.jsx)(i,{})})}function i(){return(0,n.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),(0,n.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,n.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]})}function a(){return(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function l(){return(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:(0,n.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},20467:(e,t,r)=>{"use strict";function n(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"k"):e.toString()}function o(e){return e>=1e3?"$".concat(e.toFixed(0)):"$".concat(e.toFixed(2))}function s(e){let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60)return"".concat(r,"m");let n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}r.d(t,{F0:()=>o,c5:()=>s,yj:()=>n})},29366:(e,t,r)=>{"use strict";r.d(t,{UsageChartCard:()=>x});var n=r(95155),o=r(12115),s=r(20063),i=r(26991),a=r(73850),l=r(68425),c=r(47734),d=r(73697),u=r(23508),m=r(77568),p=r(20467);function h(e){let{data:t,metric:r="tokens",scale:o="lin"}=e,s=t.map(e=>{let t=e[r];return{...e,label:e.day.slice(5),value:"log"===o&&t<=0?1:t,raw:t}}),h="cost"===r?"#00ffab":"#00f5ff";return(0,n.jsx)("div",{className:"h-64 -mx-1",children:(0,n.jsx)(i.u,{width:"100%",height:"100%",children:(0,n.jsxs)(a.Q,{data:s,margin:{top:8,right:8,bottom:0,left:-8},children:[(0,n.jsx)("defs",{children:(0,n.jsxs)("linearGradient",{id:"grad-".concat(r),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:h,stopOpacity:.35}),(0,n.jsx)("stop",{offset:"100%",stopColor:h,stopOpacity:0})]})}),(0,n.jsx)(l.d,{stroke:"#262a31",strokeDasharray:"2 4",vertical:!1}),(0,n.jsx)(c.W,{dataKey:"label",tick:{fill:"#849495",fontSize:11,fontFamily:"JetBrains Mono"},axisLine:{stroke:"#262a31"},tickLine:!1,minTickGap:48}),(0,n.jsx)(d.h,{scale:"log"===o?"log":"auto",domain:"log"===o?[1,"auto"]:["auto","auto"],allowDataOverflow:!0,tick:{fill:"#849495",fontSize:11,fontFamily:"JetBrains Mono"},axisLine:!1,tickLine:!1,tickFormatter:e=>"cost"===r?"$".concat(Math.round(e)):(0,p.yj)(e)}),(0,n.jsx)(u.m,{cursor:{stroke:h,strokeOpacity:.3},contentStyle:{background:"#181c22",border:"1px solid ".concat(h),borderRadius:6,fontSize:12,color:"#dfe2eb"},formatter:(e,t,n)=>{var o,s;let i=null!=(s=null==n||null==(o=n.payload)?void 0:o.raw)?s:0;return"tokens"===r?[(0,p.yj)(i),"tokens"]:"sessions"===r?[i.toString(),"sessions"]:["$".concat(i.toFixed(2)),"cost"]},labelFormatter:e=>"Day ".concat(e)}),(0,n.jsx)(m.G,{type:"monotone",dataKey:"value",stroke:h,strokeWidth:2,fill:"url(#grad-".concat(r,")"),isAnimationActive:!1})]})})})}function x(e){let{data:t,label:r="last 30 days",metric:i,scale:a}=e,l=(0,s.useRouter)(),c=(0,s.usePathname)(),d=(0,s.useSearchParams)(),u=(0,o.useMemo)(()=>!function(e,t){let r=e.map(e=>e[t]).filter(e=>e>0);if(r.length<5)return!1;let n=[...r].sort((e,t)=>e-t);return n[n.length-1]/Math.max(n[Math.max(0,Math.floor(.1*r.length)-1)],1)>50}(t,i)?"lin":"log",[t,i]),m=null!=a?a:u,p=(e,t,r)=>{let n=new URLSearchParams(d.toString());null===t||t===r?n.delete(e):n.set(e,t);let o=n.toString();l.push(o?"".concat(c,"?").concat(o):c,{scroll:!1})};return(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,n.jsxs)("span",{children:["Usage — ",r]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 normal-case tracking-normal",children:[(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:[{id:"tokens",label:"Tokens"},{id:"sessions",label:"Sessions"},{id:"cost",label:"Est. Cost"}].map(e=>(0,n.jsx)("button",{onClick:()=>p("metric",e.id,"tokens"),className:"px-2 py-0.5 text-[11px] rounded transition-colors font-mono ".concat(i===e.id?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim"),children:e.label},e.id))}),(0,n.jsx)("div",{className:"w-px h-4 bg-surface-3"}),(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:["lin","log"].map(e=>(0,n.jsxs)("button",{onClick:()=>p("scale",e,u),className:"px-1.5 py-0.5 text-[10px] rounded transition-colors font-mono uppercase relative ".concat(m===e?"bg-secondary/15 text-secondary":"text-ink-mute hover:text-ink-dim"),title:"log"===e?"Logarithmic scale — better when one day dwarfs the rest":"Linear scale",children:[e,null===a&&u===e&&(0,n.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-secondary",title:"auto-selected based on data range"})]},e))})]})]}),(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(h,{data:t,metric:i,scale:m})})]})}},30926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{callServer:function(){return n.callServer},createServerReference:function(){return s.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}});let n=r(41209),o=r(85153),s=r(77197)},34077:(e,t,r)=>{"use strict";r.d(t,{FreshnessIndicator:()=>i});var n=r(95155),o=r(12115),s=r(20063);function i(e){let{lastIngestedAt:t}=e,[,r]=(0,o.useState)(0),[i,c]=(0,o.useState)(!1),[d,u]=(0,o.useTransition)(),m=(0,s.useRouter)();(0,o.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),5e3);return()=>clearInterval(e)},[]);let p=0===t?"never scanned":"updated ".concat(function(e){let t=Date.now()-e;return t<1e3?"just now":t<6e4?"".concat(l(Math.round(t/1e3)),"s"):t<36e5?"".concat(l(Math.round(t/6e4)),"m"):"".concat(l(Math.round(t/36e5)),"h")}(t)," ago"),h=0===t,x=i||d;return(0,n.jsxs)("button",{type:"button",onClick:function(){u(()=>m.refresh())},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),disabled:h||d,title:"Re-scan local sessions and refresh",style:{width:"128px"},className:"text-[11px] font-mono tabular px-2 py-0.5 rounded transition-colors text-ink-mute hover:text-primary hover:bg-surface-2 focus-visible:text-primary focus-visible:bg-surface-2 outline-none disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-ink-mute disabled:cursor-not-allowed grid items-center",children:[(0,n.jsx)("span",{className:"col-start-1 row-start-1 transition-opacity flex items-center justify-center gap-1.5 whitespace-nowrap",style:{opacity:+!x},children:p}),(0,n.jsxs)("span",{"aria-hidden":!0,className:"col-start-1 row-start-1 transition-opacity flex items-center justify-center gap-1.5 whitespace-nowrap",style:{opacity:+!!x},children:[(0,n.jsx)(a,{spinning:d}),(0,n.jsx)("span",{children:"refresh"})]})]})}function a(e){let{spinning:t}=e;return(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:t?"animate-spin":"",children:[(0,n.jsx)("path",{d:"M3 12a9 9 0 0 1 15.5-6.4L21 8"}),(0,n.jsx)("path",{d:"M21 3v5h-5"}),(0,n.jsx)("path",{d:"M21 12a9 9 0 0 1-15.5 6.4L3 16"}),(0,n.jsx)("path",{d:"M3 21v-5h5"})]})}function l(e){return e<10?"0".concat(e):String(e)}},40250:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,52619,23)),Promise.resolve().then(r.bind(r,15433)),Promise.resolve().then(r.bind(r,34077)),Promise.resolve().then(r.bind(r,74050)),Promise.resolve().then(r.bind(r,61438)),Promise.resolve().then(r.bind(r,95925)),Promise.resolve().then(r.bind(r,17834)),Promise.resolve().then(r.bind(r,29366))},61438:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>a});var n=r(95155),o=r(20063),s=r(12115),i=r(47650);function a(e){var t,r;let{projects:a,current:l}=e,c=(0,o.useRouter)(),d=(0,o.usePathname)(),u=(0,o.useSearchParams)(),[m,p]=(0,s.useState)(!1),[h,x]=(0,s.useTransition)(),[f,y]=(0,s.useState)(!1),[b,v]=(0,s.useState)(null),g=(0,s.useRef)(null);(0,s.useEffect)(()=>y(!0),[]);let k=e=>{let t=new URLSearchParams(u.toString());e?t.set("project",e):t.delete("project");let r=t.toString();p(!1),x(()=>c.push(r?"".concat(d,"?").concat(r):d,{scroll:!1}))},j=l?null!=(r=null==(t=a.find(e=>e.id===l))?void 0:t.name)?r:"project":null;return(0,s.useEffect)(()=>{if(!m)return;let e=e=>{var t;let r=e.target;if(null==(t=g.current)?void 0:t.contains(r))return;let n=document.getElementById("project-filter-pop");null!=n&&n.contains(r)||p(!1)},t=e=>{"Escape"===e.key&&p(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[m]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:g,onClick:()=>{if(!m&&g.current){let e=g.current.getBoundingClientRect();v({top:e.bottom+6,left:e.left,width:Math.max(e.width,220)})}p(e=>!e)},className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors flex items-center gap-1.5 ".concat(l?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim hover:bg-surface-2"," ").concat(h?"opacity-60":""),title:"Filter by project",children:[(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),(0,n.jsx)("span",{className:"truncate max-w-[140px]",children:null!=j?j:"All projects"}),(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform ".concat(m?"rotate-180":""),children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),f&&m&&b&&(0,i.createPortal)((0,n.jsxs)("div",{id:"project-filter-pop",style:{position:"fixed",top:b.top,left:b.left,minWidth:b.width,backgroundColor:"#1c2026",zIndex:100,isolation:"isolate"},className:"border border-surface-3 rounded-md shadow-xl overflow-hidden text-[12px] font-mono max-h-[60vh] overflow-y-auto",children:[(0,n.jsx)("button",{onClick:()=>k(null),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 ".concat(l?"text-ink-dim":"text-primary bg-primary/10"),children:"All projects"}),(0,n.jsx)("div",{className:"h-px bg-surface-3"}),a.map(e=>(0,n.jsx)("button",{onClick:()=>k(e.id),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 truncate ".concat(l===e.id?"text-primary bg-primary/10":"text-ink-dim"),title:e.name,children:e.name},e.id)),0===a.length&&(0,n.jsx)("div",{className:"px-3 py-2 text-ink-mute",children:"No projects yet."})]}),document.body)]})}},74050:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>a});var n=r(95155),o=r(20063),s=r(12115),i=r(47650);function a(e){let{families:t,current:r}=e,a=(0,o.useRouter)(),l=(0,o.usePathname)(),c=(0,o.useSearchParams)(),[d,u]=(0,s.useState)(!1),[m,p]=(0,s.useTransition)(),[h,x]=(0,s.useState)(!1),[f,y]=(0,s.useState)(null),b=(0,s.useRef)(null);(0,s.useEffect)(()=>x(!0),[]);let v=e=>{let t=new URLSearchParams(c.toString());e?t.set("model",e):t.delete("model");let r=t.toString();u(!1),p(()=>a.push(r?"".concat(l,"?").concat(r):l,{scroll:!1}))};return(0,s.useEffect)(()=>{if(!d)return;let e=e=>{var t;let r=e.target;if(null==(t=b.current)?void 0:t.contains(r))return;let n=document.getElementById("model-filter-pop");null!=n&&n.contains(r)||u(!1)},t=e=>{"Escape"===e.key&&u(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[d]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:b,onClick:()=>{if(!d&&b.current){let e=b.current.getBoundingClientRect();y({top:e.bottom+6,left:e.left,width:Math.max(e.width,200)})}u(e=>!e)},className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors flex items-center gap-1.5 ".concat(r?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim hover:bg-surface-2"," ").concat(m?"opacity-60":""),title:"Filter by model",children:[(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,n.jsx)("path",{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),(0,n.jsx)("span",{className:"truncate max-w-[140px]",children:null!=r?r:"All models"}),(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform ".concat(d?"rotate-180":""),children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),h&&d&&f&&(0,i.createPortal)((0,n.jsxs)("div",{id:"model-filter-pop",style:{position:"fixed",top:f.top,left:f.left,minWidth:f.width,backgroundColor:"#1c2026",zIndex:100,isolation:"isolate"},className:"border border-surface-3 rounded-md shadow-xl overflow-hidden text-[12px] font-mono max-h-[60vh] overflow-y-auto",children:[(0,n.jsx)("button",{onClick:()=>v(null),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 ".concat(r?"text-ink-dim":"text-primary bg-primary/10"),children:"All models"}),(0,n.jsx)("div",{className:"h-px bg-surface-3"}),t.map(e=>(0,n.jsxs)("button",{onClick:()=>v(e.family),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 flex items-center justify-between gap-3 ".concat(r===e.family?"text-primary bg-primary/10":"text-ink-dim"),title:e.family,children:[(0,n.jsx)("span",{className:"truncate",children:e.family}),(0,n.jsx)("span",{className:"text-ink-mute text-[10px] tabular",children:e.sessions})]},e.family)),0===t.length&&(0,n.jsx)("div",{className:"px-3 py-2 text-ink-mute",children:"No models seen yet."})]}),document.body)]})}},95925:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>a});var n=r(95155),o=r(20063),s=r(12115);let i=[{key:"7d",label:"Last 7 days",days:7},{key:"30d",label:"Last 30 days",days:30},{key:"90d",label:"Last 90 days",days:90},{key:"all",label:"All time",days:null}];function a(e){let{current:t}=e,r=(0,o.useRouter)(),a=(0,o.usePathname)(),l=(0,o.useSearchParams)(),[c,d]=(0,s.useTransition)();return(0,n.jsx)("div",{className:"flex items-center gap-0.5 normal-case tracking-normal transition-opacity ".concat(c?"opacity-50":""),children:i.map(e=>(0,n.jsx)("button",{onClick:()=>(e=>{let t=new URLSearchParams(l.toString());"30d"===e?t.delete("range"):t.set("range",e);let n=t.toString();d(()=>{r.push(n?"".concat(a,"?").concat(n):a)})})(e.key),className:"px-2 py-0.5 text-[11px] rounded transition-colors font-mono ".concat(t===e.key?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim"),children:"all"===e.key?"All":e.key},e.key))})}}},e=>{e.O(0,[619,997,441,255,358],()=>e(e.s=40250)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[824],{8261:(e,t,n)=>{"use strict";n.d(t,{SessionActions:()=>l});var r=n(95155),i=n(12115),o=n(52619),a=n.n(o),s=n(30926);let c=(0,s.createServerReference)("4036417922bbc667f36cb1952fb5ad4b808ef92548",s.callServer,void 0,s.findSourceMapURL,"generateContextAction");function l(e){let{sessionId:t,hasLlmKey:n,cachedContext:o}=e,[s,l]=(0,i.useState)(o),[d,u]=(0,i.useState)(!1),[h,x]=(0,i.useState)(null),[m,p]=(0,i.useState)(null),[f,b]=(0,i.useTransition)();return(0,r.jsxs)("div",{className:"flex items-center gap-2 relative",children:[(0,r.jsx)("button",{onClick:()=>{x(null),b(async()=>{if(s){await navigator.clipboard.writeText(s),u(!0),setTimeout(()=>u(!1),1800);return}let e=await c(t);if(!e.ok)return void x(e.error);l(e.context),p(e.costUsd),await navigator.clipboard.writeText(e.context),u(!0),setTimeout(()=>u(!1),1800)})},disabled:!n||f,title:n?"Summarize this session so you can paste it into a fresh chat":"Add an API key in Settings to enable",className:"btn ".concat(n?"btn-primary":""," disabled:opacity-50 disabled:cursor-not-allowed"),children:f?"… summarizing":d?"✓ Copied":s?"Copy summary":"Summarize for new chat"}),(h||null!==m&&m>0||!n)&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 text-[11px] text-ink-mute flex items-center gap-2 whitespace-nowrap",children:[h&&(0,r.jsx)("span",{className:"text-error",children:h}),null!==m&&m>0&&(0,r.jsxs)("span",{className:"font-mono",children:["cost $",m.toFixed(4)]}),!n&&(0,r.jsxs)("span",{children:["summary needs ",(0,r.jsx)(a(),{href:"/settings",className:"text-primary hover:underline",children:"an API key"})]})]})]})}},17834:(e,t,n)=>{"use strict";n.d(t,{ShareButton:()=>o});var r=n(95155),i=n(12115);function o(e){let{imageUrl:t,className:n}=e,[o,l]=(0,i.useState)("idle"),[d,u]=(0,i.useState)(null),h=async()=>{l("busy"),u(null);try{var e;let n=await fetch(t);if(!n.ok)throw Error("HTTP ".concat(n.status));let r=await n.blob();if("undefined"==typeof ClipboardItem||!(null==(e=navigator.clipboard)?void 0:e.write))throw Error("clipboard image unsupported");let i=new ClipboardItem({"image/png":r});await navigator.clipboard.write([i]),l("done"),setTimeout(()=>l("idle"),2400)}catch(e){try{let e=await fetch(t),n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download="agentgraphed-stats.png",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),5e3),u("Saved to Downloads (clipboard image unsupported)"),l("err"),setTimeout(()=>l("idle"),4e3)}catch(t){u(t.message||e.message),l("err"),setTimeout(()=>l("idle"),3e3)}}};return(0,r.jsx)("button",{onClick:h,disabled:"busy"===o,"aria-label":"Share",title:"busy"===o?"Generating image…":"done"===o?"Image copied to clipboard":"err"===o?null!=d?d:"Try again":"Copy share image to clipboard",className:"btn-icon ".concat("done"===o?"text-secondary":""," ").concat(null!=n?n:""),children:"busy"===o?(0,r.jsx)(c,{}):"done"===o?(0,r.jsx)(s,{}):(0,r.jsx)(a,{})})}function a(){return(0,r.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),(0,r.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,r.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]})}function s(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function c(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},30926:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{callServer:function(){return r.callServer},createServerReference:function(){return o.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}});let r=n(41209),i=n(85153),o=n(77197)},40040:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,52619,23)),Promise.resolve().then(n.bind(n,44782)),Promise.resolve().then(n.bind(n,8261)),Promise.resolve().then(n.bind(n,17834))},44782:(e,t,n)=>{"use strict";n.d(t,{ResumePanel:()=>o});var r=n(95155),i=n(12115);function o(e){let{provider:t,cwd:n,sessionId:o}=e,[c,l]=(0,i.useState)(!1),d=function(e,t,n){let r='cd "'.concat(t,'"');return"claude"===e?"".concat(r," && claude --resume ").concat(n):"codex"===e?"".concat(r," && codex resume ").concat(n):r}(t,n,o),u=async()=>{await navigator.clipboard.writeText(d),l(!0),setTimeout(()=>l(!1),2e3)};return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,r.jsx)("span",{children:"Resume in your terminal"}),(0,r.jsxs)("span",{className:"normal-case tracking-normal font-normal text-ink-mute text-[11px]",children:["paste into ","claude"===t?"Claude Code":"codex"===t?"Codex CLI":t]})]}),(0,r.jsxs)("div",{className:"p-3 flex items-stretch gap-2",children:[(0,r.jsx)("code",{className:"flex-1 bg-canvas border border-surface-3 rounded px-3 py-2 font-mono text-code-sm text-ink-dim overflow-x-auto whitespace-nowrap leading-relaxed",title:d,children:d}),(0,r.jsx)("button",{onClick:u,className:"btn ".concat(c?"text-secondary":""," flex-shrink-0"),title:"Copy command to clipboard",children:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s,{}),(0,r.jsx)("span",{children:"Copied"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a,{}),(0,r.jsx)("span",{children:"Copy"})]})})]})]})}function a(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function s(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}}},e=>{e.O(0,[619,441,255,358],()=>e(e.s=40040)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{15179:(e,s,a)=>{"use strict";a.d(s,{v:()=>r});var t=a(30926);let r=(0,t.createServerReference)("40752214370b8809166db2a79808d35c6f895b8e96",t.callServer,void 0,t.findSourceMapURL,"classifyAction")},30926:(e,s,a)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),!function(e,s){for(var a in s)Object.defineProperty(e,a,{enumerable:!0,get:s[a]})}(s,{callServer:function(){return t.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return r.findSourceMapURL}});let t=a(41209),r=a(85153),n=a(77197)},66821:(e,s,a)=>{Promise.resolve().then(a.bind(a,77723))},77723:(e,s,a)=>{"use strict";a.d(s,{LlmSection:()=>b});var t=a(95155),r=a(12115),n=a(30926);let i=(0,n.createServerReference)("40e3997692e89950cbd9aa3a93c357e243f8902d4a",n.callServer,void 0,n.findSourceMapURL,"saveLlmAction"),o=(0,n.createServerReference)("40e407fba4c4c47f0eee9e15086a3d5aa99c5378c6",n.callServer,void 0,n.findSourceMapURL,"setAutoClassifyAction"),l=(0,n.createServerReference)("40bde21f7e91870d097bffbaa46e22458192f4ebee",n.callServer,void 0,n.findSourceMapURL,"clearKeyAction"),c=(0,n.createServerReference)("401c586918197adb9b5d67a828a5ee10093e2ba47e",n.callServer,void 0,n.findSourceMapURL,"estimateAction");var d=a(15179);let m=[{id:"claude-haiku-4-5",label:"Claude Haiku 4.5 (cheapest)",provider:"anthropic",input:1,output:5},{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 (smarter)",provider:"anthropic",input:3,output:15},{id:"gpt-5-mini",label:"GPT-5 Mini (cheapest)",provider:"openai",input:.5,output:2},{id:"gpt-4o-mini",label:"GPT-4o Mini (very cheap)",provider:"openai",input:.15,output:.6},{id:"gpt-5",label:"GPT-5 (smarter)",provider:"openai",input:2.5,output:10}];function p(e){return m.filter(s=>s.provider===e)}function u(e){return"openai"===e?"gpt-5-mini":"claude-haiku-4-5"}let x=e=>e?e.slice(0,8)+"…"+e.slice(-4):"";function b(e){let{provider:s,anthKey:a,oaiKey:n,classifierModel:m,summarizerModel:b,classified:h,total:f,autoClassify:v}=e,[y,k]=(0,r.useState)(s),[j,N]=(0,r.useState)(m),[g,w]=(0,r.useState)(null),[S,C]=(0,r.useState)(v),[L,R]=(0,r.useState)({kind:"idle"}),[U,A]=(0,r.useTransition)(),M=("openai"===y?n:a).length>0,_=p(y),O=_.some(e=>e.id===j)?j:u(y),P=e=>{R({kind:"idle"}),A(async()=>{let s=await c(e);s.ok?R({kind:"estimate",totalUsd:s.totalUsd,rowCount:s.rowCount,modelLabel:s.modelLabel,scope:e}):R({kind:"error",message:s.error})})};return(0,t.jsxs)("div",{className:"card",children:[(0,t.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,t.jsx)("span",{children:"LLM provider"}),(0,t.jsxs)("span",{className:"normal-case tracking-normal text-ink-mute text-[11px] font-mono",children:[h,"/",f," sessions classified"]})]}),(0,t.jsxs)("form",{action:e=>{A(async()=>{await i(e),w(Date.now()),setTimeout(()=>w(null),2e3)})},className:"p-5 space-y-4 text-body-md",children:[(0,t.jsxs)("p",{className:"text-ink-dim text-body-sm",children:["Optional. Used to auto-title and categorize sessions, and to generate context primers when you click ",(0,t.jsx)("em",{children:"Copy context"})," on a session. Skip this and titles stay as the raw first prompt."]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-label-caps text-ink-mute block",children:"Provider"}),(0,t.jsxs)("select",{name:"provider",value:y,onChange:e=>{var s;k(s=e.target.value),p(s).some(e=>e.id===j)||N(u(s))},className:"bg-surface-1 border border-surface-3 rounded px-2 h-9 text-body-md w-full",children:[(0,t.jsx)("option",{value:"anthropic",children:"Anthropic"}),(0,t.jsx)("option",{value:"openai",children:"OpenAI"})]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-label-caps text-ink-mute block",children:"Model"}),(0,t.jsx)("select",{name:"classifier_model",value:O,onChange:e=>N(e.target.value),className:"bg-surface-1 border border-surface-3 rounded px-2 h-9 text-body-md font-mono w-full",children:_.map(e=>(0,t.jsx)("option",{value:e.id,children:e.label},e.id))})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"text-label-caps text-ink-mute block flex items-center justify-between",children:["Anthropic key",a&&(0,t.jsx)("button",{type:"button",onClick:()=>A(()=>l("anthropic")),className:"normal-case tracking-normal text-[10px] text-ink-mute hover:text-error",children:"clear"})]}),(0,t.jsx)("input",{type:"password",name:"anthropic_key",placeholder:x(a)||"sk-ant-…",className:"bg-surface-1 border border-surface-3 rounded px-3 h-9 text-body-md font-mono w-full focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"text-label-caps text-ink-mute block flex items-center justify-between",children:["OpenAI key",n&&(0,t.jsx)("button",{type:"button",onClick:()=>A(()=>l("openai")),className:"normal-case tracking-normal text-[10px] text-ink-mute hover:text-error",children:"clear"})]}),(0,t.jsx)("input",{type:"password",name:"openai_key",placeholder:x(n)||"sk-…",className:"bg-surface-1 border border-surface-3 rounded px-3 h-9 text-body-md font-mono w-full focus:outline-none focus:border-primary"})]})]}),(0,t.jsxs)("p",{className:"text-[11px] text-ink-mute leading-relaxed",children:["Keys are stored in plaintext in your local SQLite file — same threat model as"," ",(0,t.jsx)("span",{className:"font-mono",children:"~/.aws/credentials"})," or a ",(0,t.jsx)("span",{className:"font-mono",children:".env"}),". Never sent over the network. Any process that can read your home folder can read them."]}),(0,t.jsx)("input",{type:"hidden",name:"summarizer_model",value:b}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{className:"btn btn-primary",type:"submit",disabled:U,children:U?"Saving…":"Save"}),g&&(0,t.jsx)("span",{className:"text-body-sm text-secondary",children:"✓ saved"})]})]}),(0,t.jsxs)("div",{className:"px-5 pb-5 border-t border-surface-2 pt-4 space-y-3",children:[(0,t.jsxs)("label",{className:"flex items-start gap-3 text-body-sm ".concat(M?"cursor-pointer":"opacity-60 cursor-not-allowed"),children:[(0,t.jsx)("input",{type:"checkbox",checked:S,onChange:e=>{var s;C(s=e.target.checked),A(async()=>{await o(s)})},disabled:!M||U,className:"mt-1 accent-primary"}),(0,t.jsxs)("span",{className:"text-ink-dim",children:[(0,t.jsx)("span",{className:"text-ink font-medium",children:"Automatically classify new sessions"}),(0,t.jsx)("span",{className:"block text-ink-mute text-[11px] mt-0.5",children:"When a background scan finds unclassified sessions, batch them through the classifier. Costs ~$0.0001 per session."})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("button",{type:"button",disabled:!M||U,onClick:()=>P("uncategorized"),className:"btn disabled:opacity-50 disabled:cursor-not-allowed",children:"Classify uncategorized"}),(0,t.jsx)("button",{type:"button",disabled:!M||U,onClick:()=>P("all"),className:"btn disabled:opacity-50 disabled:cursor-not-allowed",children:"Re-classify all"}),!M&&(0,t.jsx)("span",{className:"text-body-sm text-ink-mute",children:"Save a key above to enable."})]}),"estimate"===L.kind&&(0,t.jsxs)("div",{className:"border border-primary/40 bg-primary/5 rounded p-3 text-body-sm",children:[(0,t.jsx)("div",{className:"text-ink mb-2",children:0===L.rowCount?"Nothing to classify.":(0,t.jsxs)(t.Fragment,{children:["About to classify ",(0,t.jsx)("span",{className:"font-mono text-primary",children:L.rowCount})," ","sessions with ",L.modelLabel," for an estimated"," ",(0,t.jsxs)("span",{className:"font-mono text-primary",children:["$",L.totalUsd.toFixed(4)]}),"."]})}),L.rowCount>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{var e;return e=L.scope,void A(async()=>{let s=await (0,d.v)(e);s.ok?R({kind:"done",classified:s.classified,costUsd:s.costUsd,warning:s.warning}):R({kind:"error",message:s.error})})},className:"btn btn-primary",disabled:U,children:U?"Classifying…":"Confirm"}),(0,t.jsx)("button",{type:"button",onClick:()=>R({kind:"idle"}),className:"btn",disabled:U,children:"Cancel"})]})]}),"done"===L.kind&&(0,t.jsxs)("div",{className:"border border-secondary/40 bg-secondary/5 rounded p-3 text-body-sm text-ink space-y-1",children:[(0,t.jsxs)("div",{children:["✓ Classified ",(0,t.jsx)("span",{className:"font-mono text-secondary",children:L.classified})," ","sessions for ",(0,t.jsxs)("span",{className:"font-mono",children:["$",L.costUsd.toFixed(4)]}),"."]}),L.warning&&(0,t.jsxs)("div",{className:"text-error text-[11px] border-l-2 border-error pl-2 font-mono break-words",children:["Warning: ",L.warning]})]}),"error"===L.kind&&(0,t.jsx)("div",{className:"text-body-sm text-error border-l-2 border-error pl-3",children:L.message})]})]})}}},e=>{e.O(0,[441,255,358],()=>e(e.s=66821)),_N_E=e.O()}]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentgraphed",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Claude Code usage monitor — local-first analytics dashboard for Claude Code & Codex CLI sessions. See every session, every project, every dollar. No login, no cloud.",
|
|
6
6
|
"keywords": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{15179:(e,t,r)=>{"use strict";r.d(t,{v:()=>o});var n=r(30926);let o=(0,n.createServerReference)("40752214370b8809166db2a79808d35c6f895b8e96",n.callServer,void 0,n.findSourceMapURL,"classifyAction")},15433:(e,t,r)=>{"use strict";r.d(t,{ClassifyChip:()=>a});var n=r(95155),o=r(12115),s=r(20063),i=r(15179);function a(e){let{count:t,estimatedUsd:r}=e,a=(0,s.useRouter)(),[l,c]=(0,o.useState)("idle"),[d,u]=(0,o.useState)(null),[m,p]=(0,o.useState)(null),[h,x]=(0,o.useTransition)(),f=()=>{if("idle"===l)return void c("confirm");"confirm"===l&&x(async()=>{let e=await (0,i.v)("uncategorized");if(!e.ok){u(e.error),c("err"),setTimeout(()=>c("idle"),4e3);return}p({classified:e.classified,costUsd:e.costUsd}),c("done"),a.refresh(),setTimeout(()=>c("idle"),3e3)})};return"done"===l&&m?(0,n.jsxs)("div",{className:"text-[11px] font-mono px-2 py-0.5 rounded bg-secondary/10 text-secondary border border-secondary/30",children:["✓ classified ",m.classified," \xb7 $",m.costUsd.toFixed(4)]}):"err"===l?(0,n.jsx)("div",{className:"text-[11px] font-mono px-2 py-0.5 rounded bg-error/10 text-error border border-error/30",title:null!=d?d:"",children:"✗ failed"}):"confirm"===l?(0,n.jsx)("button",{onClick:f,disabled:h,className:"text-[11px] font-mono px-2 py-0.5 rounded bg-primary/15 text-primary border border-primary/40 hover:bg-primary/25 transition-colors disabled:opacity-60",title:"Click again to confirm — sends prompts to your configured provider",children:h?"… classifying":"confirm \xb7 run for ~$".concat(r.toFixed(4))}):(0,n.jsxs)("button",{onClick:f,className:"text-[11px] font-mono px-2 py-0.5 rounded text-ink-mute hover:text-primary hover:bg-surface-2 transition-colors",title:"Send their first prompts to your configured LLM to assign a title + category. ~$0.0001 per session.",children:[t," unclassified \xb7 classify"]})}},17834:(e,t,r)=>{"use strict";r.d(t,{ShareButton:()=>s});var n=r(95155),o=r(12115);function s(e){let{imageUrl:t,className:r}=e,[s,c]=(0,o.useState)("idle"),[d,u]=(0,o.useState)(null),m=async()=>{c("busy"),u(null);try{var e;let r=await fetch(t);if(!r.ok)throw Error("HTTP ".concat(r.status));let n=await r.blob();if("undefined"==typeof ClipboardItem||!(null==(e=navigator.clipboard)?void 0:e.write))throw Error("clipboard image unsupported");let o=new ClipboardItem({"image/png":n});await navigator.clipboard.write([o]),c("done"),setTimeout(()=>c("idle"),2400)}catch(e){try{let e=await fetch(t),r=await e.blob(),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download="agentgraphed-stats.png",document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout(()=>URL.revokeObjectURL(n),5e3),u("Saved to Downloads (clipboard image unsupported)"),c("err"),setTimeout(()=>c("idle"),4e3)}catch(t){u(t.message||e.message),c("err"),setTimeout(()=>c("idle"),3e3)}}};return(0,n.jsx)("button",{onClick:m,disabled:"busy"===s,"aria-label":"Share",title:"busy"===s?"Generating image…":"done"===s?"Image copied to clipboard":"err"===s?null!=d?d:"Try again":"Copy share image to clipboard",className:"btn-icon ".concat("done"===s?"text-secondary":""," ").concat(null!=r?r:""),children:"busy"===s?(0,n.jsx)(l,{}):"done"===s?(0,n.jsx)(a,{}):(0,n.jsx)(i,{})})}function i(){return(0,n.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),(0,n.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,n.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]})}function a(){return(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function l(){return(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:(0,n.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},20467:(e,t,r)=>{"use strict";function n(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"k"):e.toString()}function o(e){return e>=1e3?"$".concat(e.toFixed(0)):"$".concat(e.toFixed(2))}function s(e){let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60)return"".concat(r,"m");let n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}r.d(t,{F0:()=>o,c5:()=>s,yj:()=>n})},29366:(e,t,r)=>{"use strict";r.d(t,{UsageChartCard:()=>x});var n=r(95155),o=r(12115),s=r(20063),i=r(26991),a=r(73850),l=r(68425),c=r(47734),d=r(73697),u=r(23508),m=r(77568),p=r(20467);function h(e){let{data:t,metric:r="tokens",scale:o="lin"}=e,s=t.map(e=>{let t=e[r];return{...e,label:e.day.slice(5),value:"log"===o&&t<=0?1:t,raw:t}}),h="cost"===r?"#00ffab":"#00f5ff";return(0,n.jsx)("div",{className:"h-64 -mx-1",children:(0,n.jsx)(i.u,{width:"100%",height:"100%",children:(0,n.jsxs)(a.Q,{data:s,margin:{top:8,right:8,bottom:0,left:-8},children:[(0,n.jsx)("defs",{children:(0,n.jsxs)("linearGradient",{id:"grad-".concat(r),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:h,stopOpacity:.35}),(0,n.jsx)("stop",{offset:"100%",stopColor:h,stopOpacity:0})]})}),(0,n.jsx)(l.d,{stroke:"#262a31",strokeDasharray:"2 4",vertical:!1}),(0,n.jsx)(c.W,{dataKey:"label",tick:{fill:"#849495",fontSize:11,fontFamily:"JetBrains Mono"},axisLine:{stroke:"#262a31"},tickLine:!1,minTickGap:48}),(0,n.jsx)(d.h,{scale:"log"===o?"log":"auto",domain:"log"===o?[1,"auto"]:["auto","auto"],allowDataOverflow:!0,tick:{fill:"#849495",fontSize:11,fontFamily:"JetBrains Mono"},axisLine:!1,tickLine:!1,tickFormatter:e=>"cost"===r?"$".concat(Math.round(e)):(0,p.yj)(e)}),(0,n.jsx)(u.m,{cursor:{stroke:h,strokeOpacity:.3},contentStyle:{background:"#181c22",border:"1px solid ".concat(h),borderRadius:6,fontSize:12,color:"#dfe2eb"},formatter:(e,t,n)=>{var o,s;let i=null!=(s=null==n||null==(o=n.payload)?void 0:o.raw)?s:0;return"tokens"===r?[(0,p.yj)(i),"tokens"]:"sessions"===r?[i.toString(),"sessions"]:["$".concat(i.toFixed(2)),"cost"]},labelFormatter:e=>"Day ".concat(e)}),(0,n.jsx)(m.G,{type:"monotone",dataKey:"value",stroke:h,strokeWidth:2,fill:"url(#grad-".concat(r,")"),isAnimationActive:!1})]})})})}function x(e){let{data:t,label:r="last 30 days",metric:i,scale:a}=e,l=(0,s.useRouter)(),c=(0,s.usePathname)(),d=(0,s.useSearchParams)(),u=(0,o.useMemo)(()=>!function(e,t){let r=e.map(e=>e[t]).filter(e=>e>0);if(r.length<5)return!1;let n=[...r].sort((e,t)=>e-t);return n[n.length-1]/Math.max(n[Math.max(0,Math.floor(.1*r.length)-1)],1)>50}(t,i)?"lin":"log",[t,i]),m=null!=a?a:u,p=(e,t,r)=>{let n=new URLSearchParams(d.toString());null===t||t===r?n.delete(e):n.set(e,t);let o=n.toString();l.push(o?"".concat(c,"?").concat(o):c,{scroll:!1})};return(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,n.jsxs)("span",{children:["Usage — ",r]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 normal-case tracking-normal",children:[(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:[{id:"tokens",label:"Tokens"},{id:"sessions",label:"Sessions"},{id:"cost",label:"Est. Cost"}].map(e=>(0,n.jsx)("button",{onClick:()=>p("metric",e.id,"tokens"),className:"px-2 py-0.5 text-[11px] rounded transition-colors font-mono ".concat(i===e.id?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim"),children:e.label},e.id))}),(0,n.jsx)("div",{className:"w-px h-4 bg-surface-3"}),(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:["lin","log"].map(e=>(0,n.jsxs)("button",{onClick:()=>p("scale",e,u),className:"px-1.5 py-0.5 text-[10px] rounded transition-colors font-mono uppercase relative ".concat(m===e?"bg-secondary/15 text-secondary":"text-ink-mute hover:text-ink-dim"),title:"log"===e?"Logarithmic scale — better when one day dwarfs the rest":"Linear scale",children:[e,null===a&&u===e&&(0,n.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-secondary",title:"auto-selected based on data range"})]},e))})]})]}),(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(h,{data:t,metric:i,scale:m})})]})}},30926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{callServer:function(){return n.callServer},createServerReference:function(){return s.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}});let n=r(41209),o=r(85153),s=r(77197)},34077:(e,t,r)=>{"use strict";r.d(t,{FreshnessIndicator:()=>i});var n=r(95155),o=r(12115),s=r(20063);function i(e){let{lastIngestedAt:t}=e,[,r]=(0,o.useState)(0),[i,c]=(0,o.useState)(!1),[d,u]=(0,o.useTransition)(),m=(0,s.useRouter)();(0,o.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),5e3);return()=>clearInterval(e)},[]);let p=0===t?"never scanned":"updated ".concat(function(e){let t=Date.now()-e;return t<1e3?"just now":t<6e4?"".concat(l(Math.round(t/1e3)),"s"):t<36e5?"".concat(l(Math.round(t/6e4)),"m"):"".concat(l(Math.round(t/36e5)),"h")}(t)," ago"),h=0===t,x=i||d;return(0,n.jsxs)("button",{type:"button",onClick:function(){u(()=>m.refresh())},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),disabled:h||d,title:"Re-scan local sessions and refresh",style:{width:"128px"},className:"text-[11px] font-mono tabular px-2 py-0.5 rounded transition-colors text-ink-mute hover:text-primary hover:bg-surface-2 focus-visible:text-primary focus-visible:bg-surface-2 outline-none disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-ink-mute disabled:cursor-not-allowed grid items-center",children:[(0,n.jsx)("span",{className:"col-start-1 row-start-1 transition-opacity flex items-center justify-center gap-1.5 whitespace-nowrap",style:{opacity:+!x},children:p}),(0,n.jsxs)("span",{"aria-hidden":!0,className:"col-start-1 row-start-1 transition-opacity flex items-center justify-center gap-1.5 whitespace-nowrap",style:{opacity:+!!x},children:[(0,n.jsx)(a,{spinning:d}),(0,n.jsx)("span",{children:"refresh"})]})]})}function a(e){let{spinning:t}=e;return(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:t?"animate-spin":"",children:[(0,n.jsx)("path",{d:"M3 12a9 9 0 0 1 15.5-6.4L21 8"}),(0,n.jsx)("path",{d:"M21 3v5h-5"}),(0,n.jsx)("path",{d:"M21 12a9 9 0 0 1-15.5 6.4L3 16"}),(0,n.jsx)("path",{d:"M3 21v-5h5"})]})}function l(e){return e<10?"0".concat(e):String(e)}},40250:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,52619,23)),Promise.resolve().then(r.bind(r,15433)),Promise.resolve().then(r.bind(r,34077)),Promise.resolve().then(r.bind(r,74050)),Promise.resolve().then(r.bind(r,61438)),Promise.resolve().then(r.bind(r,95925)),Promise.resolve().then(r.bind(r,17834)),Promise.resolve().then(r.bind(r,29366))},61438:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>a});var n=r(95155),o=r(20063),s=r(12115),i=r(47650);function a(e){var t,r;let{projects:a,current:l}=e,c=(0,o.useRouter)(),d=(0,o.usePathname)(),u=(0,o.useSearchParams)(),[m,p]=(0,s.useState)(!1),[h,x]=(0,s.useTransition)(),[f,y]=(0,s.useState)(!1),[b,v]=(0,s.useState)(null),g=(0,s.useRef)(null);(0,s.useEffect)(()=>y(!0),[]);let k=e=>{let t=new URLSearchParams(u.toString());e?t.set("project",e):t.delete("project");let r=t.toString();p(!1),x(()=>c.push(r?"".concat(d,"?").concat(r):d,{scroll:!1}))},j=l?null!=(r=null==(t=a.find(e=>e.id===l))?void 0:t.name)?r:"project":null;return(0,s.useEffect)(()=>{if(!m)return;let e=e=>{var t;let r=e.target;if(null==(t=g.current)?void 0:t.contains(r))return;let n=document.getElementById("project-filter-pop");null!=n&&n.contains(r)||p(!1)},t=e=>{"Escape"===e.key&&p(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[m]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:g,onClick:()=>{if(!m&&g.current){let e=g.current.getBoundingClientRect();v({top:e.bottom+6,left:e.left,width:Math.max(e.width,220)})}p(e=>!e)},className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors flex items-center gap-1.5 ".concat(l?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim hover:bg-surface-2"," ").concat(h?"opacity-60":""),title:"Filter by project",children:[(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),(0,n.jsx)("span",{className:"truncate max-w-[140px]",children:null!=j?j:"All projects"}),(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform ".concat(m?"rotate-180":""),children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),f&&m&&b&&(0,i.createPortal)((0,n.jsxs)("div",{id:"project-filter-pop",style:{position:"fixed",top:b.top,left:b.left,minWidth:b.width,backgroundColor:"#1c2026",zIndex:100,isolation:"isolate"},className:"border border-surface-3 rounded-md shadow-xl overflow-hidden text-[12px] font-mono max-h-[60vh] overflow-y-auto",children:[(0,n.jsx)("button",{onClick:()=>k(null),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 ".concat(l?"text-ink-dim":"text-primary bg-primary/10"),children:"All projects"}),(0,n.jsx)("div",{className:"h-px bg-surface-3"}),a.map(e=>(0,n.jsx)("button",{onClick:()=>k(e.id),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 truncate ".concat(l===e.id?"text-primary bg-primary/10":"text-ink-dim"),title:e.name,children:e.name},e.id)),0===a.length&&(0,n.jsx)("div",{className:"px-3 py-2 text-ink-mute",children:"No projects yet."})]}),document.body)]})}},74050:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>a});var n=r(95155),o=r(20063),s=r(12115),i=r(47650);function a(e){let{families:t,current:r}=e,a=(0,o.useRouter)(),l=(0,o.usePathname)(),c=(0,o.useSearchParams)(),[d,u]=(0,s.useState)(!1),[m,p]=(0,s.useTransition)(),[h,x]=(0,s.useState)(!1),[f,y]=(0,s.useState)(null),b=(0,s.useRef)(null);(0,s.useEffect)(()=>x(!0),[]);let v=e=>{let t=new URLSearchParams(c.toString());e?t.set("model",e):t.delete("model");let r=t.toString();u(!1),p(()=>a.push(r?"".concat(l,"?").concat(r):l,{scroll:!1}))};return(0,s.useEffect)(()=>{if(!d)return;let e=e=>{var t;let r=e.target;if(null==(t=b.current)?void 0:t.contains(r))return;let n=document.getElementById("model-filter-pop");null!=n&&n.contains(r)||u(!1)},t=e=>{"Escape"===e.key&&u(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[d]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:b,onClick:()=>{if(!d&&b.current){let e=b.current.getBoundingClientRect();y({top:e.bottom+6,left:e.left,width:Math.max(e.width,200)})}u(e=>!e)},className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors flex items-center gap-1.5 ".concat(r?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim hover:bg-surface-2"," ").concat(m?"opacity-60":""),title:"Filter by model",children:[(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,n.jsx)("path",{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),(0,n.jsx)("span",{className:"truncate max-w-[140px]",children:null!=r?r:"All models"}),(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform ".concat(d?"rotate-180":""),children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),h&&d&&f&&(0,i.createPortal)((0,n.jsxs)("div",{id:"model-filter-pop",style:{position:"fixed",top:f.top,left:f.left,minWidth:f.width,backgroundColor:"#1c2026",zIndex:100,isolation:"isolate"},className:"border border-surface-3 rounded-md shadow-xl overflow-hidden text-[12px] font-mono max-h-[60vh] overflow-y-auto",children:[(0,n.jsx)("button",{onClick:()=>v(null),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 ".concat(r?"text-ink-dim":"text-primary bg-primary/10"),children:"All models"}),(0,n.jsx)("div",{className:"h-px bg-surface-3"}),t.map(e=>(0,n.jsxs)("button",{onClick:()=>v(e.family),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 flex items-center justify-between gap-3 ".concat(r===e.family?"text-primary bg-primary/10":"text-ink-dim"),title:e.family,children:[(0,n.jsx)("span",{className:"truncate",children:e.family}),(0,n.jsx)("span",{className:"text-ink-mute text-[10px] tabular",children:e.sessions})]},e.family)),0===t.length&&(0,n.jsx)("div",{className:"px-3 py-2 text-ink-mute",children:"No models seen yet."})]}),document.body)]})}},95925:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>a});var n=r(95155),o=r(20063),s=r(12115);let i=[{key:"7d",label:"Last 7 days",days:7},{key:"30d",label:"Last 30 days",days:30},{key:"90d",label:"Last 90 days",days:90},{key:"all",label:"All time",days:null}];function a(e){let{current:t}=e,r=(0,o.useRouter)(),a=(0,o.usePathname)(),l=(0,o.useSearchParams)(),[c,d]=(0,s.useTransition)();return(0,n.jsx)("div",{className:"flex items-center gap-0.5 normal-case tracking-normal transition-opacity ".concat(c?"opacity-50":""),children:i.map(e=>(0,n.jsx)("button",{onClick:()=>(e=>{let t=new URLSearchParams(l.toString());"30d"===e?t.delete("range"):t.set("range",e);let n=t.toString();d(()=>{r.push(n?"".concat(a,"?").concat(n):a)})})(e.key),className:"px-2 py-0.5 text-[11px] rounded transition-colors font-mono ".concat(t===e.key?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim"),children:"all"===e.key?"All":e.key},e.key))})}}},e=>{e.O(0,[619,997,441,255,358],()=>e(e.s=40250)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[824],{8261:(e,t,n)=>{"use strict";n.d(t,{SessionActions:()=>l});var r=n(95155),i=n(12115),o=n(52619),a=n.n(o),s=n(30926);let c=(0,s.createServerReference)("4036417922bbc667f36cb1952fb5ad4b808ef92548",s.callServer,void 0,s.findSourceMapURL,"generateContextAction");function l(e){let{sessionId:t,hasLlmKey:n,cachedContext:o}=e,[s,l]=(0,i.useState)(o),[d,u]=(0,i.useState)(!1),[h,x]=(0,i.useState)(null),[m,p]=(0,i.useState)(null),[f,b]=(0,i.useTransition)();return(0,r.jsxs)("div",{className:"flex items-center gap-2 relative",children:[(0,r.jsx)("button",{onClick:()=>{x(null),b(async()=>{if(s){await navigator.clipboard.writeText(s),u(!0),setTimeout(()=>u(!1),1800);return}let e=await c(t);if(!e.ok)return void x(e.error);l(e.context),p(e.costUsd),await navigator.clipboard.writeText(e.context),u(!0),setTimeout(()=>u(!1),1800)})},disabled:!n||f,title:n?"Summarize this session so you can paste it into a fresh chat":"Add an API key in Settings to enable",className:"btn ".concat(n?"btn-primary":""," disabled:opacity-50 disabled:cursor-not-allowed"),children:f?"… summarizing":d?"✓ Copied":s?"Copy summary":"Summarize for new chat"}),(h||null!==m&&m>0||!n)&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 text-[11px] text-ink-mute flex items-center gap-2 whitespace-nowrap",children:[h&&(0,r.jsx)("span",{className:"text-error",children:h}),null!==m&&m>0&&(0,r.jsxs)("span",{className:"font-mono",children:["cost $",m.toFixed(4)]}),!n&&(0,r.jsxs)("span",{children:["summary needs ",(0,r.jsx)(a(),{href:"/settings",className:"text-primary hover:underline",children:"an API key"})]})]})]})}},17834:(e,t,n)=>{"use strict";n.d(t,{ShareButton:()=>o});var r=n(95155),i=n(12115);function o(e){let{imageUrl:t,className:n}=e,[o,l]=(0,i.useState)("idle"),[d,u]=(0,i.useState)(null),h=async()=>{l("busy"),u(null);try{var e;let n=await fetch(t);if(!n.ok)throw Error("HTTP ".concat(n.status));let r=await n.blob();if("undefined"==typeof ClipboardItem||!(null==(e=navigator.clipboard)?void 0:e.write))throw Error("clipboard image unsupported");let i=new ClipboardItem({"image/png":r});await navigator.clipboard.write([i]),l("done"),setTimeout(()=>l("idle"),2400)}catch(e){try{let e=await fetch(t),n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download="agentgraphed-stats.png",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),5e3),u("Saved to Downloads (clipboard image unsupported)"),l("err"),setTimeout(()=>l("idle"),4e3)}catch(t){u(t.message||e.message),l("err"),setTimeout(()=>l("idle"),3e3)}}};return(0,r.jsx)("button",{onClick:h,disabled:"busy"===o,"aria-label":"Share",title:"busy"===o?"Generating image…":"done"===o?"Image copied to clipboard":"err"===o?null!=d?d:"Try again":"Copy share image to clipboard",className:"btn-icon ".concat("done"===o?"text-secondary":""," ").concat(null!=n?n:""),children:"busy"===o?(0,r.jsx)(c,{}):"done"===o?(0,r.jsx)(s,{}):(0,r.jsx)(a,{})})}function a(){return(0,r.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),(0,r.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,r.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]})}function s(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function c(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},30926:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{callServer:function(){return r.callServer},createServerReference:function(){return o.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}});let r=n(41209),i=n(85153),o=n(77197)},40040:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,52619,23)),Promise.resolve().then(n.bind(n,44782)),Promise.resolve().then(n.bind(n,8261)),Promise.resolve().then(n.bind(n,17834))},44782:(e,t,n)=>{"use strict";n.d(t,{ResumePanel:()=>o});var r=n(95155),i=n(12115);function o(e){let{provider:t,cwd:n,sessionId:o}=e,[c,l]=(0,i.useState)(!1),d=function(e,t,n){let r='cd "'.concat(t,'"');return"claude"===e?"".concat(r," && claude --resume ").concat(n):"codex"===e?"".concat(r," && codex resume ").concat(n):r}(t,n,o),u=async()=>{await navigator.clipboard.writeText(d),l(!0),setTimeout(()=>l(!1),2e3)};return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,r.jsx)("span",{children:"Resume in your terminal"}),(0,r.jsxs)("span",{className:"normal-case tracking-normal font-normal text-ink-mute text-[11px]",children:["paste into ","claude"===t?"Claude Code":"codex"===t?"Codex CLI":t]})]}),(0,r.jsxs)("div",{className:"p-3 flex items-stretch gap-2",children:[(0,r.jsx)("code",{className:"flex-1 bg-canvas border border-surface-3 rounded px-3 py-2 font-mono text-code-sm text-ink-dim overflow-x-auto whitespace-nowrap leading-relaxed",title:d,children:d}),(0,r.jsx)("button",{onClick:u,className:"btn ".concat(c?"text-secondary":""," flex-shrink-0"),title:"Copy command to clipboard",children:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s,{}),(0,r.jsx)("span",{children:"Copied"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a,{}),(0,r.jsx)("span",{children:"Copy"})]})})]})]})}function a(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function s(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}}},e=>{e.O(0,[619,441,255,358],()=>e(e.s=40040)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{15179:(e,s,a)=>{"use strict";a.d(s,{v:()=>r});var t=a(30926);let r=(0,t.createServerReference)("40752214370b8809166db2a79808d35c6f895b8e96",t.callServer,void 0,t.findSourceMapURL,"classifyAction")},30926:(e,s,a)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),!function(e,s){for(var a in s)Object.defineProperty(e,a,{enumerable:!0,get:s[a]})}(s,{callServer:function(){return t.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return r.findSourceMapURL}});let t=a(41209),r=a(85153),n=a(77197)},66821:(e,s,a)=>{Promise.resolve().then(a.bind(a,77723))},77723:(e,s,a)=>{"use strict";a.d(s,{LlmSection:()=>b});var t=a(95155),r=a(12115),n=a(30926);let i=(0,n.createServerReference)("40e3997692e89950cbd9aa3a93c357e243f8902d4a",n.callServer,void 0,n.findSourceMapURL,"saveLlmAction"),o=(0,n.createServerReference)("40e407fba4c4c47f0eee9e15086a3d5aa99c5378c6",n.callServer,void 0,n.findSourceMapURL,"setAutoClassifyAction"),l=(0,n.createServerReference)("40bde21f7e91870d097bffbaa46e22458192f4ebee",n.callServer,void 0,n.findSourceMapURL,"clearKeyAction"),c=(0,n.createServerReference)("401c586918197adb9b5d67a828a5ee10093e2ba47e",n.callServer,void 0,n.findSourceMapURL,"estimateAction");var d=a(15179);let m=[{id:"claude-haiku-4-5",label:"Claude Haiku 4.5 (cheapest)",provider:"anthropic",input:1,output:5},{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 (smarter)",provider:"anthropic",input:3,output:15},{id:"gpt-5-mini",label:"GPT-5 Mini (cheapest)",provider:"openai",input:.5,output:2},{id:"gpt-4o-mini",label:"GPT-4o Mini (very cheap)",provider:"openai",input:.15,output:.6},{id:"gpt-5",label:"GPT-5 (smarter)",provider:"openai",input:2.5,output:10}];function p(e){return m.filter(s=>s.provider===e)}function u(e){return"openai"===e?"gpt-5-mini":"claude-haiku-4-5"}let x=e=>e?e.slice(0,8)+"…"+e.slice(-4):"";function b(e){let{provider:s,anthKey:a,oaiKey:n,classifierModel:m,summarizerModel:b,classified:h,total:f,autoClassify:v}=e,[y,k]=(0,r.useState)(s),[j,N]=(0,r.useState)(m),[g,w]=(0,r.useState)(null),[S,C]=(0,r.useState)(v),[L,R]=(0,r.useState)({kind:"idle"}),[U,A]=(0,r.useTransition)(),M=("openai"===y?n:a).length>0,_=p(y),O=_.some(e=>e.id===j)?j:u(y),P=e=>{R({kind:"idle"}),A(async()=>{let s=await c(e);s.ok?R({kind:"estimate",totalUsd:s.totalUsd,rowCount:s.rowCount,modelLabel:s.modelLabel,scope:e}):R({kind:"error",message:s.error})})};return(0,t.jsxs)("div",{className:"card",children:[(0,t.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,t.jsx)("span",{children:"LLM provider"}),(0,t.jsxs)("span",{className:"normal-case tracking-normal text-ink-mute text-[11px] font-mono",children:[h,"/",f," sessions classified"]})]}),(0,t.jsxs)("form",{action:e=>{A(async()=>{await i(e),w(Date.now()),setTimeout(()=>w(null),2e3)})},className:"p-5 space-y-4 text-body-md",children:[(0,t.jsxs)("p",{className:"text-ink-dim text-body-sm",children:["Optional. Used to auto-title and categorize sessions, and to generate context primers when you click ",(0,t.jsx)("em",{children:"Copy context"})," on a session. Skip this and titles stay as the raw first prompt."]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-label-caps text-ink-mute block",children:"Provider"}),(0,t.jsxs)("select",{name:"provider",value:y,onChange:e=>{var s;k(s=e.target.value),p(s).some(e=>e.id===j)||N(u(s))},className:"bg-surface-1 border border-surface-3 rounded px-2 h-9 text-body-md w-full",children:[(0,t.jsx)("option",{value:"anthropic",children:"Anthropic"}),(0,t.jsx)("option",{value:"openai",children:"OpenAI"})]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-label-caps text-ink-mute block",children:"Model"}),(0,t.jsx)("select",{name:"classifier_model",value:O,onChange:e=>N(e.target.value),className:"bg-surface-1 border border-surface-3 rounded px-2 h-9 text-body-md font-mono w-full",children:_.map(e=>(0,t.jsx)("option",{value:e.id,children:e.label},e.id))})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"text-label-caps text-ink-mute block flex items-center justify-between",children:["Anthropic key",a&&(0,t.jsx)("button",{type:"button",onClick:()=>A(()=>l("anthropic")),className:"normal-case tracking-normal text-[10px] text-ink-mute hover:text-error",children:"clear"})]}),(0,t.jsx)("input",{type:"password",name:"anthropic_key",placeholder:x(a)||"sk-ant-…",className:"bg-surface-1 border border-surface-3 rounded px-3 h-9 text-body-md font-mono w-full focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"text-label-caps text-ink-mute block flex items-center justify-between",children:["OpenAI key",n&&(0,t.jsx)("button",{type:"button",onClick:()=>A(()=>l("openai")),className:"normal-case tracking-normal text-[10px] text-ink-mute hover:text-error",children:"clear"})]}),(0,t.jsx)("input",{type:"password",name:"openai_key",placeholder:x(n)||"sk-…",className:"bg-surface-1 border border-surface-3 rounded px-3 h-9 text-body-md font-mono w-full focus:outline-none focus:border-primary"})]})]}),(0,t.jsxs)("p",{className:"text-[11px] text-ink-mute leading-relaxed",children:["Keys are stored in plaintext in your local SQLite file — same threat model as"," ",(0,t.jsx)("span",{className:"font-mono",children:"~/.aws/credentials"})," or a ",(0,t.jsx)("span",{className:"font-mono",children:".env"}),". Never sent over the network. Any process that can read your home folder can read them."]}),(0,t.jsx)("input",{type:"hidden",name:"summarizer_model",value:b}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{className:"btn btn-primary",type:"submit",disabled:U,children:U?"Saving…":"Save"}),g&&(0,t.jsx)("span",{className:"text-body-sm text-secondary",children:"✓ saved"})]})]}),(0,t.jsxs)("div",{className:"px-5 pb-5 border-t border-surface-2 pt-4 space-y-3",children:[(0,t.jsxs)("label",{className:"flex items-start gap-3 text-body-sm ".concat(M?"cursor-pointer":"opacity-60 cursor-not-allowed"),children:[(0,t.jsx)("input",{type:"checkbox",checked:S,onChange:e=>{var s;C(s=e.target.checked),A(async()=>{await o(s)})},disabled:!M||U,className:"mt-1 accent-primary"}),(0,t.jsxs)("span",{className:"text-ink-dim",children:[(0,t.jsx)("span",{className:"text-ink font-medium",children:"Automatically classify new sessions"}),(0,t.jsx)("span",{className:"block text-ink-mute text-[11px] mt-0.5",children:"When a background scan finds unclassified sessions, batch them through the classifier. Costs ~$0.0001 per session."})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("button",{type:"button",disabled:!M||U,onClick:()=>P("uncategorized"),className:"btn disabled:opacity-50 disabled:cursor-not-allowed",children:"Classify uncategorized"}),(0,t.jsx)("button",{type:"button",disabled:!M||U,onClick:()=>P("all"),className:"btn disabled:opacity-50 disabled:cursor-not-allowed",children:"Re-classify all"}),!M&&(0,t.jsx)("span",{className:"text-body-sm text-ink-mute",children:"Save a key above to enable."})]}),"estimate"===L.kind&&(0,t.jsxs)("div",{className:"border border-primary/40 bg-primary/5 rounded p-3 text-body-sm",children:[(0,t.jsx)("div",{className:"text-ink mb-2",children:0===L.rowCount?"Nothing to classify.":(0,t.jsxs)(t.Fragment,{children:["About to classify ",(0,t.jsx)("span",{className:"font-mono text-primary",children:L.rowCount})," ","sessions with ",L.modelLabel," for an estimated"," ",(0,t.jsxs)("span",{className:"font-mono text-primary",children:["$",L.totalUsd.toFixed(4)]}),"."]})}),L.rowCount>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{var e;return e=L.scope,void A(async()=>{let s=await (0,d.v)(e);s.ok?R({kind:"done",classified:s.classified,costUsd:s.costUsd,warning:s.warning}):R({kind:"error",message:s.error})})},className:"btn btn-primary",disabled:U,children:U?"Classifying…":"Confirm"}),(0,t.jsx)("button",{type:"button",onClick:()=>R({kind:"idle"}),className:"btn",disabled:U,children:"Cancel"})]})]}),"done"===L.kind&&(0,t.jsxs)("div",{className:"border border-secondary/40 bg-secondary/5 rounded p-3 text-body-sm text-ink space-y-1",children:[(0,t.jsxs)("div",{children:["✓ Classified ",(0,t.jsx)("span",{className:"font-mono text-secondary",children:L.classified})," ","sessions for ",(0,t.jsxs)("span",{className:"font-mono",children:["$",L.costUsd.toFixed(4)]}),"."]}),L.warning&&(0,t.jsxs)("div",{className:"text-error text-[11px] border-l-2 border-error pl-2 font-mono break-words",children:["Warning: ",L.warning]})]}),"error"===L.kind&&(0,t.jsx)("div",{className:"text-body-sm text-error border-l-2 border-error pl-3",children:L.message})]})]})}}},e=>{e.O(0,[441,255,358],()=>e(e.s=66821)),_N_E=e.O()}]);
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented here.
|
|
|
4
4
|
|
|
5
5
|
The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [0.3.3] — 2026-06-09
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- **Every release is now boot-verified on macOS, Windows, and Linux before being declared good.** The CI publish workflow gained a `verify-platforms` matrix that pulls the freshly-published tarball from the npm registry and boots the dashboard on `macos-latest`, `windows-latest`, and `ubuntu-latest`. The 0.1.0–0.3.1 Apple Silicon dlopen bug would have died here — the previous in-job verification ran on the same Linux runner that built the bundle, so the platform mismatch never surfaced. No code changes; product behavior identical to 0.3.2.
|
|
11
|
+
|
|
12
|
+
## [0.3.2] — 2026-06-09
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- **`npx agentgraphed` failed to start on macOS and Windows.** The CI runner is Linux, so `npm run build` left a Linux x64 `better-sqlite3` binary inside `.next/standalone/node_modules/better-sqlite3/`. On install, npm fetches the correct platform prebuild at the top level, but Node's standalone-bundle require resolution found the Linux binary first and dlopened it — failing with `slice is not valid mach-o file` on Apple Silicon (and the equivalent on Windows). Versions 0.1.0 through 0.3.1 were all affected. The post-build script now prunes `node_modules/better-sqlite3` from the standalone bundle so require falls through to the platform-correct copy installed alongside the package. Reproduced and verified on a clean install.
|
|
16
|
+
|
|
7
17
|
## [0.3.1] — 2026-06-09
|
|
8
18
|
|
|
9
19
|
### Fixed
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentgraphed",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Claude Code usage monitor — local-first analytics dashboard for Claude Code & Codex CLI sessions. See every session, every project, every dollar. No login, no cloud.",
|
|
6
6
|
"keywords": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{15433:(e,t,r)=>{"use strict";r.d(t,{ClassifyChip:()=>a});var n=r(95155),o=r(12115),s=r(20063),i=r(96674);function a(e){let{count:t,estimatedUsd:r}=e,a=(0,s.useRouter)(),[l,c]=(0,o.useState)("idle"),[d,u]=(0,o.useState)(null),[m,p]=(0,o.useState)(null),[h,x]=(0,o.useTransition)(),f=()=>{if("idle"===l)return void c("confirm");"confirm"===l&&x(async()=>{let e=await (0,i.v)("uncategorized");if(!e.ok){u(e.error),c("err"),setTimeout(()=>c("idle"),4e3);return}p({classified:e.classified,costUsd:e.costUsd}),c("done"),a.refresh(),setTimeout(()=>c("idle"),3e3)})};return"done"===l&&m?(0,n.jsxs)("div",{className:"text-[11px] font-mono px-2 py-0.5 rounded bg-secondary/10 text-secondary border border-secondary/30",children:["✓ classified ",m.classified," \xb7 $",m.costUsd.toFixed(4)]}):"err"===l?(0,n.jsx)("div",{className:"text-[11px] font-mono px-2 py-0.5 rounded bg-error/10 text-error border border-error/30",title:null!=d?d:"",children:"✗ failed"}):"confirm"===l?(0,n.jsx)("button",{onClick:f,disabled:h,className:"text-[11px] font-mono px-2 py-0.5 rounded bg-primary/15 text-primary border border-primary/40 hover:bg-primary/25 transition-colors disabled:opacity-60",title:"Click again to confirm — sends prompts to your configured provider",children:h?"… classifying":"confirm \xb7 run for ~$".concat(r.toFixed(4))}):(0,n.jsxs)("button",{onClick:f,className:"text-[11px] font-mono px-2 py-0.5 rounded text-ink-mute hover:text-primary hover:bg-surface-2 transition-colors",title:"Send their first prompts to your configured LLM to assign a title + category. ~$0.0001 per session.",children:[t," unclassified \xb7 classify"]})}},17834:(e,t,r)=>{"use strict";r.d(t,{ShareButton:()=>s});var n=r(95155),o=r(12115);function s(e){let{imageUrl:t,className:r}=e,[s,c]=(0,o.useState)("idle"),[d,u]=(0,o.useState)(null),m=async()=>{c("busy"),u(null);try{var e;let r=await fetch(t);if(!r.ok)throw Error("HTTP ".concat(r.status));let n=await r.blob();if("undefined"==typeof ClipboardItem||!(null==(e=navigator.clipboard)?void 0:e.write))throw Error("clipboard image unsupported");let o=new ClipboardItem({"image/png":n});await navigator.clipboard.write([o]),c("done"),setTimeout(()=>c("idle"),2400)}catch(e){try{let e=await fetch(t),r=await e.blob(),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download="agentgraphed-stats.png",document.body.appendChild(o),o.click(),document.body.removeChild(o),setTimeout(()=>URL.revokeObjectURL(n),5e3),u("Saved to Downloads (clipboard image unsupported)"),c("err"),setTimeout(()=>c("idle"),4e3)}catch(t){u(t.message||e.message),c("err"),setTimeout(()=>c("idle"),3e3)}}};return(0,n.jsx)("button",{onClick:m,disabled:"busy"===s,"aria-label":"Share",title:"busy"===s?"Generating image…":"done"===s?"Image copied to clipboard":"err"===s?null!=d?d:"Try again":"Copy share image to clipboard",className:"btn-icon ".concat("done"===s?"text-secondary":""," ").concat(null!=r?r:""),children:"busy"===s?(0,n.jsx)(l,{}):"done"===s?(0,n.jsx)(a,{}):(0,n.jsx)(i,{})})}function i(){return(0,n.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),(0,n.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,n.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]})}function a(){return(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function l(){return(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:(0,n.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},20467:(e,t,r)=>{"use strict";function n(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"k"):e.toString()}function o(e){return e>=1e3?"$".concat(e.toFixed(0)):"$".concat(e.toFixed(2))}function s(e){let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60)return"".concat(r,"m");let n=Math.floor(r/60);return"".concat(n,"h ").concat(r%60,"m")}r.d(t,{F0:()=>o,c5:()=>s,yj:()=>n})},29366:(e,t,r)=>{"use strict";r.d(t,{UsageChartCard:()=>x});var n=r(95155),o=r(12115),s=r(20063),i=r(26991),a=r(73850),l=r(68425),c=r(47734),d=r(73697),u=r(23508),m=r(77568),p=r(20467);function h(e){let{data:t,metric:r="tokens",scale:o="lin"}=e,s=t.map(e=>{let t=e[r];return{...e,label:e.day.slice(5),value:"log"===o&&t<=0?1:t,raw:t}}),h="cost"===r?"#00ffab":"#00f5ff";return(0,n.jsx)("div",{className:"h-64 -mx-1",children:(0,n.jsx)(i.u,{width:"100%",height:"100%",children:(0,n.jsxs)(a.Q,{data:s,margin:{top:8,right:8,bottom:0,left:-8},children:[(0,n.jsx)("defs",{children:(0,n.jsxs)("linearGradient",{id:"grad-".concat(r),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:h,stopOpacity:.35}),(0,n.jsx)("stop",{offset:"100%",stopColor:h,stopOpacity:0})]})}),(0,n.jsx)(l.d,{stroke:"#262a31",strokeDasharray:"2 4",vertical:!1}),(0,n.jsx)(c.W,{dataKey:"label",tick:{fill:"#849495",fontSize:11,fontFamily:"JetBrains Mono"},axisLine:{stroke:"#262a31"},tickLine:!1,minTickGap:48}),(0,n.jsx)(d.h,{scale:"log"===o?"log":"auto",domain:"log"===o?[1,"auto"]:["auto","auto"],allowDataOverflow:!0,tick:{fill:"#849495",fontSize:11,fontFamily:"JetBrains Mono"},axisLine:!1,tickLine:!1,tickFormatter:e=>"cost"===r?"$".concat(Math.round(e)):(0,p.yj)(e)}),(0,n.jsx)(u.m,{cursor:{stroke:h,strokeOpacity:.3},contentStyle:{background:"#181c22",border:"1px solid ".concat(h),borderRadius:6,fontSize:12,color:"#dfe2eb"},formatter:(e,t,n)=>{var o,s;let i=null!=(s=null==n||null==(o=n.payload)?void 0:o.raw)?s:0;return"tokens"===r?[(0,p.yj)(i),"tokens"]:"sessions"===r?[i.toString(),"sessions"]:["$".concat(i.toFixed(2)),"cost"]},labelFormatter:e=>"Day ".concat(e)}),(0,n.jsx)(m.G,{type:"monotone",dataKey:"value",stroke:h,strokeWidth:2,fill:"url(#grad-".concat(r,")"),isAnimationActive:!1})]})})})}function x(e){let{data:t,label:r="last 30 days",metric:i,scale:a}=e,l=(0,s.useRouter)(),c=(0,s.usePathname)(),d=(0,s.useSearchParams)(),u=(0,o.useMemo)(()=>!function(e,t){let r=e.map(e=>e[t]).filter(e=>e>0);if(r.length<5)return!1;let n=[...r].sort((e,t)=>e-t);return n[n.length-1]/Math.max(n[Math.max(0,Math.floor(.1*r.length)-1)],1)>50}(t,i)?"lin":"log",[t,i]),m=null!=a?a:u,p=(e,t,r)=>{let n=new URLSearchParams(d.toString());null===t||t===r?n.delete(e):n.set(e,t);let o=n.toString();l.push(o?"".concat(c,"?").concat(o):c,{scroll:!1})};return(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,n.jsxs)("span",{children:["Usage — ",r]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 normal-case tracking-normal",children:[(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:[{id:"tokens",label:"Tokens"},{id:"sessions",label:"Sessions"},{id:"cost",label:"Est. Cost"}].map(e=>(0,n.jsx)("button",{onClick:()=>p("metric",e.id,"tokens"),className:"px-2 py-0.5 text-[11px] rounded transition-colors font-mono ".concat(i===e.id?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim"),children:e.label},e.id))}),(0,n.jsx)("div",{className:"w-px h-4 bg-surface-3"}),(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:["lin","log"].map(e=>(0,n.jsxs)("button",{onClick:()=>p("scale",e,u),className:"px-1.5 py-0.5 text-[10px] rounded transition-colors font-mono uppercase relative ".concat(m===e?"bg-secondary/15 text-secondary":"text-ink-mute hover:text-ink-dim"),title:"log"===e?"Logarithmic scale — better when one day dwarfs the rest":"Linear scale",children:[e,null===a&&u===e&&(0,n.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-secondary",title:"auto-selected based on data range"})]},e))})]})]}),(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(h,{data:t,metric:i,scale:m})})]})}},30926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{callServer:function(){return n.callServer},createServerReference:function(){return s.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}});let n=r(41209),o=r(85153),s=r(77197)},34077:(e,t,r)=>{"use strict";r.d(t,{FreshnessIndicator:()=>i});var n=r(95155),o=r(12115),s=r(20063);function i(e){let{lastIngestedAt:t}=e,[,r]=(0,o.useState)(0),[i,c]=(0,o.useState)(!1),[d,u]=(0,o.useTransition)(),m=(0,s.useRouter)();(0,o.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),5e3);return()=>clearInterval(e)},[]);let p=0===t?"never scanned":"updated ".concat(function(e){let t=Date.now()-e;return t<1e3?"just now":t<6e4?"".concat(l(Math.round(t/1e3)),"s"):t<36e5?"".concat(l(Math.round(t/6e4)),"m"):"".concat(l(Math.round(t/36e5)),"h")}(t)," ago"),h=0===t,x=i||d;return(0,n.jsxs)("button",{type:"button",onClick:function(){u(()=>m.refresh())},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),disabled:h||d,title:"Re-scan local sessions and refresh",style:{width:"128px"},className:"text-[11px] font-mono tabular px-2 py-0.5 rounded transition-colors text-ink-mute hover:text-primary hover:bg-surface-2 focus-visible:text-primary focus-visible:bg-surface-2 outline-none disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-ink-mute disabled:cursor-not-allowed grid items-center",children:[(0,n.jsx)("span",{className:"col-start-1 row-start-1 transition-opacity flex items-center justify-center gap-1.5 whitespace-nowrap",style:{opacity:+!x},children:p}),(0,n.jsxs)("span",{"aria-hidden":!0,className:"col-start-1 row-start-1 transition-opacity flex items-center justify-center gap-1.5 whitespace-nowrap",style:{opacity:+!!x},children:[(0,n.jsx)(a,{spinning:d}),(0,n.jsx)("span",{children:"refresh"})]})]})}function a(e){let{spinning:t}=e;return(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:t?"animate-spin":"",children:[(0,n.jsx)("path",{d:"M3 12a9 9 0 0 1 15.5-6.4L21 8"}),(0,n.jsx)("path",{d:"M21 3v5h-5"}),(0,n.jsx)("path",{d:"M21 12a9 9 0 0 1-15.5 6.4L3 16"}),(0,n.jsx)("path",{d:"M3 21v-5h5"})]})}function l(e){return e<10?"0".concat(e):String(e)}},40250:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,52619,23)),Promise.resolve().then(r.bind(r,15433)),Promise.resolve().then(r.bind(r,34077)),Promise.resolve().then(r.bind(r,74050)),Promise.resolve().then(r.bind(r,61438)),Promise.resolve().then(r.bind(r,95925)),Promise.resolve().then(r.bind(r,17834)),Promise.resolve().then(r.bind(r,29366))},61438:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>a});var n=r(95155),o=r(20063),s=r(12115),i=r(47650);function a(e){var t,r;let{projects:a,current:l}=e,c=(0,o.useRouter)(),d=(0,o.usePathname)(),u=(0,o.useSearchParams)(),[m,p]=(0,s.useState)(!1),[h,x]=(0,s.useTransition)(),[f,y]=(0,s.useState)(!1),[v,g]=(0,s.useState)(null),b=(0,s.useRef)(null);(0,s.useEffect)(()=>y(!0),[]);let k=e=>{let t=new URLSearchParams(u.toString());e?t.set("project",e):t.delete("project");let r=t.toString();p(!1),x(()=>c.push(r?"".concat(d,"?").concat(r):d,{scroll:!1}))},j=l?null!=(r=null==(t=a.find(e=>e.id===l))?void 0:t.name)?r:"project":null;return(0,s.useEffect)(()=>{if(!m)return;let e=e=>{var t;let r=e.target;if(null==(t=b.current)?void 0:t.contains(r))return;let n=document.getElementById("project-filter-pop");null!=n&&n.contains(r)||p(!1)},t=e=>{"Escape"===e.key&&p(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[m]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:b,onClick:()=>{if(!m&&b.current){let e=b.current.getBoundingClientRect();g({top:e.bottom+6,left:e.left,width:Math.max(e.width,220)})}p(e=>!e)},className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors flex items-center gap-1.5 ".concat(l?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim hover:bg-surface-2"," ").concat(h?"opacity-60":""),title:"Filter by project",children:[(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),(0,n.jsx)("span",{className:"truncate max-w-[140px]",children:null!=j?j:"All projects"}),(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform ".concat(m?"rotate-180":""),children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),f&&m&&v&&(0,i.createPortal)((0,n.jsxs)("div",{id:"project-filter-pop",style:{position:"fixed",top:v.top,left:v.left,minWidth:v.width,backgroundColor:"#1c2026",zIndex:100,isolation:"isolate"},className:"border border-surface-3 rounded-md shadow-xl overflow-hidden text-[12px] font-mono max-h-[60vh] overflow-y-auto",children:[(0,n.jsx)("button",{onClick:()=>k(null),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 ".concat(l?"text-ink-dim":"text-primary bg-primary/10"),children:"All projects"}),(0,n.jsx)("div",{className:"h-px bg-surface-3"}),a.map(e=>(0,n.jsx)("button",{onClick:()=>k(e.id),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 truncate ".concat(l===e.id?"text-primary bg-primary/10":"text-ink-dim"),title:e.name,children:e.name},e.id)),0===a.length&&(0,n.jsx)("div",{className:"px-3 py-2 text-ink-mute",children:"No projects yet."})]}),document.body)]})}},74050:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>a});var n=r(95155),o=r(20063),s=r(12115),i=r(47650);function a(e){let{families:t,current:r}=e,a=(0,o.useRouter)(),l=(0,o.usePathname)(),c=(0,o.useSearchParams)(),[d,u]=(0,s.useState)(!1),[m,p]=(0,s.useTransition)(),[h,x]=(0,s.useState)(!1),[f,y]=(0,s.useState)(null),v=(0,s.useRef)(null);(0,s.useEffect)(()=>x(!0),[]);let g=e=>{let t=new URLSearchParams(c.toString());e?t.set("model",e):t.delete("model");let r=t.toString();u(!1),p(()=>a.push(r?"".concat(l,"?").concat(r):l,{scroll:!1}))};return(0,s.useEffect)(()=>{if(!d)return;let e=e=>{var t;let r=e.target;if(null==(t=v.current)?void 0:t.contains(r))return;let n=document.getElementById("model-filter-pop");null!=n&&n.contains(r)||u(!1)},t=e=>{"Escape"===e.key&&u(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[d]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:v,onClick:()=>{if(!d&&v.current){let e=v.current.getBoundingClientRect();y({top:e.bottom+6,left:e.left,width:Math.max(e.width,200)})}u(e=>!e)},className:"text-[11px] font-mono px-2 py-0.5 rounded transition-colors flex items-center gap-1.5 ".concat(r?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim hover:bg-surface-2"," ").concat(m?"opacity-60":""),title:"Filter by model",children:[(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,n.jsx)("path",{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),(0,n.jsx)("span",{className:"truncate max-w-[140px]",children:null!=r?r:"All models"}),(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform ".concat(d?"rotate-180":""),children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),h&&d&&f&&(0,i.createPortal)((0,n.jsxs)("div",{id:"model-filter-pop",style:{position:"fixed",top:f.top,left:f.left,minWidth:f.width,backgroundColor:"#1c2026",zIndex:100,isolation:"isolate"},className:"border border-surface-3 rounded-md shadow-xl overflow-hidden text-[12px] font-mono max-h-[60vh] overflow-y-auto",children:[(0,n.jsx)("button",{onClick:()=>g(null),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 ".concat(r?"text-ink-dim":"text-primary bg-primary/10"),children:"All models"}),(0,n.jsx)("div",{className:"h-px bg-surface-3"}),t.map(e=>(0,n.jsxs)("button",{onClick:()=>g(e.family),className:"w-full text-left px-3 py-2 transition-colors hover:bg-surface-2 flex items-center justify-between gap-3 ".concat(r===e.family?"text-primary bg-primary/10":"text-ink-dim"),title:e.family,children:[(0,n.jsx)("span",{className:"truncate",children:e.family}),(0,n.jsx)("span",{className:"text-ink-mute text-[10px] tabular",children:e.sessions})]},e.family)),0===t.length&&(0,n.jsx)("div",{className:"px-3 py-2 text-ink-mute",children:"No models seen yet."})]}),document.body)]})}},95925:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>a});var n=r(95155),o=r(20063),s=r(12115);let i=[{key:"7d",label:"Last 7 days",days:7},{key:"30d",label:"Last 30 days",days:30},{key:"90d",label:"Last 90 days",days:90},{key:"all",label:"All time",days:null}];function a(e){let{current:t}=e,r=(0,o.useRouter)(),a=(0,o.usePathname)(),l=(0,o.useSearchParams)(),[c,d]=(0,s.useTransition)();return(0,n.jsx)("div",{className:"flex items-center gap-0.5 normal-case tracking-normal transition-opacity ".concat(c?"opacity-50":""),children:i.map(e=>(0,n.jsx)("button",{onClick:()=>(e=>{let t=new URLSearchParams(l.toString());"30d"===e?t.delete("range"):t.set("range",e);let n=t.toString();d(()=>{r.push(n?"".concat(a,"?").concat(n):a)})})(e.key),className:"px-2 py-0.5 text-[11px] rounded transition-colors font-mono ".concat(t===e.key?"bg-primary/15 text-primary":"text-ink-mute hover:text-ink-dim"),children:"all"===e.key?"All":e.key},e.key))})}},96674:(e,t,r)=>{"use strict";r.d(t,{v:()=>o});var n=r(30926);let o=(0,n.createServerReference)("4086085619f2eb1832f13de02c11c03744ae709f78",n.callServer,void 0,n.findSourceMapURL,"classifyAction")}},e=>{e.O(0,[619,997,441,255,358],()=>e(e.s=40250)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[824],{17834:(e,t,n)=>{"use strict";n.d(t,{ShareButton:()=>o});var r=n(95155),i=n(12115);function o(e){let{imageUrl:t,className:n}=e,[o,l]=(0,i.useState)("idle"),[d,u]=(0,i.useState)(null),h=async()=>{l("busy"),u(null);try{var e;let n=await fetch(t);if(!n.ok)throw Error("HTTP ".concat(n.status));let r=await n.blob();if("undefined"==typeof ClipboardItem||!(null==(e=navigator.clipboard)?void 0:e.write))throw Error("clipboard image unsupported");let i=new ClipboardItem({"image/png":r});await navigator.clipboard.write([i]),l("done"),setTimeout(()=>l("idle"),2400)}catch(e){try{let e=await fetch(t),n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download="agentgraphed-stats.png",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),5e3),u("Saved to Downloads (clipboard image unsupported)"),l("err"),setTimeout(()=>l("idle"),4e3)}catch(t){u(t.message||e.message),l("err"),setTimeout(()=>l("idle"),3e3)}}};return(0,r.jsx)("button",{onClick:h,disabled:"busy"===o,"aria-label":"Share",title:"busy"===o?"Generating image…":"done"===o?"Image copied to clipboard":"err"===o?null!=d?d:"Try again":"Copy share image to clipboard",className:"btn-icon ".concat("done"===o?"text-secondary":""," ").concat(null!=n?n:""),children:"busy"===o?(0,r.jsx)(c,{}):"done"===o?(0,r.jsx)(s,{}):(0,r.jsx)(a,{})})}function a(){return(0,r.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),(0,r.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,r.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]})}function s(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function c(){return(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin",children:(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}},30926:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{callServer:function(){return r.callServer},createServerReference:function(){return o.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}});let r=n(41209),i=n(85153),o=n(77197)},40040:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,52619,23)),Promise.resolve().then(n.bind(n,44782)),Promise.resolve().then(n.bind(n,42158)),Promise.resolve().then(n.bind(n,17834))},42158:(e,t,n)=>{"use strict";n.d(t,{SessionActions:()=>l});var r=n(95155),i=n(12115),o=n(52619),a=n.n(o),s=n(30926);let c=(0,s.createServerReference)("4020868856f89c0984ab10caafdcdbed52da540a68",s.callServer,void 0,s.findSourceMapURL,"generateContextAction");function l(e){let{sessionId:t,hasLlmKey:n,cachedContext:o}=e,[s,l]=(0,i.useState)(o),[d,u]=(0,i.useState)(!1),[h,x]=(0,i.useState)(null),[m,p]=(0,i.useState)(null),[f,b]=(0,i.useTransition)();return(0,r.jsxs)("div",{className:"flex items-center gap-2 relative",children:[(0,r.jsx)("button",{onClick:()=>{x(null),b(async()=>{if(s){await navigator.clipboard.writeText(s),u(!0),setTimeout(()=>u(!1),1800);return}let e=await c(t);if(!e.ok)return void x(e.error);l(e.context),p(e.costUsd),await navigator.clipboard.writeText(e.context),u(!0),setTimeout(()=>u(!1),1800)})},disabled:!n||f,title:n?"Summarize this session so you can paste it into a fresh chat":"Add an API key in Settings to enable",className:"btn ".concat(n?"btn-primary":""," disabled:opacity-50 disabled:cursor-not-allowed"),children:f?"… summarizing":d?"✓ Copied":s?"Copy summary":"Summarize for new chat"}),(h||null!==m&&m>0||!n)&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-2 text-[11px] text-ink-mute flex items-center gap-2 whitespace-nowrap",children:[h&&(0,r.jsx)("span",{className:"text-error",children:h}),null!==m&&m>0&&(0,r.jsxs)("span",{className:"font-mono",children:["cost $",m.toFixed(4)]}),!n&&(0,r.jsxs)("span",{children:["summary needs ",(0,r.jsx)(a(),{href:"/settings",className:"text-primary hover:underline",children:"an API key"})]})]})]})}},44782:(e,t,n)=>{"use strict";n.d(t,{ResumePanel:()=>o});var r=n(95155),i=n(12115);function o(e){let{provider:t,cwd:n,sessionId:o}=e,[c,l]=(0,i.useState)(!1),d=function(e,t,n){let r='cd "'.concat(t,'"');return"claude"===e?"".concat(r," && claude --resume ").concat(n):"codex"===e?"".concat(r," && codex resume ").concat(n):r}(t,n,o),u=async()=>{await navigator.clipboard.writeText(d),l(!0),setTimeout(()=>l(!1),2e3)};return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,r.jsx)("span",{children:"Resume in your terminal"}),(0,r.jsxs)("span",{className:"normal-case tracking-normal font-normal text-ink-mute text-[11px]",children:["paste into ","claude"===t?"Claude Code":"codex"===t?"Codex CLI":t]})]}),(0,r.jsxs)("div",{className:"p-3 flex items-stretch gap-2",children:[(0,r.jsx)("code",{className:"flex-1 bg-canvas border border-surface-3 rounded px-3 py-2 font-mono text-code-sm text-ink-dim overflow-x-auto whitespace-nowrap leading-relaxed",title:d,children:d}),(0,r.jsx)("button",{onClick:u,className:"btn ".concat(c?"text-secondary":""," flex-shrink-0"),title:"Copy command to clipboard",children:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s,{}),(0,r.jsx)("span",{children:"Copied"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a,{}),(0,r.jsx)("span",{children:"Copy"})]})})]})]})}function a(){return(0,r.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function s(){return(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}}},e=>{e.O(0,[619,441,255,358],()=>e(e.s=40040)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{11957:(e,s,a)=>{"use strict";a.d(s,{LlmSection:()=>b});var t=a(95155),r=a(12115),n=a(30926);let i=(0,n.createServerReference)("40ef48e61358f0dcac4e4e14d67c2b519e4d7d0d5d",n.callServer,void 0,n.findSourceMapURL,"saveLlmAction"),o=(0,n.createServerReference)("40b08008dfa140fd4de90f9fc68735e9365a5b0af4",n.callServer,void 0,n.findSourceMapURL,"setAutoClassifyAction"),l=(0,n.createServerReference)("40d14b4547c8964e38fc79fc8a73a1cc677e6a0bd8",n.callServer,void 0,n.findSourceMapURL,"clearKeyAction"),c=(0,n.createServerReference)("4006197c7f39df910cea8635c5c22d0f12c7c42f35",n.callServer,void 0,n.findSourceMapURL,"estimateAction");var d=a(96674);let m=[{id:"claude-haiku-4-5",label:"Claude Haiku 4.5 (cheapest)",provider:"anthropic",input:1,output:5},{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6 (smarter)",provider:"anthropic",input:3,output:15},{id:"gpt-5-mini",label:"GPT-5 Mini (cheapest)",provider:"openai",input:.5,output:2},{id:"gpt-4o-mini",label:"GPT-4o Mini (very cheap)",provider:"openai",input:.15,output:.6},{id:"gpt-5",label:"GPT-5 (smarter)",provider:"openai",input:2.5,output:10}];function p(e){return m.filter(s=>s.provider===e)}function u(e){return"openai"===e?"gpt-5-mini":"claude-haiku-4-5"}let x=e=>e?e.slice(0,8)+"…"+e.slice(-4):"";function b(e){let{provider:s,anthKey:a,oaiKey:n,classifierModel:m,summarizerModel:b,classified:f,total:h,autoClassify:v}=e,[y,k]=(0,r.useState)(s),[j,N]=(0,r.useState)(m),[g,w]=(0,r.useState)(null),[S,C]=(0,r.useState)(v),[L,R]=(0,r.useState)({kind:"idle"}),[U,A]=(0,r.useTransition)(),M=("openai"===y?n:a).length>0,_=p(y),O=_.some(e=>e.id===j)?j:u(y),P=e=>{R({kind:"idle"}),A(async()=>{let s=await c(e);s.ok?R({kind:"estimate",totalUsd:s.totalUsd,rowCount:s.rowCount,modelLabel:s.modelLabel,scope:e}):R({kind:"error",message:s.error})})};return(0,t.jsxs)("div",{className:"card",children:[(0,t.jsxs)("div",{className:"card-header flex items-center justify-between",children:[(0,t.jsx)("span",{children:"LLM provider"}),(0,t.jsxs)("span",{className:"normal-case tracking-normal text-ink-mute text-[11px] font-mono",children:[f,"/",h," sessions classified"]})]}),(0,t.jsxs)("form",{action:e=>{A(async()=>{await i(e),w(Date.now()),setTimeout(()=>w(null),2e3)})},className:"p-5 space-y-4 text-body-md",children:[(0,t.jsxs)("p",{className:"text-ink-dim text-body-sm",children:["Optional. Used to auto-title and categorize sessions, and to generate context primers when you click ",(0,t.jsx)("em",{children:"Copy context"})," on a session. Skip this and titles stay as the raw first prompt."]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-label-caps text-ink-mute block",children:"Provider"}),(0,t.jsxs)("select",{name:"provider",value:y,onChange:e=>{var s;k(s=e.target.value),p(s).some(e=>e.id===j)||N(u(s))},className:"bg-surface-1 border border-surface-3 rounded px-2 h-9 text-body-md w-full",children:[(0,t.jsx)("option",{value:"anthropic",children:"Anthropic"}),(0,t.jsx)("option",{value:"openai",children:"OpenAI"})]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-label-caps text-ink-mute block",children:"Model"}),(0,t.jsx)("select",{name:"classifier_model",value:O,onChange:e=>N(e.target.value),className:"bg-surface-1 border border-surface-3 rounded px-2 h-9 text-body-md font-mono w-full",children:_.map(e=>(0,t.jsx)("option",{value:e.id,children:e.label},e.id))})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"text-label-caps text-ink-mute block flex items-center justify-between",children:["Anthropic key",a&&(0,t.jsx)("button",{type:"button",onClick:()=>A(()=>l("anthropic")),className:"normal-case tracking-normal text-[10px] text-ink-mute hover:text-error",children:"clear"})]}),(0,t.jsx)("input",{type:"password",name:"anthropic_key",placeholder:x(a)||"sk-ant-…",className:"bg-surface-1 border border-surface-3 rounded px-3 h-9 text-body-md font-mono w-full focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("label",{className:"text-label-caps text-ink-mute block flex items-center justify-between",children:["OpenAI key",n&&(0,t.jsx)("button",{type:"button",onClick:()=>A(()=>l("openai")),className:"normal-case tracking-normal text-[10px] text-ink-mute hover:text-error",children:"clear"})]}),(0,t.jsx)("input",{type:"password",name:"openai_key",placeholder:x(n)||"sk-…",className:"bg-surface-1 border border-surface-3 rounded px-3 h-9 text-body-md font-mono w-full focus:outline-none focus:border-primary"})]})]}),(0,t.jsxs)("p",{className:"text-[11px] text-ink-mute leading-relaxed",children:["Keys are stored in plaintext in your local SQLite file — same threat model as"," ",(0,t.jsx)("span",{className:"font-mono",children:"~/.aws/credentials"})," or a ",(0,t.jsx)("span",{className:"font-mono",children:".env"}),". Never sent over the network. Any process that can read your home folder can read them."]}),(0,t.jsx)("input",{type:"hidden",name:"summarizer_model",value:b}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{className:"btn btn-primary",type:"submit",disabled:U,children:U?"Saving…":"Save"}),g&&(0,t.jsx)("span",{className:"text-body-sm text-secondary",children:"✓ saved"})]})]}),(0,t.jsxs)("div",{className:"px-5 pb-5 border-t border-surface-2 pt-4 space-y-3",children:[(0,t.jsxs)("label",{className:"flex items-start gap-3 text-body-sm ".concat(M?"cursor-pointer":"opacity-60 cursor-not-allowed"),children:[(0,t.jsx)("input",{type:"checkbox",checked:S,onChange:e=>{var s;C(s=e.target.checked),A(async()=>{await o(s)})},disabled:!M||U,className:"mt-1 accent-primary"}),(0,t.jsxs)("span",{className:"text-ink-dim",children:[(0,t.jsx)("span",{className:"text-ink font-medium",children:"Automatically classify new sessions"}),(0,t.jsx)("span",{className:"block text-ink-mute text-[11px] mt-0.5",children:"When a background scan finds unclassified sessions, batch them through the classifier. Costs ~$0.0001 per session."})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("button",{type:"button",disabled:!M||U,onClick:()=>P("uncategorized"),className:"btn disabled:opacity-50 disabled:cursor-not-allowed",children:"Classify uncategorized"}),(0,t.jsx)("button",{type:"button",disabled:!M||U,onClick:()=>P("all"),className:"btn disabled:opacity-50 disabled:cursor-not-allowed",children:"Re-classify all"}),!M&&(0,t.jsx)("span",{className:"text-body-sm text-ink-mute",children:"Save a key above to enable."})]}),"estimate"===L.kind&&(0,t.jsxs)("div",{className:"border border-primary/40 bg-primary/5 rounded p-3 text-body-sm",children:[(0,t.jsx)("div",{className:"text-ink mb-2",children:0===L.rowCount?"Nothing to classify.":(0,t.jsxs)(t.Fragment,{children:["About to classify ",(0,t.jsx)("span",{className:"font-mono text-primary",children:L.rowCount})," ","sessions with ",L.modelLabel," for an estimated"," ",(0,t.jsxs)("span",{className:"font-mono text-primary",children:["$",L.totalUsd.toFixed(4)]}),"."]})}),L.rowCount>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{var e;return e=L.scope,void A(async()=>{let s=await (0,d.v)(e);s.ok?R({kind:"done",classified:s.classified,costUsd:s.costUsd,warning:s.warning}):R({kind:"error",message:s.error})})},className:"btn btn-primary",disabled:U,children:U?"Classifying…":"Confirm"}),(0,t.jsx)("button",{type:"button",onClick:()=>R({kind:"idle"}),className:"btn",disabled:U,children:"Cancel"})]})]}),"done"===L.kind&&(0,t.jsxs)("div",{className:"border border-secondary/40 bg-secondary/5 rounded p-3 text-body-sm text-ink space-y-1",children:[(0,t.jsxs)("div",{children:["✓ Classified ",(0,t.jsx)("span",{className:"font-mono text-secondary",children:L.classified})," ","sessions for ",(0,t.jsxs)("span",{className:"font-mono",children:["$",L.costUsd.toFixed(4)]}),"."]}),L.warning&&(0,t.jsxs)("div",{className:"text-error text-[11px] border-l-2 border-error pl-2 font-mono break-words",children:["Warning: ",L.warning]})]}),"error"===L.kind&&(0,t.jsx)("div",{className:"text-body-sm text-error border-l-2 border-error pl-3",children:L.message})]})]})}},30926:(e,s,a)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),!function(e,s){for(var a in s)Object.defineProperty(e,a,{enumerable:!0,get:s[a]})}(s,{callServer:function(){return t.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return r.findSourceMapURL}});let t=a(41209),r=a(85153),n=a(77197)},66821:(e,s,a)=>{Promise.resolve().then(a.bind(a,11957))},96674:(e,s,a)=>{"use strict";a.d(s,{v:()=>r});var t=a(30926);let r=(0,t.createServerReference)("4086085619f2eb1832f13de02c11c03744ae709f78",t.callServer,void 0,t.findSourceMapURL,"classifyAction")}},e=>{e.O(0,[441,255,358],()=>e(e.s=66821)),_N_E=e.O()}]);
|
|
Binary file
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const util = require('./util');
|
|
5
|
-
const SqliteError = require('./sqlite-error');
|
|
6
|
-
|
|
7
|
-
let DEFAULT_ADDON;
|
|
8
|
-
|
|
9
|
-
function Database(filenameGiven, options) {
|
|
10
|
-
if (new.target == null) {
|
|
11
|
-
return new Database(filenameGiven, options);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Apply defaults
|
|
15
|
-
let buffer;
|
|
16
|
-
if (Buffer.isBuffer(filenameGiven)) {
|
|
17
|
-
buffer = filenameGiven;
|
|
18
|
-
filenameGiven = ':memory:';
|
|
19
|
-
}
|
|
20
|
-
if (filenameGiven == null) filenameGiven = '';
|
|
21
|
-
if (options == null) options = {};
|
|
22
|
-
|
|
23
|
-
// Validate arguments
|
|
24
|
-
if (typeof filenameGiven !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
25
|
-
if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
|
|
26
|
-
if ('readOnly' in options) throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
27
|
-
if ('memory' in options) throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
28
|
-
|
|
29
|
-
// Interpret options
|
|
30
|
-
const filename = filenameGiven.trim();
|
|
31
|
-
const anonymous = filename === '' || filename === ':memory:';
|
|
32
|
-
const readonly = util.getBooleanOption(options, 'readonly');
|
|
33
|
-
const fileMustExist = util.getBooleanOption(options, 'fileMustExist');
|
|
34
|
-
const timeout = 'timeout' in options ? options.timeout : 5000;
|
|
35
|
-
const verbose = 'verbose' in options ? options.verbose : null;
|
|
36
|
-
const nativeBinding = 'nativeBinding' in options ? options.nativeBinding : null;
|
|
37
|
-
|
|
38
|
-
// Validate interpreted options
|
|
39
|
-
if (readonly && anonymous && !buffer) throw new TypeError('In-memory/temporary databases cannot be readonly');
|
|
40
|
-
if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
41
|
-
if (timeout > 0x7fffffff) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
42
|
-
if (verbose != null && typeof verbose !== 'function') throw new TypeError('Expected the "verbose" option to be a function');
|
|
43
|
-
if (nativeBinding != null && typeof nativeBinding !== 'string' && typeof nativeBinding !== 'object') throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
44
|
-
|
|
45
|
-
// Load the native addon
|
|
46
|
-
let addon;
|
|
47
|
-
if (nativeBinding == null) {
|
|
48
|
-
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require('bindings')('better_sqlite3.node'));
|
|
49
|
-
} else if (typeof nativeBinding === 'string') {
|
|
50
|
-
// See <https://webpack.js.org/api/module-variables/#__non_webpack_require__-webpack-specific>
|
|
51
|
-
const requireFunc = typeof __non_webpack_require__ === 'function' ? __non_webpack_require__ : require;
|
|
52
|
-
addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, '.node'));
|
|
53
|
-
} else {
|
|
54
|
-
// See <https://github.com/WiseLibs/better-sqlite3/issues/972>
|
|
55
|
-
addon = nativeBinding;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!addon.isInitialized) {
|
|
59
|
-
addon.setErrorConstructor(SqliteError);
|
|
60
|
-
addon.isInitialized = true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Make sure the specified directory exists
|
|
64
|
-
if (!anonymous && !fs.existsSync(path.dirname(filename))) {
|
|
65
|
-
throw new TypeError('Cannot open database because the directory does not exist');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Object.defineProperties(this, {
|
|
69
|
-
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
70
|
-
...wrappers.getters,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const wrappers = require('./methods/wrappers');
|
|
75
|
-
Database.prototype.prepare = wrappers.prepare;
|
|
76
|
-
Database.prototype.transaction = require('./methods/transaction');
|
|
77
|
-
Database.prototype.pragma = require('./methods/pragma');
|
|
78
|
-
Database.prototype.backup = require('./methods/backup');
|
|
79
|
-
Database.prototype.serialize = require('./methods/serialize');
|
|
80
|
-
Database.prototype.function = require('./methods/function');
|
|
81
|
-
Database.prototype.aggregate = require('./methods/aggregate');
|
|
82
|
-
Database.prototype.table = require('./methods/table');
|
|
83
|
-
Database.prototype.loadExtension = wrappers.loadExtension;
|
|
84
|
-
Database.prototype.exec = wrappers.exec;
|
|
85
|
-
Database.prototype.close = wrappers.close;
|
|
86
|
-
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
87
|
-
Database.prototype.unsafeMode = wrappers.unsafeMode;
|
|
88
|
-
Database.prototype[util.inspect] = require('./methods/inspect');
|
|
89
|
-
|
|
90
|
-
module.exports = Database;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { getBooleanOption, cppdb } = require('../util');
|
|
3
|
-
|
|
4
|
-
module.exports = function defineAggregate(name, options) {
|
|
5
|
-
// Validate arguments
|
|
6
|
-
if (typeof name !== 'string') throw new TypeError('Expected first argument to be a string');
|
|
7
|
-
if (typeof options !== 'object' || options === null) throw new TypeError('Expected second argument to be an options object');
|
|
8
|
-
if (!name) throw new TypeError('User-defined function name cannot be an empty string');
|
|
9
|
-
|
|
10
|
-
// Interpret options
|
|
11
|
-
const start = 'start' in options ? options.start : null;
|
|
12
|
-
const step = getFunctionOption(options, 'step', true);
|
|
13
|
-
const inverse = getFunctionOption(options, 'inverse', false);
|
|
14
|
-
const result = getFunctionOption(options, 'result', false);
|
|
15
|
-
const safeIntegers = 'safeIntegers' in options ? +getBooleanOption(options, 'safeIntegers') : 2;
|
|
16
|
-
const deterministic = getBooleanOption(options, 'deterministic');
|
|
17
|
-
const directOnly = getBooleanOption(options, 'directOnly');
|
|
18
|
-
const varargs = getBooleanOption(options, 'varargs');
|
|
19
|
-
let argCount = -1;
|
|
20
|
-
|
|
21
|
-
// Determine argument count
|
|
22
|
-
if (!varargs) {
|
|
23
|
-
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
24
|
-
if (argCount > 0) argCount -= 1;
|
|
25
|
-
if (argCount > 100) throw new RangeError('User-defined functions cannot have more than 100 arguments');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
29
|
-
return this;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getFunctionOption = (options, key, required) => {
|
|
33
|
-
const value = key in options ? options[key] : null;
|
|
34
|
-
if (typeof value === 'function') return value;
|
|
35
|
-
if (value != null) throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
36
|
-
if (required) throw new TypeError(`Missing required option "${key}"`);
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const getLength = ({ length }) => {
|
|
41
|
-
if (Number.isInteger(length) && length >= 0) return length;
|
|
42
|
-
throw new TypeError('Expected function.length to be a positive integer');
|
|
43
|
-
};
|