@ulpi/cli 0.1.10 → 0.1.11
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/dist/{chunk-F32YQRFR.js → chunk-GSFWS32F.js} +1 -1
- package/dist/{ci-QBXWR3GW.js → ci-RMMSML3A.js} +1 -1
- package/dist/{doctor-SRJIZM2T.js → doctor-ILXW63Q2.js} +1 -1
- package/dist/{history-UGYO7Z3U.js → history-TKPFJAL3.js} +1 -1
- package/dist/index.js +8 -8
- package/dist/portal/apps/portal/.next/BUILD_ID +1 -1
- package/dist/portal/apps/portal/.next/app-build-manifest.json +98 -98
- package/dist/portal/apps/portal/.next/app-path-routes-manifest.json +21 -21
- package/dist/portal/apps/portal/.next/build-manifest.json +2 -2
- package/dist/portal/apps/portal/.next/prerender-manifest.json +106 -106
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/billing/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/codemap/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/history/[sha]/transcript/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/history/page.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/history/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/loop/page.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/loop/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/[name]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/catalog/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/secrets/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/submissions/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/usage/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/memory/settings/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/memory/timeline/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/notifications/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/parallel/page.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/parallel/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/prd/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/repos/[id]/guards/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/repos/[id]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/repos/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/config/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/plan/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/queue/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/[id]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/new/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/pipelines/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sessions/[sessionId]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sessions/page.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sessions/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/github/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/installations/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/keys/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/members/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/orgs/new/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sprints/[batchId]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sprints/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/templates/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/_not-found.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/_not-found.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/auth/callback/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/auth/callback.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/auth/callback.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/billing.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/billing.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/codemap.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/codemap.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/dashboard.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/dashboard.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/history.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/history.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/jobs.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/jobs.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/loop.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/loop.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/mcps/catalog.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/catalog.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/secrets.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/secrets.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/submissions.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/submissions.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/usage.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/usage.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory/settings.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory/settings.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory/timeline.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory/timeline.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/memory.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/notifications.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/notifications.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/parallel.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/parallel.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/prd.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/prd.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/repos.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/repos.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/config.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/config.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/plan.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/plan.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/review/queue.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/queue.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/review.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules/new.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules/new.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules/pipelines.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules/pipelines.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/sessions.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/sessions.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/settings/github.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/github.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/installations.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/installations.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/keys.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/keys.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/members.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/members.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/orgs/new.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/orgs/new.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/skills.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/skills.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/sprints.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/sprints.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/templates.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/templates.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app-paths-manifest.json +21 -21
- package/dist/portal/apps/portal/.next/server/next-font-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/next-font-manifest.json +1 -1
- package/dist/portal/apps/portal/.next/server/pages/404.html +1 -1
- package/dist/portal/apps/portal/.next/server/pages/500.html +1 -1
- package/dist/portal/apps/portal/.next/server/pages-manifest.json +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/3958-eebe9ad88e40b2c1.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/{7525-d6350803a451284c.js → 7525-8d416b046f9add2a.js} +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/history/{page-264989cf873cd3de.js → page-0275ca43fdd64bf2.js} +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/jobs/[id]/page-dba3c6050ccf9243.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/loop/page-c3f658ffb8d7397b.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/page-afe7f7a5b78650f2.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/timeline/{page-30db4506366d09f4.js → page-4e3dd7e30a9946f0.js} +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/parallel/{page-85690140ff82dd58.js → page-49a26690ced20482.js} +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/sessions/{page-6b199747e9f587de.js → page-0b140fb8bbc53097.js} +1 -1
- package/dist/portal/apps/portal/package.json +1 -0
- package/dist/portal/package.json +1 -1
- package/dist/{start-DWZHVBUO.js → start-BRB2XW3T.js} +1 -1
- package/dist/{update-IBPDEBEK.js → update-HBWHFHUW.js} +1 -1
- package/dist/{version-checker-XKFQNN3I.js → version-checker-BQP7DVQ4.js} +1 -1
- package/package.json +6 -6
- package/dist/portal/apps/portal/.next/static/chunks/3958-9975252472a218aa.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/jobs/[id]/page-b0ac38d08f846f50.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/loop/page-faeaacd95742c754.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/page-79f977cd348c57ae.js +0 -1
- /package/dist/portal/apps/portal/.next/static/{02AzZdYDA5HVAwITp37Ql → SG8tUyluXEA9HzEKtf-oo}/_buildManifest.js +0 -0
- /package/dist/portal/apps/portal/.next/static/{02AzZdYDA5HVAwITp37Ql → SG8tUyluXEA9HzEKtf-oo}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3845],{452:(e,t,s)=>{Promise.resolve().then(s.bind(s,9896))},4632:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var r=s(8111);function a(){return(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function n(e){let{icon:t,title:s,description:n,action:l,className:i=""}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(i),children:[(0,r.jsx)("div",{className:"mb-4",children:null!=t?t:(0,r.jsx)(a,{})}),(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:s}),n&&(0,r.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:n}),l&&(0,r.jsx)("button",{onClick:l.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:l.label})]})}},4736:(e,t,s)=>{"use strict";var r=s(1504);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},9896:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>L});var r=s(8111),a=s(5271),n=s(4736),l=s(3446),i=s(4401),c=s(5935),o=s.n(c),d=s(3951),x=s(250);let m={A:"bg-emerald-500/15 text-emerald-400",M:"bg-blue-500/15 text-blue-400",D:"bg-red-500/15 text-red-400",R:"bg-amber-500/15 text-amber-400",C:"bg-violet-500/15 text-violet-400"},h={A:"Added",M:"Modified",D:"Deleted",R:"Renamed",C:"Copied"};function u(e){let{entry:t}=e;return(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[t.hasSession&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-cyan-500/15 px-2 py-0.5 text-[10px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-400",children:"Review"})]})}function p(e){let{turn:t}=e,[s,n]=(0,a.useState)(!1),l="tool_use"===t.type?t.toolInput:t.content,i=null!=l&&l.length>2e3,c=i?l.slice(0,2e3):l;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{onClick:()=>n(!s),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium text-cyan-400 bg-cyan-500/10 border border-cyan-500/15 transition-colors hover:bg-cyan-500/15",children:[(0,r.jsx)("svg",{className:"h-2.5 w-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3"})}),"tool_use"===t.type?t.toolName:"Result",(0,r.jsx)("svg",{className:"h-2.5 w-2.5 text-cyan-500/60 transition-transform ".concat(s?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s&&c&&(0,r.jsxs)("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap font-mono text-[10px] text-gray-500 max-h-24 overflow-y-auto rounded border border-white/[0.03] bg-surface-950 p-2",children:[c,i&&"\n... (truncated)"]})]})}function f(e){let{turn:t}=e;if("tool_use"===t.type||"tool_result"===t.type)return(0,r.jsx)(p,{turn:t});let s="human"===t.type;return(0,r.jsxs)("div",{className:"rounded-lg border-l-2 px-3 py-2 ".concat(s?"border-l-primary-500 bg-surface-800/40 border border-l-2 border-white/[0.03]":"border-l-violet-500 bg-surface-900/60 border border-l-2 border-white/[0.04]"),children:[(0,r.jsx)("span",{className:"text-[10px] font-medium ".concat(s?"text-primary-400":"text-violet-400"),children:s?"You":"Assistant"}),(0,r.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap text-[10px] text-gray-400 leading-relaxed max-h-20 overflow-y-auto",children:t.content.length>500?t.content.slice(0,500)+"...":t.content})]})}function g(e){let{sha:t}=e,{transcript:s,loading:n}=(0,i.oI)(t),[l,c]=(0,a.useState)(!1);if(n)return(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-3",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border border-primary-500 border-t-transparent"}),"Loading transcript..."]})});if(!s)return null;let d=(0,x.K9)(s);if(!d||0===d.length)return null;let m=d.filter(e=>"human"===e.type).length,h=d.filter(e=>"assistant"===e.type).length,u=d.filter(e=>"tool_use"===e.type||"tool_result"===e.type).length;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>c(!l),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300",children:"Transcript"}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[d.length," turn",1!==d.length?"s":""," ","(",m," user, ",h," assistant, ",u," tool)"]})]}),(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-600 transition-transform ".concat(l?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),l&&(0,r.jsxs)("div",{className:"border-t border-white/[0.04] px-4 py-3 max-h-96 overflow-y-auto space-y-1.5",children:[d.slice(0,50).map((e,t)=>(0,r.jsx)(f,{turn:e},t)),d.length>50&&(0,r.jsxs)("p",{className:"py-2 text-center text-[10px] text-gray-600",children:["Showing 50 of ",d.length," turns."," ",(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-primary-400 hover:text-primary-300",children:"View full transcript"})]})]})]})}function j(e){var t;let{plan:s}=e,[n,l]=(0,a.useState)(!1),i=null==(t=s.decision)?void 0:t.behavior,c="approve"===i?"approved":"deny"===i?"denied":null;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>l(!n),className:"flex w-full items-center justify-between px-3 py-2.5 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25Z"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300 truncate",children:s.title||s.slug||"Review Plan"}),c&&(0,r.jsx)("span",{className:"rounded-full px-1.5 py-px text-[9px] font-medium ".concat("approve"===i?"text-emerald-400 bg-emerald-500/15":"deny"===i?"text-red-400 bg-red-500/15":"text-amber-400 bg-amber-500/15"),children:c})]}),(0,r.jsx)("svg",{className:"h-3 w-3 text-gray-600 transition-transform shrink-0 ".concat(n?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),n&&s.plan&&(0,r.jsx)("div",{className:"border-t border-white/[0.04] px-3 py-3 max-h-64 overflow-y-auto",children:(0,r.jsx)("pre",{className:"whitespace-pre-wrap text-[11px] text-gray-400 leading-relaxed font-mono",children:s.plan})})]})}function y(e){let{sha:t}=e,s=(0,l.yC)(),{entry:n,loading:c,refresh:x}=(0,i.O4)(t),{enrichmentStatus:p,refresh:f}=(0,i.hh)(),[y,b]=(0,a.useState)(!1),[v,N]=(0,a.useState)(null),w=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(y)return w.current=setInterval(()=>{f()},2e3),()=>{w.current&&clearInterval(w.current)}},[y,f]),(0,a.useEffect)(()=>{if(y&&p&&("done"===p.status||"error"===p.status||"idle"===p.status)){if(b(!1),"error"===p.status){var e;N(null!=(e=p.error)?e:"Enrichment failed")}x()}},[p,y,x]);let k=(0,a.useCallback)(async()=>{if(!y){b(!0),N(null);try{await (0,i.W7)(s,t),f()}catch(e){N(e instanceof Error?e.message:"Enrichment failed"),b(!1)}}},[s,t,y,f]);if(c)return(0,r.jsx)(d.G,{rows:4});if(!n)return(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Entry not found"}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-600",children:["Could not load entry for SHA ",t.slice(0,8),"."]})]});let C=n.sha.slice(0,8);return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono text-sm font-medium text-amber-400",children:C}),(0,r.jsx)(u,{entry:n})]}),n.subject&&(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-200",children:n.subject})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[n.hasTranscript&&(0,r.jsxs)(o(),{href:"/history/".concat(t,"/transcript"),className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-800 px-2.5 py-1.5 text-[11px] font-medium text-gray-300 transition-colors hover:bg-surface-750 hover:text-white",children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})}),"Full Transcript"]}),!n.hasEnrichment&&(0,r.jsx)("button",{onClick:()=>void k(),disabled:y,className:"inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-semibold text-white transition-colors disabled:cursor-not-allowed ".concat(y?"bg-primary-500/60":"bg-primary-500 hover:bg-primary-600"),children:y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-white border-t-transparent"}),(null==p?void 0:p.status)==="enriching"&&p.total>0?"".concat(p.completed,"/").concat(p.total):"Enriching..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})}),"Enrich with AI"]})})]})]}),v&&(0,r.jsx)("div",{className:"mt-3 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:v})]}),(0,r.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-xs shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Date "}),(0,r.jsx)("span",{className:"text-gray-300",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}(n.date)})]}),null!=n.filesChanged&&n.filesChanged>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Files "}),(0,r.jsxs)("span",{className:"text-gray-300",children:[n.filesChanged," changed",null!=n.insertions&&(0,r.jsxs)("span",{className:"ml-1.5 text-emerald-400",children:["+",n.insertions]}),null!=n.deletions&&(0,r.jsxs)("span",{className:"ml-1 text-red-400",children:["-",n.deletions]})]})]}),n.duration&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Duration "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.duration})]}),n.branch&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Branch "}),(0,r.jsx)("span",{className:"font-mono text-gray-300",children:n.branch})]}),n.authorName&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Author "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.authorName})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"SHA "}),(0,r.jsx)("span",{className:"font-mono text-gray-400",children:n.sha})]})]}),n.tags&&n.tags.length>0&&(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-1 shrink-0",children:n.tags.map(e=>(0,r.jsx)("span",{className:"rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-500",children:e},e))}),n.enrichment&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-violet-500/10 bg-violet-500/[0.04] p-4 shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-violet-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"})}),(0,r.jsx)("h4",{className:"text-xs font-semibold text-violet-300",children:"AI Enrichment"}),n.enrichment.complexity&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:n.enrichment.complexity})]}),n.enrichment.summary&&(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.enrichment.summary}),(n.enrichment.intent||n.enrichment.outcome)&&(0,r.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[n.enrichment.intent&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Intent"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.intent})]}),n.enrichment.outcome&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Outcome"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.outcome})]})]}),n.enrichment.insights&&n.enrichment.insights.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Insights"}),n.enrichment.insights.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-violet-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.challenges&&n.enrichment.challenges.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Challenges"}),n.enrichment.challenges.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-amber-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.recommendations&&n.enrichment.recommendations.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Recommendations"}),n.enrichment.recommendations.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-emerald-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]})]}),!n.enrichment&&n.summary&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-white/[0.04] bg-surface-800/30 p-4 shrink-0",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-gray-500 mb-1.5",children:"Summary"}),(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.summary})]}),n.files&&n.files.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Files Changed (",n.files.length,")"]}),(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden divide-y divide-white/[0.03]",children:n.files.map(e=>{var t,s,a,n;let l=null!=(t=m[e.status])?t:"bg-gray-500/15 text-gray-400",i="number"==typeof e.additions||"number"==typeof e.deletions,c=null!=(s=e.additions)?s:0,o=null!=(a=e.deletions)?a:0,d=c+o,x=Math.min(d,30),u=d>0?Math.round(c/d*x):0;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,r.jsx)("span",{className:"inline-flex w-5 items-center justify-center rounded px-0.5 py-px text-[9px] font-medium ".concat(l),children:e.status}),(0,r.jsx)("span",{className:"truncate font-mono text-[11px] text-gray-400 flex-1 min-w-0",title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:e.oldPath?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-600",children:e.oldPath}),(0,r.jsx)("span",{className:"text-gray-600",children:" → "}),e.path]}):e.path}),i&&(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[c>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-emerald-400",children:["+",c]}),o>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-red-400",children:["-",o]}),d>0&&(0,r.jsxs)("span",{className:"inline-flex gap-px",children:[Array.from({length:u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-emerald-500/70"},"a".concat(t))),Array.from({length:x-u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-red-500/70"},"d".concat(t)))]})]}),!i&&(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[9px] text-gray-600",children:null!=(n=h[e.status])?n:e.status})]},e.path)})})]}),n.reviewPlans&&n.reviewPlans.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Review Plans (",n.reviewPlans.length,")"]}),(0,r.jsx)("div",{className:"space-y-2",children:n.reviewPlans.map((e,t)=>(0,r.jsx)(j,{plan:e},e.slug||t))})]}),n.hasTranscript&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsx)(g,{sha:t}),(0,r.jsx)("div",{className:"mt-2 text-right",children:(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-[10px] text-primary-400 hover:text-primary-300 transition-colors",children:"Open full transcript page"})})]})]})}var b=s(4632);function v(e){let{onInitialized:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{d(!0),m(null);try{await (0,i.xy)(s,{collectReviewPlans:n}),t()}catch(e){m(e instanceof Error?e.message:"Failed to initialize history")}finally{d(!1)}},[s,n,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-surface-900 border border-white/[0.06]",children:(0,r.jsx)("svg",{className:"h-8 w-8 text-primary-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),(0,r.jsx)("h2",{className:"mt-5 text-lg font-semibold text-white",children:"Initialize History"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-400 max-w-sm mx-auto",children:"Set up the shadow branch to track your coding session history. This creates a dedicated git branch for structured records of each session."}),(0,r.jsx)("div",{className:"mt-6 flex items-center justify-center gap-2",children:(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:e=>c(e.target.checked),className:"h-3.5 w-3.5 rounded border-white/20 bg-surface-800 text-primary-500 focus:ring-primary-500/30 focus:ring-offset-0"}),(0,r.jsx)("span",{className:"text-xs text-gray-400",children:"Collect review plans"})]})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:o,className:"mt-5 inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[o?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})}),"Initialize History"]})]})})}function N(e){let{onBackfilled:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(null),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{c(!0),m(null);try{let e=await (0,i.RK)(s,{limit:50});d({captured:e.captured,skipped:e.skipped}),e.captured>0&&t()}catch(e){m(e instanceof Error?e.message:"Backfill failed")}finally{c(!1)}},[s,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)(b.p,{title:"No history entries yet",description:"History is initialized but empty. Backfill from recent commits to populate your timeline.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),o&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-4 py-2 text-xs text-emerald-400",children:["Captured ",o.captured," entries, skipped ",o.skipped,"."]}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:n,className:"mt-5 inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[n?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12M12 16.5V3"})}),"Backfill Recent Commits"]})]})})}function w(e){let{entry:t,selected:s,onSelect:a}=e;return(0,r.jsxs)("button",{onClick:a,className:"w-full text-left rounded-lg px-3 py-2.5 transition-colors ".concat(s?"bg-primary-500/10 border border-primary-500/30":"border border-transparent hover:bg-white/[0.03]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"font-mono text-xs text-amber-400 shrink-0",children:t.shortSha||t.sha.slice(0,7)}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600 shrink-0",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(t.date)})]}),t.filesChanged>0&&(0,r.jsxs)("span",{className:"text-[10px] text-gray-600 shrink-0",children:[t.filesChanged,"f"]})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-300 truncate",children:t.subject||"No subject"}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[t.hasSession&&(0,r.jsx)("span",{className:"rounded-full bg-cyan-500/15 px-1.5 py-px text-[9px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-1.5 py-px text-[9px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-px text-[9px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"rounded-full bg-amber-500/15 px-1.5 py-px text-[9px] font-medium text-amber-400",children:"Review"})]})]})}function k(e){let{refreshKey:t}=e,s=(0,l.yC)(),{enrichmentStatus:n,refresh:c}=(0,i.hh)();if((0,a.useEffect)(()=>{t>0&&c()},[t]),(0,a.useEffect)(()=>{if((null==n?void 0:n.status)!=="enriching")return;let e=setInterval(()=>void c(),3e3);return()=>clearInterval(e)},[null==n?void 0:n.status,c]),!n||"idle"===n.status)return null;let o=async()=>{await (0,i.J)(s),c()};if("enriching"===n.status){let e=n.total>0?Math.round(n.completed/n.total*100):0;return(0,r.jsxs)("div",{className:"rounded-lg border border-primary-500/20 bg-primary-500/[0.06] p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary-400",children:"Enriching..."})]}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-500",children:[n.completed," / ",n.total," (",e,"%)"]})]}),n.total>0&&(0,r.jsx)("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-surface-800",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-primary-500 transition-all duration-500",style:{width:"".concat(e,"%")}})})]})}if("done"===n.status)return(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs text-emerald-400",children:["Enrichment complete. ",n.completed," enriched",n.failed>0&&", ".concat(n.failed," failed"),"."]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-emerald-400/70 hover:text-emerald-400 transition-colors",children:"Dismiss"})]});if("error"===n.status){var d;return(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs text-red-400",children:["Enrichment failed: ",null!=(d=n.error)?d:"Unknown error"]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-red-400/70 hover:text-red-400 transition-colors",children:"Dismiss"})]})}return null}function C(){var e,t,s;let c=(0,l.yC)(),o=(0,n.useRouter)(),x=(0,n.useSearchParams)(),m=x?x.get("sha"):null,{stats:h}=(0,i.zg)(),[u,p]=(0,a.useState)(null),{entries:f,loading:g,error:j,refresh:b}=(0,i._q)(null!=u?u:void 0),[v,N]=(0,a.useState)(!1),[C,L]=(0,a.useState)(!1),[S,M]=(0,a.useState)(!1),[E,A]=(0,a.useState)(0),R=f.length,B=(null==h||null==(e=h.dateRange)?void 0:e.from)&&(null==h||null==(t=h.dateRange)?void 0:t.to)?function(e,t){let s=new Date(e),r=new Date(t);if(isNaN(s.getTime())||isNaN(r.getTime()))return"";let a={month:"short",day:"numeric",year:"numeric"};return"".concat(s.toLocaleDateString(void 0,a)," - ").concat(r.toLocaleDateString(void 0,a))}(h.dateRange.from,h.dateRange.to):null,P=h?Math.round(h.enrichmentCoverage):null,W=h?Math.round(10*h.avgFilesChanged)/10:null,H=null!=(s=null==h?void 0:h.tagCounts)?s:{},I=(0,a.useMemo)(()=>Object.entries(H).sort((e,t)=>{let[,s]=e,[,r]=t;return r-s}).map(e=>{let[t]=e;return t}),[H]),[D,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{m&&T(!0)},[m]);let Z=(0,a.useCallback)(e=>{o.push("/history?sha=".concat(encodeURIComponent(e)),{scroll:!1})},[o]),_=(0,a.useCallback)(async()=>{N(!0);try{await (0,i.RK)(c,{limit:50}),b()}catch(e){}finally{N(!1)}},[c,b]),V=(0,a.useCallback)(async()=>{L(!0);try{let e=await (0,i.bj)(c),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download="ulpi-history-export.json",r.click(),URL.revokeObjectURL(s)}catch(e){}finally{L(!1)}},[c]),F=(0,a.useCallback)(async()=>{M(!0);try{await (0,i.W7)(c),A(e=>e+1)}catch(e){}finally{M(!1)}},[c]),O=(0,a.useCallback)(()=>{T(!1),o.push("/history",{scroll:!1})},[o]);return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4 shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[D&&m&&(0,r.jsx)("button",{onClick:O,className:"lg:hidden rounded-lg p-1.5 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-gray-300",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})})}),(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:[R," entr",1===R?"y":"ies"]})]}),B&&(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:B})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>void _(),disabled:v,className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs font-medium text-gray-300 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[v?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12M12 16.5V3"})}),"Backfill"]}),(0,r.jsxs)("button",{onClick:()=>void V(),disabled:C,className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs font-medium text-gray-300 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[C?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),"Export"]})]})]}),(0,r.jsx)("div",{className:"mt-3 shrink-0",children:(0,r.jsx)(k,{refreshKey:E})}),(0,r.jsxs)("div",{className:"flex gap-4 flex-1 min-h-0 mt-4",children:[(0,r.jsxs)("div",{className:"w-80 min-w-[280px] max-w-[360px] shrink-0 flex flex-col rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden ".concat(D&&m?"hidden lg:flex":"flex"),children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-1.5 p-3 shrink-0",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:R}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Entries"})]}),(0,r.jsxs)("button",{onClick:()=>void F(),disabled:S,className:"rounded-lg border p-2 text-center transition-colors group ".concat(S?"border-primary-500/20 bg-primary-500/[0.06]":"border-white/[0.04] bg-surface-800/50 hover:bg-surface-800"),title:"Enrich all entries with AI",children:[S?(0,r.jsx)("span",{className:"flex items-center justify-center h-5",children:(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"})}):(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=P?"".concat(P,"%"):"--"}),(0,r.jsx)("p",{className:"text-[9px] transition-colors ".concat(S?"text-primary-400":"text-gray-600 group-hover:text-violet-400"),children:S?"Enriching...":"AI Enriched"})]}),(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=W?W:"--"}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Avg Files"})]})]}),I.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 px-3 pb-2 shrink-0",children:[(0,r.jsx)("button",{onClick:()=>p(null),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(null===u?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:"All"}),I.slice(0,10).map(e=>(0,r.jsxs)("button",{onClick:()=>p(u===e?null:e),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(u===e?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:[e," ",(0,r.jsx)("span",{className:"text-gray-600",children:H[e]})]},e))]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-2 pb-2",children:g?(0,r.jsx)(d.G,{rows:6}):j?(0,r.jsx)("div",{className:"p-3",children:(0,r.jsx)("p",{className:"text-xs text-red-400",children:j})}):0===f.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No entries found"}),u&&(0,r.jsx)("button",{onClick:()=>p(null),className:"mt-2 text-xs text-primary-400 hover:text-primary-300",children:"Clear filter"})]}):(0,r.jsx)("div",{className:"space-y-0.5",children:f.map(e=>(0,r.jsx)(w,{entry:e,selected:e.sha===m,onSelect:()=>Z(e.sha)},e.sha))})})]}),(0,r.jsx)("div",{className:"flex-1 min-w-0 rounded-xl border border-white/[0.06] bg-surface-900 p-5 overflow-hidden flex flex-col ".concat(D&&m?"flex":"hidden lg:flex"),children:m?(0,r.jsx)(y,{sha:m}):(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Select an entry to view details"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Click an entry on the left to view its full commit details, enrichment data, and transcript."})]})})]})]})}function L(){let{status:e,loading:t,refresh:s}=(0,i.uX)(),[n,l]=(0,a.useState)(null);if(t)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(0,r.jsx)(d.G,{rows:5})]});if(!e)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(0,r.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-amber-400",children:"Could not connect to the History API. Make sure the ULPI server is running."})})]});let c=null!=n?n:e.exists?0===e.totalEntries?"empty":"active":"init";return"init"===c?(0,r.jsx)(v,{onInitialized:()=>{l("empty"),s()}}):"empty"===c?(0,r.jsx)(N,{onBackfilled:()=>{l("active"),s()}}):(0,r.jsx)(C,{})}}},e=>{e.O(0,[5935,380,814,9743,7358],()=>e(e.s=452)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3845],{452:(e,t,s)=>{Promise.resolve().then(s.bind(s,9896))},4632:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var r=s(8111);function a(){return(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function n(e){let{icon:t,title:s,description:n,action:l,className:i=""}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(i),children:[(0,r.jsx)("div",{className:"mb-4",children:null!=t?t:(0,r.jsx)(a,{})}),(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:s}),n&&(0,r.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:n}),l&&(0,r.jsx)("button",{onClick:l.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:l.label})]})}},4736:(e,t,s)=>{"use strict";var r=s(1504);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},9896:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>L});var r=s(8111),a=s(5271),n=s(4736),l=s(3446),i=s(4401),c=s(5935),o=s.n(c),d=s(3951),x=s(250);let m={A:"bg-emerald-500/15 text-emerald-400",M:"bg-blue-500/15 text-blue-400",D:"bg-red-500/15 text-red-400",R:"bg-amber-500/15 text-amber-400",C:"bg-violet-500/15 text-violet-400"},h={A:"Added",M:"Modified",D:"Deleted",R:"Renamed",C:"Copied"};function u(e){let{entry:t}=e;return(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[t.hasSession&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-cyan-500/15 px-2 py-0.5 text-[10px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-400",children:"Review"})]})}function p(e){let{turn:t}=e,[s,n]=(0,a.useState)(!1),l="tool_use"===t.type?t.toolInput:t.content,i=null!=l&&l.length>2e3,c=i?l.slice(0,2e3):l;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{onClick:()=>n(!s),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium text-cyan-400 bg-cyan-500/10 border border-cyan-500/15 transition-colors hover:bg-cyan-500/15",children:[(0,r.jsx)("svg",{className:"h-2.5 w-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3"})}),"tool_use"===t.type?t.toolName:"Result",(0,r.jsx)("svg",{className:"h-2.5 w-2.5 text-cyan-500/60 transition-transform ".concat(s?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),s&&c&&(0,r.jsxs)("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap font-mono text-[10px] text-gray-500 max-h-24 overflow-y-auto rounded border border-white/[0.03] bg-surface-950 p-2",children:[c,i&&"\n... (truncated)"]})]})}function f(e){let{turn:t}=e;if("tool_use"===t.type||"tool_result"===t.type)return(0,r.jsx)(p,{turn:t});let s="human"===t.type;return(0,r.jsxs)("div",{className:"rounded-lg border-l-2 px-3 py-2 ".concat(s?"border-l-primary-500 bg-surface-800/40 border border-l-2 border-white/[0.03]":"border-l-violet-500 bg-surface-900/60 border border-l-2 border-white/[0.04]"),children:[(0,r.jsx)("span",{className:"text-[10px] font-medium ".concat(s?"text-primary-400":"text-violet-400"),children:s?"You":"Assistant"}),(0,r.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap text-[10px] text-gray-400 leading-relaxed max-h-20 overflow-y-auto",children:t.content.length>500?t.content.slice(0,500)+"...":t.content})]})}function g(e){let{sha:t}=e,{transcript:s,loading:n}=(0,i.oI)(t),[l,c]=(0,a.useState)(!1);if(n)return(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-3",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border border-primary-500 border-t-transparent"}),"Loading transcript..."]})});if(!s)return null;let d=(0,x.K9)(s);if(!d||0===d.length)return null;let m=d.filter(e=>"human"===e.type).length,h=d.filter(e=>"assistant"===e.type).length,u=d.filter(e=>"tool_use"===e.type||"tool_result"===e.type).length;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>c(!l),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300",children:"Transcript"}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[d.length," turn",1!==d.length?"s":""," ","(",m," user, ",h," assistant, ",u," tool)"]})]}),(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-600 transition-transform ".concat(l?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),l&&(0,r.jsxs)("div",{className:"border-t border-white/[0.04] px-4 py-3 max-h-96 overflow-y-auto space-y-1.5",children:[d.slice(0,50).map((e,t)=>(0,r.jsx)(f,{turn:e},t)),d.length>50&&(0,r.jsxs)("p",{className:"py-2 text-center text-[10px] text-gray-600",children:["Showing 50 of ",d.length," turns."," ",(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-primary-400 hover:text-primary-300",children:"View full transcript"})]})]})]})}function j(e){var t;let{plan:s}=e,[n,l]=(0,a.useState)(!1),i=null==(t=s.decision)?void 0:t.behavior,c="approve"===i?"approved":"deny"===i?"denied":null;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>l(!n),className:"flex w-full items-center justify-between px-3 py-2.5 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25Z"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300 truncate",children:s.title||s.slug||"Review Plan"}),c&&(0,r.jsx)("span",{className:"rounded-full px-1.5 py-px text-[9px] font-medium ".concat("approve"===i?"text-emerald-400 bg-emerald-500/15":"deny"===i?"text-red-400 bg-red-500/15":"text-amber-400 bg-amber-500/15"),children:c})]}),(0,r.jsx)("svg",{className:"h-3 w-3 text-gray-600 transition-transform shrink-0 ".concat(n?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})]}),n&&s.plan&&(0,r.jsx)("div",{className:"border-t border-white/[0.04] px-3 py-3 max-h-64 overflow-y-auto",children:(0,r.jsx)("pre",{className:"whitespace-pre-wrap text-[11px] text-gray-400 leading-relaxed font-mono",children:s.plan})})]})}function y(e){let{sha:t}=e,s=(0,l.yC)(),{entry:n,loading:c,refresh:x}=(0,i.O4)(t),{enrichmentStatus:p,refresh:f}=(0,i.hh)(),[y,b]=(0,a.useState)(!1),[v,N]=(0,a.useState)(null),w=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(y)return w.current=setInterval(()=>{f()},2e3),()=>{w.current&&clearInterval(w.current)}},[y,f]),(0,a.useEffect)(()=>{if(y&&p&&("done"===p.status||"error"===p.status||"idle"===p.status)){if(b(!1),"error"===p.status){var e;N(null!=(e=p.error)?e:"Enrichment failed")}x()}},[p,y,x]);let k=(0,a.useCallback)(async()=>{if(!y){b(!0),N(null);try{await (0,i.W7)(s,t),f()}catch(e){N(e instanceof Error?e.message:"Enrichment failed"),b(!1)}}},[s,t,y,f]);if(c)return(0,r.jsx)(d.G,{rows:4});if(!n)return(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Entry not found"}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-600",children:["Could not load entry for SHA ",t.slice(0,8),"."]})]});let C=n.sha.slice(0,8);return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono text-sm font-medium text-amber-400",children:C}),(0,r.jsx)(u,{entry:n})]}),n.subject&&(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-200",children:n.subject})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[n.hasTranscript&&(0,r.jsxs)(o(),{href:"/history/".concat(t,"/transcript"),className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-800 px-2.5 py-1.5 text-[11px] font-medium text-gray-300 transition-colors hover:bg-surface-750 hover:text-white",children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})}),"Full Transcript"]}),!n.hasEnrichment&&(0,r.jsx)("button",{onClick:()=>void k(),disabled:y,className:"inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-semibold text-white transition-colors disabled:cursor-not-allowed ".concat(y?"bg-primary-500/60":"bg-primary-500 hover:bg-primary-600"),children:y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-white border-t-transparent"}),(null==p?void 0:p.status)==="enriching"&&p.total>0?"".concat(p.completed,"/").concat(p.total):"Enriching..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})}),"Enrich with AI"]})})]})]}),v&&(0,r.jsx)("div",{className:"mt-3 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:v})]}),(0,r.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-xs shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Date "}),(0,r.jsx)("span",{className:"text-gray-300",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}(n.date)})]}),null!=n.filesChanged&&n.filesChanged>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Files "}),(0,r.jsxs)("span",{className:"text-gray-300",children:[n.filesChanged," changed",null!=n.insertions&&(0,r.jsxs)("span",{className:"ml-1.5 text-emerald-400",children:["+",n.insertions]}),null!=n.deletions&&(0,r.jsxs)("span",{className:"ml-1 text-red-400",children:["-",n.deletions]})]})]}),n.duration&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Duration "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.duration})]}),n.branch&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Branch "}),(0,r.jsx)("span",{className:"font-mono text-gray-300",children:n.branch})]}),n.authorName&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Author "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.authorName})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"SHA "}),(0,r.jsx)("span",{className:"font-mono text-gray-400",children:n.sha})]})]}),n.tags&&n.tags.length>0&&(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-1 shrink-0",children:n.tags.map(e=>(0,r.jsx)("span",{className:"rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-500",children:e},e))}),n.enrichment&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-violet-500/10 bg-violet-500/[0.04] p-4 shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-violet-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"})}),(0,r.jsx)("h4",{className:"text-xs font-semibold text-violet-300",children:"AI Enrichment"}),n.enrichment.complexity&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:n.enrichment.complexity})]}),n.enrichment.summary&&(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.enrichment.summary}),(n.enrichment.intent||n.enrichment.outcome)&&(0,r.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[n.enrichment.intent&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Intent"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.intent})]}),n.enrichment.outcome&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Outcome"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.outcome})]})]}),n.enrichment.insights&&n.enrichment.insights.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Insights"}),n.enrichment.insights.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-violet-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.challenges&&n.enrichment.challenges.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Challenges"}),n.enrichment.challenges.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-amber-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.recommendations&&n.enrichment.recommendations.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Recommendations"}),n.enrichment.recommendations.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-emerald-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]})]}),!n.enrichment&&n.summary&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-white/[0.04] bg-surface-800/30 p-4 shrink-0",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-gray-500 mb-1.5",children:"Summary"}),(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.summary})]}),n.files&&n.files.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Files Changed (",n.files.length,")"]}),(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden divide-y divide-white/[0.03]",children:n.files.map(e=>{var t,s,a,n;let l=null!=(t=m[e.status])?t:"bg-gray-500/15 text-gray-400",i="number"==typeof e.additions||"number"==typeof e.deletions,c=null!=(s=e.additions)?s:0,o=null!=(a=e.deletions)?a:0,d=c+o,x=Math.min(d,30),u=d>0?Math.round(c/d*x):0;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,r.jsx)("span",{className:"inline-flex w-5 items-center justify-center rounded px-0.5 py-px text-[9px] font-medium ".concat(l),children:e.status}),(0,r.jsx)("span",{className:"truncate font-mono text-[11px] text-gray-400 flex-1 min-w-0",title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:e.oldPath?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-600",children:e.oldPath}),(0,r.jsx)("span",{className:"text-gray-600",children:" → "}),e.path]}):e.path}),i&&(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[c>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-emerald-400",children:["+",c]}),o>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-red-400",children:["-",o]}),d>0&&(0,r.jsxs)("span",{className:"inline-flex gap-px",children:[Array.from({length:u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-emerald-500/70"},"a".concat(t))),Array.from({length:x-u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-red-500/70"},"d".concat(t)))]})]}),!i&&(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[9px] text-gray-600",children:null!=(n=h[e.status])?n:e.status})]},e.path)})})]}),n.reviewPlans&&n.reviewPlans.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Review Plans (",n.reviewPlans.length,")"]}),(0,r.jsx)("div",{className:"space-y-2",children:n.reviewPlans.map((e,t)=>(0,r.jsx)(j,{plan:e},e.slug||t))})]}),n.hasTranscript&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsx)(g,{sha:t}),(0,r.jsx)("div",{className:"mt-2 text-right",children:(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-[10px] text-primary-400 hover:text-primary-300 transition-colors",children:"Open full transcript page"})})]})]})}var b=s(4632);function v(e){let{onInitialized:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{d(!0),m(null);try{await (0,i.xy)(s,{collectReviewPlans:n}),t()}catch(e){m(e instanceof Error?e.message:"Failed to initialize history")}finally{d(!1)}},[s,n,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-surface-900 border border-white/[0.06]",children:(0,r.jsx)("svg",{className:"h-8 w-8 text-primary-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),(0,r.jsx)("h2",{className:"mt-5 text-lg font-semibold text-white",children:"Initialize History"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-400 max-w-sm mx-auto",children:"Set up the shadow branch to track your coding session history. This creates a dedicated git branch for structured records of each session."}),(0,r.jsx)("div",{className:"mt-6 flex items-center justify-center gap-2",children:(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:e=>c(e.target.checked),className:"h-3.5 w-3.5 rounded border-white/20 bg-surface-800 text-primary-500 focus:ring-primary-500/30 focus:ring-offset-0"}),(0,r.jsx)("span",{className:"text-xs text-gray-400",children:"Collect review plans"})]})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:o,className:"mt-5 inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[o?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})}),"Initialize History"]})]})})}function N(e){let{onBackfilled:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(null),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{c(!0),m(null);try{let e=await (0,i.RK)(s,{limit:50});d({captured:e.captured,skipped:e.skipped}),e.captured>0&&t()}catch(e){m(e instanceof Error?e.message:"Backfill failed")}finally{c(!1)}},[s,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)(b.p,{title:"No history entries yet",description:"History is initialized but empty. Backfill from recent commits to populate your timeline.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),o&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-4 py-2 text-xs text-emerald-400",children:["Captured ",o.captured," entries, skipped ",o.skipped,"."]}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:n,className:"mt-5 inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[n?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12M12 16.5V3"})}),"Backfill Recent Commits"]})]})})}function w(e){let{entry:t,selected:s,onSelect:a}=e;return(0,r.jsxs)("button",{onClick:a,className:"w-full text-left rounded-lg px-3 py-2.5 transition-colors ".concat(s?"bg-primary-500/10 border border-primary-500/30":"border border-transparent hover:bg-white/[0.03]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"font-mono text-xs text-amber-400 shrink-0",children:t.shortSha||t.sha.slice(0,7)}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600 shrink-0",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(t.date)})]}),t.filesChanged>0&&(0,r.jsxs)("span",{className:"text-[10px] text-gray-600 shrink-0",children:[t.filesChanged,"f"]})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-300 truncate",children:t.subject||"No subject"}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[t.hasSession&&(0,r.jsx)("span",{className:"rounded-full bg-cyan-500/15 px-1.5 py-px text-[9px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-1.5 py-px text-[9px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-px text-[9px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"rounded-full bg-amber-500/15 px-1.5 py-px text-[9px] font-medium text-amber-400",children:"Review"})]})]})}function k(e){let{refreshKey:t}=e,s=(0,l.yC)(),{enrichmentStatus:n,refresh:c}=(0,i.hh)();if((0,a.useEffect)(()=>{t>0&&c()},[t]),(0,a.useEffect)(()=>{if((null==n?void 0:n.status)!=="enriching")return;let e=setInterval(()=>void c(),3e3);return()=>clearInterval(e)},[null==n?void 0:n.status,c]),!n||"idle"===n.status)return null;let o=async()=>{await (0,i.J)(s),c()};if("enriching"===n.status){let e=n.total>0?Math.round(n.completed/n.total*100):0;return(0,r.jsxs)("div",{className:"rounded-lg border border-primary-500/20 bg-primary-500/[0.06] p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary-400",children:"Enriching..."})]}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-500",children:[n.completed," / ",n.total," (",e,"%)"]})]}),n.total>0&&(0,r.jsx)("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-surface-800",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-primary-500 transition-all duration-500",style:{width:"".concat(e,"%")}})})]})}if("done"===n.status)return(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs text-emerald-400",children:["Enrichment complete. ",n.completed," enriched",n.failed>0&&", ".concat(n.failed," failed"),"."]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-emerald-400/70 hover:text-emerald-400 transition-colors",children:"Dismiss"})]});if("error"===n.status){var d;return(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs text-red-400",children:["Enrichment failed: ",null!=(d=n.error)?d:"Unknown error"]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-red-400/70 hover:text-red-400 transition-colors",children:"Dismiss"})]})}return null}function C(){var e,t,s;let c=(0,l.yC)(),o=(0,n.useRouter)(),x=(0,n.useSearchParams)(),m=x?x.get("sha"):null,{stats:h}=(0,i.zg)(),[u,p]=(0,a.useState)(null),{entries:f,loading:g,error:j,refresh:b}=(0,i._q)(null!=u?u:void 0),[v,N]=(0,a.useState)(!1),[C,L]=(0,a.useState)(!1),[S,M]=(0,a.useState)(!1),[E,A]=(0,a.useState)(0),R=f.length,B=(null==h||null==(e=h.dateRange)?void 0:e.from)&&(null==h||null==(t=h.dateRange)?void 0:t.to)?function(e,t){let s=new Date(e),r=new Date(t);if(isNaN(s.getTime())||isNaN(r.getTime()))return"";let a={month:"short",day:"numeric",year:"numeric"};return"".concat(s.toLocaleDateString(void 0,a)," - ").concat(r.toLocaleDateString(void 0,a))}(h.dateRange.from,h.dateRange.to):null,P=h?Math.round(h.enrichmentCoverage):null,W=h?Math.round(10*h.avgFilesChanged)/10:null,H=null!=(s=null==h?void 0:h.tagCounts)?s:{},I=(0,a.useMemo)(()=>Object.entries(H).sort((e,t)=>{let[,s]=e,[,r]=t;return r-s}).map(e=>{let[t]=e;return t}),[H]),[D,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{m&&T(!0)},[m]);let Z=(0,a.useCallback)(e=>{o.push("/history?sha=".concat(encodeURIComponent(e)),{scroll:!1})},[o]),_=(0,a.useCallback)(async()=>{N(!0);try{await (0,i.RK)(c,{limit:50}),b()}catch(e){}finally{N(!1)}},[c,b]),V=(0,a.useCallback)(async()=>{L(!0);try{let e=await (0,i.bj)(c),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download="ulpi-history-export.json",r.click(),URL.revokeObjectURL(s)}catch(e){}finally{L(!1)}},[c]),F=(0,a.useCallback)(async()=>{M(!0);try{await (0,i.W7)(c),A(e=>e+1)}catch(e){}finally{M(!1)}},[c]),O=(0,a.useCallback)(()=>{T(!1),o.push("/history",{scroll:!1})},[o]);return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4 shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[D&&m&&(0,r.jsx)("button",{onClick:O,className:"lg:hidden rounded-lg p-1.5 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-gray-300",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})})}),(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:[R," entr",1===R?"y":"ies"]})]}),B&&(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:B})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>void _(),disabled:v,className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs font-medium text-gray-300 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[v?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12M12 16.5V3"})}),"Backfill"]}),(0,r.jsxs)("button",{onClick:()=>void V(),disabled:C,className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs font-medium text-gray-300 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[C?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})}),"Export"]})]})]}),(0,r.jsx)("div",{className:"mt-3 shrink-0",children:(0,r.jsx)(k,{refreshKey:E})}),(0,r.jsxs)("div",{className:"flex gap-4 flex-1 min-h-0 mt-4",children:[(0,r.jsxs)("div",{className:"w-80 min-w-[280px] max-w-[360px] shrink-0 flex flex-col rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden ".concat(D&&m?"hidden lg:flex":"flex"),children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-1.5 p-3 shrink-0",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:R}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Entries"})]}),(0,r.jsxs)("button",{onClick:()=>void F(),disabled:S,className:"rounded-lg border p-2 text-center transition-colors group ".concat(S?"border-primary-500/20 bg-primary-500/[0.06]":"border-white/[0.04] bg-surface-800/50 hover:bg-surface-800"),title:"Enrich all entries with AI",children:[S?(0,r.jsx)("span",{className:"flex items-center justify-center h-5",children:(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"})}):(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=P?"".concat(P,"%"):"--"}),(0,r.jsx)("p",{className:"text-[9px] transition-colors ".concat(S?"text-primary-400":"text-gray-600 group-hover:text-violet-400"),children:S?"Enriching...":"AI Enriched"})]}),(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=W?W:"--"}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Avg Files"})]})]}),I.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 px-3 pb-2 shrink-0",children:[(0,r.jsx)("button",{onClick:()=>p(null),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(null===u?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:"All"}),I.slice(0,10).map(e=>(0,r.jsxs)("button",{onClick:()=>p(u===e?null:e),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(u===e?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:[e," ",(0,r.jsx)("span",{className:"text-gray-600",children:H[e]})]},e))]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-2 pb-2",children:g?(0,r.jsx)(d.G,{rows:6}):j?(0,r.jsx)("div",{className:"p-3",children:(0,r.jsx)("p",{className:"text-xs text-red-400",children:j})}):0===f.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No entries found"}),u&&(0,r.jsx)("button",{onClick:()=>p(null),className:"mt-2 text-xs text-primary-400 hover:text-primary-300",children:"Clear filter"})]}):(0,r.jsx)("div",{className:"space-y-0.5",children:f.map(e=>(0,r.jsx)(w,{entry:e,selected:e.sha===m,onSelect:()=>Z(e.sha)},e.sha))})})]}),(0,r.jsx)("div",{className:"flex-1 min-w-0 rounded-xl border border-white/[0.06] bg-surface-900 p-5 overflow-hidden flex flex-col ".concat(D&&m?"flex":"hidden lg:flex"),children:m?(0,r.jsx)(y,{sha:m}):(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Select an entry to view details"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Click an entry on the left to view its full commit details, enrichment data, and transcript."})]})})]})]})}function L(){let{status:e,loading:t,refresh:s}=(0,i.uX)(),[n,l]=(0,a.useState)(null);if(t)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(0,r.jsx)(d.G,{rows:5})]});if(!e)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(0,r.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-amber-400",children:"Could not connect to the History API. Make sure the ULPI server is running."})})]});let c=null!=n?n:e.exists?0===e.totalEntries?"empty":"active":"init";return"init"===c?(0,r.jsx)(v,{onInitialized:()=>{l("empty"),s()}}):"empty"===c?(0,r.jsx)(N,{onBackfilled:()=>{l("active"),s()}}):(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)(d.G,{rows:5}),children:(0,r.jsx)(C,{})})}}},e=>{e.O(0,[5935,380,814,9743,7358],()=>e(e.s=452)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2771],{334:(e,t,s)=>{Promise.resolve().then(s.bind(s,4721))},4721:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var r=s(8111),a=s(5271),l=s(4736),n=s(8934),i=s(2928),c=s(6971);function o(e){let{streamUrl:t,lines:s,live:l=!1,maxHeight:n=600}=e,[i,c]=(0,a.useState)(null!=s?s:[]),[o,d]=(0,a.useState)(!1),[x,u]=(0,a.useState)(!0),m=(0,a.useRef)(null),h=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!t)return;let e=new EventSource(t,{withCredentials:!0});return e.onopen=()=>{d(!0)},e.onmessage=e=>{try{let t=JSON.parse(e.data);c(e=>[...e,t])}catch(t){c(t=>[...t,{timestamp:new Date().toISOString(),text:e.data}])}},e.addEventListener("done",()=>{e.close(),d(!1)}),e.onerror=()=>{d(!1),e.close()},()=>{e.close()}},[t]),(0,a.useEffect)(()=>{x&&h.current&&h.current.scrollIntoView({behavior:"smooth"})},[i,x]),(0,r.jsxs)("div",{className:"overflow-hidden rounded-xl border border-white/[0.06] bg-surface-950",children:[(0,r.jsxs)("div",{className:"glass flex items-center justify-between px-4 py-2.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-400",children:"Logs"}),(l||o)&&(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-400"}),"Live"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:[i.length," line",1!==i.length?"s":""]}),!x&&(0,r.jsxs)("button",{onClick:()=>{var e;u(!0),null==(e=h.current)||e.scrollIntoView({behavior:"smooth"})},className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-gray-400 transition-colors hover:bg-white/[0.04] hover:text-white",children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"})}),"Bottom"]})]})]}),(0,r.jsxs)("div",{ref:m,onScroll:function(){let e=m.current;e&&u(e.scrollHeight-e.scrollTop-e.clientHeight<50)},className:"overflow-y-auto font-mono text-xs leading-6",style:{maxHeight:n},children:[0===i.length&&(0,r.jsx)("div",{className:"flex items-center justify-center py-16 text-gray-600",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,r.jsx)("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3M4.5 19.5h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15A2.25 2.25 0 0 0 2.25 6.75v10.5A2.25 2.25 0 0 0 4.5 19.5Z"})}),(0,r.jsx)("span",{className:"text-xs",children:l||t?"Waiting for logs...":"No logs available."})]})}),i.map((e,t)=>(0,r.jsxs)("div",{className:"flex hover:bg-white/[0.02] px-4",children:[(0,r.jsx)("span",{className:"w-10 shrink-0 select-none pr-4 text-right text-gray-700",children:t+1}),(0,r.jsx)("span",{className:"w-20 shrink-0 text-gray-600",children:e.timestamp?new Date(e.timestamp).toLocaleTimeString():""}),(0,r.jsx)("span",{className:"whitespace-pre-wrap break-all ".concat(function(e){switch(e){case"error":return"text-red-400";case"warn":return"text-yellow-400";case"debug":return"text-gray-500";default:return"text-gray-300"}}(e.level)),children:e.text})]},t)),(0,r.jsx)("div",{ref:h})]})]})}var d=s(5935),x=s.n(d);function u(e){let{label:t,children:s}=e;return(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:t}),(0,r.jsx)("div",{className:"text-sm text-gray-200",children:s})]})}function m(){let e=(0,l.useParams)(),{org:t}=(0,n.As)(),[s,d]=(0,a.useState)(null),[m,h]=(0,a.useState)(!0),[g,p]=(0,a.useState)(!1),b=(0,a.useCallback)(async()=>{if(t&&(null==e?void 0:e.id))try{let s=await i.uE.getJob(t.id,e.id);d(s)}catch(e){}finally{h(!1)}},[t,null==e?void 0:e.id]);async function f(){if(t&&s){p(!0);try{await i.uE.cancelJob(t.id,s.id),await b()}catch(e){}finally{p(!1)}}}async function j(){if(t&&s){p(!0);try{let e=await i.uE.retryJob(t.id,s.id);window.location.href="/jobs/".concat(e.job_id)}catch(e){}finally{p(!1)}}}if((0,a.useEffect)(()=>{b()},[b]),(0,a.useEffect)(()=>{if(!s||"running"!==s.status)return;let e=setInterval(()=>{b()},5e3);return()=>clearInterval(e)},[s,b]),m)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-800"}),(0,r.jsx)("div",{className:"h-48 animate-pulse rounded-xl border border-white/[0.06] bg-surface-900"}),(0,r.jsx)("div",{className:"h-72 animate-pulse rounded-xl border border-white/[0.06] bg-surface-900"})]});if(!s)return(0,r.jsxs)("div",{className:"py-20 text-center",children:[(0,r.jsx)("svg",{className:"mx-auto h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20 13V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7m16 0v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-5m16 0h-2.586a1 1 0 0 0-.707.293l-2.414 2.414a1 1 0 0 1-.707.293h-3.172a1 1 0 0 1-.707-.293l-2.414-2.414A1 1 0 0 0 6.586 13H4"})}),(0,r.jsx)("h2",{className:"mt-3 text-base font-medium text-gray-300",children:"Job not found"}),(0,r.jsx)(x(),{href:"/jobs",className:"mt-4 inline-flex text-sm text-primary-400 hover:text-primary-300",children:"← Back to jobs"})]});let v="running"===s.status,y=v&&t?i.uE.getJobLogStreamUrl(t.id,s.id):void 0;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("nav",{className:"flex items-center gap-1.5 text-sm",children:[(0,r.jsx)(x(),{href:"/jobs",className:"text-gray-400 transition-colors hover:text-gray-200",children:"Jobs"}),(0,r.jsx)("svg",{className:"h-3 w-3 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})}),(0,r.jsx)("span",{className:"font-mono text-sm text-white",children:s.id.slice(0,8)})]}),(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-3",children:[(0,r.jsxs)("h1",{className:"text-xl font-semibold text-white",children:["Job ",s.id.slice(0,8)]}),(0,r.jsx)(c.P,{status:s.status,size:"md"})]})]}),(0,r.jsx)("div",{className:"flex gap-2",children:"running"===s.status||"queued"===s.status?(0,r.jsx)("button",{onClick:()=>void f(),disabled:g,className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3.5 py-1.5 text-sm font-medium text-red-400 transition-colors hover:bg-red-500/10 disabled:opacity-50",children:"Cancel"}):"failed"===s.status||"canceled"===s.status?(0,r.jsx)("button",{onClick:()=>void j(),disabled:g,className:"rounded-lg bg-primary-500 px-3.5 py-1.5 text-sm font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50",children:"Retry"}):null})]}),(0,r.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-5 md:grid-cols-4",children:[(0,r.jsx)(u,{label:"Status",children:(0,r.jsx)(c.P,{status:s.status})}),(0,r.jsx)(u,{label:"Repository",children:(0,r.jsxs)(x(),{href:"/repos/".concat(s.repo_id),className:"text-primary-400 hover:underline",children:[s.repo_id.slice(0,12),"..."]})}),(0,r.jsx)(u,{label:"Trigger",children:(0,r.jsx)("span",{className:"capitalize",children:s.trigger.replace(/_/g," ")})}),s.github_pr_number?(0,r.jsx)(u,{label:"PR Number",children:(0,r.jsxs)("span",{className:"text-primary-400",children:["#",s.github_pr_number]})}):(0,r.jsx)(u,{label:"PR Number",children:(0,r.jsx)("span",{className:"text-gray-600",children:"—"})}),(0,r.jsx)(u,{label:"Queued At",children:new Date(s.queued_at).toLocaleString()}),s.started_at&&(0,r.jsx)(u,{label:"Started At",children:new Date(s.started_at).toLocaleString()}),s.duration_ms?(0,r.jsx)(u,{label:"Duration",children:function(e){let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);return"".concat(s,"m ").concat(t%60,"s")}(s.duration_ms)}):v?(0,r.jsx)(u,{label:"Duration",children:(0,r.jsx)("span",{className:"text-blue-400",children:"In progress..."})}):null,s.worker_container_id&&(0,r.jsx)(u,{label:"Container",children:(0,r.jsx)("span",{className:"font-mono text-xs",children:s.worker_container_id.slice(0,12)})})]})}),s.result_summary&&(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:[(0,r.jsx)("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Result Summary"}),(0,r.jsx)("p",{className:"mt-2 text-sm leading-relaxed text-gray-300",children:s.result_summary})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"mb-3 text-base font-semibold text-white",children:"Logs"}),(0,r.jsx)(o,{streamUrl:y,live:v,maxHeight:500})]}),s.artifacts_path&&(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:[(0,r.jsx)("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:"Artifacts"}),(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-2.5",children:[(0,r.jsx)("svg",{className:"h-4 w-4 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})}),(0,r.jsx)("span",{className:"text-sm text-gray-400",children:s.artifacts_path})]})]})]})}},4736:(e,t,s)=>{"use strict";var r=s(1504);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},6971:(e,t,s)=>{"use strict";s.d(t,{P:()=>l});var r=s(8111);let a={queued:{label:"Queued",bg:"bg-yellow-500/10",text:"text-yellow-400",dot:"bg-yellow-400"},running:{label:"Running",bg:"bg-blue-500/10",text:"text-blue-400",dot:"bg-blue-400 animate-pulse"},completed:{label:"Completed",bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"bg-emerald-400"},failed:{label:"Failed",bg:"bg-red-500/10",text:"text-red-400",dot:"bg-red-400"},canceled:{label:"Canceled",bg:"bg-gray-500/10",text:"text-gray-400",dot:"bg-gray-400"}};function l(e){let{status:t,size:s="sm"}=e,l=a[t];return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full ".concat(l.bg," ").concat(l.text," ").concat("sm"===s?"px-2 py-0.5 text-xs":"px-2.5 py-1 text-sm"),children:[(0,r.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full ".concat(l.dot)}),l.label]})}}},e=>{e.O(0,[5935,8934,814,9743,7358],()=>e(e.s=334)),_N_E=e.O()}]);
|
package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/loop/page-c3f658ffb8d7397b.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[313],{1452:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>m});var s=n(8111),l=n(5271),a=n(4736),r=n(3951),o=n(4632),i=n(3025),c=n(2853),d=n(5079),u=n(5605),x=n(8322);function h(e){let{jobs:t,selectedId:n,onSelect:l,onNewRun:a}=e,r=function(e){let t=new Set(["running","queued","paused","pausing"]);return[...e].sort((e,n)=>{let s=+!t.has(e.status),l=+!t.has(n.status);return s!==l?s-l:new Date(n.createdAt).getTime()-new Date(e.createdAt).getTime()})}(t);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 shrink-0 border-b border-white/[0.04]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-white",children:"Jobs"}),t.length>0&&(0,s.jsx)("span",{className:"inline-flex items-center justify-center rounded-full bg-surface-800 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:t.length})]}),(0,s.jsxs)("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1.5 rounded-lg bg-primary-500 px-3 py-1.5 text-[11px] font-semibold text-white transition-colors hover:bg-primary-600",children:[(0,s.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Run"]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===r.length?(0,s.jsx)("div",{className:"p-4",children:(0,s.jsx)(o.p,{title:"No jobs yet",description:"Start a new run to create a job.",icon:(0,s.jsx)("svg",{className:"h-8 w-8 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 14.15v4.25c0 1.094-.787 2.036-1.872 2.18-2.087.277-4.216.42-6.378.42s-4.291-.143-6.378-.42c-1.085-.144-1.872-1.086-1.872-2.18v-4.25m16.5 0a2.18 2.18 0 0 0 .75-1.661V8.706c0-1.081-.768-2.015-1.837-2.175a48.114 48.114 0 0 0-3.413-.387m4.5 8.006c-.194.165-.42.295-.673.38A23.978 23.978 0 0 1 12 15.75c-2.648 0-5.195-.429-7.577-1.22a2.016 2.016 0 0 1-.673-.38m0 0A2.18 2.18 0 0 1 3 12.489V8.706c0-1.081.768-2.015 1.837-2.175a48.111 48.111 0 0 1 3.413-.387m7.5 0V5.25A2.25 2.25 0 0 0 13.5 3h-3a2.25 2.25 0 0 0-2.25 2.25v.894m7.5 0a48.667 48.667 0 0 0-7.5 0"})})})}):r.map(e=>{let t=n===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>l(e.id),className:"w-full px-3 py-2.5 text-left transition-colors border-b border-white/[0.02] ".concat(t?"bg-primary-500/10 border-l-2 border-l-primary-500":"hover:bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.W,{status:e.status,size:"sm"}),(0,s.jsx)(x.L,{name:e.agentName})]}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-mono text-[11px] text-gray-500 truncate",children:e.sourceBranch}),e.taskCount>0&&(0,s.jsxs)("span",{className:"text-[11px] text-gray-500 shrink-0",children:[e.completedTasks,"/",e.taskCount,e.failedTasks>0&&(0,s.jsxs)("span",{className:"text-red-400",children:[" (",e.failedTasks,"!)"]})]})]}),(0,s.jsx)("div",{className:"mt-1 text-[10px] text-gray-600",children:function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.createdAt)})]},e.id)})})]})}function m(){return(0,s.jsx)(i.s,{featureName:"Loop Engine",children:(0,s.jsx)(l.Suspense,{fallback:(0,s.jsx)(r.G,{}),children:(0,s.jsx)(j,{})})})}function j(){var e,t,n,i,u;let m=(0,a.useRouter)(),j=(0,a.useSearchParams)(),p=null!=(e=null==j?void 0:j.get("job"))?e:null,b=null!=(t=null==j?void 0:j.get("prd"))?t:null,f=null!=(n=null==j?void 0:j.get("agent"))?n:null,g=null!=(i=null==j?void 0:j.get("model"))?i:null,[v,w]=(0,l.useState)(p?"job":b?"new-run":null),{jobs:k,refresh:N,deleteJob:y,stopJob:C,rerunJob:S,rerunningId:L}=(0,c.QE)(),R=k.find(e=>"running"===e.status||"queued"===e.status),A=null!=(u=null!=p?p:null==R?void 0:R.id)?u:null,E=null!=v?v:A?"job":null,{status:M,loading:_,hasActiveEngine:P,refresh:T}=(0,c.y_)("job"===E?A:null),{start:B,runAction:D,actionRunning:W,actionMessage:I}=(0,c.nr)(T,N),V=A?k.find(e=>e.id===A):null,F=(0,l.useCallback)(e=>{var t;let n=new URLSearchParams(null!=(t=null==j?void 0:j.toString())?t:"");e?n.set("job",e):n.delete("job");let s=n.toString();m.replace("/loop".concat(s?"?".concat(s):""),{scroll:!1})},[m,j]);(0,l.useEffect)(()=>{p&&w("job")},[p]);let q=(0,l.useCallback)(()=>{w("new-run"),F(null)},[F]),G=(0,l.useCallback)(e=>{w("job"),F(e)},[F]),J=(0,l.useCallback)(async e=>{let t=await B(e);t.jobId?(w("job"),F(t.jobId)):w(null),N()},[B,N,F]),O=(0,l.useCallback)(async e=>{try{await y(e),A===e&&(w(null),F(null))}catch(e){}},[y,A,F]),Q=(0,l.useCallback)(async e=>{try{await C(e),T()}catch(e){}},[C,T]),z=(0,l.useCallback)(async e=>{try{let t=await S(e);t.id&&(w("job"),F(t.id)),T()}catch(e){}},[S,T,F]);return _?(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Loop Engine"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Autonomous task execution loop. Configure an agent and task tracker, then start a run."})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(r.G,{rows:1})})]}):(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,s.jsxs)("div",{className:"shrink-0",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Loop Engine"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Autonomous task execution loop. Configure an agent and task tracker, then start a run."})]}),I&&(0,s.jsx)("div",{className:"mt-3 shrink-0 rounded-lg border border-blue-500/20 bg-blue-500/[0.06] px-3 py-2 text-xs text-blue-400",children:I}),(0,s.jsxs)("div",{className:"flex gap-4 flex-1 min-h-0 mt-4",children:[(0,s.jsx)("div",{className:"w-80 min-w-[280px] max-w-[360px] shrink-0 flex flex-col rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden",children:(0,s.jsx)(h,{jobs:k,selectedId:"job"===E?A:null,onSelect:G,onNewRun:q})}),(0,s.jsx)("div",{className:"flex-1 min-w-0 rounded-xl border border-white/[0.06] bg-surface-900 p-5 overflow-hidden flex flex-col",children:"new-run"===E?(0,s.jsx)(d.Q,{onStart:e=>void J(e),initialPrdFilename:null!=b?b:void 0,initialAgent:null!=f?f:void 0,initialModel:null!=g?g:void 0}):V?(0,s.jsx)(x.F,{job:V,status:M,actionRunning:W,onPause:()=>void D("pause","Pause",V.id),onResume:()=>void D("resume","Resume",V.id),onStop:()=>void D("stop","Stop",V.id),onStopJob:e=>void Q(e),onRerun:e=>void z(e),onDelete:e=>void O(e),rerunningId:L}):(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1",children:[(0,s.jsx)(o.p,{title:k.length>0?"Select a job":"No jobs yet",description:k.length>0?"Choose a job from the list or start a new run.":"Click 'New Run' to start your first execution.",icon:(0,s.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})})}),0===k.length&&(0,s.jsxs)("button",{type:"button",onClick:q,className:"mt-4 inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:[(0,s.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Run"]})]})})]})]})}},9486:(e,t,n)=>{Promise.resolve().then(n.bind(n,1452))}},e=>{e.O(0,[7889,814,9743,7358],()=>e(e.s=9486)),_N_E=e.O()}]);
|
package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/page-afe7f7a5b78650f2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9796],{422:(e,t,r)=>{"use strict";r.d(t,{J:()=>l,h:()=>a});var s=r(7811);function a(){return"local"===s.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function l(){return"local"===s.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},3446:(e,t,r)=>{"use strict";r.d(t,{Kv:()=>c,HI:()=>u,Xk:()=>d,yC:()=>x});var s=r(8111),a=r(5271),l=r(422),n=r(7811);class i{async request(e,t){let r="".concat(this.baseUrl).concat(e);if(this.repo){let e=r.includes("?")?"&":"?";r="".concat(r).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let s=n.env.NEXT_PUBLIC_ULPI_API_SECRET,a=await fetch(r,{...t,headers:{"Content-Type":"application/json",...s?{"X-Ulpi-Secret":s}:{},...null==t?void 0:t.headers}});if(!a.ok)throw Error((await a.json().catch(()=>({error:a.statusText}))).error||"API error: ".concat(a.status));return a.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,l.h)()}}let o=(0,a.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,r=(0,a.useMemo)(()=>{let e=(0,l.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new i:null}},[]);return(0,s.jsx)(o,{value:r,children:t})}function d(){return(0,a.useContext)(o).mode}function x(){let{localClient:e}=(0,a.useContext)(o);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function u(){return(0,a.useContext)(o)}},3951:(e,t,r)=>{"use strict";r.d(t,{G:()=>a});var s=r(8111);function a(e){let{rows:t=3,variant:r="skeleton",className:a=""}=e;return"spinner"===r?(0,s.jsx)("div",{className:"flex items-center justify-center py-16 ".concat(a),children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,s.jsx)("div",{className:"h-7 w-7 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:"Loading..."})]})}):(0,s.jsx)("div",{className:"space-y-3 ".concat(a),children:Array.from({length:t}).map((e,t)=>(0,s.jsx)("div",{className:"animate-pulse rounded-xl border border-white/[0.04] bg-surface-800/50 p-4",children:(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"h-8 w-8 rounded-lg bg-white/[0.06]"}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)("div",{className:"h-3.5 w-1/3 rounded bg-white/[0.06]"}),(0,s.jsx)("div",{className:"h-3 w-2/3 rounded bg-white/[0.04]"})]}),(0,s.jsx)("div",{className:"h-5 w-16 rounded-full bg-white/[0.04]"})]})},t))})}},4409:(e,t,r)=>{Promise.resolve().then(r.bind(r,7099))},4632:(e,t,r)=>{"use strict";r.d(t,{p:()=>l});var s=r(8111);function a(){return(0,s.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function l(e){let{icon:t,title:r,description:l,action:n,className:i=""}=e;return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(i),children:[(0,s.jsx)("div",{className:"mb-4",children:null!=t?t:(0,s.jsx)(a,{})}),(0,s.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:r}),l&&(0,s.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:l}),n&&(0,s.jsx)("button",{onClick:n.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:n.label})]})}},6028:(e,t,r)=>{"use strict";r.d(t,{a:()=>l});var s=r(8111),a=r(5271);function l(e){let{open:t,onClose:r,title:l,description:n,children:i,maxWidth:o="max-w-lg"}=e,c=(0,a.useRef)(null),d=(0,a.useCallback)(e=>{"Escape"===e.key&&r()},[r]);return((0,a.useEffect)(()=>{if(t)return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[t,d]),(0,a.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t)?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,s.jsx)("div",{ref:c,className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),(0,s.jsxs)("div",{className:"relative z-10 w-full ".concat(o," animate-in rounded-2xl border border-white/[0.08] bg-surface-900 shadow-2xl"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between border-b border-white/[0.06] px-6 py-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-white",children:l}),n&&(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:n})]}),(0,s.jsx)("button",{onClick:r,className:"ml-4 rounded-lg p-1.5 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-gray-300",children:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),(0,s.jsx)("div",{className:"px-6 py-4",children:i})]})]}):null}},7099:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>g});var s=r(8111),a=r(5271),l=r(8984),n=r(7102);let i=["DECISION","PATTERN","BUG_ROOT_CAUSE","PREFERENCE","CONSTRAINT","CONTEXT","LESSON","RELATIONSHIP"],o=["critical","high","medium","low"];function c(e){let{onSubmit:t,onCancel:r}=e,[l,n]=(0,a.useState)(""),[c,d]=(0,a.useState)("DECISION"),[x,u]=(0,a.useState)("medium"),[m,p]=(0,a.useState)(""),[h,g]=(0,a.useState)(""),[b,y]=(0,a.useState)(!1),[f,j]=(0,a.useState)(null);async function v(e){if(e.preventDefault(),l.trim()){y(!0),j(null);try{let e=m.split(",").map(e=>e.trim()).filter(Boolean);await t({summary:l.trim(),type:c,importance:x,tags:e,detail:h.trim()||void 0})}catch(e){j(e instanceof Error?e.message:"Failed to save memory")}finally{y(!1)}}}return(0,s.jsxs)("form",{onSubmit:e=>void v(e),className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Summary"}),(0,s.jsx)("input",{type:"text",value:l,onChange:e=>n(e.target.value),placeholder:"What should be remembered?",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Type"}),(0,s.jsx)("select",{value:c,onChange:e=>d(e.target.value),className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white outline-none focus:border-primary-500/50",children:i.map(e=>(0,s.jsx)("option",{value:e,children:e.replace(/_/g," ")},e))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Importance"}),(0,s.jsx)("select",{value:x,onChange:e=>u(e.target.value),className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white outline-none focus:border-primary-500/50",children:o.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-400",children:["Tags ",(0,s.jsx)("span",{className:"text-gray-600",children:"(comma-separated)"})]}),(0,s.jsx)("input",{type:"text",value:m,onChange:e=>p(e.target.value),placeholder:"architecture, performance, security",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs font-medium text-gray-400",children:["Detail ",(0,s.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,s.jsx)("textarea",{value:h,onChange:e=>g(e.target.value),placeholder:"Additional context or explanation...",rows:3,className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50 resize-none"})]}),f&&(0,s.jsx)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:f}),(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:r,className:"rounded-lg px-4 py-2 text-xs font-medium text-gray-400 transition-colors hover:bg-white/[0.04] hover:text-gray-300",children:"Cancel"}),(0,s.jsx)("button",{type:"submit",disabled:b||!l.trim(),className:"rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:b?"Saving...":"Remember"})]})]})}var d=r(3951),x=r(4632),u=r(6028);let m=["DECISION","PATTERN","BUG_ROOT_CAUSE","PREFERENCE","CONSTRAINT","CONTEXT","LESSON","RELATIONSHIP"],p=["critical","high","medium","low"],h={DECISION:"bg-blue-500/15 text-blue-400 border-blue-500/20",PATTERN:"bg-green-500/15 text-green-400 border-green-500/20",BUG_ROOT_CAUSE:"bg-red-500/15 text-red-400 border-red-500/20",PREFERENCE:"bg-yellow-500/15 text-yellow-400 border-yellow-500/20",CONSTRAINT:"bg-orange-500/15 text-orange-400 border-orange-500/20",CONTEXT:"bg-purple-500/15 text-purple-400 border-purple-500/20",LESSON:"bg-pink-500/15 text-pink-400 border-pink-500/20",RELATIONSHIP:"bg-cyan-500/15 text-cyan-400 border-cyan-500/20"};function g(){var e,t,r,i;let{status:o,loading:g,refresh:y,toggleEnabled:f}=(0,l.XB)(),{results:j,searching:v,search:N}=(0,l.nu)(),{remember:w,forget:k,runAction:C,getTimeline:E}=(0,l.wC)(),[S,T]=(0,a.useState)(""),[R,I]=(0,a.useState)([]),[L,O]=(0,a.useState)([]),[P,M]=(0,a.useState)(!1),[_,A]=(0,a.useState)(!1),[U,B]=(0,a.useState)(null),[D,F]=(0,a.useState)(null),[X,H]=(0,a.useState)(null),[W,G]=(0,a.useState)([]),[q,z]=(0,a.useState)(!0),J=(0,a.useCallback)(async()=>{try{var e;let t=await E(20);G(null!=(e=t.entries)?e:[])}catch(e){}finally{z(!1)}},[E]);(0,a.useEffect)(()=>{J()},[J]);let V=(0,a.useCallback)(async e=>{null==e||e.preventDefault(),S.trim()&&(M(!0),await N(S.trim()))},[S,N]),Z=(0,a.useCallback)(async e=>{try{await k(e),y(),J()}catch(e){}},[k,y,J]),K=(0,a.useCallback)(async e=>{await w(e.summary,e.type),A(!1),y(),J()},[w,y,J]),Q=(null==o?void 0:o.reindexing)===!0,Y=(0,a.useCallback)(async(e,t)=>{B(e),F(null);try{var r;let s=await C(e);F(null!=(r=null==s?void 0:s.message)?r:"".concat(t," started.")),y()}catch(e){F(e instanceof Error?e.message:"".concat(t," failed"))}finally{B(null)}},[C,y]),$=j.filter(e=>(!(R.length>0)||!e.type||!!R.includes(e.type))&&(!(L.length>0)||!e.importance||!!L.includes(e.importance)));return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Memory"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Search and manage agent memories across sessions."})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[[{action:"classify-all",label:"Classify"},{action:"reindex",label:"Reindex"},{action:"export",label:"Export"}].map(e=>{let{action:t,label:r}=e,a=null!==U||"reindex"===t&&Q,l=U===t||"reindex"===t&&Q,n="reindex"===t&&Q?"Reindexing...":r;return(0,s.jsxs)("button",{onClick:()=>void Y(t,r),disabled:a,className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs font-medium text-gray-300 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[l&&(0,s.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),n]},t)}),(0,s.jsxs)("button",{onClick:()=>A(!0),className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-3 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:[(0,s.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"Remember"]})]})]}),D&&(0,s.jsx)("div",{className:"rounded-lg border border-blue-500/20 bg-blue-500/[0.06] px-3 py-2 text-xs text-blue-400",children:D}),Q&&o.reindexProgress&&(0,s.jsxs)("div",{className:"rounded-xl border border-primary-500/20 bg-primary-500/[0.06] p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,s.jsxs)("h2",{className:"text-sm font-semibold text-white",children:["Reindexing — ",o.reindexProgress.phase]})]}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:o.reindexProgress.total>0?"".concat(o.reindexProgress.current," / ").concat(o.reindexProgress.total):"".concat(o.reindexProgress.current," processed")})]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-gray-400",children:o.reindexProgress.message}),o.reindexProgress.total>0&&(0,s.jsx)("div",{className:"mt-3 h-2 w-full overflow-hidden rounded-full bg-surface-800",children:(0,s.jsx)("div",{className:"h-full rounded-full bg-primary-500 transition-all duration-500 ease-out",style:{width:"".concat(Math.min(100,Math.round(o.reindexProgress.current/o.reindexProgress.total*100)),"%")}})})]}),Q&&!o.reindexProgress&&(0,s.jsx)("div",{className:"rounded-xl border border-primary-500/20 bg-primary-500/[0.06] p-5",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,s.jsx)("h2",{className:"text-sm font-semibold text-white",children:"Starting reindex pipeline..."})]})}),(null==o?void 0:o.lastReindexError)&&!Q&&o.lastReindexError!==X&&(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:[(0,s.jsxs)("span",{children:["Reindex failed: ",o.lastReindexError]}),(0,s.jsx)("button",{onClick:()=>H(o.lastReindexError),className:"ml-2 shrink-0 text-red-400/60 hover:text-red-400 transition-colors",children:(0,s.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5 space-y-4",children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-white",children:"Search Memories"}),(0,s.jsxs)("form",{onSubmit:e=>void V(e),className:"flex items-end gap-3",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Query"}),(0,s.jsx)("input",{type:"text",value:S,onChange:e=>T(e.target.value),placeholder:"Why did we choose this architecture?",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50"})]}),(0,s.jsxs)("button",{type:"submit",disabled:v||!S.trim(),className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[v?(0,s.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,s.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})}),"Search"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-widest text-gray-600",children:"Type Filter"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>{I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:"inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wide transition-colors ".concat(R.includes(e)?h[e]:"border-transparent bg-surface-800 text-gray-500 hover:text-gray-400"),children:e.replace(/_/g," ")},e))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-widest text-gray-600",children:"Importance Filter"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:p.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>{O(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:"inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ".concat(L.includes(e)?"border-primary-500/30 bg-primary-500/10 text-primary-400":"border-transparent bg-surface-800 text-gray-500 hover:text-gray-400"),children:e},e))})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-12",children:[(0,s.jsxs)("div",{className:"lg:col-span-8",children:[(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-white",children:P?"Search Results":"Recent Memories"}),P&&$.length>0&&(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:[$.length," results"]}),!P&&W.length>0&&(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:["Last ",W.length]})]}),v?(0,s.jsx)(d.G,{rows:3}):P?0===$.length?(0,s.jsx)(x.p,{title:"No results found",description:"Try a different query or adjust the filters."}):(0,s.jsx)("div",{className:"space-y-3",children:$.map(e=>(0,s.jsx)(n._,{entry:e,score:e.score,onForget:Z},e.id))}):q?(0,s.jsx)(d.G,{rows:3}):0===W.length?(0,s.jsx)(x.p,{title:"No memories yet",description:"Memories will appear here as the agent captures decisions, patterns, and lessons.",icon:(0,s.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Z"})})}):(0,s.jsx)("div",{className:"space-y-3",children:W.map(e=>(0,s.jsx)(n._,{entry:e,onForget:Z},e.id))})]}),(0,s.jsxs)("div",{className:"lg:col-span-4 space-y-4",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Stats"}),g?(0,s.jsx)(d.G,{rows:1,variant:"spinner"}):o?(0,s.jsxs)("div",{className:"mt-3 space-y-2.5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-gray-400",children:"Enabled"}),(0,s.jsx)("button",{onClick:()=>{var e;f(!(null==(e=o.config)?void 0:e.enabled))},className:"relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full transition-colors ".concat((null==(e=o.config)?void 0:e.enabled)?"bg-primary-500":"bg-surface-700"),children:(0,s.jsx)("span",{className:"inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ".concat((null==(t=o.config)?void 0:t.enabled)?"translate-x-[18px]":"translate-x-[3px]")})})]}),(0,s.jsx)(b,{label:"Total Memories",value:String(null!=(i=null==(r=o.stats)?void 0:r.totalMemories)?i:0)}),(0,s.jsx)(b,{label:"Initialized",value:o.initialized?"Yes":"No"})]}):(0,s.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:"Unable to fetch status."})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-white",children:"About Memory"}),(0,s.jsx)("p",{className:"mt-2 text-xs leading-relaxed text-gray-400",children:"Agent Memory captures decisions, patterns, and lessons learned across coding sessions. Memories are semantically indexed and surfaced to the agent at session start for context continuity."})]})]})]}),(0,s.jsx)(u.a,{open:_,onClose:()=>A(!1),title:"Remember",description:"Create a new memory for the agent to recall.",children:(0,s.jsx)(c,{onSubmit:K,onCancel:()=>A(!1)})})]})}function b(e){let{label:t,value:r}=e;return(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-gray-400",children:t}),(0,s.jsx)("span",{className:"font-medium text-white",children:r})]})}},7102:(e,t,r)=>{"use strict";r.d(t,{_:()=>o});var s=r(8111),a=r(5271);let l={DECISION:"bg-blue-500/15 text-blue-400 border-blue-500/20",PATTERN:"bg-green-500/15 text-green-400 border-green-500/20",BUG_ROOT_CAUSE:"bg-red-500/15 text-red-400 border-red-500/20",PREFERENCE:"bg-yellow-500/15 text-yellow-400 border-yellow-500/20",CONSTRAINT:"bg-orange-500/15 text-orange-400 border-orange-500/20",CONTEXT:"bg-purple-500/15 text-purple-400 border-purple-500/20",LESSON:"bg-pink-500/15 text-pink-400 border-pink-500/20",RELATIONSHIP:"bg-cyan-500/15 text-cyan-400 border-cyan-500/20"},n={critical:"text-red-400",high:"text-orange-400",medium:"text-yellow-400",low:"text-gray-500"};function i(e){var t;let{type:r}=e,a=null!=(t=l[r])?t:"bg-gray-500/15 text-gray-400 border-gray-500/20";return(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ".concat(a),children:r.replace(/_/g," ")})}function o(e){var t,r,l,o;let{entry:c,score:d,onForget:x}=e,[u,m]=(0,a.useState)(!1),p=!!c.detail,h=(null==(t=c.relatedFiles)?void 0:t.length)>0,g=p||h;return(0,s.jsxs)("div",{className:"rounded-xl border bg-surface-800/50 p-4 space-y-2 transition-colors ".concat(g?"cursor-pointer hover:border-white/[0.08]":""," ").concat(u?"border-primary-500/30":"border-white/[0.04]"),onClick:()=>g&&m(e=>!e),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g&&(0,s.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500 transition-transform ".concat(u?"rotate-0":"-rotate-90"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})}),(0,s.jsx)(i,{type:c.type}),(0,s.jsx)("span",{className:"text-xs font-medium ".concat(n[c.importance]),children:c.importance}),void 0!==d&&(0,s.jsxs)("span",{className:"text-xs font-medium text-primary-400",children:[(100*d).toFixed(0),"% match"]})]}),x&&(0,s.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),x(c.id)},className:"rounded px-1.5 py-0.5 text-[10px] text-gray-600 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Mark as superseded",children:"forget"})]}),(0,s.jsx)("p",{className:"text-sm leading-relaxed text-gray-200",children:c.summary}),p&&(0,s.jsx)("p",{className:"text-xs leading-relaxed text-gray-400 whitespace-pre-wrap ".concat(u?"":"line-clamp-2"),children:c.detail}),u&&(0,s.jsxs)("div",{className:"space-y-2 border-t border-white/[0.04] pt-2",children:[h&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-600",children:"Related Files"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.relatedFiles.map(e=>(0,s.jsx)("span",{className:"inline-flex items-center gap-1 rounded bg-surface-800 px-2 py-0.5 font-mono text-[11px] text-gray-400",children:e.split("/").pop()},e))})]}),(null==(r=c.tags)?void 0:r.length)>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-600",children:"Tags"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.tags.map(e=>(0,s.jsxs)("span",{className:"inline-flex items-center rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-400",children:["#",e]},e))})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 pt-1 text-[11px] text-gray-600",children:[(null==(l=c.source)?void 0:l.sessionId)&&(0,s.jsxs)("span",{children:["Session: ",c.source.sessionId.slice(0,12),"..."]}),(0,s.jsxs)("span",{children:["Created: ",new Date(c.createdAt).toLocaleString()]}),(0,s.jsxs)("span",{className:"font-mono text-[10px]",children:["ID: ",c.id.slice(0,12)]})]})]}),!u&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-600",children:[(null==(o=c.tags)?void 0:o.length)>0&&(0,s.jsxs)("span",{children:["#",c.tags.slice(0,3).join(", #"),c.tags.length>3&&" +".concat(c.tags.length-3)]}),(0,s.jsx)("span",{children:function(e){let t=new Date(e);if(isNaN(t.getTime()))return e;let r=Date.now()-t.getTime();return r<6e4?"just now":r<36e5?"".concat(Math.floor(r/6e4),"m ago"):r<864e5?"".concat(Math.floor(r/36e5),"h ago"):r<6048e5?"".concat(Math.floor(r/864e5),"d ago"):t.toLocaleDateString()}(c.createdAt)}),h&&(0,s.jsxs)("span",{children:[c.relatedFiles.length," files"]})]})]})}},8984:(e,t,r)=>{"use strict";r.d(t,{XB:()=>l,nu:()=>n,wC:()=>i});var s=r(5271),a=r(3446);function l(){let e=(0,a.yC)(),[t,r]=(0,s.useState)(null),[l,n]=(0,s.useState)(!0),[i,o]=(0,s.useState)(null),c=(0,s.useRef)(null),d=(0,s.useCallback)(async()=>{o(null);try{let t=await e.get("/api/memory/status");return r(t),t}catch(e){return o(e instanceof Error?e.message:"Failed to fetch memory status"),null}finally{n(!1)}},[e]);(0,s.useEffect)(()=>{let e=!1;async function t(){var r;if(e)return;let s=await d();e||(c.current=setTimeout(()=>void t(),null!=(r=null==s?void 0:s.pollIntervalMs)?r:3e4))}return n(!0),t(),()=>{e=!0,c.current&&clearTimeout(c.current)}},[d]);let x=(0,s.useCallback)(async t=>{await e.put("/api/memory/config",{enabled:t}),await d()},[e,d]);return{status:t,loading:l,error:i,refresh:d,toggleEnabled:x}}function n(){let e=(0,a.yC)(),[t,r]=(0,s.useState)([]),[l,n]=(0,s.useState)(!1);return{results:t,searching:l,search:(0,s.useCallback)(async t=>{n(!0);try{var s;let a=(null!=(s=(await e.post("/api/memory/search",{query:t})).results)?s:[]).map(e=>e.entry);return r(a),a}catch(e){return r([]),[]}finally{n(!1)}},[e])}}function i(){let e=(0,a.yC)(),t=(0,s.useCallback)(async(t,r)=>e.post("/api/memory/remember",{summary:t,type:null!=r?r:"CONTEXT"}),[e]),r=(0,s.useCallback)(async t=>e.get("/api/memory/timeline".concat(t?"?limit=".concat(t):"")),[e]);return{remember:t,getTimeline:r,forget:(0,s.useCallback)(async t=>e.post("/api/memory/entries/".concat(t,"/forget")),[e]),runAction:(0,s.useCallback)(async t=>e.post("/api/memory/action",{action:t}),[e])}}}},e=>{e.O(0,[814,9743,7358],()=>e(e.s=4409)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5438],{422:(e,t,s)=>{"use strict";s.d(t,{J:()=>n,h:()=>a});var r=s(7811);function a(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function n(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},2603:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var r=s(8111),a=s(5271),n=s(3446),l=s(4721),i=s(3951),o=s(4632);function c(){let e=(0,n.yC)(),[t,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(!0),[x,p]=(0,a.useState)(null),[u,h]=(0,a.useState)(""),m=(0,a.useCallback)(async()=>{d(!0),p(null);try{var t;let r=u?"?type=".concat(u):"",a=await e.get("/api/memory/timeline".concat(r));s(null!=(t=a.entries)?t:[])}catch(e){p(e instanceof Error?e.message:"Failed to fetch timeline")}finally{d(!1)}},[e,u]);(0,a.useEffect)(()=>{m()},[m]);let g=(0,a.useCallback)(async t=>{try{await e.delete("/api/memory/entries/".concat(t)),s(e=>e.filter(e=>e.id!==t))}catch(e){}},[e]),f=function(e){let t=new Map;for(let s of e){let e=function(e){let t=new Date(e),s=new Date().getTime()-t.getTime();return s<864e5?"Today":s<1728e5?"Yesterday":s<6048e5?"This Week":t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}(s.createdAt),r=t.get(e);r?r.push(s):t.set(e,[s])}return Array.from(t.entries()).map(e=>{let[t,s]=e;return{label:t,entries:s}})}(t);return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Memory Timeline"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Chronological view of all agent memories."})]}),(0,r.jsx)("div",{children:(0,r.jsxs)("select",{value:u,onChange:e=>h(e.target.value),className:"rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs text-white outline-none focus:border-primary-500/50",children:[(0,r.jsx)("option",{value:"",children:"All Types"}),(0,r.jsx)("option",{value:"DECISION",children:"Decision"}),(0,r.jsx)("option",{value:"PATTERN",children:"Pattern"}),(0,r.jsx)("option",{value:"BUG_ROOT_CAUSE",children:"Bug Root Cause"}),(0,r.jsx)("option",{value:"PREFERENCE",children:"Preference"}),(0,r.jsx)("option",{value:"CONSTRAINT",children:"Constraint"}),(0,r.jsx)("option",{value:"CONTEXT",children:"Context"}),(0,r.jsx)("option",{value:"LESSON",children:"Lesson"}),(0,r.jsx)("option",{value:"RELATIONSHIP",children:"Relationship"})]})})]}),c?(0,r.jsx)(i.G,{rows:5}):x?(0,r.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:x})}):0===t.length?(0,r.jsx)(o.p,{title:"No memories yet",description:u?"No memories of this type found. Try removing the filter.":"Memories will appear here as the agent captures knowledge from sessions.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}):(0,r.jsx)("div",{className:"space-y-8",children:f.map(e=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-3 flex items-center gap-3",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:e.label}),(0,r.jsx)("div",{className:"h-px flex-1 bg-white/[0.04]"}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.entries.length," ",1===e.entries.length?"entry":"entries"]})]}),(0,r.jsx)("div",{className:"space-y-3",children:e.entries.map(e=>(0,r.jsx)(l._,{entry:e,onForget:g},e.id))})]},e.label))})]})}},3446:(e,t,s)=>{"use strict";s.d(t,{Kv:()=>c,HI:()=>p,Xk:()=>d,yC:()=>x});var r=s(8111),a=s(5271),n=s(422),l=s(7811);class i{async request(e,t){let s="".concat(this.baseUrl).concat(e);if(this.repo){let e=s.includes("?")?"&":"?";s="".concat(s).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let r=l.env.NEXT_PUBLIC_ULPI_API_SECRET,a=await fetch(s,{...t,headers:{"Content-Type":"application/json",...r?{"X-Ulpi-Secret":r}:{},...null==t?void 0:t.headers}});if(!a.ok)throw Error((await a.json().catch(()=>({error:a.statusText}))).error||"API error: ".concat(a.status));return a.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,n.h)()}}let o=(0,a.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,s=(0,a.useMemo)(()=>{let e=(0,n.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new i:null}},[]);return(0,r.jsx)(o,{value:s,children:t})}function d(){return(0,a.useContext)(o).mode}function x(){let{localClient:e}=(0,a.useContext)(o);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function p(){return(0,a.useContext)(o)}},3951:(e,t,s)=>{"use strict";s.d(t,{G:()=>a});var r=s(8111);function a(e){let{rows:t=3,variant:s="skeleton",className:a=""}=e;return"spinner"===s?(0,r.jsx)("div",{className:"flex items-center justify-center py-16 ".concat(a),children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"h-7 w-7 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Loading..."})]})}):(0,r.jsx)("div",{className:"space-y-3 ".concat(a),children:Array.from({length:t}).map((e,t)=>(0,r.jsx)("div",{className:"animate-pulse rounded-xl border border-white/[0.04] bg-surface-800/50 p-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-lg bg-white/[0.06]"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3.5 w-1/3 rounded bg-white/[0.06]"}),(0,r.jsx)("div",{className:"h-3 w-2/3 rounded bg-white/[0.04]"})]}),(0,r.jsx)("div",{className:"h-5 w-16 rounded-full bg-white/[0.04]"})]})},t))})}},4616:(e,t,s)=>{Promise.resolve().then(s.bind(s,2603))},4632:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var r=s(8111);function a(){return(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function n(e){let{icon:t,title:s,description:n,action:l,className:i=""}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(i),children:[(0,r.jsx)("div",{className:"mb-4",children:null!=t?t:(0,r.jsx)(a,{})}),(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:s}),n&&(0,r.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:n}),l&&(0,r.jsx)("button",{onClick:l.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:l.label})]})}},4721:(e,t,s)=>{"use strict";s.d(t,{_:()=>o});var r=s(8111),a=s(5271);let n={DECISION:"bg-blue-500/15 text-blue-400 border-blue-500/20",PATTERN:"bg-green-500/15 text-green-400 border-green-500/20",BUG_ROOT_CAUSE:"bg-red-500/15 text-red-400 border-red-500/20",PREFERENCE:"bg-yellow-500/15 text-yellow-400 border-yellow-500/20",CONSTRAINT:"bg-orange-500/15 text-orange-400 border-orange-500/20",CONTEXT:"bg-purple-500/15 text-purple-400 border-purple-500/20",LESSON:"bg-pink-500/15 text-pink-400 border-pink-500/20",RELATIONSHIP:"bg-cyan-500/15 text-cyan-400 border-cyan-500/20"},l={critical:"text-red-400",high:"text-orange-400",medium:"text-yellow-400",low:"text-gray-500"};function i(e){var t;let{type:s}=e,a=null!=(t=n[s])?t:"bg-gray-500/15 text-gray-400 border-gray-500/20";return(0,r.jsx)("span",{className:"inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ".concat(a),children:s.replace(/_/g," ")})}function o(e){var t,s,n,o;let{entry:c,score:d,onForget:x}=e,[p,u]=(0,a.useState)(!1),h=!!c.detail,m=(null==(t=c.relatedFiles)?void 0:t.length)>0,g=h||m;return(0,r.jsxs)("div",{className:"rounded-xl border bg-surface-800/50 p-4 space-y-2 transition-colors ".concat(g?"cursor-pointer hover:border-white/[0.08]":""," ").concat(p?"border-primary-500/30":"border-white/[0.04]"),onClick:()=>g&&u(e=>!e),children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g&&(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500 transition-transform ".concat(p?"rotate-0":"-rotate-90"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})}),(0,r.jsx)(i,{type:c.type}),(0,r.jsx)("span",{className:"text-xs font-medium ".concat(l[c.importance]),children:c.importance}),void 0!==d&&(0,r.jsxs)("span",{className:"text-xs font-medium text-primary-400",children:[(100*d).toFixed(0),"% match"]})]}),x&&(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),x(c.id)},className:"rounded px-1.5 py-0.5 text-[10px] text-gray-600 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Mark as superseded",children:"forget"})]}),(0,r.jsx)("p",{className:"text-sm leading-relaxed text-gray-200",children:c.summary}),h&&(0,r.jsx)("p",{className:"text-xs leading-relaxed text-gray-400 whitespace-pre-wrap ".concat(p?"":"line-clamp-2"),children:c.detail}),p&&(0,r.jsxs)("div",{className:"space-y-2 border-t border-white/[0.04] pt-2",children:[m&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-600",children:"Related Files"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.relatedFiles.map(e=>(0,r.jsx)("span",{className:"inline-flex items-center gap-1 rounded bg-surface-800 px-2 py-0.5 font-mono text-[11px] text-gray-400",children:e.split("/").pop()},e))})]}),(null==(s=c.tags)?void 0:s.length)>0&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-600",children:"Tags"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.tags.map(e=>(0,r.jsxs)("span",{className:"inline-flex items-center rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-400",children:["#",e]},e))})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 pt-1 text-[11px] text-gray-600",children:[(null==(n=c.source)?void 0:n.sessionId)&&(0,r.jsxs)("span",{children:["Session: ",c.source.sessionId.slice(0,12),"..."]}),(0,r.jsxs)("span",{children:["Created: ",new Date(c.createdAt).toLocaleString()]}),(0,r.jsxs)("span",{className:"font-mono text-[10px]",children:["ID: ",c.id.slice(0,12)]})]})]}),!p&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-600",children:[(null==(o=c.tags)?void 0:o.length)>0&&(0,r.jsxs)("span",{children:["#",c.tags.slice(0,3).join(", #"),c.tags.length>3&&" +".concat(c.tags.length-3)]}),(0,r.jsx)("span",{children:function(e){let t=new Date(e);if(isNaN(t.getTime()))return e;let s=Date.now()-t.getTime();return s<6e4?"just now":s<36e5?"".concat(Math.floor(s/6e4),"m ago"):s<864e5?"".concat(Math.floor(s/36e5),"h ago"):s<6048e5?"".concat(Math.floor(s/864e5),"d ago"):t.toLocaleDateString()}(c.createdAt)}),m&&(0,r.jsxs)("span",{children:[c.relatedFiles.length," files"]})]})]})}}},e=>{e.O(0,[814,9743,7358],()=>e(e.s=4616)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5438],{422:(e,t,s)=>{"use strict";s.d(t,{J:()=>n,h:()=>a});var r=s(7811);function a(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function n(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},2603:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var r=s(8111),a=s(5271),n=s(3446),l=s(7102),i=s(3951),o=s(4632);function c(){let e=(0,n.yC)(),[t,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(!0),[x,p]=(0,a.useState)(null),[u,h]=(0,a.useState)(""),m=(0,a.useCallback)(async()=>{d(!0),p(null);try{var t;let r=u?"?type=".concat(u):"",a=await e.get("/api/memory/timeline".concat(r));s(null!=(t=a.entries)?t:[])}catch(e){p(e instanceof Error?e.message:"Failed to fetch timeline")}finally{d(!1)}},[e,u]);(0,a.useEffect)(()=>{m()},[m]);let g=(0,a.useCallback)(async t=>{try{await e.delete("/api/memory/entries/".concat(t)),s(e=>e.filter(e=>e.id!==t))}catch(e){}},[e]),f=function(e){let t=new Map;for(let s of e){let e=function(e){let t=new Date(e),s=new Date().getTime()-t.getTime();return s<864e5?"Today":s<1728e5?"Yesterday":s<6048e5?"This Week":t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}(s.createdAt),r=t.get(e);r?r.push(s):t.set(e,[s])}return Array.from(t.entries()).map(e=>{let[t,s]=e;return{label:t,entries:s}})}(t);return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Memory Timeline"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Chronological view of all agent memories."})]}),(0,r.jsx)("div",{children:(0,r.jsxs)("select",{value:u,onChange:e=>h(e.target.value),className:"rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs text-white outline-none focus:border-primary-500/50",children:[(0,r.jsx)("option",{value:"",children:"All Types"}),(0,r.jsx)("option",{value:"DECISION",children:"Decision"}),(0,r.jsx)("option",{value:"PATTERN",children:"Pattern"}),(0,r.jsx)("option",{value:"BUG_ROOT_CAUSE",children:"Bug Root Cause"}),(0,r.jsx)("option",{value:"PREFERENCE",children:"Preference"}),(0,r.jsx)("option",{value:"CONSTRAINT",children:"Constraint"}),(0,r.jsx)("option",{value:"CONTEXT",children:"Context"}),(0,r.jsx)("option",{value:"LESSON",children:"Lesson"}),(0,r.jsx)("option",{value:"RELATIONSHIP",children:"Relationship"})]})})]}),c?(0,r.jsx)(i.G,{rows:5}):x?(0,r.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:x})}):0===t.length?(0,r.jsx)(o.p,{title:"No memories yet",description:u?"No memories of this type found. Try removing the filter.":"Memories will appear here as the agent captures knowledge from sessions.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}):(0,r.jsx)("div",{className:"space-y-8",children:f.map(e=>(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-3 flex items-center gap-3",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:e.label}),(0,r.jsx)("div",{className:"h-px flex-1 bg-white/[0.04]"}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.entries.length," ",1===e.entries.length?"entry":"entries"]})]}),(0,r.jsx)("div",{className:"space-y-3",children:e.entries.map(e=>(0,r.jsx)(l._,{entry:e,onForget:g},e.id))})]},e.label))})]})}},3446:(e,t,s)=>{"use strict";s.d(t,{Kv:()=>c,HI:()=>p,Xk:()=>d,yC:()=>x});var r=s(8111),a=s(5271),n=s(422),l=s(7811);class i{async request(e,t){let s="".concat(this.baseUrl).concat(e);if(this.repo){let e=s.includes("?")?"&":"?";s="".concat(s).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let r=l.env.NEXT_PUBLIC_ULPI_API_SECRET,a=await fetch(s,{...t,headers:{"Content-Type":"application/json",...r?{"X-Ulpi-Secret":r}:{},...null==t?void 0:t.headers}});if(!a.ok)throw Error((await a.json().catch(()=>({error:a.statusText}))).error||"API error: ".concat(a.status));return a.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,n.h)()}}let o=(0,a.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,s=(0,a.useMemo)(()=>{let e=(0,n.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new i:null}},[]);return(0,r.jsx)(o,{value:s,children:t})}function d(){return(0,a.useContext)(o).mode}function x(){let{localClient:e}=(0,a.useContext)(o);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function p(){return(0,a.useContext)(o)}},3951:(e,t,s)=>{"use strict";s.d(t,{G:()=>a});var r=s(8111);function a(e){let{rows:t=3,variant:s="skeleton",className:a=""}=e;return"spinner"===s?(0,r.jsx)("div",{className:"flex items-center justify-center py-16 ".concat(a),children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"h-7 w-7 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Loading..."})]})}):(0,r.jsx)("div",{className:"space-y-3 ".concat(a),children:Array.from({length:t}).map((e,t)=>(0,r.jsx)("div",{className:"animate-pulse rounded-xl border border-white/[0.04] bg-surface-800/50 p-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-lg bg-white/[0.06]"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3.5 w-1/3 rounded bg-white/[0.06]"}),(0,r.jsx)("div",{className:"h-3 w-2/3 rounded bg-white/[0.04]"})]}),(0,r.jsx)("div",{className:"h-5 w-16 rounded-full bg-white/[0.04]"})]})},t))})}},4616:(e,t,s)=>{Promise.resolve().then(s.bind(s,2603))},4632:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var r=s(8111);function a(){return(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function n(e){let{icon:t,title:s,description:n,action:l,className:i=""}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(i),children:[(0,r.jsx)("div",{className:"mb-4",children:null!=t?t:(0,r.jsx)(a,{})}),(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:s}),n&&(0,r.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:n}),l&&(0,r.jsx)("button",{onClick:l.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:l.label})]})}},7102:(e,t,s)=>{"use strict";s.d(t,{_:()=>o});var r=s(8111),a=s(5271);let n={DECISION:"bg-blue-500/15 text-blue-400 border-blue-500/20",PATTERN:"bg-green-500/15 text-green-400 border-green-500/20",BUG_ROOT_CAUSE:"bg-red-500/15 text-red-400 border-red-500/20",PREFERENCE:"bg-yellow-500/15 text-yellow-400 border-yellow-500/20",CONSTRAINT:"bg-orange-500/15 text-orange-400 border-orange-500/20",CONTEXT:"bg-purple-500/15 text-purple-400 border-purple-500/20",LESSON:"bg-pink-500/15 text-pink-400 border-pink-500/20",RELATIONSHIP:"bg-cyan-500/15 text-cyan-400 border-cyan-500/20"},l={critical:"text-red-400",high:"text-orange-400",medium:"text-yellow-400",low:"text-gray-500"};function i(e){var t;let{type:s}=e,a=null!=(t=n[s])?t:"bg-gray-500/15 text-gray-400 border-gray-500/20";return(0,r.jsx)("span",{className:"inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ".concat(a),children:s.replace(/_/g," ")})}function o(e){var t,s,n,o;let{entry:c,score:d,onForget:x}=e,[p,u]=(0,a.useState)(!1),h=!!c.detail,m=(null==(t=c.relatedFiles)?void 0:t.length)>0,g=h||m;return(0,r.jsxs)("div",{className:"rounded-xl border bg-surface-800/50 p-4 space-y-2 transition-colors ".concat(g?"cursor-pointer hover:border-white/[0.08]":""," ").concat(p?"border-primary-500/30":"border-white/[0.04]"),onClick:()=>g&&u(e=>!e),children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g&&(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500 transition-transform ".concat(p?"rotate-0":"-rotate-90"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})}),(0,r.jsx)(i,{type:c.type}),(0,r.jsx)("span",{className:"text-xs font-medium ".concat(l[c.importance]),children:c.importance}),void 0!==d&&(0,r.jsxs)("span",{className:"text-xs font-medium text-primary-400",children:[(100*d).toFixed(0),"% match"]})]}),x&&(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),x(c.id)},className:"rounded px-1.5 py-0.5 text-[10px] text-gray-600 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Mark as superseded",children:"forget"})]}),(0,r.jsx)("p",{className:"text-sm leading-relaxed text-gray-200",children:c.summary}),h&&(0,r.jsx)("p",{className:"text-xs leading-relaxed text-gray-400 whitespace-pre-wrap ".concat(p?"":"line-clamp-2"),children:c.detail}),p&&(0,r.jsxs)("div",{className:"space-y-2 border-t border-white/[0.04] pt-2",children:[m&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-600",children:"Related Files"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.relatedFiles.map(e=>(0,r.jsx)("span",{className:"inline-flex items-center gap-1 rounded bg-surface-800 px-2 py-0.5 font-mono text-[11px] text-gray-400",children:e.split("/").pop()},e))})]}),(null==(s=c.tags)?void 0:s.length)>0&&(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-600",children:"Tags"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.tags.map(e=>(0,r.jsxs)("span",{className:"inline-flex items-center rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-400",children:["#",e]},e))})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 pt-1 text-[11px] text-gray-600",children:[(null==(n=c.source)?void 0:n.sessionId)&&(0,r.jsxs)("span",{children:["Session: ",c.source.sessionId.slice(0,12),"..."]}),(0,r.jsxs)("span",{children:["Created: ",new Date(c.createdAt).toLocaleString()]}),(0,r.jsxs)("span",{className:"font-mono text-[10px]",children:["ID: ",c.id.slice(0,12)]})]})]}),!p&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-600",children:[(null==(o=c.tags)?void 0:o.length)>0&&(0,r.jsxs)("span",{children:["#",c.tags.slice(0,3).join(", #"),c.tags.length>3&&" +".concat(c.tags.length-3)]}),(0,r.jsx)("span",{children:function(e){let t=new Date(e);if(isNaN(t.getTime()))return e;let s=Date.now()-t.getTime();return s<6e4?"just now":s<36e5?"".concat(Math.floor(s/6e4),"m ago"):s<864e5?"".concat(Math.floor(s/36e5),"h ago"):s<6048e5?"".concat(Math.floor(s/864e5),"d ago"):t.toLocaleDateString()}(c.createdAt)}),m&&(0,r.jsxs)("span",{children:[c.relatedFiles.length," files"]})]})]})}}},e=>{e.O(0,[814,9743,7358],()=>e(e.s=4616)),_N_E=e.O()}]);
|