nodal-agents 0.2.0 → 0.3.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 (129) hide show
  1. package/README.md +24 -0
  2. package/cli.js +314 -99
  3. package/migrations/0020_agent_workspaces.sql +60 -0
  4. package/migrations/meta/0009_snapshot.json +4454 -4454
  5. package/migrations/meta/0010_snapshot.json +4460 -4460
  6. package/migrations/meta/_journal.json +153 -146
  7. package/package.json +7 -3
  8. package/runner.js +2998 -59214
  9. package/web/.next/BUILD_ID +1 -1
  10. package/web/.next/app-path-routes-manifest.json +4 -4
  11. package/web/.next/build-manifest.json +2 -2
  12. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js +3 -2
  13. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js.nft.json +1 -1
  14. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page_client-reference-manifest.js +1 -1
  15. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js +1 -1
  16. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js.nft.json +1 -1
  17. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page_client-reference-manifest.js +1 -1
  18. package/web/.next/server/app/(dashboard)/agents/page.js +2 -2
  19. package/web/.next/server/app/(dashboard)/agents/page.js.nft.json +1 -1
  20. package/web/.next/server/app/(dashboard)/agents/page_client-reference-manifest.js +1 -1
  21. package/web/.next/server/app/(dashboard)/approvals/page.js +2 -2
  22. package/web/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  23. package/web/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  24. package/web/.next/server/app/(dashboard)/automations/page.js +2 -2
  25. package/web/.next/server/app/(dashboard)/automations/page.js.nft.json +1 -1
  26. package/web/.next/server/app/(dashboard)/automations/page_client-reference-manifest.js +1 -1
  27. package/web/.next/server/app/(dashboard)/billing/page_client-reference-manifest.js +1 -1
  28. package/web/.next/server/app/(dashboard)/connectors/page.js +2 -2
  29. package/web/.next/server/app/(dashboard)/connectors/page.js.nft.json +1 -1
  30. package/web/.next/server/app/(dashboard)/connectors/page_client-reference-manifest.js +1 -1
  31. package/web/.next/server/app/(dashboard)/credentials/page.js +1 -1
  32. package/web/.next/server/app/(dashboard)/credentials/page.js.nft.json +1 -1
  33. package/web/.next/server/app/(dashboard)/credentials/page_client-reference-manifest.js +1 -1
  34. package/web/.next/server/app/(dashboard)/jobs/[id]/page.js +2 -2
  35. package/web/.next/server/app/(dashboard)/jobs/[id]/page.js.nft.json +1 -1
  36. package/web/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
  37. package/web/.next/server/app/(dashboard)/jobs/page.js +2 -2
  38. package/web/.next/server/app/(dashboard)/jobs/page.js.nft.json +1 -1
  39. package/web/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/llm-providers/page.js +2 -2
  41. package/web/.next/server/app/(dashboard)/llm-providers/page.js.nft.json +1 -1
  42. package/web/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/logs/page.js +2 -2
  44. package/web/.next/server/app/(dashboard)/logs/page.js.nft.json +1 -1
  45. package/web/.next/server/app/(dashboard)/logs/page_client-reference-manifest.js +1 -1
  46. package/web/.next/server/app/(dashboard)/mcp/page.js +1 -1
  47. package/web/.next/server/app/(dashboard)/mcp/page.js.nft.json +1 -1
  48. package/web/.next/server/app/(dashboard)/mcp/page_client-reference-manifest.js +1 -1
  49. package/web/.next/server/app/(dashboard)/memories/page.js +2 -2
  50. package/web/.next/server/app/(dashboard)/memories/page.js.nft.json +1 -1
  51. package/web/.next/server/app/(dashboard)/memories/page_client-reference-manifest.js +1 -1
  52. package/web/.next/server/app/(dashboard)/page.js +2 -2
  53. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  54. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  55. package/web/.next/server/app/(dashboard)/settings/page.js +2 -2
  56. package/web/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  57. package/web/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  58. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js +2 -2
  59. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js.nft.json +1 -1
  60. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page_client-reference-manifest.js +1 -1
  61. package/web/.next/server/app/(dashboard)/skills/new/page.js +1299 -101
  62. package/web/.next/server/app/(dashboard)/skills/new/page_client-reference-manifest.js +1 -1
  63. package/web/.next/server/app/(dashboard)/skills/page.js +2 -2
  64. package/web/.next/server/app/(dashboard)/skills/page.js.nft.json +1 -1
  65. package/web/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
  66. package/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  67. package/web/.next/server/app/_global-error.html +1 -1
  68. package/web/.next/server/app/_global-error.rsc +1 -1
  69. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  70. package/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  71. package/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  72. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  73. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  74. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  75. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/_not-found.html +1 -1
  77. package/web/.next/server/app/_not-found.rsc +2 -2
  78. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  79. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  80. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  81. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  82. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  83. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  84. package/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
  85. package/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  86. package/web/.next/server/app/onboarding.html +1 -1
  87. package/web/.next/server/app/onboarding.rsc +2 -2
  88. package/web/.next/server/app/onboarding.segments/_full.segment.rsc +2 -2
  89. package/web/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  90. package/web/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
  91. package/web/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  92. package/web/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
  93. package/web/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  94. package/web/.next/server/app-paths-manifest.json +4 -4
  95. package/web/.next/server/chunks/{9327.js → 2456.js} +1 -1
  96. package/web/.next/server/chunks/4574.js +1 -1
  97. package/web/.next/server/chunks/5786.js +1223 -0
  98. package/web/.next/server/chunks/5832.js +1 -0
  99. package/web/.next/server/chunks/6263.js +1 -0
  100. package/web/.next/server/chunks/9682.js +1 -0
  101. package/web/.next/server/middleware-build-manifest.js +1 -1
  102. package/web/.next/server/pages/404.html +1 -1
  103. package/web/.next/server/pages/500.html +1 -1
  104. package/web/.next/server/server-reference-manifest.js +1 -1
  105. package/web/.next/server/server-reference-manifest.json +1 -1
  106. package/web/.next/static/chunks/3141-f595f19634be6813.js +1 -0
  107. package/web/.next/static/chunks/{6118-c6a8b66d0a3e446c.js → 4239-99af3d7559fd9ec1.js} +1 -1
  108. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-f6f39ebe8d6fb019.js +2 -0
  109. package/web/.next/static/chunks/app/(dashboard)/agents/page-d2e35b0af87cdc0b.js +1 -0
  110. package/web/.next/static/chunks/app/(dashboard)/connectors/page-6ccde8b8b9197d2f.js +1 -0
  111. package/web/.next/static/chunks/app/(dashboard)/credentials/page-679ca09e4625b70f.js +1 -0
  112. package/web/.next/static/chunks/app/(dashboard)/mcp/page-ad271be896b650a9.js +1 -0
  113. package/web/.next/static/chunks/app/(dashboard)/memories/page-0eed8d3610720c33.js +1 -0
  114. package/web/.next/static/chunks/app/(dashboard)/skills/page-472bb16429cd2798.js +1 -0
  115. package/web/.next/static/css/845089bde6c9e6fb.css +3 -0
  116. package/web/.next/server/chunks/5616.js +0 -25
  117. package/web/.next/server/chunks/6595.js +0 -1
  118. package/web/.next/server/chunks/9323.js +0 -1
  119. package/web/.next/static/chunks/3422-9078c04bb8df8ce5.js +0 -1
  120. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-faaf5d7084db1fbc.js +0 -1
  121. package/web/.next/static/chunks/app/(dashboard)/agents/page-9f2c2130d2f4de95.js +0 -1
  122. package/web/.next/static/chunks/app/(dashboard)/connectors/page-cd7ee7dd1458ae47.js +0 -1
  123. package/web/.next/static/chunks/app/(dashboard)/credentials/page-73d252ca88f194f1.js +0 -1
  124. package/web/.next/static/chunks/app/(dashboard)/mcp/page-1b2bf2315b3b213e.js +0 -1
  125. package/web/.next/static/chunks/app/(dashboard)/memories/page-1e537215e80cb0c3.js +0 -1
  126. package/web/.next/static/chunks/app/(dashboard)/skills/page-a6736503d29a2f1c.js +0 -1
  127. package/web/.next/static/css/a161c147ca3606b3.css +0 -3
  128. /package/web/.next/static/{be4PVOMd_EIWn1rY3m-Q2 → RdognT8Zq7jK6wHyNY5k3}/_buildManifest.js +0 -0
  129. /package/web/.next/static/{be4PVOMd_EIWn1rY3m-Q2 → RdognT8Zq7jK6wHyNY5k3}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3141],{5977:(e,t,n)=>{n.d(t,{A:()=>r});var l=n(78604);let r=l.forwardRef((e,t)=>{let{alt:n,color:r="currentColor",size:a="1em",weight:i="regular",mirrored:s=!1,children:o,weights:d,...c}=e;return l.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:a,height:a,fill:r,viewBox:"0 0 256 256",transform:s?"scale(-1, 1)":void 0,...c},!!n&&l.createElement("title",null,n),o,d.get(i))});r.displayName="SSRBase"},14308:(e,t,n)=>{n.d(t,{A:()=>i});var l=n(3680),r=n(78604),a=n(51869);function i({open:e,title:t,message:n,confirmLabel:s="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:x}){let u=(0,r.useRef)(null),[m,p]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{p(!0)},[]),(0,r.useEffect)(()=>{if(e)return u.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&x()}},[e,x]),e&&m)?(0,a.createPortal)((0,l.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:x,"aria-hidden":"true"}),(0,l.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,l.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,l.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,l.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,l.jsx)("button",{ref:u,type:"button",onClick:x,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,l.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:s})]})]})]}),document.body):null}},28870:(e,t,n)=>{n.d(t,{A:()=>a});var l=n(3680),r=n(78604);function a({tabs:e,value:t,defaultValue:n,onChange:i}){let[s,o]=(0,r.useState)(t??n??e[0].value),d=t??s;return(0,l.jsx)("div",{className:"inline-flex gap-1 rounded-[11px] border border-rule-2 bg-paper p-1",role:"tablist",children:e.map(e=>{let n=e.value===d;return(0,l.jsxs)("button",{type:"button",role:"tab","aria-selected":n,onClick:()=>{void 0===t&&o(e.value),i?.(e.value)},className:`inline-flex h-[30px] items-center gap-2 rounded-lg border-0 px-3.5 text-[12.5px] font-medium leading-none transition-colors ${n?"bg-ink text-canvas":"bg-transparent text-ink-3 hover:text-ink-2"}`,children:[e.label,void 0!==e.count&&(0,l.jsxs)("span",{className:`font-mono text-[11px] leading-none ${n?"opacity-65":"opacity-60"}`,children:["\xb7 ",e.count]})]},e.value)})})}},32307:(e,t,n)=>{n.d(t,{A:()=>r});var l=n(3680);function r({title:e,subtitle:t,actions:n,className:a=""}){return(0,l.jsxs)("div",{className:`flex flex-wrap items-end justify-between gap-4 pt-7 pb-5 ${a}`,children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("h1",{className:"text-[28px] font-semibold leading-[1.15] tracking-[-0.015em] text-ink",children:e}),t&&(0,l.jsx)("p",{className:"mt-1.5 text-[13px] leading-[1.5] text-ink-3",children:t})]}),n&&(0,l.jsx)("div",{className:"shrink-0",children:n})]})}},32928:(e,t,n)=>{n.d(t,{e:()=>s});var l=n(78604),r=n(53087);let a=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),l.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),i=l.forwardRef((e,t)=>l.createElement(r.A,{ref:t,...e,weights:a}));i.displayName="MagnifyingGlassIcon";let s=i},42357:(e,t,n)=>{n.d(t,{A:()=>r});var l=n(3680);function r({items:e,value:t,onChange:n,className:a=""}){return(0,l.jsx)("div",{className:`flex flex-wrap items-center gap-2 ${a}`,children:e.map(e=>{let r=e.value===t;return(0,l.jsxs)("button",{type:"button",onClick:()=>n(e.value),className:`inline-flex h-8 items-center gap-1.5 rounded-[9px] border px-3.5 text-[12.5px] font-medium leading-none transition-colors ${r?"border-ink bg-ink text-canvas":"border-rule-2 bg-paper text-ink-2 hover:bg-hover"}`,children:[e.label,void 0!==e.count&&(0,l.jsx)("span",{className:`font-mono text-[11px] leading-none ${r?"opacity-65":"opacity-55"}`,children:e.count})]},e.value)})})}},53087:(e,t,n)=>{n.d(t,{A:()=>a});var l=n(78604);let r=(0,l.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),a=l.forwardRef((e,t)=>{let{alt:n,color:a,size:i,weight:s,mirrored:o,children:d,weights:c,...x}=e,{color:u="currentColor",size:m,weight:p="regular",mirrored:h=!1,...g}=l.useContext(r);return l.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=i?i:m,height:null!=i?i:m,fill:null!=a?a:u,viewBox:"0 0 256 256",transform:o||h?"scale(-1, 1)":void 0,...g,...x},!!n&&l.createElement("title",null,n),d,c.get(null!=s?s:p))});a.displayName="IconBase"},65668:(e,t,n)=>{n.d(t,{A:()=>r});var l=n(3680);function r({tabs:e,search:t,cta:n,extra:a,className:i=""}){return(0,l.jsxs)("div",{className:`flex flex-wrap items-center gap-2.5 pt-4 ${i}`,children:[e,(0,l.jsx)("div",{className:"flex-1"}),t,a,n]})}},66736:(e,t,n)=>{n.d(t,{A:()=>a});var l=n(3680),r=n(32928);function a({value:e,onChange:t,placeholder:n="Search…",minWidth:i=300,className:s=""}){return(0,l.jsxs)("div",{className:`flex h-[34px] items-center gap-2 rounded-[9px] border border-rule-2 bg-paper px-3 text-[12.5px] text-ink-4 ${s}`,style:{minWidth:i},children:[(0,l.jsx)(r.e,{size:13,className:"shrink-0"}),(0,l.jsx)("input",{type:"search",value:e,onChange:e=>t(e.target.value),placeholder:n,className:"flex-1 border-0 bg-transparent text-[13px] leading-none text-ink outline-none placeholder:text-ink-4"})]})}},77045:(e,t,n)=>{n.d(t,{A:()=>s});var l=n(3680),r=n(63363),a=n.n(r);let i={ink:"bg-ink text-canvas hover:brightness-[0.92]",coral:"bg-skill-vivid text-white hover:brightness-[0.94]",blue:"bg-conn-vivid text-white hover:brightness-[0.94]"};function s(e){let{children:t,variant:n="ink",size:r="md",className:s=""}=e,o=`inline-flex items-center justify-center gap-1.5 rounded-md font-medium leading-none border-0 cursor-pointer transition-[filter] ${"md"===r?"h-[34px] px-3.5 text-[13px]":"h-[30px] px-3 text-[12px]"} ${i[n]} ${s}`;if("href"in e&&e.href){let{href:n,variant:r,size:i,className:s,children:d,...c}=e;return(0,l.jsx)(a(),{href:n,className:o,...c,children:t})}let{variant:d,size:c,className:x,children:u,...m}=e;return(0,l.jsx)("button",{type:"button",className:o,...m,children:t})}},81630:(e,t,n)=>{n.d(t,{A:()=>s});var l=n(3680);let r={agent:"bg-agent-vivid text-[#0a0a0a]",skill:"bg-skill-vivid text-white",conn:"bg-conn-vivid text-white",ink:"bg-ink text-canvas",neutral:"bg-hover text-ink-3"},a={sm:"h-[30px] w-[30px]",md:"h-[34px] w-[34px]",lg:"h-[38px] w-[38px]",xl:"h-[42px] w-[42px]"},i={sm:"[&_svg]:h-[13px] [&_svg]:w-[13px]",md:"[&_svg]:h-[14px] [&_svg]:w-[14px]",lg:"[&_svg]:h-[16px] [&_svg]:w-[16px]",xl:"[&_svg]:h-[18px] [&_svg]:w-[18px]"};function s({variant:e,size:t="md",shape:n="round",background:o,children:d,className:c=""}){let x=o?"":r[e];return(0,l.jsx)("span",{style:o?{background:o}:void 0,className:`inline-flex shrink-0 items-center justify-center ${a[t]} ${i[t]} ${"round"===n?"rounded-full":"rounded-[9px]"} ${x} ${o?"text-white":""} ${c}`,children:d})}},82592:(e,t,n)=>{n.d(t,{A:()=>i});var l=n(3680);let r={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},a={ok:"animate-[blip_1.4s_ease-out_infinite]",lime:"animate-[blip-lime_1.5s_ease-out_infinite]",coral:"animate-[blip-coral_1.4s_ease-out_infinite]",blue:"animate-[blip-blue_1.4s_ease-out_infinite]"};function i({variant:e="ok",size:t="sm",animate:n=!0,className:s=""}){return(0,l.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${r[e]} ${n?a[e]:""} ${s}`})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6118],{10900:(e,t,n)=>{n.d(t,{m:()=>r,o:()=>o});let o={"google-oauth":{title:"Get your Google OAuth credentials",intro:"You need a Google Cloud project with the relevant APIs enabled.",steps:[{number:1,text:"Go to Google Cloud Console and create a new project (any name).",link:{href:"https://console.cloud.google.com/",label:"console.cloud.google.com"}},{number:2,text:"Enable each API your agents will use — click the links below, then hit Enable:",subLinks:[{href:"https://console.cloud.google.com/apis/library/drive.googleapis.com",label:"Drive API"},{href:"https://console.cloud.google.com/apis/library/gmail.googleapis.com",label:"Gmail API"},{href:"https://console.cloud.google.com/apis/library/sheets.googleapis.com",label:"Sheets API"},{href:"https://console.cloud.google.com/apis/library/docs.googleapis.com",label:"Docs API"}]},{number:3,text:"In the left menu, go to APIs & Services → OAuth consent screen. Choose User Type: External, fill in the app name, then add your own email as a Test user."},{number:4,text:"Go to APIs & Services → Credentials → Create credentials → OAuth client ID → Application type: Web application."},{number:5,text:"Under Authorized JavaScript origins, add the origin shown below the form."},{number:6,text:"Under Authorized redirect URIs, paste the redirect URI shown below the form. This step is mandatory — Google rejects the connection if it is missing or differs by even one character.",hint:"Most common cause of failure when trying to connect."},{number:7,text:"Click Create. A dialog shows your Client ID and Client secret. Copy both."},{number:8,text:"Paste them into the fields below."}],format:"Client ID ends with .apps.googleusercontent.com"},"notion-oauth":{title:"Get your Notion OAuth credentials",intro:"You need a Public integration — not an Internal one. The distinction matters.",steps:[{number:1,text:"Go to Notion integrations and click + New integration.",link:{href:"https://www.notion.so/my-integrations",label:"notion.so/my-integrations"}},{number:2,text:"Set Integration type to Public (not Internal — Internal tokens are single-workspace only and cannot do OAuth).",hint:'If you see no "Type" field, you are on the wrong page.'},{number:3,text:"Fill in a name and optional logo. Under Capabilities, check at minimum: Read content, Update content, Insert content."},{number:4,text:"In the OAuth Domain & URIs section, paste the redirect URI shown below the form. This step is mandatory — Notion rejects the connection if it is missing or differs by even one character.",hint:"Most common cause of failure when trying to connect."},{number:5,text:"Click Submit. On the integration page, open the Secrets tab."},{number:6,text:"Copy the OAuth client ID (a UUID) and the OAuth client secret."},{number:7,text:"Paste them into the fields below."}],format:"Client ID is a UUID. Secret starts with secret_"},"airtable-oauth":{title:"Get your Airtable OAuth credentials",warning:"Airtable only accepts localhost or an HTTPS redirect URI — raw LAN IPs (e.g. 192.168.x.x) are rejected. Open the dashboard at http://localhost:3000 just for this flow. The resulting credential works from any host afterwards.",warningWhen:"lan-ip-only",steps:[{number:1,text:"Go to the Airtable OAuth integration page and click Register new OAuth integration.",link:{href:"https://airtable.com/create/oauth",label:"airtable.com/create/oauth"}},{number:2,text:"Give it a name (e.g. Nodal-Agents)."},{number:3,text:"In the Redirect URIs section, paste the redirect URI shown below the form. This step is mandatory — Airtable rejects the connection if it is missing or differs by even one character.",hint:"Most common cause of failure when trying to connect."},{number:4,text:"In the Scopes section, check the four scopes: data.records:read, data.records:write, schema.bases:read, schema.bases:write — then save / update the integration so the scopes are persisted.",hint:'If the scopes are not saved, Airtable returns "invalid_scope" during the OAuth flow.'},{number:5,text:"Click Register integration (or Save changes if editing an existing one)."},{number:6,text:"On the integration detail page, copy the Client ID and Client secret."},{number:7,text:"Paste them into the fields below."}],format:"Client ID is a UUID. Secret is longer."}},r={notion:{title:"Get your Notion Internal Integration Token",intro:"This is the Internal integration flow — single workspace, no OAuth redirect. Different from the Notion OAuth credential.",steps:[{number:1,text:"Go to Notion integrations and click + New integration.",link:{href:"https://www.notion.so/my-integrations",label:"notion.so/my-integrations"}},{number:2,text:"Set Integration type to Internal (not Public). Select your workspace."},{number:3,text:"Under Capabilities, check at minimum: Read content, Update content, Insert content."},{number:4,text:"Click Submit. On the integration page, open the Secrets tab and copy the Internal Integration Token."},{number:5,text:"Important: for each Notion page the agent should access, open the page, click the \xb7\xb7\xb7 menu → Connections → select your integration name.",hint:'Without this step the agent gets "object not found" errors.'}],format:"Token starts with secret_"},airtable:{title:"Get your Airtable Personal Access Token",steps:[{number:1,text:"Go to the Airtable token creation page and click Create new token.",link:{href:"https://airtable.com/create/tokens",label:"airtable.com/create/tokens"}},{number:2,text:"Give it a name. Under Scopes, add at minimum: data.records:read, data.records:write, schema.bases:read."},{number:3,text:"Under Access, choose the specific bases to expose or select All workspaces."},{number:4,text:"Click Create token and copy the value immediately — Airtable hides it after you close the dialog."}],format:"Token starts with pat"},apify:{title:"Get your Apify API token",steps:[{number:1,text:"Go to the Apify integrations page.",link:{href:"https://console.apify.com/account/integrations",label:"console.apify.com/account/integrations"}},{number:2,text:"Under API tokens, either copy the default Personal API token or click Create new token to generate a dedicated one."},{number:3,text:"Paste the token into the field below."}],format:"Token starts with apify_api_"},firecrawl:{title:"Get your Firecrawl API key",steps:[{number:1,text:"Go to your Firecrawl account page and navigate to API Keys.",link:{href:"https://www.firecrawl.dev/account",label:"firecrawl.dev/account"}},{number:2,text:"Copy your existing key or click to generate a new one, then paste it below."}],format:"Key starts with fc-"},tavily:{title:"Get your Tavily API key",steps:[{number:1,text:"Go to the Tavily app and open the API section.",link:{href:"https://app.tavily.com/",label:"app.tavily.com"}},{number:2,text:"Copy your API key and paste it below."}],format:"Key starts with tvly-"}}},14308:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(3680),r=n(78604),a=n(51869);function i({open:e,title:t,message:n,confirmLabel:s="Confirm",cancelLabel:l="Cancel",destructive:c=!0,onConfirm:d,onCancel:h}){let u=(0,r.useRef)(null),[m,b]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{b(!0)},[]),(0,r.useEffect)(()=>{if(e)return u.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&h()}},[e,h]),e&&m)?(0,a.createPortal)((0,o.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,o.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:h,"aria-hidden":"true"}),(0,o.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,o.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,o.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,o.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,o.jsx)("button",{ref:u,type:"button",onClick:h,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:l}),(0,o.jsx)("button",{type:"button",onClick:d,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${c?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:s})]})]})]}),document.body):null}},27540:(e,t,n)=>{var o=n(71268);n.o(o,"usePathname")&&n.d(t,{usePathname:function(){return o.usePathname}}),n.o(o,"useRouter")&&n.d(t,{useRouter:function(){return o.useRouter}}),n.o(o,"useSearchParams")&&n.d(t,{useSearchParams:function(){return o.useSearchParams}})},36762:(e,t,n)=>{n.d(t,{A:()=>i});var o=n(3680),r=n(78604);let a=new Set(["localhost","127.0.0.1","::1"]);function i({guide:e}){let[t,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{n(!!e.warning&&("lan-ip-only"!==e.warningWhen||!a.has(window.location.hostname)))},[e.warning,e.warningWhen]),(0,o.jsxs)("div",{className:"space-y-3",children:[e.intro&&(0,o.jsx)("p",{className:"text-xs text-ink-3 italic",children:e.intro}),t&&e.warning&&(0,o.jsxs)("div",{role:"note",className:"flex gap-2 rounded-md border border-warn/30 bg-warn px-3 py-2 text-xs text-warn",children:[(0,o.jsx)("span",{"aria-hidden":"true",className:"font-bold",children:"!"}),(0,o.jsx)("span",{children:e.warning})]}),(0,o.jsx)("ol",{className:"space-y-2.5",children:e.steps.map(e=>(0,o.jsxs)("li",{className:"flex gap-2",children:[(0,o.jsx)("span",{className:"shrink-0 w-5 h-5 rounded-full bg-hover text-ink-3 text-[10px] font-bold flex items-center justify-center mt-0.5",children:e.number}),(0,o.jsxs)("div",{className:"space-y-1.5 text-sm text-ink-3",children:[(0,o.jsxs)("span",{children:[e.text,e.link&&(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{href:e.link.href,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline",children:e.link.label})]})]}),e.subLinks&&e.subLinks.length>0&&(0,o.jsx)("ul",{className:"mt-1 space-y-1 pl-1",children:e.subLinks.map(e=>(0,o.jsxs)("li",{className:"flex items-center gap-1.5 text-xs",children:[(0,o.jsx)("span",{className:"text-ink-4",children:"•"}),(0,o.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline",children:e.label})]},e.href))}),e.hint&&(0,o.jsx)("p",{className:"text-xs text-ink-3 italic",children:e.hint})]})]},e.number))}),e.format&&(0,o.jsxs)("p",{className:"text-xs text-ink-3",children:["Format: ",(0,o.jsx)("code",{className:"font-mono text-ink-3",children:e.format})]})]})}},38666:(e,t,n)=>{n.d(t,{A:()=>d});var o=n(3680),r=n(78604),a=n(51869),i=n(36762),s=n(10900);let l={"google-oauth":{label:"Google",callbackPath:"/api/oauth/google-oauth/callback",namePlaceholder:"Mon Google perso",clientIdLabel:"Client ID",clientSecretLabel:"Client secret"},"notion-oauth":{label:"Notion",callbackPath:"/api/oauth/notion-oauth/callback",namePlaceholder:"Mon Notion",clientIdLabel:"OAuth client ID",clientSecretLabel:"OAuth client secret"},"airtable-oauth":{label:"Airtable",callbackPath:"/api/oauth/airtable-oauth/callback",namePlaceholder:"Mon Airtable",clientIdLabel:"Client ID",clientSecretLabel:"Client secret"}},c=[{type:"google-oauth",label:"Google Workspace",description:"Drive, Gmail, Sheets, Docs"},{type:"notion-oauth",label:"Notion",description:"Public OAuth integration"},{type:"airtable-oauth",label:"Airtable",description:"Public OAuth integration"}];function d({initialType:e,returnToConnectorSlug:t,onClose:n}){let[h,u]=(0,r.useState)(e?"setup":"type"),[m,b]=(0,r.useState)(e??null),[p,x]=(0,r.useState)(""),[f,g]=(0,r.useState)(!1),k=(0,r.useRef)(null);(0,r.useEffect)(()=>{x(`${window.location.origin}${m?l[m].callbackPath:""}`)},[m]),(0,r.useEffect)(()=>{g(!0)},[]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&n()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);let y=m?l[m]:null,w=t?`/connectors?connectorSlug=${t}`:"/credentials",v=m?`/api/oauth/${m}/start`:"#";return f?(0,a.createPortal)((0,o.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"wizard-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,o.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:n,"aria-hidden":"true"}),(0,o.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl w-full max-w-lg shadow-2xl flex flex-col max-h-[90vh]",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-rule-2 shrink-0",children:[(0,o.jsx)("h2",{id:"wizard-title",className:"text-base font-semibold text-ink",children:"type"===h?"New credential":y?`Configure ${y.label} credential`:"Configure credential"}),(0,o.jsx)("button",{type:"button",onClick:n,className:"text-ink-3 hover:text-ink transition-colors text-xl leading-none","aria-label":"Close",children:"\xd7"})]}),"type"===h&&(0,o.jsxs)("div",{className:"overflow-y-auto px-6 py-5 space-y-3",children:[(0,o.jsx)("p",{className:"text-sm text-ink-3",children:"Choose the OAuth provider to connect to Nodal-Agents."}),(0,o.jsx)("div",{className:"space-y-2",children:c.map(e=>(0,o.jsxs)("button",{type:"button",onClick:()=>{b(e.type),u("setup")},className:"w-full text-left px-4 py-3 rounded-lg border border-rule-2 hover:border-rule hover:bg-hover transition-colors group",children:[(0,o.jsx)("div",{className:"text-sm font-semibold text-ink group-hover:text-ink",children:e.label}),(0,o.jsx)("div",{className:"text-xs text-ink-3 mt-0.5",children:e.description})]},e.type))}),(0,o.jsx)("div",{className:"pt-2 flex justify-end",children:(0,o.jsx)("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Cancel"})})]}),"setup"===h&&y&&m&&(0,o.jsxs)("form",{ref:k,method:"POST",action:v,encType:"application/x-www-form-urlencoded",className:"overflow-y-auto px-6 py-5 space-y-5",children:[(0,o.jsx)("input",{type:"hidden",name:"returnTo",value:w}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)("p",{className:"text-xs text-ink-3 font-semibold uppercase tracking-wider",children:"Setup instructions"}),(0,o.jsx)(i.A,{guide:s.o[m]})]}),(0,o.jsxs)("div",{className:"space-y-1",children:[(0,o.jsx)("p",{className:"text-xs text-ink-3",children:"Authorized redirect URI"}),(0,o.jsxs)("div",{className:"flex items-center gap-2 bg-hover border border-rule rounded-md px-3 py-2",children:[(0,o.jsx)("code",{className:"text-xs text-ink-2 font-mono flex-1 break-all",children:p||"…"}),(0,o.jsx)("button",{type:"button",onClick:function(){p&&navigator.clipboard.writeText(p).then(()=>{})},className:"shrink-0 px-2 py-0.5 text-xs font-medium border border-rule text-ink-3 rounded hover:border-ink-3 hover:text-ink transition-colors",children:"Copy"})]})]}),(0,o.jsxs)("div",{className:"space-y-3 border-t border-rule-2 pt-4",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Display name ",(0,o.jsx)("span",{className:"text-ink-4",children:"(optional)"})]}),(0,o.jsx)("input",{name:"name",placeholder:y.namePlaceholder,className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:y.clientIdLabel}),(0,o.jsx)("input",{name:"clientId",required:!0,autoComplete:"off",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none font-mono"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:y.clientSecretLabel}),(0,o.jsx)("input",{name:"clientSecret",type:"password",required:!0,autoComplete:"off",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none font-mono"})]})]}),(0,o.jsxs)("div",{className:"flex gap-2 justify-end pt-1",children:[(0,o.jsx)("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Cancel"}),!e&&(0,o.jsx)("button",{type:"button",onClick:()=>u("type"),className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Back"}),(0,o.jsxs)("button",{type:"submit",className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92]",children:["Continue with ",y.label]})]})]})]})]}),document.body):null}},77045:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(3680),r=n(63363),a=n.n(r);let i={ink:"bg-ink text-canvas hover:brightness-[0.92]",coral:"bg-skill-vivid text-white hover:brightness-[0.94]",blue:"bg-conn-vivid text-white hover:brightness-[0.94]"};function s(e){let{children:t,variant:n="ink",size:r="md",className:s=""}=e,l=`inline-flex items-center justify-center gap-1.5 rounded-md font-medium leading-none border-0 cursor-pointer transition-[filter] ${"md"===r?"h-[34px] px-3.5 text-[13px]":"h-[30px] px-3 text-[12px]"} ${i[n]} ${s}`;if("href"in e&&e.href){let{href:n,variant:r,size:i,className:s,children:c,...d}=e;return(0,o.jsx)(a(),{href:n,className:l,...d,children:t})}let{variant:c,size:d,className:h,children:u,...m}=e;return(0,o.jsx)("button",{type:"button",className:l,...m,children:t})}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4239],{10900:(e,t,n)=>{n.d(t,{m:()=>o,o:()=>a});let a={"google-oauth":{title:"Get your Google OAuth credentials",intro:"You need a Google Cloud project with the relevant APIs enabled.",steps:[{number:1,text:"Go to Google Cloud Console and create a new project (any name).",link:{href:"https://console.cloud.google.com/",label:"console.cloud.google.com"}},{number:2,text:"Enable each API your agents will use — click the links below, then hit Enable:",subLinks:[{href:"https://console.cloud.google.com/apis/library/drive.googleapis.com",label:"Drive API"},{href:"https://console.cloud.google.com/apis/library/gmail.googleapis.com",label:"Gmail API"},{href:"https://console.cloud.google.com/apis/library/sheets.googleapis.com",label:"Sheets API"},{href:"https://console.cloud.google.com/apis/library/docs.googleapis.com",label:"Docs API"}]},{number:3,text:"In the left menu, go to APIs & Services → OAuth consent screen. Choose User Type: External, fill in the app name, then add your own email as a Test user."},{number:4,text:"Go to APIs & Services → Credentials → Create credentials → OAuth client ID → Application type: Web application."},{number:5,text:"Under Authorized JavaScript origins, add the origin shown below the form."},{number:6,text:"Under Authorized redirect URIs, paste the redirect URI shown below the form. This step is mandatory — Google rejects the connection if it is missing or differs by even one character.",hint:"Most common cause of failure when trying to connect."},{number:7,text:"Click Create. A dialog shows your Client ID and Client secret. Copy both."},{number:8,text:"Paste them into the fields below."}],format:"Client ID ends with .apps.googleusercontent.com"},"notion-oauth":{title:"Get your Notion OAuth credentials",intro:"You need a Public integration — not an Internal one. The distinction matters.",steps:[{number:1,text:"Go to Notion integrations and click + New integration.",link:{href:"https://www.notion.so/my-integrations",label:"notion.so/my-integrations"}},{number:2,text:"Set Integration type to Public (not Internal — Internal tokens are single-workspace only and cannot do OAuth).",hint:'If you see no "Type" field, you are on the wrong page.'},{number:3,text:"Fill in a name and optional logo. Under Capabilities, check at minimum: Read content, Update content, Insert content."},{number:4,text:"In the OAuth Domain & URIs section, paste the redirect URI shown below the form. This step is mandatory — Notion rejects the connection if it is missing or differs by even one character.",hint:"Most common cause of failure when trying to connect."},{number:5,text:"Click Submit. On the integration page, open the Secrets tab."},{number:6,text:"Copy the OAuth client ID (a UUID) and the OAuth client secret."},{number:7,text:"Paste them into the fields below."}],format:"Client ID is a UUID. Secret starts with secret_"},"airtable-oauth":{title:"Get your Airtable OAuth credentials",warning:"Airtable only accepts localhost or an HTTPS redirect URI — raw LAN IPs (e.g. 192.168.x.x) are rejected. Open the dashboard at http://localhost:3000 just for this flow. The resulting credential works from any host afterwards.",warningWhen:"lan-ip-only",steps:[{number:1,text:"Go to the Airtable OAuth integration page and click Register new OAuth integration.",link:{href:"https://airtable.com/create/oauth",label:"airtable.com/create/oauth"}},{number:2,text:"Give it a name (e.g. Nodal-Agents)."},{number:3,text:"In the Redirect URIs section, paste the redirect URI shown below the form. This step is mandatory — Airtable rejects the connection if it is missing or differs by even one character.",hint:"Most common cause of failure when trying to connect."},{number:4,text:"In the Scopes section, check the four scopes: data.records:read, data.records:write, schema.bases:read, schema.bases:write — then save / update the integration so the scopes are persisted.",hint:'If the scopes are not saved, Airtable returns "invalid_scope" during the OAuth flow.'},{number:5,text:"Click Register integration (or Save changes if editing an existing one)."},{number:6,text:"On the integration detail page, copy the Client ID and Client secret."},{number:7,text:"Paste them into the fields below."}],format:"Client ID is a UUID. Secret is longer."}},o={notion:{title:"Get your Notion Internal Integration Token",intro:"This is the Internal integration flow — single workspace, no OAuth redirect. Different from the Notion OAuth credential.",steps:[{number:1,text:"Go to Notion integrations and click + New integration.",link:{href:"https://www.notion.so/my-integrations",label:"notion.so/my-integrations"}},{number:2,text:"Set Integration type to Internal (not Public). Select your workspace."},{number:3,text:"Under Capabilities, check at minimum: Read content, Update content, Insert content."},{number:4,text:"Click Submit. On the integration page, open the Secrets tab and copy the Internal Integration Token."},{number:5,text:"Important: for each Notion page the agent should access, open the page, click the \xb7\xb7\xb7 menu → Connections → select your integration name.",hint:'Without this step the agent gets "object not found" errors.'}],format:"Token starts with secret_"},airtable:{title:"Get your Airtable Personal Access Token",steps:[{number:1,text:"Go to the Airtable token creation page and click Create new token.",link:{href:"https://airtable.com/create/tokens",label:"airtable.com/create/tokens"}},{number:2,text:"Give it a name. Under Scopes, add at minimum: data.records:read, data.records:write, schema.bases:read."},{number:3,text:"Under Access, choose the specific bases to expose or select All workspaces."},{number:4,text:"Click Create token and copy the value immediately — Airtable hides it after you close the dialog."}],format:"Token starts with pat"},apify:{title:"Get your Apify API token",steps:[{number:1,text:"Go to the Apify integrations page.",link:{href:"https://console.apify.com/account/integrations",label:"console.apify.com/account/integrations"}},{number:2,text:"Under API tokens, either copy the default Personal API token or click Create new token to generate a dedicated one."},{number:3,text:"Paste the token into the field below."}],format:"Token starts with apify_api_"},firecrawl:{title:"Get your Firecrawl API key",steps:[{number:1,text:"Go to your Firecrawl account page and navigate to API Keys.",link:{href:"https://www.firecrawl.dev/account",label:"firecrawl.dev/account"}},{number:2,text:"Copy your existing key or click to generate a new one, then paste it below."}],format:"Key starts with fc-"},tavily:{title:"Get your Tavily API key",steps:[{number:1,text:"Go to the Tavily app and open the API section.",link:{href:"https://app.tavily.com/",label:"app.tavily.com"}},{number:2,text:"Copy your API key and paste it below."}],format:"Key starts with tvly-"}}},27540:(e,t,n)=>{var a=n(71268);n.o(a,"usePathname")&&n.d(t,{usePathname:function(){return a.usePathname}}),n.o(a,"useRouter")&&n.d(t,{useRouter:function(){return a.useRouter}}),n.o(a,"useSearchParams")&&n.d(t,{useSearchParams:function(){return a.useSearchParams}})},36762:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(3680),o=n(78604);let r=new Set(["localhost","127.0.0.1","::1"]);function i({guide:e}){let[t,n]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{n(!!e.warning&&("lan-ip-only"!==e.warningWhen||!r.has(window.location.hostname)))},[e.warning,e.warningWhen]),(0,a.jsxs)("div",{className:"space-y-3",children:[e.intro&&(0,a.jsx)("p",{className:"text-xs text-ink-3 italic",children:e.intro}),t&&e.warning&&(0,a.jsxs)("div",{role:"note",className:"flex gap-2 rounded-md border border-warn/30 bg-warn px-3 py-2 text-xs text-warn",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"font-bold",children:"!"}),(0,a.jsx)("span",{children:e.warning})]}),(0,a.jsx)("ol",{className:"space-y-2.5",children:e.steps.map(e=>(0,a.jsxs)("li",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"shrink-0 w-5 h-5 rounded-full bg-hover text-ink-3 text-[10px] font-bold flex items-center justify-center mt-0.5",children:e.number}),(0,a.jsxs)("div",{className:"space-y-1.5 text-sm text-ink-3",children:[(0,a.jsxs)("span",{children:[e.text,e.link&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsx)("a",{href:e.link.href,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline",children:e.link.label})]})]}),e.subLinks&&e.subLinks.length>0&&(0,a.jsx)("ul",{className:"mt-1 space-y-1 pl-1",children:e.subLinks.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-1.5 text-xs",children:[(0,a.jsx)("span",{className:"text-ink-4",children:"•"}),(0,a.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline",children:e.label})]},e.href))}),e.hint&&(0,a.jsx)("p",{className:"text-xs text-ink-3 italic",children:e.hint})]})]},e.number))}),e.format&&(0,a.jsxs)("p",{className:"text-xs text-ink-3",children:["Format: ",(0,a.jsx)("code",{className:"font-mono text-ink-3",children:e.format})]})]})}},38666:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(3680),o=n(78604),r=n(51869),i=n(36762),l=n(10900);let s={"google-oauth":{label:"Google",callbackPath:"/api/oauth/google-oauth/callback",namePlaceholder:"Mon Google perso",clientIdLabel:"Client ID",clientSecretLabel:"Client secret"},"notion-oauth":{label:"Notion",callbackPath:"/api/oauth/notion-oauth/callback",namePlaceholder:"Mon Notion",clientIdLabel:"OAuth client ID",clientSecretLabel:"OAuth client secret"},"airtable-oauth":{label:"Airtable",callbackPath:"/api/oauth/airtable-oauth/callback",namePlaceholder:"Mon Airtable",clientIdLabel:"Client ID",clientSecretLabel:"Client secret"}},c=[{type:"google-oauth",label:"Google Workspace",description:"Drive, Gmail, Sheets, Docs"},{type:"notion-oauth",label:"Notion",description:"Public OAuth integration"},{type:"airtable-oauth",label:"Airtable",description:"Public OAuth integration"}];function d({initialType:e,returnToConnectorSlug:t,onClose:n}){let[h,u]=(0,o.useState)(e?"setup":"type"),[m,p]=(0,o.useState)(e??null),[b,x]=(0,o.useState)(""),[g,f]=(0,o.useState)(!1),y=(0,o.useRef)(null);(0,o.useEffect)(()=>{x(`${window.location.origin}${m?s[m].callbackPath:""}`)},[m]),(0,o.useEffect)(()=>{f(!0)},[]),(0,o.useEffect)(()=>{function e(e){"Escape"===e.key&&n()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);let k=m?s[m]:null,w=t?`/connectors?connectorSlug=${t}`:"/credentials",v=m?`/api/oauth/${m}/start`:"#";return g?(0,r.createPortal)((0,a.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"wizard-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:n,"aria-hidden":"true"}),(0,a.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl w-full max-w-lg shadow-2xl flex flex-col max-h-[90vh]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-rule-2 shrink-0",children:[(0,a.jsx)("h2",{id:"wizard-title",className:"text-base font-semibold text-ink",children:"type"===h?"New credential":k?`Configure ${k.label} credential`:"Configure credential"}),(0,a.jsx)("button",{type:"button",onClick:n,className:"text-ink-3 hover:text-ink transition-colors text-xl leading-none","aria-label":"Close",children:"\xd7"})]}),"type"===h&&(0,a.jsxs)("div",{className:"overflow-y-auto px-6 py-5 space-y-3",children:[(0,a.jsx)("p",{className:"text-sm text-ink-3",children:"Choose the OAuth provider to connect to Nodal-Agents."}),(0,a.jsx)("div",{className:"space-y-2",children:c.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{p(e.type),u("setup")},className:"w-full text-left px-4 py-3 rounded-lg border border-rule-2 hover:border-rule hover:bg-hover transition-colors group",children:[(0,a.jsx)("div",{className:"text-sm font-semibold text-ink group-hover:text-ink",children:e.label}),(0,a.jsx)("div",{className:"text-xs text-ink-3 mt-0.5",children:e.description})]},e.type))}),(0,a.jsx)("div",{className:"pt-2 flex justify-end",children:(0,a.jsx)("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Cancel"})})]}),"setup"===h&&k&&m&&(0,a.jsxs)("form",{ref:y,method:"POST",action:v,encType:"application/x-www-form-urlencoded",className:"overflow-y-auto px-6 py-5 space-y-5",children:[(0,a.jsx)("input",{type:"hidden",name:"returnTo",value:w}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-xs text-ink-3 font-semibold uppercase tracking-wider",children:"Setup instructions"}),(0,a.jsx)(i.A,{guide:l.o[m]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-xs text-ink-3",children:"Authorized redirect URI"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 bg-hover border border-rule rounded-md px-3 py-2",children:[(0,a.jsx)("code",{className:"text-xs text-ink-2 font-mono flex-1 break-all",children:b||"…"}),(0,a.jsx)("button",{type:"button",onClick:function(){b&&navigator.clipboard.writeText(b).then(()=>{})},className:"shrink-0 px-2 py-0.5 text-xs font-medium border border-rule text-ink-3 rounded hover:border-ink-3 hover:text-ink transition-colors",children:"Copy"})]})]}),(0,a.jsxs)("div",{className:"space-y-3 border-t border-rule-2 pt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Display name ",(0,a.jsx)("span",{className:"text-ink-4",children:"(optional)"})]}),(0,a.jsx)("input",{name:"name",placeholder:k.namePlaceholder,className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:k.clientIdLabel}),(0,a.jsx)("input",{name:"clientId",required:!0,autoComplete:"off",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none font-mono"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:k.clientSecretLabel}),(0,a.jsx)("input",{name:"clientSecret",type:"password",required:!0,autoComplete:"off",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none font-mono"})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end pt-1",children:[(0,a.jsx)("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Cancel"}),!e&&(0,a.jsx)("button",{type:"button",onClick:()=>u("type"),className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Back"}),(0,a.jsxs)("button",{type:"submit",className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92]",children:["Continue with ",k.label]})]})]})]})]}),document.body):null}},40189:(e,t,n)=>{n.d(t,{F:()=>l});var a=n(78604),o=n(53087);let r=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),a.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),i=a.forwardRef((e,t)=>a.createElement(o.A,{ref:t,...e,weights:r}));i.displayName="PlusIcon";let l=i}}]);
@@ -0,0 +1,2 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3990],{14308:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var s=n(3680),l=n(78604),r=n(51869);function a({open:e,title:t,message:n,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:x}){let p=(0,l.useRef)(null),[u,h]=(0,l.useState)(!1);return((0,l.useEffect)(()=>{h(!0)},[]),(0,l.useEffect)(()=>{if(e)return p.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&x()}},[e,x]),e&&u)?(0,r.createPortal)((0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:x,"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,s.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,s.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)("button",{ref:p,type:"button",onClick:x,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,s.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:i})]})]})]}),document.body):null}},21021:(e,t,n)=>{"use strict";n.d(t,{a:()=>s,d:()=>r});let s={gmail:"#ea4335","google-drive":"#4285f4","google-sheets":"#0f9d58","google-docs":"#4285f4","google-calendar":"#4285f4",notion:"#000000","notion-oauth":"#000000",airtable:"#f82b60","airtable-oauth":"#f82b60",github:"#24292f",linear:"#5e6ad2",hubspot:"#ff7a59",slack:"#4a154b",intercom:"#1f8ced",stripe:"#635bff",postgres:"#336791",apify:"#00aeff",firecrawl:"#f97316",tavily:"#6366f1",composio:"#000000"},l={gmail:"Gm","google-drive":"GD","google-sheets":"GS","google-docs":"GD","google-calendar":"GC",notion:"No","notion-oauth":"No",airtable:"At","airtable-oauth":"At",github:"Gh",linear:"Li",hubspot:"HS",slack:"Sl",intercom:"IC",stripe:"St",postgres:"PG",apify:"Ap",firecrawl:"FC",tavily:"Tv",composio:"Co","custom-http-mcp":"+","custom-stdio-mcp":"+","cogni-cortex":"CX"};function r(e,t){return l[e]??t.slice(0,2).toUpperCase()}},25569:(e,t,n)=>{"use strict";n.d(t,{default:()=>B});var s=n(3680),l=n(78604),r=n(63363),a=n.n(r),i=n(27540),o=n(39504),d=n(22799),c=n(56662),x=n(61453),p=n(81906),u=n(80957),h=n(14099),m=n(26772),g=n(64678);let b=(0,g.createServerReference)("40ffaf8c97556d0f3ad537a65cfec2da1aa1e4e8c1",g.callServer,void 0,g.findSourceMapURL,"listAgentWorkspacesAction");var f=n(84702);let v=(0,g.createServerReference)("600e0953c9bf07c855dd2594e0ddd89ab55dd5a6e2",g.callServer,void 0,g.findSourceMapURL,"listWorkspaceFilesAction"),k=(0,g.createServerReference)("706c95b5e87b8cb6971879d5bd751ec9e4bda62b77",g.callServer,void 0,g.findSourceMapURL,"uploadToWorkspaceAction"),j=(0,g.createServerReference)("70f977bbfc491ca6c40163e19afe9520f05b964eed",g.callServer,void 0,g.findSourceMapURL,"deleteWorkspaceFileAction"),N=(0,g.createServerReference)("70a9cb625cbe08586591f3ceb5e1e254c5a216703a",g.callServer,void 0,g.findSourceMapURL,"addAgentWorkspaceAction"),w=(0,g.createServerReference)("40ba79c62d08b89048f332e5396c510a9b5eba16ee",g.callServer,void 0,g.findSourceMapURL,"removeAgentWorkspaceAction");var y=n(14308),S=n(63217),C=n(79716),A=n(37955),M=n(81630);function R({glyph:e,name:t,description:n,meta:l,actions:r,expanded:a,className:i=""}){return(0,s.jsxs)("div",{className:`overflow-hidden rounded-[10px] border border-rule-2 bg-paper ${i}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-3.5 px-4 py-3.5",children:[e&&(0,s.jsx)("div",{className:"flex-shrink-0",children:e}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-[13.5px] font-medium leading-[1.2] text-ink",children:t}),n&&(0,s.jsx)("div",{className:"mt-0.5 truncate text-[12px] leading-[1.3] text-ink-3",children:n})]}),l&&(0,s.jsx)("div",{className:"flex-shrink-0 font-mono text-[10.5px] tracking-[0.04em] text-ink-4",children:l}),r&&(0,s.jsx)("div",{className:"flex flex-shrink-0 items-center gap-2",children:r})]}),a&&(0,s.jsx)("div",{className:"space-y-2 border-t border-rule-2 bg-canvas/40 px-4 py-3",children:a})]})}function $({onClick:e,title:t,children:n,ariaLabel:l}){return(0,s.jsx)("button",{type:"button",onClick:e,title:t,"aria-label":l??t,className:"flex h-7 w-7 items-center justify-center rounded-md border border-rule text-ink-3 transition-colors hover:bg-hover hover:text-ink",children:n})}var L=n(35196),I=n(21021);let W=(0,g.createServerReference)("78f15e9f899979d7cf869000d8777e4d21494b6bc0",g.callServer,void 0,g.findSourceMapURL,"setAgentConnectorAssignmentAction"),O=(0,g.createServerReference)("78b3c18c651f014406b65738059cb0bb0e3cc717e2",g.callServer,void 0,g.findSourceMapURL,"setAgentMcpServerAssignmentAction");function P({onClick:e,href:t,children:n,className:l=""}){let r=`flex h-[42px] w-full items-center justify-center gap-2 rounded-[10px] border border-dashed border-rule bg-paper/40 text-[13px] font-medium text-ink-3 transition-colors hover:bg-paper/60 hover:text-ink-2 ${l}`,a=(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,s.jsx)("path",{d:"M7 2v10M2 7h10"})});return t?(0,s.jsxs)("a",{href:t,className:r,children:[a,n]}):(0,s.jsxs)("button",{type:"button",onClick:e,className:r,children:[a,n]})}function _({agentId:e,connectors:t,mcpServers:n}){let[r,a]=(0,l.useState)(()=>{let e=new Map;for(let n of t)e.set(n.connectorId,{assigned:n.assigned,enabledOperations:n.enabledOperations});return e}),[i,d]=(0,l.useState)(()=>{let e=new Map;for(let t of n)e.set(t.mcpServerId,{assigned:t.assigned,enabledTools:t.enabledTools});return e}),[c,x]=(0,l.useState)(new Set),p=(0,l.useRef)(new Map),u=(0,l.useCallback)((t,n,s)=>{let l=`conn:${t}`,r=p.current.get(l);r&&clearTimeout(r);let a=setTimeout(()=>{p.current.delete(l),W(e,t,n,s).then(e=>{e.ok||o.oR.error(e.message)})},300);p.current.set(l,a)},[e]),h=(0,l.useCallback)((t,n,s)=>{let l=`mcp:${t}`,r=p.current.get(l);r&&clearTimeout(r);let a=setTimeout(()=>{p.current.delete(l),O(e,t,n,s).then(e=>{e.ok||o.oR.error(e.message)})},300);p.current.set(l,a)},[e]);function m(e,t){a(n=>{let s=new Map(n);return s.set(e,{assigned:t,enabledOperations:null}),u(e,t,null),s}),t||f(e)}function g(e,t){d(n=>{let s=new Map(n);return s.set(e,{assigned:t,enabledTools:null}),h(e,t,null),s}),t||f(e)}function b(e){x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function f(e){x(t=>{let n=new Set(t);return n.delete(e),n})}let{connected:v,available:k}=(0,l.useMemo)(()=>{let e=[],s=[];for(let n of t){let t=r.get(n.connectorId)??n,l={kind:"api",row:n};t.assigned?e.push(l):s.push(l)}for(let t of n){let n=i.get(t.mcpServerId)??t,l={kind:"mcp",row:t};n.assigned?e.push(l):s.push(l)}return{connected:e,available:s}},[t,n,r,i]);if(0===t.length&&0===n.length)return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-[12.5px] text-ink-3",children:"No connectors or MCP servers installed on this workspace yet. Add some first; you'll then be able to attach them to this agent."}),(0,s.jsx)(P,{href:"/connectors",children:"Browse connectors marketplace"}),(0,s.jsx)(P,{href:"/mcp",children:"Browse MCP servers"})]});return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)(T,{label:`Connected \xb7 ${v.length}`,hint:"Revoke any to detach everywhere. Per-op (API) / per-tool (MCP) whitelist via the gear icon.",children:[0===v.length&&(0,s.jsx)("p",{className:"text-[12.5px] text-ink-3",children:"No connectors or MCP servers attached to this agent yet. Pick from the list below."}),v.map(e=>j(e,!0))]}),k.length>0&&(0,s.jsx)(T,{label:`Available on this workspace \xb7 ${k.length}`,hint:"Already installed at the workspace level; click + to attach to this agent.",children:k.map(e=>j(e,!1))}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(P,{href:"/connectors",children:"Browse connectors marketplace"}),(0,s.jsx)(P,{href:"/mcp",children:"Browse MCP servers"})]})]});function j(e,t){if("api"===e.kind){let n=e.row,l=r.get(n.connectorId)??n,i=c.has(n.connectorId),o=n.availableOperations,d=null===l.enabledOperations?`all ${o.length} ops`:`${l.enabledOperations.length} of ${o.length} ops`;return(0,s.jsx)(R,{glyph:(0,s.jsx)(M.A,{variant:"conn",size:"lg",shape:"square",background:I.a[n.slug],children:(0,s.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:(0,I.d)(n.slug,n.label)})}),name:(0,s.jsxs)(s.Fragment,{children:[n.label,(0,s.jsx)(U,{kind:"API"})]}),description:n.credentialName??void 0,meta:t?d:`${o.length} ops`,actions:t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)($,{title:i?"Hide operations":"Configure operations",ariaLabel:"Configure",onClick:()=>b(n.connectorId),children:(0,s.jsx)(F,{})}),(0,s.jsx)($,{title:"Detach from this agent",ariaLabel:"Detach",onClick:()=>m(n.connectorId,!1),children:(0,s.jsx)(E,{})})]}):(0,s.jsx)($,{title:"Attach to this agent",ariaLabel:"Attach",onClick:()=>m(n.connectorId,!0),children:(0,s.jsx)(K,{})}),expanded:t&&i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(z,{onClick:()=>{var e;return e=n.connectorId,void a(t=>{let n=new Map(t);return n.set(e,{assigned:!0,enabledOperations:null}),u(e,!0,null),n})},children:"Enable all"}),(0,s.jsx)(z,{onClick:()=>m(n.connectorId,!1),children:"Uncheck all"})]}),(0,s.jsx)("div",{className:"space-y-0.5",children:o.map(e=>{let t=null===l.enabledOperations||l.enabledOperations.includes(e.slug);return(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded px-1 py-1 text-[12.5px] transition-colors hover:bg-hover",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var t,s;return t=n.connectorId,s=e.slug,void a(e=>{let n,l=e.get(t)??{assigned:!0,enabledOperations:null},r=o.map(e=>e.slug);null!==(n=null===l.enabledOperations?r.filter(e=>e!==s):l.enabledOperations.includes(s)?l.enabledOperations.filter(e=>e!==s):[...l.enabledOperations,s])&&n.length===r.length&&(n=null);let a=new Map(e);return null!==n&&0===n.length?(a.set(t,{assigned:!1,enabledOperations:null}),u(t,!1,null),f(t)):(a.set(t,{...l,enabledOperations:n}),u(t,!0,n)),a})},className:"shrink-0 accent-agent-vivid"}),(0,s.jsx)("code",{className:"shrink-0 font-mono text-[11px] text-ink-2",children:e.slug}),(0,s.jsx)(D,{op:e}),e.description&&(0,s.jsx)("span",{className:"truncate text-[11px] italic text-ink-4",children:e.description})]},e.slug)})})]}):null},`conn:${n.connectorId}`)}let n=e.row,l=i.get(n.mcpServerId)??n,o=c.has(n.mcpServerId),x=n.availableTools.map(e=>e.name),p=null===l.enabledTools?`all ${x.length} tools`:`${l.enabledTools.length} of ${x.length} tools`;return(0,s.jsx)(R,{glyph:(0,s.jsx)(M.A,{variant:"conn",size:"lg",shape:"square",children:(0,s.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:"MCP"})}),name:(0,s.jsxs)(s.Fragment,{children:[n.label,(0,s.jsx)(U,{kind:"MCP"})]}),meta:t?p:`${x.length} tools`,actions:t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)($,{title:o?"Hide tools":"Configure tools",ariaLabel:"Configure",onClick:()=>b(n.mcpServerId),children:(0,s.jsx)(F,{})}),(0,s.jsx)($,{title:"Detach from this agent",ariaLabel:"Detach",onClick:()=>g(n.mcpServerId,!1),children:(0,s.jsx)(E,{})})]}):(0,s.jsx)($,{title:"Attach to this agent",ariaLabel:"Attach",onClick:()=>g(n.mcpServerId,!0),children:(0,s.jsx)(K,{})}),expanded:t&&o?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(z,{onClick:()=>{var e;return e=n.mcpServerId,void d(t=>{let n=new Map(t);return n.set(e,{assigned:!0,enabledTools:null}),h(e,!0,null),n})},children:"Enable all"}),(0,s.jsx)(z,{onClick:()=>g(n.mcpServerId,!1),children:"Uncheck all"})]}),(0,s.jsx)("div",{className:"space-y-0.5",children:n.availableTools.map(e=>{let t=null===l.enabledTools||l.enabledTools.includes(e.name);return(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded px-1 py-1 text-[12.5px] transition-colors hover:bg-hover",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var t,s;return t=n.mcpServerId,s=e.name,void d(e=>{let n,l=e.get(t)??{assigned:!0,enabledTools:null};null!==(n=null===l.enabledTools?x.filter(e=>e!==s):l.enabledTools.includes(s)?l.enabledTools.filter(e=>e!==s):[...l.enabledTools,s])&&n.length===x.length&&(n=null);let r=new Map(e);return null!==n&&0===n.length?(r.set(t,{assigned:!1,enabledTools:null}),h(t,!1,null),f(t)):(r.set(t,{assigned:!0,enabledTools:n}),h(t,!0,n)),r})},className:"shrink-0 accent-agent-vivid"}),(0,s.jsx)("code",{className:"shrink-0 font-mono text-[11px] text-ink-2",children:e.name}),e.description&&(0,s.jsx)("span",{className:"truncate text-[11px] italic text-ink-4",children:e.description})]},e.name)})})]}):null},`mcp:${n.mcpServerId}`)}}function T({label:e,hint:t,children:n}){return(0,s.jsxs)("section",{className:"space-y-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:e}),t&&(0,s.jsx)("p",{className:"mt-1 text-[11.5px] leading-[1.5] text-ink-3",children:t})]}),(0,s.jsx)("div",{className:"space-y-2",children:n})]})}function U({kind:e}){return(0,s.jsx)("span",{className:"ml-2 font-mono text-[10px] uppercase tracking-[0.04em] text-ink-4",children:e})}function z({children:e,onClick:t}){return(0,s.jsx)("button",{type:"button",onClick:t,className:"rounded border border-rule px-2 py-1 text-[11px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink",children:e})}function D({op:e}){let t="inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[9.5px] font-semibold uppercase tracking-wider";return"read"===e.risk?(0,s.jsx)("span",{className:`${t} bg-agent-vivid/10 text-ok`,children:"read"}):"write"===e.risk?(0,s.jsxs)("span",{className:`${t} bg-warn/10 text-warn`,children:[e.requiresApproval?"⚠ ":"","write"]}):(0,s.jsx)("span",{className:`${t} bg-warn-bg text-err`,children:"⚠ destr"})}function F(){return(0,s.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,s.jsx)("circle",{cx:"8",cy:"8",r:"2"}),(0,s.jsx)("circle",{cx:"8",cy:"8",r:"6"})]})}function E(){return(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:(0,s.jsx)("path",{d:"M3 3l6 6M9 3l-6 6"})})}function K(){return(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:(0,s.jsx)("path",{d:"M6 2v8M2 6h8"})})}function B({agent:e,peers:t,llmKeys:n,connectors:r,mcpServers:a,jobs:d,attachedSkills:c}){var x,p;let u=(0,i.useRouter)(),[h,m]=(0,l.useTransition)(),[g,v]=(0,l.useState)("overview"),k=(x=e.role??null,p=e.orchestratorMode??null,"orchestrator"===x&&"planner"===p?"planner":"orchestrator"===x?"router":"worker"),j=(0,l.useMemo)(()=>n.filter(e=>e.isActive),[n]),N=e.llmKeyId??j[0]?.id??"",[w,y]=(0,l.useState)(e.name),[A,M]=(0,l.useState)(e.personality??""),[R,$]=(0,l.useState)(k),[I,W]=(0,l.useState)(e.subAgentIds),[O,P]=(0,l.useState)(N),[T,U]=(0,l.useState)(e.model??""),[z,D]=(0,l.useState)(e.avatarUrl??null),[F,E]=(0,l.useState)([]),[K,J]=(0,l.useState)(!1);(0,l.useEffect)(()=>{b(e.id).then(e=>{e.ok&&E(e.data),J(!0)})},[e.id]);let Y=(0,l.useMemo)(()=>n.find(e=>e.id===O)??null,[n,O]),Q=(0,l.useMemo)(()=>(0,C.P)(T),[T]),Z=(0,l.useMemo)(()=>j.filter(e=>(0,C.$)(T,e.provider)),[j,T]),et=!Y||(0,C.$)(T,Y.provider),en=0===j.length,es=(e.name||e.slug).slice(0,1).toUpperCase(),ea=r.filter(e=>e.assigned),ei=ea.length,eo=a.filter(e=>e.assigned).length,ed="worker"===R?0:I.length,ec=(A||"").split(/\n+/).filter(Boolean)[0]?.trim()??"No description yet.",ex=d.length,ep=d.filter(e=>"completed"===e.status).length,eu=w!==e.name||A!==(e.personality??"")||R!==k||JSON.stringify([...I].sort())!==JSON.stringify([...e.subAgentIds].sort())||O!==N||T!==(e.model??"")||z!==(e.avatarUrl??null);return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(G,{}),(0,s.jsx)(q,{agents:[{id:e.id,name:e.name,slug:e.slug},...t],activeId:e.id}),(0,s.jsx)(H,{initial:es,avatarUrl:z,name:e.name,personaPreview:ec,role:k,slug:e.slug,model:e.model,llmKeyLabel:n.find(t=>t.id===e.llmKeyId)?.nickname??(n.find(t=>t.id===e.llmKeyId)?.provider?(0,S.R)(n.find(t=>t.id===e.llmKeyId).provider):null),stats:{connectors:ei,mcps:eo,subAgents:ed,skills:c.length,totalRuns:ex,successfulRuns:ep},onConfigure:()=>v("settings")}),(0,s.jsx)(V,{tab:g,onChange:v,counts:{skills:c.length,connectors:ei+eo,runs:ex}}),"overview"===g&&(0,s.jsx)(ee,{jobs:d,attachedSkills:c,connectorsAssigned:ea,mcpsAssignedCount:eo,onOpenSkills:()=>v("skills"),onOpenConnectors:()=>v("connectors")}),"skills"===g&&(0,s.jsx)(el,{skills:c}),"connectors"===g&&(0,s.jsx)(X,{children:(0,s.jsx)(_,{agentId:e.id,connectors:r,mcpServers:a},e.id)}),"runs"===g&&(0,s.jsx)(L.default,{jobs:d,agents:[{id:e.id,name:e.name,slug:e.slug},...t],agentId:e.id}),"settings"===g&&(0,s.jsx)(er,{name:w,slug:e.slug,avatarUrl:z,personality:A,role:R,showSubAgents:"worker"!==R,subAgentIds:I,peers:t,llmKeyId:O,activeKeys:j,selectedKey:Y,model:T,coherenceOk:et,detectedProviders:Q,compatibleActiveKeys:Z,noLlmKeys:en,workspaces:F,workspacesLoaded:K,onWorkspacesChange:E,mcpServers:a,agentId:e.id,dirty:eu,isPending:h,onChangeName:y,onChangeAvatar:D,onChangePersonality:M,onChangeRole:$,onToggleSubAgent:function(e){W(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},onChangeLlmKey:function(e){let t=n.find(t=>t.id===e),s=Y?.defaultModel??null;P(e),t?.defaultModel&&(!T||T===s)&&U(t.defaultModel)},onChangeModel:function(e){if(U(e),!Y||(0,C.$)(e,Y.provider))return;let t=j.filter(t=>(0,C.$)(e,t.provider));1===t.length&&t[0]&&(P(t[0].id),o.oR.success(`Switched provider to ${(0,S.R)(t[0].provider)} (matches ${e})`))},onSwitchKey:P,onSave:function(){if(!et||en||h||!eu)return;let t={id:e.id,name:w,personality:A,model:T,llmKeyId:O||null,role:R,subAgentIds:"worker"===R?[]:I,avatarUrl:z};m(async()=>{let e=await (0,f.f)(t);e.ok?(o.oR.success("Agent updated"),u.refresh()):o.oR.error(e.message)})},onReset:function(){y(e.name),M(e.personality??""),$(k),W(e.subAgentIds),P(N),U(e.model??""),D(e.avatarUrl??null)}})]})}function G(){return(0,s.jsxs)(a(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-[12.5px] text-ink-3 transition-colors hover:text-ink-2",children:[(0,s.jsx)("span",{className:"text-[14px] leading-none",children:"‹"}),"Back to agents"]})}function q({agents:e,activeId:t}){return e.length<=1?null:(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>{let n=e.id===t;return(0,s.jsxs)(a(),{href:`/agents/${e.id}/edit`,className:["inline-flex h-[34px] items-center gap-2 rounded-full border px-3.5 text-[13px] font-medium transition-colors",n?"border-rule-2 bg-paper text-ink":"border-rule bg-canvas text-ink-3 hover:border-rule-2 hover:text-ink-2"].join(" "),children:[(0,s.jsx)("span",{className:"inline-block h-[7px] w-[7px] rounded-full bg-agent-vivid"}),e.name]},e.id)})})}function H({initial:e,avatarUrl:t,name:n,personaPreview:l,role:r,slug:a,model:i,llmKeyLabel:o,stats:d,onConfigure:c}){let x=d.totalRuns>0?`${Math.round(d.successfulRuns/d.totalRuns*100)}%`:"—";return(0,s.jsxs)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-5 p-6 lg:flex-row lg:items-start",children:[(0,s.jsx)("div",{className:"flex h-[80px] w-[80px] flex-shrink-0 items-center justify-center rounded-2xl bg-agent-vivid text-[28px] font-semibold text-canvas",children:t?(0,s.jsx)("img",{src:t,alt:"",className:"h-full w-full rounded-2xl object-cover"}):e}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsx)("h1",{className:"m-0 text-[22px] font-semibold leading-none tracking-[-0.01em] text-ink",children:n}),(0,s.jsxs)("span",{className:"inline-flex h-[24px] items-center gap-1.5 rounded-full border border-rule-2 bg-canvas px-2.5 text-[11.5px] font-medium text-ink-3",children:[(0,s.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-ink-3"}),"Idle"]})]}),(0,s.jsx)("p",{className:"mt-2 text-[13.5px] leading-[1.55] text-ink-3",children:l}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11.5px] text-ink-3",children:[i&&(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"text-ink-4",children:"Model:"})," ",(0,s.jsx)("code",{className:"rounded border border-rule-2 bg-canvas px-1.5 py-0.5 font-mono text-[11px] text-ink-2",children:i})]}),o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(J,{}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"text-ink-4",children:"LLM:"})," ",(0,s.jsx)("span",{className:"text-ink-2",children:o})]})]}),(0,s.jsx)(J,{}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"text-ink-4",children:"Role:"})," ",(0,s.jsx)("span",{className:"capitalize text-ink-2",children:r})]}),(0,s.jsx)(J,{}),(0,s.jsxs)("span",{className:"font-mono text-ink-4",children:["@",a]})]})]}),(0,s.jsx)("div",{className:"flex flex-shrink-0 flex-wrap gap-2",children:(0,s.jsxs)("button",{type:"button",onClick:c,className:"inline-flex h-[34px] items-center gap-1.5 rounded-lg border border-rule bg-paper px-3.5 text-[12.5px] font-medium text-ink-2 transition-colors hover:border-rule-2 hover:text-ink",children:[(0,s.jsx)(Q,{}),"Configure"]})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-6 pb-6 sm:grid-cols-3 lg:grid-cols-6",children:[(0,s.jsx)(Y,{label:"Skills",value:String(d.skills)}),(0,s.jsx)(Y,{label:"Connectors",value:String(d.connectors)}),(0,s.jsx)(Y,{label:"MCPs",value:String(d.mcps)}),(0,s.jsx)(Y,{label:"Sub-agents",value:"worker"===r?"—":String(d.subAgents),dim:"worker"===r}),(0,s.jsx)(Y,{label:"Runs",value:String(d.totalRuns),dim:0===d.totalRuns}),(0,s.jsx)(Y,{label:"Success rate",value:x,dim:0===d.totalRuns})]})]})}function J(){return(0,s.jsx)("span",{className:"text-ink-4",children:"\xb7"})}function Y({label:e,value:t,dim:n}){return(0,s.jsxs)("div",{className:"rounded-lg border border-rule-2 bg-canvas/40 px-4 py-3",children:[(0,s.jsx)("div",{className:"font-mono text-[9.5px] uppercase tracking-[0.14em] text-ink-4",children:e}),(0,s.jsx)("div",{className:`mt-1.5 text-[20px] font-semibold leading-none tracking-[-0.01em] ${n?"text-ink-4":"text-ink"}`,children:t})]})}function Q(){return(0,s.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,s.jsx)("circle",{cx:"8",cy:"8",r:"2"}),(0,s.jsx)("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.5 3.5l1.5 1.5M11 11l1.5 1.5M3.5 12.5L5 11M11 5l1.5-1.5"})]})}function V({tab:e,onChange:t,counts:n}){let l=[{id:"overview",label:"Overview"},{id:"skills",label:"Skills",count:n.skills},{id:"connectors",label:"Connectors",count:n.connectors},{id:"runs",label:"Runs",count:n.runs},{id:"settings",label:"Settings"}];return(0,s.jsx)("div",{className:"flex gap-1 border-b border-rule-2",children:l.map(n=>{let l=e===n.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>t(n.id),className:["relative -mb-px border-b-2 px-4 pt-2.5 pb-3 text-[13.5px] font-medium transition-colors",l?"border-ink text-ink":"border-transparent text-ink-3 hover:text-ink-2"].join(" "),children:[n.label,void 0!==n.count&&n.count>0&&(0,s.jsx)("span",{className:`ml-1.5 font-mono text-[10.5px] ${l?"text-ink-2":"text-ink-4"}`,children:n.count})]},n.id)})})}function X({children:e}){return(0,s.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper p-6",children:e})}function Z({label:e,hint:t,right:n}){return(0,s.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:e}),t&&(0,s.jsx)("p",{className:"mt-1 text-[12px] leading-[1.5] text-ink-3",children:t})]}),n]})}function ee({jobs:e,attachedSkills:t,connectorsAssigned:n,mcpsAssignedCount:l,onOpenSkills:r,onOpenConnectors:i}){let o=t.length>0,d=n.length>0;return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[(0,s.jsx)("div",{className:"lg:col-span-2",children:(0,s.jsx)(X,{children:(0,s.jsx)(et,{jobs:e})})}),(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:`Connectors used \xb7 ${n.length}`,right:d?(0,s.jsx)("button",{type:"button",onClick:i,className:"text-[11.5px] text-ink-3 underline hover:text-ink-2",children:"Manage"}):void 0}),d?(0,s.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,s.jsx)(es,{row:e},e.connectorId))}):(0,s.jsxs)("p",{className:"text-[12.5px] text-ink-3",children:["No connectors assigned yet."," ",(0,s.jsx)("button",{type:"button",onClick:i,className:"underline hover:text-ink-2",children:"Wire one →"})]}),l>0&&(0,s.jsxs)("p",{className:"mt-3 border-t border-rule-2 pt-3 text-[11.5px] text-ink-4",children:["+ ",l," MCP server",l>1?"s":""," attached (Settings → Knowledge)."]})]})]}),(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:`Skills attached \xb7 ${t.length}`,right:o?(0,s.jsx)("button",{type:"button",onClick:r,className:"text-[11.5px] text-ink-3 underline hover:text-ink-2",children:"Manage"}):void 0}),o?(0,s.jsx)("div",{className:"grid grid-cols-1 gap-2 lg:grid-cols-2 xl:grid-cols-3",children:t.map(e=>(0,s.jsx)(en,{skill:e},e.id))}):(0,s.jsxs)("p",{className:"text-[12.5px] text-ink-3",children:["No skills attached yet. Read-only view — manage on the"," ",(0,s.jsx)(a(),{href:"/skills",className:"underline hover:text-ink-2",children:"Skills page"}),"."]})]})]})}function et({jobs:e}){let{data:t,total:n}=(0,l.useMemo)(()=>{let t=new Date;t.setHours(0,0,0,0);let n=[];for(let e=6;e>=0;e-=1){let s=new Date(t.getTime()-864e5*e);n.push({day:s.toLocaleDateString("en-US",{weekday:"short"}),iso:s.toISOString().slice(0,10),runs:0})}let s=new Map(n.map(e=>[e.iso,e])),l=0;for(let t of e){if("completed"!==t.status||!t.createdAt)continue;let e="string"==typeof t.createdAt?new Date(t.createdAt):t.createdAt,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString().slice(0,10),r=s.get(n);r&&(r.runs+=1,l+=1)}return{data:n,total:l}},[e]);return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-3 flex items-baseline gap-2",children:(0,s.jsx)("span",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:"Runs \xb7 7 days"})}),(0,s.jsxs)("div",{className:"mb-4 flex items-baseline gap-3",children:[(0,s.jsx)("span",{className:"text-[34px] font-semibold leading-none tracking-[-0.015em] text-ink",children:n.toLocaleString()}),(0,s.jsxs)("span",{className:"text-[13.5px] text-ink-3",children:["successful run",1===n?"":"s"]})]}),(0,s.jsx)("div",{className:"h-[200px]",children:(0,s.jsx)(d.u,{width:"100%",height:"100%",children:(0,s.jsxs)(c.Q,{data:t,margin:{top:6,right:10,left:-20,bottom:0},children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("linearGradient",{id:"agentWeeklyFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"var(--c-agent-vivid)",stopOpacity:.55}),(0,s.jsx)("stop",{offset:"100%",stopColor:"var(--c-agent-vivid)",stopOpacity:.05})]})}),(0,s.jsx)(x.d,{stroke:"var(--c-rule-2)",vertical:!1}),(0,s.jsx)(p.W,{dataKey:"day",stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1}),(0,s.jsx)(u.h,{stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1,allowDecimals:!1}),(0,s.jsx)(h.m,{cursor:{stroke:"var(--c-ink-4)",strokeDasharray:"3 3"},contentStyle:{background:"var(--c-paper)",border:"1px solid var(--c-rule)",borderRadius:10,fontSize:12,color:"var(--c-ink)",boxShadow:"0 6px 20px rgba(0,0,0,0.08)"},labelStyle:{color:"var(--c-ink-3)"}}),(0,s.jsx)(m.Gk,{type:"monotone",dataKey:"runs",stroke:"var(--c-agent-vivid)",strokeWidth:2,fill:"url(#agentWeeklyFill)"})]})})})]})}function en({skill:e}){return(0,s.jsx)(R,{glyph:(0,s.jsx)(M.A,{variant:"skill",size:"lg",shape:"square",children:(0,s.jsx)("span",{className:"font-mono text-[10.5px] font-semibold uppercase",children:e.slug.slice(0,2)})}),name:e.name,description:e.description??void 0,meta:`@${e.slug}`,actions:(0,s.jsx)(a(),{href:`/skills/${e.id}/edit`,className:"flex h-7 items-center gap-1 rounded-md border border-rule px-2 text-[11px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink",children:"Open ›"})})}function es({row:e}){return(0,s.jsx)(R,{glyph:(0,s.jsx)(M.A,{variant:"conn",size:"lg",shape:"square",background:I.a[e.slug],children:(0,s.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:(0,I.d)(e.slug,e.label)})}),name:(0,s.jsxs)(s.Fragment,{children:[e.label,(0,s.jsx)("span",{className:"ml-2 font-mono text-[10px] uppercase tracking-[0.04em] text-ink-4",children:e.slug.toUpperCase()})]}),description:e.credentialName??void 0,actions:(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.08em] text-ink-3",children:[(0,s.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-agent-vivid"}),"on"]})})}function el({skills:e}){return 0===e.length?(0,s.jsx)(X,{children:(0,s.jsx)(Z,{label:"No skills attached",hint:"Read-only view. Manage attachments on the /skills page."})}):(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:`Attached \xb7 ${e.length}`}),(0,s.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,s.jsx)(en,{skill:e},e.id))})]})}function er(e){let{name:t,slug:n,avatarUrl:r,personality:i,role:d,showSubAgents:c,subAgentIds:x,peers:p,llmKeyId:u,activeKeys:h,selectedKey:m,model:g,coherenceOk:f,detectedProviders:C,compatibleActiveKeys:M,noLlmKeys:R,workspaces:$,workspacesLoaded:L,onWorkspacesChange:I,mcpServers:W,agentId:O,dirty:P,isPending:_,onChangeName:T,onChangeAvatar:U,onChangePersonality:z,onChangeRole:D,onToggleSubAgent:F,onChangeLlmKey:E,onChangeModel:K,onSwitchKey:B,onSave:G,onReset:q}=e,[H,J]=(0,l.useState)(""),[Y,Q]=(0,l.useState)(""),[V,ee]=(0,l.useState)(!1),[et,en]=(0,l.useState)(null),[es,el]=(0,l.useTransition)(),[er,ei]=(0,l.useState)({}),[eo,ed]=(0,l.useState)({}),[ec,ex]=(0,l.useState)(""),[ep,eu]=(0,l.useState)(!1),[eh,em]=(0,l.useState)(null),[eg,eb]=(0,l.useTransition)();async function ef(e,t){eu(!0);let n=new FormData;n.append("file",t);let s=await k(O,e,n);if(eu(!1),!s.ok)return void o.oR.error(s.message);o.oR.success(`Uploaded ${s.data.filename}`);let l=await v(O,e);l.ok&&ei(t=>({...t,[e]:l.data}))}return(0,l.useEffect)(()=>{for(let e of $)eo[e.label]||v(O,e.label).then(t=>{t.ok&&ei(n=>({...n,[e.label]:t.data})),ed(t=>({...t,[e.label]:!0}))})},[$,O]),(0,s.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:"Identity",hint:"Slug is immutable. Avatar is used across the app."}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,s.jsx)(ea,{label:"Name",children:(0,s.jsx)("input",{type:"text",value:t,onChange:e=>T(e.target.value),placeholder:"Agent name",className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})}),(0,s.jsx)(ea,{label:"Slug (read-only)",children:(0,s.jsx)("code",{className:"block w-full rounded-lg border border-rule-2 bg-hover px-3 py-2 font-mono text-[11.5px] tracking-[0.02em] text-ink-3",children:n})}),(0,s.jsx)("div",{className:"sm:col-span-2",children:(0,s.jsx)(ea,{label:"Avatar",children:(0,s.jsx)(A.A,{value:r,onChange:U})})})]})]}),(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:"Behavior",hint:"Persona is the system prompt. Updating it invalidates the prompt cache for new jobs."}),(0,s.jsx)(ea,{label:"Persona / system prompt",children:(0,s.jsx)("textarea",{value:i,onChange:e=>z(e.target.value),rows:24,placeholder:"You are a helpful assistant…",className:"min-h-[560px] w-full resize-y rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] leading-[1.55] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(ea,{label:"Role",children:(0,s.jsxs)("select",{value:d,onChange:e=>D(e.target.value),className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink focus:border-ink-3 focus:outline-none",children:[(0,s.jsx)("option",{value:"worker",children:"Worker — runs its own tools"}),(0,s.jsx)("option",{value:"router",children:"Router — delegates one at a time"}),(0,s.jsx)("option",{value:"planner",children:"Planner — parallel sub-agents"})]})})}),c&&(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(ea,{label:`Sub-agents \xb7 ${x.length} selected`,children:0===p.length?(0,s.jsx)("p",{className:"text-[12.5px] text-warn",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,s.jsx)("div",{className:"divide-y divide-rule-2 overflow-hidden rounded-lg border border-rule-2 bg-canvas/30",children:p.map(e=>{let t=x.includes(e.id);return(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2 text-[13px] transition-colors hover:bg-hover",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>F(e.id),className:"accent-agent-vivid"}),(0,s.jsx)("span",{className:"text-ink",children:e.name}),(0,s.jsx)("span",{className:"ml-auto font-mono text-[11px] text-ink-3",children:e.slug})]},e.id)})})})})]}),(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:"Model",hint:"LLM key + model identifier passed to the runner."}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,s.jsx)(ea,{label:"LLM provider",children:R?(0,s.jsxs)("p",{className:"text-[12.5px] text-warn",children:["No active LLM keys."," ",(0,s.jsx)(a(),{href:"/llm-providers",className:"underline",children:"Add one"}),"."]}):(0,s.jsx)("select",{value:u,onChange:e=>E(e.target.value),className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink focus:border-ink-3 focus:outline-none",children:h.map(e=>(0,s.jsx)("option",{value:e.id,children:(e.nickname??(0,S.R)(e.provider))+" ("+(0,S.R)(e.provider)+")"},e.id))})}),(0,s.jsx)(ea,{label:"Model",children:(0,s.jsx)("input",{type:"text",value:g,onChange:e=>K(e.target.value),placeholder:m?.defaultModel??"e.g. claude-haiku-4-5-20251001",className:"w-full rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})})]}),!f&&m&&(0,s.jsxs)("div",{role:"alert","data-testid":"model-provider-mismatch",className:"mt-3 space-y-1 rounded-lg border border-warn/30 bg-warn-bg px-3 py-2 text-[12px] text-warn",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"font-semibold",children:"Provider mismatch:"})," ",(0,s.jsx)("span",{className:"font-mono",children:g})," looks like it needs"," ",(0,s.jsx)("span",{className:"font-semibold",children:Array.from(C).map(e=>(0,S.R)(e)).join(" or ")}),", but your selected key is"," ",(0,s.jsx)("span",{className:"font-semibold",children:(0,S.R)(m.provider)}),"."]}),M.length>0?(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,s.jsx)("span",{className:"text-warn/80",children:"Switch to:"}),M.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>B(e.id),className:"rounded border border-warn/30 px-1.5 py-0.5 text-[11px] font-medium text-warn hover:bg-warn-bg",children:[e.nickname??(0,S.R)(e.provider)," (",(0,S.R)(e.provider),")"]},e.id))]}):(0,s.jsxs)("p",{children:["No compatible active key."," ",(0,s.jsx)(a(),{href:"/llm-providers",className:"underline hover:text-warn",children:"Add one"}),"."]})]})]}),(0,s.jsxs)(X,{children:[(0,s.jsx)(Z,{label:"Knowledge",hint:"Workspaces scope file_* tools. Add multiple paths with distinct labels."}),L?0===$.length?(0,s.jsx)("p",{className:"text-[12.5px] text-ink-4",children:"No workspaces configured."}):(0,s.jsx)("div",{className:"space-y-4 mb-4",children:$.map(e=>(0,s.jsxs)("div",{className:"rounded-lg border border-rule bg-hover/50 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 px-3 py-2 border-b border-rule",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"font-mono text-[11px] font-semibold text-ink-2 mr-2",children:e.label}),(0,s.jsx)("span",{className:"font-mono text-[11.5px] text-ink-3 break-all",children:e.path})]}),(0,s.jsx)("button",{type:"button",onClick:()=>en(e.id),disabled:es,className:"shrink-0 rounded border border-rule px-2 py-0.5 text-[11px] text-err hover:border-err/40 hover:bg-err/5 disabled:opacity-50",children:"Remove"})]}),(0,s.jsxs)("div",{className:"px-3 pt-2 pb-1",children:[eo[e.label]?0===(er[e.label]??[]).length?(0,s.jsx)("p",{className:"text-[11.5px] text-ink-4 py-1",children:"No files uploaded yet."}):(0,s.jsx)("div",{className:"space-y-1 mb-2",children:(er[e.label]??[]).map(t=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded px-2 py-1 bg-canvas border border-rule-2 text-[11.5px]",children:[(0,s.jsx)("span",{className:"font-mono text-ink-2 truncate min-w-0",children:t.name}),(0,s.jsx)("span",{className:"shrink-0 text-ink-4",children:t.size>=1048576?`${(t.size/1024/1024).toFixed(1)} MB`:t.size>=1024?`${(t.size/1024).toFixed(0)} KB`:`${t.size} B`}),(0,s.jsx)("button",{type:"button",onClick:()=>{em({label:e.label,name:t.name})},disabled:eg,className:"shrink-0 rounded border border-rule px-1.5 py-0.5 text-[10px] text-err hover:border-err/40 hover:bg-err/5 disabled:opacity-50",children:"Delete"})]},t.name))}):(0,s.jsx)("p",{className:"text-[11.5px] text-ink-4 py-1",children:"Loading files…"}),(0,s.jsxs)("label",{className:`flex items-center gap-2 cursor-pointer rounded-lg border border-dashed px-3 py-2 text-[12px] transition-colors mb-2
2
+ ${ep&&ec===e.label?"border-ink-3 text-ink-3 bg-hover":"border-rule text-ink-4 hover:border-ink-3 hover:text-ink-3"}`,children:[(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,s.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,s.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),ep&&ec===e.label?"Uploading…":"Upload file (.docx .xlsx .pptx .pdf .txt .md .csv — max 25 MB)",(0,s.jsx)("input",{type:"file",className:"sr-only",accept:".docx,.xlsx,.pptx,.pdf,.txt,.md,.csv",disabled:ep,onChange:t=>{let n=t.target.files?.[0];n&&(t.target.value="",ex(e.label),ef(e.label,n))}})]})]})]},e.id))}):(0,s.jsx)("p",{className:"text-[12.5px] text-ink-4",children:"Loading…"}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)(ea,{label:"Add workspace",children:(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:H,onChange:e=>J(e.target.value),placeholder:"Label (e.g. notes)",maxLength:80,className:"w-28 shrink-0 rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}),(0,s.jsx)("input",{type:"text",value:Y,onChange:e=>Q(e.target.value),placeholder:"/home/you/notes or C:\\Users\\you\\docs",className:"min-w-0 flex-1 rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[12.5px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}),(0,s.jsx)("button",{type:"button",onClick:function(){H.trim()&&Y.trim()&&el(async()=>{ee(!0);let e=await N(O,H.trim(),Y.trim());if(ee(!1),!e.ok)return void o.oR.error(e.message);let t=await b(O);t.ok&&I(t.data),J(""),Q(""),o.oR.success("Workspace added")})},disabled:es||V||!H.trim()||!Y.trim(),className:"shrink-0 rounded-lg border border-rule px-4 py-2 text-[13px] font-medium text-ink-2 hover:border-rule-2 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50",children:V?"Adding…":"Add"})]})}),(0,s.jsxs)("p",{className:"text-[11px] text-ink-4",children:["Absolute path. Label is the prefix the agent uses (e.g."," ",(0,s.jsx)("code",{className:"font-mono",children:"notes/file.md"}),"). Leave label blank if a single workspace — label is then optional."]})]}),(0,s.jsx)(y.A,{open:null!==et,title:"Remove workspace",message:"The agent will lose file access to this path. Existing files are NOT deleted.",confirmLabel:"Remove",destructive:!0,onConfirm:()=>et&&void el(async()=>{let e=await w(et);if(en(null),!e.ok)return void o.oR.error(e.message);let t=await b(O);t.ok&&I(t.data),o.oR.success("Workspace removed")}),onCancel:()=>en(null)}),(0,s.jsx)(y.A,{open:null!==eh,title:"Delete file",message:eh?`Delete "${eh.name}" from workspace "${eh.label}"? This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,onConfirm:function(){if(!eh)return;let{label:e,name:t}=eh;eb(async()=>{em(null);let n=await j(O,e,t);if(!n.ok)return void o.oR.error(n.message);o.oR.success(`Deleted ${t}`);let s=await v(O,e);s.ok&&ei(t=>({...t,[e]:s.data}))})},onCancel:()=>em(null)})]}),(0,s.jsxs)("div",{className:"sticky bottom-4 z-10 flex items-center justify-between gap-3 rounded-2xl border border-rule-2 bg-paper px-4 py-3 shadow-lg",children:[(0,s.jsx)("div",{className:"text-[12.5px] text-ink-3",children:P?(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"mr-1.5 inline-block h-[7px] w-[7px] rounded-full bg-skill-vivid"}),"Unsaved changes"]}):(0,s.jsx)("span",{className:"text-ink-4",children:"No changes"})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:q,disabled:_||!P,className:"rounded-lg border border-rule px-4 py-2 text-[13px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink-2 disabled:cursor-not-allowed disabled:opacity-50",children:"Reset"}),(0,s.jsx)("button",{type:"button",onClick:G,disabled:_||R||!f||!P,title:f?P?void 0:"No changes to save":"Pick a key that matches the model first",className:"rounded-lg bg-ink px-5 py-2 text-[13px] font-semibold text-canvas transition-colors hover:brightness-[0.92] disabled:cursor-not-allowed disabled:opacity-50",children:_?"Saving…":"Save"})]})]})]})}function ea({label:e,children:t}){return(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)("label",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-ink-4",children:e}),(0,s.jsx)("div",{children:t})]})}},35196:(e,t,n)=>{"use strict";n.d(t,{default:()=>p});var s=n(3680),l=n(78604),r=n(63363),a=n.n(r);function i({tabs:e,value:t,defaultValue:n,onChange:r,variant:a="inset"}){let[o,d]=(0,l.useState)(t??n??e[0].value),c=t??o,x="inset"===a?"bg-paper text-ink shadow-[0_1px_2px_rgba(0,0,0,0.06)]":"bg-ink text-canvas";return(0,s.jsx)("div",{className:`inline-flex gap-0.5 rounded-md p-[3px] ${"inset"===a?"bg-black/[0.05]":"bg-black/[0.04]"}`,role:"tablist",children:e.map(e=>{let n=e.value===c;return(0,s.jsxs)("button",{type:"button",role:"tab","aria-selected":n,onClick:()=>{void 0===t&&d(e.value),r?.(e.value)},className:`inline-flex h-[26px] items-center gap-1.5 rounded-[6px] border-0 px-3 text-[11.5px] font-medium leading-none transition-colors ${n?x:"bg-transparent text-ink-3 hover:text-ink-2"}`,children:[e.label,void 0!==e.count&&(0,s.jsx)("span",{className:`font-mono text-[10px] ${n?"opacity-85":"opacity-65"}`,children:e.count})]},e.value)})})}var o=n(93606),d=n(99203),c=n(32928);let x=[{value:"All",label:"All"},{value:"Running",label:"Running"},{value:"Failed",label:"Failed"}];function p({jobs:e,agents:t,agentId:n}){let[r,h]=(0,l.useState)("All"),[m,g]=(0,l.useState)(""),b=(0,l.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),f=(0,l.useMemo)(()=>{let t=n?e.filter(e=>e.agentId===n):e;if("Running"===r?t=t.filter(e=>{let t=e.status??"";return"processing"===t||"pending"===t||t.startsWith("awaiting")}):"Failed"===r&&(t=t.filter(e=>"failed"===e.status||"cancelled"===e.status)),m.trim()){let e=m.toLowerCase();t=t.filter(t=>{let n=t.agentId?b.get(t.agentId)?.name??"":"";return t.task.toLowerCase().includes(e)||n.toLowerCase().includes(e)||t.channel.toLowerCase().includes(e)})}return t},[e,n,r,m,b]);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-3.5 flex flex-wrap items-center gap-2.5",children:[(0,s.jsx)(i,{tabs:x,defaultValue:"All",variant:"dark-active",onChange:e=>h(e)}),(0,s.jsxs)("div",{className:"ml-auto flex h-[34px] min-w-[240px] items-center gap-2 rounded-md border border-rule-2 bg-paper px-3 text-[12.5px] text-ink-4",children:[(0,s.jsx)(c.e,{size:13,className:"shrink-0"}),(0,s.jsx)("input",{type:"search",value:m,onChange:e=>g(e.target.value),placeholder:"Search by task or agent…",className:"flex-1 border-0 bg-transparent text-[13px] leading-none text-ink outline-none placeholder:text-ink-4"})]})]}),(0,s.jsx)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:0===f.length?(0,s.jsx)("div",{className:"px-6 py-12 text-center text-[13px] text-ink-4",children:0===e.length?"No runs yet. Use the form above to send your first task to an agent.":"No runs match the current filter."}):(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full border-collapse text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)(u,{children:"Agent"}),(0,s.jsx)(u,{children:"Task"}),(0,s.jsx)(u,{className:"hidden md:table-cell",children:"Channel"}),(0,s.jsx)(u,{className:"hidden lg:table-cell",children:"Started"}),(0,s.jsx)(u,{align:"right",children:"Status"})]})}),(0,s.jsx)("tbody",{children:f.map(e=>{var t,n,l,r;let i=e.agentId?b.get(e.agentId):null,c="completed"===(t=e.status)?"done":"failed"===t||"cancelled"===t?"warn":"processing"===t||"pending"===t||t?.startsWith("awaiting")?"run":"idle";return(0,s.jsxs)("tr",{className:"border-b border-dashed border-rule-2 last:border-0 hover:bg-hover transition-colors",children:[(0,s.jsx)("td",{className:"px-[18px] py-3 align-middle",children:i?(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,s.jsx)(d.A,{name:i.name,imageUrl:i.avatarUrl,size:"md",shape:"round"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"truncate text-[13px] font-medium leading-[1.2] text-ink",children:i.name}),(0,s.jsx)("div",{className:"truncate font-mono text-[10px] leading-none text-ink-4",children:i.slug})]})]}):(0,s.jsx)("span",{className:"font-mono text-[11px] text-ink-4",children:"—"})}),(0,s.jsx)("td",{className:"max-w-[320px] px-[18px] py-3 align-middle",children:(0,s.jsx)(a(),{href:`/jobs/${e.id}`,className:"line-clamp-1 text-[13px] text-ink-2 hover:text-ink transition-colors",title:e.task,children:(n=e.task).length>72?n.slice(0,72)+"…":n})}),(0,s.jsx)("td",{className:"hidden px-[18px] py-3 align-middle font-mono text-[11px] text-ink-4 md:table-cell",children:e.channel}),(0,s.jsx)("td",{className:"hidden px-[18px] py-3 align-middle font-mono text-[11px] text-ink-4 lg:table-cell",children:(l=e.createdAt)?("string"==typeof l?new Date(l):l).toLocaleString(void 0,{weekday:"short",hour:"2-digit",minute:"2-digit"}):"—"}),(0,s.jsx)("td",{className:"px-[18px] py-3 align-middle text-right",children:(0,s.jsx)(o.A,{variant:c,label:(r=e.status)?({pending:"Pending",processing:"Running",completed:"Done",failed:"Failed",awaiting_approval:"Awaiting",awaiting_delegation:"Awaiting",cancelled:"Cancelled"})[r]??r:"Pending"})})]},e.id)})})]})})})]})}function u({children:e,align:t="left",className:n=""}){return(0,s.jsx)("th",{className:`border-b border-rule-2 px-[18px] pt-1.5 pb-2.5 font-mono text-[9.5px] font-normal uppercase tracking-[0.16em] text-ink-4 ${"right"===t?"text-right":"text-left"} ${n}`,children:e})}},37955:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(3680),l=n(78604),r=n(51869);let a=Array.from({length:42},(e,t)=>{let n=String(t+1).padStart(2,"0");return{id:`avatar-${n}`,url:`/avatars/avatar-${n}.png`}});function i({value:e,onChange:t,label:n="Avatar"}){let[c,x]=(0,l.useState)(!1),[p,u]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{u(!0)},[]),(0,l.useEffect)(()=>{if(c)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&x(!1)}},[c]),(0,s.jsxs)("div",{children:[n&&(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:n}),(0,s.jsxs)("button",{type:"button",onClick:()=>x(!0),className:"group flex items-center gap-3 bg-hover border border-rule hover:border-rule rounded-md px-3 py-2 text-left transition-colors w-full max-w-xs",children:[(0,s.jsx)(o,{url:e,size:36}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-ink truncate",children:e?e.split("/").pop()?.replace(".png",""):"No avatar"}),(0,s.jsxs)("p",{className:"text-[11px] text-ink-3",children:["Click to ",e?"change":"pick"]})]})]}),p&&c&&(0,r.createPortal)((0,s.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Pick an avatar",onClick:()=>x(!1),className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"bg-paper border border-rule-2 rounded-2xl p-5 max-w-2xl w-full max-h-[80vh] overflow-y-auto",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Pick an avatar"}),(0,s.jsx)("button",{type:"button",onClick:()=>x(!1),className:"text-ink-3 hover:text-ink text-xs",children:"Close (Esc)"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-6 gap-3",children:[(0,s.jsx)(d,{selected:null===e,onClick:()=>void(t(null),x(!1)),label:"None",url:null}),a.map(n=>(0,s.jsx)(d,{selected:e===n.url,onClick:()=>{t(n.url),x(!1)},label:n.id,url:n.url},n.id))]})]})}),document.body)]})}function o({url:e,size:t=32}){return e?(0,s.jsx)("img",{src:e,alt:"",width:t,height:t,style:{width:t,height:t},className:"rounded-full object-cover border border-rule shrink-0"}):(0,s.jsx)("div",{style:{width:t,height:t},className:"rounded-full bg-hover border border-dashed border-rule text-ink-3 text-xs flex items-center justify-center shrink-0",children:"?"})}function d({selected:e,onClick:t,label:n,url:l}){return(0,s.jsx)("button",{type:"button",onClick:t,title:n,"aria-label":n,"aria-pressed":e,className:`aspect-square rounded-lg p-1 flex items-center justify-center transition-all ${e?"bg-ink/10 ring-2 ring-emerald-400":"bg-hover hover:bg-hover ring-1 ring-transparent hover:ring-neutral-700"}`,children:(0,s.jsx)(o,{url:l,size:56})})}},63217:(e,t,n)=>{"use strict";function s(e){switch(e){case"openai-compatible":return"Local LLM";case"anthropic":return"Anthropic";case"openai":return"OpenAI";case"ollama":return"Ollama";case"openrouter":return"OpenRouter";case"google":return"Google";case"mistral":return"Mistral";case"groq":return"Groq";default:return e}}n.d(t,{R:()=>s})},79716:(e,t,n)=>{"use strict";n.d(t,{$:()=>r,P:()=>l});let s=new Set(["ollama","openai-compatible"]);function l(e){let t=e.trim().toLowerCase();if(0===t.length)return new Set;let n=new Set;return t.includes("/")?n.add("openrouter"):t.startsWith("claude")?n.add("anthropic"):t.startsWith("gpt")||t.startsWith("chatgpt")||/^o[134](?:[-_]|$)/.test(t)?n.add("openai"):t.startsWith("gemini")?n.add("google"):t.startsWith("gemma")?(n.add("google"),n.add("ollama"),n.add("openai-compatible")):t.startsWith("mistral")||t.startsWith("codestral")||t.startsWith("pixtral")||t.startsWith("magistral")||t.startsWith("ministral")||t.startsWith("mixtral")?n.add("mistral"):(t.startsWith("llama")||t.startsWith("qwen")||t.startsWith("deepseek"))&&(n.add("ollama"),n.add("openai-compatible"),n.add("groq")),n}function r(e,t){if(0===e.trim().length||s.has(t))return!0;let n=l(e);return 0===n.size||n.has(t)}},81630:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var s=n(3680);let l={agent:"bg-agent-vivid text-[#0a0a0a]",skill:"bg-skill-vivid text-white",conn:"bg-conn-vivid text-white",ink:"bg-ink text-canvas",neutral:"bg-hover text-ink-3"},r={sm:"h-[30px] w-[30px]",md:"h-[34px] w-[34px]",lg:"h-[38px] w-[38px]",xl:"h-[42px] w-[42px]"},a={sm:"[&_svg]:h-[13px] [&_svg]:w-[13px]",md:"[&_svg]:h-[14px] [&_svg]:w-[14px]",lg:"[&_svg]:h-[16px] [&_svg]:w-[16px]",xl:"[&_svg]:h-[18px] [&_svg]:w-[18px]"};function i({variant:e,size:t="md",shape:n="round",background:o,children:d,className:c=""}){let x=o?"":l[e];return(0,s.jsx)("span",{style:o?{background:o}:void 0,className:`inline-flex shrink-0 items-center justify-center ${r[t]} ${a[t]} ${"round"===n?"rounded-full":"rounded-[9px]"} ${x} ${o?"text-white":""} ${c}`,children:d})}},82592:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var s=n(3680);let l={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},r={ok:"animate-[blip_1.4s_ease-out_infinite]",lime:"animate-[blip-lime_1.5s_ease-out_infinite]",coral:"animate-[blip-coral_1.4s_ease-out_infinite]",blue:"animate-[blip-blue_1.4s_ease-out_infinite]"};function a({variant:e="ok",size:t="sm",animate:n=!0,className:i=""}){return(0,s.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${l[e]} ${n?r[e]:""} ${i}`})}},84702:(e,t,n)=>{"use strict";n.d(t,{f:()=>l});var s=n(64678);let l=(0,s.createServerReference)("40f14a7568e2a3b6f7bc2ada24095ae0d2d7db8a93",s.callServer,void 0,s.findSourceMapURL,"updateAgentAction")},88812:(e,t,n)=>{Promise.resolve().then(n.bind(n,25569))},93606:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var s=n(3680),l=n(86127),r=n(22089),a=n(82592);let i={done:"Done",warn:"Attention",run:"Running",idle:"Idle","lvl-info":"INFO","lvl-ok":"OK","lvl-warn":"WARN","lvl-err":"ERR"},o={done:"bg-ok-bg text-ok",warn:"bg-warn-bg text-warn",run:"bg-run-bg text-run",idle:"bg-black/5 text-ink-3 dark:bg-white/5","lvl-info":"bg-black/5 text-ink-3 dark:bg-white/5","lvl-ok":"bg-ok-bg text-ok","lvl-warn":"bg-warn-bg text-warn","lvl-err":"bg-warn-bg text-err"};function d({variant:e,label:t,icon:n,className:c=""}){let x=t??i[e],p=null;return void 0!==n?p=n:"done"===e?p=(0,s.jsx)(l.r,{size:11,weight:"regular"}):"warn"===e?p=(0,s.jsx)(r.N,{size:11,weight:"regular"}):"run"===e&&(p=(0,s.jsx)(a.A,{variant:"blue",size:"sm"})),(0,s.jsxs)("span",{className:`inline-flex h-[22px] items-center gap-1.5 rounded-[5px] px-2.5 text-[11px] font-medium leading-none ${o[e]} ${c}`,children:[p,x]})}},99203:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var s=n(3680),l=n(22575);let r={sm:{box:"h-6 w-6",text:"text-[9.5px]",px:24},md:{box:"h-[30px] w-[30px]",text:"text-[10.5px]",px:30},lg:{box:"h-[42px] w-[42px]",text:"text-[14px]",px:42}};function a({name:e,imageUrl:t,size:n="md",shape:i="round",className:o=""}){let d=r[n],c=`inline-flex shrink-0 items-center justify-center overflow-hidden bg-hover font-mono font-semibold tracking-[0.04em] text-ink-2 ${d.box} ${d.text} ${"round"===i?"rounded-full":"rounded-[8px]"} ${o}`;return t?(0,s.jsx)("span",{className:c,children:(0,s.jsx)(l.default,{src:t,alt:e,width:d.px,height:d.px,className:"h-full w-full object-cover"})}):(0,s.jsx)("span",{className:c,children:function(e){let t=e.trim();if(!t)return"?";let n=t.split(/\s+/);return n.length>=2?((n[0][0]??"")+(n[1][0]??"")).toUpperCase():t.slice(0,2).toUpperCase()}(e)})}}},e=>{e.O(0,[3363,9504,9060,269,6679,1065,8724,7358],()=>e(e.s=88812)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[797],{10880:(e,t,r)=>{"use strict";r.d(t,{default:()=>h});var s=r(3680),n=r(78604),l=r(51869),a=r(27540),i=r(39504),o=r(84702),d=r(64678);let c=(0,d.createServerReference)("4031e908f0b51185160dae8c5e4dbb1e3178ccc82c",d.callServer,void 0,d.findSourceMapURL,"createAgentAction");var u=r(63217),x=r(37955),m=r(79716);function h(e){var t,r;let d="edit"===e.mode,h=(0,a.useRouter)(),p=(0,n.useRef)(null),[g,b]=(0,n.useTransition)(),[f,v]=(0,n.useState)(d),k=d?(t=e.initial.role??null,r=e.initial.orchestratorMode??null,"orchestrator"===t&&"planner"===r?"planner":"orchestrator"===t?"router":"worker"):"worker",[j,y]=(0,n.useState)(k),[N,w]=(0,n.useState)(d?e.initial.subAgentIds:[]),S=(0,n.useMemo)(()=>e.llmKeys.filter(e=>e.isActive),[e.llmKeys]),C=(d?e.initial.llmKeyId:null)??S[0]?.id??"",[R,A]=(0,n.useState)(C),[M,L]=(0,n.useState)(d?e.initial.model??"":""),[$,E]=(0,n.useState)(d?e.initial.avatarUrl??null:null),P=(0,n.useMemo)(()=>e.llmKeys.find(e=>e.id===R)??null,[e.llmKeys,R]),D=(0,n.useMemo)(()=>(0,m.P)(M),[M]),F=(0,n.useMemo)(()=>S.filter(e=>(0,m.$)(M,e.provider)),[S,M]),I=!P||(0,m.$)(M,P.provider);function W(t){let r=e.llmKeys.find(e=>e.id===t),s=P?.defaultModel??null;A(t),r?.defaultModel&&(!M||M===s)&&L(r.defaultModel)}function _(e){if(L(e),!P||(0,m.$)(e,P.provider))return;let t=S.filter(t=>(0,m.$)(e,t.provider));1===t.length&&t[0]&&(A(t[0].id),i.oR.success(`Switched provider to ${(0,u.R)(t[0].provider)} (matches ${e})`))}function q(t){t.preventDefault();let r=new FormData(t.currentTarget);if(d&&"edit"===e.mode){let t={id:e.initial.id,name:r.get("name"),personality:r.get("personality"),model:M,llmKeyId:R||null,role:j,subAgentIds:"worker"===j?[]:N,avatarUrl:$};b(async()=>{let e=await (0,o.f)(t);e.ok?(i.oR.success("Agent updated"),h.push("/agents")):i.oR.error(e.message)})}else{let e={slug:r.get("slug"),name:r.get("name"),personality:r.get("personality"),model:M,llmKeyId:R||void 0,role:j,subAgentIds:"worker"===j?[]:N,avatarUrl:$};b(async()=>{let t=await c(e);t.ok?(i.oR.success("Agent created"),p.current?.reset(),y("worker"),w([]),A(S[0]?.id??""),L(""),E(null),v(!1)):i.oR.error(t.message)})}}function z(e){w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}(0,n.useEffect)(()=>{if(f&&!d)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&v(!1)}},[f,d]);let K=e.agents??[],T=0===S.length,U="worker"!==j,O=0===K.length,G=!I&&P?(0,s.jsxs)("div",{role:"alert","data-testid":"model-provider-mismatch",className:"mt-1 px-2 py-1.5 rounded border border-warn/30 bg-warn-bg text-[11px] text-warn space-y-1",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"font-semibold",children:"Provider mismatch:"})," ",(0,s.jsx)("span",{className:"font-mono",children:M})," looks like it needs"," ",(0,s.jsx)("span",{className:"font-semibold",children:Array.from(D).map(e=>(0,u.R)(e)).join(" or ")}),", but your selected key is"," ",(0,s.jsx)("span",{className:"font-semibold",children:(0,u.R)(P.provider)}),"."]}),F.length>0?(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(0,s.jsx)("span",{className:"text-warn/80",children:"Switch to:"}),F.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>A(e.id),className:"px-1.5 py-0.5 rounded border border-warn/30 text-warn hover:bg-warn-bg font-medium",children:[e.nickname??(0,u.R)(e.provider)," (",(0,u.R)(e.provider),")"]},e.id))]}):(0,s.jsxs)("p",{children:["No compatible active key."," ",(0,s.jsx)("a",{href:"/settings",className:"underline hover:text-warn",children:"Add one in Settings → LLM providers"}),"."]})]}):null;if(d){let t=e.initial;return(0,s.jsxs)("form",{ref:p,onSubmit:q,className:"w-full max-w-lg space-y-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Edit agent"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-slug",children:"Slug"}),(0,s.jsx)("input",{id:"agent-slug",name:"slug",readOnly:!0,defaultValue:t.slug,title:"Slug is not editable",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink-3 cursor-not-allowed"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-name",children:"Name"}),(0,s.jsx)("input",{id:"agent-name",name:"name",required:!0,defaultValue:t.name,placeholder:"My Agent",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,s.jsx)(x.A,{value:$,onChange:E}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-personality",children:"Personality / System prompt"}),(0,s.jsx)("textarea",{id:"agent-personality",name:"personality",required:!0,rows:6,defaultValue:t.personality,placeholder:"You are a helpful assistant...",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none resize-y"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-llm-key",children:"LLM provider"}),T?(0,s.jsxs)("p",{className:"text-xs text-warn mt-1",children:["No active LLM providers. Add one in"," ",(0,s.jsx)("a",{href:"/settings",className:"underline",children:"Settings → LLM providers"}),"."]}):(0,s.jsx)("select",{id:"agent-llm-key",value:R,onChange:e=>W(e.target.value),required:!0,className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:S.map(e=>(0,s.jsx)("option",{value:e.id,children:(e.nickname??(0,u.R)(e.provider))+" ("+(0,u.R)(e.provider)+")"},e.id))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-model",children:"Model"}),(0,s.jsx)("input",{id:"agent-model",name:"model",type:"text",required:!0,value:M,onChange:e=>_(e.target.value),placeholder:P?.defaultModel??"e.g. claude-haiku-4-5-20251001",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),G]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-role",children:"Role"}),(0,s.jsxs)("select",{id:"agent-role",value:j,onChange:e=>y(e.target.value),className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,s.jsx)("option",{value:"worker",children:"Worker — runs its own tools and tasks"}),(0,s.jsx)("option",{value:"router",children:"Router — delegates to one sub-agent at a time"}),(0,s.jsx)("option",{value:"planner",children:"Planner — creates parallel tasks for sub-agents"})]})]}),U&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Sub-agents ",(0,s.jsxs)("span",{className:"text-ink-4",children:["(",N.length," selected)"]})]}),O?(0,s.jsx)("p",{className:"text-xs text-warn mt-1",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,s.jsx)("div",{className:"max-h-40 overflow-y-auto bg-hover border border-rule rounded-lg divide-y divide-neutral-800",children:K.map(e=>{let t=N.includes(e.id);return(0,s.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-hover/80",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>z(e.id),className:"accent-violet-500"}),(0,s.jsx)("span",{className:"text-ink",children:e.name}),(0,s.jsx)("span",{className:"font-mono text-xs text-ink-3 ml-auto",children:e.slug})]},e.id)})})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)("button",{type:"submit",disabled:g||T||!I,title:I?void 0:"Pick a key that matches the model first",className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-lg hover:brightness-[0.92] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:g?"Saving…":"Save changes"}),(0,s.jsx)("button",{type:"button",onClick:()=>h.push("/agents"),className:"px-4 py-2 text-sm font-medium border border-rule text-ink-3 rounded-lg hover:border-rule transition-colors",children:"Cancel"})]})]})}let V=f?(0,l.createPortal)((0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/60 z-40 animate-[fadeIn_150ms_ease]",onClick:()=>v(!1),"aria-hidden":"true"}),(0,s.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"New agent",className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:(0,s.jsxs)("form",{ref:p,onSubmit:q,className:"pointer-events-auto w-full max-w-lg max-h-[90vh] overflow-y-auto bg-paper border border-rule-2 rounded-xl p-6 space-y-4 shadow-2xl animate-[scaleIn_150ms_ease]",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"New agent"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-slug",children:"Slug"}),(0,s.jsx)("input",{id:"agent-slug",name:"slug",required:!0,pattern:"[a-z0-9\\-]+",placeholder:"my-agent",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-name",children:"Name"}),(0,s.jsx)("input",{id:"agent-name",name:"name",required:!0,placeholder:"My Agent",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,s.jsx)(x.A,{value:$,onChange:E}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-personality",children:"Personality / System prompt"}),(0,s.jsx)("textarea",{id:"agent-personality",name:"personality",required:!0,rows:4,placeholder:"You are a helpful assistant...",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none resize-none"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-llm-key",children:"LLM provider"}),T?(0,s.jsxs)("p",{className:"text-xs text-warn mt-1",children:["No active LLM providers. Add one in"," ",(0,s.jsx)("a",{href:"/settings",className:"underline",children:"Settings → LLM providers"}),"."]}):(0,s.jsx)("select",{id:"agent-llm-key",value:R,onChange:e=>W(e.target.value),required:!0,className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:S.map(e=>(0,s.jsx)("option",{value:e.id,children:(e.nickname??(0,u.R)(e.provider))+" ("+(0,u.R)(e.provider)+")"},e.id))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-model",children:"Model"}),(0,s.jsx)("input",{id:"agent-model",name:"model",type:"text",required:!0,value:M,onChange:e=>_(e.target.value),placeholder:P?.defaultModel??"e.g. claude-haiku-4-5-20251001",className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),G]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",htmlFor:"agent-role",children:"Role"}),(0,s.jsxs)("select",{id:"agent-role",value:j,onChange:e=>y(e.target.value),className:"w-full bg-hover border border-rule rounded-lg px-3 py-2 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,s.jsx)("option",{value:"worker",children:"Worker — runs its own tools and tasks"}),(0,s.jsx)("option",{value:"router",children:"Router — delegates to one sub-agent at a time"}),(0,s.jsx)("option",{value:"planner",children:"Planner — creates parallel tasks for sub-agents"})]})]}),U&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Sub-agents ",(0,s.jsxs)("span",{className:"text-ink-4",children:["(",N.length," selected)"]})]}),O?(0,s.jsx)("p",{className:"text-xs text-warn mt-1",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,s.jsx)("div",{className:"max-h-40 overflow-y-auto bg-hover border border-rule rounded-lg divide-y divide-neutral-800",children:K.map(e=>{let t=N.includes(e.id);return(0,s.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 text-sm cursor-pointer hover:bg-hover/80",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>z(e.id),className:"accent-violet-500"}),(0,s.jsx)("span",{className:"text-ink",children:e.name}),(0,s.jsx)("span",{className:"font-mono text-xs text-ink-3 ml-auto",children:e.slug})]},e.id)})})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)("button",{type:"submit",disabled:g||T||!I,title:I?void 0:"Pick a key that matches the model first",className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-lg hover:brightness-[0.92] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:g?"Creating…":"Create agent"}),(0,s.jsx)("button",{type:"button",onClick:()=>v(!1),className:"px-4 py-2 text-sm font-medium border border-rule text-ink-3 rounded-lg hover:border-rule transition-colors",children:"Cancel"})]})]})})]}),document.body):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>v(!0),className:"px-4 py-2 text-sm font-medium bg-ink text-canvas rounded-lg hover:brightness-[0.92] transition-colors",children:"+ New agent"}),V]})}},14308:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var s=r(3680),n=r(78604),l=r(51869);function a({open:e,title:t,message:r,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:u}){let x=(0,n.useRef)(null),[m,h]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{h(!0)},[]),(0,n.useEffect)(()=>{if(e)return x.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&m)?(0,l.createPortal)((0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,s.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),r&&(0,s.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:r}),(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)("button",{ref:x,type:"button",onClick:u,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,s.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:i})]})]})]}),document.body):null}},37955:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var s=r(3680),n=r(78604),l=r(51869);let a=Array.from({length:42},(e,t)=>{let r=String(t+1).padStart(2,"0");return{id:`avatar-${r}`,url:`/avatars/avatar-${r}.png`}});function i({value:e,onChange:t,label:r="Avatar"}){let[c,u]=(0,n.useState)(!1),[x,m]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{m(!0)},[]),(0,n.useEffect)(()=>{if(c)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&u(!1)}},[c]),(0,s.jsxs)("div",{children:[r&&(0,s.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:r}),(0,s.jsxs)("button",{type:"button",onClick:()=>u(!0),className:"group flex items-center gap-3 bg-hover border border-rule hover:border-rule rounded-md px-3 py-2 text-left transition-colors w-full max-w-xs",children:[(0,s.jsx)(o,{url:e,size:36}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-ink truncate",children:e?e.split("/").pop()?.replace(".png",""):"No avatar"}),(0,s.jsxs)("p",{className:"text-[11px] text-ink-3",children:["Click to ",e?"change":"pick"]})]})]}),x&&c&&(0,l.createPortal)((0,s.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Pick an avatar",onClick:()=>u(!1),className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"bg-paper border border-rule-2 rounded-2xl p-5 max-w-2xl w-full max-h-[80vh] overflow-y-auto",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Pick an avatar"}),(0,s.jsx)("button",{type:"button",onClick:()=>u(!1),className:"text-ink-3 hover:text-ink text-xs",children:"Close (Esc)"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-6 gap-3",children:[(0,s.jsx)(d,{selected:null===e,onClick:()=>void(t(null),u(!1)),label:"None",url:null}),a.map(r=>(0,s.jsx)(d,{selected:e===r.url,onClick:()=>{t(r.url),u(!1)},label:r.id,url:r.url},r.id))]})]})}),document.body)]})}function o({url:e,size:t=32}){return e?(0,s.jsx)("img",{src:e,alt:"",width:t,height:t,style:{width:t,height:t},className:"rounded-full object-cover border border-rule shrink-0"}):(0,s.jsx)("div",{style:{width:t,height:t},className:"rounded-full bg-hover border border-dashed border-rule text-ink-3 text-xs flex items-center justify-center shrink-0",children:"?"})}function d({selected:e,onClick:t,label:r,url:n}){return(0,s.jsx)("button",{type:"button",onClick:t,title:r,"aria-label":r,"aria-pressed":e,className:`aspect-square rounded-lg p-1 flex items-center justify-center transition-all ${e?"bg-ink/10 ring-2 ring-emerald-400":"bg-hover hover:bg-hover ring-1 ring-transparent hover:ring-neutral-700"}`,children:(0,s.jsx)(o,{url:n,size:56})})}},49293:(e,t,r)=>{"use strict";r.d(t,{V:()=>n});var s=r(64678);let n=(0,s.createServerReference)("00f7799d8ffeb54fbc0d656a2a30330367f4004a6d",s.callServer,void 0,s.findSourceMapURL,"getActiveJobsByAgentAction")},52232:(e,t,r)=>{"use strict";r.d(t,{default:()=>l});var s=r(3680),n=r(27540);function l({message:e}){let t=(0,n.useRouter)();return(0,s.jsxs)("div",{className:"bg-warn-bg border border-err/30 rounded-xl px-5 py-4 flex items-center justify-between gap-4",children:[(0,s.jsx)("p",{className:"text-sm text-err",children:e}),(0,s.jsx)("button",{onClick:()=>t.refresh(),className:"shrink-0 px-3 py-1.5 text-xs font-medium border border-err/30 text-err rounded-lg hover:border-err hover:text-err transition-colors",children:"Retry"})]})}},63217:(e,t,r)=>{"use strict";function s(e){switch(e){case"openai-compatible":return"Local LLM";case"anthropic":return"Anthropic";case"openai":return"OpenAI";case"ollama":return"Ollama";case"openrouter":return"OpenRouter";case"google":return"Google";case"mistral":return"Mistral";case"groq":return"Groq";default:return e}}r.d(t,{R:()=>s})},67849:(e,t,r)=>{Promise.resolve().then(r.bind(r,52232)),Promise.resolve().then(r.bind(r,69373)),Promise.resolve().then(r.bind(r,10880))},69373:(e,t,r)=>{"use strict";r.d(t,{default:()=>f});var s=r(3680),n=r(63363),l=r.n(n),a=r(78604),i=r(27540),o=r(39504),d=r(34767),c=r(35436),u=r(62182),x=r(49293),m=r(64678);let h=(0,m.createServerReference)("4071b52022586286c7dce9c331714fd8a5deb2ee78",m.callServer,void 0,m.findSourceMapURL,"reorderAgentsAction"),p=(0,m.createServerReference)("40ca6c379b6b8ead1e0c8e6b269c963b3a2f28e894",m.callServer,void 0,m.findSourceMapURL,"deleteAgentAction");var g=r(14308);function b({id:e,name:t,deleteAction:r}){let[n,l]=(0,a.useTransition)(),[i,d]=(0,a.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>d(!0),disabled:n,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-err hover:text-err transition-colors disabled:opacity-50",children:n?"Deleting…":"Delete"}),(0,s.jsx)(g.A,{open:i,title:`Delete agent "${t}"?`,message:"The agent and its assignments will be removed. Past job history is preserved.",confirmLabel:"Delete",onConfirm:function(){d(!1),l(async()=>{let t=await r(e);t.ok?o.oR.success("Agent deleted"):o.oR.error(t.message)})},onCancel:()=>d(!1)})]})}function f({initialGroups:e,initialActivity:t}){let[r,n]=(0,a.useState)(e),[l,u]=(0,a.useState)(t),[m,p]=(0,a.useTransition)(),g=(0,i.useRouter)(),b=(0,a.useMemo)(()=>{let e=new Map;for(let t of l)e.set(t.agentId,t);return e},[l]);(0,a.useEffect)(()=>{let e=!1,t=async()=>{let t=await (0,x.V)();!e&&t.ok&&u(t.data)},r=setInterval(()=>void t(),5e3);return()=>{e=!0,clearInterval(r)}},[]);let j=(0,d.FR)((0,d.MS)(d.AN,{activationConstraint:{distance:8}}),(0,d.MS)(d.uN,{coordinateGetter:c.JR}));function y(e){n(e),p(async()=>{let t=await h(function(e){let t=[];for(let r of e)for(let e of(r.orchestrator&&t.push(r.orchestrator.id),r.workers))t.push(e.id);return t}(e));if(!t.ok){o.oR.error(t.message),n(r);return}g.refresh()})}if(0===r.length)return(0,s.jsx)("div",{className:"bg-paper border border-rule-2 rounded-xl overflow-hidden",children:(0,s.jsx)("div",{className:"px-6 py-12 text-center text-ink-4 text-sm",children:"No agents yet. Create one above."})});let N=r.map(e=>e.orchestrator?.id).filter(e=>!!e);return(0,s.jsx)(d.Mp,{sensors:j,collisionDetection:d.fp,onDragEnd:function(e){let{active:t,over:s}=e;if(!s||t.id===s.id)return;let n=r.findIndex(e=>e.orchestrator?.id===t.id),l=r.findIndex(e=>e.orchestrator?.id===s.id);n<0||l<0||y((0,c.be)(r,n,l))},children:(0,s.jsx)(c.gB,{items:N,strategy:c._G,children:(0,s.jsx)("div",{className:"space-y-6",children:r.map((e,t)=>{let n=null===e.orchestrator;return(0,s.jsxs)("div",{children:[e.orchestrator?(0,s.jsx)(v,{orchestrator:e.orchestrator,disabled:m}):(0,s.jsx)("h2",{className:"mb-2 text-xs font-semibold text-ink-3 uppercase tracking-wider",children:"Standalone"}),(0,s.jsx)(k,{workers:e.workers,indent:!!e.orchestrator,orchestrator:e.orchestrator,disabled:m,onWorkerDragEnd:e=>(function(e,t){let{active:s,over:n}=t;if(!n||s.id===n.id)return;let l=r[e];if(!l)return;let a=l.workers.findIndex(e=>e.id===s.id),i=l.workers.findIndex(e=>e.id===n.id);if(a<0||i<0)return;let o=(0,c.be)(l.workers,a,i);y(r.map((t,r)=>r===e?{...t,workers:o}:t))})(t,e),sensors:j,activityByAgent:b})]},n?"__standalone__":e.orchestrator?.id??"")})})})})}function v({orchestrator:e,disabled:t}){let{attributes:r,listeners:n,setNodeRef:l,transform:a,transition:i,isDragging:o}=(0,c.gl)({id:e.id,disabled:t});return(0,s.jsxs)("div",{ref:l,style:{transform:u.Ks.Transform.toString(a),transition:i},className:`mb-2 flex items-center gap-2 ${o?"opacity-50":""}`,children:[(0,s.jsx)("button",{type:"button",...r,...n,"aria-label":"Drag team",title:"Drag to reorder team",className:"cursor-grab active:cursor-grabbing text-ink-4 hover:text-ink-2 transition-colors leading-none touch-none",children:"⋮⋮"}),(0,s.jsxs)("h2",{className:"text-xs font-semibold text-ink-3 uppercase tracking-wider",children:["Team — ",e.name]})]})}function k({workers:e,indent:t,orchestrator:r,disabled:n,onWorkerDragEnd:l,sensors:a,activityByAgent:i}){let o=e.map(e=>e.id);return(0,s.jsx)(d.Mp,{sensors:a,collisionDetection:d.fp,onDragEnd:l,children:(0,s.jsx)("div",{className:"bg-paper border border-rule-2 rounded-xl overflow-hidden",children:(0,s.jsx)("table",{className:"w-full text-sm",children:(0,s.jsx)("tbody",{children:(0,s.jsxs)(c.gB,{items:o,strategy:c._G,children:[r&&(0,s.jsx)(y,{agent:r,indent:!1,activity:i.get(r.id)??null}),e.map(e=>(0,s.jsx)(j,{agent:e,indent:t,disabled:n,activity:i.get(e.id)??null},e.id))]})})})})})}function j({agent:e,indent:t,disabled:r,activity:n}){let{attributes:l,listeners:a,setNodeRef:i,transform:o,transition:d,isDragging:x}=(0,c.gl)({id:e.id,disabled:r});return(0,s.jsxs)("tr",{ref:i,style:{transform:u.Ks.Transform.toString(o),transition:d},className:`border-b border-rule-2 last:border-0 ${x?"opacity-50 bg-hover":""}`,children:[(0,s.jsx)("td",{className:`px-5 py-3 ${t?"pl-10":""}`,children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",...l,...a,"aria-label":"Drag row",title:"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-ink-4 hover:text-ink-3 transition-colors leading-none touch-none select-none",children:"⋮⋮"}),(0,s.jsx)(N,{agent:e}),(0,s.jsx)(w,{agent:e}),(0,s.jsx)(S,{agent:e,activity:n})]})}),(0,s.jsx)(C,{agent:e})]})}function y({agent:e,indent:t,activity:r}){return(0,s.jsxs)("tr",{className:"border-b border-rule-2 last:border-0",children:[(0,s.jsx)("td",{className:`px-5 py-3 ${t?"pl-10":""}`,children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"w-4 inline-block","aria-hidden":!0}),(0,s.jsx)(N,{agent:e}),(0,s.jsx)(w,{agent:e}),(0,s.jsx)(S,{agent:e,activity:r})]})}),(0,s.jsx)(C,{agent:e})]})}function N({agent:e}){return e.avatarUrl?(0,s.jsx)("img",{src:e.avatarUrl,alt:"",width:32,height:32,className:"w-8 h-8 rounded-full object-cover border border-rule-2 shrink-0"}):(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-hover text-ink-3 text-xs font-semibold flex items-center justify-center shrink-0",children:e.name.charAt(0).toUpperCase()})}function w({agent:e}){return(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-ink font-medium truncate",children:e.name}),e.isDefault&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-run uppercase tracking-wider",children:"default"}),"orchestrator"===e.role&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-indigo-400 uppercase tracking-wider",children:"orchestrator"})]}),(0,s.jsx)("span",{className:"font-mono text-ink-3 text-[11px]",children:e.slug}),e.model&&(0,s.jsxs)("span",{className:"ml-2 text-ink-4 text-[11px]",children:["\xb7 ",e.model]})]})}function S({agent:e,activity:t}){if(!t||0===t.total)return null;let r=t.processing>0?{color:"bg-run",pulse:!0,label:`${t.processing} running`}:t.awaiting>0?{color:"bg-warn",pulse:!0,label:`${t.awaiting} awaiting`}:{color:"bg-warn",pulse:!1,label:`${t.pending} pending`},n=[];return t.processing>0&&n.push(`${t.processing} processing`),t.awaiting>0&&n.push(`${t.awaiting} awaiting`),t.pending>0&&n.push(`${t.pending} pending`),(0,s.jsxs)(l(),{href:`/jobs?agentId=${e.id}`,title:n.join(" \xb7 "),onPointerDown:e=>e.stopPropagation(),className:"ml-1 inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-hover hover:bg-hover border border-rule text-[11px] text-ink-2 transition-colors shrink-0",children:[(0,s.jsxs)("span",{className:"relative inline-flex w-2 h-2 shrink-0",children:[r.pulse&&(0,s.jsx)("span",{className:`absolute inset-0 inline-flex h-full w-full rounded-full opacity-60 animate-ping ${r.color}`}),(0,s.jsx)("span",{className:`relative inline-flex w-2 h-2 rounded-full ${r.color}`})]}),(0,s.jsx)("span",{className:"font-mono tabular-nums",children:t.total}),(0,s.jsx)("span",{className:"text-ink-3 text-[10px]",children:"active"})]})}function C({agent:e}){return(0,s.jsx)("td",{className:"px-5 py-3 text-right",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,s.jsx)(l(),{href:`/agents/${e.id}/telegram`,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-rule hover:text-ink transition-colors",children:"Telegram"}),(0,s.jsx)(l(),{href:`/agents/${e.id}/edit`,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-rule hover:text-ink transition-colors",children:"Edit"}),(0,s.jsx)(b,{id:e.id,name:e.name,deleteAction:p})]})})}},79716:(e,t,r)=>{"use strict";r.d(t,{$:()=>l,P:()=>n});let s=new Set(["ollama","openai-compatible"]);function n(e){let t=e.trim().toLowerCase();if(0===t.length)return new Set;let r=new Set;return t.includes("/")?r.add("openrouter"):t.startsWith("claude")?r.add("anthropic"):t.startsWith("gpt")||t.startsWith("chatgpt")||/^o[134](?:[-_]|$)/.test(t)?r.add("openai"):t.startsWith("gemini")?r.add("google"):t.startsWith("gemma")?(r.add("google"),r.add("ollama"),r.add("openai-compatible")):t.startsWith("mistral")||t.startsWith("codestral")||t.startsWith("pixtral")||t.startsWith("magistral")||t.startsWith("ministral")||t.startsWith("mixtral")?r.add("mistral"):(t.startsWith("llama")||t.startsWith("qwen")||t.startsWith("deepseek"))&&(r.add("ollama"),r.add("openai-compatible"),r.add("groq")),r}function l(e,t){if(0===e.trim().length||s.has(t))return!0;let r=n(e);return 0===r.size||r.has(t)}},84702:(e,t,r)=>{"use strict";r.d(t,{f:()=>n});var s=r(64678);let n=(0,s.createServerReference)("40f14a7568e2a3b6f7bc2ada24095ae0d2d7db8a93",s.callServer,void 0,s.findSourceMapURL,"updateAgentAction")}},e=>{e.O(0,[3363,9504,6522,1065,8724,7358],()=>e(e.s=67849)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9527],{16237:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var n=a(3680),r=a(40189),l=a(77045);function s({status:e,ctaLabel:t,ctaVariant:a="blue",onCta:i,ctaHref:o}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"flex-1 text-[12.5px] leading-none text-ink-3",children:e}),o?(0,n.jsxs)(l.A,{variant:a,size:"sm",href:o,children:[(0,n.jsx)(r.F,{size:12,weight:"bold"}),t]}):(0,n.jsxs)(l.A,{variant:a,size:"sm",onClick:i,children:[(0,n.jsx)(r.F,{size:12,weight:"bold"}),t]})]})}},21021:(e,t,a)=>{"use strict";a.d(t,{a:()=>n,d:()=>l});let n={gmail:"#ea4335","google-drive":"#4285f4","google-sheets":"#0f9d58","google-docs":"#4285f4","google-calendar":"#4285f4",notion:"#000000","notion-oauth":"#000000",airtable:"#f82b60","airtable-oauth":"#f82b60",github:"#24292f",linear:"#5e6ad2",hubspot:"#ff7a59",slack:"#4a154b",intercom:"#1f8ced",stripe:"#635bff",postgres:"#336791",apify:"#00aeff",firecrawl:"#f97316",tavily:"#6366f1",composio:"#000000"},r={gmail:"Gm","google-drive":"GD","google-sheets":"GS","google-docs":"GD","google-calendar":"GC",notion:"No","notion-oauth":"No",airtable:"At","airtable-oauth":"At",github:"Gh",linear:"Li",hubspot:"HS",slack:"Sl",intercom:"IC",stripe:"St",postgres:"PG",apify:"Ap",firecrawl:"FC",tavily:"Tv",composio:"Co","custom-http-mcp":"+","custom-stdio-mcp":"+","cogni-cortex":"CX"};function l(e,t){return r[e]??t.slice(0,2).toUpperCase()}},22089:(e,t,a)=>{"use strict";a.d(t,{N:()=>i});var n=a(78604),r=a(5977);let l=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),n.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),s=n.forwardRef((e,t)=>n.createElement(r.A,{ref:t,...e,weights:l}));s.displayName="WarningIcon";let i=s},22450:(e,t,a)=>{"use strict";a.d(t,{default:()=>s});var n=a(78604),r=a(27540),l=a(39504);function s({successLabel:e,errorMessage:t}){let a=(0,r.useRouter)(),i=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{!i.current&&(i.current=!0,e&&(l.oR.success(`${e} connected`),a.replace("/connectors")),t&&console.error("[OAuth] connection failed:",t))},[e,t,a]),null}},29697:(e,t,a)=>{"use strict";a.d(t,{default:()=>U});var n=a(3680),r=a(78604),l=a(32307),s=a(65668),i=a(28870),o=a(66736),c=a(77045);let d=[{slug:"notion",label:"Notion",authType:"api_key",docsHint:"Create a Notion integration at notion.so/my-integrations and copy its internal secret."},{slug:"notion-oauth",label:"Notion (OAuth)",authType:"oauth2",credentialType:"notion-oauth",docsHint:"Public Integration via OAuth — create one at notion.so/my-integrations (Public type) and authorize from your dashboard."},{slug:"google-drive",label:"Google Drive",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"gmail",label:"Gmail",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"google-sheets",label:"Google Sheets",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"google-docs",label:"Google Docs",authType:"oauth2",credentialType:"google-oauth",docsHint:"OAuth flow — uses your Google credential (create one under Credentials)."},{slug:"airtable-oauth",label:"Airtable (OAuth)",authType:"oauth2",credentialType:"airtable-oauth",docsHint:"OAuth flow for Airtable Public Integrations (recommended)."},{slug:"airtable",label:"Airtable",authType:"api_key",docsHint:"Personal Access Token — airtable.com/create/tokens."},{slug:"apify",label:"Apify",authType:"api_key",docsHint:"Token API Apify — console.apify.com/account/integrations."},{slug:"firecrawl",label:"Firecrawl",authType:"api_key",docsHint:"API key Firecrawl — firecrawl.dev/account."},{slug:"tavily",label:"Tavily",authType:"api_key",docsHint:"API key Tavily — app.tavily.com."}];var u=a(81630),x=a(88499),m=a(93606),p=a(39504),h=a(64678);let b=(0,h.createServerReference)("405d2914232a34edc9f74779988ef691af296a9654",h.callServer,void 0,h.findSourceMapURL,"deleteConnectorAction"),g=(0,h.createServerReference)("606055a600e56bd7666fafc3d5e53c010979a76483",h.callServer,void 0,h.findSourceMapURL,"renameConnectorAction"),f=(0,h.createServerReference)("60dc0da2d7c5db3035a1afb7ba208d34c7c256b977",h.callServer,void 0,h.findSourceMapURL,"assignCredentialAction"),v=(0,h.createServerReference)("609fad4351e144d04349ee549ca1bc241d89e2e606",h.callServer,void 0,h.findSourceMapURL,"updateConnectorApiKeyAction"),y=(0,h.createServerReference)("40ef10ebce01bad6b03cc551d9efc8c480ffd25d9d",h.callServer,void 0,h.findSourceMapURL,"refreshCredentialAction");var k=a(14308),j=a(38666);let N=new Set(["notion-oauth"]);function A({instance:e,catalogEntry:t,compatibleCredentials:a}){var l;let[s,i]=(0,r.useTransition)(),[o,c]=(0,r.useTransition)(),[d,u]=(0,r.useState)(!1),[x,m]=(0,r.useState)(!1),[h,w]=(0,r.useState)(!1),[C,S]=(0,r.useState)(e.name),[T,R]=(0,r.useState)(!1),[M,E]=(0,r.useState)(e.credentialId??a[0]?.id??""),[Z,L]=(0,r.useState)(!1),[$,F]=(0,r.useState)(""),H="api_key"===e.authType,I="oauth2"===e.authType,D=e.active,P=I&&!N.has(t.credentialType??""),O=t.credentialType,G=e.credentialId,_=e.credentialName,U=e.credentialAccountName,z=e.credentialExpiresAt,B=e.credentialScopes,K=!!(l=z??null)&&l.getTime()<Date.now(),q=D?"connected":"inactive";function V(){let t=C.trim();t&&t!==e.name?i(async()=>{let a=await g(e.id,t);a.ok?(p.oR.success("Renamed"),w(!1)):p.oR.error(a.message)}):w(!1)}function W(){let t=$.trim();t?i(async()=>{let a=await v(e.id,t);a.ok?(p.oR.success(`${e.name} key rotated`),L(!1),F("")):p.oR.error(a.message)}):p.oR.error("New API key is required")}return(0,n.jsxs)("div",{className:"bg-paper border border-rule-2 rounded-xl p-5 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[h?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("input",{autoFocus:!0,value:C,onChange:e=>S(e.target.value),onKeyDown:t=>{"Enter"===t.key&&V(),"Escape"===t.key&&(S(e.name),w(!1))},className:"bg-hover border border-rule rounded-md px-2 py-1 text-sm text-ink focus:border-ink-3 focus:outline-none w-full max-w-xs"}),(0,n.jsx)("button",{type:"button",onClick:V,disabled:s,className:"text-xs text-ok hover:text-ok disabled:opacity-40",children:"Save"}),(0,n.jsx)("button",{type:"button",onClick:()=>{S(e.name),w(!1)},className:"text-xs text-ink-3 hover:text-ink-2",children:"Cancel"})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-base font-semibold text-ink truncate",children:e.name}),(0,n.jsx)("button",{type:"button",onClick:()=>w(!0),"aria-label":"Rename connector",className:"text-ink-4 hover:text-ink-3 transition-colors text-xs leading-none",title:"Rename",children:"✎"}),(0,n.jsx)("span",{className:`inline-block px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider ${"connected"===q?"bg-agent-vivid/15 text-ok":"bg-warn-bg text-warn"}`,children:q})]}),(0,n.jsxs)("p",{className:"text-xs text-ink-3 mt-1 font-mono",children:[t.slug," \xb7 ",e.authType]}),U&&(0,n.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:U}),H&&e.hasApiKey&&(0,n.jsxs)("p",{className:"text-xs text-ink-4 mt-0.5 font-mono",children:["key: …",e.credentialId??"????"]})]}),(0,n.jsx)("div",{className:"flex gap-2 shrink-0 flex-wrap justify-end items-start",children:I?(0,n.jsxs)(n.Fragment,{children:[P&&(0,n.jsx)("button",{type:"button",onClick:function(){G&&c(async()=>{let e=await y(G);e.ok?p.oR.success("Token refreshed"):p.oR.error(e.message??"Refresh failed")})},disabled:o||s,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:o?"Refreshing…":"Refresh now"}),(0,n.jsx)("button",{type:"button",onClick:()=>m(!0),disabled:s||o,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:"Reconnect"}),a.length>0&&(0,n.jsx)("button",{type:"button",onClick:()=>R(e=>!e),disabled:s||o,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:T?"Cancel":"Switch credential"}),(0,n.jsx)("button",{type:"button",onClick:()=>u(!0),disabled:s||o,className:"px-3 py-1.5 text-xs font-medium border border-err/30 text-err rounded-md hover:border-err/30 hover:text-err disabled:opacity-40",children:"Disconnect"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",onClick:()=>L(e=>!e),disabled:s,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:Z?"Cancel":"Rotate key"}),(0,n.jsx)("button",{type:"button",onClick:()=>u(!0),disabled:s,className:"px-3 py-1.5 text-xs font-medium border border-err/30 text-err rounded-md hover:border-err/30 hover:text-err disabled:opacity-40",children:"Delete"})]})})]}),H&&Z&&(0,n.jsxs)("div",{className:"space-y-3 pt-2 border-t border-rule-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:`rotate-${e.id}`,className:"block text-xs text-ink-3 mb-1",children:"New API key"}),(0,n.jsx)("input",{id:`rotate-${e.id}`,type:"password",autoComplete:"off",autoFocus:!0,value:$,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key&&W(),"Escape"===e.key&&(F(""),L(!1))},placeholder:"Paste the new key",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"}),(0,n.jsx)("p",{className:"text-[11px] text-ink-4 mt-1",children:"Agent assignments stay intact — only the stored key changes."})]}),(0,n.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,n.jsx)("button",{type:"button",onClick:W,disabled:s||!$.trim(),className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:s?"Saving…":"Save new key"}),(0,n.jsx)("button",{type:"button",onClick:()=>{F(""),L(!1)},className:"text-xs text-ink-3 hover:text-ink underline",children:"Cancel"})]})]}),t.docsHint&&(0,n.jsx)("p",{className:"text-xs text-ink-3",children:t.docsHint}),I&&G&&(0,n.jsxs)("div",{className:"pt-2 border-t border-rule-2 space-y-2",children:[_&&(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:["Credential: ",(0,n.jsx)("span",{className:"text-ink font-medium",children:_})]}),B&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:B.split(/\s+/).map(e=>(0,n.jsx)("span",{className:"px-1.5 py-0.5 bg-hover text-ink-3 rounded text-[10px] font-mono",children:e},e))}),P&&(0,n.jsx)("p",{className:"text-xs text-ink-3",children:"Auto-refreshes when used"}),!P&&z&&(0,n.jsx)("p",{className:`text-xs ${K?"text-warn":"text-ink-3"}`,children:function(e){let t;if(!e)return"";let a=Math.round((e.getTime()-Date.now())/1e3),n=Math.abs(a);return t=n<60?`${n}s`:n<3600?`${Math.round(n/60)} min`:n<86400?`${Math.round(n/3600)} h`:`${Math.round(n/86400)} d`,a>=0?`expires in ${t}`:`expired ${t} ago`}(z)})]}),I&&T&&(0,n.jsx)("div",{className:"space-y-3 pt-2 border-t border-rule-2",children:a.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:"Use credential"}),(0,n.jsx)("select",{value:M,onChange:e=>E(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:a.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.name,e.accountName?` (${e.accountName})`:""]},e.id))})]}),(0,n.jsxs)("div",{className:"flex gap-2 items-center pt-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>M&&void i(async()=>{let t=await f(e.id,M);t.ok?(p.oR.success(`${e.name} credential updated`),R(!1)):p.oR.error(t.message)}),disabled:s||!M,className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:s?"Saving…":"Save"}),(0,n.jsx)("button",{type:"button",onClick:()=>{R(!1),m(!0)},className:"px-3 py-1.5 text-xs text-ink-3 hover:text-ink underline",children:"or create new"})]})]}):(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:["No compatible credentials found."," ",(0,n.jsx)("button",{type:"button",onClick:()=>{R(!1),m(!0)},className:"text-indigo-400 hover:text-indigo-300 underline",children:"Create one"})]})}),(0,n.jsx)(k.A,{open:d,title:`${I?"Disconnect":"Delete"} "${e.name}"?`,message:I?"Tools that depend on this connector will fail until you reconnect. Existing job history is preserved.":"This connector instance will be permanently removed. Existing job history is preserved.",confirmLabel:I?"Disconnect":"Delete",onConfirm:function(){u(!1),i(async()=>{let t=await b(e.id);t.ok?p.oR.success(`${e.name} removed`):p.oR.error(t.message)})},onCancel:()=>u(!1)}),x&&O&&(0,n.jsx)(j.A,{initialType:O,returnToConnectorSlug:t.slug,onClose:()=>m(!1)})]})}var w=a(21021);function C({instances:e,credsByType:t}){return(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:(0,n.jsxs)("table",{className:"w-full border-collapse",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)(S,{label:"Provider"}),(0,n.jsx)(S,{label:"Account"}),(0,n.jsx)(S,{label:"Scopes"}),(0,n.jsx)(S,{label:"Status"}),(0,n.jsx)(S,{label:"Actions",align:"right"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>{let a=d.find(t=>t.slug===e.slug),r=a?{...a,credentialType:a.credentialType??null}:{slug:e.slug,label:e.name,authType:e.authType,docsHint:"",credentialType:e.credentialType??null},l=r.credentialType?t[r.credentialType]??[]:[];return(0,n.jsx)(T,{instance:e,catalogEntry:r,compatibleCredentials:l},e.id)})})]})})}function S({label:e,align:t="left"}){return(0,n.jsx)("th",{className:`border-b border-rule-2 px-[18px] pt-3.5 pb-2.5 font-mono text-[9.5px] font-normal uppercase tracking-[0.16em] text-ink-4 ${"right"===t?"text-right":"text-left"}`,scope:"col",children:e})}function T({instance:e,catalogEntry:t,compatibleCredentials:a}){let[l,s]=(0,r.useState)(!1),i=w.a[e.slug],o=(0,w.d)(e.slug,t.label),c=e.active,d=e.credentialScopes?e.credentialScopes.split(/\s+/).filter(Boolean):[];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("tr",{className:"border-b border-rule-2 last:border-0 hover:bg-hover",children:[(0,n.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(u.A,{variant:"conn",size:"sm",shape:"square",background:i,children:(0,n.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:o})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"text-[13.5px] font-medium leading-[1.2] text-ink",children:t.label}),(0,n.jsx)("div",{className:"mt-0.5 font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:t.authType})]})]})}),(0,n.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,n.jsx)("span",{className:"font-sans text-[13px] leading-[1.3] text-ink-2",children:e.credentialAccountName??e.name})}),(0,n.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:d.length>0?(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[d.slice(0,4).map(e=>(0,n.jsx)(x.A,{children:e},e)),d.length>4&&(0,n.jsxs)("span",{className:"font-mono text-[11px] text-ink-4",children:["+",d.length-4]})]}):(0,n.jsx)("span",{className:"font-mono text-[11px] text-ink-4",children:"api_key"===e.authType?"api_key":"—"})}),(0,n.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,n.jsx)(m.A,{variant:c?"done":"warn",label:c?"Connected":"Needs auth"})}),(0,n.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,n.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,n.jsx)("button",{type:"button",onClick:()=>s(e=>!e),className:"inline-flex h-[30px] items-center gap-1.5 rounded-[7px] border border-rule bg-paper px-3 text-[12px] font-medium leading-none text-ink-2 transition-colors hover:bg-hover hover:text-ink",children:l?"Close":"Configure"})})})]}),l&&(0,n.jsx)("tr",{className:"border-b border-rule-2 last:border-0 bg-hover/40",children:(0,n.jsx)("td",{colSpan:5,className:"px-[18px] py-3",children:(0,n.jsx)(A,{instance:e,catalogEntry:t,compatibleCredentials:a})})})]})}var R=a(40319),M=a(42357),E=a(37820),Z=a(16237);let L=(0,h.createServerReference)("40acbc65d30c00984ec7cf68c6e885ffb032aec0a7",h.callServer,void 0,h.findSourceMapURL,"saveApiKeyConnectorAction"),$=(0,h.createServerReference)("704d2f0500c368b49f1db458d42a99b07c47d304c7",h.callServer,void 0,h.findSourceMapURL,"createOrAssignOAuthConnectorAction");var F=a(36762),H=a(10900);let I={"google-oauth":"Google","notion-oauth":"Notion","airtable-oauth":"Airtable"};function D({catalogItem:e,compatibleCredentials:t}){let[a,l]=(0,r.useState)(!1),[s,i]=(0,r.useTransition)(),[o,c]=(0,r.useState)(!1),[d,u]=(0,r.useState)(t[0]?.id??""),x="api_key"===e.authType,m="oauth2"===e.authType,h=e.credentialType;return(0,n.jsxs)("div",{className:"bg-paper border border-rule-2 rounded-xl p-4 space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-ink",children:e.label}),(0,n.jsxs)("p",{className:"text-[11px] text-ink-3 font-mono mt-0.5",children:[e.slug," \xb7 ",e.authType]})]}),(0,n.jsx)("button",{type:"button",onClick:()=>{m&&0===t.length?c(!0):l(e=>!e)},className:"shrink-0 px-3 py-1.5 text-xs font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92]",children:a?"Cancel":m&&0===t.length?`Connect with ${h?I[h]??e.label:e.label}`:"+ Add"})]}),(0,n.jsx)("p",{className:"text-xs text-ink-4",children:e.docsHint}),x&&a&&(0,n.jsxs)("form",{onSubmit:function(t){t.preventDefault();let a=new FormData(t.currentTarget),n=a.get("name")?.trim()??"",r=a.get("apiKey")?.trim()??"";n?r?i(async()=>{let t=await L({slug:e.slug,name:n,apiKey:r});t.ok?(p.oR.success(`${n} connected`),l(!1)):p.oR.error(t.message)}):p.oR.error("API key is required"):p.oR.error("Name is required")},className:"space-y-3 pt-2 border-t border-rule-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:`add-name-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:["Name ",(0,n.jsx)("span",{className:"text-ink-4",children:'(e.g. "Notion — perso")'})]}),(0,n.jsx)("input",{id:`add-name-${e.slug}`,name:"name",required:!0,placeholder:e.label,className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})]}),H.m[e.slug]&&(0,n.jsxs)("details",{className:"group text-xs",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-ink-3 hover:text-ink-2",children:"Where do I get this?"}),(0,n.jsx)("div",{className:"mt-3 pl-1",children:(0,n.jsx)(F.A,{guide:H.m[e.slug]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:`add-apikey-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:"API key"}),(0,n.jsx)("input",{id:`add-apikey-${e.slug}`,name:"apiKey",type:"password",required:!0,autoComplete:"off",className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none font-mono"})]}),(0,n.jsx)("div",{className:"pt-1",children:(0,n.jsx)("button",{type:"submit",disabled:s,className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:s?"Connecting…":"Connect"})})]}),m&&a&&t.length>0&&(0,n.jsxs)("div",{className:"space-y-3 pt-2 border-t border-rule-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:"Use existing credential"}),(0,n.jsx)("select",{value:d,onChange:e=>u(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:t.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.name,e.accountName?` (${e.accountName})`:""]},e.id))})]}),(0,n.jsxs)("div",{className:"flex gap-2 items-center pt-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>d&&void i(async()=>{let t=await $(e.slug,d);t.ok?(p.oR.success(`${e.label} connected`),l(!1)):p.oR.error(t.message)}),disabled:s||!d,className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:s?"Connecting…":"Connect"}),(0,n.jsx)("button",{type:"button",onClick:()=>{l(!1),c(!0)},className:"px-3 py-1.5 text-xs text-ink-3 hover:text-ink underline",children:"or create new"})]})]}),o&&h&&(0,n.jsx)(j.A,{initialType:h,returnToConnectorSlug:e.slug,onClose:()=>c(!1)})]})}function P(e){return e.startsWith("google-")||"gmail"===e||"notion"===e||"notion-oauth"===e||"airtable"===e||"airtable-oauth"===e?"Productivity":"github"===e||"linear"===e?"DevTools":"hubspot"===e?"CRM":"slack"===e||"intercom"===e?"Comms":"apify"===e||"firecrawl"===e||"tavily"===e||"stripe"===e||"postgres"===e?"Data":"Other"}let O=[{value:"All",label:"All"},{value:"CRM",label:"CRM"},{value:"Productivity",label:"Productivity"},{value:"Data",label:"Data"},{value:"DevTools",label:"DevTools"},{value:"Comms",label:"Comms"},{value:"Other",label:"Other"}];function G({catalog:e,instances:t,credsByType:a,category:r,onCategoryChange:l}){return(0,n.jsxs)("div",{children:[(0,n.jsx)(M.A,{items:O,value:r,onChange:l,className:"mb-[18px]"}),0===e.length?(0,n.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:(0,n.jsx)("p",{className:"text-[13px] text-ink-3",children:"No connectors in this category."})}):(0,n.jsx)("div",{className:"grid auto-rows-fr grid-cols-1 gap-3.5 md:grid-cols-2 lg:grid-cols-4",children:e.map(e=>{let r=t.filter(t=>t.slug===e.slug),l=r.length>0,s=e.credentialType?a[e.credentialType]??[]:[];return(0,n.jsx)(_,{catalogItem:e,isInstalled:l,installedCount:r.length,compatibleCredentials:s},e.slug)})})]})}function _({catalogItem:e,isInstalled:t,installedCount:a,compatibleCredentials:l}){let[s,i]=(0,r.useState)(!1),o=w.a[e.slug],c=(0,w.d)(e.slug,e.label),d=P(e.slug);return(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)(E.A,{glyph:(0,n.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:c}),glyphVariant:"conn",glyphBackground:o,name:e.label,description:e.docsHint,category:d,topRight:t?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-[6px] bg-ok-bg px-2 py-1 font-sans text-[11px] font-medium text-ok",children:[(0,n.jsx)(R.r,{size:11,weight:"regular"}),a," installed"]}):void 0,foot:(0,n.jsx)(Z.A,{ctaLabel:t?"Add account":"Install",ctaVariant:"blue",onCta:()=>i(e=>!e)})}),s&&(0,n.jsx)("div",{className:"mt-1.5 rounded-2xl border border-rule-2 bg-paper p-4",children:(0,n.jsx)(D,{catalogItem:e,compatibleCredentials:l})})]})}function U({instances:e,catalog:t,credsByType:a}){let[d,u]=(0,r.useState)(e.length>0?"installed":"marketplace"),[x,m]=(0,r.useState)(""),[p,h]=(0,r.useState)("All"),b=(0,r.useMemo)(()=>{if(!x.trim())return e;let t=x.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.slug.toLowerCase().includes(t)||(e.credentialAccountName??"").toLowerCase().includes(t))},[e,x]),g=(0,r.useMemo)(()=>{let e=t;if("All"!==p&&(e=e.filter(e=>P(e.slug)===p)),x.trim()){let t=x.toLowerCase();e=e.filter(e=>e.label.toLowerCase().includes(t)||e.slug.toLowerCase().includes(t))}return e},[t,p,x]);return(0,n.jsxs)("div",{className:"pb-10",children:[(0,n.jsx)(l.A,{title:"API Connectors",subtitle:"Wire your agents to external services — Gmail, Slack, HubSpot, and the rest. Browse the marketplace or manage the accounts you've already connected."}),(0,n.jsx)(s.A,{tabs:(0,n.jsx)(i.A,{value:d,onChange:e=>{u(e),m(""),h("All")},tabs:[{value:"installed",label:"Installed",count:e.length},{value:"marketplace",label:"Marketplace",count:t.length}]}),search:(0,n.jsx)(o.A,{value:x,onChange:m,placeholder:"installed"===d?"Search connectors…":"Search providers…"}),cta:(0,n.jsx)(c.A,{variant:"ink",href:"/credentials",children:"Manage credentials"})}),(0,n.jsx)("div",{className:"pt-5",children:"installed"===d?0===e.length?(0,n.jsx)(z,{onBrowse:()=>u("marketplace")}):0===b.length?(0,n.jsx)(B,{}):(0,n.jsx)(C,{instances:b,credsByType:a}):(0,n.jsx)(G,{catalog:g,instances:e,credsByType:a,category:p,onCategoryChange:h})})]})}function z({onBrowse:e}){return(0,n.jsxs)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:[(0,n.jsxs)("p",{className:"text-[13px] leading-[1.5] text-ink-3",children:["No connectors installed yet.",(0,n.jsx)("br",{}),"Browse the Marketplace to add one."]}),(0,n.jsx)("div",{className:"mt-4 inline-flex",children:(0,n.jsx)(c.A,{variant:"blue",onClick:e,children:"Browse Marketplace"})})]})}function B(){return(0,n.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:(0,n.jsx)("p",{className:"text-[13px] leading-[1.5] text-ink-3",children:"No connectors match your search."})})}},37820:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var n=a(3680),r=a(81630);function l({glyph:e,glyphVariant:t="skill",glyphBackground:a,name:s,description:i,category:o,topRight:c,foot:d,className:u=""}){return(0,n.jsxs)("div",{className:`relative flex h-full min-h-[200px] flex-col gap-1.5 rounded-2xl border border-rule-2 bg-paper p-[18px] ${u}`,children:[c&&(0,n.jsx)("div",{className:"absolute top-3.5 right-3.5 flex items-center gap-1.5",children:c}),(0,n.jsx)("div",{className:"mb-1.5",children:(0,n.jsx)(r.A,{variant:t,background:a,size:"lg",shape:"square",children:e})}),(0,n.jsx)("div",{className:"text-[15.5px] font-semibold leading-[1.2] tracking-[-0.005em] text-ink",children:s}),i&&(0,n.jsx)("div",{className:"text-[13px] leading-[1.4] text-ink-3",children:i}),o&&(0,n.jsx)("div",{className:"mt-1.5 font-mono text-[10.5px] uppercase tracking-[0.14em] text-ink-4",children:o}),d&&(0,n.jsx)("div",{className:"-mx-[18px] mt-auto flex items-center gap-2 border-t border-rule-2 px-[18px] pt-3.5",children:d})]})}},40319:(e,t,a)=>{"use strict";a.d(t,{r:()=>i});var n=a(78604),r=a(53087),l=a(54935);let s=n.forwardRef((e,t)=>n.createElement(r.A,{ref:t,...e,weights:l.A}));s.displayName="CheckCircleIcon";let i=s},43158:(e,t,a)=>{Promise.resolve().then(a.bind(a,29697)),Promise.resolve().then(a.bind(a,93275)),Promise.resolve().then(a.bind(a,22450))},54935:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var n=a(78604);let r=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),n.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",n.createElement(n.Fragment,null,n.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]])},64678:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return l.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return s.findSourceMapURL}};for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:n[r]});let l=a(22673),s=a(43145),i=a(87478)},86127:(e,t,a)=>{"use strict";a.d(t,{r:()=>i});var n=a(78604),r=a(5977),l=a(54935);let s=n.forwardRef((e,t)=>n.createElement(r.A,{ref:t,...e,weights:l.A}));s.displayName="CheckCircleIcon";let i=s},88499:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var n=a(3680);function r({children:e,className:t=""}){return(0,n.jsx)("code",{className:`inline-flex items-center rounded-[5px] bg-hover px-1.5 py-1 font-mono text-[11px] leading-none tracking-[0.02em] text-ink-2 ${t}`,children:e})}},93275:(e,t,a)=>{"use strict";a.d(t,{default:()=>l});var n=a(3680),r=a(27540);function l({code:e,message:t}){let a=(0,r.useRouter)();return(0,n.jsx)("div",{role:"alert",className:"rounded-xl border border-err/30 bg-warn-bg px-5 py-4 text-sm text-err",children:(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"font-bold text-err",children:"!"}),(0,n.jsx)("p",{className:"font-semibold text-err",children:"OAuth connection failed"}),(0,n.jsx)("code",{className:"font-mono text-[10px] text-err/80 bg-warn-bg px-1.5 py-0.5 rounded",children:e})]}),(0,n.jsx)("p",{className:"text-err leading-relaxed",children:t})]}),(0,n.jsx)("button",{type:"button",onClick:function(){a.replace("/connectors")},"aria-label":"Dismiss",className:"shrink-0 text-err/70 hover:text-err transition-colors text-lg leading-none px-2 -mt-0.5",children:"\xd7"})]})})}},93606:(e,t,a)=>{"use strict";a.d(t,{A:()=>c});var n=a(3680),r=a(86127),l=a(22089),s=a(82592);let i={done:"Done",warn:"Attention",run:"Running",idle:"Idle","lvl-info":"INFO","lvl-ok":"OK","lvl-warn":"WARN","lvl-err":"ERR"},o={done:"bg-ok-bg text-ok",warn:"bg-warn-bg text-warn",run:"bg-run-bg text-run",idle:"bg-black/5 text-ink-3 dark:bg-white/5","lvl-info":"bg-black/5 text-ink-3 dark:bg-white/5","lvl-ok":"bg-ok-bg text-ok","lvl-warn":"bg-warn-bg text-warn","lvl-err":"bg-warn-bg text-err"};function c({variant:e,label:t,icon:a,className:d=""}){let u=t??i[e],x=null;return void 0!==a?x=a:"done"===e?x=(0,n.jsx)(r.r,{size:11,weight:"regular"}):"warn"===e?x=(0,n.jsx)(l.N,{size:11,weight:"regular"}):"run"===e&&(x=(0,n.jsx)(s.A,{variant:"blue",size:"sm"})),(0,n.jsxs)("span",{className:`inline-flex h-[22px] items-center gap-1.5 rounded-[5px] px-2.5 text-[11px] font-medium leading-none ${o[e]} ${d}`,children:[x,u]})}}},e=>{e.O(0,[3363,9504,3141,4239,1065,8724,7358],()=>e(e.s=43158)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4087],{2393:(e,t,r)=>{Promise.resolve().then(r.bind(r,36448))},14308:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(3680),s=r(78604),i=r(51869);function a({open:e,title:t,message:r,confirmLabel:l="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:x}){let u=(0,s.useRef)(null),[m,h]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{h(!0)},[]),(0,s.useEffect)(()=>{if(e)return u.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&x()}},[e,x]),e&&m)?(0,i.createPortal)((0,n.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",className:"fixed inset-0 z-50 flex items-center justify-center px-4 text-left",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:x,"aria-hidden":"true"}),(0,n.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,n.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),r&&(0,n.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:r}),(0,n.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,n.jsx)("button",{ref:u,type:"button",onClick:x,className:"px-4 py-2 text-sm font-medium border border-rule text-ink-2 rounded-lg hover:border-rule hover:text-ink transition-colors",children:o}),(0,n.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:l})]})]})]}),document.body):null}},36448:(e,t,r)=>{"use strict";r.d(t,{default:()=>b});var n=r(3680),s=r(78604),i=r(27540),a=r(39504),l=r(40189),o=r(63363),d=r.n(o),c=r(14308);let x=new Set(["google-oauth","airtable-oauth"]),u={"google-oauth":"Google","notion-oauth":"Notion","airtable-oauth":"Airtable"};function m({credential:e,onDelete:t,onRename:r,onRefresh:i}){var l;let[o,h]=(0,s.useState)(!1),[p,b]=(0,s.useState)(!1),[f,g]=(0,s.useState)(e.name),[v,y]=(0,s.useTransition)(),[k,j]=(0,s.useTransition)(),N=x.has(e.type),w=!!(l=e.expiresAt)&&l.getTime()<Date.now(),C=function(e){let t;if(!e)return"";let r=Math.round((e.getTime()-Date.now())/1e3),n=Math.abs(r);return t=n<60?`${n}s`:n<3600?`${Math.round(n/60)} min`:n<86400?`${Math.round(n/3600)} h`:`${Math.round(n/86400)} d`,r>=0?`expires in ${t}`:`expired ${t} ago`}(e.expiresAt),R=u[e.type]??e.type,$=e.inUseBy.length;function E(){let t=f.trim();t&&t!==e.name?y(async()=>{let n=await r(e.id,t);n.ok?(a.oR.success("Credential renamed"),b(!1)):a.oR.error(n.message)}):b(!1)}return(0,n.jsxs)("div",{className:"bg-paper border border-rule-2 rounded-xl p-5 space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h3",{className:"text-base font-semibold text-ink truncate",children:e.name}),(0,n.jsx)("span",{className:"inline-block px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider bg-indigo-500/15 text-indigo-400 shrink-0",children:R})]}),e.accountName&&(0,n.jsx)("p",{className:"text-xs text-ink-3 mt-0.5",children:e.accountName}),N?(0,n.jsx)("p",{className:"text-xs text-ink-3 mt-0.5",children:"Auto-refreshes when used"}):C?(0,n.jsx)("p",{className:`text-xs mt-0.5 ${w?"text-warn":"text-ink-3"}`,children:C}):null]}),(0,n.jsxs)("div",{className:"flex gap-2 shrink-0 flex-wrap justify-end",children:[(0,n.jsx)("button",{type:"button",onClick:()=>b(!0),disabled:v||k,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:"Rename"}),N&&(0,n.jsx)("button",{type:"button",onClick:function(){j(async()=>{let t=await i(e.id);t.ok?a.oR.success("Token refreshed"):a.oR.error(t.message??"Refresh failed")})},disabled:k||v,className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:k?"Refreshing…":"Refresh"}),(0,n.jsx)("button",{type:"button",onClick:()=>h(!0),disabled:v||k,className:"px-3 py-1.5 text-xs font-medium border border-err/30 text-err rounded-md hover:border-err hover:text-err disabled:opacity-40",children:"Delete"})]})]}),e.decryptError&&(0,n.jsxs)("div",{className:"px-3 py-2 rounded border border-err/30 bg-warn-bg text-xs text-err",children:[(0,n.jsx)("span",{className:"font-semibold",children:"Cannot decrypt this credential."})," The encrypted payload could not be read (master key changed or row corrupted). Delete and recreate it."]}),e.scopes&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:e.scopes.split(/\s+/).map(e=>(0,n.jsx)("span",{className:"px-1.5 py-0.5 bg-hover text-ink-3 rounded text-[10px] font-mono",children:e},e))}),$>0&&(0,n.jsxs)("div",{className:"flex flex-wrap gap-1 items-center",children:[(0,n.jsx)("span",{className:"text-[10px] text-ink-4 uppercase tracking-wider font-semibold mr-1",children:"Used by"}),e.inUseBy.map(e=>(0,n.jsx)(d(),{href:"/connectors",className:"px-2 py-0.5 rounded text-[10px] bg-hover text-ink-3 hover:text-ink hover:bg-hover-2 transition-colors font-mono",children:e.connectorSlug},e.connectorId))]}),p&&(0,n.jsxs)("div",{className:"pt-2 border-t border-rule-2 space-y-2",children:[(0,n.jsx)("label",{className:"block text-xs text-ink-3",children:"New display name"}),(0,n.jsx)("input",{type:"text",value:f,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&E(),"Escape"===e.key&&b(!1)},autoFocus:!0,className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:E,disabled:v,className:"px-3 py-1.5 text-xs font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:v?"Saving…":"Save"}),(0,n.jsx)("button",{type:"button",onClick:()=>{b(!1),g(e.name)},className:"px-3 py-1.5 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink",children:"Cancel"})]})]}),(0,n.jsx)(c.A,{open:o,title:`Delete "${e.name}"?`,message:$>0?`This credential is used by ${$} connector${1!==$?"s":""} which will be disconnected.`:"This credential will be permanently deleted.",confirmLabel:"Delete",onConfirm:function(){h(!1),y(async()=>{let r=await t(e.id);r.ok?a.oR.success(`Credential "${e.name}" deleted`):a.oR.error(r.message)})},onCancel:()=>h(!1)})]})}var h=r(38666),p=r(77045);function b({credentials:e,justCreatedId:t,onDelete:r,onRename:o,onRefresh:d}){let c=(0,i.useRouter)(),x=(0,s.useRef)(!1),[u,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{t&&!x.current&&(x.current=!0,a.oR.success("Credential created"),c.replace("/credentials"))},[t,c]),(0,n.jsxs)("div",{className:"py-7",children:[(0,n.jsxs)("div",{className:"mb-5 flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-[28px] font-semibold leading-[1.15] tracking-[-0.015em] text-ink",children:"Credentials"}),(0,n.jsx)("p",{className:"mt-1.5 text-[13px] leading-[1.5] text-ink-3",children:0===e.length?"No credentials yet — create one to connect OAuth providers.":`${e.length} credential${1!==e.length?"s":""}`})]}),(0,n.jsxs)(p.A,{variant:"ink",onClick:()=>f(!0),children:[(0,n.jsx)(l.F,{size:13,weight:"bold"}),"New credential"]})]}),0===e.length?(0,n.jsxs)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:[(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:["Credentials store your OAuth client ID and secret securely (encrypted at rest).",(0,n.jsx)("br",{}),"Once created, multiple connectors can share the same credential."]}),(0,n.jsx)("div",{className:"mt-4 inline-flex",children:(0,n.jsxs)(p.A,{variant:"ink",onClick:()=>f(!0),children:[(0,n.jsx)(l.F,{size:13,weight:"bold"}),"Create your first credential"]})})]}):(0,n.jsx)("div",{className:"space-y-3",children:e.map(e=>(0,n.jsx)(m,{credential:e,onDelete:r,onRename:o,onRefresh:d},e.id))}),u&&(0,n.jsx)(h.A,{onClose:()=>f(!1)})]})}},53087:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(78604);let s=(0,n.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),i=n.forwardRef((e,t)=>{let{alt:r,color:i,size:a,weight:l,mirrored:o,children:d,weights:c,...x}=e,{color:u="currentColor",size:m,weight:h="regular",mirrored:p=!1,...b}=n.useContext(s);return n.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=a?a:m,height:null!=a?a:m,fill:null!=i?i:u,viewBox:"0 0 256 256",transform:o||p?"scale(-1, 1)":void 0,...b,...x},!!r&&n.createElement("title",null,r),d,c.get(null!=l?l:h))});i.displayName="IconBase"},77045:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(3680),s=r(63363),i=r.n(s);let a={ink:"bg-ink text-canvas hover:brightness-[0.92]",coral:"bg-skill-vivid text-white hover:brightness-[0.94]",blue:"bg-conn-vivid text-white hover:brightness-[0.94]"};function l(e){let{children:t,variant:r="ink",size:s="md",className:l=""}=e,o=`inline-flex items-center justify-center gap-1.5 rounded-md font-medium leading-none border-0 cursor-pointer transition-[filter] ${"md"===s?"h-[34px] px-3.5 text-[13px]":"h-[30px] px-3 text-[12px]"} ${a[r]} ${l}`;if("href"in e&&e.href){let{href:r,variant:s,size:a,className:l,children:d,...c}=e;return(0,n.jsx)(i(),{href:r,className:o,...c,children:t})}let{variant:d,size:c,className:x,children:u,...m}=e;return(0,n.jsx)("button",{type:"button",className:o,...m,children:t})}}},e=>{e.O(0,[3363,9504,4239,1065,8724,7358],()=>e(e.s=2393)),_N_E=e.O()}]);