reflex-agent 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +96 -96
  3. package/.next/app-path-routes-manifest.json +8 -8
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +7 -7
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/server/app/_not-found/page.js +1 -1
  8. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/agents/[agentId]/page.js +3 -3
  11. package/.next/server/app/agents/[agentId]/page.js.nft.json +1 -1
  12. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/agents/[agentId]/respond/route.js +2 -2
  14. package/.next/server/app/api/agents/[agentId]/respond/route.js.nft.json +1 -1
  15. package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/oauth/callback/route.js +2 -2
  18. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +2 -2
  22. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js.nft.json +1 -1
  23. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +2 -2
  25. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js.nft.json +1 -1
  26. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +3 -3
  28. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js.nft.json +1 -1
  29. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
  31. package/.next/server/app/api/roots/[id]/dashboard/route.js.nft.json +1 -1
  32. package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
  34. package/.next/server/app/api/roots/[id]/suggestions/route.js.nft.json +1 -1
  35. package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -1
  38. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js.nft.json +1 -1
  39. package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/audit/page.js +1 -1
  45. package/.next/server/app/audit/page.js.nft.json +1 -1
  46. package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/onboarding/page.js +3 -3
  48. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  49. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  50. package/.next/server/app/page.js +2 -2
  51. package/.next/server/app/page.js.nft.json +1 -1
  52. package/.next/server/app/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -2
  54. package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
  55. package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
  57. package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
  58. package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/roots/[id]/page.js +11 -3
  60. package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
  61. package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
  62. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
  63. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
  64. package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/roots/[id]/workflows/page.js +1 -1
  66. package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
  67. package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/roots/new/page.js +3 -3
  69. package/.next/server/app/roots/new/page.js.nft.json +1 -1
  70. package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/settings/page.js +5 -5
  72. package/.next/server/app/settings/page.js.nft.json +1 -1
  73. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/share/[id]/file/page.js +1 -1
  75. package/.next/server/app/share/[id]/file/page.js.nft.json +1 -1
  76. package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/share/[id]/page.js +2 -2
  78. package/.next/server/app/share/[id]/page.js.nft.json +1 -1
  79. package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
  80. package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
  81. package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
  82. package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/utilities/page.js +2 -2
  84. package/.next/server/app/utilities/page.js.nft.json +1 -1
  85. package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app-paths-manifest.json +8 -8
  87. package/.next/server/chunks/2485.js +1 -1
  88. package/.next/server/chunks/285.js +120 -49
  89. package/.next/server/chunks/2920.js +1 -0
  90. package/.next/server/chunks/3151.js +3 -0
  91. package/.next/server/chunks/3152.js +1 -1
  92. package/.next/server/chunks/3332.js +1 -1
  93. package/.next/server/chunks/4197.js +4 -0
  94. package/.next/server/chunks/4812.js +2 -2
  95. package/.next/server/chunks/539.js +1 -1
  96. package/.next/server/chunks/6483.js +2 -2
  97. package/.next/server/chunks/{3635.js → 6822.js} +1 -1
  98. package/.next/server/chunks/{6909.js → 7358.js} +121 -50
  99. package/.next/server/chunks/8872.js +1 -0
  100. package/.next/server/chunks/9098.js +1 -1
  101. package/.next/server/chunks/9637.js +1 -0
  102. package/.next/server/functions-config-manifest.json +2 -2
  103. package/.next/server/middleware-build-manifest.js +1 -1
  104. package/.next/server/middleware-manifest.json +5 -5
  105. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  106. package/.next/server/pages/500.html +1 -1
  107. package/.next/server/server-reference-manifest.js +1 -1
  108. package/.next/server/server-reference-manifest.json +1 -1
  109. package/.next/static/chunks/4108.aca4cb07ce9b3ed2.js +1 -0
  110. package/.next/static/chunks/4138-d787eac2eac9c9a8.js +1 -0
  111. package/.next/static/chunks/4847-a85e8d18ea0da09e.js +1 -0
  112. package/.next/static/chunks/527-c86224761908776e.js +1 -0
  113. package/.next/static/chunks/70-61c97afa667d1efe.js +1 -0
  114. package/.next/static/chunks/8270-8e72f6c35eb03ad2.js +1 -0
  115. package/.next/static/chunks/app/{layout-64e60b0b8e0282d7.js → layout-c712136be28f3127.js} +1 -1
  116. package/.next/static/chunks/app/onboarding/page-a4145c3e505dfe74.js +1 -0
  117. package/.next/static/chunks/app/page-6096902532dd6ec8.js +1 -0
  118. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-b3d8e79a61db4bdc.js +1 -0
  119. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-75d2a17f6f78a45d.js +1 -0
  120. package/.next/static/chunks/app/roots/[id]/page-6a9df2bb923bb1d3.js +1 -0
  121. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-8a3c2c81fce5b020.js +1 -0
  122. package/.next/static/chunks/app/roots/new/{page-2d2e4524a5804faa.js → page-dc4edb7f4cbc2441.js} +1 -1
  123. package/.next/static/chunks/app/settings/page-df5f4911b7f3a2df.js +1 -0
  124. package/.next/static/chunks/app/share/[id]/page-050853f9974f0915.js +1 -0
  125. package/.next/static/chunks/app/utilities/[scope]/[id]/page-d5494af2daf1c38d.js +1 -0
  126. package/.next/static/chunks/app/utilities/page-3ee2dc6d66ad4154.js +1 -0
  127. package/.next/static/chunks/{webpack-84a033e55baef334.js → webpack-6f08731be9714ee4.js} +1 -1
  128. package/.next/static/css/2bc00775af31f40f.css +1 -0
  129. package/.next/trace +89 -89
  130. package/dist/lib/reflex/agents/prompts.js +60 -0
  131. package/dist/lib/reflex/agents/prompts.js.map +1 -1
  132. package/package.json +1 -1
  133. package/.next/server/chunks/2559.js +0 -1
  134. package/.next/server/chunks/3868.js +0 -4
  135. package/.next/server/chunks/6149.js +0 -3
  136. package/.next/server/chunks/6954.js +0 -1
  137. package/.next/server/chunks/8142.js +0 -1
  138. package/.next/static/chunks/1580-740a1a70ef8ffa0d.js +0 -1
  139. package/.next/static/chunks/1748-53319d5ec4411b05.js +0 -1
  140. package/.next/static/chunks/357-75ffe19a5d55a8b8.js +0 -1
  141. package/.next/static/chunks/4108.86e2092ff9db450c.js +0 -1
  142. package/.next/static/chunks/4971-85de3cd4fda214ae.js +0 -1
  143. package/.next/static/chunks/7882-2b0a83d718b55183.js +0 -1
  144. package/.next/static/chunks/app/onboarding/page-9601fcb7f4f95bf8.js +0 -1
  145. package/.next/static/chunks/app/page-7666e4bab61a7c9a.js +0 -1
  146. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-790adae334559fee.js +0 -1
  147. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-50409258dd7f5deb.js +0 -1
  148. package/.next/static/chunks/app/roots/[id]/page-976f754ee926503d.js +0 -1
  149. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-fcc5eebbf3ebc541.js +0 -1
  150. package/.next/static/chunks/app/settings/page-830a2dbc2d81d341.js +0 -1
  151. package/.next/static/chunks/app/share/[id]/page-fc9bee69ce1ab695.js +0 -1
  152. package/.next/static/chunks/app/utilities/[scope]/[id]/page-2fc8d46da0544044.js +0 -1
  153. package/.next/static/chunks/app/utilities/page-14013c0eaaa83a58.js +0 -1
  154. package/.next/static/css/c46d970256fc7904.css +0 -1
  155. /package/.next/static/{LRmct3V5fYVu_lgUdqH4x → F56etct0NPc8KXiqqJQvx}/_buildManifest.js +0 -0
  156. /package/.next/static/{LRmct3V5fYVu_lgUdqH4x → F56etct0NPc8KXiqqJQvx}/_ssgManifest.js +0 -0
@@ -1,5 +1,13 @@
1
- (()=>{var a={};a.id=8138,a.ids=[8138],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},574:(a,b,c)=>{"use strict";c.d(b,{AddUtilityButton:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call AddUtilityButton() from the server but AddUtilityButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/add-utility-button.tsx","AddUtilityButton")},770:(a,b,c)=>{"use strict";c.d(b,{RunInitButton:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call RunInitButton() from the server but RunInitButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/run-init-button.tsx","RunInitButton")},1708:a=>{"use strict";a.exports=require("node:process")},1800:(a,b,c)=>{Promise.resolve().then(c.bind(c,42386)),Promise.resolve().then(c.bind(c,21448)),Promise.resolve().then(c.bind(c,84910)),Promise.resolve().then(c.bind(c,15620)),Promise.resolve().then(c.bind(c,86974)),Promise.resolve().then(c.bind(c,23273)),Promise.resolve().then(c.bind(c,68394)),Promise.resolve().then(c.bind(c,51189)),Promise.resolve().then(c.bind(c,66180)),Promise.resolve().then(c.bind(c,75266)),Promise.resolve().then(c.bind(c,14360)),Promise.resolve().then(c.bind(c,6786)),Promise.resolve().then(c.bind(c,44896)),Promise.resolve().then(c.bind(c,14848)),Promise.resolve().then(c.bind(c,53710)),Promise.resolve().then(c.bind(c,30544)),Promise.resolve().then(c.bind(c,13829)),Promise.resolve().then(c.bind(c,90044)),Promise.resolve().then(c.bind(c,57673)),Promise.resolve().then(c.bind(c,97053)),Promise.resolve().then(c.bind(c,43151)),Promise.resolve().then(c.bind(c,12156)),Promise.resolve().then(c.bind(c,71615)),Promise.resolve().then(c.bind(c,4080)),Promise.resolve().then(c.bind(c,87177)),Promise.resolve().then(c.bind(c,87634)),Promise.resolve().then(c.bind(c,6912)),Promise.resolve().then(c.bind(c,13976)),Promise.resolve().then(c.bind(c,18282)),Promise.resolve().then(c.bind(c,20633)),Promise.resolve().then(c.bind(c,61193)),Promise.resolve().then(c.bind(c,66188)),Promise.resolve().then(c.bind(c,66643)),Promise.resolve().then(c.bind(c,81669)),Promise.resolve().then(c.bind(c,39991)),Promise.resolve().then(c.bind(c,54972)),Promise.resolve().then(c.t.bind(c,1056,23))},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},3442:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},4984:a=>{"use strict";a.exports=require("readline")},7206:a=>{"use strict";a.exports=import("execa")},8086:a=>{"use strict";a.exports=require("module")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14952:(a,b,c)=>{Promise.resolve().then(c.bind(c,86673)),Promise.resolve().then(c.bind(c,16805)),Promise.resolve().then(c.bind(c,574)),Promise.resolve().then(c.bind(c,90558)),Promise.resolve().then(c.bind(c,64845)),Promise.resolve().then(c.bind(c,770)),Promise.resolve().then(c.bind(c,60524)),Promise.resolve().then(c.bind(c,50155)),Promise.resolve().then(c.bind(c,26922)),Promise.resolve().then(c.bind(c,79008)),Promise.resolve().then(c.bind(c,68146)),Promise.resolve().then(c.bind(c,60936)),Promise.resolve().then(c.bind(c,65138)),Promise.resolve().then(c.bind(c,68902)),Promise.resolve().then(c.bind(c,69644)),Promise.resolve().then(c.bind(c,49186)),Promise.resolve().then(c.bind(c,93099)),Promise.resolve().then(c.bind(c,83594)),Promise.resolve().then(c.bind(c,24375)),Promise.resolve().then(c.bind(c,67135)),Promise.resolve().then(c.bind(c,85105)),Promise.resolve().then(c.bind(c,41886)),Promise.resolve().then(c.bind(c,33309)),Promise.resolve().then(c.bind(c,37550)),Promise.resolve().then(c.bind(c,96623)),Promise.resolve().then(c.bind(c,77372)),Promise.resolve().then(c.bind(c,65478)),Promise.resolve().then(c.bind(c,97230)),Promise.resolve().then(c.bind(c,73552)),Promise.resolve().then(c.bind(c,391)),Promise.resolve().then(c.bind(c,4235)),Promise.resolve().then(c.bind(c,41138)),Promise.resolve().then(c.bind(c,60877)),Promise.resolve().then(c.bind(c,7671)),Promise.resolve().then(c.bind(c,5637)),Promise.resolve().then(c.bind(c,36786)),Promise.resolve().then(c.t.bind(c,20594,23))},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19356:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},20567:(a,b,c)=>{"use strict";c.d(b,{AU:()=>j,Z9:()=>i});var d=c(73024);c(76760);var e=c(56149),f=c(54287);let g=e.Ik({watchDebounceMs:e.ai().int().min(f.a,{message:`watchDebounceMs must be ≥ ${f.a} ms`}).default(f.VU),agentBackend:e.k5(["codex","claude-code"]).default("claude-code"),ignoreFile:e.Yj().default(".reflexignore")}),h=g.parse({});async function i(a){let b=(0,f.eQ)(a);try{let a=await d.promises.readFile(b,"utf8");return g.parse(JSON.parse(a))}catch(a){var c;if("object"==typeof(c=a)&&null!==c&&"code"in c&&"ENOENT"===c.code)return h;throw a}}async function j(a,b){await d.promises.mkdir((0,f.FF)(a),{recursive:!0}),await d.promises.writeFile((0,f.eQ)(a),JSON.stringify(b,null,2)+"\n","utf8")}},21820:a=>{"use strict";a.exports=require("os")},23273:(a,b,c)=>{"use strict";c.d(b,{RunInitButton:()=>m});var d=c(64173),e=c(17240),f=c(62261),g=c(52869),h=c(44052),i=c(20583),j=c(3265);let k=(0,j.createServerReference)("7097c53d805e225aaae726116c92b63e04ca1f7010",j.callServer,void 0,j.findSourceMapURL,"runInitAction");var l=c(88724);function m({rootPath:a,rootId:b}){let[c,j]=(0,e.useTransition)();return(0,d.jsx)(i.$,{onClick:()=>j(async()=>{let c=h.oR.loading("Running agent — this can take a minute or two…"),d=await k(a,b,!1);h.oR.dismiss(c),d.ok?(h.oR.success("Init complete"),(0,l.$d)(l.Zi.kbChanged(b)),(0,l.$d)(l.Zi.rootsChanged)):h.oR.error(d.error??"Init failed")}),disabled:c,children:c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"})," Running…"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{className:"mr-2 h-4 w-4"})," Run init"]})})}},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},28074:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{y:()=>l});var e=c(7206),f=c(73024),g=c(46726),h=c(78744),i=a([e]);e=(i.then?(await i)():i)[0];let k="claude",l={id:"claude-code",async analyzeScope(a){await j(),await f.promises.mkdir(a.reflexScope,{recursive:!0});let b=await (0,h.p)(a),c=["-p",b,"--permission-mode","acceptEdits","--allowedTools","Read,Write,Edit,LS,Glob,Grep","--add-dir",a.reflexScope];a.model&&c.push("--model",a.model),await (0,e.execa)(k,c,{cwd:a.root,stdio:"inherit"})},async chat(a){await j();let b=await (0,h.M)(a);await (0,e.execa)(k,["--append-system-prompt",b,"--add-dir",a.reflexScope],{cwd:a.scope,stdio:"inherit"})}};async function j(){try{await (0,e.execa)(k,["--version"],{stdio:"ignore"})}catch(a){throw new g.g("claude-code",a)}}d()}catch(a){d(a)}})},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31041:(a,b,c)=>{"use strict";c.d(b,{BT:()=>i,Wu:()=>j,ZB:()=>h,Zp:()=>f,aR:()=>g,wL:()=>k});var d=c(64173);c(17240);var e=c(91344);function f({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card",className:(0,e.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",a),...b})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.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",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("leading-none font-semibold",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:(0,e.cn)("text-sm text-muted-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-6",a),...b})}function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-footer",className:(0,e.cn)("flex items-center px-6 [.border-t]:pt-6",a),...b})}},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},35314:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{j:()=>h});var e=c(28074),f=c(48519),g=a([e,f]);[e,f]=g.then?(await g)():g;let i={"claude-code":e.y,codex:f.C};function h(a){let b=i[a.agentBackend];if(!b)throw Error(`Unknown agent backend: ${a.agentBackend}`);return b}d()}catch(a){d(a)}})},36306:a=>{"use strict";a.exports=import("@tailwindcss/node")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},44171:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},46726:(a,b,c)=>{"use strict";c.d(b,{g:()=>d});class d extends Error{constructor(a,b){super(`Agent backend "${a}" is unavailable: ${b instanceof Error?b.message:String(b)}`),this.name="AgentUnavailableError"}}},46770:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"001341fceb8414c4d7d121651eb8b9a28e21b3da33":()=>l.Bp,"007940bf808154f76026b158effd8381461416bda8":()=>k.Fm,"00b0deb580b821c13cd7747b74bb8d461e8fbb8922":()=>k.Ng,"00b1b8c26254a90b5cbca1823c1d7e78df881a2736":()=>k.Zl,"00b61a40fac9b21ad6f4e4a76e87038390efedf684":()=>g.i,"00c88ea8b4e421083e566a83707b9cc8a26fec2b9f":()=>s.w,"00cb7bf650409cb042160f9091c01d274a508cd66e":()=>k.Nt,"00d5177a369c199a6d4d67e9516ec503b8c3531b95":()=>o.wd,"00ed88f596870410ad47d1256a36378907bba6411b":()=>j.L8,"40007e8588123e4a1c2446869c632dd3481c97ae79":()=>l.gn,"40052029685146fccb067daf5fe782f3a861c82775":()=>p.ct,"400a60e2061cfe21dadeb1433cb28a8826c1fa8476":()=>n.x,"400b14da94f93e958c4820fd255e1dba2e675ee5f0":()=>e.nC,"400c568a7db516ccdd6d9ba2bae2662b3ebc31957f":()=>l.QR,"400e8d7c67057bea6aef89be20396fc5de0ba0dd46":()=>l.L_,"4014d0297188a0950381429d433d10aa98cde3ae84":()=>l.vv,"4018083d4923b30a197b1fc83354bff9817054a2fa":()=>l.mR,"4025f7fd383d7aaeba853004f970d2f5dc51fc1572":()=>i.uA,"40293949eeea14f1abc36aee7a1c6b08f531044b63":()=>l.b7,"402cdd8397ff9d25cf4ad96075ea3622884b135a60":()=>h.$z,"4035e97d85d70e8eaaa8557d97eb59e375c117b7ed":()=>f.z,"403e983977877b307d9670a7f626b1e2455a363885":()=>q.RR,"404831e19a27eaf506c581594c309ef4e315f8d1f4":()=>h.MU,"404d0691571f379f1db2b8d7dbf5fcdeafee79e0fc":()=>f.u,"404ea01a5eda6a32991a3e36211a1fc540bcd57243":()=>l.Kt,"4058cdbb16e944d3f8754aa278125cf0b6169794b6":()=>l.Yt,"4059b8409808eb39568df1892a8b5fd4e837e3d373":()=>e.nY,"405ec53da393750aba1a102583b27c6bb53b5b7867":()=>p.uy,"40626117cb2bab0b0c8473199e2e3278a5061e6b58":()=>j.ns,"4069f9843caba5ad00f780f3ac4c4aa177d3013261":()=>i.Cz,"40789ceee14fca4b897c3f08e93712b1fdc03a2f38":()=>o.LL,"407e1ec647ac47828a8f71dfd10fd41930d8abd913":()=>i.hN,"4084822de69aa14384f43e55b6234553adffbf1dc9":()=>t.K9,"4098ccef81a70c3489b2a27f59f021bd8de9c73109":()=>t.rg,"40a99f1ab040292fb2a54e3fb4f55ac404de385679":()=>l.nO,"40b0da2e010aae2fb36461a876894101fae8f346dc":()=>l.JR,"40bbbfbf70cc4f50aa1312ef994664910de49789b4":()=>k.bt,"40c58744e22bd7a5e6a79e2d723da9c8c61f5a7502":()=>i.IK,"40c9699f70b447d4fead0ea11e252e38865d139599":()=>l.RK,"40d54200b5ecc4abb8e00bb6ca186c1cabd700e9f9":()=>p.Yr,"40d6b08cbe8d94852a207c89611967292f75dd5d40":()=>l.k_,"40d743a93d1471d5f57fe5f4440fb41cb460706bd1":()=>j.Is,"40e4e924aa53ad8f05d0077700aaa6b5965efbec5c":()=>q.R1,"40e63d7cb1fa792dc22a713385a884d2d0abce1731":()=>q.c9,"40fa11eaf0802d2f2c3da2477f43c9e5fef17ade4f":()=>l.Zh,"600511d2cb84a2ceabb4b62bbf0286dfdd888078ed":()=>r.tT,"6009e206c0d3d6b007dc4e7ce95600f9ce84d54020":()=>r.cl,"60329fd98a356f77677ac8d2d262a1a2e7527b462b":()=>o.ZC,"60500860b41d0ab1e6c6657111ca40fdda8ce7afab":()=>r.hL,"60710357a0553f0da8e04948d247a9c4e7519ce6e8":()=>m.S,"608f028ad74cfe4b7ae15960871d695e1cfc25de7c":()=>r.Aq,"60ac998057a449ec671cc27babf2c5ce2a9f8c3995":()=>h.Tc,"60aff92e27d06500bcb27bcee5c4a79cfd72d9c5f1":()=>o.qO,"60b0f08fd473c27ea347b31c7944a2c2ea795fc367":()=>r.KV,"60b821086d84cce706ab8a92f10bc276f6b8b34d17":()=>o.b2,"60c82dbc54ebebde5ee157e85e01721ad76126b665":()=>e.L4,"60c8f40603d8894bb9dca7e05ed01a48c9a8eaa186":()=>e.T$,"60dea53b5c3903235447bf5cd591581728eb160d4a":()=>e.OQ,"7027419a080ac59b35fddc6e37eabafe99c092b625":()=>e.h$,"7040e3dc047efa96c3c9111e517343785985b3e040":()=>r.Mh,"705a1d9d6197afca0974a26faea39ed19829a6dae2":()=>l.jf,"705dc0bf98e010ba114e21938853009cbe07d11a8d":()=>l.i8,"7091c1a7bb8977e9c27d4a114dc26ea06278172c84":()=>r.mm,"7097c53d805e225aaae726116c92b63e04ca1f7010":()=>t.Ik,"70c695a13fe1c2b91fcd1c3d6e56356f571febf6ec":()=>l.QI,"70dba019e89f68093e7d0eb1ba647e70a5975160ee":()=>l.q_,"789fccf65ed6f2f7db808c6867ed11fd1129d1ce91":()=>r.ru,"78c5512a5e07397f4abcfe04dfa901cfa1b305a904":()=>e.g3});var e=c(13415),f=c(3890),g=c(50995),h=c(15754),i=c(27129),j=c(16856),k=c(92814),l=c(9328),m=c(4168),n=c(63337),o=c(72901),p=c(98783),q=c(91745),r=c(34639),s=c(48272),t=c(78645),u=a([e,h,l,o,p,q,r,t]);[e,h,l,o,p,q,r,t]=u.then?(await u)():u,d()}catch(a){d(a)}})},47452:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(19963).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"}]])},48161:a=>{"use strict";a.exports=require("node:os")},48519:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{C:()=>l});var e=c(7206),f=c(73024),g=c(46726),h=c(78744),i=a([e]);e=(i.then?(await i)():i)[0];let k="codex",l={id:"codex",async analyzeScope(a){await j(),await f.promises.mkdir(a.reflexScope,{recursive:!0});let b=await (0,h.p)(a),c=["exec","--cd",a.root,"--sandbox","workspace-write","--add-dir",a.reflexScope];a.model&&c.push("--model",a.model),c.push(b),await (0,e.execa)(k,c,{stdio:"inherit"})},async chat(a){await j();let b=await (0,h.M)(a);await (0,e.execa)(k,["--system",b],{cwd:a.scope,stdio:"inherit"})}};async function j(){try{await (0,e.execa)(k,["--version"],{stdio:"ignore"})}catch(a){throw new g.g("codex",a)}}d()}catch(a){d(a)}})},49809:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k:()=>v,x:()=>t});var e=c(31776);c(428);var f=c(73024),g=c(76760),h=c.n(g),i=c(24576),j=c(11178),k=c(56843),l=c(16909),m=c(24139),n=c(1701),o=c(52129),p=c(7188),q=c(11244),r=c(97364),s=a([l,o]);async function t(a){try{let b=await (0,i.Zn)(a);if(!b)return{ok:!1,error:"Root not found"};let[c,d,e,f]=await Promise.all([(0,k.hk)(b.path),(0,j.CA)(b.path),(0,p.listWidgets)(b.path),(0,p.readLayout)(b.path)]),g=(0,p.reconcileLayout)(f,e.map(a=>a.id),q.SYSTEM_WIDGET_IDS);(g.order.join("|")!==f.order.join("|")||g.hidden.join("|")!==f.hidden.join("|")||JSON.stringify(g.sizes??{})!==JSON.stringify(f.sizes??{}))&&await (0,p.writeLayout)(b.path,g);let h=c.map(a=>a.meta.id),r=new Set("function"==typeof l.z.listRunningTopicsForRoot?l.z.listRunningTopicsForRoot(a):[]),[s,t,v]=await Promise.all([(0,m.Z)(b.path,h),(0,n.Mn)(),(0,o.Qv)(a).catch(()=>null)]),w=new Set(s.map(a=>a.requestId));for(let a of t)!w.has(a.requestId)&&h.includes(a.topicId)&&s.push({kind:"mcp-add",topicId:a.topicId,requestId:a.requestId,ts:a.createdAt,summary:`MCP add: ${a.directive.label}`,...a.directive.description?{details:a.directive.description}:{}});s.sort((a,b)=>a.ts<b.ts?1:-1);let x=new Map;for(let a of c)x.set(a.meta.id,a.meta);let y=[],z=[];for(let a of c){let b=a.meta;if(b.goal&&"active"===b.goalStatus){y.push({topicId:b.id,topicTitle:b.title,goal:b.goal,goalIterations:b.goalIterations??0,updatedAt:b.updatedAt,running:r.has(b.id)});continue}r.has(b.id)&&z.push({topicId:b.id,topicTitle:b.title,updatedAt:b.updatedAt})}y.sort((a,b)=>a.updatedAt<b.updatedAt?1:-1),z.sort((a,b)=>a.updatedAt<b.updatedAt?1:-1);let A=await u(d);return{ok:!0,snapshot:{rootId:a,rootPath:b.path,activeGoals:y,runningAgents:z,pendingApprovals:s,recentKb:A,suggestions:v,widgets:e,layout:g}}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function u(a){let b=Date.now()-2592e5,c=a.filter(a=>Date.parse(a.modifiedAt)>=b).sort((a,b)=>a.modifiedAt<b.modifiedAt?1:-1).slice(0,6);return Promise.all(c.map(async a=>{let b=await (0,j.xO)(a.abs);return{rel:a.rel,title:b.title??h().basename(a.rel),...b.kind?{kind:b.kind}:{},modifiedAt:a.modifiedAt,preview:""}}))}async function v(a,b){try{let c=await (0,i.Zn)(a);if(!c)return{ok:!1,error:"Root not found"};let d=h().join(c.path,".reflex",b),e=h().relative(h().join(c.path,".reflex"),d);if(e.startsWith("..")||h().isAbsolute(e))return{ok:!1,error:"Refused (path traversal)"};let g=await f.promises.readFile(d,"utf8");return{ok:!0,preview:function(a){let b=a,c=a.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return c&&(b=a.slice(c[0].length)),(b=b.replace(/^#+\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\r?\n+/g," ").trim()).length>200&&(b=b.slice(0,197).trimEnd()+"…"),b}(g)}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}[l,o]=s.then?(await s)():s,(0,r.D)([t,v]),(0,e.A)(t,"40d4bbd2cde140a66caa7ca8b04a1d51318bb7c228",null),(0,e.A)(v,"60d2dbfc420613da79d1ae3ccc31e1ed5c1052e863",null),d()}catch(a){d(a)}})},50108:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{E:()=>m});var e=c(73024),f=c(76760),g=c.n(f),h=c(20567),i=c(35314),j=c(79734),k=c(54287),l=a([i]);async function m(a,b={}){let c=g().resolve(a);await n(c),await e.promises.mkdir((0,k.FF)(c),{recursive:!0});let d=await (0,h.Z9)(c);if(await (0,h.AU)(c,d),await (0,j.D)(c),b.scaffoldOnly)return void process.stdout.write(`Reflex scaffolded at ${(0,k.FF)(c)} (scaffold-only).
1
+ (()=>{var a={};a.id=8138,a.ids=[8138],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},574:(a,b,c)=>{"use strict";c.d(b,{AddUtilityButton:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call AddUtilityButton() from the server but AddUtilityButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/add-utility-button.tsx","AddUtilityButton")},770:(a,b,c)=>{"use strict";c.d(b,{RunInitButton:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call RunInitButton() from the server but RunInitButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/run-init-button.tsx","RunInitButton")},1708:a=>{"use strict";a.exports=require("node:process")},3237:(a,b,c)=>{"use strict";c.d(b,{RemoveRootButton:()=>m});var d=c(64173),e=c(17240),f=c(97338),g=c(44052),h=c(87671),i=c(20583),j=c(3265);let k=(0,j.createServerReference)("40cc3ca8a4e655d45e7f28bd4bc971943c7d279203",j.callServer,void 0,j.findSourceMapURL,"removeRootAction");var l=c(88724);function m({id:a,path:b,redirectHome:c}){let[j,m]=(0,e.useTransition)(),n=(0,h.useRouter)();return(0,d.jsx)(i.$,{variant:"ghost",size:"sm",disabled:j,title:"Delete Space",onClick:()=>{confirm(`Delete this Space?
2
+
3
+ Path: ${b}
4
+
5
+ This wipes the .reflex/ folder (KB, topics, memory, suggestions, audit) and removes mentions of "${b.split("/").pop()??b}" from global memory.
6
+
7
+ Your own files in the folder are NOT touched.
8
+
9
+ This cannot be undone.`)&&m(async()=>{let b=await k(a);b.ok?(g.oR.success("Space deleted"),(0,l.$d)(l.Zi.rootsChanged),c&&n.push("/")):g.oR.error(b.error??"Failed to delete")})},children:(0,d.jsx)(f.A,{className:"h-4 w-4 text-muted-foreground"})})}},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},3442:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},4984:a=>{"use strict";a.exports=require("readline")},7206:a=>{"use strict";a.exports=import("execa")},8086:a=>{"use strict";a.exports=require("module")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12690:(a,b,c)=>{"use strict";c.d(b,{Dashboard:()=>aB});var d=c(64173),e=c(17240),f=c(71813),g=c(63351),h=c(44052),i=c(20583),j=c(88724),k=c(1056),l=c.n(k),m=c(75430),n=c(62261),o=c(96975),p=c(42382),q=c(31041);function r({rootId:a,activeGoals:b,runningAgents:c}){let e=(0,f.c)("roots"),g=b.length+c.length;return(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(m.A,{className:"h-4 w-4 text-violet-600"}),e("activeGoals.title")]}),g>0&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:g})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[0===g&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:e("activeGoals.empty")}),b.map(b=>(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.topicId}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(m.A,{className:"h-3.5 w-3.5 text-violet-600 mt-0.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.topicTitle}),b.running&&(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin text-violet-600 shrink-0"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:b.goal}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-muted-foreground",children:[(0,d.jsx)("span",{children:e("activeGoals.iterationLabel",{count:b.goalIterations})}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsx)("span",{children:e("activeGoals.updatedLabel",{time:function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("activeGoals.justNow");let d=Math.floor(c/6e4);if(d<1)return b("activeGoals.justNow");if(d<60)return b("activeGoals.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("activeGoals.hoursAgo",{count:e}):b("activeGoals.daysAgo",{count:Math.floor(e/24)})}(b.updatedAt,e)})})]})]})]})},b.topicId)),c.map(b=>(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.topicId}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5 text-amber-600 mt-0.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.topicTitle}),(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin text-amber-600 shrink-0"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e("activeGoals.agentRunning")})]})]})},b.topicId))]})]})}var s=c(74868),t=c(42324),u=c(63387),v=c(33120);function w({rootId:a,items:b}){let c=(0,f.c)("roots");return(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(s.A,{className:"h-4 w-4 text-amber-600"}),c("pendingApprovals.title")]}),b.length>0&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:b.length})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[0===b.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("pendingApprovals.empty")}),b.map(b=>{var e;return(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.topicId}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(x,{kind:b.kind}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.summary}),(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:"permission"===(e=b.kind)?"permission":"question"===e?"question":"mcp-add"})]}),b.details&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:b.details}),(0,d.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:["topic ",b.topicId.slice(0,12)," \xb7 ",function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("pendingApprovals.justNow");let d=Math.floor(c/6e4);if(d<1)return b("pendingApprovals.justNow");if(d<60)return b("pendingApprovals.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("pendingApprovals.hoursAgo",{count:e}):b("pendingApprovals.daysAgo",{count:Math.floor(e/24)})}(b.ts,c)]})]})]})},`${b.kind}:${b.requestId}`)})]})]})}function x({kind:a}){let b="h-3.5 w-3.5 mt-0.5 shrink-0";return"permission"===a?(0,d.jsx)(t.A,{className:`${b} text-rose-600`}):"question"===a?(0,d.jsx)(u.A,{className:`${b} text-sky-600`}):(0,d.jsx)(v.A,{className:`${b} text-emerald-600`})}var y=c(68669),z=c(3265);function A({rootId:a,items:b}){let c=(0,f.c)("roots"),[g,h]=(0,e.useState)({});return(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(y.A,{className:"h-4 w-4 text-emerald-700"}),c("recentKb.title")]}),b.length>0&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:b.length})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[0===b.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("recentKb.empty")}),b.map(b=>(0,d.jsx)(l(),{href:`/roots/${a}/kb/${b.rel.split("/").map(encodeURIComponent).join("/")}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(y.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-emerald-700"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.title}),b.kind&&(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:b.kind})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:g[b.rel]??b.rel}),(0,d.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:[function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("recentKb.justNow");let d=Math.floor(c/6e4);if(d<1)return b("recentKb.justNow");if(d<60)return b("recentKb.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("recentKb.hoursAgo",{count:e}):b("recentKb.daysAgo",{count:Math.floor(e/24)})}(b.modifiedAt,c)," \xb7 ",(0,d.jsx)("span",{className:"font-mono",children:b.rel})]})]})]})},b.rel))]})]})}z.callServer,z.findSourceMapURL;var B=c(87671),C=c(42557);let D=(0,C.A)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var E=c(69552),F=c(62481),G=c(73569),H=c(32826);function I({rootId:a,cache:b}){let c=(0,f.c)("roots"),[j,k]=(0,e.useState)(b),[l,m]=(0,e.useTransition)(),o=(0,B.useRouter)(),r=j&&Date.now()-Date.parse(j.generatedAt)>864e5;return(0,d.jsxs)(q.Zp,{className:"lg:col-span-2",children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(D,{className:"h-4 w-4 text-amber-500"}),c("aiSuggestions.title"),r&&(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:c("aiSuggestions.stale")})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{m(async()=>{try{let b=await fetch(`/api/roots/${a}/suggestions`,{method:"POST",cache:"no-store"}),d=await b.json();if(!d.ok)return void h.oR.error(d.error??c("aiSuggestions.regenerateFailed"));d.cache&&k(d.cache)}catch(a){h.oR.error(a instanceof Error?a.message:String(a))}})},disabled:l,className:"gap-1 h-7 text-xs",children:[l?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(g.A,{className:"h-3 w-3"}),c("aiSuggestions.recompute")]})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[!j&&!l&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("aiSuggestions.intro")}),j&&0===j.items.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("aiSuggestions.nothingUrgent")}),(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:j?.items.map((b,c)=>(0,d.jsxs)("div",{className:"rounded-md border bg-card p-3 space-y-1.5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(E.A,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),(0,d.jsx)("p",{className:"text-sm font-medium leading-snug flex-1",children:b.title})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:b.why}),(0,d.jsx)(J,{rootId:a,item:b,router:o})]},c))}),j&&(0,d.jsx)("p",{className:"text-[10px] text-muted-foreground pt-1",children:c.rich("aiSuggestions.generatedAt",{time:function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("aiSuggestions.justNow");let d=Math.floor(c/6e4);if(d<1)return b("aiSuggestions.justNow");if(d<60)return b("aiSuggestions.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("aiSuggestions.hoursAgo",{count:e}):b("aiSuggestions.daysAgo",{count:Math.floor(e/24)})}(j.generatedAt,c),model:j.model,code:a=>(0,d.jsx)("code",{className:"font-mono",children:a})})})]})]})}function J({rootId:a,item:b,router:c}){let[g,k]=(0,e.useTransition)(),m=(0,f.c)("roots"),{action:o}=b;if("none"===o.kind)return null;if("open-topic"===o.kind&&o.target)return(0,d.jsx)(i.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,d.jsxs)(l(),{href:`/roots/${a}/chat/${o.target}`,children:[(0,d.jsx)(F.A,{className:"h-3 w-3"}),o.label]})});if("open-kb"===o.kind&&o.target){let b=o.target.split("/").map(encodeURIComponent).join("/");return(0,d.jsx)(i.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,d.jsxs)(l(),{href:`/roots/${a}/kb/${b}`,children:[(0,d.jsx)(F.A,{className:"h-3 w-3"}),o.label]})})}return"send-message"===o.kind&&o.target?(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>{k(async()=>{try{let b=await (0,H.g)(a,o.target,[],void 0);if(!b.ok)return void h.oR.error(b.error??m("aiSuggestions.sendFailed"));(0,j.$d)(j.Zi.topicsChanged(a)),c.push(`/roots/${a}/chat/${b.topicId}`)}catch(a){h.oR.error(a instanceof Error?a.message:String(a))}})},disabled:g,children:[g?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(G.A,{className:"h-3 w-3"}),o.label]}):null}var K=c(97162),L=c(34719),M=c(56189),N=c(12619),O=c(66979);let P=(0,z.createServerReference)("40ee0634b95dcfa16f971b953fd77aa95947a244f3",z.callServer,void 0,z.findSourceMapURL,"listSuggestionsAction"),Q=(0,z.createServerReference)("40997f0ef7dc788f375f4b38dada832f306ece631d",z.callServer,void 0,z.findSourceMapURL,"approveSuggestionAction"),R=(0,z.createServerReference)("4028e6693b419eee8c484484e5a8e5bc19f50f8eee",z.callServer,void 0,z.findSourceMapURL,"rejectSuggestionAction");var S=c(91344);let T={utility:K.A,research:L.A,widget:M.A,goal:m.A,skill:E.A},U={utility:"text-emerald-600",research:"text-violet-600",widget:"text-blue-600",goal:"text-amber-600",skill:"text-pink-600"};function V({rootId:a}){let b=(0,B.useRouter)(),[c,f]=(0,e.useState)([]),[j,k]=(0,e.useState)(!0),[l,m]=(0,e.useState)({}),[o,r]=(0,e.useTransition)(),s=(0,e.useCallback)(async()=>{let b=await P(a);k(!1),b.ok&&f(b.items)},[a]);return j||0===c.length?null:(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)(q.ZB,{className:"text-lg flex items-center gap-2",children:[(0,d.jsx)(D,{className:"h-4 w-4 text-amber-500"}),"Suggestions",(0,d.jsx)(p.E,{variant:"secondary",className:"ml-1",children:c.length})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>r(()=>s()),disabled:o,className:"h-7 gap-1",children:[(0,d.jsx)(g.A,{className:(0,S.cn)("h-3 w-3",o&&"animate-spin")}),"Refresh"]})]}),(0,d.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,d.jsx)(q.Wu,{className:"space-y-2",children:c.map(c=>{let e=T[c.kind]??D,g=l[c.id];return(0,d.jsxs)("div",{className:"flex items-start gap-3 rounded-md border p-3",children:[(0,d.jsx)(e,{className:(0,S.cn)("h-4 w-4 mt-1 shrink-0",U[c.kind])}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"font-medium text-sm",children:c.title}),(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:c.kind})]}),c.description&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1 leading-snug",children:c.description}),c.prompt&&(0,d.jsx)("code",{className:"block mt-1 text-[10px] font-mono text-muted-foreground/70 truncate",children:c.prompt})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"default",disabled:!!g,onClick:()=>{m(a=>({...a,[c.id]:"approve"})),(async()=>{let d=await Q({rootId:a,suggestionId:c.id});if(m(a=>({...a,[c.id]:null})),!d.ok)return h.oR.error(d.error??"Failed to start topic");h.oR.success(`Started: ${c.title}`),f(a=>a.filter(a=>a.id!==c.id)),b.push(`/roots/${a}/chat/${d.topicId}`)})()},className:"h-8 gap-1",children:["approve"===g?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(N.A,{className:"h-3 w-3"}),"Approve"]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",disabled:!!g,onClick:()=>{m(a=>({...a,[c.id]:"reject"})),(async()=>{let b=await R({rootId:a,suggestionId:c.id});if(m(a=>({...a,[c.id]:null})),!b.ok)return h.oR.error(b.error??"Failed to reject");h.oR.success(`Dismissed: ${c.title}`),f(a=>a.filter(a=>a.id!==c.id))})()},className:"h-8 gap-1 text-muted-foreground hover:text-destructive",children:["reject"===g?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(O.A,{className:"h-3 w-3"}),"Dismiss"]})]})]},c.id)})})]})}var W=c(14566);let X=(0,C.A)("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);var Y=c(30515);let Z=(0,z.createServerReference)("605bce6936d33283ca712f40b0c63890178a19c29a",z.callServer,void 0,z.findSourceMapURL,"saveWidgetOrderAction"),$=(0,z.createServerReference)("60edceb1dd132d1cb24fe649bef82742a1409b5968",z.callServer,void 0,z.findSourceMapURL,"hideWidgetAction"),_={sm:2,md:3,wide:6},aa=["sys:active-goals","sys:pending","sys:recent-kb","sys:ai-suggestions"],ab=[{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."}],ac=(0,z.createServerReference)("709c188d297b8301c4b2e6901fa5867d927e381d22",z.callServer,void 0,z.findSourceMapURL,"setWidgetSizeAction"),ad=[{mode:"sm",label:"S",titleKey:"widgetsCommon.sizeSm"},{mode:"md",label:"M",titleKey:"widgetsCommon.sizeMd"},{mode:"wide",label:"W",titleKey:"widgetsCommon.sizeWide"}];function ae({rootId:a,widgetId:b,mode:c,onChanged:g}){let i=(0,f.c)("roots"),[j,k]=(0,e.useTransition)();return(0,d.jsx)("div",{role:"radiogroup","aria-label":i("widgetsCommon.sizeAria"),className:"inline-flex items-center rounded border bg-background/80 backdrop-blur overflow-hidden text-[10px] leading-none",children:ad.map(e=>{let f=e.mode===c,l="sm"===e.mode?i("widgetsCommon.sizeSm"):"md"===e.mode?i("widgetsCommon.sizeMd"):i("widgetsCommon.sizeWide");return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":f,"aria-label":l,title:l,onClick:()=>{var d;(d=e.mode)!==c&&k(async()=>{let c=await ac(a,b,d);if(!c.ok)return void h.oR.error(c.error??i("widgetsCommon.sizeFailed"));g()})},disabled:j,className:["px-1.5 py-0.5 font-mono transition-colors disabled:opacity-50",f?"bg-violet-600 text-white":"text-muted-foreground hover:bg-accent hover:text-foreground"].join(" "),children:e.label},e.mode)})})}function af(a){let b=_[a];return 2===b?"lg:col-span-2":3===b?"lg:col-span-3":"lg:col-span-6"}let ag=(0,C.A)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var ah=c(54874),ai=c(14425),aj=c(71155),ak=c(44509);let al=(0,z.createServerReference)("7831708867c79c93966e5412f8bdb70c6744a42125",z.callServer,void 0,z.findSourceMapURL,"patchWidgetDataAction"),am=(0,z.createServerReference)("70d67f33031dd5e502f94279dfc8a819f21cabf03f",z.callServer,void 0,z.findSourceMapURL,"setWidgetRefreshAction"),an=(0,z.createServerReference)("605440d7c93b603e6e1557d174c4952a32cc587b14",z.callServer,void 0,z.findSourceMapURL,"refreshWidgetNowAction");function ao({rootId:a,widget:b,mode:c,onHide:g,hiding:i,onLayoutChanged:j,dnd:k}){let m=(0,f.c)("roots"),[n,o]=(0,e.useTransition)(),r=k.dragging===b.id,s=k.dropTarget===b.id&&!r,t=af(c);return(0,d.jsxs)(q.Zp,{draggable:!0,onDragStart:a=>{a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b.id),k.onDragStart(b.id)},onDragOver:a=>{a.preventDefault(),a.dataTransfer.dropEffect="move",k.dropTarget!==b.id&&k.onDragOver(b.id)},onDrop:a=>{a.preventDefault(),k.onDrop(b.id)},onDragEnd:()=>k.onDragEnd(),className:[t,"transition-all",r?"opacity-50":"",s?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background":""].join(" "),children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-start gap-2 space-y-0",children:[(0,d.jsx)(ag,{className:"h-3.5 w-3.5 text-muted-foreground/60 cursor-grab active:cursor-grabbing mt-1 shrink-0","aria-label":m("widgetsCommon.dragHandle")}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"truncate",children:b.title}),(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono shrink-0",children:b.kind})]}),b.description&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5 line-clamp-2",children:b.description})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 -mt-0.5 shrink-0",children:[(0,d.jsx)(ae,{rootId:a,widgetId:b.id,mode:c,onChanged:j}),b.sourceTopicId&&(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.sourceTopicId}`,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground","aria-label":m("widgetsCommon.editViaTopicAria"),title:m("widgetsCommon.editViaTopicTitle"),children:(0,d.jsx)(ah.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{type:"button",onClick:()=>o(async()=>{await Promise.resolve(),g(b.id)}),disabled:n||i,"aria-label":m("widgetsCommon.hideAria"),title:m("widgetsCommon.hideTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:(0,d.jsx)(O.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)(q.Wu,{className:"space-y-3",children:[(0,ak.v)(a,b.kind,b.data,{onPatch:async c=>{let d=await al(a,b.id,c);if(!d.ok)throw h.oR.error(d.error??m("widgetsCommon.savePatchFailed")),Error(d.error??m("widgetsCommon.patchFailed"))}}),(0,d.jsx)(ap,{rootId:a,widget:b})]})]})}function ap({rootId:a,widget:b}){let c=(0,f.c)("roots"),[i,j]=(0,e.useTransition)(),[k,l]=(0,e.useTransition)(),m=b.refresh??"manual",n=b.lastRefreshAt??b.updatedAt;return b.sourceTopicId?(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t text-[11px] text-muted-foreground",children:[(0,d.jsx)(ai.A,{className:"h-3 w-3 shrink-0"}),(0,d.jsx)("span",{className:"shrink-0",children:c("widgetsCommon.updatedAt",{time:function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("widgetsCommon.justNow");let d=Math.floor(c/6e4);if(d<1)return b("widgetsCommon.justNow");if(d<60)return b("widgetsCommon.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("widgetsCommon.hoursAgo",{count:e}):b("widgetsCommon.daysAgo",{count:Math.floor(e/24)})}(n,c)})}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[(0,d.jsxs)(aj.l6,{value:m,onValueChange:d=>{l(async()=>{var e;let f=await am(a,b.id,d);f.ok?h.oR.success("manual"===d?c("widgetsCommon.autoRefreshOff"):c("widgetsCommon.cadenceSet",{cadence:(e=d,c("hourly"===e?"widgetsCommon.cadenceHourly":"daily"===e?"widgetsCommon.cadenceDaily":"weekly"===e?"widgetsCommon.cadenceWeekly":"widgetsCommon.cadenceManual"))})):h.oR.error(f.error??c("widgetsCommon.cadenceFailed"))})},disabled:k,children:[(0,d.jsx)(aj.bq,{className:"h-6 text-[10px] gap-1 px-1.5 w-auto min-w-[110px]",children:(0,d.jsx)(aj.yv,{})}),(0,d.jsxs)(aj.gC,{children:[(0,d.jsx)(aj.eb,{value:"manual",children:c("widgetsCommon.manual")}),(0,d.jsx)(aj.eb,{value:"hourly",children:c("widgetsCommon.hourly")}),(0,d.jsx)(aj.eb,{value:"daily",children:c("widgetsCommon.daily")}),(0,d.jsx)(aj.eb,{value:"weekly",children:c("widgetsCommon.weekly")})]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{j(async()=>{let d=await an(a,b.id);d.ok?h.oR.success(c("widgetsCommon.refreshStarted")):h.oR.error(d.error??c("widgetsCommon.refreshFailed"))})},disabled:i,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,d.jsx)(g.A,{className:`h-3 w-3 ${i?"animate-spin":""}`}),c("widgetsCommon.refreshLabel")]})]})]}):null}var aq=c(75482),ar=c(3442),as=c(97338),at=c(27456),au=c(89619);let av=(0,z.createServerReference)("60106cb482223e7533067dbee521cc9fe9f11ce822",z.callServer,void 0,z.findSourceMapURL,"deleteWidgetAction");function aw({rootId:a,open:b,onOpenChange:c,widgets:e,layout:g,onChanged:h}){let j=(0,f.c)("roots");if(!b)return null;let k=new Set(g.hidden);return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:a=>{a.target===a.currentTarget&&c(!1)},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>c(!1)}),(0,d.jsxs)("div",{className:"relative bg-card border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",children:[(0,d.jsx)(X,{className:"h-4 w-4 text-violet-600"}),(0,d.jsx)("h2",{className:"text-sm font-medium flex-1",children:j("widgetsCommon.libraryTitle")}),(0,d.jsx)(i.$,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>c(!1),children:(0,d.jsx)(O.A,{className:"h-4 w-4"})})]}),(0,d.jsx)(at.F,{className:"flex-1 min-h-0",children:(0,d.jsxs)("div",{className:"p-4 space-y-4",children:[(0,d.jsxs)("section",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:j("widgetsCommon.systemWidgetsHeading")}),ab.map(b=>(0,d.jsx)(ax,{rootId:a,id:b.id,title:b.title,description:b.description,badge:"system",badgeVariant:"default",hidden:k.has(b.id),canDelete:!1,onChanged:h},b.id))]}),(0,d.jsxs)("section",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:j("widgetsCommon.userWidgetsHeading",{count:e.length})}),0===e.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:j("widgetsCommon.noUserWidgets")}),e.map(b=>(0,d.jsx)(ax,{rootId:a,id:b.id,title:b.title,description:b.description??`kind: ${b.kind}`,badge:b.kind,badgeVariant:"outline",hidden:k.has(b.id),canDelete:!0,onChanged:h},b.id))]})]})})]})]})}function ax({rootId:a,id:b,title:c,description:g,badge:j,badgeVariant:k,hidden:l,canDelete:m,onChanged:n}){let o=(0,f.c)("roots"),[q,r]=(0,e.useTransition)();return(0,d.jsxs)("div",{className:"flex items-start gap-3 rounded-md border bg-card px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate",children:c}),(0,d.jsx)(p.E,{variant:k,className:"text-[10px] font-mono",children:j}),l&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:o("widgetsCommon.hidden")})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:g})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{r(async()=>{let c=l?await (0,au.t)(a,b):await $(a,b);if(!c.ok)return void h.oR.error(c.error);n()})},disabled:q,className:"gap-1 h-7 text-xs",children:l?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aq.A,{className:"h-3 w-3"}),o("widgetsCommon.show")]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ar.A,{className:"h-3 w-3"}),o("widgetsCommon.hide")]})}),m&&(0,d.jsx)(i.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>{confirm(o("widgetsCommon.deleteWidgetConfirm",{title:c}))&&r(async()=>{let c=await av(a,b);if(!c.ok)return void h.oR.error(c.error);n()})},disabled:q,className:"h-7 w-7 text-muted-foreground hover:text-destructive",title:o("widgetsCommon.deleteForever"),children:(0,d.jsx)(as.A,{className:"h-3.5 w-3.5"})})]})]})}function ay({rootId:a,widgets:b,layout:c,systemRenderers:g,snapshot:j,onLayoutChanged:k}){let l=(0,f.c)("roots"),m=(0,e.useMemo)(()=>{let a=new Map;for(let c of b)a.set(c.id,c);return a},[b]),[n,o]=(0,e.useState)(c.order),[p,q]=(0,e.useState)(c.hidden),[,r]=(0,e.useTransition)(),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1);aA(c.order,o),aA(c.hidden,q);let y=(0,e.useCallback)(b=>{o(b),r(async()=>{let c=await Z(a,b);c.ok?(o(c.layout.order),q(c.layout.hidden),k()):h.oR.error(c.error)})},[a,k]),z=(0,e.useCallback)(b=>{o(n.filter(a=>a!==b)),q(a=>[...new Set([b,...a])]),r(async()=>{let c=await $(a,b);if(!c.ok)return void h.oR.error(c.error);o(c.layout.order),q(c.layout.hidden),k()})},[a,n,k]),A={onDragStart:a=>t(a),onDragOver:a=>v(a),onDrop:a=>{if(t(null),v(null),!s||s===a)return;let b=[...n],c=b.indexOf(s),d=b.indexOf(a);c<0||d<0||(b.splice(c,1),b.splice(d,0,s),y(b))},onDragEnd:()=>{t(null),v(null)},dragging:s,dropTarget:u};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:l("widgetsCommon.projectWidgetsTitle")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("widgetsCommon.projectWidgetsHint")})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"outline",onClick:()=>x(!0),className:"gap-1 h-8",children:[(0,d.jsx)(X,{className:"h-3.5 w-3.5"}),l("widgetsCommon.library",{count:p.length})]})]}),0===n.length&&(0,d.jsxs)("div",{className:"rounded-md border border-dashed bg-muted/20 p-6 text-center space-y-2",children:[(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:l.rich("widgetsCommon.emptyDashboard",{example:()=>(0,d.jsx)("em",{children:l("widgetsCommon.emptyDashboardExample")})})}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>x(!0),className:"gap-1",children:[(0,d.jsx)(Y.A,{className:"h-3 w-3"}),l("widgetsCommon.restoreSystem")]})]}),(0,d.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-6 gap-4",children:n.map(b=>{var e;let f=m.get(b),h=c.sizes?.[b]??(e=f?.size,e?.mode?e.mode:e?.cols===1?"sm":e?.cols===2?"md":e?.cols===3?"wide":"md");return aa.includes(b)?(0,d.jsx)(az,{rootId:a,id:b,node:g[b],onHide:z,dnd:A,mode:h,onLayoutChanged:k},b):f?(0,d.jsx)(ao,{rootId:a,widget:f,mode:h,onHide:z,hiding:!1,dnd:A,onLayoutChanged:k},b):null})}),(0,d.jsx)(aw,{open:w,onOpenChange:x,rootId:a,widgets:b,layout:{order:n,hidden:p},onChanged:()=>{k()}})]})}function az({rootId:a,id:b,node:c,onHide:e,dnd:g,mode:h,onLayoutChanged:i}){let j=(0,f.c)("roots"),k=g.dragging===b,l=g.dropTarget===b&&!k,m=af(h);return(0,d.jsxs)("div",{draggable:!0,onDragStart:a=>{a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b),g.onDragStart(b)},onDragOver:a=>{a.preventDefault(),a.dataTransfer.dropEffect="move",g.dropTarget!==b&&g.onDragOver(b)},onDrop:a=>{a.preventDefault(),g.onDrop(b)},onDragEnd:()=>g.onDragEnd(),className:[m,"relative group/sys transition-all",k?"opacity-50":"",l?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background rounded-lg":""].join(" "),children:[c,(0,d.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,d.jsx)(ae,{rootId:a,widgetId:b,mode:h,onChanged:i}),(0,d.jsx)("button",{type:"button",onClick:()=>e(b),"aria-label":j("widgetsCommon.hideAria"),title:j("widgetsCommon.hideSystemTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:"\xd7"})]})]})}function aA(a,b){(0,e.useMemo)(()=>{b(a)},[JSON.stringify(a)])}function aB({rootId:a,initialSnapshot:b}){let c=(0,f.c)("roots"),[k,l]=(0,e.useState)(b),[m,n]=(0,e.useTransition)(),o=(0,e.useCallback)(()=>{n(async()=>{try{let b=await fetch(`/api/roots/${a}/dashboard`,{cache:"no-store"}),d=await b.json();if(!d.ok||!d.snapshot)return void h.oR.error(d.error??c("dashboard.refreshFailed"));l(d.snapshot)}catch(a){h.oR.error(a instanceof Error?a.message:String(a))}})},[a,c]);(0,j.S9)(j.Zi.topicsChanged(a),o),(0,j.S9)(j.Zi.kbChanged(a),o);let p={"sys:active-goals":(0,d.jsx)(r,{rootId:a,activeGoals:k.activeGoals,runningAgents:k.runningAgents}),"sys:pending":(0,d.jsx)(w,{rootId:a,items:k.pendingApprovals}),"sys:recent-kb":(0,d.jsx)(A,{rootId:a,items:k.recentKb}),"sys:ai-suggestions":(0,d.jsx)(I,{rootId:a,cache:k.suggestions})};return(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,d.jsxs)("div",{className:"p-6 space-y-5 max-w-6xl mx-auto",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:c("dashboard.projectOverview")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("dashboard.projectOverviewHint")})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:o,disabled:m,className:"gap-1 h-8",children:[(0,d.jsx)(g.A,{className:`h-3.5 w-3.5 ${m?"animate-spin":""}`}),c("dashboard.refresh")]})]}),(0,d.jsx)(V,{rootId:a}),(0,d.jsx)(ay,{rootId:a,widgets:k.widgets,layout:k.layout,systemRenderers:p,snapshot:k,onLayoutChanged:o}),(0,d.jsx)(W.p,{scope:"project",rootId:a,title:c("dashboard.memoryTitle"),description:c("dashboard.memoryHint")})]})})}},13864:(a,b,c)=>{"use strict";c.d(b,{RunInitButton:()=>m});var d=c(64173),e=c(17240),f=c(62261),g=c(52869),h=c(44052),i=c(20583),j=c(3265);let k=(0,j.createServerReference)("70d2736fbdb79ddc02efe04667237b0fa0242c4dbb",j.callServer,void 0,j.findSourceMapURL,"runInitAction");var l=c(88724);function m({rootPath:a,rootId:b}){let[c,j]=(0,e.useTransition)();return(0,d.jsx)(i.$,{onClick:()=>j(async()=>{let c=h.oR.loading("Running agent — this can take a minute or two…"),d=await k(a,b,!1);h.oR.dismiss(c),d.ok?(h.oR.success("Init complete"),(0,l.$d)(l.Zi.kbChanged(b)),(0,l.$d)(l.Zi.rootsChanged)):h.oR.error(d.error??"Init failed")}),disabled:c,children:c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"})," Running…"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{className:"mr-2 h-4 w-4"})," Run init"]})})}},14566:(a,b,c)=>{"use strict";c.d(b,{p:()=>s});var d=c(64173),e=c(17240),f=c(44052),g=c(62261),h=c(74868),i=c(13530),j=c(97338),k=c(20583),l=c(31041),m=c(45477),n=c(91344),o=c(3265);let p=(0,o.createServerReference)("40af933609085fb06ae25c7ce714fdcb6a7412eeac",o.callServer,void 0,o.findSourceMapURL,"loadMemoryAction"),q=(0,o.createServerReference)("404d14bf8050849c571d5245fae484379dbc1749d3",o.callServer,void 0,o.findSourceMapURL,"saveMemoryFileAction"),r=(0,o.createServerReference)("40ddd93498dfe7c5e2278c0522b98f20b2ab653411",o.callServer,void 0,o.findSourceMapURL,"wipeMemoryAction");function s({scope:a,rootId:b,title:c,description:f,allowWipe:i}){let[j,k]=(0,e.useState)([]),[m,n]=(0,e.useState)(!0),[o,q]=(0,e.useState)(null),r=(0,e.useCallback)(async()=>{n(!0);let c=await p(b?{scope:a,rootId:b}:{scope:a});if(n(!1),!c.ok)return void q(c.error);q(null),k(c.files)},[a,b]);return(0,d.jsxs)(l.Zp,{children:[(0,d.jsx)(l.aR,{children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(l.ZB,{className:"text-lg",children:c}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:f})]}),i&&j.length>0&&(0,d.jsx)(u,{scope:a,rootId:b,onWiped:r})]})}),(0,d.jsx)(l.Wu,{children:m?(0,d.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,d.jsx)(g.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):o?(0,d.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"}),o]}):(0,d.jsx)("div",{className:"space-y-4",children:j.map(c=>(0,d.jsx)(t,{snapshot:c,scope:a,rootId:b,onSaved:a=>k(b=>b.map(b=>b.file===a.file?a:b))},c.file))})})]})}function t({snapshot:a,scope:b,rootId:c,onSaved:h}){let[j,l]=(0,e.useState)(a.content),[o,p]=(0,e.useTransition)(),r=j.trim(),s=r?r.split("\n").length:0,t=s>a.cap,u=s>.9*a.cap,v=j!==a.content;return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"font-mono text-sm font-semibold",children:a.file}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:a.description})]}),(0,d.jsxs)("span",{className:(0,n.cn)("text-xs tabular-nums",t?"text-destructive font-medium":u?"text-amber-600":"text-muted-foreground"),children:[s,"/",a.cap]})]}),(0,d.jsx)(m.T,{value:j,onChange:a=>l(a.target.value),rows:Math.min(a.cap+2,Math.max(3,s+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,d.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,d.jsxs)(k.$,{type:"button",size:"sm",variant:v?"default":"ghost",disabled:!v||o||t,onClick:()=>{if(t)return void f.oR.error(`${a.file} exceeds ${a.cap}-line cap (${s}). Trim before saving.`);p(async()=>{let d=await q({scope:b,...c?{rootId:c}:{},file:a.file,content:r});if(!d.ok)return void f.oR.error(d.error??"Save failed");f.oR.success(`Saved ${a.file}`),h({...a,content:r,lines:d.lines})})},children:[o?(0,d.jsx)(g.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,d.jsx)(i.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function u({scope:a,rootId:b,onWiped:c}){let[g,h]=(0,e.useTransition)();return(0,d.jsxs)(k.$,{type:"button",size:"sm",variant:"ghost",disabled:g,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&h(async()=>{let d=await r(b?{scope:a,rootId:b}:{scope:a});if(!d.ok)return void f.oR.error(d.error??"Wipe failed");f.oR.success("Memory wiped"),await c()})},className:"text-destructive hover:text-destructive",children:[(0,d.jsx)(j.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},16585:(a,b,c)=>{"use strict";c.d(b,{g:()=>e});var d=c(3265);let e=(0,d.createServerReference)("406aafc3792e9180d655459a777c12f36d462b9ad6",d.callServer,void 0,d.findSourceMapURL,"installCuratedAction")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19356:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"402d6961ba9a6dec98f86553ad9cee1b4b97ad8ab3":()=>f.summarizeYoutubeAction,"4050e35bd626ae46cf22515e4ae311f6f4eaeca4d2":()=>e.x,"406250594256b6f47d72096ce95bbe611f11f6f379":()=>f.AZ,"40635bb3e1c7fb24feba3fec5e8915d945013d9267":()=>f.Gh,"40872923f4a42fd0c484899abfa5693491405bfce2":()=>f.rD,"409e829df9d0913e30e1a6a1b0a865bc8075bbcc98":()=>f.O1,"60755c0b8c4fac075c0d679ccedbc7897f99a8a25d":()=>e.k});var e=c(49809),f=c(18746),g=a([e]);e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},20567:(a,b,c)=>{"use strict";c.d(b,{AU:()=>j,Z9:()=>i});var d=c(73024);c(76760);var e=c(56149),f=c(54287);let g=e.Ik({watchDebounceMs:e.ai().int().min(f.a,{message:`watchDebounceMs must be ≥ ${f.a} ms`}).default(f.VU),agentBackend:e.k5(["codex","claude-code"]).default("claude-code"),ignoreFile:e.Yj().default(".reflexignore")}),h=g.parse({});async function i(a){let b=(0,f.eQ)(a);try{let a=await d.promises.readFile(b,"utf8");return g.parse(JSON.parse(a))}catch(a){var c;if("object"==typeof(c=a)&&null!==c&&"code"in c&&"ENOENT"===c.code)return h;throw a}}async function j(a,b){await d.promises.mkdir((0,f.FF)(a),{recursive:!0}),await d.promises.writeFile((0,f.eQ)(a),JSON.stringify(b,null,2)+"\n","utf8")}},21820:a=>{"use strict";a.exports=require("os")},24761:(a,b,c)=>{"use strict";c.d(b,{B:()=>e});var d=c(3265);let e=(0,d.createServerReference)("009f671ab6acb5dd5e5dbff2845942b4ec3830e606",d.callServer,void 0,d.findSourceMapURL,"listCuratedAction")},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},28074:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{y:()=>l});var e=c(7206),f=c(73024),g=c(46726),h=c(78744),i=a([e]);e=(i.then?(await i)():i)[0];let k="claude",l={id:"claude-code",async analyzeScope(a){await j(),await f.promises.mkdir(a.reflexScope,{recursive:!0});let b=await (0,h.p)(a),c=["-p",b,"--permission-mode","acceptEdits","--allowedTools","Read,Write,Edit,LS,Glob,Grep","--add-dir",a.reflexScope];a.model&&c.push("--model",a.model),await (0,e.execa)(k,c,{cwd:a.root,stdio:"inherit"})},async chat(a){await j();let b=await (0,h.M)(a);await (0,e.execa)(k,["--append-system-prompt",b,"--add-dir",a.reflexScope],{cwd:a.scope,stdio:"inherit"})}};async function j(){try{await (0,e.execa)(k,["--version"],{stdio:"ignore"})}catch(a){throw new g.g("claude-code",a)}}d()}catch(a){d(a)}})},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29830:(a,b,c)=>{Promise.resolve().then(c.bind(c,86673)),Promise.resolve().then(c.bind(c,62109)),Promise.resolve().then(c.bind(c,16805)),Promise.resolve().then(c.bind(c,574)),Promise.resolve().then(c.bind(c,90558)),Promise.resolve().then(c.bind(c,64845)),Promise.resolve().then(c.bind(c,770)),Promise.resolve().then(c.bind(c,60524)),Promise.resolve().then(c.bind(c,50155)),Promise.resolve().then(c.bind(c,26922)),Promise.resolve().then(c.bind(c,79008)),Promise.resolve().then(c.bind(c,68146)),Promise.resolve().then(c.bind(c,60936)),Promise.resolve().then(c.bind(c,65138)),Promise.resolve().then(c.bind(c,68902)),Promise.resolve().then(c.bind(c,69644)),Promise.resolve().then(c.bind(c,49186)),Promise.resolve().then(c.bind(c,93099)),Promise.resolve().then(c.bind(c,83594)),Promise.resolve().then(c.bind(c,24375)),Promise.resolve().then(c.bind(c,67135)),Promise.resolve().then(c.bind(c,85105)),Promise.resolve().then(c.bind(c,41886)),Promise.resolve().then(c.bind(c,33309)),Promise.resolve().then(c.bind(c,37550)),Promise.resolve().then(c.bind(c,96623)),Promise.resolve().then(c.bind(c,77372)),Promise.resolve().then(c.bind(c,65478)),Promise.resolve().then(c.bind(c,97230)),Promise.resolve().then(c.bind(c,73552)),Promise.resolve().then(c.bind(c,391)),Promise.resolve().then(c.bind(c,4235)),Promise.resolve().then(c.bind(c,41138)),Promise.resolve().then(c.bind(c,60877)),Promise.resolve().then(c.bind(c,7671)),Promise.resolve().then(c.bind(c,5637)),Promise.resolve().then(c.bind(c,36786)),Promise.resolve().then(c.t.bind(c,20594,23))},31041:(a,b,c)=>{"use strict";c.d(b,{BT:()=>i,Wu:()=>j,ZB:()=>h,Zp:()=>f,aR:()=>g,wL:()=>k});var d=c(64173);c(17240);var e=c(91344);function f({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card",className:(0,e.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",a),...b})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.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",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("leading-none font-semibold",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-description",className:(0,e.cn)("text-sm text-muted-foreground",a),...b})}function j({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-6",a),...b})}function k({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-footer",className:(0,e.cn)("flex items-center px-6 [.border-t]:pt-6",a),...b})}},31421:a=>{"use strict";a.exports=require("node:child_process")},33873:a=>{"use strict";a.exports=require("path")},35314:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{j:()=>h});var e=c(28074),f=c(48519),g=a([e,f]);[e,f]=g.then?(await g)():g;let i={"claude-code":e.y,codex:f.C};function h(a){let b=i[a.agentBackend];if(!b)throw Error(`Unknown agent backend: ${a.agentBackend}`);return b}d()}catch(a){d(a)}})},36306:a=>{"use strict";a.exports=import("@tailwindcss/node")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43449:(a,b,c)=>{"use strict";c.d(b,{AddUtilityButton:()=>y});var d=c(64173),e=c(17240),f=c(1056),g=c.n(f),h=c(87671),i=c(71813),j=c(97162);let k=(0,c(42557).A)("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);var l=c(66979),m=c(62261),n=c(65177),o=c(97338),p=c(12619),q=c(44171),r=c(44052),s=c(20583);c(24761);var t=c(3265);t.callServer,t.findSourceMapURL;let u=(0,t.createServerReference)("40ae46949272db465546e5cfa874fcac36a5153ba4",t.callServer,void 0,t.findSourceMapURL,"applyUtilityUpdateAction");var v=c(16585),w=c(92498),x=c(88724);function y({rootId:a,installed:b}){let c=(0,i.c)("roots"),[f,t]=(0,e.useState)(!1),[y,z]=(0,e.useState)([]),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useTransition)(),[G,H]=(0,e.useState)([]),I=(0,e.useRef)(null),J=(0,h.useRouter)(),K=new Set(b.map(a=>a.id)),L=b.filter(a=>"project"===a.scope),M=new Map(G.map(a=>[a.id,a]));return(0,d.jsxs)("div",{className:"relative",ref:I,children:[(0,d.jsxs)(s.$,{type:"button",variant:"ghost",size:"sm",className:"gap-1",onClick:()=>t(a=>!a),title:c("addUtility.buttonTitle"),children:[(0,d.jsx)(j.A,{className:"h-4 w-4"}),c("addUtility.buttonLabel"),L.length>0&&(0,d.jsx)("span",{className:"ml-1 text-[10px] rounded-full bg-violet-100 text-violet-700 px-1.5",children:L.length}),G.length>0&&(0,d.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:c("addUtility.updatesTitle",{count:G.length}),children:[(0,d.jsx)(k,{className:"h-2.5 w-2.5"}),G.length]})]}),f&&(0,d.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,d.jsxs)("div",{className:"sticky top-0 bg-popover flex items-center gap-2 px-3 py-2 border-b",children:[(0,d.jsx)(j.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,d.jsx)("span",{className:"text-xs font-medium",children:c("addUtility.popoverTitle")}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!1),className:"ml-auto p-0.5 rounded hover:bg-accent",children:(0,d.jsx)(l.A,{className:"h-3 w-3"})})]}),L.length>0&&(0,d.jsxs)("section",{className:"p-2 border-b",children:[(0,d.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:c("addUtility.installedInProject")}),(0,d.jsx)("ul",{className:"space-y-1",children:L.map(b=>{let e=M.get(b.id);return(0,d.jsxs)("li",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2 py-1.5 text-xs",children:[(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"truncate font-medium",children:b.name}),e&&(0,d.jsxs)("div",{className:"text-[10px] text-amber-700 inline-flex items-center gap-0.5",children:[(0,d.jsx)(k,{className:"h-2.5 w-2.5"}),e.currentVersion," → ",e.latestVersion]})]}),e&&(0,d.jsxs)("button",{type:"button",onClick:()=>{D(e.id),F(async()=>{let b=await u({...e,rootId:a});if(D(null),!b.ok)return void r.oR.error(b.error);r.oR.success(c("addUtility.applyUpdateSuccess",{name:e.name,from:e.currentVersion,to:b.newVersion})),H(a=>a.filter(a=>a.id!==e.id)),(0,x.$d)(x.Zi.kbChanged(a)),J.refresh()})},disabled:E&&C===b.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:c("addUtility.applyUpdateTitle"),children:[E&&C===b.id?(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(k,{className:"h-3 w-3"}),c("addUtility.updateAction")]}),(0,d.jsx)(g(),{href:`/utilities/${b.scope}/${b.id}?rootId=${encodeURIComponent(a)}`,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:c("addUtility.openAction"),children:(0,d.jsx)(n.A,{className:"h-3 w-3"})}),(0,d.jsx)("button",{type:"button",onClick:()=>{confirm(c("addUtility.removeConfirm",{name:b.name}))&&(D(b.id),F(async()=>{let d=await (0,w.j)(b.scope,b.id,"project"===b.scope?a:void 0);if(D(null),!d.ok)return void r.oR.error(d.error??c("addUtility.removeFailed"));r.oR.success(c("addUtility.removeSuccess",{name:b.name})),(0,x.$d)(x.Zi.kbChanged(a)),J.refresh()}))},disabled:E&&C===b.id,className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-50",title:c("addUtility.removeAction"),children:E&&C===b.id?(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(o.A,{className:"h-3 w-3"})})]},b.id)})})]}),(0,d.jsxs)("section",{className:"p-2",children:[(0,d.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:c("addUtility.catalog")}),A?(0,d.jsxs)("div",{className:"px-2 py-4 text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}),c("addUtility.loading")]}):0===y.length?(0,d.jsx)("p",{className:"px-2 py-4 text-xs text-muted-foreground",children:c("addUtility.catalogEmpty")}):(0,d.jsx)("ul",{className:"space-y-1",children:y.map(b=>{let e=K.has(b.id),f=C===b.id&&E;return(0,d.jsx)("li",{className:"rounded-md border bg-card px-2 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"text-xl leading-none",children:b.emoji}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug",children:b.description})]}),e?(0,d.jsxs)("span",{className:"text-[10px] text-emerald-700 inline-flex items-center gap-0.5",children:[(0,d.jsx)(p.A,{className:"h-3 w-3"})," ",c("addUtility.already")]}):(0,d.jsxs)("button",{type:"button",onClick:()=>{D(b.id),F(async()=>{let d=b.suggestedScope??"global",e=await (0,v.g)({github:b.github,scope:d,..."project"===d?{rootId:a}:{}});if(D(null),!e.ok)return void r.oR.error(e.error);r.oR.success(c("addUtility.installSuccess",{name:b.name})),(0,x.$d)(x.Zi.kbChanged(a)),J.refresh()})},disabled:f||E,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:[f?(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(q.A,{className:"h-3 w-3"}),c("addUtility.add")]})]})},b.id)})})]})]})]})}},44171:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},46726:(a,b,c)=>{"use strict";c.d(b,{g:()=>d});class d extends Error{constructor(a,b){super(`Agent backend "${a}" is unavailable: ${b instanceof Error?b.message:String(b)}`),this.name="AgentUnavailableError"}}},47452:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(19963).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"}]])},48161:a=>{"use strict";a.exports=require("node:os")},48519:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{C:()=>l});var e=c(7206),f=c(73024),g=c(46726),h=c(78744),i=a([e]);e=(i.then?(await i)():i)[0];let k="codex",l={id:"codex",async analyzeScope(a){await j(),await f.promises.mkdir(a.reflexScope,{recursive:!0});let b=await (0,h.p)(a),c=["exec","--cd",a.root,"--sandbox","workspace-write","--add-dir",a.reflexScope];a.model&&c.push("--model",a.model),c.push(b),await (0,e.execa)(k,c,{stdio:"inherit"})},async chat(a){await j();let b=await (0,h.M)(a);await (0,e.execa)(k,["--system",b],{cwd:a.scope,stdio:"inherit"})}};async function j(){try{await (0,e.execa)(k,["--version"],{stdio:"ignore"})}catch(a){throw new g.g("codex",a)}}d()}catch(a){d(a)}})},49809:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k:()=>v,x:()=>t});var e=c(31776);c(428);var f=c(73024),g=c(76760),h=c.n(g),i=c(24576),j=c(11178),k=c(56843),l=c(16909),m=c(24139),n=c(1701),o=c(52129),p=c(7188),q=c(11244),r=c(97364),s=a([l,o]);async function t(a){try{let b=await (0,i.Zn)(a);if(!b)return{ok:!1,error:"Root not found"};let[c,d,e,f]=await Promise.all([(0,k.hk)(b.path),(0,j.CA)(b.path),(0,p.listWidgets)(b.path),(0,p.readLayout)(b.path)]),g=(0,p.reconcileLayout)(f,e.map(a=>a.id),q.SYSTEM_WIDGET_IDS);(g.order.join("|")!==f.order.join("|")||g.hidden.join("|")!==f.hidden.join("|")||JSON.stringify(g.sizes??{})!==JSON.stringify(f.sizes??{}))&&await (0,p.writeLayout)(b.path,g);let h=c.map(a=>a.meta.id),r=new Set("function"==typeof l.z.listRunningTopicsForRoot?l.z.listRunningTopicsForRoot(a):[]),[s,t,v]=await Promise.all([(0,m.Z)(b.path,h),(0,n.Mn)(),(0,o.Qv)(a).catch(()=>null)]),w=new Set(s.map(a=>a.requestId));for(let a of t)!w.has(a.requestId)&&h.includes(a.topicId)&&s.push({kind:"mcp-add",topicId:a.topicId,requestId:a.requestId,ts:a.createdAt,summary:`MCP add: ${a.directive.label}`,...a.directive.description?{details:a.directive.description}:{}});s.sort((a,b)=>a.ts<b.ts?1:-1);let x=new Map;for(let a of c)x.set(a.meta.id,a.meta);let y=[],z=[];for(let a of c){let b=a.meta;if(b.goal&&"active"===b.goalStatus){y.push({topicId:b.id,topicTitle:b.title,goal:b.goal,goalIterations:b.goalIterations??0,updatedAt:b.updatedAt,running:r.has(b.id)});continue}r.has(b.id)&&z.push({topicId:b.id,topicTitle:b.title,updatedAt:b.updatedAt})}y.sort((a,b)=>a.updatedAt<b.updatedAt?1:-1),z.sort((a,b)=>a.updatedAt<b.updatedAt?1:-1);let A=await u(d);return{ok:!0,snapshot:{rootId:a,rootPath:b.path,activeGoals:y,runningAgents:z,pendingApprovals:s,recentKb:A,suggestions:v,widgets:e,layout:g}}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function u(a){let b=Date.now()-2592e5,c=a.filter(a=>Date.parse(a.modifiedAt)>=b).sort((a,b)=>a.modifiedAt<b.modifiedAt?1:-1).slice(0,6);return Promise.all(c.map(async a=>{let b=await (0,j.xO)(a.abs);return{rel:a.rel,title:b.title??h().basename(a.rel),...b.kind?{kind:b.kind}:{},modifiedAt:a.modifiedAt,preview:""}}))}async function v(a,b){try{let c=await (0,i.Zn)(a);if(!c)return{ok:!1,error:"Root not found"};let d=h().join(c.path,".reflex",b),e=h().relative(h().join(c.path,".reflex"),d);if(e.startsWith("..")||h().isAbsolute(e))return{ok:!1,error:"Refused (path traversal)"};let g=await f.promises.readFile(d,"utf8");return{ok:!0,preview:function(a){let b=a,c=a.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return c&&(b=a.slice(c[0].length)),(b=b.replace(/^#+\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\r?\n+/g," ").trim()).length>200&&(b=b.slice(0,197).trimEnd()+"…"),b}(g)}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}[l,o]=s.then?(await s)():s,(0,r.D)([t,v]),(0,e.A)(t,"4050e35bd626ae46cf22515e4ae311f6f4eaeca4d2",null),(0,e.A)(v,"60755c0b8c4fac075c0d679ccedbc7897f99a8a25d",null),d()}catch(a){d(a)}})},50108:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{E:()=>m});var e=c(73024),f=c(76760),g=c.n(f),h=c(20567),i=c(35314),j=c(79734),k=c(54287),l=a([i]);async function m(a,b={}){let c=g().resolve(a);await n(c),await e.promises.mkdir((0,k.FF)(c),{recursive:!0});let d=await (0,h.Z9)(c);if(await (0,h.AU)(c,d),await (0,j.D)(c),b.scaffoldOnly)return void process.stdout.write(`Reflex scaffolded at ${(0,k.FF)(c)} (scaffold-only).
2
10
  `);let f=b.harness?{...d,agentBackend:b.harness}:d,l=await (0,j.z)({root:c,scope:c}),o={...l,...b.model?{model:b.model}:{},...b.language?{language:b.language}:{}};process.stdout.write(`Running ${f.agentBackend}${b.model?` (${b.model})`:""}${b.language?` [lang=${b.language}]`:""} over ${c} (${l.files.length} files visible)…
3
11
  `);let p=(0,i.j)(f);await p.analyzeScope(o),process.stdout.write(`Done. KB written under ${(0,k.FF)(c)}
4
- `)}async function n(a){let b=await e.promises.stat(a).catch(()=>null);if(!b||!b.isDirectory())throw Error(`Not a directory: ${a}`)}i=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},51333:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(19963).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"}]])},51455:a=>{"use strict";a.exports=require("node:fs/promises")},52129:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Qt:()=>t,Qv:()=>r});var e=c(73024),f=c(76760),g=c.n(f),h=c(29163),i=c(11178),j=c(56843),k=c(16909),l=c(24139),m=c(99048),n=c(17640),o=c(24576),p=a([k,m]);function q(a){let b=a.replace(/[^A-Za-z0-9_.-]/g,"_");return g().join((0,h._)(),"roots",b,"suggestions.json")}async function r(a){try{let b=await e.promises.readFile(q(a),"utf8"),c=JSON.parse(b);if(c.rootId!==a||!Array.isArray(c.items))return null;return c}catch{return null}}async function s(a){let b=q(a.rootId);await e.promises.mkdir(g().dirname(b),{recursive:!0}),await e.promises.writeFile(b,JSON.stringify(a,null,2)+"\n",{encoding:"utf8",mode:384});try{await e.promises.chmod(b,384)}catch{}}async function t(a){var b;let c=await (0,o.Zn)(a);if(!c)return{ok:!1,error:"Root not found"};let d=(await (0,n.M)()).assignments.quick,e=await u(a,c.path);if(e.empty){let b={rootId:a,generatedAt:new Date().toISOString(),model:"n/a",items:[{title:"Project is empty",why:"No topics, no KB files — nothing to suggest. Start with /chat or create your first entry.",action:{kind:"none",label:"OK"}}]};return await s(b),{ok:!0,cache:b}}let f=(b=e,['You analyse the state of a local Reflex knowledge-base project and propose 2–4 high-leverage actions for the user.\nOutput STRICT JSON: an object with one key `items`, value array of {title, why, action}.\naction.kind ∈ {"open-topic", "open-kb", "send-message", "none"}.\n - open-topic: target = topic id from the snapshot\n - open-kb: target = rel-path from the snapshot (.reflex/-relative)\n - send-message: target = the literal text Reflex should send. topicId = which topic to send into (use an existing id from the snapshot or omit for new chat).\n - none: informational only\nEach action.label is the button text (3-6 words, Russian or English to match the project\'s vibe).\nEach `title` is 4-9 words; each `why` is one sentence explaining the trigger.\nSkip trivialities. Don\'t propose chores that don\'t move the project forward.\nReply in Russian unless titles/paths are obviously English.\n\n## Snapshot',JSON.stringify(b,null,2),"\nReturn only the JSON object — no preamble, no markdown fences, no comments. The reply MUST start with `{` and end with `}`."].join("\n"));try{let b=await (0,m.T)(d,f,{timeoutMs:45e3}),c=function(a){let b=a.trim();b.startsWith("```")&&(b=b.replace(/^```[a-z]*\r?\n/i,"").replace(/```\s*$/i,""));let c=b.indexOf("{"),d=b.lastIndexOf("}");c>=0&&d>c&&(b=b.slice(c,d+1));let e=JSON.parse(b);if(!e||"object"!=typeof e||!Array.isArray(e.items))throw Error("Model returned non-JSON or missing items[]");let f=[];for(let a of e.items){if(!a||"object"!=typeof a)continue;let b="string"==typeof a.title?a.title:null,c="string"==typeof a.why?a.why:null,d=a.action&&"object"==typeof a.action?a.action:null;if(!b||!c||!d)continue;let e=d.kind;if("open-topic"!==e&&"open-kb"!==e&&"send-message"!==e&&"none"!==e)continue;let g="string"==typeof d.label?d.label:"Open";f.push({title:b,why:c,action:{kind:e,label:g,..."string"==typeof d.target?{target:d.target}:{},..."string"==typeof d.topicId?{topicId:d.topicId}:{}}})}return f}(b),e={rootId:a,generatedAt:new Date().toISOString(),model:`${d.harness}:${d.model}`,items:c.slice(0,5)};return await s(e),{ok:!0,cache:e}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function u(a,b){let[c,d]=await Promise.all([(0,j.hk)(b),(0,i.dj)(b)]),e=c.map(a=>a.meta.id),f=new Set("function"==typeof k.z.listRunningTopicsForRoot?k.z.listRunningTopicsForRoot(a):[]),g=await (0,l.Z)(b,e),h=Date.now()-432e6,m=c.filter(a=>Date.parse(a.meta.updatedAt)<h).filter(a=>a.meta.goal&&"active"===a.meta.goalStatus).map(a=>({id:a.meta.id,title:a.meta.title,updatedAt:a.meta.updatedAt}));return{empty:0===c.length&&0===d.length,topicCount:c.length,topicsWithGoal:c.filter(a=>a.meta.goal&&"active"===a.meta.goalStatus).map(a=>({id:a.meta.id,title:a.meta.title,goal:a.meta.goal,iterations:a.meta.goalIterations??0,updatedAt:a.meta.updatedAt,running:f.has(a.meta.id)})),runningTopics:c.filter(a=>f.has(a.meta.id)).map(a=>({id:a.meta.id,title:a.meta.title})),recentKb:d.slice().sort((a,b)=>a.modifiedAt<b.modifiedAt?1:-1).slice(0,8).map(a=>({rel:a.rel,title:a.meta.title??a.rel,modifiedAt:a.modifiedAt})),pendingCount:g.length,totalKbFiles:d.length,staleTopics:m}}[k,m]=p.then?(await p)():p,d()}catch(a){d(a)}})},52869:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},57075:a=>{"use strict";a.exports=require("node:stream")},58550:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{default:()=>B});var e=c(63003),f=c(20594),g=c.n(f),h=c(9310),i=c(17596),j=c(88842),k=c(47452),l=c(51333),m=c(50895),n=c(84913),o=c(67248),p=c(60524),q=c(24576),r=c(11178),s=c(49809),t=c(61105),u=c(64845),v=c(770),w=c(90558),x=c(16805),y=c(86673),z=c(574),A=a([s]);async function B({params:a}){let{id:b}=await a,c=await (0,q.Zn)(b);c||(0,h.notFound)();let d=await (0,m.A)("roots"),[f,A,B]=await Promise.all([(0,r.RP)(c.path),(0,s.x)(b),(0,t.dH)({rootId:b})]),C=A.ok?A.snapshot:void 0,D=B.map(a=>({id:a.manifest.id,name:a.manifest.name,scope:a.scope}));return(0,e.jsxs)("main",{className:"flex-1 flex flex-col min-h-0",children:[(0,e.jsxs)("header",{className:"border-b px-6 py-4 flex items-center gap-4",children:[(0,e.jsx)(n.$,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-3",children:(0,e.jsxs)(g(),{href:"/",children:[(0,e.jsx)(i.A,{className:"mr-1 h-4 w-4"})," Roots"]})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(j.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsx)("h1",{className:"text-base font-medium truncate",children:c.path})]}),(0,e.jsx)("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground",children:f.exists?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(o.E,{variant:"secondary",children:[f.fileCount," MD files"]}),c.lastInitAt?(0,e.jsxs)("span",{children:["Last init ",new Date(c.lastInitAt).toLocaleString()]}):(0,e.jsx)("span",{children:"No init recorded"})]}):(0,e.jsx)(o.E,{variant:"outline",children:".reflex/ not yet created"})})]}),(0,e.jsx)(z.AddUtilityButton,{rootId:c.id,installed:D}),(0,e.jsx)(n.$,{asChild:!0,variant:"ghost",size:"sm",className:"gap-1",children:(0,e.jsxs)(g(),{href:`/roots/${c.id}/workflows`,children:[(0,e.jsx)(k.A,{className:"h-4 w-4"}),"Workflows"]})}),(0,e.jsx)(y.InsertImageButton,{rootId:c.id}),(0,e.jsx)(x.ShareButton,{kind:"project",rootId:c.id,label:c.path.split("/").pop()||d("detail.projectFallbackLabel")}),(0,e.jsx)(v.RunInitButton,{rootPath:c.path,rootId:c.id})]}),(0,e.jsx)(p.Separator,{}),C?(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,e.jsx)(u.Dashboard,{rootId:c.id,initialSnapshot:C}),(0,e.jsx)(w.CommandBar,{rootId:c.id})]}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground gap-3 p-10 text-center",children:[(0,e.jsx)(l.A,{className:"h-6 w-6"}),(0,e.jsxs)("p",{children:[d("detail.loadFailed"),A.ok?"":`: ${A.error??""}`,"."]}),(0,e.jsx)("p",{className:"text-xs",children:d.rich("detail.loadFailedHint",{b:a=>(0,e.jsx)("strong",{children:a})})})]}),(0,e.jsx)(w.CommandBar,{rootId:c.id})]})]})}s=(A.then?(await A)():A)[0],d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63351:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).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"}]])},64845:(a,b,c)=>{"use strict";c.d(b,{Dashboard:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call Dashboard() from the server but Dashboard is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/dashboard.tsx","Dashboard")},65631:(a,b,c)=>{"use strict";c.d(b,{B:()=>e});var d=c(3265);let e=(0,d.createServerReference)("001341fceb8414c4d7d121651eb8b9a28e21b3da33",d.callServer,void 0,d.findSourceMapURL,"listCuratedAction")},65686:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>E.a,__next_app__:()=>K,handler:()=>M,pages:()=>J,routeModule:()=>L,tree:()=>I});var d=c(61597),e=c(99210),f=c(1082),g=c(15003),h=c(36265),i=c(11817),j=c(45136),k=c(41809),l=c(55745),m=c(88963),n=c(69153),o=c(48343),p=c(15808),q=c(21238),r=c(2555),s=c(261),t=c(34370),u=c(89583),v=c(26713),w=c(53875),x=c(7952),y=c(54532),z=c(80269),A=c(17851),B=c(57865),C=c(86439),D=c(47319),E=c.n(D),F=c(1859),G=c(20498),H={};for(let a in F)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(H[a]=()=>F[a]);c.d(b,H);let I={children:["",{children:["roots",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,58550)),"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/page.tsx"]}]},{layout:[()=>Promise.resolve().then(c.bind(c,6993)),"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/layout.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(c.bind(c,79459)),"/home/runner/work/reflex-agent/reflex-agent/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,47319,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,82295,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,91570,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,72845,23)),"next/dist/client/components/builtin/unauthorized.js"]}]}.children,J=["/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/page.tsx"],K={require:c,loadChunk:()=>Promise.resolve()},L=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/roots/[id]/page",pathname:"/roots/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:I},distDir:".next",relativeProjectDir:""});async function M(a,b,d){var D;let H="/roots/[id]/page";"/index"===H&&(H="/");let N=(0,h.getRequestMeta)(a,"postponed"),O=(0,h.getRequestMeta)(a,"minimalMode"),P=await L.prepare(a,b,{srcPage:H,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,parsedUrl:T,pageIsDynamic:U,buildManifest:V,nextFontManifest:W,reactLoadableManifest:X,serverActionsManifest:Y,clientReferenceManifest:Z,subresourceIntegrityManifest:$,prerenderManifest:_,isDraftMode:aa,resolvedPathname:ab,revalidateOnlyGenerated:ac,routerServerContext:ad,nextConfig:ae,interceptionRoutePatterns:af}=P,ag=T.pathname||"/",ah=(0,s.normalizeAppPath)(H),{isOnDemandRevalidate:ai}=P,aj=L.match(ag,_),ak=!!_.routes[ab],al=!!(aj||ak||_.routes[ah]),am=a.headers["user-agent"]||"",an=(0,v.getBotType)(am),ao=(0,q.isHtmlBotRequest)(a),ap=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[u.NEXT_ROUTER_PREFETCH_HEADER],aq=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[u.RSC_HEADER]),ar=(0,t.getIsPossibleServerAction)(a),as=(0,m.checkIsAppPPREnabled)(ae.experimental.ppr)&&(null==(D=_.routes[ah]??_.dynamicRoutes[ah])?void 0:D.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?N:void 0,aw=as&&aq&&!ap,ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=!am||(0,q.shouldServeStreamingMetadata)(am,ae.htmlLimitedBots);ao&&as&&(al=!1,ay=!1);let az=!0===L.isDev||!al||"string"==typeof N||aw,aA=ao&&as,aB=null;aa||!al||az||ar||av||aw||(aB=ab);let aC=aB;!aC&&L.isDev&&(aC=ab),L.isDev||aa||!al||!aq||aw||(0,k.d)(a.headers);let aD={...F,tree:I,pages:J,GlobalError:E(),handler:M,routeModule:L,__next_app__:K};Y&&Z&&(0,p.setReferenceManifestsSingleton)({page:H,clientReferenceManifest:Z,serverActionsManifest:Y,serverModuleMap:(0,r.createServerModuleMap)({serverActionsManifest:Y})});let aE=a.method||"GET",aF=(0,g.getTracer)(),aG=aF.getActiveScopeSpan();try{let f=L.getVaryHeader(ab,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return L.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aF.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aE} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aE} ${a.url}`)})},m=async({span:e,postponed:f,fallbackRouteParams:g})=>{let i={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aD,Component:(0,j.T)(aD),params:S,routeModule:L,page:H,postponed:f,shouldWaitOnAllReady:aA,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||az,buildManifest:V,nextFontManifest:W,reactLoadableManifest:X,subresourceIntegrityManifest:$,serverActionsManifest:Y,clientReferenceManifest:Z,setIsrStatus:null==ad?void 0:ad.setIsrStatus,dir:c(33873).join(process.cwd(),L.relativeProjectDir),isDraftMode:aa,isRevalidate:al&&!f&&!aw,botType:an,isOnDemandRevalidate:ai,isPossibleServerAction:ar,assetPrefix:ae.assetPrefix,nextConfigOutput:ae.output,crossOrigin:ae.crossOrigin,trailingSlash:ae.trailingSlash,previewProps:_.preview,deploymentId:ae.deploymentId,enableTainting:ae.experimental.taint,htmlLimitedBots:ae.htmlLimitedBots,devtoolSegmentExplorer:ae.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:ae.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:ae.experimental.cacheLife,basePath:ae.basePath,serverActions:ae.experimental.serverActions,...at?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:at}:{},experimental:{isRoutePPREnabled:as,expireTime:ae.expireTime,staleTimes:ae.experimental.staleTimes,cacheComponents:!!ae.experimental.cacheComponents,clientSegmentCache:!!ae.experimental.clientSegmentCache,clientParamParsing:!!ae.experimental.clientParamParsing,dynamicOnHover:!!ae.experimental.dynamicOnHover,inlineCss:!!ae.experimental.inlineCss,authInterrupts:!!ae.experimental.authInterrupts,clientTraceMetadata:ae.experimental.clientTraceMetadata||[]},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>L.onRequestError(a,b,d,ad),err:(0,h.getRequestMeta)(a,"invokeError"),dev:L.isDev}},l=await k(e,i),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[z.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,al&&(null==n?void 0:n.revalidate)===0&&!L.isDev&&!as){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ab}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
5
- see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:w.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},n=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===L.isDev,l=c||b.writableEnded;if(ai&&ac&&!f&&!O)return(null==ad?void 0:ad.render404)?await ad.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(j=(0,x.parseFallbackField)(aj.fallback)),j===x.FallbackMode.PRERENDER&&(0,v.isBot)(am)&&(!as||ao)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(j!==x.FallbackMode.NOT_FOUND||f)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),!O&&j!==x.FallbackMode.BLOCKING_STATIC_RENDER&&aC&&!l&&!aa&&U&&(k||!ak)){let b;if((k||aj)&&j===x.FallbackMode.NOT_FOUND)throw new C.NoFallbackError;if(as&&!aq){let c="string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:k?ah:null;if(b=await L.handleResponse({cacheKey:c,req:a,nextConfig:ae,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:_,isRoutePPREnabled:as,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||au?(0,o.u)(ah):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let n=ai||g||!av?void 0:av;if(at&&void 0!==n)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:w.CachedRouteKind.PAGES,html:y.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=U&&as&&((0,h.getRequestMeta)(a,"renderFallbackShell")||au)?(0,o.u)(ag):null;return m({span:i,postponed:n,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,o=await L.handleResponse({cacheKey:aB,responseGenerator:a=>n({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ae,prerenderManifest:_,waitUntil:d.waitUntil});if(aa&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),L.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!o){if(aB)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=o.value)?void 0:f.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=o.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof o.value.postponed;al&&!aw&&(!p||ap)&&(O||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),b.setHeader(u.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=o;if(av)l={revalidate:0,expire:void 0};else if(O&&aq&&!ap&&as)l={revalidate:0,expire:void 0};else if(!L.isDev)if(aa)l={revalidate:0,expire:void 0};else if(al){if(o.cacheControl)if("number"==typeof o.cacheControl.revalidate){if(o.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${o.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:o.cacheControl.revalidate,expire:(null==(j=o.cacheControl)?void 0:j.expire)??ae.expireTime}}else l={revalidate:z.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(o.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===w.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[z.NEXT_CACHE_TAGS_HEADER];O&&al&&c&&"string"==typeof c&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(d,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.EMPTY,cacheControl:o.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...o,value:{...o.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&av)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(O&&al||delete a[z.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[z.NEXT_CACHE_TAGS_HEADER];if(O&&al&&s&&"string"==typeof s&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,s),!q.status||aq&&as||(b.statusCode=q.status),!O&&q.status&&G.RedirectStatusCode[q.status]&&aq&&(b.statusCode=200),p&&b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"1"),aq&&!aa){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:q.html,cacheControl:aw?{revalidate:0,expire:void 0}:o.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(q.rscData,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl})}let t=q.html;if(!p||O||aq)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:o.cacheControl});if(at)return t.push(new ReadableStream({start(a){a.enqueue(A.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}});let v=new TransformStream;return t.push(v.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(v.writable)}).catch(a=>{v.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}})};if(!aG)return await aF.withPropagatedContext(a.headers,()=>aF.trace(i.BaseServerSpan.handleRequest,{spanName:`${aE} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aE,"http.target":a.url}},p));await p(aG)}catch(b){throw b instanceof C.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:al,isOnDemandRevalidate:ai})},ad),b}}},71152:a=>{"use strict";a.exports=require("esbuild")},72744:(a,b,c)=>{"use strict";c.d(b,{g:()=>e});var d=c(3265);let e=(0,d.createServerReference)("40007e8588123e4a1c2446869c632dd3481c97ae79",d.callServer,void 0,d.findSourceMapURL,"installCuratedAction")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},74133:(a,b,c)=>{"use strict";c.d(b,{p:()=>s});var d=c(64173),e=c(17240),f=c(44052),g=c(62261),h=c(74868),i=c(13530),j=c(97338),k=c(20583),l=c(31041),m=c(45477),n=c(91344),o=c(3265);let p=(0,o.createServerReference)("40e63d7cb1fa792dc22a713385a884d2d0abce1731",o.callServer,void 0,o.findSourceMapURL,"loadMemoryAction"),q=(0,o.createServerReference)("403e983977877b307d9670a7f626b1e2455a363885",o.callServer,void 0,o.findSourceMapURL,"saveMemoryFileAction"),r=(0,o.createServerReference)("40e4e924aa53ad8f05d0077700aaa6b5965efbec5c",o.callServer,void 0,o.findSourceMapURL,"wipeMemoryAction");function s({scope:a,rootId:b,title:c,description:f,allowWipe:i}){let[j,k]=(0,e.useState)([]),[m,n]=(0,e.useState)(!0),[o,q]=(0,e.useState)(null),r=(0,e.useCallback)(async()=>{n(!0);let c=await p(b?{scope:a,rootId:b}:{scope:a});if(n(!1),!c.ok)return void q(c.error);q(null),k(c.files)},[a,b]);return(0,d.jsxs)(l.Zp,{children:[(0,d.jsx)(l.aR,{children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(l.ZB,{className:"text-lg",children:c}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:f})]}),i&&j.length>0&&(0,d.jsx)(u,{scope:a,rootId:b,onWiped:r})]})}),(0,d.jsx)(l.Wu,{children:m?(0,d.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,d.jsx)(g.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):o?(0,d.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"}),o]}):(0,d.jsx)("div",{className:"space-y-4",children:j.map(c=>(0,d.jsx)(t,{snapshot:c,scope:a,rootId:b,onSaved:a=>k(b=>b.map(b=>b.file===a.file?a:b))},c.file))})})]})}function t({snapshot:a,scope:b,rootId:c,onSaved:h}){let[j,l]=(0,e.useState)(a.content),[o,p]=(0,e.useTransition)(),r=j.trim(),s=r?r.split("\n").length:0,t=s>a.cap,u=s>.9*a.cap,v=j!==a.content;return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"font-mono text-sm font-semibold",children:a.file}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:a.description})]}),(0,d.jsxs)("span",{className:(0,n.cn)("text-xs tabular-nums",t?"text-destructive font-medium":u?"text-amber-600":"text-muted-foreground"),children:[s,"/",a.cap]})]}),(0,d.jsx)(m.T,{value:j,onChange:a=>l(a.target.value),rows:Math.min(a.cap+2,Math.max(3,s+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,d.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,d.jsxs)(k.$,{type:"button",size:"sm",variant:v?"default":"ghost",disabled:!v||o||t,onClick:()=>{if(t)return void f.oR.error(`${a.file} exceeds ${a.cap}-line cap (${s}). Trim before saving.`);p(async()=>{let d=await q({scope:b,...c?{rootId:c}:{},file:a.file,content:r});if(!d.ok)return void f.oR.error(d.error??"Save failed");f.oR.success(`Saved ${a.file}`),h({...a,content:r,lines:d.lines})})},children:[o?(0,d.jsx)(g.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,d.jsx)(i.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function u({scope:a,rootId:b,onWiped:c}){let[g,h]=(0,e.useTransition)();return(0,d.jsxs)(k.$,{type:"button",size:"sm",variant:"ghost",disabled:g,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&h(async()=>{let d=await r(b?{scope:a,rootId:b}:{scope:a});if(!d.ok)return void f.oR.error(d.error??"Wipe failed");f.oR.success("Memory wiped"),await c()})},className:"text-destructive hover:text-destructive",children:[(0,d.jsx)(j.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},75482:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},78645:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ik:()=>q,K9:()=>o,rg:()=>r});var e=c(73745);c(66493);var f=c(73024),g=c(65326),h=c(53905),i=c(50108),j=c(36017),k=c(5492),l=c(51021),m=c(63781),n=a([i,l]);async function o(a){try{let b=await f.promises.stat(a).catch(()=>null);if(!b||!b.isDirectory())return{ok:!1,error:`Not a directory: ${a}`};let c=await (0,h._S)(a);(0,g.revalidatePath)("/");let d=await p(c).catch(()=>void 0);return{ok:!0,id:c.id,...d?{onboardingTopicId:d}:{}}}catch(a){return{ok:!1,error:s(a)}}}async function p(a){let b=await (0,j.M)(),c=b.assignments.chat,d=await (0,k.OY)({root:a.path,firstMessage:"Space onboarding",harness:c.harness,model:c.model,language:b.language}),e=await (0,l.W)({rootId:a.id,topicId:d.meta.id,message:"/skill space-onboarding",attachments:[]});return"error"in e,d.meta.id}async function q(a,b,c=!1){try{let d=await (0,j.M)(),e=d.assignments.analyze,f="claude-code"===e.harness||"codex"===e.harness?e.harness:void 0;return await (0,i.E)(a,{scaffoldOnly:c,language:d.language,...f?{harness:f}:{},...f?{model:e.model}:{}}),c||await (0,h.Qu)(b),(0,g.revalidatePath)("/"),(0,g.revalidatePath)(`/roots/${b}`),{ok:!0}}catch(a){return{ok:!1,error:s(a)}}}async function r(a){try{return await (0,h.L7)(a),(0,g.revalidatePath)("/"),{ok:!0}}catch(a){return{ok:!1,error:s(a)}}}function s(a){if(a instanceof Error){try{let b=JSON.parse(a.message);if(Array.isArray(b))return b.map(a=>"object"==typeof a&&null!==a&&"message"in a?String(a.message):String(a)).join("; ")}catch{}return a.message}return String(a)}[i,l]=n.then?(await n)():n,(0,m.D)([o,q,r]),(0,e.A)(o,"4084822de69aa14384f43e55b6234553adffbf1dc9",null),(0,e.A)(q,"7097c53d805e225aaae726116c92b63e04ca1f7010",null),(0,e.A)(r,"4098ccef81a70c3489b2a27f59f021bd8de9c73109",null),d()}catch(a){d(a)}})},79428:a=>{"use strict";a.exports=require("buffer")},79646:a=>{"use strict";a.exports=require("child_process")},79734:(a,b,c)=>{"use strict";c.d(b,{D:()=>j,z:()=>i});var d=c(73024),e=c(76760),f=c.n(e),g=c(879),h=c(54287);async function i(a){let b=f().resolve(a.root),c=f().resolve(a.scope),d=f().relative(b,c);if(d.startsWith(".."))throw Error(`Scope ${c} is outside root ${b}`);let e=d?(0,h.x9)(b,d):f().join(b,h.fW),i=[];for await(let a of(0,g.G)(c))"."!==a.rel&&(a.isDir||i.push(a.rel));return{root:b,scope:c,reflexScope:e,files:i}}async function j(a){let b=f().join(a,h.KZ);try{await d.promises.access(b);return}catch{}await d.promises.writeFile(b,"# .reflexignore — gitignore syntax\n# Patterns listed here are excluded from Reflex's analysis and watchers.\n\nnode_modules/\ndist/\nbuild/\n.venv/\n__pycache__/\n*.log\n","utf8")}},80133:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"40082ec70d0b2a4630ca385f69cd615a7db57e5a23":()=>f.rD,"4031d5ebb9cc210e06f8217d6bc629135ef4c1f5bd":()=>f.Gh,"4036300f8624cb51c0e2918c09796cbcd4025824b4":()=>f.O1,"408c0ad85dae45d66a47ce63a7e36c290ec25af47d":()=>f.summarizeYoutubeAction,"40b0a116af1bfb9f70336ace63436ef128cfd4c6b6":()=>f.AZ,"40d4bbd2cde140a66caa7ca8b04a1d51318bb7c228":()=>e.x,"60d2dbfc420613da79d1ae3ccc31e1ed5c1052e863":()=>e.k});var e=c(49809),f=c(18746),g=a([e]);e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},84910:(a,b,c)=>{"use strict";c.d(b,{AddUtilityButton:()=>y});var d=c(64173),e=c(17240),f=c(1056),g=c.n(f),h=c(87671),i=c(71813),j=c(97162);let k=(0,c(42557).A)("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);var l=c(66979),m=c(62261),n=c(65177),o=c(97338),p=c(12619),q=c(44171),r=c(44052),s=c(20583);c(65631);var t=c(3265);t.callServer,t.findSourceMapURL;let u=(0,t.createServerReference)("4018083d4923b30a197b1fc83354bff9817054a2fa",t.callServer,void 0,t.findSourceMapURL,"applyUtilityUpdateAction");var v=c(72744),w=c(92374),x=c(88724);function y({rootId:a,installed:b}){let c=(0,i.c)("roots"),[f,t]=(0,e.useState)(!1),[y,z]=(0,e.useState)([]),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useTransition)(),[G,H]=(0,e.useState)([]),I=(0,e.useRef)(null),J=(0,h.useRouter)(),K=new Set(b.map(a=>a.id)),L=b.filter(a=>"project"===a.scope),M=new Map(G.map(a=>[a.id,a]));return(0,d.jsxs)("div",{className:"relative",ref:I,children:[(0,d.jsxs)(s.$,{type:"button",variant:"ghost",size:"sm",className:"gap-1",onClick:()=>t(a=>!a),title:c("addUtility.buttonTitle"),children:[(0,d.jsx)(j.A,{className:"h-4 w-4"}),c("addUtility.buttonLabel"),L.length>0&&(0,d.jsx)("span",{className:"ml-1 text-[10px] rounded-full bg-violet-100 text-violet-700 px-1.5",children:L.length}),G.length>0&&(0,d.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:c("addUtility.updatesTitle",{count:G.length}),children:[(0,d.jsx)(k,{className:"h-2.5 w-2.5"}),G.length]})]}),f&&(0,d.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,d.jsxs)("div",{className:"sticky top-0 bg-popover flex items-center gap-2 px-3 py-2 border-b",children:[(0,d.jsx)(j.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,d.jsx)("span",{className:"text-xs font-medium",children:c("addUtility.popoverTitle")}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!1),className:"ml-auto p-0.5 rounded hover:bg-accent",children:(0,d.jsx)(l.A,{className:"h-3 w-3"})})]}),L.length>0&&(0,d.jsxs)("section",{className:"p-2 border-b",children:[(0,d.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:c("addUtility.installedInProject")}),(0,d.jsx)("ul",{className:"space-y-1",children:L.map(b=>{let e=M.get(b.id);return(0,d.jsxs)("li",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2 py-1.5 text-xs",children:[(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"truncate font-medium",children:b.name}),e&&(0,d.jsxs)("div",{className:"text-[10px] text-amber-700 inline-flex items-center gap-0.5",children:[(0,d.jsx)(k,{className:"h-2.5 w-2.5"}),e.currentVersion," → ",e.latestVersion]})]}),e&&(0,d.jsxs)("button",{type:"button",onClick:()=>{D(e.id),F(async()=>{let b=await u({...e,rootId:a});if(D(null),!b.ok)return void r.oR.error(b.error);r.oR.success(c("addUtility.applyUpdateSuccess",{name:e.name,from:e.currentVersion,to:b.newVersion})),H(a=>a.filter(a=>a.id!==e.id)),(0,x.$d)(x.Zi.kbChanged(a)),J.refresh()})},disabled:E&&C===b.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:c("addUtility.applyUpdateTitle"),children:[E&&C===b.id?(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(k,{className:"h-3 w-3"}),c("addUtility.updateAction")]}),(0,d.jsx)(g(),{href:`/utilities/${b.scope}/${b.id}?rootId=${encodeURIComponent(a)}`,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:c("addUtility.openAction"),children:(0,d.jsx)(n.A,{className:"h-3 w-3"})}),(0,d.jsx)("button",{type:"button",onClick:()=>{confirm(c("addUtility.removeConfirm",{name:b.name}))&&(D(b.id),F(async()=>{let d=await (0,w.j)(b.scope,b.id,"project"===b.scope?a:void 0);if(D(null),!d.ok)return void r.oR.error(d.error??c("addUtility.removeFailed"));r.oR.success(c("addUtility.removeSuccess",{name:b.name})),(0,x.$d)(x.Zi.kbChanged(a)),J.refresh()}))},disabled:E&&C===b.id,className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-50",title:c("addUtility.removeAction"),children:E&&C===b.id?(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(o.A,{className:"h-3 w-3"})})]},b.id)})})]}),(0,d.jsxs)("section",{className:"p-2",children:[(0,d.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:c("addUtility.catalog")}),A?(0,d.jsxs)("div",{className:"px-2 py-4 text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}),c("addUtility.loading")]}):0===y.length?(0,d.jsx)("p",{className:"px-2 py-4 text-xs text-muted-foreground",children:c("addUtility.catalogEmpty")}):(0,d.jsx)("ul",{className:"space-y-1",children:y.map(b=>{let e=K.has(b.id),f=C===b.id&&E;return(0,d.jsx)("li",{className:"rounded-md border bg-card px-2 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"text-xl leading-none",children:b.emoji}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"font-medium text-sm",children:b.name}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug",children:b.description})]}),e?(0,d.jsxs)("span",{className:"text-[10px] text-emerald-700 inline-flex items-center gap-0.5",children:[(0,d.jsx)(p.A,{className:"h-3 w-3"})," ",c("addUtility.already")]}):(0,d.jsxs)("button",{type:"button",onClick:()=>{D(b.id),F(async()=>{let d=b.suggestedScope??"global",e=await (0,v.g)({github:b.github,scope:d,..."project"===d?{rootId:a}:{}});if(D(null),!e.ok)return void r.oR.error(e.error);r.oR.success(c("addUtility.installSuccess",{name:b.name})),(0,x.$d)(x.Zi.kbChanged(a)),J.refresh()})},disabled:f||E,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:[f?(0,d.jsx)(m.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(q.A,{className:"h-3 w-3"}),c("addUtility.add")]})]})},b.id)})})]})]})]})}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86974:(a,b,c)=>{"use strict";c.d(b,{Dashboard:()=>aB});var d=c(64173),e=c(17240),f=c(71813),g=c(63351),h=c(44052),i=c(20583),j=c(88724),k=c(1056),l=c.n(k),m=c(75430),n=c(62261),o=c(19356),p=c(42382),q=c(31041);function r({rootId:a,activeGoals:b,runningAgents:c}){let e=(0,f.c)("roots"),g=b.length+c.length;return(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(m.A,{className:"h-4 w-4 text-violet-600"}),e("activeGoals.title")]}),g>0&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:g})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[0===g&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:e("activeGoals.empty")}),b.map(b=>(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.topicId}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(m.A,{className:"h-3.5 w-3.5 text-violet-600 mt-0.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.topicTitle}),b.running&&(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin text-violet-600 shrink-0"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:b.goal}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-muted-foreground",children:[(0,d.jsx)("span",{children:e("activeGoals.iterationLabel",{count:b.goalIterations})}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsx)("span",{children:e("activeGoals.updatedLabel",{time:function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("activeGoals.justNow");let d=Math.floor(c/6e4);if(d<1)return b("activeGoals.justNow");if(d<60)return b("activeGoals.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("activeGoals.hoursAgo",{count:e}):b("activeGoals.daysAgo",{count:Math.floor(e/24)})}(b.updatedAt,e)})})]})]})]})},b.topicId)),c.map(b=>(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.topicId}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5 text-amber-600 mt-0.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.topicTitle}),(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin text-amber-600 shrink-0"}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e("activeGoals.agentRunning")})]})]})},b.topicId))]})]})}var s=c(74868),t=c(42324),u=c(63387),v=c(33120);function w({rootId:a,items:b}){let c=(0,f.c)("roots");return(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(s.A,{className:"h-4 w-4 text-amber-600"}),c("pendingApprovals.title")]}),b.length>0&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:b.length})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[0===b.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("pendingApprovals.empty")}),b.map(b=>{var e;return(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.topicId}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(x,{kind:b.kind}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.summary}),(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:"permission"===(e=b.kind)?"permission":"question"===e?"question":"mcp-add"})]}),b.details&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:b.details}),(0,d.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:["topic ",b.topicId.slice(0,12)," \xb7 ",function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("pendingApprovals.justNow");let d=Math.floor(c/6e4);if(d<1)return b("pendingApprovals.justNow");if(d<60)return b("pendingApprovals.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("pendingApprovals.hoursAgo",{count:e}):b("pendingApprovals.daysAgo",{count:Math.floor(e/24)})}(b.ts,c)]})]})]})},`${b.kind}:${b.requestId}`)})]})]})}function x({kind:a}){let b="h-3.5 w-3.5 mt-0.5 shrink-0";return"permission"===a?(0,d.jsx)(t.A,{className:`${b} text-rose-600`}):"question"===a?(0,d.jsx)(u.A,{className:`${b} text-sky-600`}):(0,d.jsx)(v.A,{className:`${b} text-emerald-600`})}var y=c(68669),z=c(3265);function A({rootId:a,items:b}){let c=(0,f.c)("roots"),[g,h]=(0,e.useState)({});return(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(y.A,{className:"h-4 w-4 text-emerald-700"}),c("recentKb.title")]}),b.length>0&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:b.length})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[0===b.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("recentKb.empty")}),b.map(b=>(0,d.jsx)(l(),{href:`/roots/${a}/kb/${b.rel.split("/").map(encodeURIComponent).join("/")}`,className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(y.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-emerald-700"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:b.title}),b.kind&&(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:b.kind})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:g[b.rel]??b.rel}),(0,d.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:[function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("recentKb.justNow");let d=Math.floor(c/6e4);if(d<1)return b("recentKb.justNow");if(d<60)return b("recentKb.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("recentKb.hoursAgo",{count:e}):b("recentKb.daysAgo",{count:Math.floor(e/24)})}(b.modifiedAt,c)," \xb7 ",(0,d.jsx)("span",{className:"font-mono",children:b.rel})]})]})]})},b.rel))]})]})}z.callServer,z.findSourceMapURL;var B=c(87671),C=c(42557);let D=(0,C.A)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var E=c(69552),F=c(62481),G=c(73569),H=c(41414);function I({rootId:a,cache:b}){let c=(0,f.c)("roots"),[j,k]=(0,e.useState)(b),[l,m]=(0,e.useTransition)(),o=(0,B.useRouter)(),r=j&&Date.now()-Date.parse(j.generatedAt)>864e5;return(0,d.jsxs)(q.Zp,{className:"lg:col-span-2",children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2",children:[(0,d.jsx)(D,{className:"h-4 w-4 text-amber-500"}),c("aiSuggestions.title"),r&&(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:c("aiSuggestions.stale")})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{m(async()=>{try{let b=await fetch(`/api/roots/${a}/suggestions`,{method:"POST",cache:"no-store"}),d=await b.json();if(!d.ok)return void h.oR.error(d.error??c("aiSuggestions.regenerateFailed"));d.cache&&k(d.cache)}catch(a){h.oR.error(a instanceof Error?a.message:String(a))}})},disabled:l,className:"gap-1 h-7 text-xs",children:[l?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(g.A,{className:"h-3 w-3"}),c("aiSuggestions.recompute")]})]}),(0,d.jsxs)(q.Wu,{className:"space-y-2",children:[!j&&!l&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("aiSuggestions.intro")}),j&&0===j.items.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:c("aiSuggestions.nothingUrgent")}),(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:j?.items.map((b,c)=>(0,d.jsxs)("div",{className:"rounded-md border bg-card p-3 space-y-1.5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(E.A,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),(0,d.jsx)("p",{className:"text-sm font-medium leading-snug flex-1",children:b.title})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:b.why}),(0,d.jsx)(J,{rootId:a,item:b,router:o})]},c))}),j&&(0,d.jsx)("p",{className:"text-[10px] text-muted-foreground pt-1",children:c.rich("aiSuggestions.generatedAt",{time:function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("aiSuggestions.justNow");let d=Math.floor(c/6e4);if(d<1)return b("aiSuggestions.justNow");if(d<60)return b("aiSuggestions.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("aiSuggestions.hoursAgo",{count:e}):b("aiSuggestions.daysAgo",{count:Math.floor(e/24)})}(j.generatedAt,c),model:j.model,code:a=>(0,d.jsx)("code",{className:"font-mono",children:a})})})]})]})}function J({rootId:a,item:b,router:c}){let[g,k]=(0,e.useTransition)(),m=(0,f.c)("roots"),{action:o}=b;if("none"===o.kind)return null;if("open-topic"===o.kind&&o.target)return(0,d.jsx)(i.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,d.jsxs)(l(),{href:`/roots/${a}/chat/${o.target}`,children:[(0,d.jsx)(F.A,{className:"h-3 w-3"}),o.label]})});if("open-kb"===o.kind&&o.target){let b=o.target.split("/").map(encodeURIComponent).join("/");return(0,d.jsx)(i.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,d.jsxs)(l(),{href:`/roots/${a}/kb/${b}`,children:[(0,d.jsx)(F.A,{className:"h-3 w-3"}),o.label]})})}return"send-message"===o.kind&&o.target?(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>{k(async()=>{try{let b=await (0,H.g)(a,o.target,[],void 0);if(!b.ok)return void h.oR.error(b.error??m("aiSuggestions.sendFailed"));(0,j.$d)(j.Zi.topicsChanged(a)),c.push(`/roots/${a}/chat/${b.topicId}`)}catch(a){h.oR.error(a instanceof Error?a.message:String(a))}})},disabled:g,children:[g?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(G.A,{className:"h-3 w-3"}),o.label]}):null}var K=c(97162),L=c(34719),M=c(56189),N=c(12619),O=c(66979);let P=(0,z.createServerReference)("405ec53da393750aba1a102583b27c6bb53b5b7867",z.callServer,void 0,z.findSourceMapURL,"listSuggestionsAction"),Q=(0,z.createServerReference)("40052029685146fccb067daf5fe782f3a861c82775",z.callServer,void 0,z.findSourceMapURL,"approveSuggestionAction"),R=(0,z.createServerReference)("40d54200b5ecc4abb8e00bb6ca186c1cabd700e9f9",z.callServer,void 0,z.findSourceMapURL,"rejectSuggestionAction");var S=c(91344);let T={utility:K.A,research:L.A,widget:M.A,goal:m.A,skill:E.A},U={utility:"text-emerald-600",research:"text-violet-600",widget:"text-blue-600",goal:"text-amber-600",skill:"text-pink-600"};function V({rootId:a}){let b=(0,B.useRouter)(),[c,f]=(0,e.useState)([]),[j,k]=(0,e.useState)(!0),[l,m]=(0,e.useState)({}),[o,r]=(0,e.useTransition)(),s=(0,e.useCallback)(async()=>{let b=await P(a);k(!1),b.ok&&f(b.items)},[a]);return j||0===c.length?null:(0,d.jsxs)(q.Zp,{children:[(0,d.jsxs)(q.aR,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)(q.ZB,{className:"text-lg flex items-center gap-2",children:[(0,d.jsx)(D,{className:"h-4 w-4 text-amber-500"}),"Suggestions",(0,d.jsx)(p.E,{variant:"secondary",className:"ml-1",children:c.length})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>r(()=>s()),disabled:o,className:"h-7 gap-1",children:[(0,d.jsx)(g.A,{className:(0,S.cn)("h-3 w-3",o&&"animate-spin")}),"Refresh"]})]}),(0,d.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,d.jsx)(q.Wu,{className:"space-y-2",children:c.map(c=>{let e=T[c.kind]??D,g=l[c.id];return(0,d.jsxs)("div",{className:"flex items-start gap-3 rounded-md border p-3",children:[(0,d.jsx)(e,{className:(0,S.cn)("h-4 w-4 mt-1 shrink-0",U[c.kind])}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"font-medium text-sm",children:c.title}),(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:c.kind})]}),c.description&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1 leading-snug",children:c.description}),c.prompt&&(0,d.jsx)("code",{className:"block mt-1 text-[10px] font-mono text-muted-foreground/70 truncate",children:c.prompt})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"default",disabled:!!g,onClick:()=>{m(a=>({...a,[c.id]:"approve"})),(async()=>{let d=await Q({rootId:a,suggestionId:c.id});if(m(a=>({...a,[c.id]:null})),!d.ok)return h.oR.error(d.error??"Failed to start topic");h.oR.success(`Started: ${c.title}`),f(a=>a.filter(a=>a.id!==c.id)),b.push(`/roots/${a}/chat/${d.topicId}`)})()},className:"h-8 gap-1",children:["approve"===g?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(N.A,{className:"h-3 w-3"}),"Approve"]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",disabled:!!g,onClick:()=>{m(a=>({...a,[c.id]:"reject"})),(async()=>{let b=await R({rootId:a,suggestionId:c.id});if(m(a=>({...a,[c.id]:null})),!b.ok)return h.oR.error(b.error??"Failed to reject");h.oR.success(`Dismissed: ${c.title}`),f(a=>a.filter(a=>a.id!==c.id))})()},className:"h-8 gap-1 text-muted-foreground hover:text-destructive",children:["reject"===g?(0,d.jsx)(n.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(O.A,{className:"h-3 w-3"}),"Dismiss"]})]})]},c.id)})})]})}var W=c(74133);let X=(0,C.A)("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);var Y=c(30515);let Z=(0,z.createServerReference)("608f028ad74cfe4b7ae15960871d695e1cfc25de7c",z.callServer,void 0,z.findSourceMapURL,"saveWidgetOrderAction"),$=(0,z.createServerReference)("60500860b41d0ab1e6c6657111ca40fdda8ce7afab",z.callServer,void 0,z.findSourceMapURL,"hideWidgetAction"),_={sm:2,md:3,wide:6},aa=["sys:active-goals","sys:pending","sys:recent-kb","sys:ai-suggestions"],ab=[{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."}],ac=(0,z.createServerReference)("7040e3dc047efa96c3c9111e517343785985b3e040",z.callServer,void 0,z.findSourceMapURL,"setWidgetSizeAction"),ad=[{mode:"sm",label:"S",titleKey:"widgetsCommon.sizeSm"},{mode:"md",label:"M",titleKey:"widgetsCommon.sizeMd"},{mode:"wide",label:"W",titleKey:"widgetsCommon.sizeWide"}];function ae({rootId:a,widgetId:b,mode:c,onChanged:g}){let i=(0,f.c)("roots"),[j,k]=(0,e.useTransition)();return(0,d.jsx)("div",{role:"radiogroup","aria-label":i("widgetsCommon.sizeAria"),className:"inline-flex items-center rounded border bg-background/80 backdrop-blur overflow-hidden text-[10px] leading-none",children:ad.map(e=>{let f=e.mode===c,l="sm"===e.mode?i("widgetsCommon.sizeSm"):"md"===e.mode?i("widgetsCommon.sizeMd"):i("widgetsCommon.sizeWide");return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":f,"aria-label":l,title:l,onClick:()=>{var d;(d=e.mode)!==c&&k(async()=>{let c=await ac(a,b,d);if(!c.ok)return void h.oR.error(c.error??i("widgetsCommon.sizeFailed"));g()})},disabled:j,className:["px-1.5 py-0.5 font-mono transition-colors disabled:opacity-50",f?"bg-violet-600 text-white":"text-muted-foreground hover:bg-accent hover:text-foreground"].join(" "),children:e.label},e.mode)})})}function af(a){let b=_[a];return 2===b?"lg:col-span-2":3===b?"lg:col-span-3":"lg:col-span-6"}let ag=(0,C.A)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var ah=c(54874),ai=c(14425),aj=c(71155),ak=c(9084);let al=(0,z.createServerReference)("789fccf65ed6f2f7db808c6867ed11fd1129d1ce91",z.callServer,void 0,z.findSourceMapURL,"patchWidgetDataAction"),am=(0,z.createServerReference)("7091c1a7bb8977e9c27d4a114dc26ea06278172c84",z.callServer,void 0,z.findSourceMapURL,"setWidgetRefreshAction"),an=(0,z.createServerReference)("60b0f08fd473c27ea347b31c7944a2c2ea795fc367",z.callServer,void 0,z.findSourceMapURL,"refreshWidgetNowAction");function ao({rootId:a,widget:b,mode:c,onHide:g,hiding:i,onLayoutChanged:j,dnd:k}){let m=(0,f.c)("roots"),[n,o]=(0,e.useTransition)(),r=k.dragging===b.id,s=k.dropTarget===b.id&&!r,t=af(c);return(0,d.jsxs)(q.Zp,{draggable:!0,onDragStart:a=>{a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b.id),k.onDragStart(b.id)},onDragOver:a=>{a.preventDefault(),a.dataTransfer.dropEffect="move",k.dropTarget!==b.id&&k.onDragOver(b.id)},onDrop:a=>{a.preventDefault(),k.onDrop(b.id)},onDragEnd:()=>k.onDragEnd(),className:[t,"transition-all",r?"opacity-50":"",s?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background":""].join(" "),children:[(0,d.jsxs)(q.aR,{className:"pb-2 flex flex-row items-start gap-2 space-y-0",children:[(0,d.jsx)(ag,{className:"h-3.5 w-3.5 text-muted-foreground/60 cursor-grab active:cursor-grabbing mt-1 shrink-0","aria-label":m("widgetsCommon.dragHandle")}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)(q.ZB,{className:"text-sm flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"truncate",children:b.title}),(0,d.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono shrink-0",children:b.kind})]}),b.description&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5 line-clamp-2",children:b.description})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 -mt-0.5 shrink-0",children:[(0,d.jsx)(ae,{rootId:a,widgetId:b.id,mode:c,onChanged:j}),b.sourceTopicId&&(0,d.jsx)(l(),{href:`/roots/${a}/chat/${b.sourceTopicId}`,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground","aria-label":m("widgetsCommon.editViaTopicAria"),title:m("widgetsCommon.editViaTopicTitle"),children:(0,d.jsx)(ah.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{type:"button",onClick:()=>o(async()=>{await Promise.resolve(),g(b.id)}),disabled:n||i,"aria-label":m("widgetsCommon.hideAria"),title:m("widgetsCommon.hideTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:(0,d.jsx)(O.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)(q.Wu,{className:"space-y-3",children:[(0,ak.v)(a,b.kind,b.data,{onPatch:async c=>{let d=await al(a,b.id,c);if(!d.ok)throw h.oR.error(d.error??m("widgetsCommon.savePatchFailed")),Error(d.error??m("widgetsCommon.patchFailed"))}}),(0,d.jsx)(ap,{rootId:a,widget:b})]})]})}function ap({rootId:a,widget:b}){let c=(0,f.c)("roots"),[i,j]=(0,e.useTransition)(),[k,l]=(0,e.useTransition)(),m=b.refresh??"manual",n=b.lastRefreshAt??b.updatedAt;return b.sourceTopicId?(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t text-[11px] text-muted-foreground",children:[(0,d.jsx)(ai.A,{className:"h-3 w-3 shrink-0"}),(0,d.jsx)("span",{className:"shrink-0",children:c("widgetsCommon.updatedAt",{time:function(a,b){let c=Date.now()-Date.parse(a);if(!Number.isFinite(c)||c<0)return b("widgetsCommon.justNow");let d=Math.floor(c/6e4);if(d<1)return b("widgetsCommon.justNow");if(d<60)return b("widgetsCommon.minutesAgo",{count:d});let e=Math.floor(d/60);return e<24?b("widgetsCommon.hoursAgo",{count:e}):b("widgetsCommon.daysAgo",{count:Math.floor(e/24)})}(n,c)})}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[(0,d.jsxs)(aj.l6,{value:m,onValueChange:d=>{l(async()=>{var e;let f=await am(a,b.id,d);f.ok?h.oR.success("manual"===d?c("widgetsCommon.autoRefreshOff"):c("widgetsCommon.cadenceSet",{cadence:(e=d,c("hourly"===e?"widgetsCommon.cadenceHourly":"daily"===e?"widgetsCommon.cadenceDaily":"weekly"===e?"widgetsCommon.cadenceWeekly":"widgetsCommon.cadenceManual"))})):h.oR.error(f.error??c("widgetsCommon.cadenceFailed"))})},disabled:k,children:[(0,d.jsx)(aj.bq,{className:"h-6 text-[10px] gap-1 px-1.5 w-auto min-w-[110px]",children:(0,d.jsx)(aj.yv,{})}),(0,d.jsxs)(aj.gC,{children:[(0,d.jsx)(aj.eb,{value:"manual",children:c("widgetsCommon.manual")}),(0,d.jsx)(aj.eb,{value:"hourly",children:c("widgetsCommon.hourly")}),(0,d.jsx)(aj.eb,{value:"daily",children:c("widgetsCommon.daily")}),(0,d.jsx)(aj.eb,{value:"weekly",children:c("widgetsCommon.weekly")})]})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{j(async()=>{let d=await an(a,b.id);d.ok?h.oR.success(c("widgetsCommon.refreshStarted")):h.oR.error(d.error??c("widgetsCommon.refreshFailed"))})},disabled:i,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,d.jsx)(g.A,{className:`h-3 w-3 ${i?"animate-spin":""}`}),c("widgetsCommon.refreshLabel")]})]})]}):null}var aq=c(75482),ar=c(3442),as=c(97338),at=c(27456),au=c(85134);let av=(0,z.createServerReference)("6009e206c0d3d6b007dc4e7ce95600f9ce84d54020",z.callServer,void 0,z.findSourceMapURL,"deleteWidgetAction");function aw({rootId:a,open:b,onOpenChange:c,widgets:e,layout:g,onChanged:h}){let j=(0,f.c)("roots");if(!b)return null;let k=new Set(g.hidden);return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:a=>{a.target===a.currentTarget&&c(!1)},children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>c(!1)}),(0,d.jsxs)("div",{className:"relative bg-card border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",children:[(0,d.jsx)(X,{className:"h-4 w-4 text-violet-600"}),(0,d.jsx)("h2",{className:"text-sm font-medium flex-1",children:j("widgetsCommon.libraryTitle")}),(0,d.jsx)(i.$,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>c(!1),children:(0,d.jsx)(O.A,{className:"h-4 w-4"})})]}),(0,d.jsx)(at.F,{className:"flex-1 min-h-0",children:(0,d.jsxs)("div",{className:"p-4 space-y-4",children:[(0,d.jsxs)("section",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:j("widgetsCommon.systemWidgetsHeading")}),ab.map(b=>(0,d.jsx)(ax,{rootId:a,id:b.id,title:b.title,description:b.description,badge:"system",badgeVariant:"default",hidden:k.has(b.id),canDelete:!1,onChanged:h},b.id))]}),(0,d.jsxs)("section",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:j("widgetsCommon.userWidgetsHeading",{count:e.length})}),0===e.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:j("widgetsCommon.noUserWidgets")}),e.map(b=>(0,d.jsx)(ax,{rootId:a,id:b.id,title:b.title,description:b.description??`kind: ${b.kind}`,badge:b.kind,badgeVariant:"outline",hidden:k.has(b.id),canDelete:!0,onChanged:h},b.id))]})]})})]})]})}function ax({rootId:a,id:b,title:c,description:g,badge:j,badgeVariant:k,hidden:l,canDelete:m,onChanged:n}){let o=(0,f.c)("roots"),[q,r]=(0,e.useTransition)();return(0,d.jsxs)("div",{className:"flex items-start gap-3 rounded-md border bg-card px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"text-sm font-medium truncate",children:c}),(0,d.jsx)(p.E,{variant:k,className:"text-[10px] font-mono",children:j}),l&&(0,d.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:o("widgetsCommon.hidden")})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:g})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{r(async()=>{let c=l?await (0,au.t)(a,b):await $(a,b);if(!c.ok)return void h.oR.error(c.error);n()})},disabled:q,className:"gap-1 h-7 text-xs",children:l?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aq.A,{className:"h-3 w-3"}),o("widgetsCommon.show")]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ar.A,{className:"h-3 w-3"}),o("widgetsCommon.hide")]})}),m&&(0,d.jsx)(i.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>{confirm(o("widgetsCommon.deleteWidgetConfirm",{title:c}))&&r(async()=>{let c=await av(a,b);if(!c.ok)return void h.oR.error(c.error);n()})},disabled:q,className:"h-7 w-7 text-muted-foreground hover:text-destructive",title:o("widgetsCommon.deleteForever"),children:(0,d.jsx)(as.A,{className:"h-3.5 w-3.5"})})]})]})}function ay({rootId:a,widgets:b,layout:c,systemRenderers:g,snapshot:j,onLayoutChanged:k}){let l=(0,f.c)("roots"),m=(0,e.useMemo)(()=>{let a=new Map;for(let c of b)a.set(c.id,c);return a},[b]),[n,o]=(0,e.useState)(c.order),[p,q]=(0,e.useState)(c.hidden),[,r]=(0,e.useTransition)(),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1);aA(c.order,o),aA(c.hidden,q);let y=(0,e.useCallback)(b=>{o(b),r(async()=>{let c=await Z(a,b);c.ok?(o(c.layout.order),q(c.layout.hidden),k()):h.oR.error(c.error)})},[a,k]),z=(0,e.useCallback)(b=>{o(n.filter(a=>a!==b)),q(a=>[...new Set([b,...a])]),r(async()=>{let c=await $(a,b);if(!c.ok)return void h.oR.error(c.error);o(c.layout.order),q(c.layout.hidden),k()})},[a,n,k]),A={onDragStart:a=>t(a),onDragOver:a=>v(a),onDrop:a=>{if(t(null),v(null),!s||s===a)return;let b=[...n],c=b.indexOf(s),d=b.indexOf(a);c<0||d<0||(b.splice(c,1),b.splice(d,0,s),y(b))},onDragEnd:()=>{t(null),v(null)},dragging:s,dropTarget:u};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:l("widgetsCommon.projectWidgetsTitle")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:l("widgetsCommon.projectWidgetsHint")})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"outline",onClick:()=>x(!0),className:"gap-1 h-8",children:[(0,d.jsx)(X,{className:"h-3.5 w-3.5"}),l("widgetsCommon.library",{count:p.length})]})]}),0===n.length&&(0,d.jsxs)("div",{className:"rounded-md border border-dashed bg-muted/20 p-6 text-center space-y-2",children:[(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:l.rich("widgetsCommon.emptyDashboard",{example:()=>(0,d.jsx)("em",{children:l("widgetsCommon.emptyDashboardExample")})})}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>x(!0),className:"gap-1",children:[(0,d.jsx)(Y.A,{className:"h-3 w-3"}),l("widgetsCommon.restoreSystem")]})]}),(0,d.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-6 gap-4",children:n.map(b=>{var e;let f=m.get(b),h=c.sizes?.[b]??(e=f?.size,e?.mode?e.mode:e?.cols===1?"sm":e?.cols===2?"md":e?.cols===3?"wide":"md");return aa.includes(b)?(0,d.jsx)(az,{rootId:a,id:b,node:g[b],onHide:z,dnd:A,mode:h,onLayoutChanged:k},b):f?(0,d.jsx)(ao,{rootId:a,widget:f,mode:h,onHide:z,hiding:!1,dnd:A,onLayoutChanged:k},b):null})}),(0,d.jsx)(aw,{open:w,onOpenChange:x,rootId:a,widgets:b,layout:{order:n,hidden:p},onChanged:()=>{k()}})]})}function az({rootId:a,id:b,node:c,onHide:e,dnd:g,mode:h,onLayoutChanged:i}){let j=(0,f.c)("roots"),k=g.dragging===b,l=g.dropTarget===b&&!k,m=af(h);return(0,d.jsxs)("div",{draggable:!0,onDragStart:a=>{a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b),g.onDragStart(b)},onDragOver:a=>{a.preventDefault(),a.dataTransfer.dropEffect="move",g.dropTarget!==b&&g.onDragOver(b)},onDrop:a=>{a.preventDefault(),g.onDrop(b)},onDragEnd:()=>g.onDragEnd(),className:[m,"relative group/sys transition-all",k?"opacity-50":"",l?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background rounded-lg":""].join(" "),children:[c,(0,d.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,d.jsx)(ae,{rootId:a,widgetId:b,mode:h,onChanged:i}),(0,d.jsx)("button",{type:"button",onClick:()=>e(b),"aria-label":j("widgetsCommon.hideAria"),title:j("widgetsCommon.hideSystemTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:"\xd7"})]})]})}function aA(a,b){(0,e.useMemo)(()=>{b(a)},[JSON.stringify(a)])}function aB({rootId:a,initialSnapshot:b}){let c=(0,f.c)("roots"),[k,l]=(0,e.useState)(b),[m,n]=(0,e.useTransition)(),o=(0,e.useCallback)(()=>{n(async()=>{try{let b=await fetch(`/api/roots/${a}/dashboard`,{cache:"no-store"}),d=await b.json();if(!d.ok||!d.snapshot)return void h.oR.error(d.error??c("dashboard.refreshFailed"));l(d.snapshot)}catch(a){h.oR.error(a instanceof Error?a.message:String(a))}})},[a,c]);(0,j.S9)(j.Zi.topicsChanged(a),o),(0,j.S9)(j.Zi.kbChanged(a),o);let p={"sys:active-goals":(0,d.jsx)(r,{rootId:a,activeGoals:k.activeGoals,runningAgents:k.runningAgents}),"sys:pending":(0,d.jsx)(w,{rootId:a,items:k.pendingApprovals}),"sys:recent-kb":(0,d.jsx)(A,{rootId:a,items:k.recentKb}),"sys:ai-suggestions":(0,d.jsx)(I,{rootId:a,cache:k.suggestions})};return(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,d.jsxs)("div",{className:"p-6 space-y-5 max-w-6xl mx-auto",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:c("dashboard.projectOverview")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("dashboard.projectOverviewHint")})]}),(0,d.jsxs)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:o,disabled:m,className:"gap-1 h-8",children:[(0,d.jsx)(g.A,{className:`h-3.5 w-3.5 ${m?"animate-spin":""}`}),c("dashboard.refresh")]})]}),(0,d.jsx)(V,{rootId:a}),(0,d.jsx)(ay,{rootId:a,widgets:k.widgets,layout:k.layout,systemRenderers:p,snapshot:k,onLayoutChanged:o}),(0,d.jsx)(W.p,{scope:"project",rootId:a,title:c("dashboard.memoryTitle"),description:c("dashboard.memoryHint")})]})})}},90558:(a,b,c)=>{"use strict";c.d(b,{CommandBar:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call CommandBar() from the server but CommandBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/command-bar.tsx","CommandBar")},91745:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{R1:()=>n,RR:()=>m,c9:()=>l});var e=c(73745);c(66493);var f=c(81483),g=c(1947),h=c(53905),i=c(63781),j=a([g]);async function k(a,b){if("global"===a)return;if(!b)throw Error("project memory requires rootId");let c=await (0,h.Zn)(b);if(!c)throw Error(`unknown root: ${b}`);return c.path}async function l(a){try{if(!(0,f.qL)(a.scope))return{ok:!1,error:"invalid scope"};let b=await k(a.scope,a.rootId),c=await (0,g.ab)(b?{scope:"project",rootPath:b}:{scope:"global"}),d=f.cs.map(a=>({file:a,content:c[a].content??"",lines:c[a].lines,cap:f.h0[a],tier:f.a9[a],description:f.lh[a]}));return{ok:!0,files:d}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function m(a){try{if(!(0,f.qL)(a.scope))return{ok:!1,error:"invalid scope"};if(!(0,f.UV)(a.file))return{ok:!1,error:"invalid file"};let b=await k(a.scope,a.rootId),c=await (0,g.xP)(b?{scope:"project",rootPath:b}:{scope:"global"},a.file,"replace",{content:a.content});if(!c.ok)return{ok:!1,error:c.error??"write failed",lines:c.lines,cap:c.cap};return{ok:!0,lines:c.lines,cap:c.cap}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function n(a){try{if(!(0,f.qL)(a.scope))return{ok:!1,error:"invalid scope"};let b=await k(a.scope,a.rootId),c=b?{scope:"project",rootPath:b}:{scope:"global"};for(let a of f.cs)await (0,g.xP)(c,a,"replace",{content:""});return{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}g=(j.then?(await j)():j)[0],(0,i.D)([l,m,n]),(0,e.A)(l,"40e63d7cb1fa792dc22a713385a884d2d0abce1731",null),(0,e.A)(m,"403e983977877b307d9670a7f626b1e2455a363885",null),(0,e.A)(n,"40e4e924aa53ad8f05d0077700aaa6b5965efbec5c",null),d()}catch(a){d(a)}})},92374:(a,b,c)=>{"use strict";c.d(b,{j:()=>e});var d=c(3265);let e=(0,d.createServerReference)("705a1d9d6197afca0974a26faea39ed19829a6dae2",d.callServer,void 0,d.findSourceMapURL,"removeUtilityAction")},98783:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Yr:()=>o,ct:()=>n,uy:()=>m});var e=c(73745);c(66493);var f=c(65326),g=c(53905),h=c(22421),i=c(13415),j=c(1947),k=c(63781),l=a([i,j]);async function m(a){try{let b=await (0,g.Zn)(a);if(!b)return{ok:!1,error:"Root not found"};let c=await (0,h.vd)(b.path);return{ok:!0,items:c}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function n(a){try{let b=await (0,g.Zn)(a.rootId);if(!b)return{ok:!1,error:"Root not found"};let c=(await (0,h.vd)(b.path)).find(b=>b.id===a.suggestionId);if(!c)return{ok:!1,error:"Suggestion not found or already actioned"};let d=await (0,i.g3)(a.rootId,c.prompt,[]);if(!d.ok)return{ok:!1,error:d.error??"topic start failed"};return await (0,h.Bd)(b.path,c.id,d.topicId),(0,f.revalidatePath)(`/roots/${a.rootId}`),{ok:!0,topicId:d.topicId}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function o(a){try{let b=await (0,g.Zn)(a.rootId);if(!b)return{ok:!1,error:"Root not found"};let c=(await (0,h.vd)(b.path)).find(b=>b.id===a.suggestionId);if(!c)return{ok:!1,error:"Suggestion not found"};let d=`Rejected suggestion: "${c.title}" (${c.kind})`;return await (0,j.xP)({scope:"project",rootPath:b.path},"AVOID","append",{content:d}),await (0,h.eJ)(b.path,c.id),(0,f.revalidatePath)(`/roots/${a.rootId}`),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}[i,j]=l.then?(await l)():l,(0,k.D)([m,n,o]),(0,e.A)(m,"405ec53da393750aba1a102583b27c6bb53b5b7867",null),(0,e.A)(n,"40052029685146fccb067daf5fe782f3a861c82775",null),(0,e.A)(o,"40d54200b5ecc4abb8e00bb6ca186c1cabd700e9f9",null),d()}catch(a){d(a)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[9803,8404,2356,1988,9631,192,5895,8056,7572,4842,5543,1105,285,6909,9861,6954,3152,3868,4812,2559,6149],()=>b(b.s=65686));module.exports=c})();
12
+ `)}async function n(a){let b=await e.promises.stat(a).catch(()=>null);if(!b||!b.isDirectory())throw Error(`Not a directory: ${a}`)}i=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},51333:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(19963).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"}]])},51455:a=>{"use strict";a.exports=require("node:fs/promises")},52129:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Qt:()=>t,Qv:()=>r});var e=c(73024),f=c(76760),g=c.n(f),h=c(29163),i=c(11178),j=c(56843),k=c(16909),l=c(24139),m=c(99048),n=c(17640),o=c(24576),p=a([k,m]);function q(a){let b=a.replace(/[^A-Za-z0-9_.-]/g,"_");return g().join((0,h._)(),"roots",b,"suggestions.json")}async function r(a){try{let b=await e.promises.readFile(q(a),"utf8"),c=JSON.parse(b);if(c.rootId!==a||!Array.isArray(c.items))return null;return c}catch{return null}}async function s(a){let b=q(a.rootId);await e.promises.mkdir(g().dirname(b),{recursive:!0}),await e.promises.writeFile(b,JSON.stringify(a,null,2)+"\n",{encoding:"utf8",mode:384});try{await e.promises.chmod(b,384)}catch{}}async function t(a){var b;let c=await (0,o.Zn)(a);if(!c)return{ok:!1,error:"Root not found"};let d=(await (0,n.M)()).assignments.quick,e=await u(a,c.path);if(e.empty){let b={rootId:a,generatedAt:new Date().toISOString(),model:"n/a",items:[{title:"Project is empty",why:"No topics, no KB files — nothing to suggest. Start with /chat or create your first entry.",action:{kind:"none",label:"OK"}}]};return await s(b),{ok:!0,cache:b}}let f=(b=e,['You analyse the state of a local Reflex knowledge-base project and propose 2–4 high-leverage actions for the user.\nOutput STRICT JSON: an object with one key `items`, value array of {title, why, action}.\naction.kind ∈ {"open-topic", "open-kb", "send-message", "none"}.\n - open-topic: target = topic id from the snapshot\n - open-kb: target = rel-path from the snapshot (.reflex/-relative)\n - send-message: target = the literal text Reflex should send. topicId = which topic to send into (use an existing id from the snapshot or omit for new chat).\n - none: informational only\nEach action.label is the button text (3-6 words, Russian or English to match the project\'s vibe).\nEach `title` is 4-9 words; each `why` is one sentence explaining the trigger.\nSkip trivialities. Don\'t propose chores that don\'t move the project forward.\nReply in Russian unless titles/paths are obviously English.\n\n## Snapshot',JSON.stringify(b,null,2),"\nReturn only the JSON object — no preamble, no markdown fences, no comments. The reply MUST start with `{` and end with `}`."].join("\n"));try{let b=await (0,m.T)(d,f,{timeoutMs:45e3}),c=function(a){let b=a.trim();b.startsWith("```")&&(b=b.replace(/^```[a-z]*\r?\n/i,"").replace(/```\s*$/i,""));let c=b.indexOf("{"),d=b.lastIndexOf("}");c>=0&&d>c&&(b=b.slice(c,d+1));let e=JSON.parse(b);if(!e||"object"!=typeof e||!Array.isArray(e.items))throw Error("Model returned non-JSON or missing items[]");let f=[];for(let a of e.items){if(!a||"object"!=typeof a)continue;let b="string"==typeof a.title?a.title:null,c="string"==typeof a.why?a.why:null,d=a.action&&"object"==typeof a.action?a.action:null;if(!b||!c||!d)continue;let e=d.kind;if("open-topic"!==e&&"open-kb"!==e&&"send-message"!==e&&"none"!==e)continue;let g="string"==typeof d.label?d.label:"Open";f.push({title:b,why:c,action:{kind:e,label:g,..."string"==typeof d.target?{target:d.target}:{},..."string"==typeof d.topicId?{topicId:d.topicId}:{}}})}return f}(b),e={rootId:a,generatedAt:new Date().toISOString(),model:`${d.harness}:${d.model}`,items:c.slice(0,5)};return await s(e),{ok:!0,cache:e}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function u(a,b){let[c,d]=await Promise.all([(0,j.hk)(b),(0,i.dj)(b)]),e=c.map(a=>a.meta.id),f=new Set("function"==typeof k.z.listRunningTopicsForRoot?k.z.listRunningTopicsForRoot(a):[]),g=await (0,l.Z)(b,e),h=Date.now()-432e6,m=c.filter(a=>Date.parse(a.meta.updatedAt)<h).filter(a=>a.meta.goal&&"active"===a.meta.goalStatus).map(a=>({id:a.meta.id,title:a.meta.title,updatedAt:a.meta.updatedAt}));return{empty:0===c.length&&0===d.length,topicCount:c.length,topicsWithGoal:c.filter(a=>a.meta.goal&&"active"===a.meta.goalStatus).map(a=>({id:a.meta.id,title:a.meta.title,goal:a.meta.goal,iterations:a.meta.goalIterations??0,updatedAt:a.meta.updatedAt,running:f.has(a.meta.id)})),runningTopics:c.filter(a=>f.has(a.meta.id)).map(a=>({id:a.meta.id,title:a.meta.title})),recentKb:d.slice().sort((a,b)=>a.modifiedAt<b.modifiedAt?1:-1).slice(0,8).map(a=>({rel:a.rel,title:a.meta.title??a.rel,modifiedAt:a.modifiedAt})),pendingCount:g.length,totalKbFiles:d.length,staleTopics:m}}[k,m]=p.then?(await p)():p,d()}catch(a){d(a)}})},52869:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},57075:a=>{"use strict";a.exports=require("node:stream")},58550:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{default:()=>C});var e=c(63003),f=c(20594),g=c.n(f),h=c(9310),i=c(17596),j=c(88842),k=c(47452),l=c(51333),m=c(50895),n=c(84913),o=c(67248),p=c(60524),q=c(24576),r=c(11178),s=c(49809),t=c(61105),u=c(64845),v=c(770),w=c(90558),x=c(16805),y=c(86673),z=c(574),A=c(62109),B=a([s]);async function C({params:a}){let{id:b}=await a,c=await (0,q.Zn)(b);c||(0,h.notFound)();let d=await (0,m.A)("roots"),[f,B,C]=await Promise.all([(0,r.RP)(c.path),(0,s.x)(b),(0,t.dH)({rootId:b})]),D=B.ok?B.snapshot:void 0,E=C.map(a=>({id:a.manifest.id,name:a.manifest.name,scope:a.scope}));return(0,e.jsxs)("main",{className:"flex-1 flex flex-col min-h-0",children:[(0,e.jsxs)("header",{className:"border-b px-6 py-4 flex items-center gap-4",children:[(0,e.jsx)(n.$,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-3",children:(0,e.jsxs)(g(),{href:"/",children:[(0,e.jsx)(i.A,{className:"mr-1 h-4 w-4"})," Roots"]})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(j.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,e.jsx)("h1",{className:"text-base font-medium truncate",children:c.path})]}),(0,e.jsx)("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground",children:f.exists?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(o.E,{variant:"secondary",children:[f.fileCount," MD files"]}),c.lastInitAt?(0,e.jsxs)("span",{children:["Last init ",new Date(c.lastInitAt).toLocaleString()]}):(0,e.jsx)("span",{children:"No init recorded"})]}):(0,e.jsx)(o.E,{variant:"outline",children:".reflex/ not yet created"})})]}),(0,e.jsx)(z.AddUtilityButton,{rootId:c.id,installed:E}),(0,e.jsx)(n.$,{asChild:!0,variant:"ghost",size:"sm",className:"gap-1",children:(0,e.jsxs)(g(),{href:`/roots/${c.id}/workflows`,children:[(0,e.jsx)(k.A,{className:"h-4 w-4"}),"Workflows"]})}),(0,e.jsx)(y.InsertImageButton,{rootId:c.id}),(0,e.jsx)(x.ShareButton,{kind:"project",rootId:c.id,label:c.path.split("/").pop()||d("detail.projectFallbackLabel")}),(0,e.jsx)(v.RunInitButton,{rootPath:c.path,rootId:c.id}),(0,e.jsx)(A.RemoveRootButton,{id:c.id,path:c.path,redirectHome:!0})]}),(0,e.jsx)(p.Separator,{}),D?(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,e.jsx)(u.Dashboard,{rootId:c.id,initialSnapshot:D}),(0,e.jsx)(w.CommandBar,{rootId:c.id})]}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground gap-3 p-10 text-center",children:[(0,e.jsx)(l.A,{className:"h-6 w-6"}),(0,e.jsxs)("p",{children:[d("detail.loadFailed"),B.ok?"":`: ${B.error??""}`,"."]}),(0,e.jsx)("p",{className:"text-xs",children:d.rich("detail.loadFailedHint",{b:a=>(0,e.jsx)("strong",{children:a})})})]}),(0,e.jsx)(w.CommandBar,{rootId:c.id})]})]})}s=(B.then?(await B)():B)[0],d()}catch(a){d(a)}})},59767:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"0014b030414ea9a6a29ae20473613cc7ed170fa2e3":()=>p.wd,"002801b88705a511da37aeec30ed5b2388b698a495":()=>l.Nt,"005fc454480197eee81c79f1881ed7184615feeda4":()=>l.Zl,"00671947863c9ddac4b6ee7cd2a0c47d13a5a77bc3":()=>k.L8,"008404505690ddfc6b51b642c77de510f66a1bba42":()=>l.Ng,"009eb430cfd12fcd58f1c1d78883caa9fedf8fe565":()=>t.w,"009f671ab6acb5dd5e5dbff2845942b4ec3830e606":()=>m.Bp,"00bb102975a6547639e8267f1ba135a907277554e3":()=>l.Fm,"00e95d6f8a3f881907aec85c52654bf07ccc038365":()=>g.i,"4001cc396f80fee8a1633456687fdb4159eee791bc":()=>i.uA,"400b6c5065b0a4f1ac9cfe3db81cb30b4bf4ba0aed":()=>e.nC,"4016252b5843779bed58255bdcabcc73483c0304e7":()=>f.u,"40207f4e6f4d300eb61a2f4d780280fdf6ba497ff0":()=>j.K9,"4024a7240e6e311133878a8749cdb4f0bfc69dfc94":()=>h.MU,"4028e6693b419eee8c484484e5a8e5bc19f50f8eee":()=>q.Yr,"402fffba7d293cb5d9292e3b4e533de664ca7934c9":()=>h.$z,"4035aaae137e408c2598adb145bc073022516445ef":()=>m.QR,"40462fdeec2ffb46e3bc415fcd320b0c6eb1d2d787":()=>p.LL,"404d14bf8050849c571d5245fae484379dbc1749d3":()=>r.RR,"405de29ae51dd666e56270fb95126ff8ff8cb5284f":()=>e.nY,"40611cdd599e9a472c2f819b21762d7ff50e80809e":()=>k.ns,"406aafc3792e9180d655459a777c12f36d462b9ad6":()=>m.gn,"407152c1c68d605b8686020435f5ebe7275c9795e2":()=>i.Cz,"407a91f8a88e190fc2c74812213d308d72f22b6dfc":()=>k.Is,"40844cca287f90fa241a546e630f2ec2e3260143bd":()=>m.vv,"4085e869625f691661e8f76104096a13b3d467e486":()=>m.Kt,"4099488ab2bbd866c8017adef2fe40170172aff97e":()=>o.x,"40997f0ef7dc788f375f4b38dada832f306ece631d":()=>q.ct,"409bdf79b99f3c5143750e32a9797f57e79edd06f7":()=>f.z,"409d43cd259f7c942ad062388849a814198ece4f07":()=>m.Yt,"40ae46949272db465546e5cfa874fcac36a5153ba4":()=>m.mR,"40af933609085fb06ae25c7ce714fdcb6a7412eeac":()=>r.c9,"40b6fae01e20d569141600a048050db3647146ca42":()=>m.RK,"40b91000f43a91ad91b058a6ff2ee2b5d619bfc24c":()=>m.b7,"40c68650227a567aea826724e7fe6304ba23c99483":()=>l.bt,"40ca6dbcd0ebe9f2b26281634c585d34727f7dd5c5":()=>m.nO,"40cb378b9ff826742a2c0a82699f26a4a837307d49":()=>m.JR,"40cc3ca8a4e655d45e7f28bd4bc971943c7d279203":()=>j.rg,"40d038e86c670fd2a545936a59086f84dc5b305287":()=>m.Zh,"40d89d2fd9352d05d30d06101824526fa5c038fdd7":()=>m.L_,"40ddba02f49d565ab9fedc19919f1b4148baf1616b":()=>i.hN,"40ddd93498dfe7c5e2278c0522b98f20b2ab653411":()=>r.R1,"40e54a486330f648636f442f71b94d27a8561a563e":()=>i.IK,"40ec5bee000556c64631f08fa8132e5eb62982d0aa":()=>m.k_,"40ee0634b95dcfa16f971b953fd77aa95947a244f3":()=>q.uy,"6009534488ec6ad495c652930e10f3444cfe1bf9cc":()=>s.tT,"60106cb482223e7533067dbee521cc9fe9f11ce822":()=>s.cl,"602d037c14b4891a0ede961df30623e311160f9913":()=>p.qO,"602e3d0310b44a8e202e9f784b389fb69a7ef517a5":()=>e.L4,"605387c37e3e6ec91962dea152fccc1ed0cbfb8230":()=>p.b2,"605440d7c93b603e6e1557d174c4952a32cc587b14":()=>s.KV,"605bce6936d33283ca712f40b0c63890178a19c29a":()=>s.Aq,"606946d674baf88876d164cd9fba20787ff2bb244a":()=>p.ZC,"607172d8bcc1b603e840f0da23229ab11313804473":()=>h.Tc,"60a5acc9fcf16234fd9fe0dec64f9e2db64042d004":()=>e.OQ,"60ca3fccaef3a315a1bca24ed8e08b6223f74ecf94":()=>n.S,"60d7f0bcddcc74bfd30125761256540f0c7d2b4e78":()=>e.T$,"60edceb1dd132d1cb24fe649bef82742a1409b5968":()=>s.hL,"700475db28f28d02d5945345eb1c77d776684388a1":()=>m.jf,"7042ce158c54352859fb38724253952f5f7c9cccf6":()=>m.i8,"7061eb8e0c3f409cb8dc50b4a51cbf72847a5fdc0f":()=>e.h$,"7088c88d429110023c7f79632f0fb98a97a39b93fd":()=>m.QI,"709c188d297b8301c4b2e6901fa5867d927e381d22":()=>s.Mh,"70af39ffef14535684f171178b6a3727a80c3959c0":()=>m.q_,"70d2736fbdb79ddc02efe04667237b0fa0242c4dbb":()=>j.Ik,"70d67f33031dd5e502f94279dfc8a819f21cabf03f":()=>s.mm,"7831708867c79c93966e5412f8bdb70c6744a42125":()=>s.ru,"78bdebe77eb51711a3314dec5d445cfaa49c4cbc52":()=>e.g3});var e=c(13415),f=c(3890),g=c(50995),h=c(15754),i=c(27129),j=c(78645),k=c(16856),l=c(92814),m=c(9328),n=c(4168),o=c(63337),p=c(72901),q=c(98783),r=c(91745),s=c(34639),t=c(48272),u=a([e,h,j,m,p,q,r,s]);[e,h,j,m,p,q,r,s]=u.then?(await u)():u,d()}catch(a){d(a)}})},62109:(a,b,c)=>{"use strict";c.d(b,{RemoveRootButton:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call RemoveRootButton() from the server but RemoveRootButton is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/_components/remove-root-button.tsx","RemoveRootButton")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63351:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).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"}]])},64845:(a,b,c)=>{"use strict";c.d(b,{Dashboard:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call Dashboard() from the server but Dashboard is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/dashboard.tsx","Dashboard")},65686:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>E.a,__next_app__:()=>K,handler:()=>M,pages:()=>J,routeModule:()=>L,tree:()=>I});var d=c(61597),e=c(99210),f=c(1082),g=c(15003),h=c(36265),i=c(11817),j=c(45136),k=c(41809),l=c(55745),m=c(88963),n=c(69153),o=c(48343),p=c(15808),q=c(21238),r=c(2555),s=c(261),t=c(34370),u=c(89583),v=c(26713),w=c(53875),x=c(7952),y=c(54532),z=c(80269),A=c(17851),B=c(57865),C=c(86439),D=c(47319),E=c.n(D),F=c(1859),G=c(20498),H={};for(let a in F)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(H[a]=()=>F[a]);c.d(b,H);let I={children:["",{children:["roots",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,58550)),"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/page.tsx"]}]},{layout:[()=>Promise.resolve().then(c.bind(c,6993)),"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/layout.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(c.bind(c,79459)),"/home/runner/work/reflex-agent/reflex-agent/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,47319,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,82295,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,91570,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,72845,23)),"next/dist/client/components/builtin/unauthorized.js"]}]}.children,J=["/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/page.tsx"],K={require:c,loadChunk:()=>Promise.resolve()},L=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/roots/[id]/page",pathname:"/roots/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:I},distDir:".next",relativeProjectDir:""});async function M(a,b,d){var D;let H="/roots/[id]/page";"/index"===H&&(H="/");let N=(0,h.getRequestMeta)(a,"postponed"),O=(0,h.getRequestMeta)(a,"minimalMode"),P=await L.prepare(a,b,{srcPage:H,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,parsedUrl:T,pageIsDynamic:U,buildManifest:V,nextFontManifest:W,reactLoadableManifest:X,serverActionsManifest:Y,clientReferenceManifest:Z,subresourceIntegrityManifest:$,prerenderManifest:_,isDraftMode:aa,resolvedPathname:ab,revalidateOnlyGenerated:ac,routerServerContext:ad,nextConfig:ae,interceptionRoutePatterns:af}=P,ag=T.pathname||"/",ah=(0,s.normalizeAppPath)(H),{isOnDemandRevalidate:ai}=P,aj=L.match(ag,_),ak=!!_.routes[ab],al=!!(aj||ak||_.routes[ah]),am=a.headers["user-agent"]||"",an=(0,v.getBotType)(am),ao=(0,q.isHtmlBotRequest)(a),ap=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[u.NEXT_ROUTER_PREFETCH_HEADER],aq=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[u.RSC_HEADER]),ar=(0,t.getIsPossibleServerAction)(a),as=(0,m.checkIsAppPPREnabled)(ae.experimental.ppr)&&(null==(D=_.routes[ah]??_.dynamicRoutes[ah])?void 0:D.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?N:void 0,aw=as&&aq&&!ap,ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=!am||(0,q.shouldServeStreamingMetadata)(am,ae.htmlLimitedBots);ao&&as&&(al=!1,ay=!1);let az=!0===L.isDev||!al||"string"==typeof N||aw,aA=ao&&as,aB=null;aa||!al||az||ar||av||aw||(aB=ab);let aC=aB;!aC&&L.isDev&&(aC=ab),L.isDev||aa||!al||!aq||aw||(0,k.d)(a.headers);let aD={...F,tree:I,pages:J,GlobalError:E(),handler:M,routeModule:L,__next_app__:K};Y&&Z&&(0,p.setReferenceManifestsSingleton)({page:H,clientReferenceManifest:Z,serverActionsManifest:Y,serverModuleMap:(0,r.createServerModuleMap)({serverActionsManifest:Y})});let aE=a.method||"GET",aF=(0,g.getTracer)(),aG=aF.getActiveScopeSpan();try{let f=L.getVaryHeader(ab,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return L.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aF.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aE} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aE} ${a.url}`)})},m=async({span:e,postponed:f,fallbackRouteParams:g})=>{let i={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aD,Component:(0,j.T)(aD),params:S,routeModule:L,page:H,postponed:f,shouldWaitOnAllReady:aA,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||az,buildManifest:V,nextFontManifest:W,reactLoadableManifest:X,subresourceIntegrityManifest:$,serverActionsManifest:Y,clientReferenceManifest:Z,setIsrStatus:null==ad?void 0:ad.setIsrStatus,dir:c(33873).join(process.cwd(),L.relativeProjectDir),isDraftMode:aa,isRevalidate:al&&!f&&!aw,botType:an,isOnDemandRevalidate:ai,isPossibleServerAction:ar,assetPrefix:ae.assetPrefix,nextConfigOutput:ae.output,crossOrigin:ae.crossOrigin,trailingSlash:ae.trailingSlash,previewProps:_.preview,deploymentId:ae.deploymentId,enableTainting:ae.experimental.taint,htmlLimitedBots:ae.htmlLimitedBots,devtoolSegmentExplorer:ae.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:ae.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:ae.experimental.cacheLife,basePath:ae.basePath,serverActions:ae.experimental.serverActions,...at?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:at}:{},experimental:{isRoutePPREnabled:as,expireTime:ae.expireTime,staleTimes:ae.experimental.staleTimes,cacheComponents:!!ae.experimental.cacheComponents,clientSegmentCache:!!ae.experimental.clientSegmentCache,clientParamParsing:!!ae.experimental.clientParamParsing,dynamicOnHover:!!ae.experimental.dynamicOnHover,inlineCss:!!ae.experimental.inlineCss,authInterrupts:!!ae.experimental.authInterrupts,clientTraceMetadata:ae.experimental.clientTraceMetadata||[]},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>L.onRequestError(a,b,d,ad),err:(0,h.getRequestMeta)(a,"invokeError"),dev:L.isDev}},l=await k(e,i),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[z.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,al&&(null==n?void 0:n.revalidate)===0&&!L.isDev&&!as){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ab}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
13
+ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:w.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},n=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===L.isDev,l=c||b.writableEnded;if(ai&&ac&&!f&&!O)return(null==ad?void 0:ad.render404)?await ad.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(j=(0,x.parseFallbackField)(aj.fallback)),j===x.FallbackMode.PRERENDER&&(0,v.isBot)(am)&&(!as||ao)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(j!==x.FallbackMode.NOT_FOUND||f)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),!O&&j!==x.FallbackMode.BLOCKING_STATIC_RENDER&&aC&&!l&&!aa&&U&&(k||!ak)){let b;if((k||aj)&&j===x.FallbackMode.NOT_FOUND)throw new C.NoFallbackError;if(as&&!aq){let c="string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:k?ah:null;if(b=await L.handleResponse({cacheKey:c,req:a,nextConfig:ae,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:_,isRoutePPREnabled:as,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||au?(0,o.u)(ah):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let n=ai||g||!av?void 0:av;if(at&&void 0!==n)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:w.CachedRouteKind.PAGES,html:y.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=U&&as&&((0,h.getRequestMeta)(a,"renderFallbackShell")||au)?(0,o.u)(ag):null;return m({span:i,postponed:n,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,o=await L.handleResponse({cacheKey:aB,responseGenerator:a=>n({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ae,prerenderManifest:_,waitUntil:d.waitUntil});if(aa&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),L.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!o){if(aB)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=o.value)?void 0:f.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=o.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof o.value.postponed;al&&!aw&&(!p||ap)&&(O||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),b.setHeader(u.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=o;if(av)l={revalidate:0,expire:void 0};else if(O&&aq&&!ap&&as)l={revalidate:0,expire:void 0};else if(!L.isDev)if(aa)l={revalidate:0,expire:void 0};else if(al){if(o.cacheControl)if("number"==typeof o.cacheControl.revalidate){if(o.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${o.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:o.cacheControl.revalidate,expire:(null==(j=o.cacheControl)?void 0:j.expire)??ae.expireTime}}else l={revalidate:z.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(o.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===w.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[z.NEXT_CACHE_TAGS_HEADER];O&&al&&c&&"string"==typeof c&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(d,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.EMPTY,cacheControl:o.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...o,value:{...o.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&av)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(O&&al||delete a[z.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[z.NEXT_CACHE_TAGS_HEADER];if(O&&al&&s&&"string"==typeof s&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,s),!q.status||aq&&as||(b.statusCode=q.status),!O&&q.status&&G.RedirectStatusCode[q.status]&&aq&&(b.statusCode=200),p&&b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"1"),aq&&!aa){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:q.html,cacheControl:aw?{revalidate:0,expire:void 0}:o.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(q.rscData,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl})}let t=q.html;if(!p||O||aq)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:o.cacheControl});if(at)return t.push(new ReadableStream({start(a){a.enqueue(A.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}});let v=new TransformStream;return t.push(v.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(v.writable)}).catch(a=>{v.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}})};if(!aG)return await aF.withPropagatedContext(a.headers,()=>aF.trace(i.BaseServerSpan.handleRequest,{spanName:`${aE} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aE,"http.target":a.url}},p));await p(aG)}catch(b){throw b instanceof C.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:al,isOnDemandRevalidate:ai})},ad),b}}},71152:a=>{"use strict";a.exports=require("esbuild")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},75482:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},78645:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ik:()=>u,K9:()=>s,rg:()=>v});var e=c(73745);c(66493);var f=c(73024),g=c(76760),h=c.n(g),i=c(65326),j=c(53905),k=c(50108),l=c(36017),m=c(5492),n=c(51021),o=c(1947),p=c(81483),q=c(63781),r=a([k,n,o]);async function s(a){try{let b=await f.promises.stat(a).catch(()=>null);if(!b||!b.isDirectory())return{ok:!1,error:`Not a directory: ${a}`};let c=await (0,j._S)(a);(0,i.revalidatePath)("/");let d=await t(c).catch(()=>void 0);return{ok:!0,id:c.id,...d?{onboardingTopicId:d}:{}}}catch(a){return{ok:!1,error:x(a)}}}async function t(a){let b=await (0,l.M)(),c=b.assignments.chat,d=await (0,m.OY)({root:a.path,firstMessage:"Space onboarding",harness:c.harness,model:c.model,language:b.language}),e=await (0,n.W)({rootId:a.id,topicId:d.meta.id,message:"/skill space-onboarding",attachments:[]});return"error"in e,d.meta.id}async function u(a,b,c=!1){try{let d=await (0,l.M)(),e=d.assignments.analyze,f="claude-code"===e.harness||"codex"===e.harness?e.harness:void 0;return await (0,k.E)(a,{scaffoldOnly:c,language:d.language,...f?{harness:f}:{},...f?{model:e.model}:{}}),c||await (0,j.Qu)(b),(0,i.revalidatePath)("/"),(0,i.revalidatePath)(`/roots/${b}`),{ok:!0}}catch(a){return{ok:!1,error:x(a)}}}async function v(a){try{let b=await (0,j.Zn)(a);if(!b)return(0,i.revalidatePath)("/"),{ok:!0};let c=h().join(b.path,".reflex");await f.promises.rm(c,{recursive:!0,force:!0}).catch(()=>null);let d=h().basename(b.path);return await w({projectName:d,projectPath:b.path}),await (0,j.L7)(a),(0,i.revalidatePath)("/"),(0,i.revalidatePath)(`/roots/${a}`),{ok:!0}}catch(a){return{ok:!1,error:x(a)}}}async function w(a){let b=new Set;if(a.projectName.trim()&&b.add(a.projectName.trim()),a.projectPath.trim()&&b.add(a.projectPath.trim()),0!==b.size)for(let a of p.cs){let c=await (0,o.MJ)({scope:"global"},a);if(!c.content)continue;let d=c.content.split("\n").filter(a=>{let c=a.toLowerCase();for(let a of b)if(c.includes(a.toLowerCase()))return!1;return!0}).join("\n").trim();d!==c.content.trim()&&await (0,o.xP)({scope:"global"},a,"replace",{content:d})}}function x(a){if(a instanceof Error){try{let b=JSON.parse(a.message);if(Array.isArray(b))return b.map(a=>"object"==typeof a&&null!==a&&"message"in a?String(a.message):String(a)).join("; ")}catch{}return a.message}return String(a)}[k,n,o]=r.then?(await r)():r,(0,q.D)([s,u,v]),(0,e.A)(s,"40207f4e6f4d300eb61a2f4d780280fdf6ba497ff0",null),(0,e.A)(u,"70d2736fbdb79ddc02efe04667237b0fa0242c4dbb",null),(0,e.A)(v,"40cc3ca8a4e655d45e7f28bd4bc971943c7d279203",null),d()}catch(a){d(a)}})},79428:a=>{"use strict";a.exports=require("buffer")},79646:a=>{"use strict";a.exports=require("child_process")},79734:(a,b,c)=>{"use strict";c.d(b,{D:()=>j,z:()=>i});var d=c(73024),e=c(76760),f=c.n(e),g=c(879),h=c(54287);async function i(a){let b=f().resolve(a.root),c=f().resolve(a.scope),d=f().relative(b,c);if(d.startsWith(".."))throw Error(`Scope ${c} is outside root ${b}`);let e=d?(0,h.x9)(b,d):f().join(b,h.fW),i=[];for await(let a of(0,g.G)(c))"."!==a.rel&&(a.isDir||i.push(a.rel));return{root:b,scope:c,reflexScope:e,files:i}}async function j(a){let b=f().join(a,h.KZ);try{await d.promises.access(b);return}catch{}await d.promises.writeFile(b,"# .reflexignore — gitignore syntax\n# Patterns listed here are excluded from Reflex's analysis and watchers.\n\nnode_modules/\ndist/\nbuild/\n.venv/\n__pycache__/\n*.log\n","utf8")}},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},90510:(a,b,c)=>{Promise.resolve().then(c.bind(c,3211)),Promise.resolve().then(c.bind(c,3237)),Promise.resolve().then(c.bind(c,44045)),Promise.resolve().then(c.bind(c,43449)),Promise.resolve().then(c.bind(c,15620)),Promise.resolve().then(c.bind(c,12690)),Promise.resolve().then(c.bind(c,13864)),Promise.resolve().then(c.bind(c,68394)),Promise.resolve().then(c.bind(c,51189)),Promise.resolve().then(c.bind(c,66180)),Promise.resolve().then(c.bind(c,75266)),Promise.resolve().then(c.bind(c,14360)),Promise.resolve().then(c.bind(c,6786)),Promise.resolve().then(c.bind(c,44896)),Promise.resolve().then(c.bind(c,14848)),Promise.resolve().then(c.bind(c,53710)),Promise.resolve().then(c.bind(c,30544)),Promise.resolve().then(c.bind(c,13829)),Promise.resolve().then(c.bind(c,90044)),Promise.resolve().then(c.bind(c,57673)),Promise.resolve().then(c.bind(c,97053)),Promise.resolve().then(c.bind(c,43151)),Promise.resolve().then(c.bind(c,12156)),Promise.resolve().then(c.bind(c,71615)),Promise.resolve().then(c.bind(c,4080)),Promise.resolve().then(c.bind(c,87177)),Promise.resolve().then(c.bind(c,87634)),Promise.resolve().then(c.bind(c,6912)),Promise.resolve().then(c.bind(c,13976)),Promise.resolve().then(c.bind(c,18282)),Promise.resolve().then(c.bind(c,20633)),Promise.resolve().then(c.bind(c,61193)),Promise.resolve().then(c.bind(c,66188)),Promise.resolve().then(c.bind(c,66643)),Promise.resolve().then(c.bind(c,81669)),Promise.resolve().then(c.bind(c,39991)),Promise.resolve().then(c.bind(c,54972)),Promise.resolve().then(c.t.bind(c,1056,23))},90558:(a,b,c)=>{"use strict";c.d(b,{CommandBar:()=>d});let d=(0,c(54491).registerClientReference)(function(){throw Error("Attempted to call CommandBar() from the server but CommandBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/reflex-agent/reflex-agent/app/roots/[id]/_components/command-bar.tsx","CommandBar")},91745:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{R1:()=>n,RR:()=>m,c9:()=>l});var e=c(73745);c(66493);var f=c(81483),g=c(1947),h=c(53905),i=c(63781),j=a([g]);async function k(a,b){if("global"===a)return;if(!b)throw Error("project memory requires rootId");let c=await (0,h.Zn)(b);if(!c)throw Error(`unknown root: ${b}`);return c.path}async function l(a){try{if(!(0,f.qL)(a.scope))return{ok:!1,error:"invalid scope"};let b=await k(a.scope,a.rootId),c=await (0,g.ab)(b?{scope:"project",rootPath:b}:{scope:"global"}),d=f.cs.map(a=>({file:a,content:c[a].content??"",lines:c[a].lines,cap:f.h0[a],tier:f.a9[a],description:f.lh[a]}));return{ok:!0,files:d}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function m(a){try{if(!(0,f.qL)(a.scope))return{ok:!1,error:"invalid scope"};if(!(0,f.UV)(a.file))return{ok:!1,error:"invalid file"};let b=await k(a.scope,a.rootId),c=await (0,g.xP)(b?{scope:"project",rootPath:b}:{scope:"global"},a.file,"replace",{content:a.content});if(!c.ok)return{ok:!1,error:c.error??"write failed",lines:c.lines,cap:c.cap};return{ok:!0,lines:c.lines,cap:c.cap}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function n(a){try{if(!(0,f.qL)(a.scope))return{ok:!1,error:"invalid scope"};let b=await k(a.scope,a.rootId),c=b?{scope:"project",rootPath:b}:{scope:"global"};for(let a of f.cs)await (0,g.xP)(c,a,"replace",{content:""});return{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}g=(j.then?(await j)():j)[0],(0,i.D)([l,m,n]),(0,e.A)(l,"40af933609085fb06ae25c7ce714fdcb6a7412eeac",null),(0,e.A)(m,"404d14bf8050849c571d5245fae484379dbc1749d3",null),(0,e.A)(n,"40ddd93498dfe7c5e2278c0522b98f20b2ab653411",null),d()}catch(a){d(a)}})},92498:(a,b,c)=>{"use strict";c.d(b,{j:()=>e});var d=c(3265);let e=(0,d.createServerReference)("700475db28f28d02d5945345eb1c77d776684388a1",d.callServer,void 0,d.findSourceMapURL,"removeUtilityAction")},96975:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(42557).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},98783:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Yr:()=>o,ct:()=>n,uy:()=>m});var e=c(73745);c(66493);var f=c(65326),g=c(53905),h=c(22421),i=c(13415),j=c(1947),k=c(63781),l=a([i,j]);async function m(a){try{let b=await (0,g.Zn)(a);if(!b)return{ok:!1,error:"Root not found"};let c=await (0,h.vd)(b.path);return{ok:!0,items:c}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function n(a){try{let b=await (0,g.Zn)(a.rootId);if(!b)return{ok:!1,error:"Root not found"};let c=(await (0,h.vd)(b.path)).find(b=>b.id===a.suggestionId);if(!c)return{ok:!1,error:"Suggestion not found or already actioned"};let d=await (0,i.g3)(a.rootId,c.prompt,[]);if(!d.ok)return{ok:!1,error:d.error??"topic start failed"};return await (0,h.Bd)(b.path,c.id,d.topicId),(0,f.revalidatePath)(`/roots/${a.rootId}`),{ok:!0,topicId:d.topicId}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function o(a){try{let b=await (0,g.Zn)(a.rootId);if(!b)return{ok:!1,error:"Root not found"};let c=(await (0,h.vd)(b.path)).find(b=>b.id===a.suggestionId);if(!c)return{ok:!1,error:"Suggestion not found"};let d=`Rejected suggestion: "${c.title}" (${c.kind})`;return await (0,j.xP)({scope:"project",rootPath:b.path},"AVOID","append",{content:d}),await (0,h.eJ)(b.path,c.id),(0,f.revalidatePath)(`/roots/${a.rootId}`),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}[i,j]=l.then?(await l)():l,(0,k.D)([m,n,o]),(0,e.A)(m,"40ee0634b95dcfa16f971b953fd77aa95947a244f3",null),(0,e.A)(n,"40997f0ef7dc788f375f4b38dada832f306ece631d",null),(0,e.A)(o,"4028e6693b419eee8c484484e5a8e5bc19f50f8eee",null),d()}catch(a){d(a)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[9803,8404,2356,1988,9631,192,5895,8056,7572,4842,5543,1105,285,7358,9861,539,3152,4197,4812,9637,3151],()=>b(b.s=65686));module.exports=c})();