@savecontext/dashboard 0.1.22 → 0.1.24
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/dashboard/.next/BUILD_ID +1 -1
- package/.next/standalone/dashboard/.next/app-path-routes-manifest.json +22 -22
- package/.next/standalone/dashboard/.next/build-manifest.json +2 -2
- package/.next/standalone/dashboard/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.html +17 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/checkpoints/[id]/items/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/checkpoints/[id]/items/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/checkpoints/[id]/items/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/context/delete/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/context/delete/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/context/delete/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/context/update/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/context/update/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/context/update/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/create/route.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/api/issues/create/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/create/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/delete/route.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/api/issues/delete/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/delete/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/list/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/list/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/list/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/subtasks/route.js +4 -4
- package/.next/standalone/dashboard/.next/server/app/api/issues/subtasks/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/subtasks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/update/route.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/api/issues/update/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/issues/update/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/delete/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/delete/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/delete/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/list/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/list/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/list/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/save/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/save/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/memory/save/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/[id]/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/[id]/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/create/route.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/api/plans/create/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/create/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/delete/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/delete/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/delete/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/list/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/list/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/list/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/update/route.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/api/plans/update/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/plans/update/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/projects/[id]/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/projects/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/projects/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/projects/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/stats/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/stats/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/stats/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/status/route.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/status/route.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/api/sessions/[id]/status/route_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/checkpoints/[id]/page.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/checkpoints/[id]/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/checkpoints/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/checkpoints/page.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/dashboard/checkpoints/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/checkpoints/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/issues/page.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/issues/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/issues/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/memory/page.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/dashboard/memory/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/memory/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/page.js +3 -3
- package/.next/standalone/dashboard/.next/server/app/dashboard/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/plans/page.js +2 -2
- package/.next/standalone/dashboard/.next/server/app/dashboard/plans/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/plans/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/sessions/[id]/page.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/sessions/[id]/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/sessions/page.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/sessions/page.js.nft.json +1 -1
- package/.next/standalone/dashboard/.next/server/app/dashboard/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/dashboard/.next/server/app-paths-manifest.json +22 -22
- package/.next/standalone/dashboard/.next/server/chunks/848.js +1 -1
- package/.next/standalone/dashboard/.next/server/pages/404.html +17 -1
- package/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/.next/standalone/dashboard/.next/static/chunks/{3358-27a1941db2941343.js → 3358-be1dcb412e5a5840.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/{5602-66df072f21a844c9.js → 5602-de6be5d495e39d30.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/{6736-41f13829c40765d8.js → 6736-2e5d92a3f8a9a938.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/checkpoints/{page-4b30b30c441a24c8.js → page-69c93b249f9f09f9.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/issues/page-b176cdca78e8145d.js +1 -0
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/memory/{page-5b92aff45809fc6f.js → page-ffbe55f2b5b3a1a4.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/{page-8403ee5d448ed5a7.js → page-e7dfa69451ac3cf4.js} +2 -2
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/plans/{page-5203a84d31f5998c.js → page-aa014387d68c52ed.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/sessions/[id]/{page-094d2405b39c79d3.js → page-1acf5db28461761f.js} +1 -1
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/sessions/page-bce106da597ef37a.js +1 -0
- package/.next/standalone/dashboard/package.json +8 -9
- package/.next/standalone/package.json +1 -1
- package/README.md +3 -5
- package/bin/savecontext-dashboard.js +6 -5
- package/package.json +8 -9
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/issues/page-8595961148b9e336.js +0 -1
- package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/sessions/page-a6e839598a743003.js +0 -1
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/database.js +0 -90
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/index.js +0 -3
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/lib/util.js +0 -12
- package/.next/standalone/node_modules/.pnpm/better-sqlite3@12.5.0/node_modules/better-sqlite3/package.json +0 -59
- package/.next/standalone/node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js +0 -221
- package/.next/standalone/node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/package.json +0 -28
- package/.next/standalone/node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js +0 -66
- package/.next/standalone/node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/package.json +0 -32
- 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 -59
- package/.next/standalone/node_modules/bindings/bindings.js +0 -221
- package/.next/standalone/node_modules/bindings/package.json +0 -28
- package/.next/standalone/node_modules/file-uri-to-path/index.js +0 -66
- package/.next/standalone/node_modules/file-uri-to-path/package.json +0 -32
- /package/.next/standalone/dashboard/.next/static/{iXCD4qusgLaFdlD22YBUR → 00P-K7nRwpuQW1hq0VwZ5}/_buildManifest.js +0 -0
- /package/.next/standalone/dashboard/.next/static/{iXCD4qusgLaFdlD22YBUR → 00P-K7nRwpuQW1hq0VwZ5}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[399],{607:(e,t,r)=>{"use strict";r.d(t,{ActiveAgentsSection:()=>i});var a=r(2638),s=r(4372),n=r(1015);function i({agents:e}){return 0===e.length?null:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-zinc-900 dark:text-zinc-50",children:"Active Agents"}),(0,a.jsx)("div",{className:"space-y-3",children:e.map(e=>{var t;let r,i,c;return(0,a.jsx)("div",{className:"rounded-xl border border-zinc-200 bg-white p-4 shadow-sm dark:border-zinc-800 dark:bg-zinc-900",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"font-medium text-zinc-900 dark:text-zinc-50",children:e.provider}),(0,a.jsx)("span",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:new Date(e.last_active_at).toLocaleString()})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-sm text-zinc-600 dark:text-zinc-400",children:[e.git_branch&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(s.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:e.git_branch})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(n.A,{className:"h-3.5 w-3.5"}),(0,a.jsxs)("span",{children:["Last active ",(t=e.last_active_at,(c=Math.floor((i=Math.floor((r=Math.floor(Math.floor((Date.now()-t)/1e3)/60))/60))/24))>0?`${c}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:"just now")]})]})]}),(0,a.jsx)("div",{className:"text-xs text-zinc-500 dark:text-zinc-500 font-mono",children:e.agent_id})]})},e.agent_id)})})]})}},1015:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(6748).A)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},1500:(e,t,r)=>{Promise.resolve().then(r.bind(r,607)),Promise.resolve().then(r.bind(r,1599)),Promise.resolve().then(r.bind(r,8602)),Promise.resolve().then(r.bind(r,3628)),Promise.resolve().then(r.bind(r,2054)),Promise.resolve().then(r.t.bind(r,6253,23))},1599:(e,t,r)=>{"use strict";r.d(t,{CheckpointList:()=>h});var a=r(2638),s=r(6702),n=r(5771),i=r(6748);let c=(0,i.A)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);var l=r(6738),d=r(3831);let o=(0,i.A)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);var x=r(7069);function m({checkpoint:e,onClose:t}){let[r,i]=(0,s.useState)([]),[m,h]=(0,s.useState)(!0);(0,s.useEffect)(()=>{fetch(`/api/checkpoints/${e.id}/items`).then(e=>e.json()).then(e=>{i(e),h(!1)}).catch(e=>{console.error("Failed to load checkpoint items:",e),h(!1)})},[e.id]),(0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]),(0,s.useEffect)(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);let u={reminder:{bg:"bg-blue-500/10",text:"text-blue-600 dark:text-blue-400",label:"Reminder"},decision:{bg:"bg-purple-500/10",text:"text-purple-600 dark:text-purple-400",label:"Decision"},progress:{bg:"bg-teal-500/10",text:"text-teal-600 dark:text-teal-400",label:"Progress"},note:{bg:"bg-zinc-500/10",text:"text-zinc-600 dark:text-zinc-400",label:"Note"}};return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,a.jsxs)("div",{className:"relative z-10 mx-4 w-full max-w-3xl max-h-[90vh] overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between border-b border-zinc-200 p-6 dark:border-zinc-800",children:[(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-[rgb(var(--checkpoint-bg))]",children:(0,a.jsx)(n.A,{className:"h-6 w-6 text-[rgb(var(--checkpoint-foreground))]"})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-50",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center gap-4 text-xs text-zinc-500 dark:text-zinc-500",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(c,{className:"h-3.5 w-3.5"}),new Date(e.created_at).toLocaleString()]}),e.git_branch&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(o,{className:"h-3.5 w-3.5"}),e.git_branch]})]})]})]}),(0,a.jsx)("button",{onClick:t,className:"rounded-lg p-2 text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:(0,a.jsx)(x.A,{className:"h-5 w-5"})})]}),(0,a.jsx)("div",{className:"max-h-[calc(90vh-12rem)] overflow-y-auto p-6",children:m?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-zinc-400 border-t-transparent dark:border-zinc-500"})}):0===r.length?(0,a.jsx)("div",{className:"py-12 text-center",children:(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"No context items in this checkpoint"})}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-50",children:["Snapshot (",r.length," items)"]})}),r.map(e=>{let t=u[e.category]||u.note;return(0,a.jsxs)("div",{className:"rounded-lg border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-900/50",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium ${t.bg} ${t.text}`,children:t.label}),(0,a.jsx)("span",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:new Date(e.created_at).toLocaleDateString()})]}),e.key&&(0,a.jsx)("div",{className:"mb-1 text-sm font-medium text-zinc-900 dark:text-zinc-50",children:e.key}),(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-sm text-zinc-700 dark:text-zinc-300 break-words [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs",children:(0,a.jsx)(l.oz,{remarkPlugins:[d.A],children:e.value})})]},e.id)})]})})]})]})}function h({checkpoints:e}){let[t,r]=(0,s.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,a.jsx)("button",{onClick:()=>r(e),className:"w-full rounded-lg border border-zinc-200 bg-white p-4 text-left shadow-sm transition-all hover:border-zinc-400 hover:shadow-md dark:border-zinc-800 dark:bg-zinc-900 dark:hover:border-zinc-600",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--checkpoint-bg))]",children:(0,a.jsx)(n.A,{className:"h-4 w-4 text-[rgb(var(--checkpoint-foreground))]"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsx)("h3",{className:"font-semibold text-zinc-900 dark:text-zinc-50 truncate",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-xs text-zinc-600 dark:text-zinc-400 line-clamp-2",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-zinc-500 dark:text-zinc-500",children:[(0,a.jsx)(c,{className:"h-3 w-3"}),new Date(e.created_at).toLocaleDateString()]})]})]})},e.id))}),t&&(0,a.jsx)(m,{checkpoint:t,onClose:()=>r(null)})]})}},2054:(e,t,r)=>{"use strict";function a({date:e,format:t="datetime"}){return function(e,t){let r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}),c=n.getTime()===a.getTime(),l=n.getTime()===s.getTime(),d=e.getFullYear()===r.getFullYear();if("date"===t)return c?"Today":l?"Yesterday":d?e.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});if(c)return`Today at ${i}`;if(l)return`Yesterday at ${i}`;if(d){let t=e.toLocaleDateString(void 0,{month:"short",day:"numeric"});return`${t} at ${i}`}let o=e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return`${o} at ${i}`}(new Date(e),t)}r.d(t,{LocalDate:()=>a})},3304:(e,t,r)=>{"use strict";r.d(t,{ContextItemCard:()=>h});var a=r(2638),s=r(6702),n=r(6738),i=r(3831),c=r(5794),l=r(592);let d=(0,r(6748).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var o=r(737);let x={reminder:{bg:"bg-blue-500/10 dark:bg-blue-500/10",text:"text-blue-600 dark:text-blue-400",label:"Reminder"},decision:{bg:"bg-purple-500/10 dark:bg-purple-500/10",text:"text-purple-600 dark:text-purple-400",label:"Decision"},progress:{bg:"bg-teal-500/10 dark:bg-teal-500/10",text:"text-teal-600 dark:text-teal-400",label:"Progress"},note:{bg:"bg-zinc-500/10 dark:bg-zinc-500/10",text:"text-zinc-600 dark:text-zinc-400",label:"Note"}},m={high:{bg:"bg-red-500/10 dark:bg-red-500/10",text:"text-red-600 dark:text-red-400",label:"High"},normal:{bg:"bg-yellow-500/10 dark:bg-yellow-500/10",text:"text-yellow-600 dark:text-yellow-400",label:"Normal"},low:{bg:"bg-gray-500/10 dark:bg-gray-500/10",text:"text-gray-600 dark:text-gray-400",label:"Low"}};function h({item:e,onDelete:t,onEdit:r}){let[h,u]=(0,s.useState)(!1),b=x[e.category]||x.note,g=m[e.priority]||m.normal,p=e.value.length>200,k=!p||h?e.value:e.value.slice(0,200)+"...";return(0,a.jsxs)("div",{className:"group rounded-xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium ${b.bg} ${b.text}`,children:b.label}),(0,a.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium ${g.bg} ${g.text}`,children:g.label}),(0,a.jsx)("span",{className:"ml-auto text-xs text-zinc-500 dark:text-zinc-500",children:new Date(e.created_at).toLocaleString()}),(0,a.jsxs)("div",{className:"flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[r&&(0,a.jsx)("button",{onClick:()=>r(e),className:"rounded p-1.5 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",title:"Edit context item",children:(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"})}),t&&(0,a.jsx)("button",{onClick:()=>t(e),className:"rounded p-1.5 text-zinc-500 hover:bg-red-50 hover:text-red-600 dark:text-zinc-400 dark:hover:bg-red-900/20 dark:hover:text-red-400",title:"Delete context item",children:(0,a.jsx)(l.A,{className:"h-3.5 w-3.5"})})]})]}),e.key&&(0,a.jsx)("div",{className:"mb-2 text-sm font-medium text-zinc-900 dark:text-zinc-50",children:e.key}),(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-sm text-zinc-700 dark:text-zinc-300 break-words [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs [&_table]:w-full [&_th]:bg-zinc-100 [&_th]:dark:bg-zinc-800 [&_th]:px-3 [&_th]:py-2 [&_td]:px-3 [&_td]:py-2 [&_td]:border-t [&_td]:border-zinc-200 [&_td]:dark:border-zinc-700",children:(0,a.jsx)(n.oz,{remarkPlugins:[i.A],children:k})}),p&&(0,a.jsx)("button",{onClick:()=>u(!h),className:"mt-3 flex items-center gap-1 text-xs font-medium text-teal-600 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300",children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d,{className:"h-3.5 w-3.5"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Show more"]})}),e.updated_at!==e.created_at&&(0,a.jsxs)("div",{className:"mt-2 text-xs text-zinc-500 dark:text-zinc-500",children:["Updated: ",new Date(e.updated_at).toLocaleString()]})]})}},3628:(e,t,r)=>{"use strict";r.d(t,{SessionDetailHeader:()=>o});var a=r(2638),s=r(6702),n=r(1422),i=r(9349),c=r(5794),l=r(3627),d=r(4512);function o({sessionId:e,sessionName:t,sessionDescription:r,sessionStatus:s}){let c=(0,n.useRouter)(),o=async(t,r)=>{await fetch(`/api/sessions/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:r})}),c.refresh()};return(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex gap-3 sm:gap-4 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 sm:h-12 sm:w-12 shrink-0 items-center justify-center rounded-lg bg-accent",children:(0,a.jsx)(i.A,{className:"h-5 w-5 sm:h-6 sm:w-6 text-accent-foreground"})}),(0,a.jsxs)("div",{className:"space-y-1 min-w-0 flex-1",children:[(0,a.jsx)(x,{value:t,onSave:e=>o("name",e),className:"text-2xl sm:text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50"}),r?(0,a.jsx)(x,{value:r,onSave:e=>o("description",e),className:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400",multiline:!0}):(0,a.jsx)(x,{value:"",placeholder:"Add description...",onSave:e=>o("description",e),className:"text-sm sm:text-base text-zinc-400 dark:text-zinc-500"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 self-start",children:[(0,a.jsx)(l.e,{sessionId:e,currentStatus:s}),(0,a.jsx)(d.A,{sessionId:e,sessionName:t,currentStatus:s,redirectOnDelete:"/dashboard/sessions"})]})]})}function x({value:e,placeholder:t,onSave:r,className:n,multiline:i}){let[l,d]=(0,s.useState)(!1),[o,x]=(0,s.useState)(e),[m,h]=(0,s.useState)(!1),u=(0,s.useRef)(null),b=()=>{d(!1);let t=o.trim();t&&t!==e?r(t):x(e)},g=t=>{"Enter"!==t.key||i?"Escape"===t.key&&(x(e),d(!1)):u.current?.blur()};if(l){let e=`bg-zinc-100 dark:bg-zinc-800 rounded px-2 -mx-2 outline-none focus:ring-2 focus:ring-zinc-400 w-full ${n}`;return i?(0,a.jsx)("textarea",{ref:u,value:o,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:g,rows:2,className:e}):(0,a.jsx)("input",{ref:u,type:"text",value:o,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:g,className:e})}return(0,a.jsxs)("div",{className:"group flex items-center gap-2",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[(0,a.jsx)("span",{className:n,children:e||t}),(0,a.jsx)("button",{onClick:()=>{x(e),d(!0),setTimeout(()=>u.current?.focus(),0)},className:`shrink-0 p-1 rounded text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-opacity ${m?"opacity-100":"opacity-0"}`,children:(0,a.jsx)(c.A,{className:"h-4 w-4"})})]})}},5771:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(6748).A)("bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]])},8602:(e,t,r)=>{"use strict";r.d(t,{ContextItemsSection:()=>u});var a=r(2638),s=r(6702),n=r(1422),i=r(3304),c=r(5979),l=r(7069);function d({item:e,onConfirm:t,onCancel:r}){let[n,i]=(0,s.useState)(!1),d=async()=>{i(!0);try{await t(e)}catch(e){console.error("Failed to delete context item:",e),i(!1)}};return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),(0,a.jsxs)("div",{className:"relative z-10 mx-4 w-full max-w-md rounded-2xl border border-zinc-200 bg-white p-6 shadow-2xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"mb-4 flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-red-500/10",children:(0,a.jsx)(c.A,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-50",children:"Delete Context Item"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:"This action cannot be undone."})]})]}),(0,a.jsx)("button",{onClick:r,className:"rounded-lg p-2 text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,a.jsxs)("div",{className:"mb-6 rounded-lg border border-zinc-200 bg-zinc-50 p-3 dark:border-zinc-800 dark:bg-zinc-900/50",children:[e.key&&(0,a.jsx)("div",{className:"mb-1 text-sm font-medium text-zinc-900 dark:text-zinc-50",children:e.key}),(0,a.jsx)("div",{className:"line-clamp-3 text-sm text-zinc-600 dark:text-zinc-400",children:e.value})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("button",{onClick:r,disabled:n,className:"flex-1 rounded-lg border border-zinc-200 px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 disabled:opacity-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,a.jsx)("button",{onClick:d,disabled:n,className:"flex-1 rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 disabled:opacity-50 dark:bg-red-600 dark:hover:bg-red-700",children:n?"Deleting...":"Delete"})]})]})]})}var o=r(6748);let x=(0,o.A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function m({item:e,onSave:t,onCancel:r}){let[n,i]=(0,s.useState)(!1),[c,d]=(0,s.useState)({value:e.value,category:e.category,priority:e.priority,channel:e.channel||""}),o=async()=>{i(!0);try{await t(e,c)}catch(e){console.error("Failed to save context item:",e),i(!1)}};return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),(0,a.jsxs)("div",{className:"relative z-10 mx-4 w-full max-w-2xl max-h-[90vh] overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-zinc-200 p-6 dark:border-zinc-800",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-teal-500/10",children:(0,a.jsx)(x,{className:"h-5 w-5 text-teal-600 dark:text-teal-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-50",children:"Edit Context Item"}),e.key&&(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:e.key})]})]}),(0,a.jsx)("button",{onClick:r,className:"rounded-lg p-2 text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"max-h-[calc(90vh-12rem)] overflow-y-auto p-6",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Value"}),(0,a.jsx)("textarea",{value:c.value,onChange:e=>d({...c,value:e.target.value}),rows:8,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",placeholder:"Enter context value..."})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Category"}),(0,a.jsxs)("select",{value:c.category,onChange:e=>d({...c,category:e.target.value}),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",children:[(0,a.jsx)("option",{value:"task",children:"Task"}),(0,a.jsx)("option",{value:"decision",children:"Decision"}),(0,a.jsx)("option",{value:"progress",children:"Progress"}),(0,a.jsx)("option",{value:"note",children:"Note"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Priority"}),(0,a.jsxs)("select",{value:c.priority,onChange:e=>d({...c,priority:e.target.value}),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",children:[(0,a.jsx)("option",{value:"high",children:"High"}),(0,a.jsx)("option",{value:"normal",children:"Normal"}),(0,a.jsx)("option",{value:"low",children:"Low"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Channel"}),(0,a.jsx)("input",{type:"text",value:c.channel,onChange:e=>d({...c,channel:e.target.value}),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",placeholder:"Enter channel name..."})]})]})}),(0,a.jsxs)("div",{className:"flex gap-3 border-t border-zinc-200 p-6 dark:border-zinc-800",children:[(0,a.jsx)("button",{onClick:r,disabled:n,className:"flex-1 rounded-lg border border-zinc-200 px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 disabled:opacity-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,a.jsx)("button",{onClick:o,disabled:n,className:"flex-1 rounded-lg bg-teal-600 px-4 py-2 text-sm font-medium text-white hover:bg-teal-700 disabled:opacity-50 dark:bg-teal-600 dark:hover:bg-teal-700",children:n?"Saving...":"Save Changes"})]})]})]})}let h=(0,o.A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);function u({items:e,sessionId:t}){let r=(0,n.useRouter)(),[c,l]=(0,s.useState)(null),[o,x]=(0,s.useState)(null),u=async e=>{try{let a=await fetch("/api/context/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,sessionId:t})}),s=await a.json();if(!a.ok)throw Error(s.error||"Failed to delete");l(null),r.refresh()}catch(e){throw console.error("Delete error:",e),e}},b=async(e,a)=>{try{let s=await fetch("/api/context/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,sessionId:t,...a})}),n=await s.json();if(!s.ok)throw Error(n.error||"Failed to update");x(null),r.refresh()}catch(e){throw console.error("Update error:",e),e}};return 0===e.length?(0,a.jsxs)("div",{className:"rounded-xl border border-dashed border-zinc-300 bg-zinc-50 p-12 text-center dark:border-zinc-700 dark:bg-zinc-900/50",children:[(0,a.jsx)(h,{className:"mx-auto h-12 w-12 text-zinc-400 dark:text-zinc-600"}),(0,a.jsx)("h3",{className:"mt-4 font-semibold text-zinc-900 dark:text-zinc-50",children:"No context items yet"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:"Context items will appear here as you work with SaveContext"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-3",children:e.map(e=>(0,a.jsx)(i.ContextItemCard,{item:e,onDelete:l,onEdit:x},e.id))}),c&&(0,a.jsx)(d,{item:c,onConfirm:u,onCancel:()=>l(null)}),o&&(0,a.jsx)(m,{item:o,onSave:b,onCancel:()=>x(null)})]})}}},e=>{e.O(0,[3358,9353,7306,6736,5602,2655,8704,7358],()=>e(e.s=1500)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[399],{607:(e,t,r)=>{"use strict";r.d(t,{ActiveAgentsSection:()=>i});var a=r(2638),s=r(4372),n=r(1015);function i({agents:e}){return 0===e.length?null:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-zinc-900 dark:text-zinc-50",children:"Active Agents"}),(0,a.jsx)("div",{className:"space-y-3",children:e.map(e=>{var t;let r,i,c;return(0,a.jsx)("div",{className:"rounded-xl border border-zinc-200 bg-white p-4 shadow-sm dark:border-zinc-800 dark:bg-zinc-900",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"font-medium text-zinc-900 dark:text-zinc-50",children:e.provider}),(0,a.jsx)("span",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:new Date(e.last_active_at).toLocaleString()})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-sm text-zinc-600 dark:text-zinc-400",children:[e.git_branch&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(s.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:e.git_branch})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(n.A,{className:"h-3.5 w-3.5"}),(0,a.jsxs)("span",{children:["Last active ",(t=e.last_active_at,(c=Math.floor((i=Math.floor((r=Math.floor(Math.floor((Date.now()-t)/1e3)/60))/60))/24))>0?`${c}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:"just now")]})]})]}),(0,a.jsx)("div",{className:"text-xs text-zinc-500 dark:text-zinc-500 font-mono",children:e.agent_id})]})},e.agent_id)})})]})}},1015:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(6748).A)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},1500:(e,t,r)=>{Promise.resolve().then(r.bind(r,607)),Promise.resolve().then(r.bind(r,1599)),Promise.resolve().then(r.bind(r,8602)),Promise.resolve().then(r.bind(r,3628)),Promise.resolve().then(r.bind(r,2054)),Promise.resolve().then(r.t.bind(r,6253,23))},1599:(e,t,r)=>{"use strict";r.d(t,{CheckpointList:()=>h});var a=r(2638),s=r(6702),n=r(5771),i=r(6748);let c=(0,i.A)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);var l=r(6738),d=r(3831);let o=(0,i.A)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);var x=r(7069);function m({checkpoint:e,onClose:t}){let[r,i]=(0,s.useState)([]),[m,h]=(0,s.useState)(!0);(0,s.useEffect)(()=>{fetch(`/api/checkpoints/${e.id}/items`).then(e=>e.json()).then(e=>{i(e),h(!1)}).catch(e=>{console.error("Failed to load checkpoint items:",e),h(!1)})},[e.id]),(0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]),(0,s.useEffect)(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);let u={reminder:{bg:"bg-blue-500/10",text:"text-blue-600 dark:text-blue-400",label:"Reminder"},decision:{bg:"bg-purple-500/10",text:"text-purple-600 dark:text-purple-400",label:"Decision"},progress:{bg:"bg-teal-500/10",text:"text-teal-600 dark:text-teal-400",label:"Progress"},note:{bg:"bg-zinc-500/10",text:"text-zinc-600 dark:text-zinc-400",label:"Note"}};return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,a.jsxs)("div",{className:"relative z-10 mx-4 w-full max-w-3xl max-h-[90vh] overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between border-b border-zinc-200 p-6 dark:border-zinc-800",children:[(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-[rgb(var(--checkpoint-bg))]",children:(0,a.jsx)(n.A,{className:"h-6 w-6 text-[rgb(var(--checkpoint-foreground))]"})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-50",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center gap-4 text-xs text-zinc-500 dark:text-zinc-500",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(c,{className:"h-3.5 w-3.5"}),new Date(e.created_at).toLocaleString()]}),e.git_branch&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(o,{className:"h-3.5 w-3.5"}),e.git_branch]})]})]})]}),(0,a.jsx)("button",{onClick:t,className:"rounded-lg p-2 text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:(0,a.jsx)(x.A,{className:"h-5 w-5"})})]}),(0,a.jsx)("div",{className:"max-h-[calc(90vh-12rem)] overflow-y-auto p-6",children:m?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-zinc-400 border-t-transparent dark:border-zinc-500"})}):0===r.length?(0,a.jsx)("div",{className:"py-12 text-center",children:(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"No context items in this checkpoint"})}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-50",children:["Snapshot (",r.length," items)"]})}),r.map(e=>{let t=u[e.category]||u.note;return(0,a.jsxs)("div",{className:"rounded-lg border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-900/50",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium ${t.bg} ${t.text}`,children:t.label}),(0,a.jsx)("span",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:new Date(e.created_at).toLocaleDateString()})]}),e.key&&(0,a.jsx)("div",{className:"mb-1 text-sm font-medium text-zinc-900 dark:text-zinc-50",children:e.key}),(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-sm text-zinc-700 dark:text-zinc-300 break-words [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs",children:(0,a.jsx)(l.oz,{remarkPlugins:[d.A],children:e.value})})]},e.id)})]})})]})]})}function h({checkpoints:e}){let[t,r]=(0,s.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,a.jsx)("button",{onClick:()=>r(e),className:"w-full rounded-lg border border-zinc-200 bg-white p-4 text-left shadow-sm transition-all hover:border-zinc-400 hover:shadow-md dark:border-zinc-800 dark:bg-zinc-900 dark:hover:border-zinc-600",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-[rgb(var(--checkpoint-bg))]",children:(0,a.jsx)(n.A,{className:"h-4 w-4 text-[rgb(var(--checkpoint-foreground))]"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsx)("h3",{className:"font-semibold text-zinc-900 dark:text-zinc-50 truncate",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-xs text-zinc-600 dark:text-zinc-400 line-clamp-2",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-zinc-500 dark:text-zinc-500",children:[(0,a.jsx)(c,{className:"h-3 w-3"}),new Date(e.created_at).toLocaleDateString()]})]})]})},e.id))}),t&&(0,a.jsx)(m,{checkpoint:t,onClose:()=>r(null)})]})}},2054:(e,t,r)=>{"use strict";function a({date:e,format:t="datetime"}){return function(e,t){let r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}),c=n.getTime()===a.getTime(),l=n.getTime()===s.getTime(),d=e.getFullYear()===r.getFullYear();if("date"===t)return c?"Today":l?"Yesterday":d?e.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});if(c)return`Today at ${i}`;if(l)return`Yesterday at ${i}`;if(d){let t=e.toLocaleDateString(void 0,{month:"short",day:"numeric"});return`${t} at ${i}`}let o=e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return`${o} at ${i}`}(new Date(e),t)}r.d(t,{LocalDate:()=>a})},3304:(e,t,r)=>{"use strict";r.d(t,{ContextItemCard:()=>h});var a=r(2638),s=r(6702),n=r(6738),i=r(3831),c=r(5794),l=r(592);let d=(0,r(6748).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var o=r(737);let x={reminder:{bg:"bg-blue-500/10 dark:bg-blue-500/10",text:"text-blue-600 dark:text-blue-400",label:"Reminder"},decision:{bg:"bg-purple-500/10 dark:bg-purple-500/10",text:"text-purple-600 dark:text-purple-400",label:"Decision"},progress:{bg:"bg-teal-500/10 dark:bg-teal-500/10",text:"text-teal-600 dark:text-teal-400",label:"Progress"},note:{bg:"bg-zinc-500/10 dark:bg-zinc-500/10",text:"text-zinc-600 dark:text-zinc-400",label:"Note"}},m={high:{bg:"bg-red-500/10 dark:bg-red-500/10",text:"text-red-600 dark:text-red-400",label:"High"},normal:{bg:"bg-yellow-500/10 dark:bg-yellow-500/10",text:"text-yellow-600 dark:text-yellow-400",label:"Normal"},low:{bg:"bg-gray-500/10 dark:bg-gray-500/10",text:"text-gray-600 dark:text-gray-400",label:"Low"}};function h({item:e,onDelete:t,onEdit:r}){let[h,u]=(0,s.useState)(!1),b=x[e.category]||x.note,g=m[e.priority]||m.normal,p=e.value.length>200,k=!p||h?e.value:e.value.slice(0,200)+"...";return(0,a.jsxs)("div",{className:"group rounded-xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium ${b.bg} ${b.text}`,children:b.label}),(0,a.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium ${g.bg} ${g.text}`,children:g.label}),(0,a.jsx)("span",{className:"ml-auto text-xs text-zinc-500 dark:text-zinc-500",children:new Date(e.created_at).toLocaleString()}),(0,a.jsxs)("div",{className:"flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[r&&(0,a.jsx)("button",{onClick:()=>r(e),className:"rounded p-1.5 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",title:"Edit context item",children:(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"})}),t&&(0,a.jsx)("button",{onClick:()=>t(e),className:"rounded p-1.5 text-zinc-500 hover:bg-red-50 hover:text-red-600 dark:text-zinc-400 dark:hover:bg-red-900/20 dark:hover:text-red-400",title:"Delete context item",children:(0,a.jsx)(l.A,{className:"h-3.5 w-3.5"})})]})]}),e.key&&(0,a.jsx)("div",{className:"mb-2 text-sm font-medium text-zinc-900 dark:text-zinc-50",children:e.key}),(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-sm text-zinc-700 dark:text-zinc-300 break-words [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs [&_table]:w-full [&_th]:bg-zinc-100 [&_th]:dark:bg-zinc-800 [&_th]:px-3 [&_th]:py-2 [&_td]:px-3 [&_td]:py-2 [&_td]:border-t [&_td]:border-zinc-200 [&_td]:dark:border-zinc-700",children:(0,a.jsx)(n.oz,{remarkPlugins:[i.A],children:k})}),p&&(0,a.jsx)("button",{onClick:()=>u(!h),className:"mt-3 flex items-center gap-1 text-xs font-medium text-teal-600 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300",children:h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d,{className:"h-3.5 w-3.5"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Show more"]})}),e.updated_at!==e.created_at&&(0,a.jsxs)("div",{className:"mt-2 text-xs text-zinc-500 dark:text-zinc-500",children:["Updated: ",new Date(e.updated_at).toLocaleString()]})]})}},3628:(e,t,r)=>{"use strict";r.d(t,{SessionDetailHeader:()=>o});var a=r(2638),s=r(6702),n=r(1422),i=r(9349),c=r(5794),l=r(3627),d=r(4512);function o({sessionId:e,sessionName:t,sessionDescription:r,sessionStatus:s}){let c=(0,n.useRouter)(),o=async(t,r)=>{await fetch(`/api/sessions/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:r})}),c.refresh()};return(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex gap-3 sm:gap-4 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 sm:h-12 sm:w-12 shrink-0 items-center justify-center rounded-lg bg-accent",children:(0,a.jsx)(i.A,{className:"h-5 w-5 sm:h-6 sm:w-6 text-accent-foreground"})}),(0,a.jsxs)("div",{className:"space-y-1 min-w-0 flex-1",children:[(0,a.jsx)(x,{value:t,onSave:e=>o("name",e),className:"text-2xl sm:text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50"}),r?(0,a.jsx)(x,{value:r,onSave:e=>o("description",e),className:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400",multiline:!0}):(0,a.jsx)(x,{value:"",placeholder:"Add description...",onSave:e=>o("description",e),className:"text-sm sm:text-base text-zinc-400 dark:text-zinc-500"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 self-start",children:[(0,a.jsx)(l.e,{sessionId:e,currentStatus:s}),(0,a.jsx)(d.A,{sessionId:e,sessionName:t,currentStatus:s,redirectOnDelete:"/dashboard/sessions"})]})]})}function x({value:e,placeholder:t,onSave:r,className:n,multiline:i}){let[l,d]=(0,s.useState)(!1),[o,x]=(0,s.useState)(e),[m,h]=(0,s.useState)(!1),u=(0,s.useRef)(null),b=()=>{d(!1);let t=o.trim();t&&t!==e?r(t):x(e)},g=t=>{"Enter"!==t.key||i?"Escape"===t.key&&(x(e),d(!1)):u.current?.blur()};if(l){let e=`bg-zinc-100 dark:bg-zinc-800 rounded px-2 -mx-2 outline-none focus:ring-2 focus:ring-zinc-400 w-full ${n}`;return i?(0,a.jsx)("textarea",{ref:u,value:o,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:g,rows:2,className:e}):(0,a.jsx)("input",{ref:u,type:"text",value:o,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:g,className:e})}return(0,a.jsxs)("div",{className:"group flex items-center gap-2",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[(0,a.jsx)("span",{className:n,children:e||t}),(0,a.jsx)("button",{onClick:()=>{x(e),d(!0),setTimeout(()=>u.current?.focus(),0)},className:`shrink-0 p-1 rounded text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-opacity ${m?"opacity-100":"opacity-0"}`,children:(0,a.jsx)(c.A,{className:"h-4 w-4"})})]})}},5771:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(6748).A)("bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]])},8602:(e,t,r)=>{"use strict";r.d(t,{ContextItemsSection:()=>u});var a=r(2638),s=r(6702),n=r(1422),i=r(3304),c=r(8360),l=r(7069);function d({item:e,onConfirm:t,onCancel:r}){let[n,i]=(0,s.useState)(!1),d=async()=>{i(!0);try{await t(e)}catch(e){console.error("Failed to delete context item:",e),i(!1)}};return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),(0,a.jsxs)("div",{className:"relative z-10 mx-4 w-full max-w-md rounded-2xl border border-zinc-200 bg-white p-6 shadow-2xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"mb-4 flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-red-500/10",children:(0,a.jsx)(c.A,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-50",children:"Delete Context Item"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:"This action cannot be undone."})]})]}),(0,a.jsx)("button",{onClick:r,className:"rounded-lg p-2 text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,a.jsxs)("div",{className:"mb-6 rounded-lg border border-zinc-200 bg-zinc-50 p-3 dark:border-zinc-800 dark:bg-zinc-900/50",children:[e.key&&(0,a.jsx)("div",{className:"mb-1 text-sm font-medium text-zinc-900 dark:text-zinc-50",children:e.key}),(0,a.jsx)("div",{className:"line-clamp-3 text-sm text-zinc-600 dark:text-zinc-400",children:e.value})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("button",{onClick:r,disabled:n,className:"flex-1 rounded-lg border border-zinc-200 px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 disabled:opacity-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,a.jsx)("button",{onClick:d,disabled:n,className:"flex-1 rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 disabled:opacity-50 dark:bg-red-600 dark:hover:bg-red-700",children:n?"Deleting...":"Delete"})]})]})]})}var o=r(6748);let x=(0,o.A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function m({item:e,onSave:t,onCancel:r}){let[n,i]=(0,s.useState)(!1),[c,d]=(0,s.useState)({value:e.value,category:e.category,priority:e.priority,channel:e.channel||""}),o=async()=>{i(!0);try{await t(e,c)}catch(e){console.error("Failed to save context item:",e),i(!1)}};return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),(0,a.jsxs)("div",{className:"relative z-10 mx-4 w-full max-w-2xl max-h-[90vh] overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-zinc-200 p-6 dark:border-zinc-800",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-teal-500/10",children:(0,a.jsx)(x,{className:"h-5 w-5 text-teal-600 dark:text-teal-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-50",children:"Edit Context Item"}),e.key&&(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:e.key})]})]}),(0,a.jsx)("button",{onClick:r,className:"rounded-lg p-2 text-zinc-500 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:(0,a.jsx)(l.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"max-h-[calc(90vh-12rem)] overflow-y-auto p-6",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Value"}),(0,a.jsx)("textarea",{value:c.value,onChange:e=>d({...c,value:e.target.value}),rows:8,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",placeholder:"Enter context value..."})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Category"}),(0,a.jsxs)("select",{value:c.category,onChange:e=>d({...c,category:e.target.value}),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",children:[(0,a.jsx)("option",{value:"task",children:"Task"}),(0,a.jsx)("option",{value:"decision",children:"Decision"}),(0,a.jsx)("option",{value:"progress",children:"Progress"}),(0,a.jsx)("option",{value:"note",children:"Note"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Priority"}),(0,a.jsxs)("select",{value:c.priority,onChange:e=>d({...c,priority:e.target.value}),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",children:[(0,a.jsx)("option",{value:"high",children:"High"}),(0,a.jsx)("option",{value:"normal",children:"Normal"}),(0,a.jsx)("option",{value:"low",children:"Low"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Channel"}),(0,a.jsx)("input",{type:"text",value:c.channel,onChange:e=>d({...c,channel:e.target.value}),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-teal-500 focus:outline-none focus:ring-2 focus:ring-teal-500/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-50",placeholder:"Enter channel name..."})]})]})}),(0,a.jsxs)("div",{className:"flex gap-3 border-t border-zinc-200 p-6 dark:border-zinc-800",children:[(0,a.jsx)("button",{onClick:r,disabled:n,className:"flex-1 rounded-lg border border-zinc-200 px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 disabled:opacity-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,a.jsx)("button",{onClick:o,disabled:n,className:"flex-1 rounded-lg bg-teal-600 px-4 py-2 text-sm font-medium text-white hover:bg-teal-700 disabled:opacity-50 dark:bg-teal-600 dark:hover:bg-teal-700",children:n?"Saving...":"Save Changes"})]})]})]})}let h=(0,o.A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);function u({items:e,sessionId:t}){let r=(0,n.useRouter)(),[c,l]=(0,s.useState)(null),[o,x]=(0,s.useState)(null),u=async e=>{try{let a=await fetch("/api/context/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,sessionId:t})}),s=await a.json();if(!a.ok)throw Error(s.error||"Failed to delete");l(null),r.refresh()}catch(e){throw console.error("Delete error:",e),e}},b=async(e,a)=>{try{let s=await fetch("/api/context/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e.key,sessionId:t,...a})}),n=await s.json();if(!s.ok)throw Error(n.error||"Failed to update");x(null),r.refresh()}catch(e){throw console.error("Update error:",e),e}};return 0===e.length?(0,a.jsxs)("div",{className:"rounded-xl border border-dashed border-zinc-300 bg-zinc-50 p-12 text-center dark:border-zinc-700 dark:bg-zinc-900/50",children:[(0,a.jsx)(h,{className:"mx-auto h-12 w-12 text-zinc-400 dark:text-zinc-600"}),(0,a.jsx)("h3",{className:"mt-4 font-semibold text-zinc-900 dark:text-zinc-50",children:"No context items yet"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:"Context items will appear here as you work with SaveContext"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-3",children:e.map(e=>(0,a.jsx)(i.ContextItemCard,{item:e,onDelete:l,onEdit:x},e.id))}),c&&(0,a.jsx)(d,{item:c,onConfirm:u,onCancel:()=>l(null)}),o&&(0,a.jsx)(m,{item:o,onSave:b,onCancel:()=>x(null)})]})}}},e=>{e.O(0,[3358,9353,7306,6736,5602,2655,8704,7358],()=>e(e.s=1500)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1719],{592:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(6748).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},737:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(6748).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},2532:(e,t,s)=>{"use strict";s.d(t,{SessionFilters:()=>d});var n=s(2638),a=s(1422),r=s(6539),i=s(7069),l=s(737),c=s(6702);let o=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"completed",label:"Completed"}];function d({projects:e,currentProjectId:t,currentStatus:s,currentSearch:d,hideStatusFilter:u}){let m=(0,a.useRouter)(),x=(0,a.usePathname)(),p=(0,a.useSearchParams)(),[h,g]=(0,c.useState)(!1),[v,f]=(0,c.useState)(d||""),z=(0,c.useRef)(null),b=(0,c.useRef)(null);(0,c.useEffect)(()=>{f(d||"")},[d]),(0,c.useEffect)(()=>{function e(e){z.current&&!z.current.contains(e.target)&&g(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let k=(0,c.useCallback)((e,t)=>{let s=new URLSearchParams(p.toString());null===t||"all"===t||""===t?s.delete(e):s.set(e,t);let n=s.toString();m.push(`${x}${n?`?${n}`:""}`)},[m,x,p]),j=e=>{f(e),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{k("search",e||null)},300)};(0,c.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let w=e.find(e=>e.id===t),N=w?w.name:null;return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(r.A,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,n.jsx)("input",{type:"text",value:v,onChange:e=>j(e.target.value),placeholder:"Search sessions...",className:"h-8 sm:h-9 w-48 sm:w-64 rounded-lg border border-zinc-200 bg-white pl-8 pr-3 text-sm text-zinc-900 placeholder:text-zinc-400 outline-none focus:border-zinc-400 focus:ring-1 focus:ring-zinc-400 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:focus:border-zinc-600"}),v&&(0,n.jsx)("button",{onClick:()=>j(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",children:(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"})})]}),(0,n.jsxs)("div",{className:"relative",ref:z,children:[(0,n.jsxs)("button",{onClick:()=>g(!h),className:"flex items-center gap-1.5 sm:gap-2 rounded-lg border border-zinc-200 bg-white px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-medium text-zinc-700 shadow-sm transition-all hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700/50",children:[(0,n.jsx)("span",{children:N||"All Projects"}),(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-zinc-500"})]}),h&&(0,n.jsx)("div",{className:"absolute left-0 top-full z-50 mt-2 w-64 rounded-lg border border-zinc-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-800",children:(0,n.jsxs)("div",{className:"max-h-80 overflow-y-auto p-1",children:[(0,n.jsx)("button",{onClick:()=>{k("projectId",null),g(!1)},className:`w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${!t?"bg-primary font-medium text-primary-foreground":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700/50"}`,children:"All Projects"}),e.map(e=>(0,n.jsxs)("button",{onClick:()=>{k("projectId",e.id),g(!1)},className:`w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${t===e.id?"bg-primary font-medium text-primary-foreground":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700/50"}`,children:[(0,n.jsx)("div",{className:"truncate",children:e.name}),e.source_path&&(0,n.jsx)("div",{className:"truncate text-xs text-zinc-500 dark:text-zinc-500",children:e.source_path})]},e.id))]})})]}),!u&&(0,n.jsx)("div",{className:"flex items-center gap-1.5 sm:gap-2",children:o.map(e=>(0,n.jsx)("button",{onClick:()=>k("status",e.value),className:`rounded-full px-2.5 sm:px-3 py-1 sm:py-1.5 text-[10px] sm:text-xs font-medium transition-all ${s===e.value?"bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900 shadow-sm":"bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700"}`,children:e.label},e.value))}),(t||"all"!==s||d)&&(0,n.jsxs)("button",{onClick:()=>{f(""),k("search",null),k("projectId",null),k("status","all")},className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:[(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})}},4752:(e,t,s)=>{Promise.resolve().then(s.bind(s,5807)),Promise.resolve().then(s.bind(s,2532)),Promise.resolve().then(s.t.bind(s,6253,23))},5807:(e,t,s)=>{"use strict";s.d(t,{SessionCardContent:()=>d});var n=s(2638),a=s(6702),r=s(1422),i=s(9349),l=s(5794),c=s(3627),o=s(4512);function d({sessionId:e,sessionName:t,sessionDescription:s,sessionStatus:a,projectNames:l,createdAt:d}){let m=(0,r.useRouter)(),x=[...new Set(l)],p=x.slice(0,2),h=x.length-2,g=e=>{e.preventDefault(),e.stopPropagation()},v=async(t,s)=>{await fetch(`/api/sessions/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:s})}),m.refresh()};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"absolute top-3 right-3 sm:top-4 sm:right-4 flex items-center gap-2",onClick:g,onMouseDown:g,children:[(0,n.jsx)(c.e,{sessionId:e,currentStatus:a}),(0,n.jsx)(o.A,{sessionId:e,sessionName:t,currentStatus:a})]}),(0,n.jsxs)("div",{className:"flex gap-3 sm:gap-4 pr-32 sm:pr-40",children:[(0,n.jsx)("div",{className:"flex h-9 w-9 sm:h-10 sm:w-10 shrink-0 items-center justify-center rounded-lg bg-accent",children:(0,n.jsx)(i.A,{className:"h-4 w-4 sm:h-5 sm:w-5 text-accent-foreground"})}),(0,n.jsxs)("div",{className:"space-y-1.5 min-w-0 flex-1",children:[(0,n.jsx)(u,{value:t,onSave:e=>v("name",e),className:"font-semibold text-zinc-900 dark:text-zinc-50"}),s?(0,n.jsx)(u,{value:s,onSave:e=>v("description",e),className:"text-sm text-zinc-600 dark:text-zinc-400",multiline:!0}):(0,n.jsx)(u,{value:"",placeholder:"Add description...",onSave:e=>v("description",e),className:"text-sm text-zinc-400 dark:text-zinc-500"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(e=>(0,n.jsx)("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-zinc-100 px-2 py-1 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e},e)),h>0&&(0,n.jsxs)("span",{className:"text-xs font-medium text-zinc-500",children:["+",h," more"]}),(0,n.jsx)("span",{className:"text-zinc-400",children:"•"}),(0,n.jsx)("span",{className:"text-xs text-zinc-500 shrink-0",children:new Date(d).toLocaleDateString()})]})]})]})]})}function u({value:e,placeholder:t,onSave:s,className:r,multiline:i}){let[c,o]=(0,a.useState)(!1),[d,u]=(0,a.useState)(e),[m,x]=(0,a.useState)(!1),p=(0,a.useRef)(null),h=(0,a.useRef)(null),g=e=>{e.preventDefault(),e.stopPropagation()},v=t=>{t.preventDefault(),t.stopPropagation(),o(!1);let n=d.trim();n&&n!==e?s(n):u(e)},f=t=>{t.stopPropagation(),"Enter"!==t.key||i?"Escape"===t.key&&(t.preventDefault(),u(e),o(!1)):(t.preventDefault(),p.current?.blur())};if(c){let e=`bg-zinc-100 dark:bg-zinc-800 rounded px-1 -mx-1 outline-none focus:ring-2 focus:ring-zinc-400 w-full ${r}`;return(0,n.jsx)("div",{ref:h,onClick:g,onMouseDown:g,children:i?(0,n.jsx)("textarea",{ref:p,value:d,onChange:e=>u(e.target.value),onBlur:v,onKeyDown:f,onClick:g,onMouseDown:g,rows:2,className:e}):(0,n.jsx)("input",{ref:p,type:"text",value:d,onChange:e=>u(e.target.value),onBlur:v,onKeyDown:f,onClick:g,onMouseDown:g,className:e})})}return(0,n.jsxs)("div",{className:"group flex items-center gap-1",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),onClick:g,onMouseDown:g,children:[(0,n.jsx)("span",{className:`${r} ${i?"line-clamp-2":"truncate"}`,children:e||t}),(0,n.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e),o(!0),setTimeout(()=>p.current?.focus(),0)},onMouseDown:g,className:`shrink-0 p-0.5 rounded text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-opacity ${m?"opacity-100":"opacity-0"}`,children:(0,n.jsx)(l.A,{className:"h-3 w-3"})})]})}},6539:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(6748).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])}},e=>{e.O(0,[3358,7306,6736,5602,2655,8704,7358],()=>e(e.s=4752)),_N_E=e.O()}]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savecontext/dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "SaveContext Dashboard - The OS for AI coding agents",
|
|
5
5
|
"bin": {
|
|
6
6
|
"savecontext-dashboard": "./bin/savecontext-dashboard.js"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"bin"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "next dev -p 3333",
|
|
14
|
-
"build": "next build --webpack &&
|
|
15
|
-
"postbuild": "cp -r .next/static .next/standalone/dashboard/.next/ && cp -r public .next/standalone/dashboard/ 2>/dev/null || true &&
|
|
16
|
-
"start": "next start -p 3333",
|
|
17
|
-
"prepublishOnly": "
|
|
13
|
+
"dev": "bun --bun next dev -p 3333",
|
|
14
|
+
"build": "bun --bun next build --webpack && bun run postbuild",
|
|
15
|
+
"postbuild": "cp -r .next/static .next/standalone/dashboard/.next/ && cp -r public .next/standalone/dashboard/ 2>/dev/null || true && bun ../server/scripts/npm/fix-pnpm-modules.cjs",
|
|
16
|
+
"start": "bun --bun next start -p 3333",
|
|
17
|
+
"prepublishOnly": "bun run build"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"session-management"
|
|
30
30
|
],
|
|
31
31
|
"author": "Shane Monastero",
|
|
32
|
-
"license": "
|
|
32
|
+
"license": "AGPL-3.0",
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/greenfieldlabs-inc/savecontext/issues"
|
|
35
35
|
},
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"@radix-ui/react-separator": "^1.1.7",
|
|
42
42
|
"@radix-ui/react-slot": "^1.2.3",
|
|
43
43
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
44
|
-
"better-sqlite3": "^12.4.1",
|
|
45
44
|
"class-variance-authority": "^0.7.1",
|
|
46
45
|
"clsx": "^2.1.1",
|
|
47
46
|
"date-fns": "^4.1.0",
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"devDependencies": {
|
|
59
58
|
"@tailwindcss/postcss": "^4",
|
|
60
59
|
"@tailwindcss/typography": "^0.5.16",
|
|
61
|
-
"@types/
|
|
60
|
+
"@types/bun": "^1.2.4",
|
|
62
61
|
"@types/node": "^20.19.24",
|
|
63
62
|
"@types/react": "^19",
|
|
64
63
|
"@types/react-dom": "^19",
|
package/README.md
CHANGED
|
@@ -5,22 +5,20 @@ Local web UI for SaveContext - view sessions, context, issues, and plans.
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
bunx @savecontext/dashboard
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Custom port:
|
|
12
12
|
```bash
|
|
13
|
-
|
|
13
|
+
bunx @savecontext/dashboard -p 4000
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
|
-
-
|
|
18
|
+
- [Bun](https://bun.sh) runtime (install: `curl -fsSL https://bun.sh/install | bash`)
|
|
19
19
|
- SaveContext MCP server must be installed and have created data
|
|
20
20
|
- Reads from `~/.savecontext/data/savecontext.db`
|
|
21
21
|
|
|
22
|
-
> Note: Next release will use Bun for cross-platform compatibility.
|
|
23
|
-
|
|
24
22
|
## Links
|
|
25
23
|
|
|
26
24
|
- [SaveContext MCP Server](https://www.npmjs.com/package/@savecontext/mcp)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
@@ -18,15 +18,15 @@ for (let i = 0; i < args.length; i++) {
|
|
|
18
18
|
console.log(`
|
|
19
19
|
SaveContext Dashboard
|
|
20
20
|
|
|
21
|
-
Usage:
|
|
21
|
+
Usage: bunx @savecontext/dashboard [options]
|
|
22
22
|
|
|
23
23
|
Options:
|
|
24
24
|
-p, --port <port> Port to run on (default: 3333)
|
|
25
25
|
-h, --help Show this help message
|
|
26
26
|
|
|
27
27
|
Examples:
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
bunx @savecontext/dashboard
|
|
29
|
+
bunx @savecontext/dashboard -p 4000
|
|
30
30
|
`);
|
|
31
31
|
process.exit(0);
|
|
32
32
|
}
|
|
@@ -38,7 +38,7 @@ const serverPath = path.join(standaloneDir, 'server.js');
|
|
|
38
38
|
|
|
39
39
|
console.log(`Starting SaveContext Dashboard on http://localhost:${port}`);
|
|
40
40
|
|
|
41
|
-
const child = spawn('
|
|
41
|
+
const child = spawn('bun', [serverPath], {
|
|
42
42
|
cwd: standaloneDir,
|
|
43
43
|
stdio: 'inherit',
|
|
44
44
|
env: {
|
|
@@ -51,6 +51,7 @@ const child = spawn('node', [serverPath], {
|
|
|
51
51
|
|
|
52
52
|
child.on('error', (err) => {
|
|
53
53
|
console.error('Failed to start dashboard:', err.message);
|
|
54
|
+
console.error('Make sure Bun is installed: https://bun.sh');
|
|
54
55
|
process.exit(1);
|
|
55
56
|
});
|
|
56
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savecontext/dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "SaveContext Dashboard - The OS for AI coding agents",
|
|
5
5
|
"bin": {
|
|
6
6
|
"savecontext-dashboard": "./bin/savecontext-dashboard.js"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"bin"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "next dev -p 3333",
|
|
14
|
-
"build": "next build --webpack &&
|
|
15
|
-
"postbuild": "cp -r .next/static .next/standalone/dashboard/.next/ && cp -r public .next/standalone/dashboard/ 2>/dev/null || true &&
|
|
16
|
-
"start": "next start -p 3333",
|
|
17
|
-
"prepublishOnly": "
|
|
13
|
+
"dev": "bun --bun next dev -p 3333",
|
|
14
|
+
"build": "bun --bun next build --webpack && bun run postbuild",
|
|
15
|
+
"postbuild": "cp -r .next/static .next/standalone/dashboard/.next/ && cp -r public .next/standalone/dashboard/ 2>/dev/null || true && bun ../server/scripts/npm/fix-pnpm-modules.cjs",
|
|
16
|
+
"start": "bun --bun next start -p 3333",
|
|
17
|
+
"prepublishOnly": "bun run build"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"session-management"
|
|
30
30
|
],
|
|
31
31
|
"author": "Shane Monastero",
|
|
32
|
-
"license": "
|
|
32
|
+
"license": "AGPL-3.0",
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/greenfieldlabs-inc/savecontext/issues"
|
|
35
35
|
},
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"@radix-ui/react-separator": "^1.1.7",
|
|
42
42
|
"@radix-ui/react-slot": "^1.2.3",
|
|
43
43
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
44
|
-
"better-sqlite3": "^12.4.1",
|
|
45
44
|
"class-variance-authority": "^0.7.1",
|
|
46
45
|
"clsx": "^2.1.1",
|
|
47
46
|
"date-fns": "^4.1.0",
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"devDependencies": {
|
|
59
58
|
"@tailwindcss/postcss": "^4",
|
|
60
59
|
"@tailwindcss/typography": "^0.5.16",
|
|
61
|
-
"@types/
|
|
60
|
+
"@types/bun": "^1.2.4",
|
|
62
61
|
"@types/node": "^20.19.24",
|
|
63
62
|
"@types/react": "^19",
|
|
64
63
|
"@types/react-dom": "^19",
|
package/.next/standalone/dashboard/.next/static/chunks/app/dashboard/issues/page-8595961148b9e336.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9954],{1015:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},1422:(e,t,s)=>{"use strict";var a=s(2082);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},1794:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},2283:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},2362:(e,t,s)=>{Promise.resolve().then(s.bind(s,7545))},2771:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},3183:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},3203:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},3503:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]])},4545:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]])},4811:(e,t,s)=>{"use strict";s.d(t,{p:()=>i});var a=s(2638),r=s(6702);function i({icon:e,heading:t,description:s,action:i}){return(0,a.jsx)("div",{className:"rounded-2xl border-2 border-dashed border-zinc-300 bg-zinc-50 p-8 text-center dark:border-zinc-700 dark:bg-zinc-900/50",children:(0,a.jsxs)("div",{className:"mx-auto max-w-lg space-y-4",children:[(0,a.jsx)("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900",children:r.isValidElement(e)?r.cloneElement(e,{className:"h-6 w-6"}):e}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h3",{className:"text-lg font-bold text-zinc-900 dark:text-zinc-50",children:t}),(0,a.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:s})]}),i&&(0,a.jsx)("button",{onClick:i.onClick,className:"mt-4 inline-flex items-center gap-2 rounded-lg bg-zinc-900 px-4 py-2 text-sm font-medium text-white hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-zinc-200",children:i.label})]})})}},5050:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},5789:(e,t,s)=>{"use strict";s.d(t,{T:()=>i});var a=s(2638),r=s(5979);function i({isOpen:e,onClose:t,onConfirm:s,title:i,message:n,confirmText:c="Delete",cancelText:l="Cancel",variant:d="danger"}){return e?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:(0,a.jsxs)("div",{className:"w-full max-w-md rounded-xl border border-zinc-200 bg-white p-6 shadow-xl dark:border-zinc-800 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:(0,a.jsx)(r.A,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-50",children:i}),(0,a.jsx)("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400 whitespace-pre-wrap",children:n})]})]}),(0,a.jsxs)("div",{className:"mt-6 flex justify-end gap-3",children:[(0,a.jsx)("button",{onClick:t,className:"rounded-lg border border-zinc-300 px-4 py-2 text-sm font-medium text-zinc-700 transition-colors hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:l}),(0,a.jsx)("button",{onClick:()=>{s(),t()},className:`rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors ${(()=>{switch(d){case"danger":default:return"bg-red-600 hover:bg-red-700 dark:bg-red-600 dark:hover:bg-red-700";case"warning":return"bg-amber-600 hover:bg-amber-700 dark:bg-amber-600 dark:hover:bg-amber-700";case"info":return"bg-blue-600 hover:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-700"}})()}`,children:c})]})]})}):null}},5804:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]])},5979:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},6539:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},7058:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]])},7069:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},7545:(e,t,s)=>{"use strict";s.d(t,{IssuesClient:()=>Q});var a=s(2638),r=s(6702),i=s(7787),n=s(2283),c=s(5979),l=s(1794),d=s(6748);let o=(0,d.A)("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);var x=s(5050),p=s(3503),h=s(5804),u=s(9349),m=s(7058),b=s(8317),z=s(737),k=s(7609),j=s(3183),g=s(7069),v=s(7653);let f=(0,d.A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var y=s(2771),N=s(592),w=s(4545),_=s(3203),A=s(8702);let C=(0,d.A)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var S=s(1015),P=s(6539),M=s(6253),E=s.n(M),$=s(6738),T=s(3831),D=s(1422),O=s(5789),F=s(4811);function L({completed:e,total:t,size:s=16,strokeWidth:r=2,className:i=""}){if(0===t)return null;let n=t>0?e/t*100:0,c=e===t,l=(s-r)/2,d=2*Math.PI*l,o=c?"stroke-emerald-500":e>0?"stroke-blue-500":"stroke-zinc-300 dark:stroke-zinc-600";return(0,a.jsxs)("div",{className:`flex items-center gap-1.5 ${i}`,children:[(0,a.jsxs)("svg",{width:s,height:s,className:"transform -rotate-90",children:[(0,a.jsx)("circle",{cx:s/2,cy:s/2,r:l,fill:"none",strokeWidth:r,className:"stroke-zinc-200 dark:stroke-zinc-700"}),(0,a.jsx)("circle",{cx:s/2,cy:s/2,r:l,fill:"none",strokeWidth:r,strokeLinecap:"round",strokeDasharray:d,strokeDashoffset:d-n/100*d,className:`${o} transition-all duration-300`})]}),(0,a.jsxs)("span",{className:`text-xs tabular-nums ${c?"text-emerald-600 dark:text-emerald-400":"text-zinc-500"}`,children:[e,"/",t]})]})}function I({priority:e,className:t=""}){let s=4===e?"fill-orange-500":"fill-zinc-500 dark:fill-zinc-400",r="fill-zinc-200 dark:fill-zinc-700";return(0,a.jsxs)("svg",{className:`h-4 w-4 ${t}`,viewBox:"0 0 16 16",fill:"none",children:[(0,a.jsx)("rect",{x:"3",y:"2",width:"10",height:"2",rx:"0.5",className:e>=4?s:r}),(0,a.jsx)("rect",{x:"3",y:"5.5",width:"10",height:"2",rx:"0.5",className:e>=3?s:r}),(0,a.jsx)("rect",{x:"3",y:"9",width:"10",height:"2",rx:"0.5",className:e>=2?s:r}),(0,a.jsx)("rect",{x:"3",y:"12.5",width:"10",height:"2",rx:"0.5",className:e>=1?s:r})]})}let R=[{value:"open",label:"Open",icon:(0,a.jsx)(n.A,{className:"h-4 w-4",strokeWidth:2}),color:"text-zinc-400"},{value:"in_progress",label:"In Progress",icon:(0,a.jsx)("div",{className:"h-4 w-4 rounded-full border-2 border-yellow-500 border-r-transparent"}),color:"text-yellow-500"},{value:"blocked",label:"Blocked",icon:(0,a.jsx)(c.A,{className:"h-4 w-4"}),color:"text-red-500"},{value:"closed",label:"Closed",icon:(0,a.jsx)(l.A,{className:"h-4 w-4"}),color:"text-blue-500"},{value:"deferred",label:"Deferred",icon:(0,a.jsx)(o,{className:"h-4 w-4"}),color:"text-zinc-400"}],B=Object.fromEntries(R.map(e=>[e.value,e])),q=R[0],H=[{value:0,label:"No priority"},{value:4,label:"Urgent"},{value:3,label:"High"},{value:2,label:"Medium"},{value:1,label:"Low"}],U=[{value:"task",label:"Task",icon:(0,a.jsx)(x.A,{className:"h-4 w-4"}),color:"text-zinc-400"},{value:"bug",label:"Bug",icon:(0,a.jsx)(p.A,{className:"h-4 w-4"}),color:"text-red-500"},{value:"feature",label:"Feature",icon:(0,a.jsx)(h.A,{className:"h-4 w-4"}),color:"text-violet-500"},{value:"epic",label:"Epic",icon:(0,a.jsx)(u.A,{className:"h-4 w-4"}),color:"text-indigo-500"},{value:"chore",label:"Chore",icon:(0,a.jsx)(m.A,{className:"h-4 w-4"}),color:"text-zinc-400"}],V=Object.fromEntries(U.map(e=>[e.value,e]));function K({trigger:e,options:t,value:s,onChange:n,renderOption:c,className:l=""}){let[d,o]=(0,r.useState)(!1),[x,p]=(0,r.useState)(!1),[h,u]=(0,r.useState)({top:0,left:0}),m=(0,r.useRef)(null),z=(0,r.useRef)(null);(0,r.useEffect)(()=>{p(!0)},[]),(0,r.useEffect)(()=>{if(d&&m.current){let e=m.current.getBoundingClientRect(),t=window.innerHeight-e.bottom,s=e.top;u({top:t<200&&s>t?e.top+window.scrollY-200-4:e.bottom+window.scrollY+4,left:e.left+window.scrollX})}},[d]),(0,r.useEffect)(()=>{function e(e){let t=e.target;m.current&&!m.current.contains(t)&&z.current&&!z.current.contains(t)&&o(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let k=d&&x&&(0,a.jsx)("div",{ref:z,className:"fixed z-99999 min-w-[200px] rounded-lg border border-zinc-200 bg-white py-1 shadow-lg dark:border-zinc-700 dark:bg-zinc-800",style:{top:h.top,left:h.left},children:t.map(e=>(0,a.jsxs)("button",{onClick:t=>{t.stopPropagation(),n(e.value),o(!1)},className:"w-full px-3 py-1.5 text-left text-sm hover:bg-zinc-100 dark:hover:bg-zinc-700 flex items-center justify-between",children:[c(e,e.value===s),e.value===s&&(0,a.jsx)(b.A,{className:"h-4 w-4 text-zinc-500"})]},String(e.value)))});return(0,a.jsxs)("div",{className:`relative ${l}`,children:[(0,a.jsx)("button",{ref:m,onClick:e=>{e.stopPropagation(),o(!d)},className:"flex items-center",children:e}),x&&(0,i.createPortal)(k,document.body)]})}function J({value:e,onChange:t,size:s="sm"}){let r=B[e]||q;return(0,a.jsx)(K,{trigger:(0,a.jsx)("span",{className:`${r.color} hover:opacity-70 transition-opacity`,children:"sm"===s?(0,a.jsx)("span",{className:"sm"===s?"h-[14px] w-[14px]":"h-4 w-4",children:r.icon}):(0,a.jsxs)("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800 ${r.color}`,children:[r.icon,(0,a.jsx)("span",{className:"text-sm",children:r.label}),(0,a.jsx)(z.A,{className:"h-3 w-3 ml-1 text-zinc-400"})]})}),options:R,value:e,onChange:t,renderOption:e=>{let t=B[e.value]||q;return(0,a.jsxs)("span",{className:`flex items-center gap-2 ${t.color}`,children:[t.icon,(0,a.jsx)("span",{children:e.label})]})}})}function Y({value:e,onChange:t,size:s="sm"}){let r=H.find(t=>t.value===e)?.label||"No priority";return(0,a.jsx)(K,{trigger:"sm"===s?(0,a.jsx)("span",{className:"hover:opacity-70 transition-opacity",children:(0,a.jsx)(I,{priority:e})}):(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800 text-zinc-700 dark:text-zinc-300",children:[(0,a.jsx)(I,{priority:e}),(0,a.jsx)("span",{className:"text-sm",children:r}),(0,a.jsx)(z.A,{className:"h-3 w-3 ml-1 text-zinc-400"})]}),options:H,value:e,onChange:t,renderOption:e=>(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)(I,{priority:e.value}),(0,a.jsx)("span",{className:4===e.value?"text-orange-500":"",children:e.label})]})})}function W({value:e,onChange:t}){let s=V[e]||U[0];return(0,a.jsx)(K,{trigger:(0,a.jsxs)("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800 ${s.color}`,children:[s.icon,(0,a.jsx)("span",{className:"text-sm",children:s.label}),(0,a.jsx)(z.A,{className:"h-3 w-3 ml-1 text-zinc-400"})]}),options:U,value:e,onChange:t,renderOption:e=>{let t=V[e.value];return(0,a.jsxs)("span",{className:`flex items-center gap-2 ${t?.color}`,children:[t?.icon,(0,a.jsx)("span",{children:e.label})]})}})}function X({value:e,onChange:t,projects:s}){let r=s.map(e=>({value:e.project_path,label:e.name||e.project_path.split("/").pop()||e.project_path})),i=r.find(t=>t.value===e)?.label||"Project";return(0,a.jsx)(K,{trigger:(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800 text-zinc-700 dark:text-zinc-300 whitespace-nowrap",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm truncate max-w-[150px]",children:i}),(0,a.jsx)(z.A,{className:"h-3 w-3 ml-1 text-zinc-400 shrink-0"})]}),options:r,value:e,onChange:t,renderOption:e=>(0,a.jsxs)("span",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 text-zinc-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.label})]})})}function Z({projects:e,currentProjectPath:t,additionalPaths:s,onAdd:r}){let i=new Set([t,...s]),n=e.filter(e=>!i.has(e.project_path));if(0===n.length)return null;let c=n.map(e=>({value:e.project_path,label:e.name||e.project_path.split("/").pop()||e.project_path}));return(0,a.jsx)(K,{trigger:(0,a.jsxs)("span",{className:"flex items-center gap-1 px-2 py-1 rounded-md border border-dashed border-zinc-300 dark:border-zinc-600 hover:bg-zinc-50 dark:hover:bg-zinc-800 text-zinc-500 dark:text-zinc-400 text-sm",children:[(0,a.jsx)(j.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:"Add"})]}),options:c,value:"",onChange:r,renderOption:e=>(0,a.jsxs)("span",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 text-zinc-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.label})]})})}function G({issue:e,typeConfig:t,onClose:s,onUpdate:i,onSubtaskCreated:c,projects:d}){let[o,x]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),[u,m]=(0,r.useState)(!1),[b,P]=(0,r.useState)(e.title),[M,D]=(0,r.useState)(e.description||""),[F,I]=(0,r.useState)(e.details||""),[R,B]=(0,r.useState)(!1),[q,H]=(0,r.useState)(""),[U,V]=(0,r.useState)([]),[K,W]=(0,r.useState)(!1),[G,Q]=(0,r.useState)(!1),[ee,et]=(0,r.useState)([]),[es,ea]=(0,r.useState)(null),[er,ei]=(0,r.useState)(null),[en,ec]=(0,r.useState)(""),[el,ed]=(0,r.useState)(null),[eo,ex]=(0,r.useState)(!1),[ep,eh]=(0,r.useState)({}),[eu,em]=(0,r.useState)({}),[eb,ez]=(0,r.useState)(null),[ek,ej]=(0,r.useState)(""),[eg,ev]=(0,r.useState)(!1),[ef,ey]=(0,r.useState)(null),[eN,ew]=(0,r.useState)(!1),[e_,eA]=(0,r.useState)([]),[eC,eS]=(0,r.useState)(null),[eP,eM]=(0,r.useState)(!1),[eE,e$]=(0,r.useState)([]),[eT,eD]=(0,r.useState)(!1),[eO,eF]=(0,r.useState)(!1),[eL,eI]=(0,r.useState)(!1);(0,r.useEffect)(()=>{P(e.title),D(e.description||""),I(e.details||"")},[e.title,e.description,e.details]);let eR=async(t,s)=>{V(e=>e.map(e=>e.id===t?{...e,...s}:e));try{if(!(await fetch("/api/issues/update",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,...s})})).ok){let t=await fetch(`/api/issues/subtasks?parentId=${e.id}`),s=await t.json();s.success&&V(s.issues||[])}}catch(e){console.error("Failed to update subtask:",e)}},eB=(e,t,s)=>{ei({id:e,field:t}),ec(s||"")},eq=()=>{if(!er)return;let{id:e,field:t}=er;eR(e,{[t]:en}),ei(null),ec("")},eH=async()=>{if(el)try{let e=new URLSearchParams({id:el});(await fetch(`/api/issues/delete?${e}`,{method:"DELETE"})).ok&&(V(e=>e.filter(e=>e.id!==el)),ex(!1),ed(null),c())}catch(e){console.error("Failed to delete subtask:",e)}},eU=async()=>{if(ef)try{let e=new URLSearchParams({id:ef.id});(await fetch(`/api/issues/delete?${e}`,{method:"DELETE"})).ok&&(eh(e=>({...e,[ef.parentId]:e[ef.parentId].filter(e=>e.id!==ef.id)})),ew(!1),ey(null),c())}catch(e){console.error("Failed to delete child:",e)}};(0,r.useEffect)(()=>{!async function(){W(!0);try{let t=await fetch(`/api/issues/subtasks?parentId=${e.id}`),s=await t.json();s.success&&V(s.issues||[])}catch(e){console.error("Failed to load subtasks:",e)}finally{W(!1)}}()},[e.id]),(0,r.useEffect)(()=>{!async function(){if(!es)return;let e=U.find(e=>e.id===es);if(e&&0!==(e.child_count||0)&&!ep[es]){em(e=>({...e,[es]:!0}));try{let e=await fetch(`/api/issues/subtasks?parentId=${es}`),t=await e.json();t.success&&eh(e=>({...e,[es]:t.issues||[]}))}catch(e){console.error("Failed to load sub-subtasks:",e)}finally{em(e=>({...e,[es]:!1}))}}}()},[es,U]),(0,r.useEffect)(()=>{!async function(){if(!e.plan_id)return eS(null);eM(!0);try{let t=await fetch(`/api/plans/${e.plan_id}`),s=await t.json();s.success&&eS(s.plan)}catch(e){console.error("Failed to load plan:",e)}finally{eM(!1)}}()},[e.plan_id]),(0,r.useEffect)(()=>{!async function(){if(eO&&e.project_path){eD(!0);try{let t=await fetch(`/api/memory/list?projectPath=${encodeURIComponent(e.project_path)}`),s=await t.json();s.success&&e$(s.memories||[])}catch(e){console.error("Failed to load memories:",e)}finally{eD(!1)}}}()},[eO,e.project_path]);let eV=async()=>{if(q.trim()){Q(!0);try{if((await fetch("/api/issues/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.project_path,title:q.trim(),parentId:e.id,status:"open",priority:0,issueType:"task",dependsOn:ee.length>0?ee:void 0})})).ok){H(""),B(!1),et([]);let t=await fetch(`/api/issues/subtasks?parentId=${e.id}`),s=await t.json();s.success&&V(s.issues||[]),c()}}catch(e){console.error("Failed to create subtask:",e)}finally{Q(!1)}}},eK=async t=>{if(ek.trim()){ev(!0);try{if((await fetch("/api/issues/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.project_path,title:ek.trim(),parentId:t,status:"open",priority:0,issueType:"task",dependsOn:e_.length>0?e_:void 0})})).ok){ej(""),ez(null),eA([]);let e=await fetch(`/api/issues/subtasks?parentId=${t}`),s=await e.json();s.success&&eh(e=>({...e,[t]:s.issues||[]})),c()}}catch(e){console.error("Failed to create subtask:",e)}finally{ev(!1)}}},eJ=()=>{b.trim()&&b!==e.title&&i({title:b.trim()}),x(!1)};return(0,a.jsxs)("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 p-6 space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{className:"space-y-1 min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-zinc-400",children:[(0,a.jsx)("span",{className:"font-mono",children:e.short_id||e.id.slice(0,6)}),(0,a.jsx)("span",{children:"\xb7"}),(0,a.jsx)("span",{className:t.color,children:t.label})]}),o?(0,a.jsx)("input",{type:"text",value:b,onChange:e=>P(e.target.value),onBlur:eJ,onKeyDown:t=>{"Enter"===t.key&&eJ(),"Escape"===t.key&&(P(e.title),x(!1))},autoFocus:!0,className:"w-full text-lg font-semibold text-zinc-900 dark:text-zinc-100 bg-transparent border-b border-zinc-300 dark:border-zinc-600 outline-none focus:border-zinc-500"}):(0,a.jsx)("h2",{onClick:()=>x(!0),className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100 cursor-text hover:bg-zinc-50 dark:hover:bg-zinc-800 rounded px-1 -mx-1",children:e.title})]}),(0,a.jsx)("button",{onClick:s,className:"p-1 rounded text-zinc-400 hover:text-zinc-600 hover:bg-zinc-100 dark:hover:text-zinc-300 dark:hover:bg-zinc-700",children:(0,a.jsx)(g.A,{className:"h-4 w-4"})})]}),(eC||e.parent)&&(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-zinc-500 dark:text-zinc-400 bg-zinc-50 dark:bg-zinc-800/50 rounded-lg px-3 py-2",children:[(0,a.jsx)(v.A,{className:"h-3.5 w-3.5 text-zinc-400"}),(0,a.jsx)("span",{className:"text-zinc-400",children:e.project_path?.split("/").pop()}),eC&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{className:"h-3 w-3 text-zinc-300"}),(0,a.jsxs)(E(),{href:`/dashboard/plans?id=${eC.id}`,className:"flex items-center gap-1 hover:text-zinc-700 dark:hover:text-zinc-200",children:[(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"}),eC.title]})]}),e.parent&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{className:"h-3 w-3 text-zinc-300"}),(0,a.jsxs)("span",{className:"text-zinc-500 dark:text-zinc-400",children:["Subtask of ",e.parent.title]})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(J,{value:e.status,onChange:e=>i({status:e}),size:"md"}),(0,a.jsx)(Y,{value:e.priority,onChange:e=>i({priority:e}),size:"md"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400 mb-2 block",children:"Projects"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[(0,a.jsx)(X,{value:e.project_path,onChange:e=>i({project_path:e}),projects:d}),e.additional_project_paths&&e.additional_project_paths.length>0&&e.additional_project_paths.map(e=>(0,a.jsxs)("span",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800 text-zinc-700 dark:text-zinc-300 text-sm",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 text-zinc-400 shrink-0"}),(0,a.jsx)("span",{className:"truncate max-w-[150px]",children:e.split("/").pop()}),(0,a.jsx)("button",{onClick:()=>i({remove_project_path:e}),className:"text-zinc-400 hover:text-red-500",title:"Remove from issue",children:(0,a.jsx)(g.A,{className:"h-3.5 w-3.5"})})]},e)),(0,a.jsx)(Z,{projects:d,currentProjectPath:e.project_path,additionalPaths:e.additional_project_paths||[],onAdd:e=>i({add_project_path:e})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Description"}),p?(0,a.jsx)("textarea",{value:M,onChange:e=>D(e.target.value),onBlur:()=>{M!==(e.description||"")&&i({description:M}),h(!1)},onKeyDown:t=>{"Escape"===t.key&&(D(e.description||""),h(!1))},autoFocus:!0,rows:4,className:"w-full mt-1 text-sm text-zinc-600 dark:text-zinc-400 bg-transparent border border-zinc-200 dark:border-zinc-700 rounded-md p-2 outline-none focus:border-zinc-400 resize-none",placeholder:"Add a description..."}):(0,a.jsx)("div",{onClick:()=>h(!0),className:"mt-1 text-sm cursor-text hover:bg-zinc-50 dark:hover:bg-zinc-800 rounded px-2 py-1 -mx-2 min-h-8",children:e.description?(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-zinc-600 dark:text-zinc-400 [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs",children:(0,a.jsx)($.oz,{remarkPlugins:[T.A],children:e.description})}):(0,a.jsx)("p",{className:"text-zinc-400 italic",children:"Add a description..."})})]}),(0,a.jsxs)("div",{className:"border-t border-zinc-100 dark:border-zinc-800 pt-4",children:[(0,a.jsxs)("button",{onClick:()=>eI(!eL),className:"flex items-center gap-2 text-xs text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 w-full",children:[(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:"Implementation Details"}),e.details&&(0,a.jsxs)("span",{className:"text-zinc-400",children:["(",e.details.length," chars)"]}),(0,a.jsx)(z.A,{className:`h-3 w-3 ml-auto transition-transform ${eL?"rotate-180":""}`})]}),eL&&(0,a.jsx)("div",{className:"mt-3",children:u?(0,a.jsx)("textarea",{value:F,onChange:e=>I(e.target.value),onBlur:()=>{F!==(e.details||"")&&i({details:F}),m(!1)},onKeyDown:t=>{"Escape"===t.key&&(I(e.details||""),m(!1))},autoFocus:!0,rows:6,className:"w-full text-sm text-zinc-600 dark:text-zinc-400 bg-transparent border border-zinc-200 dark:border-zinc-700 rounded-md p-2 outline-none focus:border-zinc-400 resize-none font-mono",placeholder:"Add implementation details..."}):(0,a.jsx)("div",{onClick:()=>m(!0),className:"text-sm cursor-text hover:bg-zinc-50 dark:hover:bg-zinc-800 rounded px-2 py-1 -mx-2 min-h-8",children:e.details?(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-zinc-600 dark:text-zinc-400 [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs",children:(0,a.jsx)($.oz,{remarkPlugins:[T.A],children:e.details})}):(0,a.jsx)("p",{className:"text-zinc-400 italic",children:"Add implementation details..."})})})]}),(0,a.jsxs)("div",{className:"border-t border-zinc-100 dark:border-zinc-800 pt-4",children:[U.length>0&&(0,a.jsx)("div",{className:"mb-3 space-y-1",children:U.map(e=>{let t=es===e.id;return(0,a.jsxs)("div",{className:"group/subtask border border-zinc-100 dark:border-zinc-800 rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 py-2 px-3 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 cursor-pointer",onClick:()=>ea(t?null:e.id),children:[(0,a.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,a.jsx)(J,{value:e.status,onChange:t=>eR(e.id,{status:t}),size:"sm"})}),(0,a.jsx)("span",{className:"font-mono text-xs text-zinc-400",children:e.short_id}),(0,a.jsx)("span",{className:`text-sm flex-1 ${"closed"===e.status?"text-zinc-400 line-through":"text-zinc-700 dark:text-zinc-300"}`,children:e.title}),(0,a.jsx)(L,{completed:e.completed_count||0,total:e.child_count||0}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),ed(e.id),ex(!0)},className:"p-1 rounded text-zinc-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 opacity-0 group-hover/subtask:opacity-100 transition-opacity",children:(0,a.jsx)(N.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)(z.A,{className:`h-4 w-4 text-zinc-400 transition-transform ${t?"rotate-180":""}`})]}),t&&(0,a.jsxs)("div",{className:"px-3 pb-3 pt-1 space-y-3 border-t border-zinc-100 dark:border-zinc-800 bg-zinc-50/50 dark:bg-zinc-800/30",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Title"}),er?.id===e.id&&"title"===er.field?(0,a.jsx)("input",{type:"text",value:en,onChange:e=>ec(e.target.value),onBlur:eq,onKeyDown:e=>{"Enter"===e.key&&eq(),"Escape"===e.key&&(ei(null),ec(""))},autoFocus:!0,className:"w-full mt-1 text-sm font-medium text-zinc-900 dark:text-zinc-100 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded px-2 py-1 outline-none focus:border-zinc-400"}):(0,a.jsx)("p",{onClick:()=>eB(e.id,"title",e.title),className:"mt-1 text-sm font-medium text-zinc-900 dark:text-zinc-100 cursor-text hover:bg-white dark:hover:bg-zinc-800 rounded px-2 py-1 -mx-2",children:e.title})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Priority"}),(0,a.jsx)(Y,{value:e.priority,onChange:t=>eR(e.id,{priority:t}),size:"sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Description"}),er?.id===e.id&&"description"===er.field?(0,a.jsx)("textarea",{value:en,onChange:e=>ec(e.target.value),onBlur:eq,onKeyDown:e=>{"Escape"===e.key&&(ei(null),ec(""))},autoFocus:!0,rows:2,className:"w-full mt-1 text-sm text-zinc-600 dark:text-zinc-400 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded px-2 py-1 outline-none focus:border-zinc-400 resize-none",placeholder:"Add description..."}):(0,a.jsx)("div",{onClick:()=>eB(e.id,"description",e.description||""),className:"mt-1 text-sm cursor-text hover:bg-white dark:hover:bg-zinc-800 rounded px-2 py-1 -mx-2 min-h-6",children:e.description?(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-zinc-600 dark:text-zinc-400 [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs",children:(0,a.jsx)($.oz,{remarkPlugins:[T.A],children:e.description})}):(0,a.jsx)("span",{className:"italic text-zinc-400",children:"Add description..."})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Details"}),er?.id===e.id&&"details"===er.field?(0,a.jsx)("textarea",{value:en,onChange:e=>ec(e.target.value),onBlur:eq,onKeyDown:e=>{"Escape"===e.key&&(ei(null),ec(""))},autoFocus:!0,rows:3,className:"w-full mt-1 text-sm text-zinc-600 dark:text-zinc-400 bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded px-2 py-1 outline-none focus:border-zinc-400 resize-none font-mono",placeholder:"Add implementation details..."}):(0,a.jsx)("div",{onClick:()=>eB(e.id,"details",e.details||""),className:"mt-1 text-sm cursor-text hover:bg-white dark:hover:bg-zinc-800 rounded px-2 py-1 -mx-2 min-h-6",children:e.details?(0,a.jsx)("div",{className:"prose prose-sm prose-zinc dark:prose-invert max-w-none text-zinc-600 dark:text-zinc-400 [&_pre]:overflow-x-auto [&_pre]:bg-zinc-100 [&_pre]:dark:bg-zinc-800 [&_pre]:text-zinc-800 [&_pre]:dark:text-zinc-200 [&_pre]:p-3 [&_pre]:rounded-lg [&_code]:bg-zinc-100 [&_code]:dark:bg-zinc-800 [&_code]:text-zinc-800 [&_code]:dark:text-zinc-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-xs",children:(0,a.jsx)($.oz,{remarkPlugins:[T.A],children:e.details})}):(0,a.jsx)("span",{className:"italic text-zinc-400",children:"Add implementation details..."})})]}),(0,a.jsxs)("div",{className:"border-t border-zinc-200 dark:border-zinc-700 pt-3 mt-3",children:[(e.child_count||0)>0&&(0,a.jsxs)("span",{className:"text-xs text-zinc-400 font-medium",children:["Subtasks (",e.child_count,")"]}),eu[e.id]?(0,a.jsx)("p",{className:"text-xs text-zinc-400 mt-2",children:"Loading..."}):ep[e.id]?.length>0?(0,a.jsx)("div",{className:"mt-2 space-y-1",children:ep[e.id].map(t=>(0,a.jsxs)("div",{className:"group/child flex items-center gap-2 py-1.5 px-2 rounded hover:bg-white dark:hover:bg-zinc-800",children:[(0,a.jsx)(J,{value:t.status,onChange:s=>{eh(a=>({...a,[e.id]:a[e.id].map(e=>e.id===t.id?{...e,status:s}:e)})),eR(t.id,{status:s})},size:"sm"}),(0,a.jsx)("span",{className:"font-mono text-xs text-zinc-400",children:t.short_id}),(0,a.jsx)("span",{className:`text-xs flex-1 ${"closed"===t.status?"text-zinc-400 line-through":"text-zinc-600 dark:text-zinc-300"}`,children:t.title}),(0,a.jsx)("button",{onClick:s=>{s.stopPropagation(),ey({id:t.id,parentId:e.id}),ew(!0)},className:"p-1 rounded text-zinc-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 opacity-0 group-hover/child:opacity-100 transition-opacity",children:(0,a.jsx)(N.A,{className:"h-3 w-3"})})]},t.id))}):null,eb===e.id?(0,a.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.A,{className:"h-3.5 w-3.5 text-zinc-300 shrink-0"}),(0,a.jsx)("input",{type:"text",value:ek,onChange:e=>ej(e.target.value),onKeyDown:t=>{"Enter"===t.key&&ek.trim()&&eK(e.id),"Escape"===t.key&&(ej(""),ez(null),eA([]))},placeholder:"Subtask title",autoFocus:!0,className:"flex-1 text-xs bg-transparent border-b border-zinc-300 dark:border-zinc-600 outline-none text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 py-1"})]}),ep[e.id]?.length>0&&(0,a.jsxs)("div",{className:"pl-5 space-y-1",children:[(0,a.jsx)("span",{className:"text-xs text-zinc-500",children:"Blocked by:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:ep[e.id].filter(e=>"closed"!==e.status).map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>{eA(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},className:`px-1.5 py-0.5 text-xs rounded border transition-colors ${e_.includes(e.id)?"bg-amber-100 dark:bg-amber-900/30 border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-400":"bg-zinc-50 dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 text-zinc-500 hover:border-zinc-300"}`,children:e.short_id},e.id))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 pl-5",children:[(0,a.jsx)("button",{onClick:()=>eK(e.id),disabled:!ek.trim()||eg,className:"px-2 py-0.5 text-xs rounded bg-zinc-900 dark:bg-zinc-100 text-white dark:text-zinc-900 disabled:opacity-50",children:eg?"...":"Add"}),(0,a.jsx)("button",{onClick:()=>{ej(""),ez(null),eA([])},className:"text-xs text-zinc-400 hover:text-zinc-600",children:"Cancel"})]})]}):(0,a.jsxs)("button",{onClick:()=>ez(e.id),className:"mt-2 flex items-center gap-1 text-xs text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300",children:[(0,a.jsx)(j.A,{className:"h-3.5 w-3.5"}),"Add subtask"]})]})]})]},e.id)})}),R?(0,a.jsxs)("div",{className:"border border-zinc-200 dark:border-zinc-700 rounded-lg p-3 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(n.A,{className:"h-4 w-4 text-zinc-300 mt-0.5 shrink-0"}),(0,a.jsx)("input",{type:"text",value:q,onChange:e=>H(e.target.value),onKeyDown:e=>{"Enter"===e.key&&q.trim()&&eV(),"Escape"===e.key&&(H(""),B(!1),et([]))},placeholder:"epic"===e.issue_type||"feature"===e.issue_type?"Task title":"Subtask title",autoFocus:!0,className:"flex-1 text-sm bg-transparent border-none outline-none text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"})]}),U.length>0&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-zinc-500",children:"Blocked by (optional):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:U.filter(e=>"closed"!==e.status).map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>{et(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},className:`px-2 py-0.5 text-xs rounded border transition-colors ${ee.includes(e.id)?"bg-amber-100 dark:bg-amber-900/30 border-amber-300 dark:border-amber-700 text-amber-700 dark:text-amber-400":"bg-zinc-50 dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 text-zinc-600 dark:text-zinc-400 hover:border-zinc-300 dark:hover:border-zinc-600"}`,children:e.short_id},e.id))})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>{H(""),B(!1),et([])},className:"px-2 py-1 text-xs text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300",children:"Cancel"}),(0,a.jsx)("button",{onClick:eV,disabled:!q.trim()||G,className:"px-3 py-1 text-xs rounded-md bg-zinc-900 dark:bg-zinc-100 text-white dark:text-zinc-900 hover:bg-zinc-800 dark:hover:bg-zinc-200 disabled:opacity-50",children:G?"Adding...":"epic"===e.issue_type||"feature"===e.issue_type?"Add task":"Add subtask"})]})]}):(0,a.jsxs)("button",{onClick:()=>B(!0),className:"flex items-center gap-1.5 text-sm text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),"epic"===e.issue_type||"feature"===e.issue_type?"Add task":"Add subtask"]})]}),e.labels&&e.labels.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Labels"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:e.labels.map(e=>(0,a.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400",children:e.label},e.id))})]}),e.dependencies&&e.dependencies.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs text-zinc-400",children:"Blocked by"}),(0,a.jsx)("div",{className:"mt-2 space-y-1",children:e.dependencies.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-600 dark:text-zinc-400",children:[(0,a.jsx)("span",{className:"font-mono text-xs text-zinc-400",children:e.dependsOnShortId||e.dependsOnId.slice(0,6)}),(0,a.jsx)("span",{children:e.dependsOnTitle})]},e.id))})]}),(0,a.jsxs)("div",{className:"border-t border-zinc-100 dark:border-zinc-800 pt-4",children:[(0,a.jsxs)("button",{onClick:()=>eF(!eO),className:"flex items-center gap-2 text-xs text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 w-full",children:[(0,a.jsx)(w.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:"Project Memory"}),eE.length>0&&(0,a.jsxs)("span",{className:"text-zinc-400",children:["(",eE.length,")"]}),(0,a.jsx)(z.A,{className:`h-3 w-3 ml-auto transition-transform ${eO?"rotate-180":""}`})]}),eO&&(0,a.jsx)("div",{className:"mt-3 space-y-2",children:eT?(0,a.jsx)("p",{className:"text-xs text-zinc-400",children:"Loading..."}):0===eE.length?(0,a.jsx)("p",{className:"text-xs text-zinc-400 italic",children:"No memory items for this project"}):eE.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:["command"===e.category&&(0,a.jsx)(_.A,{className:"h-3.5 w-3.5 text-emerald-500 mt-0.5 shrink-0"}),"config"===e.category&&(0,a.jsx)(A.A,{className:"h-3.5 w-3.5 text-blue-500 mt-0.5 shrink-0"}),"note"===e.category&&(0,a.jsx)(C,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"font-mono text-zinc-500 dark:text-zinc-400",children:e.key}),(0,a.jsx)("p",{className:"text-zinc-600 dark:text-zinc-400 wrap-break-word",children:e.value})]})]},e.id))})]}),(e.created_in_session||e.completed_in_session)&&(0,a.jsxs)("div",{className:"flex items-center gap-4 pt-4 border-t border-zinc-100 dark:border-zinc-800 text-xs text-zinc-400",children:[e.created_in_session&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"}),"Created in session"]}),e.completed_in_session&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(l.A,{className:"h-3.5 w-3.5 text-green-500"}),"Completed in session"]})]}),(0,a.jsx)(O.T,{isOpen:eo,onClose:()=>{ex(!1),ed(null)},onConfirm:eH,title:"Delete Subtask",message:"Are you sure you want to delete this subtask? This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(O.T,{isOpen:eN,onClose:()=>{ew(!1),ey(null)},onConfirm:eU,title:"Delete Subtask",message:"Are you sure you want to delete this subtask? This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",variant:"danger"})]})}function Q({projects:e,initialProjectFilter:t,initialStatusFilter:s}){let i=(0,D.useRouter)(),n=(0,D.usePathname)(),c=(0,D.useSearchParams)(),[l,d]=(0,r.useState)([]),[o,p]=(0,r.useState)({open:0,in_progress:0,blocked:0,closed:0,deferred:0,total:0,by_priority:{},by_type:{}}),[h,u]=(0,r.useState)(!0),[m,b]=(0,r.useState)(""),[k,v]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),[w,_]=(0,r.useState)(!1),[A,C]=(0,r.useState)(null),[S,M]=(0,r.useState)(null),E=(0,r.useRef)(null),[$,T]=(0,r.useState)({title:"",description:"",projectPath:"",status:"open",priority:0,issueType:"task"}),[L,I]=(0,r.useState)(null),R=t||null;(0,r.useEffect)(()=>{function e(e){E.current&&!E.current.contains(e.target)&&y(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let q=(e,t)=>{let s=new URLSearchParams(c.toString());null===t||"all"===t?s.delete(e):s.set(e,t);let a=s.toString();i.push(`${n}${a?`?${a}`:""}`)};(0,r.useEffect)(()=>{H()},[R,s]),(0,r.useEffect)(()=>{let e=c.get("issue");e&&M(e)},[c]);let H=async()=>{try{u(!0);let e=new URLSearchParams({...R&&{projectPath:R},..."all"!==s&&{status:s}}),t=await fetch(`/api/issues/list?${e}`),a=await t.json();a.success&&(d(a.issues),p(a.stats))}catch(e){console.error("Failed to load issues:",e)}finally{u(!1)}},K=async()=>{if($.projectPath&&$.title)try{(await fetch("/api/issues/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:$.projectPath,title:$.title,description:$.description,status:$.status,priority:$.priority,issueType:$.issueType})})).ok&&(ee(),v(!1),H())}catch(e){console.error("Failed to create issue:",e)}},Z=async(e,t)=>{let s=t.add_project_path||t.remove_project_path;s||d(s=>s.map(s=>s.id===e?{...s,...t,updated_at:Date.now()}:s));try{(await fetch("/api/issues/update",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,...t})})).ok?s&&H():H()}catch(e){console.error("Failed to update issue:",e),H()}},Q=async()=>{if(A)try{let e=new URLSearchParams({id:A});(await fetch(`/api/issues/delete?${e}`,{method:"DELETE"})).ok&&(_(!1),C(null),S===A&&M(null),H())}catch(e){console.error("Failed to delete issue:",e)}},ee=()=>{T({title:"",description:"",projectPath:R||e[0]?.project_path||"",status:"open",priority:0,issueType:"task"}),I(null)},et=l.filter(e=>!e.parent&&(e.title.toLowerCase().includes(m.toLowerCase())||e.description&&e.description.toLowerCase().includes(m.toLowerCase())||e.short_id&&e.short_id.toLowerCase().includes(m.toLowerCase()))),es=e.find(e=>e.project_path===R),ea=es?.project_path.split("/").pop()||null;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold text-zinc-900 dark:text-zinc-50",children:"Issues"}),(0,a.jsxs)("button",{onClick:()=>{ee(),v(!0)},className:"inline-flex items-center gap-1.5 rounded-md bg-zinc-900 dark:bg-zinc-100 px-3 py-1.5 text-sm font-medium text-white dark:text-zinc-900 hover:bg-zinc-800 dark:hover:bg-zinc-200",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),"New"]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[(0,a.jsx)(P.A,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:m,onChange:e=>b(e.target.value),className:"w-full h-8 rounded-md border border-zinc-200 bg-white pl-8 pr-3 text-sm focus:border-zinc-300 focus:outline-none dark:border-zinc-700 dark:bg-zinc-900"})]}),(0,a.jsxs)("div",{className:"relative",ref:E,children:[(0,a.jsxs)("button",{onClick:()=>y(!f),className:"flex items-center gap-1 h-8 rounded-md border border-zinc-200 bg-white px-2.5 text-sm text-zinc-600 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-400",children:[(0,a.jsx)("span",{children:ea||"All"}),(0,a.jsx)(z.A,{className:"h-3.5 w-3.5"})]}),f&&(0,a.jsx)("div",{className:"absolute left-0 top-full z-50 mt-1 w-56 rounded-md border border-zinc-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-800",children:(0,a.jsxs)("div",{className:"max-h-64 overflow-y-auto py-1",children:[(0,a.jsx)("button",{onClick:()=>{q("project",null),y(!1)},className:`w-full px-3 py-1.5 text-left text-sm ${!t?"bg-zinc-100 dark:bg-zinc-700":"hover:bg-zinc-50 dark:hover:bg-zinc-700/50"}`,children:"All Projects"}),e.map(e=>(0,a.jsx)("button",{onClick:()=>{q("project",e.project_path),y(!1)},className:`w-full px-3 py-1.5 text-left text-sm truncate ${t===e.project_path?"bg-zinc-100 dark:bg-zinc-700":"hover:bg-zinc-50 dark:hover:bg-zinc-700/50"}`,children:e.project_path.split("/").pop()},e.project_path))]})})]}),(0,a.jsx)("div",{className:"flex items-center gap-1",children:[{value:"all",label:"All"},{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"closed",label:"Closed"},{value:"deferred",label:"Deferred"}].map(e=>(0,a.jsx)("button",{onClick:()=>q("status",e.value),className:`h-8 px-2.5 rounded-md text-sm transition-colors ${s===e.value?"bg-zinc-100 text-zinc-900 dark:bg-zinc-800 dark:text-zinc-100":"text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-200"}`,children:e.label},e.value))}),(t||"all"!==s||m)&&(0,a.jsx)("button",{onClick:()=>{b(""),q("project",null),q("status","all")},className:"h-8 px-2 text-sm text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",children:(0,a.jsx)(g.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 overflow-hidden",children:h?(0,a.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,a.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-zinc-200 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300"})}):0===et.length?(0,a.jsx)(F.p,{icon:(0,a.jsx)(x.A,{}),heading:m||"all"!==s?"No Issues Match Your Filters":"No Issues Yet",description:m||"all"!==s?"Try adjusting your search or filters":"Create your first issue to get started tracking your work"}):(0,a.jsx)("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800",children:et.map(e=>{B[e.status];let t=S===e.id;return(0,a.jsxs)("div",{className:`group flex items-center h-10 px-3 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 cursor-pointer transition-colors ${t?"bg-zinc-50 dark:bg-zinc-800/50":""} ${"closed"===e.status?"opacity-50":""}`,onClick:()=>M(t?null:e.id),children:[(0,a.jsx)("div",{className:"w-6 shrink-0",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(Y,{value:e.priority,onChange:t=>Z(e.id,{priority:t})})}),(0,a.jsx)("div",{className:"w-6 shrink-0",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(J,{value:e.status,onChange:t=>Z(e.id,{status:t})})}),(0,a.jsx)("span",{className:"w-20 shrink-0 text-xs text-zinc-400 dark:text-zinc-500 font-mono mr-2",children:e.short_id||e.id.slice(0,8)}),(0,a.jsx)("span",{className:`flex-1 text-sm truncate ${"closed"===e.status?"text-zinc-400 line-through":"text-zinc-900 dark:text-zinc-100"}`,children:e.title}),(0,a.jsx)("span",{className:"hidden sm:block w-20 text-xs text-zinc-400 text-right shrink-0",children:new Date(e.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),(0,a.jsx)("div",{className:"w-8 flex items-center justify-end opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),C(e.id),_(!0)},className:"p-1 rounded text-zinc-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",children:(0,a.jsx)(N.A,{className:"h-3.5 w-3.5"})})})]},e.id)})})}),S&&(()=>{let t=et.find(e=>e.id===S);if(!t)return null;let s=V[t.issue_type]||U[0];return(0,a.jsx)(G,{issue:t,typeConfig:s,onClose:()=>M(null),onUpdate:e=>Z(t.id,e),onSubtaskCreated:H,projects:e})})(),k&&(0,a.jsx)("div",{className:"fixed inset-0 z-100 flex items-center justify-center bg-black/50 p-4",children:(0,a.jsxs)("div",{className:"w-full max-w-2xl rounded-xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-700 dark:bg-zinc-900",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 rounded border border-zinc-200 dark:border-zinc-700 text-zinc-600 dark:text-zinc-400 text-xs font-medium",children:$.projectPath?$.projectPath.split("/").pop():"SAV"}),(0,a.jsx)("span",{className:"text-zinc-400",children:"›"}),(0,a.jsx)("span",{className:"text-zinc-700 dark:text-zinc-300",children:"New issue"})]}),(0,a.jsx)("button",{onClick:()=>{v(!1),ee()},className:"p-1 rounded text-zinc-400 hover:text-zinc-600 hover:bg-zinc-100 dark:hover:text-zinc-300 dark:hover:bg-zinc-700",children:(0,a.jsx)(g.A,{className:"h-4 w-4"})})]}),(0,a.jsxs)("div",{className:"p-4 space-y-4",children:[(0,a.jsx)("input",{type:"text",value:$.title,onChange:e=>T({...$,title:e.target.value}),placeholder:"Issue title",autoFocus:!0,className:"w-full text-lg font-medium text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 bg-transparent border-none outline-none"}),(0,a.jsx)("textarea",{value:$.description,onChange:e=>T({...$,description:e.target.value}),placeholder:"Add description...",rows:4,className:"w-full text-sm text-zinc-600 dark:text-zinc-400 placeholder:text-zinc-400 bg-transparent border-none outline-none resize-none"})]}),(0,a.jsx)("div",{className:"px-4 py-3 border-t border-zinc-200 dark:border-zinc-700",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(J,{value:$.status,onChange:e=>T({...$,status:e}),size:"md"}),(0,a.jsx)(Y,{value:$.priority,onChange:e=>T({...$,priority:e}),size:"md"}),(0,a.jsx)(W,{value:$.issueType,onChange:e=>T({...$,issueType:e})}),(0,a.jsx)(X,{value:$.projectPath,onChange:e=>T({...$,projectPath:e}),projects:e})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-3 px-4 py-3 border-t border-zinc-200 dark:border-zinc-700",children:[(0,a.jsx)("button",{onClick:()=>{v(!1),ee()},className:"px-3 py-1.5 text-sm text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-100",children:"Cancel"}),(0,a.jsx)("button",{onClick:K,disabled:!$.title||!$.projectPath,className:"px-4 py-1.5 rounded-md bg-zinc-900 dark:bg-zinc-100 text-sm font-medium text-white dark:text-zinc-900 hover:bg-zinc-800 dark:hover:bg-zinc-200 disabled:opacity-50 disabled:cursor-not-allowed",children:"Create issue"})]})]})}),(0,a.jsx)(O.T,{isOpen:w,onClose:()=>_(!1),onConfirm:Q,title:"Delete Issue",message:"Are you sure you want to delete this issue? This action cannot be undone.",confirmText:"Delete",cancelText:"Cancel",variant:"danger"})]})}},7609:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]])},7653:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]])},8317:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},8702:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},9349:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(6748).A)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]])}},e=>{e.O(0,[3358,9353,2655,8704,7358],()=>e(e.s=2362)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1719],{592:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(6748).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},737:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(6748).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},4752:(e,t,s)=>{Promise.resolve().then(s.bind(s,5807)),Promise.resolve().then(s.bind(s,5389)),Promise.resolve().then(s.t.bind(s,6253,23))},5389:(e,t,s)=>{"use strict";s.d(t,{SessionFilters:()=>d});var n=s(2638),a=s(1422),r=s(6539),i=s(7069),l=s(737),c=s(6702);let o=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"completed",label:"Completed"}];function d({projects:e,currentProjectId:t,currentStatus:s,currentSearch:d,hideStatusFilter:u}){let m=(0,a.useRouter)(),x=(0,a.usePathname)(),p=(0,a.useSearchParams)(),[h,g]=(0,c.useState)(!1),[v,f]=(0,c.useState)(d||""),z=(0,c.useRef)(null),b=(0,c.useRef)(null);(0,c.useEffect)(()=>{f(d||"")},[d]),(0,c.useEffect)(()=>{function e(e){z.current&&!z.current.contains(e.target)&&g(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let k=(0,c.useCallback)((e,t)=>{let s=new URLSearchParams(p.toString());null===t||"all"===t||""===t?s.delete(e):s.set(e,t);let n=s.toString();m.push(`${x}${n?`?${n}`:""}`)},[m,x,p]),j=e=>{f(e),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{k("search",e||null)},300)};(0,c.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let w=e.find(e=>e.id===t),N=w?w.name:null;return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(r.A,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,n.jsx)("input",{type:"text",value:v,onChange:e=>j(e.target.value),placeholder:"Search sessions...",className:"h-8 sm:h-9 w-48 sm:w-64 rounded-lg border border-zinc-200 bg-white pl-8 pr-3 text-sm text-zinc-900 placeholder:text-zinc-400 outline-none focus:border-zinc-400 focus:ring-1 focus:ring-zinc-400 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500 dark:focus:border-zinc-600"}),v&&(0,n.jsx)("button",{onClick:()=>j(""),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",children:(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"})})]}),(0,n.jsxs)("div",{className:"relative",ref:z,children:[(0,n.jsxs)("button",{onClick:()=>g(!h),className:"flex items-center gap-1.5 sm:gap-2 rounded-lg border border-zinc-200 bg-white px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-medium text-zinc-700 shadow-sm transition-all hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700/50",children:[(0,n.jsx)("span",{children:N||"All Projects"}),(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-zinc-500"})]}),h&&(0,n.jsx)("div",{className:"absolute left-0 top-full z-50 mt-2 w-64 rounded-lg border border-zinc-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-800",children:(0,n.jsxs)("div",{className:"max-h-80 overflow-y-auto p-1",children:[(0,n.jsx)("button",{onClick:()=>{k("projectId",null),g(!1)},className:`w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${!t?"bg-primary font-medium text-primary-foreground":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700/50"}`,children:"All Projects"}),e.map(e=>(0,n.jsxs)("button",{onClick:()=>{k("projectId",e.id),g(!1)},className:`w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${t===e.id?"bg-primary font-medium text-primary-foreground":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700/50"}`,children:[(0,n.jsx)("div",{className:"truncate",children:e.name}),e.source_path&&(0,n.jsx)("div",{className:"truncate text-xs text-zinc-500 dark:text-zinc-500",children:e.source_path})]},e.id))]})})]}),!u&&(0,n.jsx)("div",{className:"flex items-center gap-1.5 sm:gap-2",children:o.map(e=>(0,n.jsx)("button",{onClick:()=>k("status",e.value),className:`rounded-full px-2.5 sm:px-3 py-1 sm:py-1.5 text-[10px] sm:text-xs font-medium transition-all ${s===e.value?"bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900 shadow-sm":"bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700"}`,children:e.label},e.value))}),(t||"all"!==s||d)&&(0,n.jsxs)("button",{onClick:()=>{f(""),k("search",null),k("projectId",null),k("status","all")},className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:[(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})}},5807:(e,t,s)=>{"use strict";s.d(t,{SessionCardContent:()=>d});var n=s(2638),a=s(6702),r=s(1422),i=s(9349),l=s(5794),c=s(3627),o=s(4512);function d({sessionId:e,sessionName:t,sessionDescription:s,sessionStatus:a,projectNames:l,createdAt:d}){let m=(0,r.useRouter)(),x=[...new Set(l)],p=x.slice(0,2),h=x.length-2,g=e=>{e.preventDefault(),e.stopPropagation()},v=async(t,s)=>{await fetch(`/api/sessions/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:s})}),m.refresh()};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"absolute top-3 right-3 sm:top-4 sm:right-4 flex items-center gap-2",onClick:g,onMouseDown:g,children:[(0,n.jsx)(c.e,{sessionId:e,currentStatus:a}),(0,n.jsx)(o.A,{sessionId:e,sessionName:t,currentStatus:a})]}),(0,n.jsxs)("div",{className:"flex gap-3 sm:gap-4 pr-32 sm:pr-40",children:[(0,n.jsx)("div",{className:"flex h-9 w-9 sm:h-10 sm:w-10 shrink-0 items-center justify-center rounded-lg bg-accent",children:(0,n.jsx)(i.A,{className:"h-4 w-4 sm:h-5 sm:w-5 text-accent-foreground"})}),(0,n.jsxs)("div",{className:"space-y-1.5 min-w-0 flex-1",children:[(0,n.jsx)(u,{value:t,onSave:e=>v("name",e),className:"font-semibold text-zinc-900 dark:text-zinc-50"}),s?(0,n.jsx)(u,{value:s,onSave:e=>v("description",e),className:"text-sm text-zinc-600 dark:text-zinc-400",multiline:!0}):(0,n.jsx)(u,{value:"",placeholder:"Add description...",onSave:e=>v("description",e),className:"text-sm text-zinc-400 dark:text-zinc-500"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(e=>(0,n.jsx)("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-zinc-100 px-2 py-1 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e},e)),h>0&&(0,n.jsxs)("span",{className:"text-xs font-medium text-zinc-500",children:["+",h," more"]}),(0,n.jsx)("span",{className:"text-zinc-400",children:"•"}),(0,n.jsx)("span",{className:"text-xs text-zinc-500 shrink-0",children:new Date(d).toLocaleDateString()})]})]})]})]})}function u({value:e,placeholder:t,onSave:s,className:r,multiline:i}){let[c,o]=(0,a.useState)(!1),[d,u]=(0,a.useState)(e),[m,x]=(0,a.useState)(!1),p=(0,a.useRef)(null),h=(0,a.useRef)(null),g=e=>{e.preventDefault(),e.stopPropagation()},v=t=>{t.preventDefault(),t.stopPropagation(),o(!1);let n=d.trim();n&&n!==e?s(n):u(e)},f=t=>{t.stopPropagation(),"Enter"!==t.key||i?"Escape"===t.key&&(t.preventDefault(),u(e),o(!1)):(t.preventDefault(),p.current?.blur())};if(c){let e=`bg-zinc-100 dark:bg-zinc-800 rounded px-1 -mx-1 outline-none focus:ring-2 focus:ring-zinc-400 w-full ${r}`;return(0,n.jsx)("div",{ref:h,onClick:g,onMouseDown:g,children:i?(0,n.jsx)("textarea",{ref:p,value:d,onChange:e=>u(e.target.value),onBlur:v,onKeyDown:f,onClick:g,onMouseDown:g,rows:2,className:e}):(0,n.jsx)("input",{ref:p,type:"text",value:d,onChange:e=>u(e.target.value),onBlur:v,onKeyDown:f,onClick:g,onMouseDown:g,className:e})})}return(0,n.jsxs)("div",{className:"group flex items-center gap-1",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),onClick:g,onMouseDown:g,children:[(0,n.jsx)("span",{className:`${r} ${i?"line-clamp-2":"truncate"}`,children:e||t}),(0,n.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e),o(!0),setTimeout(()=>p.current?.focus(),0)},onMouseDown:g,className:`shrink-0 p-0.5 rounded text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-opacity ${m?"opacity-100":"opacity-0"}`,children:(0,n.jsx)(l.A,{className:"h-3 w-3"})})]})}},6539:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(6748).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])}},e=>{e.O(0,[3358,7306,6736,5602,2655,8704,7358],()=>e(e.s=4752)),_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 && !filename.startsWith('file:') && !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;
|