reflex-agent 0.18.1 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +102 -102
- package/.next/app-path-routes-manifest.json +9 -9
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/agents/[agentId]/page.js +1 -1
- package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/[agentId]/respond/route.js +1 -1
- package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +1 -1
- package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
- package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
- package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/utilities/install-archive/route_client-reference-manifest.js +1 -1
- package/.next/server/app/audit/page.js +1 -1
- package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/dispatcher/page.js +1 -1
- package/.next/server/app/dispatcher/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding/page.js +1 -1
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -2
- package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
- package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/memory/page.js +2 -2
- package/.next/server/app/roots/[id]/memory/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/page.js +6 -6
- package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
- package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/[id]/workflows/page.js +2 -2
- package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
- package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
- package/.next/server/app/roots/new/page.js +4 -4
- package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +4 -4
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/share/[id]/file/page.js +2 -2
- package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
- package/.next/server/app/share/[id]/page.js +2 -2
- package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
- package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
- package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/utilities/page.js +2 -2
- package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +9 -9
- package/.next/server/chunks/1358.js +1 -1
- package/.next/server/chunks/{9186.js → 2389.js} +2 -2
- package/.next/server/chunks/285.js +5 -5
- package/.next/server/chunks/3332.js +1 -1
- package/.next/server/chunks/4578.js +0 -0
- package/.next/server/chunks/4812.js +1 -1
- package/.next/server/chunks/4969.js +1 -0
- package/.next/server/chunks/6356.js +3 -0
- package/.next/server/chunks/{6217.js → 7607.js} +1 -1
- package/.next/server/chunks/8040.js +1 -0
- package/.next/server/chunks/9098.js +1 -1
- package/.next/server/chunks/9809.js +1 -1
- package/.next/server/functions-config-manifest.json +3 -3
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_error.js +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{7343-d414cbf00d7903b3.js → 2885-3b6efe9070ae7699.js} +1 -1
- package/.next/static/chunks/334-e9ffb96d6720ee5b.js +1 -0
- package/.next/static/chunks/4108.a04c1e0b768f6392.js +1 -0
- package/.next/static/chunks/5371-f2503fe0dffea57d.js +1 -0
- package/.next/static/chunks/5744-eccd279a734c778c.js +1 -0
- package/.next/static/chunks/6642-02be14d0b5ca62b7.js +1 -0
- package/.next/static/chunks/app/layout-48a6fb46c228b814.js +1 -0
- package/.next/static/chunks/app/onboarding/page-06103f281ff3f063.js +1 -0
- package/.next/static/chunks/app/{page-a73a8abd219d328f.js → page-eed31ba1b952cf24.js} +1 -1
- package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-5fc17c5819406917.js +1 -0
- package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-a52b2005a7e538ca.js +1 -0
- package/.next/static/chunks/app/roots/[id]/memory/{page-c69f17be3048bdc2.js → page-4edc11023d8a13fd.js} +1 -1
- package/.next/static/chunks/app/roots/[id]/page-0f0d498f4b4bd7bf.js +1 -0
- package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-f93d6b1bb29e79f0.js +1 -0
- package/.next/static/chunks/app/roots/[id]/workflows/page-562913d54bcd08d5.js +1 -0
- package/.next/static/chunks/app/roots/new/page-98d64261cc2ae2a1.js +1 -0
- package/.next/static/chunks/app/settings/page-7a4d8a407fbe5ed8.js +1 -0
- package/.next/static/chunks/app/share/[id]/page-a0540dba09771e84.js +1 -0
- package/.next/static/chunks/app/utilities/[scope]/[id]/page-2cee9be029f211c6.js +1 -0
- package/.next/static/chunks/app/utilities/page-197156f16167514e.js +1 -0
- package/.next/static/chunks/{webpack-648ac9036cb1b816.js → webpack-dbfe1e5d0f7f7a98.js} +1 -1
- package/.next/trace +90 -90
- package/package.json +1 -1
- package/.next/server/chunks/1525.js +0 -1
- package/.next/server/chunks/404.js +0 -3
- package/.next/server/chunks/9703.js +0 -1
- package/.next/static/chunks/4035-c900a19ab709c489.js +0 -1
- package/.next/static/chunks/4108.2a1cd2be227d1db6.js +0 -1
- package/.next/static/chunks/5572-cc7066942d006956.js +0 -1
- package/.next/static/chunks/59-8d4a53ee7c914335.js +0 -1
- package/.next/static/chunks/8523-ce9e5fd4102e0550.js +0 -1
- package/.next/static/chunks/app/layout-61561440bde8894f.js +0 -1
- package/.next/static/chunks/app/onboarding/page-25b3a1c1da972648.js +0 -1
- package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-1c1825c48749b024.js +0 -1
- package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-aa97c0262e3f3a94.js +0 -1
- package/.next/static/chunks/app/roots/[id]/page-5385296d9e6fb5bd.js +0 -1
- package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-3d141c8450f93771.js +0 -1
- package/.next/static/chunks/app/roots/[id]/workflows/page-39f9bcc115ebee4b.js +0 -1
- package/.next/static/chunks/app/roots/new/page-be08d7bdb6d3ec29.js +0 -1
- package/.next/static/chunks/app/settings/page-1a56d55862b78015.js +0 -1
- package/.next/static/chunks/app/share/[id]/page-4713e54d2c21a7d8.js +0 -1
- package/.next/static/chunks/app/utilities/[scope]/[id]/page-749569080a03f192.js +0 -1
- package/.next/static/chunks/app/utilities/page-7ec6d0962a63b2cf.js +0 -1
- /package/.next/static/{wqvqGv9K0VMAHRhcQ6dS5 → kKiRbrTiD77WXduAvKNfN}/_buildManifest.js +0 -0
- /package/.next/static/{wqvqGv9K0VMAHRhcQ6dS5 → kKiRbrTiD77WXduAvKNfN}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{3989:(e,t,s)=>{"use strict";s.d(t,{ChatView:()=>eu});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),o=s(23506),l=s(1646),d=s(3239),c=s(95265),m=s(8096),u=s(56221),p=s(28310),x=s(85253),h=s(53588),g=s(63602),f=s(39121),v=s(63514),b=s(69709),j=s(69205),w=s(49623),N=s(51587),y=s(76479),k=s(53296),C=s(43863),A=s(9923),S=s(94494),I=s(13506);function P(e){let{name:t,input:s,result:a,pending:o}=e,l=(0,i.c)("roots"),[c,m]=(0,n.useState)(!1),u=function(e){let t=e.toLowerCase();return"read"===t?w.A:"write"===t||"edit"===t?N.A:"bash"===t||"shell"===t?y.A:"glob"===t?k.A:"grep"===t||"search"===t?C.A:"ls"===t?A.A:S.A}(t),p=function(e,t){if(!t||"object"!=typeof t)return"";let s=e.toLowerCase();if(("read"===s||"write"===s||"edit"===s)&&"string"==typeof t.file_path)return t.file_path;if("bash"===s&&"string"==typeof t.command)return t.command.length>80?t.command.slice(0,77)+"…":t.command;if("glob"===s&&"string"==typeof t.pattern)return t.pattern;if("grep"===s){let e=[];return"string"==typeof t.pattern&&e.push(t.pattern),"string"==typeof t.path&&e.push("in ".concat(t.path)),e.join(" ")}return"ls"===s&&"string"==typeof t.path?t.path:""}(t,s);return(0,r.jsxs)("div",{className:(0,I.cn)("rounded-lg border my-2 text-sm overflow-hidden",(null==a?void 0:a.isError)?"border-destructive/40 bg-destructive/5":"bg-muted/30"),children:[(0,r.jsxs)("button",{type:"button",onClick:()=>m(e=>!e),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-accent/40 transition-colors",children:[c?(0,r.jsx)(b.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):(0,r.jsx)(j.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,r.jsx)(u,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"font-mono text-xs font-medium",children:t}),p&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:p}),(0,r.jsx)("span",{className:"ml-auto text-[10px] uppercase tracking-wider text-muted-foreground shrink-0",children:o?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})," ",l("toolCall.working")]}):(null==a?void 0:a.isError)?(0,r.jsx)("span",{className:"text-destructive",children:l("toolCall.error")}):a?(0,r.jsx)("span",{children:l("toolCall.done")}):(0,r.jsx)("span",{children:"—"})})]}),c&&(0,r.jsxs)("div",{className:"px-3 pb-3 space-y-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"input"}),(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-background/60 rounded p-2 overflow-x-auto whitespace-pre-wrap break-all",children:function(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}(s)})]}),a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"output"}),(0,r.jsx)("pre",{className:(0,I.cn)("text-[11px] font-mono rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-64 overflow-y-auto",a.isError?"bg-destructive/10 text-destructive-foreground":"bg-background/60"),children:a.content||"(empty)"})]})]})]})}var T=s(3024),q=s(86295),R=s(13561),z=s(43153),B=s(59145),E=s(35687),O=s(39783),$=s(65714),L=s(15523),D=s(78825),U=s(66459);function H(e){let{perm:t}=e,s=(0,i.c)("roots"),[a,o]=(0,n.useTransition)(),l=t.resolved,c=(e,s)=>{o(async()=>{let r=await fetch("/api/agents/".concat(t.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"permission",requestId:t.requestId,decision:e,...s?{scope:s}:{},...t.tool?{tool:t.tool}:{}})});if(!r.ok){var n;let e=await r.json().catch(()=>({}));u.oR.error(null!=(n=e.error)?n:"HTTP ".concat(r.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",l&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,r.jsx)(T.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:s("permissionCard.title")}),t.tool&&(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.tool}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:t.requestId})]}),t.description&&(0,r.jsx)("p",{className:"text-sm mb-2",children:t.description}),void 0!==t.input&&(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-muted/40 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-3",children:M(t.input)}),l?(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm",children:"allow"===l.decision?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q.A,{className:"h-4 w-4 text-emerald-600"}),(0,r.jsx)("span",{children:s("permissionCard.allowed",{scope:l.scope?" (".concat(l.scope,")"):""})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"h-4 w-4 text-destructive"}),(0,r.jsx)("span",{children:s("permissionCard.denied")})]})}):(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsxs)(x.$,{size:"sm",onClick:()=>c("allow","once"),disabled:a,children:[a?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.allow")]}),(0,r.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>c("allow","always"),disabled:a,children:[(0,r.jsx)(q.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.allowAlways")]}),(0,r.jsxs)(x.$,{size:"sm",variant:"destructive",onClick:()=>c("deny"),disabled:a,children:[(0,r.jsx)(R.A,{className:"mr-2 h-3.5 w-3.5"}),s("permissionCard.deny")]})]})]})})}function F(e){var t;let{question:s}=e,a=(0,i.c)("roots"),[o,l]=(0,n.useState)(""),[c,m]=(0,n.useState)(new Set),[p,h]=(0,n.useTransition)(),g=s.resolved,f=s.options&&s.options.length>0?s.options:(null!=(t=s.choices)?t:[]).map(e=>({label:e})),v=e=>{e.trim()&&h(async()=>{let t=await fetch("/api/agents/".concat(s.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"answer",questionId:s.questionId,answer:e.trim()})});if(t.ok)l(""),m(new Set);else{var r;let e=await t.json().catch(()=>({}));u.oR.error(null!=(r=e.error)?r:"HTTP ".concat(t.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",g&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground flex-wrap",children:[(0,r.jsx)(B.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:a("questionCard.title")}),s.header&&(0,r.jsx)("span",{className:"rounded bg-violet-100 dark:bg-violet-950/60 text-violet-900 dark:text-violet-200 px-1.5 py-0.5 text-[10px] uppercase font-mono",children:s.header}),s.multiSelect&&(0,r.jsx)("span",{className:"text-[10px] normal-case tracking-normal italic",children:a("questionCard.multiSelect")}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:s.questionId})]}),(0,r.jsx)("p",{className:"text-sm font-medium mb-3",children:s.prompt}),g?(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:[a("questionCard.answerLabel")," ",(0,r.jsx)("span",{className:"text-foreground",children:function(e){if(!e.startsWith("["))return e;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e))return t.join(", ")}catch(e){}return e}(g.answer)})]}):(0,r.jsxs)("div",{className:"space-y-2",children:[f.length>0&&(0,r.jsx)("div",{className:"flex flex-col gap-1.5",children:f.map(e=>{let t=c.has(e.label);return s.multiSelect?(0,r.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.label,void m(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},disabled:p,className:(0,I.cn)("flex items-start gap-2 text-left rounded-md border p-2.5 transition",t?"border-violet-500 bg-violet-50 dark:bg-violet-950/30":"border-input hover:bg-accent/40",p&&"opacity-50"),children:[(0,r.jsx)("span",{className:(0,I.cn)("mt-0.5 h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center",t?"bg-violet-600 border-violet-600 text-white":"border-muted-foreground/40"),children:t&&(0,r.jsx)(z.A,{className:"h-2.5 w-2.5"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),e.description&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:e.description})]})]},e.label):(0,r.jsx)("button",{type:"button",onClick:()=>v(e.label),disabled:p,className:(0,I.cn)("flex items-start gap-2 text-left rounded-md border p-2.5 transition","border-input hover:bg-accent/60 hover:border-violet-400",p&&"opacity-50"),children:(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),e.description&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 leading-snug",children:e.description})]})},e.label)})}),s.multiSelect&&f.length>0&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,r.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a("questionCard.selected",{count:c.size})}),(0,r.jsxs)(x.$,{type:"button",size:"sm",onClick:()=>{0!==c.size&&v(JSON.stringify([...c]))},disabled:p||0===c.size,children:[p?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),a("questionCard.submit")]})]}),(0,r.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,r.jsx)(L.p,{value:o,onChange:e=>l(e.target.value),placeholder:a("questionCard.ownAnswerPlaceholder"),disabled:p,className:"h-9 text-sm"}),(0,r.jsxs)(x.$,{type:"submit",size:"sm",disabled:p||!o.trim(),children:[p?(0,r.jsx)(d.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z.A,{className:"mr-2 h-3.5 w-3.5"}),a("questionCard.submit")]})]})]})]})})}function J(e){let{entry:t}=e,s=(0,i.c)("roots"),[a,o]=(0,n.useTransition)(),[l,c]=(0,n.useState)({}),m=t.resolved,p=e=>{if("approve"===e){var r,n;for(let e of null!=(r=t.secrets)?r:[])if(!e.oauth&&e.required&&!(null==(n=l[e.envKey])?void 0:n.trim()))return void u.oR.error(s("mcpAddCard.secretRequired",{label:e.label||e.envKey}))}o(async()=>{let s=await fetch("/api/agents/".concat(t.agentId,"/respond"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"mcp-add",requestId:t.requestId,decision:e,..."approve"===e?{secretValues:l}:{}})});if(!s.ok){var r;let e=await s.json().catch(()=>({}));u.oR.error(null!=(r=e.error)?r:"HTTP ".concat(s.status))}})};return(0,r.jsx)("div",{className:(0,I.cn)("rounded-lg border-2 my-2 p-4 reflex-gradient",m&&"opacity-60"),children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:s("mcpAddCard.title")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.server}),(0,r.jsx)("span",{className:"ml-auto font-mono normal-case tracking-normal",children:t.requestId})]}),(0,r.jsx)("div",{className:"text-sm font-medium",children:t.label}),t.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),(0,r.jsx)("pre",{className:"text-[11px] font-mono bg-muted/40 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto my-3",children:M(t.config)}),t.secrets&&t.secrets.length>0&&!m&&(0,r.jsxs)("div",{className:"space-y-2 mb-3",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:s("mcpAddCard.fillSecrets")}),t.secrets.map(e=>{var t;return e.oauth?(0,r.jsx)(K,{slot:e},e.envKey):(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("label",{className:"text-xs flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono",children:e.envKey}),(0,r.jsx)("span",{className:"text-muted-foreground",children:e.label}),e.required&&(0,r.jsx)("span",{className:"text-destructive text-[10px]",children:"*"})]}),e.description&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.description}),(0,r.jsx)(L.p,{type:"password",value:null!=(t=l[e.envKey])?t:"",onChange:t=>c(s=>({...s,[e.envKey]:t.target.value})),placeholder:e.required?s("mcpAddCard.required"):s("mcpAddCard.optional"),className:"font-mono text-xs h-8"})]},e.envKey)})]}),m?(0,r.jsx)("div",{className:"flex items-center gap-2 text-sm",children:"approve"===m.decision?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.A,{className:"h-4 w-4 text-emerald-600"}),(0,r.jsx)("span",{children:s("mcpAddCard.registered")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{className:"h-4 w-4 text-destructive"}),(0,r.jsx)("span",{children:s("mcpAddCard.rejected")})]})}):(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,r.jsxs)(x.$,{type:"button",variant:"default",size:"sm",onClick:()=>p("approve"),disabled:a,children:[a&&(0,r.jsx)(d.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),(0,r.jsx)(z.A,{className:"h-3.5 w-3.5 mr-1"})," ",s("mcpAddCard.register")]}),(0,r.jsxs)(x.$,{type:"button",variant:"outline",size:"sm",onClick:()=>p("reject"),disabled:a,children:[(0,r.jsx)(R.A,{className:"h-3.5 w-3.5 mr-1"})," ",s("mcpAddCard.reject")]})]})]})})}function K(e){var t,a;let{slot:o}=e,l=(0,i.c)("roots"),[c,m]=(0,n.useState)(null),[p,h]=(0,n.useState)(null),[g,f]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[w,N]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[C,A]=(0,n.useTransition)(),[S,I]=(0,n.useTransition)(),P=async()=>{if(!o.oauth)return;let{listOAuthStatusesAction:e,getOAuthClientAction:t}=await s.e(4108).then(s.bind(s,94108)),[r,n]=await Promise.all([e(),t(o.oauth)]);if(r.ok){let e=r.statuses.find(e=>e.id===o.oauth);e&&m({hasClient:e.hasClient,hasTokens:e.hasTokens})}if(n.ok){var a;h({setupHint:n.setupHint,consoleUrl:n.consoleUrl,needsClientSecret:n.needsClientSecret,setupSteps:null!=(a=n.setupSteps)?a:[]}),n.client?(f(n.client.clientId),N(n.client.hasSecret)):(f(""),N(!1))}};(0,n.useEffect)(()=>{P()},[o.oauth]);let T=!(null==c?void 0:c.hasClient);return(0,r.jsxs)("div",{className:"space-y-2 rounded border border-violet-200 bg-violet-50/30 p-2",children:[(0,r.jsxs)("label",{className:"text-xs flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono",children:o.envKey}),(0,r.jsx)("span",{className:"text-muted-foreground",children:o.label}),(0,r.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-violet-700 ml-auto",children:l("mcpAddCard.oauthLabel",{provider:null!=(t=o.oauth)?t:""})})]}),o.description&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:o.description}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(null==c?void 0:c.hasTokens)?(0,r.jsxs)("span",{className:"text-xs text-emerald-700 flex items-center gap-1",children:[(0,r.jsx)(z.A,{className:"h-3 w-3"})," ",l("mcpAddCard.authorized")]}):(null==c?void 0:c.hasClient)?(0,r.jsxs)(x.$,{type:"button",size:"sm",variant:"outline",onClick:()=>{o.oauth&&A(async()=>{let{beginOAuthAction:e,listOAuthStatusesAction:t}=await s.e(4108).then(s.bind(s,94108)),r=await e(o.oauth);if(!r.ok)return void u.oR.error(r.error);window.open(r.authorizeUrl,"reflex-oauth","width=600,height=720,noopener=no");let n=Date.now(),a=async()=>{if(Date.now()-n>3e5)return void u.oR.error(l("mcpAddCard.authorizationTimedOut"));let e=await t();if(e.ok){let t=e.statuses.find(e=>e.id===o.oauth);if(null==t?void 0:t.hasTokens){u.oR.success(l("mcpAddCard.providerAuthorized",{provider:o.oauth})),m({hasClient:t.hasClient,hasTokens:t.hasTokens});return}}setTimeout(()=>void a(),1500)};a()})},disabled:C,className:"h-7 text-xs",children:[C&&(0,r.jsx)(d.A,{className:"mr-1 h-3 w-3 animate-spin"}),l("mcpAddCard.authorizeVia",{provider:null!=(a=o.oauth)?a:""})]}):(0,r.jsx)("span",{className:"text-xs text-amber-700",children:l("mcpAddCard.clientIdNotConfigured")}),!T&&(0,r.jsxs)(x.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>k(e=>!e),className:"h-7 text-xs text-muted-foreground gap-1",children:[(0,r.jsx)(b.A,{className:"h-3 w-3 transition-transform ".concat(y?"rotate-180":"")}),y?l("mcpAddCard.hideClient"):l("mcpAddCard.editClient")]}),(0,r.jsx)(x.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>void P(),className:"h-7 text-xs text-muted-foreground ml-auto",children:l("mcpAddCard.refresh")})]}),(y||T)&&p&&(0,r.jsxs)("div",{className:"space-y-2 border-t border-violet-200 pt-2 mt-2",children:[p.setupHint&&(0,r.jsx)("div",{className:"rounded border border-amber-200 bg-amber-50 px-2 py-1.5 text-[10px] text-amber-900 leading-snug",children:p.setupHint}),(0,r.jsxs)("a",{href:p.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] text-violet-700 hover:underline inline-flex items-center gap-1",children:[(0,r.jsx)(O.A,{className:"h-3 w-3"}),l("mcpAddCard.openProviderConsole")]}),p.setupSteps.length>0&&(0,r.jsxs)("div",{className:"rounded border border-violet-200 bg-white/60 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:l("mcpAddCard.stepByStep")}),(0,r.jsx)(U.O,{steps:p.setupSteps})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"text-[10px]",children:l("mcpAddCard.clientIdLabel")}),(0,r.jsx)(L.p,{value:g,onChange:e=>f(e.target.value),placeholder:"123…apps.googleusercontent.com",className:"font-mono text-xs h-7"})]}),p.needsClientSecret&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(D.J,{className:"text-[10px]",children:[l("mcpAddCard.clientSecretLabel")," ",w&&(0,r.jsx)("span",{className:"text-muted-foreground",children:l("mcpAddCard.clientSecretSavedHint")})]}),(0,r.jsx)(L.p,{type:"password",value:v,onChange:e=>j(e.target.value),placeholder:w?"••••":"GOCSPX-…",className:"font-mono text-xs h-7"})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(x.$,{type:"button",size:"sm",onClick:()=>{if(o.oauth){if(!g.trim())return void u.oR.error(l("mcpAddCard.clientIdRequired"));I(async()=>{let{saveOAuthClientAction:e}=await s.e(4108).then(s.bind(s,94108)),t=await e({provider:o.oauth,clientId:g.trim(),...v?{clientSecret:v}:{}});if(!t.ok)return void u.oR.error(t.error);u.oR.success(l("mcpAddCard.clientSaved")),j(""),await P()})}},disabled:S||!g.trim(),className:"h-7 text-xs",children:[S?(0,r.jsx)(d.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,r.jsx)($.A,{className:"mr-1 h-3 w-3"}),l("mcpAddCard.saveClient")]})})]})]})}function M(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}var _=s(54400),W=s.n(_),V=s(7293),G=s(86515),Z=s(16329),X=s(40805),Q=s(8583),Y=s(35994);function ee(e){let{rootId:t,entry:s}=e,n=(0,i.c)("roots"),a=function(e){let t=e.toLowerCase();return"task"===t||"tasks"===t?G.A:"meeting"===t||"meetings"===t?Z.A:"product"===t||"products"===t?X.A:"fact"===t||"facts"===t?Q.A:Y.A}(s.kind),o="/roots/".concat(t,"?file=").concat(encodeURIComponent(s.relPath));return(0,r.jsx)(W(),{href:o,className:"my-2 block rounded-lg border-2 p-[2px] reflex-gradient hover:shadow-md transition-shadow",children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-3 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"reflex-gradient h-9 w-9 rounded-md flex items-center justify-center text-white shrink-0",children:(0,r.jsx)(a,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:n("kbWriteCard.writtenToKb")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:s.kind})]}),(0,r.jsx)("div",{className:"text-sm font-medium truncate",children:s.title}),(0,r.jsx)("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:s.relPath})]}),(0,r.jsx)(V.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})})}var et=s(39624);function es(e){let{utility:t,rootId:s}=e,n=(0,i.c)("roots"),a="project"===t.scope&&s?"?rootId=".concat(encodeURIComponent(s)):"",o="/utilities/".concat(t.scope,"/").concat(t.id).concat(a);return(0,r.jsx)(W(),{href:o,className:"my-2 block rounded-lg border-2 p-[2px] reflex-gradient hover:shadow-md transition-shadow",children:(0,r.jsxs)("div",{className:"rounded-md bg-background/95 backdrop-blur p-3 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"reflex-gradient h-9 w-9 rounded-md flex items-center justify-center text-white shrink-0",children:(0,r.jsx)(et.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:n("utilityCard.installed")}),(0,r.jsx)("span",{className:"font-mono normal-case tracking-normal",children:t.scope})]}),(0,r.jsx)("div",{className:"text-sm font-medium truncate",children:t.name}),(0,r.jsxs)("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[t.id," \xb7 v",t.version]})]})]})})}var er=s(94870),en=s(56380),ea=s(76974),ei=s(4001),eo=s(72581);function el(e){let{rootId:t,widget:s}=e,a=(0,i.c)("roots"),[o,l]=(0,n.useState)(!1),[d,c]=(0,n.useTransition)();return(0,r.jsxs)("div",{className:"my-3 rounded-lg border border-violet-200 bg-violet-50/40 dark:border-violet-900/40 dark:bg-violet-950/20 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-violet-200 dark:border-violet-900/40 bg-violet-100/40 dark:bg-violet-900/20 text-xs",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium text-violet-900 dark:text-violet-200",children:"create"===s.op?a("widgetPreview.created"):a("widgetPreview.updated")}),(0,r.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono",children:s.widgetKind}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono ml-1",children:s.widgetId}),o?(0,r.jsxs)("span",{className:"ml-auto inline-flex items-center gap-1 text-[10px] text-emerald-700",children:[(0,r.jsx)(z.A,{className:"h-3 w-3"}),a("widgetPreview.onDashboard")]}):(0,r.jsxs)("button",{type:"button",onClick:()=>{c(async()=>{let e=await (0,eo.t)(t,s.widgetId);e.ok?(l(!0),u.oR.success(a("widgetPreview.pinned"))):u.oR.error(e.error)})},disabled:d,className:"ml-auto inline-flex items-center gap-1 text-[10px] text-violet-700 hover:underline disabled:opacity-50",title:a("widgetPreview.pinToDashboardTitle"),children:[(0,r.jsx)(er.A,{className:"h-3 w-3"}),d?a("widgetPreview.pinning"):a("widgetPreview.pinToDashboard")]}),(0,r.jsx)(W(),{href:"/roots/".concat(t),className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-violet-700",title:a("widgetPreview.openDashboard"),children:(0,r.jsx)(en.A,{className:"h-3 w-3"})})]}),(0,r.jsxs)("div",{className:"p-3 space-y-2 bg-card",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:s.title}),s.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description})]}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground inline-flex items-center gap-0.5",title:a("widgetPreview.editViaChatTitle"),children:[(0,r.jsx)(ea.A,{className:"h-2.5 w-2.5"}),a("widgetPreview.editViaChat")]})]}),(0,r.jsx)("div",{className:"pt-1",children:(0,ei.v)(t,s.widgetKind,s.data,{readonly:!0})})]})]})}var ed=s(27474),ec=s(54207);function em(e){let{rootId:t,workflow:s}=e,n=(0,i.c)("roots");return(0,r.jsxs)("div",{className:"my-3 rounded-lg border border-violet-200 bg-violet-50/40 dark:border-violet-900/40 dark:bg-violet-950/20 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-violet-200 dark:border-violet-900/40 bg-violet-100/40 dark:bg-violet-900/20 text-xs",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-600"}),(0,r.jsx)("span",{className:"font-medium text-violet-900 dark:text-violet-200",children:n("workflowPreview.created")}),(0,r.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono",children:s.trigger}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono ml-1",children:s.workflowId})]}),(0,r.jsxs)("div",{className:"p-3 space-y-2 bg-card",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(ed.A,{className:"h-4 w-4 text-violet-600 mt-0.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:s.label}),s.description&&(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.description}),(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1",children:n.rich("workflowPreview.stepsCount",{count:s.stepCount,trigger:s.trigger,code:e=>(0,r.jsx)("code",{className:"font-mono",children:e})})})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 pt-1 text-xs",children:[(0,r.jsxs)(W(),{href:"/roots/".concat(t,"/workflows/").concat(s.workflowId),className:"inline-flex items-center gap-1 rounded px-2 py-1 bg-violet-600 text-white hover:bg-violet-700",children:[(0,r.jsx)(ec.A,{className:"h-3 w-3"}),n("workflowPreview.openInEditor")]}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground inline-flex items-center gap-1",children:[(0,r.jsx)(ea.A,{className:"h-2.5 w-2.5"}),n("workflowPreview.editHereViaChat")]})]})]})]})}function eu(e){let{rootId:t,topicId:s,initialEvents:a,initialActive:m}=e,x=(0,i.c)("roots"),[h,b]=(0,n.useState)(a),[j,w]=(0,n.useState)(m),[N,y]=(0,n.useState)(!1),k=(0,n.useRef)(a.length>0?a[a.length-1].seq:-1),C=(0,n.useRef)(null),A=(0,n.useMemo)(()=>(function(e){let t=[],s=new Map,r=null,n=null,a=e=>{var a;let i=s.get(e),o={kind:"assistant",agentId:e,agentLabel:null!=(a=null==i?void 0:i.label)?a:"assistant",...(null==i?void 0:i.model)?{agentModel:i.model}:{},...(null==i?void 0:i.role)?{agentRole:i.role}:{},segments:[],pending:!0};return t.push(o),r=o,n=null,o},i=(e,t)=>{let s=r;s&&(s.pending=!1,"failed"===e&&t&&(s.error=t),r=null,n=null)};for(let l of e){if("agent-start"===l.type){s.set(l.agentId,l.meta);continue}if("turn-start"===l.type){a(l.agentId);continue}if("turn-end"===l.type||"agent-end"===l.type){i(l.status,l.error);continue}if("user-message"===l.type){let e=s.get(l.agentId),r=null==e?void 0:e.role;t.push({kind:"user",body:l.text,agentId:l.agentId,...r?{agentRole:r}:{},...(null==e?void 0:e.label)?{agentLabel:e.label}:{}});continue}if("system"===l.type){l.subtype&&l.subtype.startsWith("reflex.")&&t.push({kind:"system",body:l.text,systemSubtype:l.subtype});continue}if("assistant-delta"===l.type){let e=r;if(e||(e=a(l.agentId)),!e)continue;let t=e.segments;if(n&&"text"===n.kind)n.text+=l.text;else{let e={kind:"text",text:l.text};t.push(e),n=e}continue}if("tool-use"===l.type){let e=r;if(e||(e=a(l.agentId)),!e)continue;let t=e.segments,s={kind:"tool",tool:{toolUseId:l.toolUseId,name:l.name,input:l.input}};t.push(s),n=s;continue}if("tool-result"===l.type){var o;let e=r;if(!e)continue;let t=null!=(o=e.segments)?o:[];for(let e=t.length-1;e>=0;e--){let s=t[e];if("tool"===s.kind&&s.tool.toolUseId===l.toolUseId){s.tool.result={content:l.content,...l.isError?{isError:!0}:{}};break}}continue}if("error"===l.type){let e=r;e&&(e.error=l.message);continue}if("permission-request"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"permission",perm:{requestId:l.requestId,agentId:l.agentId,...l.tool?{tool:l.tool}:{},...l.action?{action:l.action}:{},...void 0!==l.input?{input:l.input}:{},...l.description?{description:l.description}:{}}}),n=e.segments[e.segments.length-1];continue}if("permission-response"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"permission"===t.kind&&t.perm.requestId===l.requestId&&(t.perm.resolved={decision:l.decision,...l.scope?{scope:l.scope}:{}});continue}if("question"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"question",question:{questionId:l.questionId,agentId:l.agentId,prompt:l.prompt,...l.header?{header:l.header}:{},...l.multiSelect?{multiSelect:!0}:{},...l.choices?{choices:l.choices}:{},...l.options?{options:l.options}:{}}}),n=e.segments[e.segments.length-1];continue}if("answer"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"question"===t.kind&&t.question.questionId===l.questionId&&(t.question.resolved={answer:l.answer});continue}if("mcp-add-request"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"mcp-add",entry:{requestId:l.requestId,agentId:l.agentId,server:l.server,label:l.label,...l.description?{description:l.description}:{},config:l.config,...l.secrets?{secrets:l.secrets}:{}}}),n=e.segments[e.segments.length-1];continue}if("mcp-add-response"===l.type){for(let e of t)if("assistant"===e.kind&&e.segments)for(let t of e.segments)"mcp-add"===t.kind&&t.entry.requestId===l.requestId&&(t.entry.resolved={decision:l.decision});continue}if("onboarding-done"===l.type){t.push({kind:"onboarding-done"});continue}if("kb-write"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"kb",kb:{kind:l.kind,title:l.title,relPath:l.relPath}}),n=e.segments[e.segments.length-1];continue}if("utility-installed"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"utility",utility:{id:l.utilityId,name:l.name,scope:l.scope,version:l.version}}),n=e.segments[e.segments.length-1];continue}if("utility-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}if("widget-event"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"widget",widget:{op:l.op,widgetId:l.widgetId,title:l.title,...l.description?{description:l.description}:{},widgetKind:l.kind,data:l.data,...l.sourceTopicId?{sourceTopicId:l.sourceTopicId}:{}}}),n=e.segments[e.segments.length-1];continue}if("widget-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}if("workflow-event"===l.type){let e=null!=r?r:a(l.agentId);if(!e)continue;e.segments.push({kind:"workflow",workflow:{workflowId:l.workflowId,label:l.label,...l.description?{description:l.description}:{},trigger:l.trigger,stepCount:l.stepCount}}),n=e.segments[e.segments.length-1];continue}if("workflow-error"===l.type){let e=null!=r?r:a(l.agentId);e&&(e.error=l.message);continue}}return t})(h),[h]),S=(0,n.useCallback)(()=>{let e=C.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,n.useEffect)(()=>{S()},[A,S]),(0,n.useEffect)(()=>{let e=new AbortController,r="/api/roots/".concat(t,"/chat/").concat(s,"/stream?since=").concat(k.current),n=!1;return(async()=>{try{let a=await fetch(r,{signal:e.signal});if(!a.ok||!a.body)return void y(!1);y(!0);let i=a.body.getReader(),o=new TextDecoder,l="";for(;!n;){let{done:e,value:r}=await i.read();if(e)break;for(let e of(l+=o.decode(r,{stream:!0}),function(e){let t=[];for(;;){let s=e.indexOf("\n\n");if(s<0)break;let r=e.slice(0,s);e=e.slice(s+2);let n="message",a="";for(let e of r.split(/\r?\n/))!e.startsWith(":")&&(e.startsWith("event:")?n=e.slice(6).trim():e.startsWith("data:")&&(a+=e.slice(5).trimStart()));let i=null;try{i=a?JSON.parse(a):null}catch(e){i=null}t.push({event:n,data:i,rest:e})}return t}(l)))if(l=e.rest,"event"===e.event&&e.data){let t=e.data;I(t)}else if("error"===e.event){var t,s;u.oR.error(String(null!=(s=null==(t=e.data)?void 0:t.message)?s:"stream"))}}}catch(e){n||y(!1)}finally{y(!1)}})(),()=>{n=!0,e.abort()}},[s,t]);let I=(0,n.useCallback)(e=>{e.seq<=k.current||(k.current=e.seq,b(t=>[...t,e]),"turn-start"===e.type?w(!0):"agent-start"===e.type&&"orchestrator"===e.meta.role&&w(!0),("turn-end"===e.type||"agent-end"===e.type)&&(w(!1),(0,v.$d)(v.Zi.topicsChanged(t))),"kb-write"===e.type&&(0,v.$d)(v.Zi.kbChanged(t)))},[t]),P=(0,n.useCallback)(async()=>{try{let r=await fetch("/api/roots/".concat(t,"/chat/").concat(s,"/stop"),{method:"POST"});if(!r.ok){var e;let t=await r.json().catch(()=>({}));u.oR.error(null!=(e=t.error)?e:"HTTP ".concat(r.status));return}w(!1)}catch(e){u.oR.error(e instanceof Error?e.message:String(e))}},[t,s]),T=(0,n.useCallback)(async(e,r)=>{let n=e.trim();if(!n&&0===r.length)return!1;try{let e=await fetch("/api/roots/".concat(t,"/chat/").concat(s,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n,attachments:r})});if(409===e.status)return u.oR.error(x("chat.waitForCurrentAnswer")),!1;if(!e.ok){var a;let t=await e.json().catch(()=>({}));return u.oR.error(null!=(a=t.error)?a:"HTTP ".concat(e.status)),!1}return!0}catch(e){return u.oR.error(e instanceof Error?e.message:String(e)),!1}},[t,s]);return(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsxs)("div",{className:"border-b px-6 py-2 flex items-center gap-3 text-xs",children:[(0,r.jsx)("span",{className:"text-muted-foreground inline-flex items-center gap-1",children:N?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.A,{className:"h-3 w-3 text-emerald-600"})," ",x("chat.connectedToStream")]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.A,{className:"h-3 w-3 text-muted-foreground"})," ",x("chat.offline")]})}),j&&(0,r.jsxs)(p.E,{variant:"default",className:"gap-1 bg-emerald-600",children:[(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})," ",x("chat.agentWorking")]}),(0,r.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground font-mono",children:["seq: ",k.current]})]}),(0,r.jsx)("div",{ref:C,className:"flex-1 overflow-y-auto",children:(0,r.jsx)("div",{className:"mx-auto max-w-3xl px-6 py-6 space-y-4",children:0===A.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground italic",children:x("chat.topicEmpty")}):A.map((e,n)=>(0,r.jsx)(ep,{turn:e,rootId:t,topicId:s},n))})}),(0,r.jsx)(g.E,{label:x("chat.replyInTopicLabel"),children:(0,r.jsx)(f.L,{rootId:t,topicId:s,placeholder:x("chat.topicPlaceholder"),submitLabel:x("chat.send"),pendingLabel:x("chat.sendPending"),SubmitIcon:c.A,active:j,onStop:P,onSubmit:e=>{let{message:t,attachments:s}=e;return T(t,s)}})})]})}function ep(e){var t,s,n,a;let{turn:o,rootId:l,topicId:c}=e,p=(0,i.c)("roots"),x=(e,t)=>{let s=p("kb.summaryContextChat",{url:t,text:e});fetch("/api/roots/".concat(l,"/chat/").concat(c,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s,attachments:[]})}).then(async e=>{if(!e.ok){var t;let s=await e.json().catch(()=>({}));u.oR.error(null!=(t=s.error)?t:"HTTP ".concat(e.status));return}u.oR.success(p("kb.summarySentToChat"))}).catch(e=>{u.oR.error(e instanceof Error?e.message:String(e))})};if("system"===o.kind)return(0,r.jsx)(eg,{body:null!=(s=o.body)?s:"",subtype:o.systemSubtype});if("onboarding-done"===o.kind)return(0,r.jsx)(eh,{rootId:l});if("user"===o.kind){if("subagent"===o.agentRole)return null;let e=null!=(n=o.body)?n:"";if(/^\/skill\s+space-onboarding\s*$/.test(e.trim()))return null;let t=function(e,t){let s=e.trimStart(),r=/^\[MCP setup wizard\]\s*([^\n]*)/.exec(s);if(r)return{badge:t.mcpSetupBadge,summary:r[1].trim()||t.mcpSetupDefault,details:e};let n=/^\[Reflex\]\s+Answer for question\s+\S+:\s+([\s\S]*?)(?:\s*\.?\s*Continue\.\s*)?$/.exec(s);if(n)return{badge:t.answerBadge,summary:n[1].trim(),details:e};let a=/^\[Reflex\]\s+(Allowed|Denied|User (allowed|denied))[\s\S]*?:\s*([\s\S]*?)(?:\s*\.?\s*Continue\.\s*)?$/.exec(s);if(a){var i,o;return{badge:t.permissionBadge,summary:(null!=(o=null!=(i=a[3])?i:a[1])?o:"").trim()||t.permissionUserDecision,details:e}}if(/^\[Reflex\]\s+(MCP server|User rejected|Failed to register)[\s\S]*?$/.exec(s)){let r=s.split("\n",1)[0];return{badge:t.mcpBadge,summary:r.replace(/^\[Reflex\]\s+/,"").slice(0,200),details:e}}if(/^\[Reflex \/goal\]\s+([\s\S]*)/.exec(s))return{badge:t.goalBadge,summary:t.goalAutoContinue,details:e};let l=/^\[Reflex[^\]]*\]\s*([\s\S]*)/.exec(s);if(l){let s=l[1].split("\n",1)[0].trim();return{badge:t.systemBadge,summary:s.slice(0,200)||t.systemMessage,details:e}}return null}(e,{mcpSetupDefault:p("chat.mcpSetupDefault"),mcpSetupBadge:p("chat.mcpSetupBadge"),answerBadge:p("chat.answerBadge"),permissionBadge:p("chat.permissionBadge"),permissionUserDecision:p("chat.permissionUserDecision"),mcpBadge:p("chat.mcpBadge"),goalBadge:p("chat.goalBadge"),goalAutoContinue:p("chat.goalAutoContinue"),systemBadge:p("chat.systemBadge"),systemMessage:p("chat.systemMessage")});return t?(0,r.jsx)(ef,{system:t}):(0,r.jsxs)("div",{className:"rounded-lg border bg-muted/40 p-4",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-2",children:"user"}),(0,r.jsx)(h.p,{source:e,onSendToChat:x})]})}let g="subagent"===o.agentRole;return(0,r.jsx)(ex,{isSubAgent:g,turn:o,children:(0,r.jsxs)("div",{className:g?"rounded-md border border-dashed bg-muted/30 px-3 py-2":"rounded-lg border bg-background p-4",children:[(0,r.jsxs)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-2 flex items-center gap-2",children:[(0,r.jsx)(m.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:null!=(a=o.agentLabel)?a:"assistant"}),g&&(0,r.jsx)("span",{className:"text-[10px] normal-case px-1.5 py-0.5 rounded bg-violet-100 text-violet-800 tracking-normal",children:"sub-agent"}),o.agentModel&&(0,r.jsx)("span",{className:"font-mono text-[10px] normal-case tracking-normal",children:o.agentModel}),o.pending&&(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"}),o.error&&(0,r.jsx)("span",{className:"text-destructive text-xs normal-case",children:p("chat.errorPrefix",{message:o.error})})]}),null==(t=o.segments)?void 0:t.map((e,t)=>{if("text"===e.kind){let s=function(e){let t=e;for(let e of["permission","question","kb","utility","dispatch","mcp-add","youtube-summary","widget-create","widget-update","workflow-create","image-gen","memory","suggestion","onboarding-done","skill-create","task-create","task-update"]){let s=RegExp("<{1,2}reflex:".concat(e,">{1,2}[\\s\\S]*?<{1,2}\\/reflex:").concat(e,">{1,2}"),"g");t=t.replace(s,"")}return t}(e.text);return s.trim()?(0,r.jsx)(h.p,{source:s,onSendToChat:x},t):null}return"tool"===e.kind?(0,r.jsx)(P,{name:e.tool.name,input:e.tool.input,...e.tool.result?{result:e.tool.result}:{},pending:!e.tool.result},t):"permission"===e.kind?(0,r.jsx)(H,{perm:e.perm},t):"question"===e.kind?(0,r.jsx)(F,{question:e.question},t):"kb"===e.kind?(0,r.jsx)(ee,{rootId:l,entry:e.kb},t):"mcp-add"===e.kind?(0,r.jsx)(J,{entry:e.entry},t):"utility"===e.kind?(0,r.jsx)(es,{utility:e.utility,rootId:l},t):"widget"===e.kind?(0,r.jsx)(el,{rootId:l,widget:e.widget},t):"workflow"===e.kind?(0,r.jsx)(em,{rootId:l,workflow:e.workflow},t):null}),o.pending&&(!o.segments||0===o.segments.length)&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:p("chat.thinking")})]})})}function ex(e){var t;let{isSubAgent:s,turn:n,children:a}=e,o=(0,i.c)("roots");if(!s)return(0,r.jsx)(r.Fragment,{children:a});let l=[null!=(t=n.agentLabel)?t:"sub-agent",o(n.pending?"chat.subAgentWorking":n.error?"chat.subAgentError":"chat.subAgentDone")].join(" \xb7 ");return(0,r.jsxs)("details",{className:"group",open:n.pending,children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 text-xs text-muted-foreground border-l-2 border-violet-300 pl-2 py-1 hover:text-foreground select-none",children:[(0,r.jsx)("span",{className:"inline-block h-3 w-3 text-center transition-transform group-open:rotate-90",children:"▸"}),(0,r.jsx)(m.A,{className:"h-3 w-3 text-violet-500"}),(0,r.jsx)("span",{children:l}),n.pending&&(0,r.jsx)(d.A,{className:"h-3 w-3 animate-spin"})]}),(0,r.jsx)("div",{className:"mt-1 pl-4",children:a})]})}function eh(e){let{rootId:t}=e,s=(0,a.useRouter)();return(0,r.jsx)("div",{className:"rounded-lg border border-emerald-300 bg-emerald-50/70 dark:bg-emerald-950/30 p-4",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"rounded-full bg-emerald-500/10 p-2 mt-0.5",children:(0,r.jsx)(m.A,{className:"h-4 w-4 text-emerald-600"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-medium text-sm",children:"Dashboard is ready"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Suggestions are waiting on the dashboard. Approve the ones that feel right; dismiss the rest. Come back here anytime to add context."})]}),(0,r.jsx)(x.$,{type:"button",size:"sm",onClick:()=>s.push("/roots/".concat(t)),children:"Go to dashboard"})]})})}function eg(e){let{body:t,subtype:s}=e;return(0,r.jsxs)("div",{className:["rounded-md border px-3 py-2 text-xs flex items-start gap-2","reflex.preflight"===s?"border-violet-200 bg-violet-50/60 text-violet-900":"border-dashed bg-muted/30 text-muted-foreground"].join(" "),children:[(0,r.jsx)(m.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-violet-600"}),(0,r.jsx)("div",{className:"whitespace-pre-wrap leading-relaxed flex-1 min-w-0",children:t})]})}function ef(e){let{system:t}=e;return(0,r.jsxs)("details",{className:"group rounded-md border border-dashed bg-muted/20 px-3 py-1.5 text-xs",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 select-none",children:[(0,r.jsx)("span",{className:"inline-block h-3 w-3 text-center text-muted-foreground transition-transform group-open:rotate-90",children:"▸"}),(0,r.jsx)("span",{className:"rounded bg-muted-foreground/10 text-[10px] uppercase tracking-wider text-muted-foreground px-1.5 py-0.5 font-mono",children:t.badge}),(0,r.jsx)("span",{className:"truncate text-foreground/80",children:t.summary})]}),(0,r.jsx)("pre",{className:"mt-2 pl-5 text-[11px] whitespace-pre-wrap font-mono text-muted-foreground/90",children:t.details})]})}},16225:(e,t,s)=>{"use strict";s.d(t,{DeleteTopicButton:()=>p});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),o=s(3239),l=s(46972),d=s(56221),c=s(85253),m=s(83977),u=s(63514);function p(e){let{rootId:t,topicId:s,topicTitle:p}=e,x=(0,i.c)("roots"),[h,g]=(0,n.useTransition)(),f=(0,a.useRouter)();return(0,r.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{confirm(x("deleteTopic.confirm",{title:p}))&&g(async()=>{let e=await (0,m.L)(t,s);if(!e.ok){var r;d.oR.error(null!=(r=e.error)?r:x("deleteTopic.deleteFailed"));return}d.oR.success(x("deleteTopic.deleted")),(0,u.$d)(u.Zi.topicsChanged(t)),f.push("/roots/".concat(t))})},disabled:h,className:"gap-1 h-8 text-muted-foreground hover:text-destructive",title:x("deleteTopic.title"),children:[h?(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"text-xs",children:x("deleteTopic.label")})]})}},25342:(e,t,s)=>{Promise.resolve().then(s.bind(s,3989)),Promise.resolve().then(s.bind(s,16225)),Promise.resolve().then(s.bind(s,46230)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},46230:(e,t,s)=>{"use strict";s.d(t,{GoalBadge:()=>g});var r=s(4624),n=s(99356),a=s(49411),i=s(13561),o=s(58726),l=s(5270),d=s(41234),c=s(56221),m=s(85253),u=s(28310),p=s(13506),x=s(7911);let h=(0,x.createServerReference)("60b41d4fdd2081fc24ac5e6e04f9a73163ba177af9",x.callServer,void 0,x.findSourceMapURL,"clearTopicGoalAction");function g(e){var t;let{rootId:s,topicId:x,goal:g,status:f,iterations:v}=e,b=(0,a.c)("roots"),[j,w]=(0,n.useTransition)(),N="completed"===(t=f)?o.A:"abandoned"===t?l.A:d.A;return(0,r.jsxs)("div",{className:(0,p.cn)("flex items-center gap-2 rounded-md border px-3 py-1.5 text-xs","active"===f&&"reflex-gradient text-foreground border-transparent","completed"===f&&"border-emerald-500/40 bg-emerald-50","abandoned"===f&&"border-destructive/40 bg-destructive/5"),children:[(0,r.jsx)(N,{className:"h-3.5 w-3.5 shrink-0"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"text-[10px] uppercase tracking-wider opacity-80",children:["/goal \xb7 ",f," ","active"===f&&v>0&&(0,r.jsxs)("span",{className:"font-mono",children:["(",v,")"]})]}),(0,r.jsx)("div",{className:"truncate font-medium",title:g,children:g})]}),"active"===f&&(0,r.jsxs)(m.$,{type:"button",size:"sm",variant:"ghost",className:"h-7 shrink-0",disabled:j,onClick:()=>{confirm(b("goalBadge.stopConfirm"))&&w(async()=>{var e;let t=await h(s,x);t.ok?c.oR.success(b("goalBadge.stopSuccess")):c.oR.error(null!=(e=t.error)?e:b("goalBadge.stopFailed"))})},children:[(0,r.jsx)(i.A,{className:"mr-1 h-3 w-3"})," ",b("goalBadge.stop")]}),("completed"===f||"abandoned"===f)&&(0,r.jsx)(u.E,{variant:"outline",className:"shrink-0 capitalize",children:f})]})}},66459:(e,t,s)=>{"use strict";s.d(t,{O:()=>c});var r=s(4624),n=s(99356),a=s(43153),i=s(9598),o=s(56221),l=s(49411),d=s(85253);function c(e){let{steps:t}=e,s=(0,l.c)("app");return t&&0!==t.length?(0,r.jsx)("ol",{className:"space-y-2 text-xs",children:t.map((e,t)=>(0,r.jsxs)("li",{className:"flex gap-2",children:[(0,r.jsxs)("span",{className:"font-mono text-muted-foreground shrink-0 w-5 text-right",children:[t+1,"."]}),(0,r.jsxs)("div",{className:"space-y-1 flex-1 min-w-0",children:[(0,r.jsx)("div",{children:e.title}),e.choice&&(0,r.jsxs)("div",{className:"text-[11px]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("oauth.copyHint")}),(0,r.jsx)("span",{className:"font-medium bg-muted/60 rounded px-1.5 py-0.5",children:e.choice})]}),e.body&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:e.body}),e.copy&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[e.field&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[e.field,":"]}),(0,r.jsx)("code",{className:"font-mono text-[11px] bg-muted/60 rounded px-1.5 py-0.5 break-all flex-1 min-w-0",children:e.copy}),(0,r.jsx)(m,{value:e.copy})]})]})]},t))}):null}function m(e){let{value:t}=e,s=(0,l.c)("app"),[c,m]=(0,n.useState)(!1);return(0,r.jsx)(d.$,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:async()=>{try{await navigator.clipboard.writeText(t),m(!0),o.oR.success(s("oauth.copied")),setTimeout(()=>m(!1),1200)}catch(e){o.oR.error(s("oauth.copyFailed"))}},title:s("oauth.copy"),children:c?(0,r.jsx)(a.A,{className:"h-3 w-3 text-emerald-600"}):(0,r.jsx)(i.A,{className:"h-3 w-3"})})}},83977:(e,t,s)=>{"use strict";s.d(t,{L:()=>n});var r=s(7911);let n=(0,r.createServerReference)("6025990ec0a3639626d0c30c78f5523602cd31f12d",r.callServer,void 0,r.findSourceMapURL,"deleteTopicAction")}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,6568,6642,334,2885,4933,146,7358],()=>e(e.s=25342)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[532],{2046:(e,t,s)=>{Promise.resolve().then(s.bind(s,77836)),Promise.resolve().then(s.bind(s,44051)),Promise.resolve().then(s.bind(s,86430)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},5270:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},16329:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},23262:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},30441:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]])},39160:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},58726:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},59728:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},72691:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},86430:(e,t,s)=>{"use strict";s.d(t,{RootViewer:()=>F});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),l=s(56221),c=s(80192),o=s(43504),d=s(28310),m=s(53588),x=s(7911);let u=(0,x.createServerReference)("6022f94f7b99f15b128aa250a6cf45532b59bb38d0",x.callServer,void 0,x.findSourceMapURL,"readKbFileAction");var h=s(8190),p=s(45804);let y=(0,p.A)("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var v=s(16329);let f=(0,p.A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),g=(0,p.A)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),b=(0,p.A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),j=(0,p.A)("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var k=s(39783),N=s(58726),w=s(72691),A=s(5270);let P=(0,p.A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);var E=s(13506);function C(e){let{kind:t,data:s}=e,n=(null!=t?t:"").toLowerCase();return"task"===n?(0,r.jsx)(L,{data:s}):"meeting"===n?(0,r.jsx)(_,{data:s}):"product"===n?(0,r.jsx)(z,{data:s}):"fact"===n?(0,r.jsx)(B,{data:s}):(0,r.jsx)(M,{data:s})}let S=new Set(["title","version","date","kind"]);function M(e){let{data:t}=e,s=Object.entries(t).filter(e=>{let[t]=e;return!S.has(t)});return 0===s.length?null:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:s.map(e=>{let[t,s]=e;return(0,r.jsxs)(d.E,{variant:"outline",className:"font-mono text-[10px]",children:[(0,r.jsxs)("span",{className:"text-muted-foreground mr-1",children:[t,":"]}),(0,r.jsx)("span",{className:"truncate max-w-[16rem]",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(t=>e(t)).join(", ");try{return JSON.stringify(t)}catch(e){return String(t)}}(s)})]},t)})})}function L(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.status),l=R(s.priority),c=null!=(t=R(s.due))?t:R(s.due_date),o=R(s.assignee),m=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a&&(0,r.jsxs)(d.E,{className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"done"===t?"bg-emerald-600 text-white":"doing"===t||"in_progress"===t?"bg-blue-600 text-white":"blocked"===t||"cancelled"===t?"bg-destructive text-destructive-foreground":"paused"===t?"bg-amber-600 text-white":"bg-secondary text-secondary-foreground"}(a)),children:[(0,r.jsx)(H,{status:a}),a]}),l&&(0,r.jsxs)(d.E,{variant:"outline",className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"high"===t||"p0"===t||"urgent"===t?"border-destructive text-destructive":"med"===t||"medium"===t||"p1"===t?"border-amber-600 text-amber-700":"border-muted-foreground text-muted-foreground"}(l)),children:[(0,r.jsx)(y,{className:"h-3 w-3"}),l]}),c&&(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(v.A,{className:"h-3 w-3"}),n("entityBadges.dueLabel",{date:c})]}),o&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"}),o]}),null==m?void 0:m.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"}),e]},e))]})}function _(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=U(s.attendees),l=U(s.decisions),c=null!=(t=U(s.action_items))?t:U(s.actionItems);return(0,r.jsxs)("div",{className:"space-y-2",children:[a&&a.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)(b,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"})," ",e]},e))]}),l&&l.length>0&&(0,r.jsx)(I,{title:n("entityBadges.decisionsTitle"),items:l}),c&&c.length>0&&(0,r.jsx)(I,{title:"Action items",items:c})]})}function z(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.sku),l=s.price,c=R(s.currency),o=R(s.vendor),m=R(s.url),x=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null!=l&&""!==l&&(0,r.jsxs)(d.E,{className:"bg-emerald-600 text-white",children:["number"==typeof(t=l)?t.toLocaleString():"string"==typeof t?t:String(t),c?" ".concat(c):""]}),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 font-mono",children:[(0,r.jsx)(j,{className:"h-3 w-3"})," ",a]}),o&&(0,r.jsx)(d.E,{variant:"secondary",className:"gap-1",children:o}),m&&(0,r.jsxs)("a",{href:m,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline",children:[(0,r.jsx)(k.A,{className:"h-3 w-3"}),n("entityBadges.openLink")]}),null==x?void 0:x.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e))]})}function B(e){let{data:t}=e,s=(0,i.c)("roots"),n=U(t.tags),a=R(t.source);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null==n?void 0:n.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e)),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 max-w-[24rem]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("entityBadges.sourceLabel")}),(0,r.jsx)("span",{className:"truncate",children:a})]})]})}function I(e){let{title:t,items:s}=e;return(0,r.jsxs)("div",{className:"rounded-md border bg-muted/30 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:t}),(0,r.jsx)("ul",{className:"space-y-0.5 text-sm",children:s.map((e,t)=>(0,r.jsxs)("li",{className:"leading-snug",children:["• ",e]},t))})]})}function H(e){let{status:t}=e,s=t.toLowerCase();return"done"===s?(0,r.jsx)(N.A,{className:"h-3 w-3"}):"doing"===s||"in_progress"===s?(0,r.jsx)(w.A,{className:"h-3 w-3"}):"blocked"===s||"cancelled"===s?(0,r.jsx)(A.A,{className:"h-3 w-3"}):"paused"===s?(0,r.jsx)(P,{className:"h-3 w-3"}):(0,r.jsx)(y,{className:"h-3 w-3"})}function R(e){return"string"==typeof e&&e.trim()?e:"number"==typeof e?String(e):void 0}function U(e){if(!Array.isArray(e))return;let t=e.map(e=>"string"==typeof e?e:null==e?"":String(e)).filter(e=>e.trim());return t.length>0?t:void 0}var q=s(9993);function F(e){var t,s;let{files:d,rootId:x,rootPath:p,initialFile:y}=e,v=(0,i.c)("roots"),f=(()=>{let e=new Map;for(let t of d)e.set(t.rel,t);return e})(),g=null!=(s=y&&f.has(y)?y:f.has("INDEX.md")?"INDEX.md":null==(t=d[0])?void 0:t.rel)?s:null,[b,j]=(0,n.useState)(g),[k,N]=(0,n.useState)(""),[w,A]=(0,n.useState)(null),[P,E]=(0,n.useTransition)(),C=(0,a.useRouter)();return(0,n.useEffect)(()=>{y&&f.has(y)&&j(y)},[y]),(0,n.useEffect)(()=>{b&&E(async()=>{let e=await u(x,b);if(e.ok)N(e.content),A(e.meta);else{var t;N("# Error\n\n".concat(null!=(t=e.error)?t:"")),A(null)}})},[b,x]),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsx)(c.F,{className:"flex-1 min-h-0",children:(0,r.jsxs)("article",{className:"mx-auto max-w-3xl px-8 py-10",children:[b?P?(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(o.E,{className:"h-8 w-3/5"}),(0,r.jsx)(o.E,{className:"h-4 w-full"}),(0,r.jsx)(o.E,{className:"h-4 w-11/12"}),(0,r.jsx)(o.E,{className:"h-4 w-4/5"})]}):(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsx)(O,{meta:w,filename:b}),(0,r.jsx)(m.p,{source:function(e){if(!e.startsWith("---"))return e;let t=e.indexOf("\n---",3);return t<0?e:e.slice(t+4).replace(/^\r?\n/,"")}(k),onSendToChat:(e,t)=>{(async()=>{let s=v("kb.summaryContext",{url:t,text:e}),r=await (0,q.g)(x,s);if(!r.ok)return l.oR.error(r.error);C.push("/roots/".concat(x,"/chat/").concat(r.topicId))})()}})]}):(0,r.jsx)("p",{className:"text-muted-foreground",children:v("kb.selectFileHint")}),(0,r.jsxs)("div",{className:"mt-10 text-[11px] text-muted-foreground font-mono truncate",children:[p,"/.reflex/"]})]})}),(0,r.jsx)(h.CommandBar,{rootId:x,focusFile:null!=b?b:void 0})]})}function O(e){var t;let{meta:s,filename:n}=e;return s.title||void 0!==s.version||s.date||s.kind?(0,r.jsxs)("header",{className:"mb-6 pb-4 border-b space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-3 flex-wrap",children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:null!=(t=s.title)?t:n}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.kind&&(0,r.jsx)(d.E,{variant:"default",className:"capitalize",children:s.kind}),void 0!==s.version&&(0,r.jsxs)(d.E,{variant:"outline",children:["v",s.version]}),s.date&&(0,r.jsx)("span",{className:"font-mono",children:s.date})]})]}),(0,r.jsx)(T,{createdBy:s.data.createdBy}),(0,r.jsx)(C,{kind:s.kind,data:s.data}),(0,r.jsx)("div",{className:"text-[11px] text-muted-foreground font-mono",children:n})]}):null}function T(e){let{createdBy:t}=e,s=(0,i.c)("roots");if("string"!=typeof t||!t)return null;let[n,a]=t.split(":",2);if(!n||!a)return null;let[l,c]=a.split("@",2),o="utility"===n?s("kb.createdMiniApp"):"workflow"===n?s("kb.createdWorkflow"):"agent"===n?s("kb.createdAgent"):n,d=(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border bg-violet-50 dark:bg-violet-950/30 px-2 py-0.5 text-[10px] text-violet-700 dark:text-violet-300",children:[(0,r.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-muted-foreground",children:s("kb.createdLabel")}),(0,r.jsx)("span",{children:o}),(0,r.jsx)("code",{className:"font-mono",children:l}),c&&(0,r.jsxs)("span",{className:"font-mono text-muted-foreground",children:["v",c]})]});return"utility"===n&&l?(0,r.jsx)("a",{href:"/utilities/project/".concat(encodeURIComponent(l)),className:"inline-block hover:opacity-80",title:s("kb.openMiniApp"),children:d}):d}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,6642,334,5371,4933,146,7358],()=>e(e.s=2046)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9872],{3239:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4959:(e,t,r)=>{"use strict";r.d(t,{BT:()=>d,Wu:()=>l,ZB:()=>o,Zp:()=>a,aR:()=>i,wL:()=>c});var s=r(4624);r(99356);var n=r(13506);function a(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card",className:(0,n.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...r})}function i(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:(0,n.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function o(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:(0,n.cn)("leading-none font-semibold",t),...r})}function d(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:(0,n.cn)("text-sm text-muted-foreground",t),...r})}function l(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:(0,n.cn)("px-6",t),...r})}function c(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-footer",className:(0,n.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},7951:(e,t,r)=>{Promise.resolve().then(r.bind(r,19327)),Promise.resolve().then(r.bind(r,91074)),Promise.resolve().then(r.bind(r,96253)),Promise.resolve().then(r.bind(r,28050)),Promise.resolve().then(r.bind(r,94904)),Promise.resolve().then(r.bind(r,13270)),Promise.resolve().then(r.bind(r,99730)),Promise.resolve().then(r.bind(r,89146)),Promise.resolve().then(r.bind(r,19078)),Promise.resolve().then(r.bind(r,67854)),Promise.resolve().then(r.bind(r,69050)),Promise.resolve().then(r.bind(r,63739)),Promise.resolve().then(r.bind(r,33976)),Promise.resolve().then(r.bind(r,12537)),Promise.resolve().then(r.bind(r,97485)),Promise.resolve().then(r.bind(r,41923)),Promise.resolve().then(r.bind(r,73868)),Promise.resolve().then(r.bind(r,53511)),Promise.resolve().then(r.bind(r,2018)),Promise.resolve().then(r.bind(r,18487)),Promise.resolve().then(r.bind(r,98346)),Promise.resolve().then(r.bind(r,14884)),Promise.resolve().then(r.bind(r,85314)),Promise.resolve().then(r.bind(r,17280)),Promise.resolve().then(r.bind(r,8855)),Promise.resolve().then(r.bind(r,86631)),Promise.resolve().then(r.bind(r,2604)),Promise.resolve().then(r.bind(r,27237)),Promise.resolve().then(r.bind(r,49455)),Promise.resolve().then(r.bind(r,39211)),Promise.resolve().then(r.bind(r,56360)),Promise.resolve().then(r.t.bind(r,54400,23))},13506:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a});var s=r(47989),n=r(55701);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,s.$)(t))}},19327:(e,t,r)=>{"use strict";r.d(t,{MemoryEditor:()=>p});var s=r(4624),n=r(99356),a=r(56221),i=r(3239),o=r(85924),d=r(65714),l=r(46972),c=r(85253),u=r(4959),v=r(71651),m=r(13506),h=r(7911);let b=(0,h.createServerReference)("40c15ec8ded15cc5ec9eb918994e4f729aeccb25e1",h.callServer,void 0,h.findSourceMapURL,"loadMemoryAction"),x=(0,h.createServerReference)("40493c396fbeb942eb2451b6b0fd04cf9642ab62dc",h.callServer,void 0,h.findSourceMapURL,"saveMemoryFileAction"),f=(0,h.createServerReference)("40cc6831ec3afc3d93ab0f8db8f7c844ec61ff84b8",h.callServer,void 0,h.findSourceMapURL,"wipeMemoryAction");function p(e){let{scope:t,rootId:r,title:a,description:d,allowWipe:l}=e,[c,v]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[x,f]=(0,n.useState)(null),p=(0,n.useCallback)(async()=>{h(!0);let e=await b(r?{scope:t,rootId:r}:{scope:t});if(h(!1),!e.ok)return void f(e.error);f(null),v(e.files)},[t,r]);return(0,n.useEffect)(()=>{p()},[p]),(0,s.jsxs)(u.Zp,{children:[(0,s.jsx)(u.aR,{children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(u.ZB,{className:"text-lg",children:a}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:d})]}),l&&c.length>0&&(0,s.jsx)(y,{scope:t,rootId:r,onWiped:p})]})}),(0,s.jsx)(u.Wu,{children:m?(0,s.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,s.jsx)(i.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):x?(0,s.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"}),x]}):(0,s.jsx)("div",{className:"space-y-4",children:c.map(e=>(0,s.jsx)(g,{snapshot:e,scope:t,rootId:r,onSaved:e=>v(t=>t.map(t=>t.file===e.file?e:t))},e.file))})})]})}function g(e){let{snapshot:t,scope:r,rootId:o,onSaved:l}=e,[u,h]=(0,n.useState)(t.content),[b,f]=(0,n.useTransition)();(0,n.useEffect)(()=>{h(t.content)},[t.content]);let p=u.trim(),g=p?p.split("\n").length:0,y=g>t.cap,j=g>.9*t.cap,k=u!==t.content;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,s.jsx)("span",{className:"font-mono text-sm font-semibold",children:t.file}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:t.description})]}),(0,s.jsxs)("span",{className:(0,m.cn)("text-xs tabular-nums",y?"text-destructive font-medium":j?"text-amber-600":"text-muted-foreground"),children:[g,"/",t.cap]})]}),(0,s.jsx)(v.T,{value:u,onChange:e=>h(e.target.value),rows:Math.min(t.cap+2,Math.max(3,g+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,s.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,s.jsxs)(c.$,{type:"button",size:"sm",variant:k?"default":"ghost",disabled:!k||b||y,onClick:()=>{if(y)return void a.oR.error("".concat(t.file," exceeds ").concat(t.cap,"-line cap (").concat(g,"). Trim before saving."));f(async()=>{let e=await x({scope:r,...o?{rootId:o}:{},file:t.file,content:p});if(!e.ok){var s;a.oR.error(null!=(s=e.error)?s:"Save failed");return}a.oR.success("Saved ".concat(t.file)),l({...t,content:p,lines:e.lines})})},children:[b?(0,s.jsx)(i.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,s.jsx)(d.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function y(e){let{scope:t,rootId:r,onWiped:i}=e,[o,d]=(0,n.useTransition)();return(0,s.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",disabled:o,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&d(async()=>{let e=await f(r?{scope:t,rootId:r}:{scope:t});if(!e.ok){var s;a.oR.error(null!=(s=e.error)?s:"Wipe failed");return}a.oR.success("Memory wiped"),await i()})},className:"text-destructive hover:text-destructive",children:[(0,s.jsx)(l.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},46972:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},60621:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var s=r(47989);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.$,i=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,d=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],s=null==o?void 0:o[e];if(null===t)return null;let a=n(t)||n(s);return i[e][a]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return a(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...l}[t]):({...o,...l})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},65714:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},71651:(e,t,r)=>{"use strict";r.d(t,{T:()=>a});var s=r(4624);r(99356);var n=r(13506);function a(e){let{className:t,...r}=e;return(0,s.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...r})}},85253:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var s=r(4624);r(99356);var n=r(60621),a=r(50362),i=r(13506);let o=(0,n.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function d(e){let{className:t,variant:r="default",size:n="default",asChild:d=!1,...l}=e,c=d?a.bL:"button";return(0,s.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":n,className:(0,i.cn)(o({variant:r,size:n,className:t})),...l})}},85924:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},91074:(e,t,r)=>{"use strict";r.d(t,{Separator:()=>i});var s=r(4624);r(99356);var n=r(44188),a=r(13506);function i(e){let{className:t,orientation:r="horizontal",decorative:i=!0,...o}=e;return(0,s.jsx)(n.b,{"data-slot":"separator",decorative:i,orientation:r,className:(0,a.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,4933,146,7358],()=>e(e.s=7951)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9872],{3239:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4959:(e,t,r)=>{"use strict";r.d(t,{BT:()=>d,Wu:()=>l,ZB:()=>o,Zp:()=>a,aR:()=>i,wL:()=>c});var s=r(4624);r(99356);var n=r(13506);function a(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card",className:(0,n.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...r})}function i(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:(0,n.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function o(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:(0,n.cn)("leading-none font-semibold",t),...r})}function d(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:(0,n.cn)("text-sm text-muted-foreground",t),...r})}function l(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:(0,n.cn)("px-6",t),...r})}function c(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-footer",className:(0,n.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},7951:(e,t,r)=>{Promise.resolve().then(r.bind(r,52470)),Promise.resolve().then(r.bind(r,91074)),Promise.resolve().then(r.bind(r,96253)),Promise.resolve().then(r.bind(r,28050)),Promise.resolve().then(r.bind(r,94904)),Promise.resolve().then(r.bind(r,13270)),Promise.resolve().then(r.bind(r,99730)),Promise.resolve().then(r.bind(r,89146)),Promise.resolve().then(r.bind(r,19078)),Promise.resolve().then(r.bind(r,67854)),Promise.resolve().then(r.bind(r,69050)),Promise.resolve().then(r.bind(r,63739)),Promise.resolve().then(r.bind(r,33976)),Promise.resolve().then(r.bind(r,12537)),Promise.resolve().then(r.bind(r,97485)),Promise.resolve().then(r.bind(r,41923)),Promise.resolve().then(r.bind(r,73868)),Promise.resolve().then(r.bind(r,53511)),Promise.resolve().then(r.bind(r,2018)),Promise.resolve().then(r.bind(r,18487)),Promise.resolve().then(r.bind(r,98346)),Promise.resolve().then(r.bind(r,14884)),Promise.resolve().then(r.bind(r,85314)),Promise.resolve().then(r.bind(r,17280)),Promise.resolve().then(r.bind(r,8855)),Promise.resolve().then(r.bind(r,86631)),Promise.resolve().then(r.bind(r,2604)),Promise.resolve().then(r.bind(r,27237)),Promise.resolve().then(r.bind(r,49455)),Promise.resolve().then(r.bind(r,39211)),Promise.resolve().then(r.bind(r,56360)),Promise.resolve().then(r.t.bind(r,54400,23))},13506:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a});var s=r(47989),n=r(55701);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,s.$)(t))}},46972:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},52470:(e,t,r)=>{"use strict";r.d(t,{MemoryEditor:()=>p});var s=r(4624),n=r(99356),a=r(56221),i=r(3239),o=r(85924),d=r(65714),l=r(46972),c=r(85253),u=r(4959),v=r(71651),m=r(13506),h=r(7911);let f=(0,h.createServerReference)("408f9fa4f212c245f24d79fd9d05c2e477b51b69bb",h.callServer,void 0,h.findSourceMapURL,"loadMemoryAction"),x=(0,h.createServerReference)("40296f28d19c1626e4c31c390d03b1170a11f23f40",h.callServer,void 0,h.findSourceMapURL,"saveMemoryFileAction"),b=(0,h.createServerReference)("40de28da2b0b990dd8df5c30301336c0f7c3b327fb",h.callServer,void 0,h.findSourceMapURL,"wipeMemoryAction");function p(e){let{scope:t,rootId:r,title:a,description:d,allowWipe:l}=e,[c,v]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[x,b]=(0,n.useState)(null),p=(0,n.useCallback)(async()=>{h(!0);let e=await f(r?{scope:t,rootId:r}:{scope:t});if(h(!1),!e.ok)return void b(e.error);b(null),v(e.files)},[t,r]);return(0,n.useEffect)(()=>{p()},[p]),(0,s.jsxs)(u.Zp,{children:[(0,s.jsx)(u.aR,{children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(u.ZB,{className:"text-lg",children:a}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:d})]}),l&&c.length>0&&(0,s.jsx)(y,{scope:t,rootId:r,onWiped:p})]})}),(0,s.jsx)(u.Wu,{children:m?(0,s.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,s.jsx)(i.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):x?(0,s.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"}),x]}):(0,s.jsx)("div",{className:"space-y-4",children:c.map(e=>(0,s.jsx)(g,{snapshot:e,scope:t,rootId:r,onSaved:e=>v(t=>t.map(t=>t.file===e.file?e:t))},e.file))})})]})}function g(e){let{snapshot:t,scope:r,rootId:o,onSaved:l}=e,[u,h]=(0,n.useState)(t.content),[f,b]=(0,n.useTransition)();(0,n.useEffect)(()=>{h(t.content)},[t.content]);let p=u.trim(),g=p?p.split("\n").length:0,y=g>t.cap,j=g>.9*t.cap,k=u!==t.content;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,s.jsx)("span",{className:"font-mono text-sm font-semibold",children:t.file}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:t.description})]}),(0,s.jsxs)("span",{className:(0,m.cn)("text-xs tabular-nums",y?"text-destructive font-medium":j?"text-amber-600":"text-muted-foreground"),children:[g,"/",t.cap]})]}),(0,s.jsx)(v.T,{value:u,onChange:e=>h(e.target.value),rows:Math.min(t.cap+2,Math.max(3,g+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,s.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,s.jsxs)(c.$,{type:"button",size:"sm",variant:k?"default":"ghost",disabled:!k||f||y,onClick:()=>{if(y)return void a.oR.error("".concat(t.file," exceeds ").concat(t.cap,"-line cap (").concat(g,"). Trim before saving."));b(async()=>{let e=await x({scope:r,...o?{rootId:o}:{},file:t.file,content:p});if(!e.ok){var s;a.oR.error(null!=(s=e.error)?s:"Save failed");return}a.oR.success("Saved ".concat(t.file)),l({...t,content:p,lines:e.lines})})},children:[f?(0,s.jsx)(i.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,s.jsx)(d.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function y(e){let{scope:t,rootId:r,onWiped:i}=e,[o,d]=(0,n.useTransition)();return(0,s.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",disabled:o,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&d(async()=>{let e=await b(r?{scope:t,rootId:r}:{scope:t});if(!e.ok){var s;a.oR.error(null!=(s=e.error)?s:"Wipe failed");return}a.oR.success("Memory wiped"),await i()})},className:"text-destructive hover:text-destructive",children:[(0,s.jsx)(l.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},60621:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var s=r(47989);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.$,i=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,d=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],s=null==o?void 0:o[e];if(null===t)return null;let a=n(t)||n(s);return i[e][a]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return a(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...l}[t]):({...o,...l})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},65714:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},71651:(e,t,r)=>{"use strict";r.d(t,{T:()=>a});var s=r(4624);r(99356);var n=r(13506);function a(e){let{className:t,...r}=e;return(0,s.jsx)("textarea",{"data-slot":"textarea",className:(0,n.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...r})}},85253:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var s=r(4624);r(99356);var n=r(60621),a=r(50362),i=r(13506);let o=(0,n.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function d(e){let{className:t,variant:r="default",size:n="default",asChild:d=!1,...l}=e,c=d?a.bL:"button";return(0,s.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":n,className:(0,i.cn)(o({variant:r,size:n,className:t})),...l})}},85924:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(45804).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},91074:(e,t,r)=>{"use strict";r.d(t,{Separator:()=>i});var s=r(4624);r(99356);var n=r(44188),a=r(13506);function i(e){let{className:t,orientation:r="horizontal",decorative:i=!0,...o}=e;return(0,s.jsx)(n.b,{"data-slot":"separator",decorative:i,orientation:r,className:(0,a.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,4933,146,7358],()=>e(e.s=7951)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8138],{4959:(e,t,s)=>{"use strict";s.d(t,{BT:()=>l,Wu:()=>d,ZB:()=>o,Zp:()=>n,aR:()=>i,wL:()=>c});var a=s(4624);s(99356);var r=s(13506);function n(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",t),...s})}function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-sm text-muted-foreground",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-footer",className:(0,r.cn)("flex items-center px-6 [.border-t]:pt-6",t),...s})}},7530:(e,t,s)=>{Promise.resolve().then(s.bind(s,77836)),Promise.resolve().then(s.bind(s,94775)),Promise.resolve().then(s.bind(s,44051)),Promise.resolve().then(s.bind(s,80588)),Promise.resolve().then(s.bind(s,8190)),Promise.resolve().then(s.bind(s,73238)),Promise.resolve().then(s.bind(s,33789)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},32566:(e,t,s)=>{"use strict";s.d(t,{B:()=>r});var a=s(7911);let r=(0,a.createServerReference)("0086f1c7d35f377cefa4ae5029debea76860ebb06e",a.callServer,void 0,a.findSourceMapURL,"listCuratedAction")},33789:(e,t,s)=>{"use strict";s.d(t,{RunInitButton:()=>u});var a=s(4624),r=s(99356),n=s(3239),i=s(67805),o=s(56221),l=s(85253),d=s(7911);let c=(0,d.createServerReference)("70f1bf3cb268632f8d132b5fad637a648a6e5b397f",d.callServer,void 0,d.findSourceMapURL,"runInitAction");var m=s(63514);function u(e){let{rootPath:t,rootId:s}=e,[d,u]=(0,r.useTransition)();return(0,a.jsx)(l.$,{onClick:()=>u(async()=>{let e=o.oR.loading("Running agent — this can take a minute or two…"),a=await c(t,s,!1);if(o.oR.dismiss(e),a.ok)o.oR.success("Init complete"),(0,m.$d)(m.Zi.kbChanged(s)),(0,m.$d)(m.Zi.rootsChanged);else{var r;o.oR.error(null!=(r=a.error)?r:"Init failed")}}),disabled:d,children:d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{className:"mr-2 h-4 w-4 animate-spin"})," Running…"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.A,{className:"mr-2 h-4 w-4"})," Run init"]})})}},52470:(e,t,s)=>{"use strict";s.d(t,{MemoryEditor:()=>v});var a=s(4624),r=s(99356),n=s(56221),i=s(3239),o=s(85924),l=s(65714),d=s(46972),c=s(85253),m=s(4959),u=s(71651),x=s(13506),h=s(7911);let p=(0,h.createServerReference)("408f9fa4f212c245f24d79fd9d05c2e477b51b69bb",h.callServer,void 0,h.findSourceMapURL,"loadMemoryAction"),g=(0,h.createServerReference)("40296f28d19c1626e4c31c390d03b1170a11f23f40",h.callServer,void 0,h.findSourceMapURL,"saveMemoryFileAction"),f=(0,h.createServerReference)("40de28da2b0b990dd8df5c30301336c0f7c3b327fb",h.callServer,void 0,h.findSourceMapURL,"wipeMemoryAction");function v(e){let{scope:t,rootId:s,title:n,description:l,allowWipe:d}=e,[c,u]=(0,r.useState)([]),[x,h]=(0,r.useState)(!0),[g,f]=(0,r.useState)(null),v=(0,r.useCallback)(async()=>{h(!0);let e=await p(s?{scope:t,rootId:s}:{scope:t});if(h(!1),!e.ok)return void f(e.error);f(null),u(e.files)},[t,s]);return(0,r.useEffect)(()=>{v()},[v]),(0,a.jsxs)(m.Zp,{children:[(0,a.jsx)(m.aR,{children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(m.ZB,{className:"text-lg",children:n}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:l})]}),d&&c.length>0&&(0,a.jsx)(j,{scope:t,rootId:s,onWiped:v})]})}),(0,a.jsx)(m.Wu,{children:x?(0,a.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,a.jsx)(i.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):g?(0,a.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"}),g]}):(0,a.jsx)("div",{className:"space-y-4",children:c.map(e=>(0,a.jsx)(b,{snapshot:e,scope:t,rootId:s,onSaved:e=>u(t=>t.map(t=>t.file===e.file?e:t))},e.file))})})]})}function b(e){let{snapshot:t,scope:s,rootId:o,onSaved:d}=e,[m,h]=(0,r.useState)(t.content),[p,f]=(0,r.useTransition)();(0,r.useEffect)(()=>{h(t.content)},[t.content]);let v=m.trim(),b=v?v.split("\n").length:0,j=b>t.cap,w=b>.9*t.cap,N=m!==t.content;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-sm font-semibold",children:t.file}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:t.description})]}),(0,a.jsxs)("span",{className:(0,x.cn)("text-xs tabular-nums",j?"text-destructive font-medium":w?"text-amber-600":"text-muted-foreground"),children:[b,"/",t.cap]})]}),(0,a.jsx)(u.T,{value:m,onChange:e=>h(e.target.value),rows:Math.min(t.cap+2,Math.max(3,b+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,a.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,a.jsxs)(c.$,{type:"button",size:"sm",variant:N?"default":"ghost",disabled:!N||p||j,onClick:()=>{if(j)return void n.oR.error("".concat(t.file," exceeds ").concat(t.cap,"-line cap (").concat(b,"). Trim before saving."));f(async()=>{let e=await g({scope:s,...o?{rootId:o}:{},file:t.file,content:v});if(!e.ok){var a;n.oR.error(null!=(a=e.error)?a:"Save failed");return}n.oR.success("Saved ".concat(t.file)),d({...t,content:v,lines:e.lines})})},children:[p?(0,a.jsx)(i.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,a.jsx)(l.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function j(e){let{scope:t,rootId:s,onWiped:i}=e,[o,l]=(0,r.useTransition)();return(0,a.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",disabled:o,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&l(async()=>{let e=await f(s?{scope:t,rootId:s}:{scope:t});if(!e.ok){var a;n.oR.error(null!=(a=e.error)?a:"Wipe failed");return}n.oR.success("Memory wiped"),await i()})},className:"text-destructive hover:text-destructive",children:[(0,a.jsx)(d.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},73238:(e,t,s)=>{"use strict";s.d(t,{Dashboard:()=>eC});var a=s(4624),r=s(99356),n=s(49411),i=s(3747),o=s(56221),l=s(85253),d=s(63514),c=s(54400),m=s.n(c),u=s(41234),x=s(3239),h=s(86790),p=s(28310),g=s(4959);function f(e){let{rootId:t,activeGoals:s,runningAgents:r}=e,i=(0,n.c)("roots"),o=s.length+r.length;return(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(u.A,{className:"h-4 w-4 text-violet-600"}),i("activeGoals.title")]}),o>0&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:o})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[0===o&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:i("activeGoals.empty")}),s.map(e=>(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(e.topicId),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(u.A,{className:"h-3.5 w-3.5 text-violet-600 mt-0.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.topicTitle}),e.running&&(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin text-violet-600 shrink-0"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.goal}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-muted-foreground",children:[(0,a.jsx)("span",{children:i("activeGoals.iterationLabel",{count:e.goalIterations})}),(0,a.jsx)("span",{children:"\xb7"}),(0,a.jsx)("span",{children:i("activeGoals.updatedLabel",{time:function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("activeGoals.justNow");let a=Math.floor(s/6e4);if(a<1)return t("activeGoals.justNow");if(a<60)return t("activeGoals.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("activeGoals.hoursAgo",{count:r}):t("activeGoals.daysAgo",{count:Math.floor(r/24)})}(e.updatedAt,i)})})]})]})]})},e.topicId)),r.map(e=>(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(e.topicId),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 text-amber-600 mt-0.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.topicTitle}),(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin text-amber-600 shrink-0"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:i("activeGoals.agentRunning")})]})]})},e.topicId))]})]})}var v=s(85924),b=s(3024),j=s(59145),w=s(31108);function N(e){let{rootId:t,items:s}=e,r=(0,n.c)("roots");return(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(v.A,{className:"h-4 w-4 text-amber-600"}),r("pendingApprovals.title")]}),s.length>0&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:s.length})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[0===s.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:r("pendingApprovals.empty")}),s.map(e=>{var s;return(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(e.topicId),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(y,{kind:e.kind}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.summary}),(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:"permission"===(s=e.kind)?"permission":"question"===s?"question":"mcp-add"})]}),e.details&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.details}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:["topic ",e.topicId.slice(0,12)," \xb7 ",function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("pendingApprovals.justNow");let a=Math.floor(s/6e4);if(a<1)return t("pendingApprovals.justNow");if(a<60)return t("pendingApprovals.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("pendingApprovals.hoursAgo",{count:r}):t("pendingApprovals.daysAgo",{count:Math.floor(r/24)})}(e.ts,r)]})]})]})},"".concat(e.kind,":").concat(e.requestId))})]})]})}function y(e){let{kind:t}=e,s="h-3.5 w-3.5 mt-0.5 shrink-0";return"permission"===t?(0,a.jsx)(b.A,{className:"".concat(s," text-rose-600")}):"question"===t?(0,a.jsx)(j.A,{className:"".concat(s," text-sky-600")}):(0,a.jsx)(w.A,{className:"".concat(s," text-emerald-600")})}var k=s(49623),S=s(7911);let A=(0,S.createServerReference)("602f9c30a3df060531214b1c4cd34ef39e9c5df160",S.callServer,void 0,S.findSourceMapURL,"readKbPreviewAction");function C(e){let{rootId:t,items:s}=e,i=(0,n.c)("roots"),[o,l]=(0,r.useState)({});return(0,r.useEffect)(()=>{let e=!1;return(async()=>{for(let a of s){if(o[a.rel])continue;let s=await A(t,a.rel);if(e)return;s.ok&&l(e=>({...e,[a.rel]:s.preview}))}})(),()=>{e=!0}},[t,s]),(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 text-emerald-700"}),i("recentKb.title")]}),s.length>0&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:s.length})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[0===s.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:i("recentKb.empty")}),s.map(e=>{var s;return(0,a.jsx)(m(),{href:"/roots/".concat(t,"/kb/").concat(e.rel.split("/").map(encodeURIComponent).join("/")),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-emerald-700"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.title}),e.kind&&(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:e.kind})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:null!=(s=o[e.rel])?s:e.rel}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:[function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("recentKb.justNow");let a=Math.floor(s/6e4);if(a<1)return t("recentKb.justNow");if(a<60)return t("recentKb.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("recentKb.hoursAgo",{count:r}):t("recentKb.daysAgo",{count:Math.floor(r/24)})}(e.modifiedAt,i)," \xb7 ",(0,a.jsx)("span",{className:"font-mono",children:e.rel})]})]})]})},e.rel)})]})]})}var R=s(69285),U=s(95046),M=s(8096),T=s(54207),D=s(95265),I=s(9993);function E(e){let{rootId:t,cache:s}=e,d=(0,n.c)("roots"),[c,m]=(0,r.useState)(s),[u,h]=(0,r.useTransition)(),f=(0,R.useRouter)(),v=c&&Date.now()-Date.parse(c.generatedAt)>864e5;return(0,a.jsxs)(g.Zp,{className:"lg:col-span-2",children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(U.A,{className:"h-4 w-4 text-amber-500"}),d("aiSuggestions.title"),v&&(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:d("aiSuggestions.stale")})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{h(async()=>{try{let s=await fetch("/api/roots/".concat(t,"/suggestions"),{method:"POST",cache:"no-store"}),a=await s.json();if(!a.ok){var e;o.oR.error(null!=(e=a.error)?e:d("aiSuggestions.regenerateFailed"));return}a.cache&&m(a.cache)}catch(e){o.oR.error(e instanceof Error?e.message:String(e))}})},disabled:u,className:"gap-1 h-7 text-xs",children:[u?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(i.A,{className:"h-3 w-3"}),d("aiSuggestions.recompute")]})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[!c&&!u&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:d("aiSuggestions.intro")}),c&&0===c.items.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:d("aiSuggestions.nothingUrgent")}),(0,a.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:null==c?void 0:c.items.map((e,s)=>(0,a.jsxs)("div",{className:"rounded-md border bg-card p-3 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(M.A,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),(0,a.jsx)("p",{className:"text-sm font-medium leading-snug flex-1",children:e.title})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:e.why}),(0,a.jsx)(P,{rootId:t,item:e,router:f})]},s))}),c&&(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground pt-1",children:d.rich("aiSuggestions.generatedAt",{time:function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("aiSuggestions.justNow");let a=Math.floor(s/6e4);if(a<1)return t("aiSuggestions.justNow");if(a<60)return t("aiSuggestions.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("aiSuggestions.hoursAgo",{count:r}):t("aiSuggestions.daysAgo",{count:Math.floor(r/24)})}(c.generatedAt,d),model:c.model,code:e=>(0,a.jsx)("code",{className:"font-mono",children:e})})})]})]})}function P(e){let{rootId:t,item:s,router:i}=e,[c,u]=(0,r.useTransition)(),h=(0,n.c)("roots"),{action:p}=s;if("none"===p.kind)return null;if("open-topic"===p.kind&&p.target)return(0,a.jsx)(l.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,a.jsxs)(m(),{href:"/roots/".concat(t,"/chat/").concat(p.target),children:[(0,a.jsx)(T.A,{className:"h-3 w-3"}),p.label]})});if("open-kb"===p.kind&&p.target){let e=p.target.split("/").map(encodeURIComponent).join("/");return(0,a.jsx)(l.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,a.jsxs)(m(),{href:"/roots/".concat(t,"/kb/").concat(e),children:[(0,a.jsx)(T.A,{className:"h-3 w-3"}),p.label]})})}return"send-message"===p.kind&&p.target?(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>{u(async()=>{try{let s=await (0,I.g)(t,p.target,[],void 0);if(!s.ok){var e;o.oR.error(null!=(e=s.error)?e:h("aiSuggestions.sendFailed"));return}(0,d.$d)(d.Zi.topicsChanged(t)),i.push("/roots/".concat(t,"/chat/").concat(s.topicId))}catch(e){o.oR.error(e instanceof Error?e.message:String(e))}})},disabled:c,children:[c?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(D.A,{className:"h-3 w-3"}),p.label]}):null}var L=s(39624),z=s(71789),W=s(53732),F=s(43153),Z=s(13561);let $=(0,S.createServerReference)("404e51f2563e9fa37c7e4081ff0b0b16f381f2baba",S.callServer,void 0,S.findSourceMapURL,"listSuggestionsAction"),B=(0,S.createServerReference)("40cbdb46031a33d2d6990761290b8a20c57181eb5e",S.callServer,void 0,S.findSourceMapURL,"approveSuggestionAction"),O=(0,S.createServerReference)("40a68c58514a68cfb8c451925764f3fc4a7fe9dc12",S.callServer,void 0,S.findSourceMapURL,"rejectSuggestionAction");var K=s(13506);let G={utility:L.A,research:z.A,widget:W.A,goal:u.A,skill:M.A},H={utility:"text-emerald-600",research:"text-violet-600",widget:"text-blue-600",goal:"text-amber-600",skill:"text-pink-600"};function V(e){let{rootId:t}=e,s=(0,R.useRouter)(),[n,d]=(0,r.useState)([]),[c,m]=(0,r.useState)(!0),[u,h]=(0,r.useState)({}),[f,v]=(0,r.useTransition)(),b=(0,r.useCallback)(async()=>{let e=await $(t);m(!1),e.ok&&d(e.items)},[t]);return((0,r.useEffect)(()=>{b()},[b]),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{"visible"===document.visibilityState&&b()},3e4);return()=>window.clearInterval(e)},[b]),c||0===n.length)?null:(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(g.ZB,{className:"text-lg flex items-center gap-2",children:[(0,a.jsx)(U.A,{className:"h-4 w-4 text-amber-500"}),"Suggestions",(0,a.jsx)(p.E,{variant:"secondary",className:"ml-1",children:n.length})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>v(()=>b()),disabled:f,className:"h-7 gap-1",children:[(0,a.jsx)(i.A,{className:(0,K.cn)("h-3 w-3",f&&"animate-spin")}),"Refresh"]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Hypotheses the agent put together from the onboarding chat. Approve to start a topic; dismiss to drop it (and remember you said no)."})]}),(0,a.jsx)(g.Wu,{className:"space-y-2",children:n.map(e=>{var r;let n=null!=(r=G[e.kind])?r:U.A,i=u[e.id];return(0,a.jsxs)("div",{className:"flex items-start gap-3 rounded-md border p-3",children:[(0,a.jsx)(n,{className:(0,K.cn)("h-4 w-4 mt-1 shrink-0",H[e.kind])}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"font-medium text-sm",children:e.title}),(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:e.kind})]}),e.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1 leading-snug",children:e.description}),e.prompt&&(0,a.jsx)("code",{className:"block mt-1 text-[10px] font-mono text-muted-foreground/70 truncate",children:e.prompt})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"default",disabled:!!i,onClick:()=>{h(t=>({...t,[e.id]:"approve"})),(async()=>{let a=await B({rootId:t,suggestionId:e.id});if(h(t=>({...t,[e.id]:null})),!a.ok){var r;o.oR.error(null!=(r=a.error)?r:"Failed to start topic");return}o.oR.success("Started: ".concat(e.title)),d(t=>t.filter(t=>t.id!==e.id)),s.push("/roots/".concat(t,"/chat/").concat(a.topicId))})()},className:"h-8 gap-1",children:["approve"===i?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(F.A,{className:"h-3 w-3"}),"Approve"]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",disabled:!!i,onClick:()=>{h(t=>({...t,[e.id]:"reject"})),(async()=>{let s=await O({rootId:t,suggestionId:e.id});if(h(t=>({...t,[e.id]:null})),!s.ok){var a;o.oR.error(null!=(a=s.error)?a:"Failed to reject");return}o.oR.success("Dismissed: ".concat(e.title)),d(t=>t.filter(t=>t.id!==e.id))})()},className:"h-8 gap-1 text-muted-foreground hover:text-destructive",children:["reject"===i?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(Z.A,{className:"h-3 w-3"}),"Dismiss"]})]})]},e.id)})})]})}var _=s(52470),q=s(93305),J=s(41379);let Y=(0,S.createServerReference)("608fc096d2ed2c6604326ff4891aaf5903f75638dc",S.callServer,void 0,S.findSourceMapURL,"saveWidgetOrderAction"),Q=(0,S.createServerReference)("605a4abd674a5c905716f41eb0bff04a07dc41cbd3",S.callServer,void 0,S.findSourceMapURL,"hideWidgetAction"),X={sm:2,md:3,wide:6},ee=["sys:active-goals","sys:pending","sys:recent-kb","sys:ai-suggestions"],et=[{id:"sys:active-goals",title:"Active goals & running agents",description:"Topics with an active /goal and a running orchestrator."},{id:"sys:pending",title:"Awaiting response",description:"Unanswered permission / question / mcp-add cards."},{id:"sys:recent-kb",title:"Recent in KB",description:"KB files modified in the last 72 hours."},{id:"sys:ai-suggestions",title:"What's next — Reflex suggestions",description:"Gemini-driven analysis of project state with actions."}],es=(0,S.createServerReference)("708d6c3772416997bc8935ba8267e62f5af1c3eca0",S.callServer,void 0,S.findSourceMapURL,"setWidgetSizeAction"),ea=[{mode:"sm",label:"S",titleKey:"widgetsCommon.sizeSm"},{mode:"md",label:"M",titleKey:"widgetsCommon.sizeMd"},{mode:"wide",label:"W",titleKey:"widgetsCommon.sizeWide"}];function er(e){let{rootId:t,widgetId:s,mode:i,onChanged:l}=e,d=(0,n.c)("roots"),[c,m]=(0,r.useTransition)();return(0,a.jsx)("div",{role:"radiogroup","aria-label":d("widgetsCommon.sizeAria"),className:"inline-flex items-center rounded border bg-background/80 backdrop-blur overflow-hidden text-[10px] leading-none",children:ea.map(e=>{let r=e.mode===i,n="sm"===e.mode?d("widgetsCommon.sizeSm"):"md"===e.mode?d("widgetsCommon.sizeMd"):d("widgetsCommon.sizeWide");return(0,a.jsx)("button",{type:"button",role:"radio","aria-checked":r,"aria-label":n,title:n,onClick:()=>{var a;(a=e.mode)!==i&&m(async()=>{let e=await es(t,s,a);if(!e.ok){var r;o.oR.error(null!=(r=e.error)?r:d("widgetsCommon.sizeFailed"));return}l()})},disabled:c,className:["px-1.5 py-0.5 font-mono transition-colors disabled:opacity-50",r?"bg-violet-600 text-white":"text-muted-foreground hover:bg-accent hover:text-foreground"].join(" "),children:e.label},e.mode)})})}function en(e){let t=X[e];return 2===t?"lg:col-span-2":3===t?"lg:col-span-3":"lg:col-span-6"}var ei=s(73600),eo=s(76974),el=s(72691),ed=s(22841),ec=s(4001);let em=(0,S.createServerReference)("783aa4bba291b273914d8c1022ab814fb9bead4d51",S.callServer,void 0,S.findSourceMapURL,"patchWidgetDataAction"),eu=(0,S.createServerReference)("7010e188fb76de45f6f10a36ff128b55f690648e8f",S.callServer,void 0,S.findSourceMapURL,"setWidgetRefreshAction"),ex=(0,S.createServerReference)("6074e6a3e4daf67c32928f64ffc1d7f969ec7b2f90",S.callServer,void 0,S.findSourceMapURL,"refreshWidgetNowAction");function eh(e){let{rootId:t,widget:s,mode:i,onHide:l,hiding:d,onLayoutChanged:c,dnd:u}=e,x=(0,n.c)("roots"),[h,f]=(0,r.useTransition)(),v=u.dragging===s.id,b=u.dropTarget===s.id&&!v,j=en(i);return(0,a.jsxs)(g.Zp,{draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",s.id),u.onDragStart(s.id)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u.dropTarget!==s.id&&u.onDragOver(s.id)},onDrop:e=>{e.preventDefault(),u.onDrop(s.id)},onDragEnd:()=>u.onDragEnd(),className:[j,"transition-all",v?"opacity-50":"",b?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background":""].join(" "),children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-start gap-2 space-y-0",children:[(0,a.jsx)(ei.A,{className:"h-3.5 w-3.5 text-muted-foreground/60 cursor-grab active:cursor-grabbing mt-1 shrink-0","aria-label":x("widgetsCommon.dragHandle")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"truncate",children:s.title}),(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono shrink-0",children:s.kind})]}),s.description&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5 line-clamp-2",children:s.description})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 -mt-0.5 shrink-0",children:[(0,a.jsx)(er,{rootId:t,widgetId:s.id,mode:i,onChanged:c}),s.sourceTopicId&&(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(s.sourceTopicId),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground","aria-label":x("widgetsCommon.editViaTopicAria"),title:x("widgetsCommon.editViaTopicTitle"),children:(0,a.jsx)(eo.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{type:"button",onClick:()=>f(async()=>{await Promise.resolve(),l(s.id)}),disabled:h||d,"aria-label":x("widgetsCommon.hideAria"),title:x("widgetsCommon.hideTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:(0,a.jsx)(Z.A,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)(g.Wu,{className:"space-y-3",children:[(0,ec.v)(t,s.kind,s.data,{widgetId:s.id,onPatch:async e=>{let a=await em(t,s.id,e);if(!a.ok){var r,n;throw o.oR.error(null!=(r=a.error)?r:x("widgetsCommon.savePatchFailed")),Error(null!=(n=a.error)?n:x("widgetsCommon.patchFailed"))}}}),(0,a.jsx)(ep,{rootId:t,widget:s})]})]})}function ep(e){var t,s;let{rootId:l,widget:d}=e,c=(0,n.c)("roots"),[m,u]=(0,r.useTransition)(),[x,h]=(0,r.useTransition)(),p=null!=(t=d.refresh)?t:"manual",g=null!=(s=d.lastRefreshAt)?s:d.updatedAt;return d.sourceTopicId?(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t text-[11px] text-muted-foreground",children:[(0,a.jsx)(el.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"shrink-0",children:c("widgetsCommon.updatedAt",{time:function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("widgetsCommon.justNow");let a=Math.floor(s/6e4);if(a<1)return t("widgetsCommon.justNow");if(a<60)return t("widgetsCommon.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("widgetsCommon.hoursAgo",{count:r}):t("widgetsCommon.daysAgo",{count:Math.floor(r/24)})}(g,c)})}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[(0,a.jsxs)(ed.l6,{value:p,onValueChange:e=>{h(async()=>{var t,s;let a=await eu(l,d.id,e);a.ok?o.oR.success("manual"===e?c("widgetsCommon.autoRefreshOff"):c("widgetsCommon.cadenceSet",{cadence:(s=e,c("hourly"===s?"widgetsCommon.cadenceHourly":"daily"===s?"widgetsCommon.cadenceDaily":"weekly"===s?"widgetsCommon.cadenceWeekly":"widgetsCommon.cadenceManual"))})):o.oR.error(null!=(t=a.error)?t:c("widgetsCommon.cadenceFailed"))})},disabled:x,children:[(0,a.jsx)(ed.bq,{className:"h-6 text-[10px] gap-1 px-1.5 w-auto min-w-[110px]",children:(0,a.jsx)(ed.yv,{})}),(0,a.jsxs)(ed.gC,{children:[(0,a.jsx)(ed.eb,{value:"manual",children:c("widgetsCommon.manual")}),(0,a.jsx)(ed.eb,{value:"hourly",children:c("widgetsCommon.hourly")}),(0,a.jsx)(ed.eb,{value:"daily",children:c("widgetsCommon.daily")}),(0,a.jsx)(ed.eb,{value:"weekly",children:c("widgetsCommon.weekly")})]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{u(async()=>{var e;let t=await ex(l,d.id);t.ok?o.oR.success(c("widgetsCommon.refreshStarted")):o.oR.error(null!=(e=t.error)?e:c("widgetsCommon.refreshFailed"))})},disabled:m,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 hover:bg-accent text-foreground/80 hover:text-foreground",title:c("widgetsCommon.refreshNowTitle"),children:[(0,a.jsx)(i.A,{className:"h-3 w-3 ".concat(m?"animate-spin":"")}),c("widgetsCommon.refreshLabel")]})]})]}):null}var eg=s(84784),ef=s(41280),ev=s(46972),eb=s(80192),ej=s(72581);let ew=(0,S.createServerReference)("60d08bee7815d4a7b2adb32c0a3feacf972a1c4829",S.callServer,void 0,S.findSourceMapURL,"deleteWidgetAction");function eN(e){let{rootId:t,open:s,onOpenChange:i,widgets:o,layout:d,onChanged:c}=e,m=(0,n.c)("roots");if((0,r.useEffect)(()=>{if(!s)return;let e=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,i]),!s)return null;let u=new Set(d.hidden);return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:e=>{e.target===e.currentTarget&&i(!1)},children:[(0,a.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>i(!1)}),(0,a.jsxs)("div",{className:"relative bg-card border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",children:[(0,a.jsx)(q.A,{className:"h-4 w-4 text-violet-600"}),(0,a.jsx)("h2",{className:"text-sm font-medium flex-1",children:m("widgetsCommon.libraryTitle")}),(0,a.jsx)(l.$,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>i(!1),children:(0,a.jsx)(Z.A,{className:"h-4 w-4"})})]}),(0,a.jsx)(eb.F,{className:"flex-1 min-h-0",children:(0,a.jsxs)("div",{className:"p-4 space-y-4",children:[(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:m("widgetsCommon.systemWidgetsHeading")}),et.map(e=>(0,a.jsx)(ey,{rootId:t,id:e.id,title:e.title,description:e.description,badge:"system",badgeVariant:"default",hidden:u.has(e.id),canDelete:!1,onChanged:c},e.id))]}),(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:m("widgetsCommon.userWidgetsHeading",{count:o.length})}),0===o.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:m("widgetsCommon.noUserWidgets")}),o.map(e=>{var s;return(0,a.jsx)(ey,{rootId:t,id:e.id,title:e.title,description:null!=(s=e.description)?s:"kind: ".concat(e.kind),badge:e.kind,badgeVariant:"outline",hidden:u.has(e.id),canDelete:!0,onChanged:c},e.id)})]})]})})]})]})}function ey(e){let{rootId:t,id:s,title:i,description:d,badge:c,badgeVariant:m,hidden:u,canDelete:x,onChanged:h}=e,g=(0,n.c)("roots"),[f,v]=(0,r.useTransition)();return(0,a.jsxs)("div",{className:"flex items-start gap-3 rounded-md border bg-card px-3 py-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:i}),(0,a.jsx)(p.E,{variant:m,className:"text-[10px] font-mono",children:c}),u&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:g("widgetsCommon.hidden")})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:d})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{v(async()=>{let e=u?await (0,ej.t)(t,s):await Q(t,s);if(!e.ok)return void o.oR.error(e.error);h()})},disabled:f,className:"gap-1 h-7 text-xs",children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eg.A,{className:"h-3 w-3"}),g("widgetsCommon.show")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ef.A,{className:"h-3 w-3"}),g("widgetsCommon.hide")]})}),x&&(0,a.jsx)(l.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>{confirm(g("widgetsCommon.deleteWidgetConfirm",{title:i}))&&v(async()=>{let e=await ew(t,s);if(!e.ok)return void o.oR.error(e.error);h()})},disabled:f,className:"h-7 w-7 text-muted-foreground hover:text-destructive",title:g("widgetsCommon.deleteForever"),children:(0,a.jsx)(ev.A,{className:"h-3.5 w-3.5"})})]})]})}function ek(e){let{rootId:t,widgets:s,layout:i,systemRenderers:d,snapshot:c,onLayoutChanged:m}=e,u=(0,n.c)("roots"),x=(0,r.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.id,t);return e},[s]),[h,p]=(0,r.useState)(i.order),[g,f]=(0,r.useState)(i.hidden),[,v]=(0,r.useTransition)(),[b,j]=(0,r.useState)(null),[w,N]=(0,r.useState)(null),[y,k]=(0,r.useState)(!1);eA(i.order,p),eA(i.hidden,f);let S=(0,r.useCallback)(e=>{p(e),v(async()=>{let s=await Y(t,e);s.ok?(p(s.layout.order),f(s.layout.hidden),m()):o.oR.error(s.error)})},[t,m]),A=(0,r.useCallback)(e=>{p(h.filter(t=>t!==e)),f(t=>[...new Set([e,...t])]),v(async()=>{let s=await Q(t,e);if(!s.ok)return void o.oR.error(s.error);p(s.layout.order),f(s.layout.hidden),m()})},[t,h,m]),C={onDragStart:e=>j(e),onDragOver:e=>N(e),onDrop:e=>{if(j(null),N(null),!b||b===e)return;let t=[...h],s=t.indexOf(b),a=t.indexOf(e);s<0||a<0||(t.splice(s,1),t.splice(a,0,b),S(t))},onDragEnd:()=>{j(null),N(null)},dragging:b,dropTarget:w};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:u("widgetsCommon.projectWidgetsTitle")}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:u("widgetsCommon.projectWidgetsHint")})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"outline",onClick:()=>k(!0),className:"gap-1 h-8",children:[(0,a.jsx)(q.A,{className:"h-3.5 w-3.5"}),u("widgetsCommon.library",{count:g.length})]})]}),0===h.length&&(0,a.jsxs)("div",{className:"rounded-md border border-dashed bg-muted/20 p-6 text-center space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:u.rich("widgetsCommon.emptyDashboard",{example:()=>(0,a.jsx)("em",{children:u("widgetsCommon.emptyDashboardExample")})})}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>k(!0),className:"gap-1",children:[(0,a.jsx)(J.A,{className:"h-3 w-3"}),u("widgetsCommon.restoreSystem")]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-6 gap-4",children:h.map(e=>{var s,r;let n=x.get(e),o=null==(s=i.sizes)?void 0:s[e],l=null!=o?o:(null==(r=null==n?void 0:n.size)?void 0:r.mode)?r.mode:(null==r?void 0:r.cols)===1?"sm":(null==r?void 0:r.cols)===2?"md":(null==r?void 0:r.cols)===3?"wide":"md";return ee.includes(e)?(0,a.jsx)(eS,{rootId:t,id:e,node:d[e],onHide:A,dnd:C,mode:l,onLayoutChanged:m},e):n?(0,a.jsx)(eh,{rootId:t,widget:n,mode:l,onHide:A,hiding:!1,dnd:C,onLayoutChanged:m},e):null})}),(0,a.jsx)(eN,{open:y,onOpenChange:k,rootId:t,widgets:s,layout:{order:h,hidden:g},onChanged:()=>{m()}})]})}function eS(e){let{rootId:t,id:s,node:r,onHide:i,dnd:o,mode:l,onLayoutChanged:d}=e,c=(0,n.c)("roots"),m=o.dragging===s,u=o.dropTarget===s&&!m,x=en(l);return(0,a.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",s),o.onDragStart(s)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",o.dropTarget!==s&&o.onDragOver(s)},onDrop:e=>{e.preventDefault(),o.onDrop(s)},onDragEnd:()=>o.onDragEnd(),className:[x,"relative group/sys transition-all",m?"opacity-50":"",u?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background rounded-lg":""].join(" "),children:[r,(0,a.jsxs)("div",{className:"absolute top-2 right-2 opacity-0 group-hover/sys:opacity-100 transition-opacity flex items-center gap-1 bg-background/85 backdrop-blur rounded p-0.5",children:[(0,a.jsx)(er,{rootId:t,widgetId:s,mode:l,onChanged:d}),(0,a.jsx)("button",{type:"button",onClick:()=>i(s),"aria-label":c("widgetsCommon.hideAria"),title:c("widgetsCommon.hideSystemTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:"\xd7"})]})]})}function eA(e,t){(0,r.useMemo)(()=>{t(e)},[JSON.stringify(e)])}function eC(e){let{rootId:t,initialSnapshot:s}=e,c=(0,n.c)("roots"),[m,u]=(0,r.useState)(s),[x,h]=(0,r.useTransition)(),p=(0,r.useCallback)(()=>{h(async()=>{try{let s=await fetch("/api/roots/".concat(t,"/dashboard"),{cache:"no-store"}),a=await s.json();if(!a.ok||!a.snapshot){var e;o.oR.error(null!=(e=a.error)?e:c("dashboard.refreshFailed"));return}u(a.snapshot)}catch(e){o.oR.error(e instanceof Error?e.message:String(e))}})},[t,c]);(0,d.S9)(d.Zi.topicsChanged(t),p),(0,d.S9)(d.Zi.kbChanged(t),p),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{"visible"===document.visibilityState&&p()},3e4);return()=>window.clearInterval(e)},[p]);let g={"sys:active-goals":(0,a.jsx)(f,{rootId:t,activeGoals:m.activeGoals,runningAgents:m.runningAgents}),"sys:pending":(0,a.jsx)(N,{rootId:t,items:m.pendingApprovals}),"sys:recent-kb":(0,a.jsx)(C,{rootId:t,items:m.recentKb}),"sys:ai-suggestions":(0,a.jsx)(E,{rootId:t,cache:m.suggestions})};return(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"p-6 space-y-5 max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:c("dashboard.projectOverview")}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("dashboard.projectOverviewHint")})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:p,disabled:x,className:"gap-1 h-8",children:[(0,a.jsx)(i.A,{className:"h-3.5 w-3.5 ".concat(x?"animate-spin":"")}),c("dashboard.refresh")]})]}),(0,a.jsx)(V,{rootId:t}),(0,a.jsx)(ek,{rootId:t,widgets:m.widgets,layout:m.layout,systemRenderers:g,snapshot:m,onLayoutChanged:p}),(0,a.jsx)(_.MemoryEditor,{scope:"project",rootId:t,title:c("dashboard.memoryTitle"),description:c("dashboard.memoryHint")})]})})}},80588:(e,t,s)=>{"use strict";s.d(t,{AddUtilityButton:()=>A});var a=s(4624),r=s(99356),n=s(54400),i=s.n(n),o=s(69285),l=s(49411),d=s(39624),c=s(36059),m=s(13561),u=s(3239),x=s(39783),h=s(46972),p=s(43153),g=s(57751),f=s(56221),v=s(85253),b=s(32566),j=s(7911);let w=(0,j.createServerReference)("407edfb5ed94bac9884c08c956cfc71111fc5be0d1",j.callServer,void 0,j.findSourceMapURL,"checkUtilityUpdatesAction"),N=(0,j.createServerReference)("4038dbb9e71362809e4c919569bb2ce9812f77c200",j.callServer,void 0,j.findSourceMapURL,"applyUtilityUpdateAction");var y=s(93890),k=s(83298),S=s(63514);function A(e){let{rootId:t,installed:s}=e,n=(0,l.c)("roots"),[j,A]=(0,r.useState)(!1),[C,R]=(0,r.useState)([]),[U,M]=(0,r.useState)(!1),[T,D]=(0,r.useState)(null),[I,E]=(0,r.useTransition)(),[P,L]=(0,r.useState)([]),z=(0,r.useRef)(null),W=(0,o.useRouter)(),F=new Set(s.map(e=>e.id)),Z=s.filter(e=>"project"===e.scope),$=new Map(P.map(e=>[e.id,e]));return(0,r.useEffect)(()=>{if(!j)return;let e=e=>{var t;(null==(t=z.current)?void 0:t.contains(e.target))||A(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[j]),(0,r.useEffect)(()=>{!j||C.length>0||U||(M(!0),(async()=>{try{let e=await (0,b.B)();R(e.items)}catch(e){f.oR.error(n("addUtility.loadCatalogFailed"))}finally{M(!1)}})())},[j,C.length,U]),(0,r.useEffect)(()=>{j&&0!==s.length&&(async()=>{let e=await w({rootId:t});e.ok&&L(e.updates)})()},[j,s.length,t]),(0,a.jsxs)("div",{className:"relative",ref:z,children:[(0,a.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"gap-1",onClick:()=>A(e=>!e),title:n("addUtility.buttonTitle"),children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),n("addUtility.buttonLabel"),Z.length>0&&(0,a.jsx)("span",{className:"ml-1 text-[10px] rounded-full bg-violet-100 text-violet-700 px-1.5",children:Z.length}),P.length>0&&(0,a.jsxs)("span",{className:"ml-0.5 text-[10px] rounded-full bg-amber-100 text-amber-800 px-1.5 inline-flex items-center gap-0.5",title:n("addUtility.updatesTitle",{count:P.length}),children:[(0,a.jsx)(c.A,{className:"h-2.5 w-2.5"}),P.length]})]}),j&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-30 w-[440px] max-h-[75vh] overflow-y-auto rounded-lg border bg-popover shadow-lg",children:[(0,a.jsxs)("div",{className:"sticky top-0 bg-popover flex items-center gap-2 px-3 py-2 border-b",children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:n("addUtility.popoverTitle")}),(0,a.jsx)("button",{type:"button",onClick:()=>A(!1),className:"ml-auto p-0.5 rounded hover:bg-accent",children:(0,a.jsx)(m.A,{className:"h-3 w-3"})})]}),Z.length>0&&(0,a.jsxs)("section",{className:"p-2 border-b",children:[(0,a.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:n("addUtility.installedInProject")}),(0,a.jsx)("ul",{className:"space-y-1",children:Z.map(e=>{let s=$.get(e.id);return(0,a.jsxs)("li",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2 py-1.5 text-xs",children:[(0,a.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"truncate font-medium",children:e.name}),s&&(0,a.jsxs)("div",{className:"text-[10px] text-amber-700 inline-flex items-center gap-0.5",children:[(0,a.jsx)(c.A,{className:"h-2.5 w-2.5"}),s.currentVersion," → ",s.latestVersion]})]}),s&&(0,a.jsxs)("button",{type:"button",onClick:()=>{D(s.id),E(async()=>{let e=await N({...s,rootId:t});if(D(null),!e.ok)return void f.oR.error(e.error);f.oR.success(n("addUtility.applyUpdateSuccess",{name:s.name,from:s.currentVersion,to:e.newVersion})),L(e=>e.filter(e=>e.id!==s.id)),(0,S.$d)(S.Zi.kbChanged(t)),W.refresh()})},disabled:I&&T===e.id,className:"text-[11px] rounded bg-amber-600 px-2 py-1 text-white hover:bg-amber-700 disabled:opacity-50 inline-flex items-center gap-0.5",title:n("addUtility.applyUpdateTitle"),children:[I&&T===e.id?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(c.A,{className:"h-3 w-3"}),n("addUtility.updateAction")]}),(0,a.jsx)(i(),{href:"/utilities/".concat(e.scope,"/").concat(e.id,"?rootId=").concat(encodeURIComponent(t)),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:n("addUtility.openAction"),children:(0,a.jsx)(x.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{confirm(n("addUtility.removeConfirm",{name:e.name}))&&(D(e.id),E(async()=>{let s=await (0,k.j)(e.scope,e.id,"project"===e.scope?t:void 0);if(D(null),!s.ok){var a;f.oR.error(null!=(a=s.error)?a:n("addUtility.removeFailed"));return}f.oR.success(n("addUtility.removeSuccess",{name:e.name})),(0,S.$d)(S.Zi.kbChanged(t)),W.refresh()}))},disabled:I&&T===e.id,className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-50",title:n("addUtility.removeAction"),children:I&&T===e.id?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(h.A,{className:"h-3 w-3"})})]},e.id)})})]}),(0,a.jsxs)("section",{className:"p-2",children:[(0,a.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:n("addUtility.catalog")}),U?(0,a.jsxs)("div",{className:"px-2 py-4 text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}),n("addUtility.loading")]}):0===C.length?(0,a.jsx)("p",{className:"px-2 py-4 text-xs text-muted-foreground",children:n("addUtility.catalogEmpty")}):(0,a.jsx)("ul",{className:"space-y-1",children:C.map(e=>{let s=F.has(e.id),r=T===e.id&&I;return(0,a.jsx)("li",{className:"rounded-md border bg-card px-2 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"text-xl leading-none",children:e.emoji}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug",children:e.description})]}),s?(0,a.jsxs)("span",{className:"text-[10px] text-emerald-700 inline-flex items-center gap-0.5",children:[(0,a.jsx)(p.A,{className:"h-3 w-3"})," ",n("addUtility.already")]}):(0,a.jsxs)("button",{type:"button",onClick:()=>{D(e.id),E(async()=>{var s;let a=null!=(s=e.suggestedScope)?s:"global",r=await (0,y.g)({github:e.github,scope:a,..."project"===a?{rootId:t}:{}});if(D(null),!r.ok)return void f.oR.error(r.error);f.oR.success(n("addUtility.installSuccess",{name:e.name})),(0,S.$d)(S.Zi.kbChanged(t)),W.refresh()})},disabled:r||I,className:"text-[11px] rounded bg-violet-600 px-2 py-1 text-white hover:bg-violet-700 disabled:opacity-50 inline-flex items-center gap-0.5",children:[r?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(g.A,{className:"h-3 w-3"}),n("addUtility.add")]})]})},e.id)})})]})]})]})}},83298:(e,t,s)=>{"use strict";s.d(t,{j:()=>r});var a=s(7911);let r=(0,a.createServerReference)("70a8b6b2c501734352ebe4be1eab847d52bf685232",a.callServer,void 0,a.findSourceMapURL,"removeUtilityAction")},93890:(e,t,s)=>{"use strict";s.d(t,{g:()=>r});var a=s(7911);let r=(0,a.createServerReference)("4012c1dd01f4b8d8f287e1e8088142bedc4f02eb62",a.callServer,void 0,a.findSourceMapURL,"installCuratedAction")},94775:(e,t,s)=>{"use strict";s.d(t,{RemoveRootButton:()=>u});var a=s(4624),r=s(99356),n=s(46972),i=s(56221),o=s(69285),l=s(85253),d=s(7911);let c=(0,d.createServerReference)("40c6e22395f4fe6c3c0fee68e56a9166eb24a0d37d",d.callServer,void 0,d.findSourceMapURL,"removeRootAction");var m=s(63514);function u(e){let{id:t,path:s,redirectHome:d}=e,[u,x]=(0,r.useTransition)(),h=(0,o.useRouter)();return(0,a.jsx)(l.$,{variant:"ghost",size:"sm",disabled:u,title:"Delete Space",onClick:()=>{var e;confirm("Delete this Space?\n\n"+"Path: ".concat(s,"\n\n")+"This wipes the .reflex/ folder (KB, topics, memory, "+'suggestions, audit) and removes mentions of "'.concat(null!=(e=s.split("/").pop())?e:s,'" from global memory.\n\n')+"Your own files in the folder are NOT touched.\n\nThis cannot be undone.")&&x(async()=>{let e=await c(t);if(e.ok)i.oR.success("Space deleted"),(0,m.$d)(m.Zi.rootsChanged),d&&h.push("/");else{var s;i.oR.error(null!=(s=e.error)?s:"Failed to delete")}})},children:(0,a.jsx)(n.A,{className:"h-4 w-4 text-muted-foreground"})})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,2038,8775,8566,6642,334,2885,5371,4933,146,7358],()=>e(e.s=7530)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6388],{3239:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},13506:(e,t,s)=>{"use strict";s.d(t,{cn:()=>i});var r=s(47989),a=s(55701);function i(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,a.QP)((0,r.$)(t))}},15523:(e,t,s)=>{"use strict";s.d(t,{p:()=>i});var r=s(4624);s(99356);var a=s(13506);function i(e){let{className:t,type:s,...i}=e;return(0,r.jsx)("input",{type:s,"data-slot":"input",className:(0,a.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t),...i})}},22841:(e,t,s)=>{"use strict";s.d(t,{bq:()=>u,eb:()=>m,gC:()=>p,l6:()=>d,yv:()=>c});var r=s(4624);s(99356);var a=s(69709),i=s(43153),n=s(59728),l=s(85314),o=s(13506);function d(e){let{...t}=e;return(0,r.jsx)(l.Root,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,r.jsx)(l.Value,{"data-slot":"select-value",...t})}function u(e){let{className:t,size:s="default",children:i,...n}=e;return(0,r.jsxs)(l.Trigger,{"data-slot":"select-trigger","data-size":s,className:(0,o.cn)("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...n,children:[i,(0,r.jsx)(l.Icon,{asChild:!0,children:(0,r.jsx)(a.A,{className:"size-4 opacity-50"})})]})}function p(e){let{className:t,children:s,position:a="item-aligned",align:i="center",...n}=e;return(0,r.jsx)(l.Portal,{children:(0,r.jsxs)(l.Content,{"data-slot":"select-content",className:(0,o.cn)("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,align:i,...n,children:[(0,r.jsx)(h,{}),(0,r.jsx)(l.Viewport,{className:(0,o.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),(0,r.jsx)(x,{})]})})}function m(e){let{className:t,children:s,...a}=e;return(0,r.jsxs)(l.Item,{"data-slot":"select-item",className:(0,o.cn)("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[(0,r.jsx)("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,r.jsx)(l.ItemIndicator,{children:(0,r.jsx)(i.A,{className:"size-4"})})}),(0,r.jsx)(l.ItemText,{children:s})]})}function h(e){let{className:t,...s}=e;return(0,r.jsx)(l.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,r.jsx)(n.A,{className:"size-4"})})}function x(e){let{className:t,...s}=e;return(0,r.jsx)(l.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,r.jsx)(a.A,{className:"size-4"})})}},28310:(e,t,s)=>{"use strict";s.d(t,{E:()=>o});var r=s(4624);s(99356);var a=s(60621),i=s(50362),n=s(13506);let l=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function o(e){let{className:t,variant:s="default",asChild:a=!1,...o}=e,d=a?i.bL:"span";return(0,r.jsx)(d,{"data-slot":"badge","data-variant":s,className:(0,n.cn)(l({variant:s}),t),...o})}},33984:(e,t,s)=>{"use strict";s.d(t,{WorkflowEditor:()=>C});var r=s(4624),a=s(99356),i=s(69285),n=s(49411),l=s(3239),o=s(46972),d=s(67805),c=s(41379),u=s(59728),p=s(69709),m=s(76974),h=s(65714),x=s(54400),v=s.n(x),f=s(56221),b=s(28310),g=s(85253),y=s(15523),w=s(71651),k=s(22841),j=s(7911);let N=(0,j.createServerReference)("6033255c5a83995124a4cf4066ff8b8e7aa8ebdc13",j.callServer,void 0,j.findSourceMapURL,"saveWorkflowAction"),P=(0,j.createServerReference)("601448b91ad3b5a3c54f44695b0bf2cfff9e23834b",j.callServer,void 0,j.findSourceMapURL,"listRunsAction"),z=(0,j.createServerReference)("709c70926fe3692b8cacfc5cf55ef65374f4d9c6b3",j.callServer,void 0,j.findSourceMapURL,"runWorkflowAction"),A=(0,j.createServerReference)("606e957e2dd5da4088f63d0268ee878eb38baaa0c1",j.callServer,void 0,j.findSourceMapURL,"deleteWorkflowAction"),S=[{kind:"text-template",label:"Text template",description:"Assembles text from a template with substitutions from previous steps. Use as glue between steps before the next one.",defaultParams:{template:"Hello {{prev}}"},fields:[{key:"template",label:"Template",type:"text",hint:"Substitutions: {{prev}}, {{steps.<id>.output}}, {{input.<field>}}",placeholder:"Summary: {{prev}}"}]},{kind:"http-request",label:"HTTP request",description:"Makes an HTTP request (GET by default). Puts the response body into output as a string or JSON if application/json.",defaultParams:{url:"https://api.example.com/",method:"GET"},fields:[{key:"url",label:"URL",type:"url",placeholder:"https://…"},{key:"method",label:"Method",type:"select",options:["GET","POST","PUT","PATCH","DELETE"]},{key:"headers",label:"Headers (JSON)",type:"json",hint:'Example: {"Authorization":"Bearer …"}'},{key:"body",label:"Body",type:"text",hint:"Leave empty for GET"}]},{kind:"web-fetch",label:"Fetch page",description:"Requests a URL and returns the textual content. Convenient for parsing pages without HTTP-config pain.",defaultParams:{url:"https://example.com"},fields:[{key:"url",label:"URL",type:"url",placeholder:"https://…"}]},{kind:"ask-agent",label:"Ask the agent",description:"Runs a headless orchestrator agent with the given question. Output is the agent's reply (the full assistant text).",defaultParams:{prompt:"Briefly summarize: {{prev}}"},fields:[{key:"prompt",label:"Question for the agent",type:"text",placeholder:"Use {{prev}} to pass the input"}]},{kind:"kb-write",label:"Write to KB",description:"Saves to the knowledge base as a Markdown file with frontmatter (kind, title, body). Use the previous step's output as `body`.",defaultParams:{kind:"note",title:"From workflow {{workflow.label}}",body:"{{prev}}"},fields:[{key:"kind",label:"Kind",type:"string",placeholder:"note"},{key:"title",label:"Title",type:"string",placeholder:"{{workflow.label}}"},{key:"body",label:"Body (Markdown)",type:"text",placeholder:"{{prev}}"}]},{kind:"utility-call",label:"Call a mini-app",description:"Runs a named server action of an installed utility with the given args. Output = the action's result. utility-call lets the workflow use mini-app functions as a library.",defaultParams:{utilityId:"",utilityScope:"global",actionName:"",args:"{}"},fields:[{key:"utilityId",label:"Utility (id)",type:"string",placeholder:"my-utility"},{key:"utilityScope",label:"Scope",type:"select",options:["global","project"]},{key:"actionName",label:"Action",type:"string",placeholder:"name from manifest.serverActions"},{key:"args",label:"Arguments (JSON)",type:"json",hint:"Passed as the first argument to the action. {{prev}} substitutions work inside JSON strings."}]},{kind:"image-generate",label:"Generate an image",description:"Generates an image via Gemini Nano Banana or Codex `$imagegen`. Output: {url, sha, mime, provider} — `url` can be inserted into a kb-write body as ``.",defaultParams:{prompt:"cute raccoon in a spacesuit, watercolor",provider:"gemini",aspectRatio:"1:1"},fields:[{key:"prompt",label:"Prompt",type:"text",placeholder:"Image description"},{key:"provider",label:"Provider",type:"select",options:["gemini","codex"]},{key:"aspectRatio",label:"Aspect ratio",type:"select",options:["1:1","16:9","9:16","4:3","3:4","21:9"]},{key:"size",label:"Size (opt.)",type:"string",placeholder:"1024x1024"}]},{kind:"image-search",label:"Search images on the web",description:"Searches for ready-made images by query (Unsplash by default, Pexels as fallback). Output: {results: [{url, thumb, attribution}…]}.",defaultParams:{query:"mountains sunrise",provider:"unsplash",count:6},fields:[{key:"query",label:"Query",type:"string",placeholder:"mountains sunrise"},{key:"provider",label:"Provider",type:"select",options:["unsplash","pexels","brave"]},{key:"count",label:"Result count",type:"string",placeholder:"6"}]},{kind:"notify",label:"Notify me",description:"Delivers a message to your configured channels (Telegram). Body defaults to the previous step's output — chain it after a summary to get a daily ping.",defaultParams:{title:"",body:"{{prev}}"},fields:[{key:"title",label:"Title (optional)",type:"string",placeholder:"Morning digest"},{key:"body",label:"Body",type:"text",placeholder:"{{prev}}"},{key:"link",label:"Link (optional)",type:"string",placeholder:"https://…"}]}];function E(e){var t;return null!=(t=S.find(t=>t.kind===e))?t:null}function C(e){var t;let{rootId:s,initial:u,initialRuns:p,readOnly:m,sourceUtilityId:h}=e,x=(0,n.c)("roots"),b=(0,i.useRouter)(),[w,j]=(0,a.useState)(u),[C,M]=(0,a.useState)(p),[O,_]=(0,a.useState)(null),[L,I]=(0,a.useState)("closed"),[U,$]=(0,a.useTransition)(),[H,V]=(0,a.useTransition)(),q=e=>{m||(j(e),V(async()=>{var t;let r=await N(s,e);r.ok||f.oR.error(null!=(t=r.error)?t:x("workflowEditor.saveFailed"))}))},D=async()=>{let e=await P(s,w.id);e.ok&&M(e.runs)},B=(e,t)=>{let s=e+t;if(s<0||s>=w.steps.length)return;let r=[...w.steps],a=r[e],i=r[s];r[e]=i,r[s]=a,q({...w,steps:r,updatedAt:new Date().toISOString()})};return(0,r.jsxs)("div",{className:"space-y-6",children:[m&&(0,r.jsxs)("div",{className:"rounded-md border border-violet-200 bg-violet-50 dark:bg-violet-950/20 px-4 py-2.5 text-xs text-violet-900 dark:text-violet-200",children:["Provided by the"," ",(0,r.jsx)("span",{className:"font-mono",children:null!=h?h:"utility"})," ","mini-app — managed by its manifest, so it's read-only here. You can still run it manually and review the history below."]}),(0,r.jsxs)("div",{className:"rounded-md border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:x("workflowEditor.nameLabel")}),(0,r.jsx)(y.p,{value:w.label,onChange:e=>q({...w,label:e.target.value}),className:"text-sm",disabled:m})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:x("workflowEditor.descriptionLabel")}),(0,r.jsx)(y.p,{value:null!=(t=w.description)?t:"",onChange:e=>q({...w,description:e.target.value}),className:"text-sm",placeholder:x("workflowEditor.descriptionPlaceholder"),disabled:m})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:x("workflowEditor.triggerLabel")}),(0,r.jsxs)(k.l6,{value:w.trigger,onValueChange:e=>q({...w,trigger:e}),disabled:m,children:[(0,r.jsx)(k.bq,{className:"h-8 w-32",children:(0,r.jsx)(k.yv,{})}),(0,r.jsxs)(k.gC,{children:[(0,r.jsx)(k.eb,{value:"manual",children:x("workflowEditor.triggerManual")}),(0,r.jsx)(k.eb,{value:"hourly",children:x("workflowEditor.triggerHourly")}),(0,r.jsx)(k.eb,{value:"daily",children:x("workflowEditor.triggerDaily")}),(0,r.jsx)(k.eb,{value:"weekly",children:x("workflowEditor.triggerWeekly")})]})]})]}),w.sourceTopicId&&(0,r.jsx)(v(),{href:"/roots/".concat(s,"/chat/").concat(w.sourceTopicId),className:"text-xs text-muted-foreground hover:underline self-end pb-2",children:x("workflowEditor.editViaTopic")}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-2 self-end pb-1",children:[H&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[(0,r.jsx)(l.A,{className:"h-3 w-3 animate-spin inline mr-1"}),x("workflowEditor.saving")]}),!m&&(0,r.jsxs)(g.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{confirm(x("workflowEditor.deleteConfirm",{label:w.label}))&&V(async()=>{let e=await A(s,w.id);if(!e.ok)return void f.oR.error(e.error);b.push("/roots/".concat(s,"/workflows"))})},disabled:H,className:"text-muted-foreground hover:text-destructive",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 mr-1"}),x("workflowEditor.delete")]}),(0,r.jsxs)(g.$,{type:"button",size:"sm",onClick:()=>{$(async()=>{let e=await z(s,w.id);if(!e.ok)return void f.oR.error(e.error);"completed"===e.run.status?f.oR.success(x("workflowEditor.completed")):"failed"===e.run.status&&f.oR.error(x("workflowEditor.failedRun")),D()})},disabled:U||0===w.steps.length,className:"gap-1",children:[U?(0,r.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(d.A,{className:"h-3.5 w-3.5"}),x("workflowEditor.run")]})]})]})]}),(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:x("workflowEditor.stepsHeading",{count:w.steps.length})}),w.steps.map((e,t)=>(0,r.jsx)(R,{step:e,idx:t,total:w.steps.length,readOnly:m,editing:O===e.id,onToggleEdit:()=>_(O===e.id?null:e.id),onMoveUp:()=>B(t,-1),onMoveDown:()=>B(t,1),onRemove:()=>(e=>{let t=w.steps.filter((t,s)=>s!==e);q({...w,steps:t,updatedAt:new Date().toISOString()})})(t),onChange:e=>((e,t)=>{let s=w.steps.map((s,r)=>r===e?{...s,...t}:s);q({...w,steps:s,updatedAt:new Date().toISOString()})})(t,e)},e.id)),"open"===L?(0,r.jsxs)("div",{className:"rounded-md border bg-card p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h3",{className:"text-xs font-medium",children:x("workflowEditor.pickStepKind")}),(0,r.jsx)(g.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>I("closed"),className:"h-6 text-xs",children:x("workflowEditor.cancel")})]}),(0,r.jsx)("div",{className:"grid gap-1.5",children:S.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>(e=>{let t=E(e);if(!t)return;let s=function(e,t){let s=t.replace(/[^a-z0-9]/gi,"-"),r=1;for(;e.some(e=>e.id==="".concat(s,"-").concat(r));)r+=1;return"".concat(s,"-").concat(r)}(w.steps,e);q({...w,steps:[...w.steps,{id:s,kind:e,label:t.label,params:{...t.defaultParams}}],updatedAt:new Date().toISOString()}),I("closed"),_(s)})(e.kind),className:"text-left rounded-md border px-3 py-2 hover:bg-accent/60 transition",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:e.description})]},e.kind))})]}):m?null:(0,r.jsxs)(g.$,{type:"button",variant:"outline",size:"sm",onClick:()=>I("open"),className:"w-full gap-1 border-dashed",children:[(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"}),x("workflowEditor.addStep")]})]}),(0,r.jsx)(T,{runs:C,onRefresh:D})]})}function R(e){let{step:t,idx:s,total:a,readOnly:i,editing:l,onToggleEdit:d,onMoveUp:c,onMoveDown:x,onRemove:v,onChange:f}=e,j=(0,n.c)("roots"),N=E(t.kind);return(0,r.jsxs)("div",{className:"rounded-md border bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 group",children:[(0,r.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground w-6 text-center shrink-0",children:s+1}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsx)("span",{className:"text-sm font-medium truncate",children:t.label}),(0,r.jsx)(b.E,{variant:"outline",className:"text-[10px] font-mono",children:t.kind})]}),N&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground line-clamp-1 mt-0.5",children:N.description})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[!i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",onClick:c,disabled:0===s,className:"h-7 w-7",children:(0,r.jsx)(u.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",onClick:x,disabled:s===a-1,className:"h-7 w-7",children:(0,r.jsx)(p.A,{className:"h-3.5 w-3.5"})})]}),(0,r.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",onClick:d,className:"h-7 w-7",title:i?"View step config":void 0,children:(0,r.jsx)(m.A,{className:"h-3.5 w-3.5"})}),!i&&(0,r.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",onClick:v,className:"h-7 w-7 text-muted-foreground hover:text-destructive",children:(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"})})]})]}),l&&(0,r.jsxs)("div",{className:"border-t bg-muted/30 px-3 py-3 space-y-2.5",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{className:"text-[11px] font-medium text-muted-foreground",children:j("workflowEditor.labelField")}),(0,r.jsx)(y.p,{value:t.label,onChange:e=>f({label:e.target.value}),className:"h-8 text-sm"})]}),null==N?void 0:N.fields.map(e=>{var s;let a=null!=(s=t.params[e.key])?s:"";return(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{className:"text-[11px] font-medium text-muted-foreground",children:e.label}),"select"===e.type&&e.options?(0,r.jsxs)(k.l6,{value:String(a||e.options[0]),onValueChange:s=>f({params:{...t.params,[e.key]:s}}),children:[(0,r.jsx)(k.bq,{className:"h-8 text-sm",children:(0,r.jsx)(k.yv,{})}),(0,r.jsx)(k.gC,{children:e.options.map(e=>(0,r.jsx)(k.eb,{value:e,children:e},e))})]}):"text"===e.type||"json"===e.type?(0,r.jsx)(w.T,{value:String(a),onChange:s=>f({params:{...t.params,[e.key]:s.target.value}}),placeholder:e.placeholder,rows:3,className:"text-sm font-mono"}):(0,r.jsx)(y.p,{value:String(a),onChange:s=>f({params:{...t.params,[e.key]:s.target.value}}),placeholder:e.placeholder,className:"h-8 text-sm font-mono"}),e.hint&&(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground",children:e.hint})]},e.key)}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(g.$,{type:"button",size:"sm",variant:"ghost",onClick:d,className:"h-7 text-xs gap-1",children:[(0,r.jsx)(h.A,{className:"h-3 w-3"}),j("workflowEditor.done")]})})]})]})}function T(e){let{runs:t,onRefresh:s}=e,i=(0,n.c)("roots"),[o,d]=(0,a.useTransition)();return 0===t.length?(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:i("workflowEditor.runHistory")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:i("workflowEditor.noRuns")})]}):(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:i("workflowEditor.runHistory")}),(0,r.jsx)(g.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>d(async()=>s()),disabled:o,className:"h-7 text-xs",children:o?(0,r.jsx)(l.A,{className:"h-3 w-3 animate-spin"}):i("workflowEditor.refresh")})]}),(0,r.jsx)("ul",{className:"space-y-1.5",children:t.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("details",{className:"rounded-md border bg-card",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 px-3 py-2",children:[(0,r.jsx)(b.E,{variant:"completed"===e.status?"secondary":"failed"===e.status?"destructive":"outline",className:"text-[10px]",children:e.status}),(0,r.jsx)("span",{className:"text-xs font-mono truncate",children:e.id}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:new Date(e.startedAt).toLocaleString()})]}),(0,r.jsx)("div",{className:"px-3 pb-3 space-y-1.5",children:e.steps.map(e=>(0,r.jsxs)("div",{className:"text-xs rounded border bg-muted/30 px-2 py-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(b.E,{variant:"completed"===e.status?"secondary":"failed"===e.status?"destructive":"outline",className:"text-[10px]",children:e.status}),(0,r.jsx)("span",{className:"font-mono",children:e.stepId})]}),e.error&&(0,r.jsx)("pre",{className:"mt-1 text-[10px] text-destructive whitespace-pre-wrap",children:e.error}),void 0!==e.output&&(0,r.jsx)("pre",{className:"mt-1 text-[10px] text-muted-foreground whitespace-pre-wrap max-h-32 overflow-y-auto font-mono",children:function(e){try{if("string"==typeof e)return e.length>800?e.slice(0,800)+"…":e;let t=JSON.stringify(e,null,2);return t.length>800?t.slice(0,800)+"…":t}catch(t){return String(e)}}(e.output)})]},e.stepId))})]})},e.id))})]})}},41379:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},43153:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},46972:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},52515:(e,t,s)=>{Promise.resolve().then(s.bind(s,33984)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},59728:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},60621:(e,t,s)=>{"use strict";s.d(t,{F:()=>n});var r=s(47989);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=r.$,n=(e,t)=>s=>{var r;if((null==t?void 0:t.variants)==null)return i(e,null==s?void 0:s.class,null==s?void 0:s.className);let{variants:n,defaultVariants:l}=t,o=Object.keys(n).map(e=>{let t=null==s?void 0:s[e],r=null==l?void 0:l[e];if(null===t)return null;let i=a(t)||a(r);return n[e][i]}),d=s&&Object.entries(s).reduce((e,t)=>{let[s,r]=t;return void 0===r||(e[s]=r),e},{});return i(e,o,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:s,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...l,...d}[t]):({...l,...d})[t]===s})?[...e,s,r]:e},[]),null==s?void 0:s.class,null==s?void 0:s.className)}},65714:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},67805:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},69285:(e,t,s)=>{"use strict";var r=s(48849);s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}})},69709:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},71651:(e,t,s)=>{"use strict";s.d(t,{T:()=>i});var r=s(4624);s(99356);var a=s(13506);function i(e){let{className:t,...s}=e;return(0,r.jsx)("textarea",{"data-slot":"textarea",className:(0,a.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...s})}},76974:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},85253:(e,t,s)=>{"use strict";s.d(t,{$:()=>o});var r=s(4624);s(99356);var a=s(60621),i=s(50362),n=s(13506);let l=(0,a.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:s="default",size:a="default",asChild:o=!1,...d}=e,c=o?i.bL:"button";return(0,r.jsx)(c,{"data-slot":"button","data-variant":s,"data-size":a,className:(0,n.cn)(l({variant:s,size:a,className:t})),...d})}},91074:(e,t,s)=>{"use strict";s.d(t,{Separator:()=>n});var r=s(4624);s(99356);var a=s(44188),i=s(13506);function n(e){let{className:t,orientation:s="horizontal",decorative:n=!0,...l}=e;return(0,r.jsx)(a.b,{"data-slot":"separator",decorative:n,orientation:s,className:(0,i.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...l})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,4933,146,7358],()=>e(e.s=52515)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2699],{4059:(e,t,r)=>{"use strict";r.d(t,{WorkflowRow:()=>u});var n=r(4624),s=r(99356),a=r(56221),i=r(27474),o=r(28310),l=r(32165),d=r(7911);let c=(0,d.createServerReference)("70925dabf315f10f91bb494e812d0eefd6776a7d2e",d.callServer,void 0,d.findSourceMapURL,"setWorkflowEnabledAction");function u(e){var t;let{rootId:r,wf:d,href:u}=e,[h,v]=(0,s.useState)(d.enabled),[m,b]=(0,s.useTransition)(),f="project"===d.source&&"manual"!==d.trigger;return(0,n.jsx)("div",{className:"rounded-md border bg-card hover:bg-accent/30 transition px-4 py-3",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)(i.A,{className:"h-4 w-4 mt-0.5 shrink-0 text-violet-600"}),(0,n.jsxs)("a",{href:u,className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("span",{className:"text-sm font-medium truncate",children:d.label}),(0,n.jsx)(o.E,{variant:"outline",className:"text-[10px]",children:d.trigger}),(0,n.jsxs)(o.E,{variant:"secondary",className:"text-[10px]",children:[d.stepCount," ",1===d.stepCount?"step":"steps"]}),"utility"===d.source&&(0,n.jsxs)(o.E,{variant:"outline",className:"text-[10px] border-violet-300 text-violet-700",children:["from ",null!=(t=d.utilityId)?t:"utility"]}),"manual"!==d.trigger&&!h&&(0,n.jsx)(o.E,{variant:"outline",className:"text-[10px] border-amber-300 text-amber-700",children:"paused"})]}),d.description&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:d.description}),(0,n.jsxs)("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-1 font-mono",children:[(0,n.jsx)("span",{children:d.id}),d.lastRun&&(0,n.jsxs)("span",{children:["last: ",function(e){let t=Date.now()-Date.parse(e);if(!Number.isFinite(t)||t<0)return"—";let r=Math.floor(t/1e3);if(r<60)return"".concat(r,"s ago");let n=Math.floor(r/60);if(n<60)return"".concat(n,"m ago");let s=Math.floor(n/60);return s<24?"".concat(s,"h ago"):"".concat(Math.floor(s/24),"d ago")}(d.lastRun.startedAt)," \xb7"," ",(0,n.jsx)("span",{className:"failed"===d.lastRun.status?"text-destructive":"running"===d.lastRun.status?"text-amber-700":"",children:d.lastRun.status})]}),d.nextRunAt&&h&&(0,n.jsxs)("span",{children:["next: ",function(e){let t=Date.parse(e)-Date.now();if(!Number.isFinite(t))return"—";if(t<=0)return"due";let r=Math.floor(t/1e3);if(r<60)return"in ".concat(r,"s");let n=Math.floor(r/60);if(n<60)return"in ".concat(n,"m");let s=Math.floor(n/60);return s<24?"in ".concat(s,"h"):"in ".concat(Math.floor(s/24),"d")}(d.nextRunAt)]})]})]}),"manual"!==d.trigger&&(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground",children:h?"on":"off"}),(0,n.jsx)(l.d,{checked:h,onCheckedChange:e=>{v(e),b(async()=>{let t=await c(r,d.id,e);if(t.ok)a.oR.success(e?"Scheduler resumed":"Scheduler paused");else{var n;v(!e),a.oR.error(null!=(n=t.error)?n:"Couldn't change enabled state")}})},disabled:!f||m,"aria-label":"Toggle scheduler"})]})]})})}},13506:(e,t,r)=>{"use strict";r.d(t,{cn:()=>a});var n=r(47989),s=r(55701);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,n.$)(t))}},17414:(e,t,r)=>{Promise.resolve().then(r.bind(r,4059)),Promise.resolve().then(r.bind(r,91074)),Promise.resolve().then(r.bind(r,96253)),Promise.resolve().then(r.bind(r,28050)),Promise.resolve().then(r.bind(r,94904)),Promise.resolve().then(r.bind(r,13270)),Promise.resolve().then(r.bind(r,99730)),Promise.resolve().then(r.bind(r,89146)),Promise.resolve().then(r.bind(r,19078)),Promise.resolve().then(r.bind(r,67854)),Promise.resolve().then(r.bind(r,69050)),Promise.resolve().then(r.bind(r,63739)),Promise.resolve().then(r.bind(r,33976)),Promise.resolve().then(r.bind(r,12537)),Promise.resolve().then(r.bind(r,97485)),Promise.resolve().then(r.bind(r,41923)),Promise.resolve().then(r.bind(r,73868)),Promise.resolve().then(r.bind(r,53511)),Promise.resolve().then(r.bind(r,2018)),Promise.resolve().then(r.bind(r,18487)),Promise.resolve().then(r.bind(r,98346)),Promise.resolve().then(r.bind(r,14884)),Promise.resolve().then(r.bind(r,85314)),Promise.resolve().then(r.bind(r,17280)),Promise.resolve().then(r.bind(r,8855)),Promise.resolve().then(r.bind(r,86631)),Promise.resolve().then(r.bind(r,2604)),Promise.resolve().then(r.bind(r,27237)),Promise.resolve().then(r.bind(r,49455)),Promise.resolve().then(r.bind(r,39211)),Promise.resolve().then(r.bind(r,56360)),Promise.resolve().then(r.t.bind(r,54400,23))},27474:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(45804).A)("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]])},28310:(e,t,r)=>{"use strict";r.d(t,{E:()=>l});var n=r(4624);r(99356);var s=r(60621),a=r(50362),i=r(13506);let o=(0,s.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function l(e){let{className:t,variant:r="default",asChild:s=!1,...l}=e,d=s?a.bL:"span";return(0,n.jsx)(d,{"data-slot":"badge","data-variant":r,className:(0,i.cn)(o({variant:r}),t),...l})}},32165:(e,t,r)=>{"use strict";r.d(t,{d:()=>i});var n=r(4624);r(99356);var s=r(8855),a=r(13506);function i(e){let{className:t,size:r="default",...i}=e;return(0,n.jsx)(s.Root,{"data-slot":"switch","data-size":r,className:(0,a.cn)("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",t),...i,children:(0,n.jsx)(s.Thumb,{"data-slot":"switch-thumb",className:(0,a.cn)("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground")})})}},60621:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var n=r(47989);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=n.$,i=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;let a=s(t)||s(n);return i[e][a]}),d=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return a(e,l,null==t||null==(n=t.compoundVariants)?void 0:n.reduce((e,t)=>{let{class:r,className:n,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...d}[t]):({...o,...d})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},91074:(e,t,r)=>{"use strict";r.d(t,{Separator:()=>i});var n=r(4624);r(99356);var s=r(44188),a=r(13506);function i(e){let{className:t,orientation:r="horizontal",decorative:i=!0,...o}=e;return(0,n.jsx)(s.b,{"data-slot":"separator",decorative:i,orientation:r,className:(0,a.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,4933,146,7358],()=>e(e.s=17414)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9429],{3239:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},3747:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4959:(e,t,r)=>{"use strict";r.d(t,{BT:()=>l,Wu:()=>d,ZB:()=>o,Zp:()=>n,aR:()=>i,wL:()=>c});var a=r(4624);r(99356);var s=r(13506);function n(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,s.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...r})}function i(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function o(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("leading-none font-semibold",t),...r})}function l(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-sm text-muted-foreground",t),...r})}function d(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("px-6",t),...r})}function c(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-footer",className:(0,s.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},9923:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},13506:(e,t,r)=>{"use strict";r.d(t,{cn:()=>n});var a=r(47989),s=r(55701);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},13561:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},15523:(e,t,r)=>{"use strict";r.d(t,{p:()=>n});var a=r(4624);r(99356);var s=r(13506);function n(e){let{className:t,type:r,...n}=e;return(0,a.jsx)("input",{type:r,"data-slot":"input",className:(0,s.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t),...n})}},32564:(e,t,r)=>{"use strict";r.d(t,{DirectoryPicker:()=>C});var a=r(4624),s=r(99356),n=r(69285),i=r(49411);let o=(0,r(45804).A)("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);var l=r(3747),d=r(59728),c=r(42146),u=r(72754),h=r(3239),m=r(13561),p=r(69709),x=r(69205),v=r(9923),f=r(56221),b=r(85253),g=r(4959),j=r(15523),y=r(80192),k=r(91074),w=r(7911);let N=(0,w.createServerReference)("4061e79674a610b7ce47b530baab5566de69d40307",w.callServer,void 0,w.findSourceMapURL,"addRootAction");var P=r(63514);let A=(0,w.createServerReference)("40f52f361e4e50eda834d1d413d0ac79b99155291f",w.callServer,void 0,w.findSourceMapURL,"browseAction"),S=(0,w.createServerReference)("60c563940ceca5dc95db0927863affe3d37d4ff002",w.callServer,void 0,w.findSourceMapURL,"createDirectoryAction");function C(e){let{initialPath:t}=e,r=(0,i.c)("roots"),[p,x]=(0,s.useState)(t),[v,w]=(0,s.useState)(t),[C,R]=(0,s.useState)(null),[D,$]=(0,s.useState)([]),[_,E]=(0,s.useState)(t),[H,T]=(0,s.useState)(!1),[Z,B]=(0,s.useTransition)(),[O,V]=(0,s.useTransition)(),[U,q]=(0,s.useState)(!1),[I,W]=(0,s.useState)(""),[K,Q]=(0,s.useTransition)(),X=(0,n.useRouter)();(0,s.useEffect)(()=>{G(t)},[]);let G=e=>{B(async()=>{let t=await A(e);if(!t.ok){var r;f.oR.error(null!=(r=t.error)?r:"Failed to browse");return}x(t.path),w(t.path),R(t.parent),E(t.path),$(t.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden)))})},J=async e=>{let t=function e(t,r){for(let a of t){if(a.absPath===r)return a;if(a.expanded){let t=e(a.children,r);if(t)return t}}return null}(D,e);if(!t)return;if(t.expanded)return void $(t=>L(t,e,e=>({...e,expanded:!1})));if(t.loaded)return void $(t=>L(t,e,e=>({...e,expanded:!0})));$(t=>L(t,e,e=>({...e,loading:!0})));let r=await A(e);if(!r.ok){var a;f.oR.error(null!=(a=r.error)?a:"Failed to browse"),$(t=>L(t,e,e=>({...e,loading:!1})));return}let s=r.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden));$(t=>L(t,e,e=>({...e,loading:!1,loaded:!0,expanded:!0,children:s})))},Y=async e=>{if(e===p){let t=await A(e);t.ok&&$(t.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden)));return}let t=await A(e);if(!t.ok)return;let r=t.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden));$(t=>L(t,e,e=>({...e,children:r,loaded:!0,expanded:!0})))};return(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{children:[(0,a.jsxs)(g.ZB,{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{children:"Browse"}),(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",onClick:()=>G(t),disabled:Z,children:[(0,a.jsx)(o,{className:"mr-1 h-4 w-4"})," Home"]})]}),(0,a.jsxs)("form",{className:"flex gap-2 mt-2",onSubmit:e=>{e.preventDefault(),G(v)},children:[(0,a.jsx)(j.p,{value:v,onChange:e=>w(e.target.value),placeholder:"/absolute/path",className:"font-mono text-xs"}),(0,a.jsx)(b.$,{type:"submit",variant:"secondary",disabled:Z,children:(0,a.jsx)(l.A,{className:"h-4 w-4 ".concat(Z?"animate-spin":"")})})]})]}),(0,a.jsx)(k.Separator,{}),(0,a.jsx)(g.Wu,{className:"px-2 py-2",children:(0,a.jsxs)(y.F,{className:"h-[460px]",children:[(0,a.jsxs)("div",{className:"px-2 py-1 flex items-center gap-2",children:[(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",disabled:!C||Z,onClick:()=>C&&G(C),className:"h-8",children:[(0,a.jsx)(d.A,{className:"mr-1 h-4 w-4"})," Up"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>E(p),className:"flex-1 flex items-center gap-2 px-2 py-1 text-sm rounded-md hover:bg-accent ".concat(_===p?"bg-accent":""),title:p,children:[(0,a.jsx)(c.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate font-mono text-xs",children:"."}),(0,a.jsxs)("span",{className:"text-muted-foreground text-[11px] truncate",children:["(",M(p),")"]})]}),(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",disabled:Z||K,onClick:()=>{q(e=>!e),W("")},className:"h-8",title:r("picker.createFolderTitle",{parent:M(_)}),children:[(0,a.jsx)(u.A,{className:"mr-1 h-4 w-4"})," ",r("picker.createButton")]}),(0,a.jsxs)("label",{className:"flex items-center gap-1 text-xs text-muted-foreground select-none",children:[(0,a.jsx)("input",{type:"checkbox",checked:H,onChange:e=>T(e.target.checked)}),"hidden"]})]}),U&&(0,a.jsxs)("form",{className:"px-2 pb-2 flex items-center gap-2",onSubmit:e=>{e.preventDefault();let t=I.trim();t&&Q(async()=>{let e=await S(_,t);if(!e.ok){var a;f.oR.error(null!=(a=e.error)?a:r("picker.createFolderFailed"));return}f.oR.success(r("picker.folderCreated")),q(!1),W(""),await Y(_),E(e.path)})},children:[(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground font-mono truncate max-w-[40%]",children:[_,"/"]}),(0,a.jsx)(j.p,{autoFocus:!0,value:I,onChange:e=>W(e.target.value),placeholder:r("picker.newFolderPlaceholder"),className:"h-8 text-sm flex-1",disabled:K,onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),q(!1),W(""))}}),(0,a.jsxs)(b.$,{type:"submit",size:"sm",disabled:K||!I.trim(),className:"h-8",children:[K?(0,a.jsx)(h.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(u.A,{className:"mr-1 h-3.5 w-3.5"}),r("picker.createButton")]}),(0,a.jsx)(b.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),W("")},className:"h-8",children:(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(k.Separator,{className:"my-1"}),Z?(0,a.jsxs)("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:[(0,a.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"})," Loading…"]}):0===D.length?(0,a.jsx)("div",{className:"px-4 py-10 text-center text-sm text-muted-foreground",children:"No subdirectories."}):(0,a.jsx)(z,{nodes:D,selected:_,onSelect:E,onToggle:J,showHidden:H,depth:0})]})}),(0,a.jsx)(k.Separator,{}),(0,a.jsxs)(g.wL,{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"text-xs text-muted-foreground font-mono truncate",children:["Selected: ",_]}),(0,a.jsx)(b.$,{onClick:()=>{V(async()=>{let e=await N(_);if(!e.ok){var t;f.oR.error(null!=(t=e.error)?t:"Failed to add");return}f.oR.success("Directory added"),(0,P.$d)(P.Zi.rootsChanged),e.onboardingTopicId?X.push("/roots/".concat(e.id,"/chat/").concat(e.onboardingTopicId)):X.push("/roots/".concat(e.id))})},disabled:O||Z,children:O?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"})," Adding…"]}):"Add this directory"})]})]})}function z(e){let{nodes:t,selected:r,onSelect:s,onToggle:n,showHidden:i,depth:o}=e;return(0,a.jsx)("ul",{children:t.filter(e=>i||!e.hidden).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)(R,{node:e,depth:o,selected:r,onSelect:s,onToggle:n}),e.expanded&&e.children.length>0&&(0,a.jsx)(z,{nodes:e.children,selected:r,onSelect:s,onToggle:n,showHidden:i,depth:o+1}),e.expanded&&e.loaded&&0===e.children.length&&(0,a.jsx)("div",{className:"text-xs text-muted-foreground italic px-2 py-1",style:{paddingLeft:16*o+44},children:"(empty)"})]},e.absPath))})}function R(e){let{node:t,depth:r,selected:s,onSelect:n,onToggle:i}=e,o=s===t.absPath;return(0,a.jsxs)("div",{className:"group flex items-center gap-1 pr-2 py-1 rounded-md hover:bg-accent/60 ".concat(o?"bg-accent":""),style:{paddingLeft:16*r+4},children:[(0,a.jsx)("button",{type:"button",onClick:()=>i(t.absPath),className:"h-6 w-6 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0","aria-label":t.expanded?"Collapse":"Expand",children:t.loading?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):t.expanded?(0,a.jsx)(p.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(x.A,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)("button",{type:"button",onClick:()=>n(t.absPath),onDoubleClick:()=>i(t.absPath),className:"flex-1 min-w-0 flex items-center gap-2 text-left text-sm",children:[t.expanded?(0,a.jsx)(c.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}):(0,a.jsx)(v.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate ".concat(t.hidden?"opacity-60":""),children:t.name})]})]})}function F(e,t,r){return{name:e,absPath:t,hidden:r,loaded:!1,loading:!1,expanded:!1,children:[]}}function L(e,t,r){return e.map(e=>e.absPath===t?r(e):e.children.length>0?{...e,children:L(e.children,t,r)}:e)}function M(e){var t;let r=e.split("/").filter(Boolean);return null!=(t=r[r.length-1])?t:e}},32740:(e,t,r)=>{Promise.resolve().then(r.bind(r,32564)),Promise.resolve().then(r.bind(r,96253)),Promise.resolve().then(r.bind(r,28050)),Promise.resolve().then(r.bind(r,94904)),Promise.resolve().then(r.bind(r,13270)),Promise.resolve().then(r.bind(r,99730)),Promise.resolve().then(r.bind(r,89146)),Promise.resolve().then(r.bind(r,19078)),Promise.resolve().then(r.bind(r,67854)),Promise.resolve().then(r.bind(r,69050)),Promise.resolve().then(r.bind(r,63739)),Promise.resolve().then(r.bind(r,33976)),Promise.resolve().then(r.bind(r,12537)),Promise.resolve().then(r.bind(r,97485)),Promise.resolve().then(r.bind(r,41923)),Promise.resolve().then(r.bind(r,73868)),Promise.resolve().then(r.bind(r,53511)),Promise.resolve().then(r.bind(r,2018)),Promise.resolve().then(r.bind(r,18487)),Promise.resolve().then(r.bind(r,98346)),Promise.resolve().then(r.bind(r,14884)),Promise.resolve().then(r.bind(r,85314)),Promise.resolve().then(r.bind(r,17280)),Promise.resolve().then(r.bind(r,8855)),Promise.resolve().then(r.bind(r,86631)),Promise.resolve().then(r.bind(r,2604)),Promise.resolve().then(r.bind(r,27237)),Promise.resolve().then(r.bind(r,49455)),Promise.resolve().then(r.bind(r,39211)),Promise.resolve().then(r.bind(r,56360)),Promise.resolve().then(r.t.bind(r,54400,23))},42146:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])},59728:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},60621:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var a=r(47989);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=a.$,i=(e,t)=>r=>{var a;if((null==t?void 0:t.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],a=null==o?void 0:o[e];if(null===t)return null;let n=s(t)||s(a);return i[e][n]}),d=r&&Object.entries(r).reduce((e,t)=>{let[r,a]=t;return void 0===a||(e[r]=a),e},{});return n(e,l,null==t||null==(a=t.compoundVariants)?void 0:a.reduce((e,t)=>{let{class:r,className:a,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...d}[t]):({...o,...d})[t]===r})?[...e,r,a]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},63514:(e,t,r)=>{"use strict";r.d(t,{$d:()=>n,S9:()=>i,Zi:()=>s});var a=r(99356);let s={rootsChanged:"reflex:roots-changed",topicsChanged:e=>"reflex:topics-changed:".concat(e),kbChanged:e=>"reflex:kb-changed:".concat(e)};function n(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function i(e,t){(0,a.useEffect)(()=>{let r=e=>t(e.detail);return window.addEventListener(e,r),()=>window.removeEventListener(e,r)},[e,t])}},69205:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},69285:(e,t,r)=>{"use strict";var a=r(48849);r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}})},69709:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},72754:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},80192:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var a=r(4624);r(99356);var s=r(14884),n=r(13506);function i(e){let{className:t,children:r,...i}=e;return(0,a.jsxs)(s.Root,{"data-slot":"scroll-area",className:(0,n.cn)("relative",t),...i,children:[(0,a.jsx)(s.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:r}),(0,a.jsx)(o,{}),(0,a.jsx)(s.Corner,{})]})}function o(e){let{className:t,orientation:r="vertical",...i}=e;return(0,a.jsx)(s.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:r,className:(0,n.cn)("flex touch-none p-px transition-colors select-none","vertical"===r&&"h-full w-2.5 border-l border-l-transparent","horizontal"===r&&"h-2.5 flex-col border-t border-t-transparent",t),...i,children:(0,a.jsx)(s.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},85253:(e,t,r)=>{"use strict";r.d(t,{$:()=>l});var a=r(4624);r(99356);var s=r(60621),n=r(50362),i=r(13506);let o=(0,s.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r="default",size:s="default",asChild:l=!1,...d}=e,c=l?n.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":s,className:(0,i.cn)(o({variant:r,size:s,className:t})),...d})}},91074:(e,t,r)=>{"use strict";r.d(t,{Separator:()=>i});var a=r(4624);r(99356);var s=r(44188),n=r(13506);function i(e){let{className:t,orientation:r="horizontal",decorative:i=!0,...o}=e;return(0,a.jsx)(s.b,{"data-slot":"separator",decorative:i,orientation:r,className:(0,n.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}}},e=>{e.O(0,[4400,4678,9776,6785,3335,9411,4933,146,7358],()=>e(e.s=32740)),_N_E=e.O()}]);
|