nodal-agents 0.4.2 → 0.4.4

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 (130) hide show
  1. package/README.md +12 -12
  2. package/package.json +2 -1
  3. package/runner.js +247 -66
  4. package/web/.next/BUILD_ID +1 -1
  5. package/web/.next/build-manifest.json +2 -2
  6. package/web/.next/prerender-manifest.json +3 -3
  7. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js +3 -3
  8. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js.nft.json +1 -1
  9. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page_client-reference-manifest.js +1 -1
  10. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js +2 -2
  11. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page_client-reference-manifest.js +1 -1
  12. package/web/.next/server/app/(dashboard)/agents/page.js +2 -2
  13. package/web/.next/server/app/(dashboard)/agents/page_client-reference-manifest.js +1 -1
  14. package/web/.next/server/app/(dashboard)/approvals/page.js +2 -2
  15. package/web/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  16. package/web/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  17. package/web/.next/server/app/(dashboard)/automations/page.js +2 -2
  18. package/web/.next/server/app/(dashboard)/automations/page_client-reference-manifest.js +1 -1
  19. package/web/.next/server/app/(dashboard)/billing/page.js +2 -2
  20. package/web/.next/server/app/(dashboard)/billing/page_client-reference-manifest.js +1 -1
  21. package/web/.next/server/app/(dashboard)/chat/page.js +1 -1
  22. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  23. package/web/.next/server/app/(dashboard)/connectors/page.js +1 -1
  24. package/web/.next/server/app/(dashboard)/connectors/page.js.nft.json +1 -1
  25. package/web/.next/server/app/(dashboard)/connectors/page_client-reference-manifest.js +1 -1
  26. package/web/.next/server/app/(dashboard)/credentials/page.js +1 -1
  27. package/web/.next/server/app/(dashboard)/credentials/page.js.nft.json +1 -1
  28. package/web/.next/server/app/(dashboard)/credentials/page_client-reference-manifest.js +1 -1
  29. package/web/.next/server/app/(dashboard)/jobs/[id]/page.js +2 -2
  30. package/web/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
  31. package/web/.next/server/app/(dashboard)/jobs/page.js +2 -2
  32. package/web/.next/server/app/(dashboard)/jobs/page.js.nft.json +1 -1
  33. package/web/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
  34. package/web/.next/server/app/(dashboard)/llm-providers/page.js +1 -1
  35. package/web/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  36. package/web/.next/server/app/(dashboard)/logs/page.js +2 -2
  37. package/web/.next/server/app/(dashboard)/logs/page_client-reference-manifest.js +1 -1
  38. package/web/.next/server/app/(dashboard)/mcp/page.js +1 -1
  39. package/web/.next/server/app/(dashboard)/mcp/page_client-reference-manifest.js +1 -1
  40. package/web/.next/server/app/(dashboard)/memories/page.js +2 -2
  41. package/web/.next/server/app/(dashboard)/memories/page_client-reference-manifest.js +1 -1
  42. package/web/.next/server/app/(dashboard)/page.js +4 -4
  43. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  44. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  45. package/web/.next/server/app/(dashboard)/settings/page.js +2 -2
  46. package/web/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  47. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js +1 -1
  48. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js.nft.json +1 -1
  49. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page_client-reference-manifest.js +1 -1
  50. package/web/.next/server/app/(dashboard)/skills/new/page.js +2 -2
  51. package/web/.next/server/app/(dashboard)/skills/new/page.js.nft.json +1 -1
  52. package/web/.next/server/app/(dashboard)/skills/new/page_client-reference-manifest.js +1 -1
  53. package/web/.next/server/app/(dashboard)/skills/page.js +1 -1
  54. package/web/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
  55. package/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  56. package/web/.next/server/app/_global-error.html +1 -1
  57. package/web/.next/server/app/_global-error.rsc +2 -2
  58. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  59. package/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  60. package/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  61. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  62. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
  63. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  64. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/_not-found.html +1 -1
  66. package/web/.next/server/app/_not-found.rsc +2 -2
  67. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  68. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  69. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  70. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  71. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  72. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  73. package/web/.next/server/app/api/oauth/[provider]/callback/route.js +1 -1
  74. package/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
  75. package/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/onboarding.html +1 -1
  77. package/web/.next/server/app/onboarding.rsc +2 -2
  78. package/web/.next/server/app/onboarding.segments/_full.segment.rsc +2 -2
  79. package/web/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  80. package/web/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
  81. package/web/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  82. package/web/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
  83. package/web/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  84. package/web/.next/server/chunks/3233.js +1 -1
  85. package/web/.next/server/chunks/3889.js +1 -0
  86. package/web/.next/server/chunks/5329.js +1 -0
  87. package/web/.next/server/chunks/593.js +1 -0
  88. package/web/.next/server/chunks/7231.js +1 -0
  89. package/web/.next/server/chunks/7741.js +1 -1
  90. package/web/.next/server/middleware-build-manifest.js +1 -1
  91. package/web/.next/server/pages/404.html +1 -1
  92. package/web/.next/server/pages/500.html +1 -1
  93. package/web/.next/server/server-reference-manifest.js +1 -1
  94. package/web/.next/server/server-reference-manifest.json +1 -1
  95. package/web/.next/static/chunks/{9123-20653d928e33410a.js → 9123-67530ba510c58003.js} +1 -1
  96. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-a2c267f563cd1a70.js +2 -0
  97. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/telegram/page-2d7cae43f5e6952a.js +1 -0
  98. package/web/.next/static/chunks/app/(dashboard)/agents/page-bed833ebdd3646fb.js +1 -0
  99. package/web/.next/static/chunks/app/(dashboard)/approvals/{page-79dea6e91956eeba.js → page-4b27762472802ce0.js} +1 -1
  100. package/web/.next/static/chunks/app/(dashboard)/automations/{page-3b863b7af8e2c1a3.js → page-9e5d2ce807ce1c37.js} +1 -1
  101. package/web/.next/static/chunks/app/(dashboard)/chat/page-8f81d7e3abb475a6.js +1 -0
  102. package/web/.next/static/chunks/app/(dashboard)/connectors/{page-4a437ba82f4086da.js → page-39b1d9560235d574.js} +1 -1
  103. package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-112bb22a9ec43be0.js +1 -0
  104. package/web/.next/static/chunks/app/(dashboard)/jobs/{page-94a311f688a255d8.js → page-44351170ed5f9180.js} +1 -1
  105. package/web/.next/static/chunks/app/(dashboard)/{layout-e1b0d4fad2926646.js → layout-53e69de869cba0d0.js} +1 -1
  106. package/web/.next/static/chunks/app/(dashboard)/llm-providers/{page-e5e2c4e2b783d37f.js → page-8f6ce47ba228e38b.js} +1 -1
  107. package/web/.next/static/chunks/app/(dashboard)/mcp/page-cdf057e468c6e92e.js +1 -0
  108. package/web/.next/static/chunks/app/(dashboard)/memories/page-e706ab4aa681fa99.js +1 -0
  109. package/web/.next/static/chunks/app/(dashboard)/{page-fb50e1576a3ab2e4.js → page-29cfae3bf701076e.js} +1 -1
  110. package/web/.next/static/chunks/app/(dashboard)/settings/page-312ae27ae71ea6d1.js +1 -0
  111. package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-89a8a30db5eb96e1.js +1 -0
  112. package/web/.next/static/chunks/app/(dashboard)/skills/new/page-46a424b203591560.js +1 -0
  113. package/web/.next/static/chunks/app/(dashboard)/skills/page-edad7bbd3230fb7a.js +1 -0
  114. package/web/.next/server/chunks/1945.js +0 -1
  115. package/web/.next/server/chunks/4839.js +0 -1
  116. package/web/.next/server/chunks/8206.js +0 -1
  117. package/web/.next/server/chunks/8398.js +0 -1
  118. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-a8e293c54c818084.js +0 -2
  119. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/telegram/page-7a94ae67b2c3c9c3.js +0 -1
  120. package/web/.next/static/chunks/app/(dashboard)/agents/page-b258b8975ac6450b.js +0 -1
  121. package/web/.next/static/chunks/app/(dashboard)/chat/page-4d965bb7ee3732db.js +0 -1
  122. package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-be20dcbf25c8f3ce.js +0 -1
  123. package/web/.next/static/chunks/app/(dashboard)/mcp/page-c071c54f76273ac4.js +0 -1
  124. package/web/.next/static/chunks/app/(dashboard)/memories/page-8ca0b34ad35eb1fa.js +0 -1
  125. package/web/.next/static/chunks/app/(dashboard)/settings/page-7b256e9c462e97f8.js +0 -1
  126. package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-12930816795e8b20.js +0 -1
  127. package/web/.next/static/chunks/app/(dashboard)/skills/new/page-e3a19abaf7468db9.js +0 -1
  128. package/web/.next/static/chunks/app/(dashboard)/skills/page-43f1475a0bc9c45f.js +0 -1
  129. /package/web/.next/static/{ZuUX-HBTQOhLf0tFI6JQI → PV5qpGylrVW3jZ7zKHuhE}/_buildManifest.js +0 -0
  130. /package/web/.next/static/{ZuUX-HBTQOhLf0tFI6JQI → PV5qpGylrVW3jZ7zKHuhE}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";exports.id=8398,exports.ids=[8398],exports.modules={7720:(a,b,c)=>{c.d(b,{m:()=>e,o:()=>d});let d={"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."}},e={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-"}}},7935:(a,b,c)=>{c.r(b),c.d(b,{"0001a2098a01631f448f8e2e7256c342a70a4f8fce":()=>d.$z,"0001eea186e7cab43bced1965c5bda7632b511f398":()=>d.cj,"000357a4b97c621c792fba8213ef7ae7505018fcd3":()=>d.oA,"0033cc88f3b3477b989e9df2edac4a6ce3e3f58250":()=>d.oG,"003e18e0fad52d29deb751c8f661f19b7717fcff5c":()=>d.Ko,"003f32faa2479a4dce73325e1f0b3db3d1f544e270":()=>d.dO,"00471a08cbfe30783ae558daa3926bdd257abcca26":()=>d.BO,"0055a5e407a06696d0cd78161c2024a7dc0f865735":()=>d.JD,"00724d8c4d22104172f7e88beedeaed018ddaa1b9a":()=>d.Le,"00728028b2eb4e67b0e2b874b03d370fe1d91bb338":()=>d.M3,"007a4f71348b1fb8b20a43debd7f0814e67c62a266":()=>d.pD,"009b2aebb53c355ea693b72eb51ed2b79a06fe0fcb":()=>d.Zz,"00c5a58fca98e0b66a21c226cc3a16e7cc9ef9e046":()=>d.$4,"00c88254b0ab7e6527a14ab353f0354a93c22a8e66":()=>d.Hy,"00cd03744442b23685f3832db6fb9ae765bd63dfcd":()=>d.$5,"00e380381f0bf9caafc2c162493236800179ff748d":()=>d.Ql,"00e93f5a30fbb4748e0f30addc55e311d26b3a1e21":()=>d.VZ,"00f347a602753f7d10260f90aab34af24d59ebbd3e":()=>d.zh,"4001dcf648a52984ff32bcc647ffa470fb68b09cec":()=>d.ei,"40044cbfd30d3a380dfa65d1f1bac57af888684dfa":()=>d._x,"400a618371c75d32e73dfab28acb51b7db500aab1c":()=>d.y4,"400ca4c91c055218dcdc663b53bc21d219783e16f2":()=>d.eP,"400cfdc41e4bf4ffb900586307c0e1b774f8b5393a":()=>d.CV,"400f1516aea326fe8ab6e2c07202680b0da997a3bf":()=>d._N,"4015389522a581e79a290ddf4ccda681da7e3e602f":()=>d.Hp,"40162d8df2e52a907c99cd0a9d8d4bc05202f4d5e5":()=>d.fl,"401f4fb51c8eb3ebbb19cb59c5e23502c68a42d62a":()=>d.Cy,"402d1dae72e7231c36679c809c8d55365674695323":()=>d.S2,"402dd9b41913f4df0dc409b17a7f342badb27eda92":()=>d.xV,"40314db96cdaf34762dd2363662db4bee58982baf4":()=>d.Rz,"403601917fce9df1a8214098418b6c880126a33bda":()=>d.e4,"4037207befca10bb542d700e5232bd286c98781d5e":()=>d.QT,"403841485f398c760228bf932338d55e8493d0332e":()=>d.fG,"403928f9cfca7ec3986ffae44cead3466612ae83fa":()=>d.PH,"4043fd062e51d792226e9aaa93a0578d2066285682":()=>d.rT,"4047290d2ad6a981481bd95c915a26b2dd8b434896":()=>d.bN,"40478f1a577901d4467c5b683c46d0a2f8f98654c2":()=>e.Bs,"404912c6c805f1cee60f4f4fc38f2528b768406fb6":()=>d.HO,"404ae92a4884f24a9d0d96b484c9a0eb05289bdc1c":()=>d.AS,"4052967950b494e22cd435b66a556d540a965df63a":()=>d.Wq,"4052b64a6183fe248882f2c27441addf9e9e07bb4a":()=>d.iU,"405441c5447e7f0cc99b8c935b54e903aa38a592ca":()=>d.fI,"405e6ab4f6b3f7d0ca79943dd7c850fefad7099fbe":()=>d.LN,"405fccf8c384bb49d592d555a9d19562d33294a37e":()=>d.rf,"40633131ff7c417ddc94a2d111d4b7242174d7d3d5":()=>d.EA,"406439137cb7d4544c2b414e89282a6e3c5c373da2":()=>d.oC,"4065c4f7485462878810b4367bb2071b5e7de6a367":()=>d.Ke,"4067a8d48830fe5172f84c37187e6a2383152974dc":()=>d.gE,"4069f5841b60ff6b623370147903caf7970d85fc29":()=>d.X1,"406bc57145dd20a43bf9eb44ad644423cd40feacc5":()=>d.t3,"406e77ecff957cc585bcb26dd261255f9f2898d578":()=>d.iu,"4074fba9a9b77f695cae5c335f58c9cb06018ef143":()=>d.rv,"4076fe837a437fc16fbfdf9ae42b8d01330ffd1cde":()=>d.cr,"407e027cfc6438bdd6aa0a116dd96d8b9f1aa95fdd":()=>d.By,"40871f9e81ec4546f4f88b8550094fef7bfcd7a418":()=>d.P7,"408b3de093f9bcf31d51e2be76356609e27b9322d5":()=>d.Jb,"4092dc652d59fc1cd56ed109ecf08033028030b03b":()=>d.JH,"4095362ab18ceb12b9cae65f132d1aa5bf0f91ba50":()=>e.Gw,"409c323309b6e0c70c7e5fa891476c4f8a5724ed85":()=>d.hl,"409ec0cda17508fdfbb081f36bb78f64a0cedcc1de":()=>d.Ev,"40a2f99fceaa61fd4a74b0c6f3b01f599d36e2ea48":()=>d.Og,"40a775f04cb3ac41b01717bea17e5125c7c323ca14":()=>d.lV,"40ae142f3021cbdd06d5717bdffcc1ad58e6031d04":()=>d.WH,"40ae45fa762350801d0bbb6a81fbb26079b8b6cc00":()=>d.Ro,"40b31054d17065135c1994442ce190d2b0b5281bd6":()=>e.DF,"40bb25b856f502b069916be582ba5ba4b59f0fd377":()=>d.ZA,"40c2a1a8bbe7ffe80d3ff0c990a6c8654ded77d9a1":()=>d.PD,"40c79b6c35e3bd74cad98121c4441e16924c3a0163":()=>e.Jh,"40cf6a26aa9acd16be3a0c9b353c8102210c884458":()=>d.TD,"40d1bd442c90bc9723cf4f2cb23e3314c55dbe2835":()=>d.Sh,"40d4438800367db8da074265f2947c1bf13285e37a":()=>d.c6,"40d4aa141d9a87660e25bf42619062a975f4fbfcad":()=>e.FT,"40d69a1ce58eda67b96c81a500c437e9107611b2d7":()=>d.ZG,"40dc8a6b4278d8a81c973ba871e34e76afa12c60fb":()=>d.f_,"40de046de0bddf3387f259087a088306728aef5546":()=>d.Mo,"40de7de0d0c60c355737be884a0f4a3fb4344e7b12":()=>d.pu,"40e7f8235ea05603b604a187b6856b07f20c86ca28":()=>d.UR,"40ebde0ab3fe9c43462ac8e177421049003d8f251a":()=>d.Sb,"40edfa610d9f4f1799cc65a92742ab593c2dafa41b":()=>d.hP,"40facb78698674673e654bfa0ef67e6b589d0ea3cc":()=>d.cu,"40fe8d2ab51c2dd88084e726bf2a3f04cc7ce7a5e1":()=>e._E,"6027df2597319ed4f15048c44cfae75dec92fd42fc":()=>d.Ru,"60943f6e65ce8746f79a517f650bb15ea55702262c":()=>d.dd,"60a525fb1a7d0371de2f00a8eb7c3bda7a31685ea6":()=>d.c2,"60b2ec0fde8727e97be37bfe26f8a86ad2dcb409be":()=>d.f2,"60dd24aaaa22c1da2093cefa4bcd38555c7dbda203":()=>d.wI,"60e1dae0f6fcb459194ac6847f177cd7ea5167958d":()=>d.qo,"60ec0d7acf6ae077de5c2f5dc3df9068481eac1087":()=>d.yU,"60fa3e1656cac7acb3b16deddc01305765d41851ec":()=>d.vu,"60fb166498c3b29c31edbdbf931b7ef0d00a3bbc91":()=>e.Av,"701da93c8522b797df48348b38d4619e704c151a4e":()=>d.Jc,"7041fb86f0b54be1543e88faa8ae18ffff53082138":()=>d.z_,"70d398e886e045c6741c5251cd841a4fb1b585f282":()=>d.ch,"70f2a9ff93ddc1531a5571077d2b2726ac5272e9d0":()=>d.Oc,"78098002e441d38ebd5b6eec9b95f9890febb3b6dd":()=>d.AH,"788d516a7a7d59ef016aee06fe39b3a2fc32f50e6e":()=>d.wj});var d=c(5786),e=c(28881)},28881:(a,b,c)=>{c.d(b,{Av:()=>q,Bs:()=>p,DF:()=>u,FT:()=>o,Gw:()=>s,Jh:()=>r,_E:()=>t});var d=c(43607),e=c(87388),f=c(90454),g=c(98472),h=c(61989),i=c(95488),j=c(42112),k=c(66402);function l(a){return{ok:!0,data:a}}function m(a,b){return{ok:!1,code:a,message:b}}async function n(){let a,b=(0,i.Iz)();try{let b=await (0,k.headers)();a=new Request("http://localhost/",{headers:b})}catch{a=new Request("http://localhost/")}return(0,j.oC)(a,b)}async function o(a){try{let b=await n(),c=(0,i.Lf)(),d=await c.select().from(f.z3).where((0,f.eq)(f.z3.ownerUserId,b.userId)),e=void 0!==a?d.filter(b=>b.type===a):d,g=await Promise.all(e.map(async a=>{let b=null,d=null,e=null,g=null;try{let g=await (0,f.G0)(c,a.id);g&&(b=g.payload.accountName??null,d=g.payload.expiresAt?new Date(g.payload.expiresAt):null,e=g.payload.scopes??null)}catch(a){g=a instanceof Error?a.message:"decrypt_failed"}let h=(await c.select({id:f.tK.id,slug:f.tK.slug}).from(f.tK).where((0,f.eq)(f.tK.credentialId,a.id))).map(a=>({connectorSlug:a.slug,connectorId:a.id}));return{id:a.id,name:a.name,type:a.type,accountName:b,expiresAt:d,scopes:e,inUseBy:h,createdAt:a.createdAt,updatedAt:a.updatedAt,decryptError:g}}));return l(g)}catch(a){return console.error("[listCredentialsAction]",a),m("db_error","Failed to load credentials")}}async function p(a){try{let b=await n();if(!h.Yj().guid().safeParse(a).success)return m("validation_failed","Invalid credential id");let c=(0,i.Lf)(),[d]=await c.select({id:f.z3.id,ownerUserId:f.z3.ownerUserId}).from(f.z3).where((0,f.eq)(f.z3.id,a));if(!d)return m("not_found","Credential not found");if(d.ownerUserId!==b.userId)return m("forbidden","Access denied");let g=(await c.select({id:f.tK.id}).from(f.tK).where((0,f.eq)(f.tK.credentialId,a))).length;return await c.delete(f.z3).where((0,f.eq)(f.z3.id,a)),(0,e.revalidatePath)("/credentials"),(0,e.revalidatePath)("/connectors"),l({disconnected:g})}catch(a){return console.error("[deleteCredentialAction]",a),m("db_error","Failed to delete credential")}}async function q(a,b){try{let c=await n();if(!h.Yj().guid().safeParse(a).success)return m("validation_failed","Invalid credential id");let d=b.trim();if(0===d.length||d.length>120)return m("validation_failed","Name must be 1–120 characters");let g=(0,i.Lf)(),[j]=await g.select({id:f.z3.id,ownerUserId:f.z3.ownerUserId}).from(f.z3).where((0,f.eq)(f.z3.id,a));if(!j)return m("not_found","Credential not found");if(j.ownerUserId!==c.userId)return m("forbidden","Access denied");return await g.update(f.z3).set({name:d,updatedAt:new Date}).where((0,f.eq)(f.z3.id,a)),(0,e.revalidatePath)("/credentials"),l(void 0)}catch(a){return console.error("[renameCredentialAction]",a),m("db_error","Failed to rename credential")}}async function r(a){try{let b=await n();if(!h.Yj().guid().safeParse(a).success)return m("validation_failed","Invalid credential id");let c=(0,i.Lf)(),[d]=await c.select({id:f.z3.id,ownerUserId:f.z3.ownerUserId}).from(f.z3).where((0,f.eq)(f.z3.id,a));if(!d)return m("not_found","Credential not found");if(d.ownerUserId!==b.userId)return m("forbidden","Access denied");let{expiresAt:g}=await (0,f.Ic)(c,a);return(0,e.revalidatePath)("/credentials"),l({expiresAt:g})}catch(b){let a=b instanceof Error?b.message:String(b);if(console.error("[refreshCredentialAction]",b),a.includes("does not support token refresh"))return m("oauth_no_refresh","This provider does not support token refresh");if(a.includes("missing refreshToken"))return m("missing_refresh_token","Credential is missing refresh token");return m("refresh_failed",`Token refresh failed: ${a}`)}}async function s(a){return(0,f.Se)((0,i.Lf)(),a)}async function t(a){return(0,f.Ic)((0,i.Lf)(),a)}async function u(a){let{ownerUserId:b,credentialType:c,name:d,payload:h}=a,j=(0,i.Lf)(),k=JSON.stringify(h),l=(0,g.ph)(k)?k:(0,g.w)(k),[m]=await j.insert(f.z3).values({ownerUserId:b,name:d,type:c,payload:l}).returning({id:f.z3.id});if(!m)throw Error("persistCredentialFromOauthFlow: insert returned no row");return(0,e.revalidatePath)("/credentials"),{id:m.id}}(0,c(75749).D)([o,p,q,r,s,t,u]),(0,d.A)(o,"40d4aa141d9a87660e25bf42619062a975f4fbfcad",null),(0,d.A)(p,"40478f1a577901d4467c5b683c46d0a2f8f98654c2",null),(0,d.A)(q,"60fb166498c3b29c31edbdbf931b7ef0d00a3bbc91",null),(0,d.A)(r,"40c79b6c35e3bd74cad98121c4441e16924c3a0163",null),(0,d.A)(s,"4095362ab18ceb12b9cae65f132d1aa5bf0f91ba50",null),(0,d.A)(t,"40fe8d2ab51c2dd88084e726bf2a3f04cc7ce7a5e1",null),(0,d.A)(u,"40b31054d17065135c1994442ce190d2b0b5281bd6",null)},60968:(a,b,c)=>{c.d(b,{A:()=>f});var d=c(10476),e=c(64565);function f({guide:a}){let[b,c]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"space-y-3",children:[a.intro&&(0,d.jsx)("p",{className:"text-xs text-ink-3 italic",children:a.intro}),b&&a.warning&&(0,d.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,d.jsx)("span",{"aria-hidden":"true",className:"font-bold",children:"!"}),(0,d.jsx)("span",{children:a.warning})]}),(0,d.jsx)("ol",{className:"space-y-2.5",children:a.steps.map(a=>(0,d.jsxs)("li",{className:"flex gap-2",children:[(0,d.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:a.number}),(0,d.jsxs)("div",{className:"space-y-1.5 text-sm text-ink-3",children:[(0,d.jsxs)("span",{children:[a.text,a.link&&(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsx)("a",{href:a.link.href,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline",children:a.link.label})]})]}),a.subLinks&&a.subLinks.length>0&&(0,d.jsx)("ul",{className:"mt-1 space-y-1 pl-1",children:a.subLinks.map(a=>(0,d.jsxs)("li",{className:"flex items-center gap-1.5 text-xs",children:[(0,d.jsx)("span",{className:"text-ink-4",children:"•"}),(0,d.jsx)("a",{href:a.href,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-400 hover:text-indigo-300 underline",children:a.label})]},a.href))}),a.hint&&(0,d.jsx)("p",{className:"text-xs text-ink-3 italic",children:a.hint})]})]},a.number))}),a.format&&(0,d.jsxs)("p",{className:"text-xs text-ink-3",children:["Format: ",(0,d.jsx)("code",{className:"font-mono text-ink-3",children:a.format})]})]})}},63364:(a,b,c)=>{c.d(b,{A:()=>k});var d=c(10476),e=c(64565),f=c(90424),g=c(60968),h=c(7720);let i={"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"}},j=[{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 k({initialType:a,returnToConnectorSlug:b,onClose:c}){let[l,m]=(0,e.useState)(a?"setup":"type"),[n,o]=(0,e.useState)(a??null),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(!1),t=(0,e.useRef)(null),u=n?i[n]:null,v=b?`/connectors?connectorSlug=${b}`:"/credentials",w=n?`/api/oauth/${n}/start`:"#";return r?(0,f.createPortal)((0,d.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,d.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:c,"aria-hidden":"true"}),(0,d.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,d.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-rule-2 shrink-0",children:[(0,d.jsx)("h2",{id:"wizard-title",className:"text-base font-semibold text-ink",children:"type"===l?"New credential":u?`Configure ${u.label} credential`:"Configure credential"}),(0,d.jsx)("button",{type:"button",onClick:c,className:"text-ink-3 hover:text-ink transition-colors text-xl leading-none","aria-label":"Close",children:"\xd7"})]}),"type"===l&&(0,d.jsxs)("div",{className:"overflow-y-auto px-6 py-5 space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-ink-3",children:"Choose the OAuth provider to connect to Nodal-Agents."}),(0,d.jsx)("div",{className:"space-y-2",children:j.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>{o(a.type),m("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,d.jsx)("div",{className:"text-sm font-semibold text-ink group-hover:text-ink",children:a.label}),(0,d.jsx)("div",{className:"text-xs text-ink-3 mt-0.5",children:a.description})]},a.type))}),(0,d.jsx)("div",{className:"pt-2 flex justify-end",children:(0,d.jsx)("button",{type:"button",onClick:c,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"===l&&u&&n&&(0,d.jsxs)("form",{ref:t,method:"POST",action:w,encType:"application/x-www-form-urlencoded",className:"overflow-y-auto px-6 py-5 space-y-5",children:[(0,d.jsx)("input",{type:"hidden",name:"returnTo",value:v}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-xs text-ink-3 font-semibold uppercase tracking-wider",children:"Setup instructions"}),(0,d.jsx)(g.A,{guide:h.o[n]})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-xs text-ink-3",children:"Authorized redirect URI"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 bg-hover border border-rule rounded-md px-3 py-2",children:[(0,d.jsx)("code",{className:"text-xs text-ink-2 font-mono flex-1 break-all",children:p||"…"}),(0,d.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,d.jsxs)("div",{className:"space-y-3 border-t border-rule-2 pt-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-xs text-ink-3 mb-1",children:["Display name ",(0,d.jsx)("span",{className:"text-ink-4",children:"(optional)"})]}),(0,d.jsx)("input",{name:"name",placeholder:u.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,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:u.clientIdLabel}),(0,d.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,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:u.clientSecretLabel}),(0,d.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,d.jsxs)("div",{className:"flex gap-2 justify-end pt-1",children:[(0,d.jsx)("button",{type:"button",onClick:c,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"}),!a&&(0,d.jsx)("button",{type:"button",onClick:()=>m("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,d.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 ",u.label]})]})]})]})]}),document.body):null}}};
@@ -1,2 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3990],{21021:(e,t,n)=>{"use strict";n.d(t,{a:()=>l,d:()=>r});let l={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"},s={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 s[e]??t.slice(0,2).toUpperCase()}},23270:(e,t,n)=>{"use strict";n.d(t,{f:()=>s});var l=n(64678);let s=(0,l.createServerReference)("403841485f398c760228bf932338d55e8493d0332e",l.callServer,void 0,l.findSourceMapURL,"updateAgentAction")},35196:(e,t,n)=>{"use strict";n.d(t,{default:()=>p});var l=n(3680),s=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,s.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,l.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,l.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,l.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,s.useState)("All"),[m,g]=(0,s.useState)(""),b=(0,s.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),f=(0,s.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,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"mb-3.5 flex flex-wrap items-center gap-2.5",children:[(0,l.jsx)(i,{tabs:x,defaultValue:"All",variant:"dark-active",onChange:e=>h(e)}),(0,l.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,l.jsx)(c.e,{size:13,className:"shrink-0"}),(0,l.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,l.jsx)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:0===f.length?(0,l.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,l.jsx)("div",{className:"overflow-x-auto",children:(0,l.jsxs)("table",{className:"w-full border-collapse text-sm",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)(u,{children:"Agent"}),(0,l.jsx)(u,{children:"Task"}),(0,l.jsx)(u,{className:"hidden md:table-cell",children:"Channel"}),(0,l.jsx)(u,{className:"hidden lg:table-cell",children:"Started"}),(0,l.jsx)(u,{align:"right",children:"Status"})]})}),(0,l.jsx)("tbody",{children:f.map(e=>{var t,n,s,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,l.jsxs)("tr",{className:"border-b border-dashed border-rule-2 last:border-0 hover:bg-hover transition-colors",children:[(0,l.jsx)("td",{className:"px-[18px] py-3 align-middle",children:i?(0,l.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,l.jsx)(d.A,{name:i.name,imageUrl:i.avatarUrl,size:"md",shape:"round"}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"truncate text-[13px] font-medium leading-[1.2] text-ink",children:i.name}),(0,l.jsx)("div",{className:"truncate font-mono text-[10px] leading-none text-ink-4",children:i.slug})]})]}):(0,l.jsx)("span",{className:"font-mono text-[11px] text-ink-4",children:"—"})}),(0,l.jsx)("td",{className:"max-w-[320px] px-[18px] py-3 align-middle",children:(0,l.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,l.jsx)("td",{className:"hidden px-[18px] py-3 align-middle font-mono text-[11px] text-ink-4 md:table-cell",children:e.channel}),(0,l.jsx)("td",{className:"hidden px-[18px] py-3 align-middle font-mono text-[11px] text-ink-4 lg:table-cell",children:(s=e.createdAt)?("string"==typeof s?new Date(s):s).toLocaleString(void 0,{weekday:"short",hour:"2-digit",minute:"2-digit"}):"—"}),(0,l.jsx)("td",{className:"px-[18px] py-3 align-middle text-right",children:(0,l.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,l.jsx)("th",{className:`border-b border-rule-2 px-[18px] pt-1.5 pb-2.5 font-mono text-[9.5px] font-normal whitespace-nowrap 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 l=n(3680),s=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,s.useState)(!1),[p,u]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{u(!0)},[]),(0,s.useEffect)(()=>{if(c)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&x(!1)}},[c]),(0,l.jsxs)("div",{children:[n&&(0,l.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:n}),(0,l.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,l.jsx)(o,{url:e,size:36}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"text-sm text-ink truncate",children:e?e.split("/").pop()?.replace(".png",""):"No avatar"}),(0,l.jsxs)("p",{className:"text-[11px] text-ink-3",children:["Click to ",e?"change":"pick"]})]})]}),p&&c&&(0,r.createPortal)((0,l.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,l.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,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h3",{className:"text-sm font-semibold text-ink",children:"Pick an avatar"}),(0,l.jsx)("button",{type:"button",onClick:()=>x(!1),className:"text-ink-3 hover:text-ink text-xs",children:"Close (Esc)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-6 gap-3",children:[(0,l.jsx)(d,{selected:null===e,onClick:()=>void(t(null),x(!1)),label:"None",url:null}),a.map(n=>(0,l.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,l.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,l.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:s}){return(0,l.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,l.jsx)(o,{url:s,size:56})})}},63217:(e,t,n)=>{"use strict";function l(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:()=>l})},68385:(e,t,n)=>{"use strict";n.d(t,{default:()=>E});var l=n(3680),s=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)("40d1bd442c90bc9723cf4f2cb23e3314c55dbe2835",g.callServer,void 0,g.findSourceMapURL,"listAgentWorkspacesAction");var f=n(23270);let v=(0,g.createServerReference)("60fa3e1656cac7acb3b16deddc01305765d41851ec",g.callServer,void 0,g.findSourceMapURL,"listWorkspaceFilesAction"),k=(0,g.createServerReference)("70f2a9ff93ddc1531a5571077d2b2726ac5272e9d0",g.callServer,void 0,g.findSourceMapURL,"uploadToWorkspaceAction"),j=(0,g.createServerReference)("7041fb86f0b54be1543e88faa8ae18ffff53082138",g.callServer,void 0,g.findSourceMapURL,"deleteWorkspaceFileAction"),N=(0,g.createServerReference)("70d398e886e045c6741c5251cd841a4fb1b585f282",g.callServer,void 0,g.findSourceMapURL,"addAgentWorkspaceAction"),w=(0,g.createServerReference)("403928f9cfca7ec3986ffae44cead3466612ae83fa",g.callServer,void 0,g.findSourceMapURL,"removeAgentWorkspaceAction");var y=n(14308),S=n(12120),C=n(63217),A=n(37955),I=n(81630);function M({glyph:e,name:t,description:n,meta:s,actions:r,expanded:a,className:i=""}){return(0,l.jsxs)("div",{className:`overflow-hidden rounded-[10px] border border-rule-2 bg-paper ${i}`,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3.5 px-4 py-3.5",children:[e&&(0,l.jsx)("div",{className:"flex-shrink-0",children:e}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"text-[13.5px] font-medium leading-[1.2] text-ink",children:t}),n&&(0,l.jsx)("div",{className:"mt-0.5 truncate text-[12px] leading-[1.3] text-ink-3",children:n})]}),s&&(0,l.jsx)("div",{className:"flex-shrink-0 font-mono text-[10.5px] tracking-[0.04em] text-ink-4",children:s}),r&&(0,l.jsx)("div",{className:"flex flex-shrink-0 items-center gap-2",children:r})]}),a&&(0,l.jsx)("div",{className:"space-y-2 border-t border-rule-2 bg-canvas/40 px-4 py-3",children:a})]})}function R({onClick:e,title:t,children:n,ariaLabel:s}){return(0,l.jsx)("button",{type:"button",onClick:e,title:t,"aria-label":s??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 $=n(35196),L=n(21021);let _=(0,g.createServerReference)("78098002e441d38ebd5b6eec9b95f9890febb3b6dd",g.callServer,void 0,g.findSourceMapURL,"setAgentConnectorAssignmentAction"),O=(0,g.createServerReference)("788d516a7a7d59ef016aee06fe39b3a2fc32f50e6e",g.callServer,void 0,g.findSourceMapURL,"setAgentMcpServerAssignmentAction");function T({onClick:e,href:t,children:n,className:s=""}){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 ${s}`,a=(0,l.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,l.jsx)("path",{d:"M7 2v10M2 7h10"})});return t?(0,l.jsxs)("a",{href:t,className:r,children:[a,n]}):(0,l.jsxs)("button",{type:"button",onClick:e,className:r,children:[a,n]})}function U({agentId:e,connectors:t,mcpServers:n}){let[r,a]=(0,s.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,s.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,s.useState)(new Set),p=(0,s.useRef)(new Map),u=(0,s.useCallback)((t,n,l)=>{let s=`conn:${t}`,r=p.current.get(s);r&&clearTimeout(r);let a=setTimeout(()=>{p.current.delete(s),_(e,t,n,l).then(e=>{e.ok||o.oR.error(e.message)})},300);p.current.set(s,a)},[e]),h=(0,s.useCallback)((t,n,l)=>{let s=`mcp:${t}`,r=p.current.get(s);r&&clearTimeout(r);let a=setTimeout(()=>{p.current.delete(s),O(e,t,n,l).then(e=>{e.ok||o.oR.error(e.message)})},300);p.current.set(s,a)},[e]);function m(e,t){a(n=>{let l=new Map(n);return l.set(e,{assigned:t,enabledOperations:null}),u(e,t,null),l}),t||f(e)}function g(e,t){d(n=>{let l=new Map(n);return l.set(e,{assigned:t,enabledTools:null}),h(e,t,null),l}),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,s.useMemo)(()=>{let e=[],l=[];for(let n of t){let t=r.get(n.connectorId)??n,s={kind:"api",row:n};t.assigned?e.push(s):l.push(s)}for(let t of n){let n=i.get(t.mcpServerId)??t,s={kind:"mcp",row:t};n.assigned?e.push(s):l.push(s)}return{connected:e,available:l}},[t,n,r,i]);if(0===t.length&&0===n.length)return(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.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,l.jsx)(T,{href:"/connectors",children:"Browse connectors marketplace"}),(0,l.jsx)(T,{href:"/mcp",children:"Browse MCP servers"})]});return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)(F,{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,l.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,l.jsx)(F,{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,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)(T,{href:"/connectors",children:"Browse connectors marketplace"}),(0,l.jsx)(T,{href:"/mcp",children:"Browse MCP servers"})]})]});function j(e,t){if("api"===e.kind){let n=e.row,s=r.get(n.connectorId)??n,i=c.has(n.connectorId),o=n.availableOperations,d=null===s.enabledOperations?`all ${o.length} ops`:`${s.enabledOperations.length} of ${o.length} ops`;return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"conn",size:"lg",shape:"square",background:L.a[n.slug],children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:(0,L.d)(n.slug,n.label)})}),name:(0,l.jsxs)(l.Fragment,{children:[n.label,(0,l.jsx)(P,{kind:"API"})]}),description:n.credentialName??void 0,meta:t?d:`${o.length} ops`,actions:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(R,{title:i?"Hide operations":"Configure operations",ariaLabel:"Configure",onClick:()=>b(n.connectorId),children:(0,l.jsx)(W,{})}),(0,l.jsx)(R,{title:"Detach from this agent",ariaLabel:"Detach",onClick:()=>m(n.connectorId,!1),children:(0,l.jsx)(B,{})})]}):(0,l.jsx)(R,{title:"Attach to this agent",ariaLabel:"Attach",onClick:()=>m(n.connectorId,!0),children:(0,l.jsx)(K,{})}),expanded:t&&i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.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,l.jsx)(z,{onClick:()=>m(n.connectorId,!1),children:"Uncheck all"})]}),(0,l.jsx)("div",{className:"space-y-0.5",children:o.map(e=>{let t=null===s.enabledOperations||s.enabledOperations.includes(e.slug);return(0,l.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,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var t,l;return t=n.connectorId,l=e.slug,void a(e=>{let n,s=e.get(t)??{assigned:!0,enabledOperations:null},r=o.map(e=>e.slug);null!==(n=null===s.enabledOperations?r.filter(e=>e!==l):s.enabledOperations.includes(l)?s.enabledOperations.filter(e=>e!==l):[...s.enabledOperations,l])&&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,{...s,enabledOperations:n}),u(t,!0,n)),a})},className:"shrink-0 accent-agent-vivid"}),(0,l.jsx)("code",{className:"shrink-0 font-mono text-[11px] text-ink-2",children:e.slug}),(0,l.jsx)(D,{op:e}),e.description&&(0,l.jsx)("span",{className:"truncate text-[11px] italic text-ink-4",children:e.description})]},e.slug)})})]}):null},`conn:${n.connectorId}`)}let n=e.row,s=i.get(n.mcpServerId)??n,o=c.has(n.mcpServerId),x=n.availableTools.map(e=>e.name),p=null===s.enabledTools?`all ${x.length} tools`:`${s.enabledTools.length} of ${x.length} tools`;return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"conn",size:"lg",shape:"square",children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:"MCP"})}),name:(0,l.jsxs)(l.Fragment,{children:[n.label,(0,l.jsx)(P,{kind:"MCP"})]}),meta:t?p:`${x.length} tools`,actions:t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(R,{title:o?"Hide tools":"Configure tools",ariaLabel:"Configure",onClick:()=>b(n.mcpServerId),children:(0,l.jsx)(W,{})}),(0,l.jsx)(R,{title:"Detach from this agent",ariaLabel:"Detach",onClick:()=>g(n.mcpServerId,!1),children:(0,l.jsx)(B,{})})]}):(0,l.jsx)(R,{title:"Attach to this agent",ariaLabel:"Attach",onClick:()=>g(n.mcpServerId,!0),children:(0,l.jsx)(K,{})}),expanded:t&&o?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.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,l.jsx)(z,{onClick:()=>g(n.mcpServerId,!1),children:"Uncheck all"})]}),(0,l.jsx)("div",{className:"space-y-0.5",children:n.availableTools.map(e=>{let t=null===s.enabledTools||s.enabledTools.includes(e.name);return(0,l.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,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var t,l;return t=n.mcpServerId,l=e.name,void d(e=>{let n,s=e.get(t)??{assigned:!0,enabledTools:null};null!==(n=null===s.enabledTools?x.filter(e=>e!==l):s.enabledTools.includes(l)?s.enabledTools.filter(e=>e!==l):[...s.enabledTools,l])&&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,l.jsx)("code",{className:"shrink-0 font-mono text-[11px] text-ink-2",children:e.name}),e.description&&(0,l.jsx)("span",{className:"truncate text-[11px] italic text-ink-4",children:e.description})]},e.name)})})]}):null},`mcp:${n.mcpServerId}`)}}function F({label:e,hint:t,children:n}){return(0,l.jsxs)("section",{className:"space-y-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:e}),t&&(0,l.jsx)("p",{className:"mt-1 text-[11.5px] leading-[1.5] text-ink-3",children:t})]}),(0,l.jsx)("div",{className:"space-y-2",children:n})]})}function P({kind:e}){return(0,l.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,l.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,l.jsx)("span",{className:`${t} bg-agent-vivid/10 text-ok`,children:"read"}):"write"===e.risk?(0,l.jsxs)("span",{className:`${t} bg-warn/10 text-warn`,children:[e.requiresApproval?"⚠ ":"","write"]}):(0,l.jsx)("span",{className:`${t} bg-warn-bg text-err`,children:"⚠ destr"})}function W(){return(0,l.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,l.jsx)("circle",{cx:"8",cy:"8",r:"2"}),(0,l.jsx)("circle",{cx:"8",cy:"8",r:"6"})]})}function B(){return(0,l.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:(0,l.jsx)("path",{d:"M3 3l6 6M9 3l-6 6"})})}function K(){return(0,l.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:(0,l.jsx)("path",{d:"M6 2v8M2 6h8"})})}function E({agent:e,peers:t,allAgents:n,llmKeys:r,connectors:a,mcpServers:d,jobs:c,attachedSkills:x}){var p,u;let h=(0,i.useRouter)(),[m,g]=(0,s.useTransition)(),[v,k]=(0,s.useState)("overview"),j=(p=e.role??null,u=e.orchestratorMode??null,"orchestrator"===p&&"planner"===u?"planner":"orchestrator"===p?"router":"worker"),N=(0,s.useMemo)(()=>r.filter(e=>e.isActive),[r]),w=e.llmKeyId??N[0]?.id??"",[y,A]=(0,s.useState)(e.name),[I,M]=(0,s.useState)(e.personality??""),[R,L]=(0,s.useState)(j),[_,O]=(0,s.useState)(e.subAgentIds),[T,F]=(0,s.useState)(w),[P,z]=(0,s.useState)(e.fallbackChain??[]),[D,W]=(0,s.useState)(e.model??""),[B,K]=(0,s.useState)(e.avatarUrl??null),[H,J]=(0,s.useState)([]),[Y,Z]=(0,s.useState)(!1);(0,s.useEffect)(()=>{b(e.id).then(e=>{e.ok&&J(e.data),Z(!0)})},[e.id]);let et=(0,s.useMemo)(()=>r.find(e=>e.id===T)??null,[r,T]),en=0===N.length,el=(e.name||e.slug).slice(0,1).toUpperCase(),ea=a.filter(e=>e.assigned),ei=ea.length,eo=d.filter(e=>e.assigned).length,ed="worker"===R?0:_.length,ec=(I||"").split(/\n+/).filter(Boolean)[0]?.trim()??"No description yet.",ex=c.length,ep=c.filter(e=>"completed"===e.status).length,eu=y!==e.name||I!==(e.personality??"")||R!==j||JSON.stringify([..._].sort())!==JSON.stringify([...e.subAgentIds].sort())||T!==w||JSON.stringify(P)!==JSON.stringify(e.fallbackChain??[])||D!==(e.model??"")||B!==(e.avatarUrl??null);return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(G,{}),(0,l.jsx)(q,{agents:n,activeId:e.id}),(0,l.jsx)(V,{initial:el,avatarUrl:B,name:e.name,personaPreview:ec,role:j,slug:e.slug,model:e.model,llmKeyLabel:r.find(t=>t.id===e.llmKeyId)?.nickname??(r.find(t=>t.id===e.llmKeyId)?.provider?(0,C.R)(r.find(t=>t.id===e.llmKeyId).provider):null),stats:{connectors:ei,mcps:eo,subAgents:ed,skills:x.length,totalRuns:ex,successfulRuns:ep},onConfigure:()=>k("settings")}),(0,l.jsx)(Q,{tab:v,onChange:k,counts:{skills:x.length,connectors:ei+eo,runs:ex}}),"overview"===v&&(0,l.jsx)(ee,{jobs:c,attachedSkills:x,connectorsAssigned:ea,mcpsAssignedCount:eo,onOpenSkills:()=>k("skills"),onOpenConnectors:()=>k("connectors")}),"skills"===v&&(0,l.jsx)(es,{skills:x}),"connectors"===v&&(0,l.jsx)(X,{children:(0,l.jsx)(U,{agentId:e.id,connectors:a,mcpServers:d},e.id)}),"runs"===v&&(0,l.jsx)($.default,{jobs:c,agents:[{id:e.id,name:e.name,slug:e.slug},...t],agentId:e.id}),"settings"===v&&(0,l.jsx)(er,{name:y,slug:e.slug,avatarUrl:B,personality:I,role:R,showSubAgents:"worker"!==R,subAgentIds:_,peers:t,llmKeyId:T,fallbackChain:P,activeKeys:N,selectedKey:et,model:D,noLlmKeys:en,workspaces:H,workspacesLoaded:Y,onWorkspacesChange:J,mcpServers:d,agentId:e.id,dirty:eu,isPending:m,onChangeName:A,onChangeAvatar:K,onChangePersonality:M,onChangeRole:L,onToggleSubAgent:function(e){O(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},onToggleFallback:function(e){z(t=>{if(t.some(t=>t.keyId===e))return t.filter(t=>t.keyId!==e);let n=r.find(t=>t.id===e);return[...t,{keyId:e,model:n?S.SV[n.provider]?.[0]?.modelId??"":""}]})},onChangeFallbackModel:function(e,t){z(n=>n.map(n=>n.keyId===e?{...n,model:t}:n))},onChangeLlmKey:function(e){let t=r.find(t=>t.id===e);F(e),W(t?S.SV[t.provider]?.[0]?.modelId??"":"")},onChangeModel:function(e){W(e)},onSave:function(){if(en||m||!eu)return;let t={id:e.id,name:y,personality:I,model:D,llmKeyId:T||null,fallbackChain:P.filter(e=>e.keyId!==T),role:R,subAgentIds:"worker"===R?[]:_,avatarUrl:B};g(async()=>{let e=await (0,f.f)(t);e.ok?(o.oR.success("Agent updated"),h.refresh()):o.oR.error(e.message)})},onReset:function(){A(e.name),M(e.personality??""),L(j),O(e.subAgentIds),F(w),z(e.fallbackChain??[]),W(e.model??""),K(e.avatarUrl??null)}})]})}function G(){return(0,l.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,l.jsx)("span",{className:"text-[14px] leading-none",children:"‹"}),"Back to agents"]})}function q({agents:e,activeId:t}){return e.length<=1?null:(0,l.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>{let n=e.id===t;return(0,l.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,l.jsx)("span",{className:"inline-block h-[7px] w-[7px] rounded-full bg-agent-vivid"}),e.name]},e.id)})})}function V({initial:e,avatarUrl:t,name:n,personaPreview:s,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,l.jsxs)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-5 p-6 lg:flex-row lg:items-start",children:[t?(0,l.jsx)("img",{src:t,alt:"",className:"h-[80px] w-[80px] flex-shrink-0 rounded-2xl object-cover"}):(0,l.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:e}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,l.jsx)("h1",{className:"m-0 text-[22px] font-semibold leading-none tracking-[-0.01em] text-ink",children:n}),(0,l.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,l.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-ink-3"}),"Idle"]})]}),(0,l.jsx)("p",{className:"mt-2 text-[13.5px] leading-[1.55] text-ink-3",children:s}),(0,l.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,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"text-ink-4",children:"Model:"})," ",(0,l.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,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(H,{}),(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"text-ink-4",children:"LLM:"})," ",(0,l.jsx)("span",{className:"text-ink-2",children:o})]})]}),(0,l.jsx)(H,{}),(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"text-ink-4",children:"Role:"})," ",(0,l.jsx)("span",{className:"capitalize text-ink-2",children:r})]}),(0,l.jsx)(H,{}),(0,l.jsxs)("span",{className:"font-mono text-ink-4",children:["@",a]})]})]}),(0,l.jsx)("div",{className:"flex flex-shrink-0 flex-wrap gap-2",children:(0,l.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,l.jsx)(Y,{}),"Configure"]})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2 px-6 pb-6 sm:grid-cols-3 lg:grid-cols-6",children:[(0,l.jsx)(J,{label:"Skills",value:String(d.skills)}),(0,l.jsx)(J,{label:"Connectors",value:String(d.connectors)}),(0,l.jsx)(J,{label:"MCPs",value:String(d.mcps)}),(0,l.jsx)(J,{label:"Sub-agents",value:"worker"===r?"—":String(d.subAgents),dim:"worker"===r}),(0,l.jsx)(J,{label:"Runs",value:String(d.totalRuns),dim:0===d.totalRuns}),(0,l.jsx)(J,{label:"Success rate",value:x,dim:0===d.totalRuns})]})]})}function H(){return(0,l.jsx)("span",{className:"text-ink-4",children:"\xb7"})}function J({label:e,value:t,dim:n}){return(0,l.jsxs)("div",{className:"rounded-lg border border-rule-2 bg-canvas/40 px-4 py-3",children:[(0,l.jsx)("div",{className:"font-mono text-[9.5px] uppercase tracking-[0.14em] text-ink-4",children:e}),(0,l.jsx)("div",{className:`mt-1.5 text-[20px] font-semibold leading-none tracking-[-0.01em] ${n?"text-ink-4":"text-ink"}`,children:t})]})}function Y(){return(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,l.jsx)("circle",{cx:"8",cy:"8",r:"2"}),(0,l.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 Q({tab:e,onChange:t,counts:n}){let s=[{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,l.jsx)("div",{className:"flex gap-1 border-b border-rule-2",children:s.map(n=>{let s=e===n.id;return(0,l.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",s?"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,l.jsx)("span",{className:`ml-1.5 font-mono text-[10.5px] ${s?"text-ink-2":"text-ink-4"}`,children:n.count})]},n.id)})})}function X({children:e}){return(0,l.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,l.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:e}),t&&(0,l.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:s,onOpenSkills:r,onOpenConnectors:i}){let o=t.length>0,d=n.length>0;return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[(0,l.jsx)("div",{className:"lg:col-span-2",children:(0,l.jsx)(X,{children:(0,l.jsx)(et,{jobs:e})})}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:`Connectors used \xb7 ${n.length}`,right:d?(0,l.jsx)("button",{type:"button",onClick:i,className:"text-[11.5px] text-ink-3 underline hover:text-ink-2",children:"Manage"}):void 0}),d?(0,l.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,l.jsx)(el,{row:e},e.connectorId))}):(0,l.jsxs)("p",{className:"text-[12.5px] text-ink-3",children:["No connectors assigned yet."," ",(0,l.jsx)("button",{type:"button",onClick:i,className:"underline hover:text-ink-2",children:"Wire one →"})]}),s>0&&(0,l.jsxs)("p",{className:"mt-3 border-t border-rule-2 pt-3 text-[11.5px] text-ink-4",children:["+ ",s," MCP server",s>1?"s":""," attached (Settings → Knowledge)."]})]})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:`Skills attached \xb7 ${t.length}`,right:o?(0,l.jsx)("button",{type:"button",onClick:r,className:"text-[11.5px] text-ink-3 underline hover:text-ink-2",children:"Manage"}):void 0}),o?(0,l.jsx)("div",{className:"grid grid-cols-1 gap-2 lg:grid-cols-2 xl:grid-cols-3",children:t.map(e=>(0,l.jsx)(en,{skill:e},e.id))}):(0,l.jsxs)("p",{className:"text-[12.5px] text-ink-3",children:["No skills attached yet. Read-only view — manage on the"," ",(0,l.jsx)(a(),{href:"/skills",className:"underline hover:text-ink-2",children:"Skills page"}),"."]})]})]})}function et({jobs:e}){let{data:t,total:n}=(0,s.useMemo)(()=>{let t=new Date;t.setHours(0,0,0,0);let n=[];for(let e=6;e>=0;e-=1){let l=new Date(t.getTime()-864e5*e);n.push({day:l.toLocaleDateString("en-US",{weekday:"short"}),iso:l.toISOString().slice(0,10),runs:0})}let l=new Map(n.map(e=>[e.iso,e])),s=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=l.get(n);r&&(r.runs+=1,s+=1)}return{data:n,total:s}},[e]);return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-3 flex items-baseline gap-2",children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:"Runs \xb7 7 days"})}),(0,l.jsxs)("div",{className:"mb-4 flex items-baseline gap-3",children:[(0,l.jsx)("span",{className:"text-[34px] font-semibold leading-none tracking-[-0.015em] text-ink",children:n.toLocaleString()}),(0,l.jsxs)("span",{className:"text-[13.5px] text-ink-3",children:["successful run",1===n?"":"s"]})]}),(0,l.jsx)("div",{className:"h-[200px]",children:(0,l.jsx)(d.u,{width:"100%",height:"100%",children:(0,l.jsxs)(c.Q,{data:t,margin:{top:6,right:10,left:-20,bottom:0},children:[(0,l.jsx)("defs",{children:(0,l.jsxs)("linearGradient",{id:"agentWeeklyFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"var(--c-agent-vivid)",stopOpacity:.55}),(0,l.jsx)("stop",{offset:"100%",stopColor:"var(--c-agent-vivid)",stopOpacity:.05})]})}),(0,l.jsx)(x.d,{stroke:"var(--c-rule-2)",vertical:!1}),(0,l.jsx)(p.W,{dataKey:"day",stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1}),(0,l.jsx)(u.h,{stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1,allowDecimals:!1}),(0,l.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,l.jsx)(m.Gk,{type:"monotone",dataKey:"runs",stroke:"var(--c-agent-vivid)",strokeWidth:2,fill:"url(#agentWeeklyFill)"})]})})})]})}function en({skill:e}){return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"skill",size:"lg",shape:"square",children:(0,l.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,l.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 el({row:e}){return(0,l.jsx)(M,{glyph:(0,l.jsx)(I.A,{variant:"conn",size:"lg",shape:"square",background:L.a[e.slug],children:(0,l.jsx)("span",{className:"font-mono text-[10.5px] font-semibold",children:(0,L.d)(e.slug,e.label)})}),name:(0,l.jsxs)(l.Fragment,{children:[e.label,(0,l.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,l.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.08em] text-ink-3",children:[(0,l.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-agent-vivid"}),"on"]})})}function es({skills:e}){return 0===e.length?(0,l.jsx)(X,{children:(0,l.jsx)(Z,{label:"No skills attached",hint:"Read-only view. Manage attachments on the /skills page."})}):(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:`Attached \xb7 ${e.length}`}),(0,l.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,l.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,fallbackChain:h,activeKeys:m,selectedKey:g,model:f,noLlmKeys:I,workspaces:M,workspacesLoaded:R,onWorkspacesChange:$,mcpServers:L,agentId:_,dirty:O,isPending:T,onChangeName:U,onChangeAvatar:F,onChangePersonality:P,onChangeRole:z,onToggleSubAgent:D,onToggleFallback:W,onChangeFallbackModel:B,onChangeLlmKey:K,onChangeModel:E,onSave:G,onReset:q}=e,V=m.filter(e=>e.id!==u),H=g?S.SV[g.provider]??[]:[],J=!!(0,S.mV)(g?.provider??"",f),[Y,Q]=(0,s.useState)(""),[ee,et]=(0,s.useState)(""),[en,el]=(0,s.useState)(!1),[es,er]=(0,s.useState)(null),[ei,eo]=(0,s.useTransition)(),[ed,ec]=(0,s.useState)({}),[ex,ep]=(0,s.useState)({}),[eu,eh]=(0,s.useState)(""),[em,eg]=(0,s.useState)(!1),[eb,ef]=(0,s.useState)(null),[ev,ek]=(0,s.useTransition)();async function ej(e,t){eg(!0);let n=new FormData;n.append("file",t);let l=await k(_,e,n);if(eg(!1),!l.ok)return void o.oR.error(l.message);o.oR.success(`Uploaded ${l.data.filename}`);let s=await v(_,e);s.ok&&ec(t=>({...t,[e]:s.data}))}return(0,s.useEffect)(()=>{for(let e of M)ex[e.label]||v(_,e.label).then(t=>{t.ok&&ec(n=>({...n,[e.label]:t.data})),ep(t=>({...t,[e.label]:!0}))})},[M,_]),(0,l.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Identity",hint:"Slug is immutable. Avatar is used across the app."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,l.jsx)(ea,{label:"Name",children:(0,l.jsx)("input",{type:"text",value:t,onChange:e=>U(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,l.jsx)(ea,{label:"Slug (read-only)",children:(0,l.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,l.jsx)("div",{className:"sm:col-span-2",children:(0,l.jsx)(ea,{label:"Avatar",children:(0,l.jsx)(A.A,{value:r,onChange:F})})})]})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Behavior",hint:"Persona is the system prompt. Updating it invalidates the prompt cache for new jobs."}),(0,l.jsx)(ea,{label:"Persona / system prompt",children:(0,l.jsx)("textarea",{value:i,onChange:e=>P(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,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(ea,{label:"Role",children:(0,l.jsxs)("select",{value:d,onChange:e=>z(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,l.jsx)("option",{value:"worker",children:"Worker — runs its own tools"}),(0,l.jsx)("option",{value:"router",children:"Router — delegates one at a time"}),(0,l.jsx)("option",{value:"planner",children:"Planner — parallel sub-agents"})]})})}),c&&(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(ea,{label:`Sub-agents \xb7 ${x.length} selected`,children:0===p.length?(0,l.jsx)("p",{className:"text-[12.5px] text-warn",children:"Create at least one worker agent first — orchestrators need someone to delegate to."}):(0,l.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,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2 text-[13px] transition-colors hover:bg-hover",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>D(e.id),className:"accent-agent-vivid"}),(0,l.jsx)("span",{className:"text-ink",children:e.name}),(0,l.jsx)("span",{className:"ml-auto font-mono text-[11px] text-ink-3",children:e.slug})]},e.id)})})})})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Model",hint:"LLM key + model identifier passed to the runner."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,l.jsx)(ea,{label:"LLM provider",children:I?(0,l.jsxs)("p",{className:"text-[12.5px] text-warn",children:["No active LLM keys."," ",(0,l.jsx)(a(),{href:"/llm-providers",className:"underline",children:"Add one"}),"."]}):(0,l.jsx)("select",{value:u,onChange:e=>K(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:m.map(e=>(0,l.jsx)("option",{value:e.id,children:(e.nickname??(0,C.R)(e.provider))+" ("+(0,C.R)(e.provider)+")"},e.id))})}),(0,l.jsxs)(ea,{label:"Model",children:[H.length>0&&(0,l.jsxs)("select",{value:J?f:"__custom__",onChange:e=>E("__custom__"===e.target.value?"":e.target.value),className:"mb-2 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.eS)(H).map(({group:e,models:t})=>e?(0,l.jsx)("optgroup",{label:e,children:t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId))},e):t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId))),(0,l.jsx)("option",{value:"__custom__",children:"Custom…"})]}),(0===H.length||!J)&&(0,l.jsx)("input",{type:"text",value:f,onChange:e=>E(e.target.value),placeholder:S.SV[g?.provider??""]?.[0]?.modelId??"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"})]})]}),!I&&(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(ea,{label:"Fallback providers (failover order)",children:0===V.length?(0,l.jsxs)("p",{className:"text-[12px] text-ink-4",children:["Add another LLM key in"," ",(0,l.jsx)(a(),{href:"/llm-providers",className:"underline",children:"LLM providers"})," ","to enable failover."]}):(0,l.jsxs)("div",{className:"space-y-2.5",children:[(0,l.jsx)("p",{className:"text-[12px] text-ink-4",children:"If the primary is down (5xx / timeout / quota) mid-job, the runner fails over to these in order. Pick the model each fallback should run on."}),V.map(e=>{let t=h.findIndex(t=>t.keyId===e.id),n=-1!==t,s=S.SV[e.provider]??[],r=n?h[t]?.model??"":"";return(0,l.jsxs)("div",{className:"space-y-1.5",children:[(0,l.jsxs)("label",{className:"flex cursor-pointer items-center gap-2.5 select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:n,onChange:()=>W(e.id),className:"accent-ink"}),(0,l.jsx)("span",{className:"text-[13px] text-ink-2",children:(e.nickname??(0,C.R)(e.provider))+" ("+(0,C.R)(e.provider)+")"}),n&&(0,l.jsxs)("span",{className:"ml-auto rounded-full border border-rule-2 px-2 py-0.5 text-[10px] font-medium text-ink-4",children:["#",t+1]})]}),n&&(s.length>0?(0,l.jsx)("select",{value:r,onChange:t=>B(e.id,t.target.value),className:"ml-[1.6rem] w-[calc(100%-1.6rem)] rounded-lg border border-rule bg-canvas px-3 py-1.5 text-[12.5px] text-ink focus:border-ink-3 focus:outline-none",children:(0,S.eS)(s).map(({group:e,models:t})=>e?(0,l.jsx)("optgroup",{label:e,children:t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId))},e):t.map(e=>(0,l.jsx)("option",{value:e.modelId,children:e.label},e.modelId)))}):(0,l.jsx)("input",{type:"text",value:r,onChange:t=>B(e.id,t.target.value),placeholder:"model id (e.g. llama-3.3-70b)",className:"ml-[1.6rem] w-[calc(100%-1.6rem)] rounded-lg border border-rule bg-canvas px-3 py-1.5 font-mono text-[12px] text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}))]},e.id)})]})})})]}),(0,l.jsxs)(X,{children:[(0,l.jsx)(Z,{label:"Knowledge",hint:"Folders scope file_* tools. Add multiple paths with distinct labels."}),R?0===M.length?(0,l.jsx)("p",{className:"text-[12.5px] text-ink-4",children:"No folders configured."}):(0,l.jsx)("div",{className:"space-y-4 mb-4",children:M.map(e=>(0,l.jsxs)("div",{className:"rounded-lg border border-rule bg-hover/50 overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between gap-3 px-3 py-2 border-b border-rule",children:[(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("span",{className:"font-mono text-[11px] font-semibold text-ink-2 mr-2",children:e.label}),(0,l.jsx)("span",{className:"font-mono text-[11.5px] text-ink-3 break-all",children:e.path})]}),(0,l.jsx)("button",{type:"button",onClick:()=>er(e.id),disabled:ei,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,l.jsxs)("div",{className:"px-3 pt-2 pb-1",children:[ex[e.label]?0===(ed[e.label]??[]).length?(0,l.jsx)("p",{className:"text-[11.5px] text-ink-4 py-1",children:"No files uploaded yet."}):(0,l.jsx)("div",{className:"space-y-1 mb-2",children:(ed[e.label]??[]).map(t=>(0,l.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,l.jsx)("span",{className:"font-mono text-ink-2 truncate min-w-0",children:t.name}),(0,l.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,l.jsx)("button",{type:"button",onClick:()=>{ef({label:e.label,name:t.name})},disabled:ev,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,l.jsx)("p",{className:"text-[11.5px] text-ink-4 py-1",children:"Loading files…"}),(0,l.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
- ${em&&eu===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,l.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,l.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,l.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,l.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),em&&eu===e.label?"Uploading…":"Upload file (.docx .xlsx .pptx .pdf .txt .md .csv — max 25 MB)",(0,l.jsx)("input",{type:"file",className:"sr-only",accept:".docx,.xlsx,.pptx,.pdf,.txt,.md,.csv",disabled:em,onChange:t=>{let n=t.target.files?.[0];n&&(t.target.value="",eh(e.label),ej(e.label,n))}})]})]})]},e.id))}):(0,l.jsx)("p",{className:"text-[12.5px] text-ink-4",children:"Loading…"}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)(ea,{label:"Add folder",children:(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("input",{type:"text",value:Y,onChange:e=>Q(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,l.jsx)("input",{type:"text",value:ee,onChange:e=>et(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,l.jsx)("button",{type:"button",onClick:function(){Y.trim()&&ee.trim()&&eo(async()=>{el(!0);let e=await N(_,Y.trim(),ee.trim());if(el(!1),!e.ok)return void o.oR.error(e.message);let t=await b(_);t.ok&&$(t.data),Q(""),et(""),o.oR.success("Folder added")})},disabled:ei||en||!Y.trim()||!ee.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:en?"Adding…":"Add"})]})}),(0,l.jsxs)("p",{className:"text-[11px] text-ink-4",children:["Absolute path. Label is the prefix the agent uses (e.g."," ",(0,l.jsx)("code",{className:"font-mono",children:"notes/file.md"}),"). Leave label blank if a single folder — label is then optional."]})]}),(0,l.jsx)(y.A,{open:null!==es,title:"Remove folder",message:"The agent will lose file access to this path. Existing files are NOT deleted.",confirmLabel:"Remove",destructive:!0,onConfirm:()=>es&&void eo(async()=>{let e=await w(es);if(er(null),!e.ok)return void o.oR.error(e.message);let t=await b(_);t.ok&&$(t.data),o.oR.success("Folder removed")}),onCancel:()=>er(null)}),(0,l.jsx)(y.A,{open:null!==eb,title:"Delete file",message:eb?`Delete "${eb.name}" from folder "${eb.label}"? This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,onConfirm:function(){if(!eb)return;let{label:e,name:t}=eb;ek(async()=>{ef(null);let n=await j(_,e,t);if(!n.ok)return void o.oR.error(n.message);o.oR.success(`Deleted ${t}`);let l=await v(_,e);l.ok&&ec(t=>({...t,[e]:l.data}))})},onCancel:()=>ef(null)})]}),(0,l.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,l.jsx)("div",{className:"text-[12.5px] text-ink-3",children:O?(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"mr-1.5 inline-block h-[7px] w-[7px] rounded-full bg-skill-vivid"}),"Unsaved changes"]}):(0,l.jsx)("span",{className:"text-ink-4",children:"No changes"})}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{type:"button",onClick:q,disabled:T||!O,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,l.jsx)("button",{type:"button",onClick:G,disabled:T||I||!O,title:O?void 0:"No changes to save",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:T?"Saving…":"Save"})]})]})]})}function ea({label:e,children:t}){return(0,l.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,l.jsx)("label",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-ink-4",children:e}),(0,l.jsx)("div",{children:t})]})}},81630:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var l=n(3680);let s={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?"":s[e];return(0,l.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 l=n(3680);let s={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,l.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${s[e]} ${n?r[e]:""} ${i}`})}},88812:(e,t,n)=>{Promise.resolve().then(n.bind(n,68385))},93606:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var l=n(3680),s=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,l.jsx)(s.r,{size:11,weight:"regular"}):"warn"===e?p=(0,l.jsx)(r.N,{size:11,weight:"regular"}):"run"===e&&(p=(0,l.jsx)(a.A,{variant:"blue",size:"sm"})),(0,l.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 l=n(3680),s=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,l.jsx)("span",{className:c,children:(0,l.jsx)(s.default,{src:t,alt:e,width:d.px,height:d.px,className:"h-full w-full object-cover"})}):(0,l.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,7025,2575,269,9582,9123,1065,8724,7358],()=>e(e.s=88812)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2925],{14308:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(3680),s=n(78604),a=n(51869);function o({open:e,title:t,message:n,confirmLabel:i="Confirm",cancelLabel:l="Cancel",destructive:c=!0,onConfirm:d,onCancel:u}){let m=(0,s.useRef)(null),[b,f]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{f(!0)},[]),(0,s.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&b)?(0,a.createPortal)((0,r.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,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,r.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),n&&(0,r.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:n}),(0,r.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,r.jsx)("button",{ref:m,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:l}),(0,r.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:i})]})]})]}),document.body):null}},27540:(e,t,n)=>{"use strict";var r=n(71268);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},64678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return a.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var s in r)Object.defineProperty(t,s,{enumerable:!0,get:r[s]});let a=n(22673),o=n(43145),i=n(87478)},71133:(e,t,n)=>{"use strict";n.d(t,{default:()=>u});var r=n(3680),s=n(78604),a=n(27540),o=n(39504),i=n(64678);let l=(0,i.createServerReference)("4047290d2ad6a981481bd95c915a26b2dd8b434896",i.callServer,void 0,i.findSourceMapURL,"configureAgentTelegramAction"),c=(0,i.createServerReference)("40871f9e81ec4546f4f88b8550094fef7bfcd7a418",i.callServer,void 0,i.findSourceMapURL,"disconnectAgentTelegramAction");var d=n(14308);function u({agentId:e,initialConfig:t}){let n=(0,a.useRouter)(),[i,m]=(0,s.useState)(t),[b,f]=(0,s.useState)(""),[x,p]=(0,s.useTransition)(),[h,v]=(0,s.useState)(!1),g="connected"===i.status;return(0,r.jsxs)("div",{className:"space-y-5",children:[(0,r.jsxs)("div",{className:"bg-paper border border-rule-2/60 rounded-xl px-5 py-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:g?"inline-block w-2 h-2 rounded-full bg-agent-vivid":"inline-block w-2 h-2 rounded-full bg-ink-4","aria-hidden":"true"}),(0,r.jsx)("span",{className:"text-sm font-medium text-ink",children:g?"Connected":"Not connected"})]}),i.botUsername&&(0,r.jsxs)("p",{className:"text-xs text-ink-3 mt-1.5",children:["Bot:"," ",(0,r.jsxs)("a",{href:`https://t.me/${i.botUsername}`,target:"_blank",rel:"noopener noreferrer",className:"font-mono text-ink-2 hover:text-ok",children:["@",i.botUsername]})]})]}),(0,r.jsxs)("form",{onSubmit:function(t){t.preventDefault(),b&&p(async()=>{let t=await l({agentId:e,botToken:b});t.ok?(m(t.data),f(""),o.oR.success(`Connected as @${t.data.botUsername}`),n.refresh()):o.oR.error(t.message)})},className:"space-y-3",children:[(0,r.jsxs)("label",{className:"block",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-ink-2 uppercase tracking-wider",children:"Bot token"}),(0,r.jsx)("input",{type:"text",autoComplete:"off",spellCheck:!1,value:b,onChange:e=>f(e.target.value),placeholder:"123456789:ABCDEF…",className:"mt-2 w-full px-3 py-2 bg-canvas border border-rule-2 rounded-lg text-sm font-mono text-ink placeholder:text-ink-4 focus:outline-none focus:border-rule"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"submit",disabled:x||!b,className:"px-4 py-2 text-sm font-medium bg-ok text-ink rounded-lg hover:bg-agent-vivid transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:x?"Saving…":g?"Replace token":"Connect"}),g&&(0,r.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:x,className:"px-4 py-2 text-sm font-medium border border-rule-2 text-ink-3 rounded-lg hover:border-err hover:text-err transition-colors disabled:opacity-50",children:"Disconnect"})]})]}),(0,r.jsx)(d.A,{open:h,title:"Disconnect Telegram bot?",message:"Incoming messages to this bot will stop being processed. You can reconnect later by pasting the token again.",confirmLabel:"Disconnect",onConfirm:function(){v(!1),p(async()=>{let t=await c(e);t.ok?(m({...i,status:"disconnected",botUsername:null}),o.oR.success("Telegram disconnected"),n.refresh()):o.oR.error(t.message)})},onCancel:()=>v(!1)})]})}},78479:(e,t,n)=>{Promise.resolve().then(n.bind(n,71133)),Promise.resolve().then(n.t.bind(n,63363,23))}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=78479)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[797],{23270:(e,t,r)=>{"use strict";r.d(t,{f:()=>n});var s=r(64678);let n=(0,s.createServerReference)("403841485f398c760228bf932338d55e8493d0332e",s.callServer,void 0,s.findSourceMapURL,"updateAgentAction")},27287:(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(57581),m=r(64678);let h=(0,m.createServerReference)("4065c4f7485462878810b4367bb2071b5e7de6a367",m.callServer,void 0,m.findSourceMapURL,"reorderAgentsAction"),g=(0,m.createServerReference)("4043fd062e51d792226e9aaa93a0578d2066285682",m.callServer,void 0,m.findSourceMapURL,"deleteAgentAction");var p=r(14308);function b({id:e,name:t,deleteAction:r}){let n=(0,i.useRouter)(),[l,d]=(0,a.useTransition)(),[c,u]=(0,a.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>u(!0),disabled:l,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:l?"Deleting…":"Delete"}),(0,s.jsx)(p.A,{open:c,title:`Delete agent "${t}"?`,message:"The agent and its assignments will be removed. Past job history is preserved.",confirmLabel:"Delete",onConfirm:function(){u(!1),d(async()=>{let t=await r(e);t.ok?(o.oR.success("Agent deleted"),n.refresh()):o.oR.error(t.message)})},onCancel:()=>u(!1)})]})}function f({initialGroups:e,initialActivity:t}){let[r,n]=(0,a.useState)(e),[l,u]=(0,a.useState)(t),[m,g]=(0,a.useTransition)(),p=(0,i.useRouter)(),b=(0,a.useSyncExternalStore)(()=>()=>{},()=>!0,()=>!1),k=(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 y=(0,d.FR)((0,d.MS)(d.AN,{activationConstraint:{distance:8}}),(0,d.MS)(d.uN,{coordinateGetter:c.JR}));function w(e){n(e),g(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}p.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 S=r.map(e=>e.orchestrator?.id).filter(e=>!!e);return b?(0,s.jsx)(d.Mp,{sensors:y,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||w((0,c.be)(r,n,l))},children:(0,s.jsx)(c.gB,{items:S,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)(j,{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);w(r.map((t,r)=>r===e?{...t,workers:o}:t))})(t,e),sensors:y,activityByAgent:k})]},n?"__standalone__":e.orchestrator?.id??"")})})})}):(0,s.jsx)("div",{className:"space-y-6",children:r.map(e=>{let t=null===e.orchestrator;return(0,s.jsxs)("div",{children:[e.orchestrator?(0,s.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"leading-none text-ink-4","aria-hidden":!0,children:"⋮⋮"}),(0,s.jsxs)("h2",{className:"text-xs font-semibold uppercase tracking-wider text-ink-3",children:["Team — ",e.orchestrator.name]})]}):(0,s.jsx)("h2",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-ink-3",children:"Standalone"}),(0,s.jsx)("div",{className:"overflow-hidden rounded-xl border border-rule-2 bg-paper",children:(0,s.jsx)("table",{className:"w-full text-sm",children:(0,s.jsxs)("tbody",{children:[e.orchestrator&&(0,s.jsx)(N,{agent:e.orchestrator,indent:!1,activity:k.get(e.orchestrator.id)??null}),e.workers.map(t=>(0,s.jsx)(N,{agent:t,indent:!!e.orchestrator,activity:k.get(t.id)??null},t.id))]})})})]},t?"__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 j({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)(N,{agent:r,indent:!1,activity:i.get(r.id)??null}),e.map(e=>(0,s.jsx)(k,{agent:e,indent:t,disabled:n,activity:i.get(e.id)??null},e.id))]})})})})})}function k({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)(y,{agent:e}),(0,s.jsx)(w,{agent:e}),(0,s.jsx)(S,{agent:e,activity:n})]})}),(0,s.jsx)(C,{agent:e})]})}function N({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)(y,{agent:e}),(0,s.jsx)(w,{agent:e}),(0,s.jsx)(S,{agent:e,activity:r})]})}),(0,s.jsx)(C,{agent:e})]})}function y({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:g})]})})}},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})})}},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"})]})}},57581:(e,t,r)=>{"use strict";r.d(t,{V:()=>n});var s=r(64678);let n=(0,s.createServerReference)("00e93f5a30fbb4748e0f30addc55e311d26b3a1e21",s.callServer,void 0,s.findSourceMapURL,"getActiveJobsByAgentAction")},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,27287)),Promise.resolve().then(r.bind(r,96266))},96266:(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(23270),d=r(64678);let c=(0,d.createServerReference)("401f4fb51c8eb3ebbb19cb59c5e23502c68a42d62a",d.callServer,void 0,d.findSourceMapURL,"createAgentAction");var u=r(12120),x=r(63217),m=r(37955);function h(e){var t,r;let d="edit"===e.mode,h=(0,a.useRouter)(),g=(0,n.useRef)(null),[p,b]=(0,n.useTransition)(),[f,v]=(0,n.useState)(d),j=d?(t=e.initial.role??null,r=e.initial.orchestratorMode??null,"orchestrator"===t&&"planner"===r?"planner":"orchestrator"===t?"router":"worker"):"worker",[k,N]=(0,n.useState)(j),[y,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,I]=(0,n.useState)(d?e.initial.avatarUrl??null:null),_=(0,n.useMemo)(()=>e.llmKeys.find(e=>e.id===R)??null,[e.llmKeys,R]);function $(t){let r=e.llmKeys.find(e=>e.id===t);A(t),L(u.SV[r?.provider??""]?.[0]?.modelId??"")}function D(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:k,subAgentIds:"worker"===k?[]:y,avatarUrl:E};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:k,subAgentIds:"worker"===k?[]:y,avatarUrl:E};b(async()=>{let t=await c(e);t.ok?(i.oR.success("Agent created"),g.current?.reset(),N("worker"),w([]),A(S[0]?.id??""),L(""),I(null),v(!1),h.refresh()):i.oR.error(t.message)})}}function F(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 P=e.agents??[],q=0===S.length,K="worker"!==k,T=0===P.length;if(d){let t=e.initial;return(0,s.jsxs)("form",{ref:g,onSubmit:D,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)(m.A,{value:E,onChange:I}),(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"}),q?(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=>$(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,x.R)(e.provider))+" ("+(0,x.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=>{L(e.target.value)},placeholder:u.SV[_?.provider??""]?.[0]?.modelId??"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"}),null]})]}),(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:k,onChange:e=>N(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"})]})]}),K&&(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:["(",y.length," selected)"]})]}),T?(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:P.map(e=>{let t=y.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:()=>F(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:p||q,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:p?"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 U=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:g,onSubmit:D,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)(m.A,{value:E,onChange:I}),(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"}),q?(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=>$(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,x.R)(e.provider))+" ("+(0,x.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=>{L(e.target.value)},placeholder:u.SV[_?.provider??""]?.[0]?.modelId??"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"}),null]})]}),(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:k,onChange:e=>N(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"})]})]}),K&&(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:["(",y.length," selected)"]})]}),T?(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:P.map(e=>{let t=y.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:()=>F(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:p||q,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:p?"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"}),U]})}}},e=>{e.O(0,[3363,9504,7025,5436,9123,1065,8724,7358],()=>e(e.s=67849)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3705],{14308:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var r=a(3680),n=a(78604),s=a(51869);function l({open:e,title:t,message:a,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:c=!0,onConfirm:d,onCancel:u}){let m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{p(!0)},[]),(0,n.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&x)?(0,s.createPortal)((0,r.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,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,r.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),a&&(0,r.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:a}),(0,r.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,r.jsx)("button",{ref:m,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,r.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:i})]})]})]}),document.body):null}},37223:(e,t,a)=>{"use strict";a.d(t,{X:()=>i});var r=a(78604),n=a(53087);let s=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",r.createElement(r.Fragment,null,r.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"}),r.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",r.createElement(r.Fragment,null,r.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,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),l=r.forwardRef((e,t)=>r.createElement(n.A,{ref:t,...e,weights:s}));l.displayName="XIcon";let i=l},44891:(e,t,a)=>{Promise.resolve().then(a.bind(a,48927)),Promise.resolve().then(a.t.bind(a,63363,23))},48927:(e,t,a)=>{"use strict";a.d(t,{default:()=>g});var r=a(3680),n=a(78604),s=a(39504),l=a(54805),i=a(37223),o=a(14308),c=a(64678);let d=(0,c.createServerReference)("00471a08cbfe30783ae558daa3926bdd257abcca26",c.callServer,void 0,c.findSourceMapURL,"listConversationsAction"),u=(0,c.createServerReference)("40bb25b856f502b069916be582ba5ba4b59f0fd377",c.callServer,void 0,c.findSourceMapURL,"listChatAction"),m=(0,c.createServerReference)("00e380381f0bf9caafc2c162493236800179ff748d",c.callServer,void 0,c.findSourceMapURL,"createConversationAction"),x=(0,c.createServerReference)("402dd9b41913f4df0dc409b17a7f342badb27eda92",c.callServer,void 0,c.findSourceMapURL,"deleteConversationAction"),p=(0,c.createServerReference)("40ae142f3021cbdd06d5717bdffcc1ad58e6031d04",c.callServer,void 0,c.findSourceMapURL,"sendChatMessageAction"),f=(0,c.createServerReference)("40e7f8235ea05603b604a187b6856b07f20c86ca28",c.callServer,void 0,c.findSourceMapURL,"getChatJobStatusAction"),h=n.useLayoutEffect,b=new Set(["completed","failed","cancelled"]);function g({initialConversations:e,rootName:t}){let[a,c]=(0,n.useState)(e),[f,b]=(0,n.useState)(e[0]?.id??null),[w,y]=(0,n.useState)([]),[N,E]=(0,n.useState)(""),[L,S]=(0,n.useState)(!1),[H,M]=(0,n.useState)(""),[A,R]=(0,n.useState)(null),[C,Z]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),F=(0,n.useRef)(null),O=(0,n.useRef)(!0),I=w.length>0&&"user"===w[w.length-1].role,Y=(0,n.useCallback)(()=>{let e=F.current;e&&(e.scrollTop=e.scrollHeight)},[]),$=(0,n.useCallback)(()=>{let e=F.current;e&&(O.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},[]);h(()=>{O.current=!0,Y();let e=setTimeout(Y,80);return()=>clearTimeout(e)},[w,I,C,Y]),(0,n.useEffect)(()=>{let e=F.current;if(!e)return;let t=new MutationObserver(()=>{O.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>t.disconnect()},[]);let z=(0,n.useCallback)(async()=>{let e=await d();e.ok&&c(e.data.conversations)},[]),U=(0,n.useCallback)(async e=>{Z(!0);let t=await u(e);Z(!1),t.ok&&y(t.data.messages)},[]);async function V(e){D(!1),e!==f&&(b(e),y([]),await U(e))}async function _(){let e=await m();e.ok?(await z(),y([]),b(e.data.id),D(!1)):s.oR.error(e.message)}async function P(e){let t=await x(e);if(!t.ok)return void s.oR.error(t.message);let r=a.filter(t=>t.id!==e);if(c(r),f===e){let e=r[0]?.id??null;b(e),e?await U(e):y([])}s.oR.success("Conversation deleted")}async function B(e){e.preventDefault();let t=N.trim();if(!t||L)return;E(""),S(!0);let a=f;if(!a){let e=await m();if(!e.ok){s.oR.error(e.message),S(!1);return}b(a=e.data.id)}y(e=>[...e,{id:`local-${Date.now()}`,role:"user",content:t,jobId:null}]);let r=await p({conversationId:a,message:t});r.ok||s.oR.error(r.message);let n=await u(a);n.ok&&y(n.data.messages),await z(),S(!1)}(0,n.useEffect)(()=>{f&&U(f)},[]),(0,n.useEffect)(()=>{let e;if(!I||!f)return;let t=!1,a=0,r=async()=>{if(t||a>=30)return;a+=1;let n=await u(f);t||!n.ok||(y(n.data.messages),n.data.messages[n.data.messages.length-1]?.role==="user"?e=setTimeout(()=>void r(),2e3):z())};return e=setTimeout(()=>void r(),2e3),()=>{t=!0,e&&clearTimeout(e)}},[I,f,z]);let K=H.trim()?a.filter(e=>e.title.toLowerCase().includes(H.toLowerCase())):a,X=function(e){let t={TODAY:[],YESTERDAY:[],EARLIER:[]};for(let a of e)t[function(e){if(!e)return"EARLIER";let t=new Date,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(a.getTime()-864e5),n=new Date(e.getFullYear(),e.getMonth(),e.getDate());return n.getTime()===a.getTime()?"TODAY":n.getTime()===r.getTime()?"YESTERDAY":"EARLIER"}(a.updatedAt)].push(a);return["TODAY","YESTERDAY","EARLIER"].filter(e=>t[e].length>0).map(e=>({group:e,items:t[e]}))}(K);return(0,r.jsxs)("div",{className:"relative flex h-full min-h-0 overflow-hidden rounded-xl border border-rule-2 bg-paper",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-rule-2 px-3 py-2 lg:hidden",children:[(0,r.jsx)("span",{className:"truncate text-sm font-semibold text-ink",children:t??"Chat"}),(0,r.jsxs)("button",{type:"button",onClick:()=>D(!0),className:"inline-flex shrink-0 items-center gap-1.5 rounded-md border border-rule px-2.5 py-1 text-xs font-medium text-ink-2 transition-colors hover:bg-hover","aria-label":"Show conversations",children:[(0,r.jsx)(l.B,{size:14})," History"]})]}),(0,r.jsx)("div",{ref:F,onScroll:$,className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-5",children:C?(0,r.jsx)("p",{className:"py-8 text-center text-sm text-ink-4",children:"Loading…"}):0!==w.length||I?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative flex items-center justify-center py-1",children:[(0,r.jsx)("span",{className:"absolute inset-x-0 top-1/2 h-px bg-rule-2"}),(0,r.jsx)("span",{className:"relative bg-paper px-3 text-[10px] font-semibold uppercase tracking-widest text-ink-4",children:"Today"})]}),w.map(e=>(0,r.jsx)(k,{message:e,rootName:t},e.id)),I&&(0,r.jsxs)("div",{className:"flex justify-start gap-2.5",children:[(0,r.jsx)(j,{rootName:t}),(0,r.jsxs)("div",{className:"flex max-w-[80%] flex-col items-start",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-ink-2",children:t??"Agent"}),(0,r.jsx)("span",{className:"rounded bg-ink/10 px-1 py-px text-[9px] font-semibold uppercase tracking-widest text-ink-3",children:"Orchestrator"})]}),(0,r.jsx)("div",{className:"rounded-2xl rounded-bl-sm border border-rule bg-canvas px-3.5 py-2 text-sm text-ink-4",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)("span",{className:"animate-pulse",children:"●"})," thinking…"]})})]})]})]}):(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsxs)("p",{className:"text-center text-sm text-ink-4",children:["Say hello to ",t??"your ROOT agent"," \uD83D\uDC4B"]})})}),(0,r.jsxs)("form",{onSubmit:e=>void B(e),className:"flex items-end gap-2 border-t border-rule-2 p-3",children:[(0,r.jsx)("textarea",{value:N,onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),B(e))},rows:1,placeholder:`Message ${t??"your ROOT agent"}…`,className:"max-h-40 min-h-[40px] flex-1 resize-y rounded-md border border-rule bg-canvas px-3 py-2 text-sm text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"}),(0,r.jsx)("button",{type:"submit",disabled:L||0===N.trim().length,className:"inline-flex h-[40px] shrink-0 items-center rounded-md bg-ink px-4 text-sm font-medium text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-40",children:L?"Sending…":"Send"})]})]}),T&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 bg-black/40 lg:hidden",onClick:()=>D(!1),"aria-hidden":!0}),(0,r.jsxs)("aside",{className:`flex-col border-l border-rule-2 bg-paper lg:flex lg:static lg:z-auto lg:w-[300px] lg:max-w-none lg:shrink-0 lg:shadow-none ${T?"absolute inset-y-0 right-0 z-20 flex w-[85%] max-w-[320px] shadow-xl":"hidden"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-rule-2 px-4 py-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>D(!1),className:"text-ink-3 transition-colors hover:text-ink lg:hidden","aria-label":"Close conversations",children:(0,r.jsx)(i.X,{size:16})}),(0,r.jsx)("span",{className:"text-sm font-semibold text-ink",children:"Chat"})]}),(0,r.jsx)("button",{type:"button",onClick:()=>void _(),className:"inline-flex items-center gap-1 rounded-md bg-ink px-2.5 py-1 text-xs font-medium text-canvas transition-[filter] hover:brightness-[0.92]",children:"+ New"})]}),(0,r.jsx)("div",{className:"border-b border-rule-2 px-3 py-2.5",children:(0,r.jsx)("input",{type:"text",value:H,onChange:e=>M(e.target.value),placeholder:"Search conversations…",className:"w-full rounded-md border border-rule bg-canvas px-3 py-1.5 text-xs text-ink placeholder:text-ink-4 focus:border-ink-3 focus:outline-none"})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===K.length?(0,r.jsx)("p",{className:"px-4 py-6 text-center text-xs text-ink-4",children:H.trim()?"No conversations match.":"No conversations yet — say hello."}):X.map(({group:e,items:t})=>(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"sticky top-0 bg-paper px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-ink-4",children:e}),t.map(e=>(0,r.jsx)(v,{conversation:e,active:e.id===f,onSelect:()=>void V(e.id),onDelete:()=>R(e.id)},e.id))]},e))})]}),(0,r.jsx)(o.A,{open:null!==A,title:"Delete conversation",message:"This will permanently remove this conversation and all its messages.",confirmLabel:"Delete",cancelLabel:"Cancel",destructive:!0,onConfirm:()=>{R(null),A&&P(A)},onCancel:()=>R(null)})]})}function v({conversation:e,active:t,onSelect:a,onDelete:n}){let s=e.title.trim()||"New conversation",l=e.preview.trim(),i=function(e){if(!e)return"";let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<60)return"just now";let a=Math.floor(t/60);if(a<60)return`${a}m ago`;let r=Math.floor(a/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return 1===n?"yesterday":n<7?`${n}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(e.updatedAt);return(0,r.jsxs)("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&a()},className:`group relative flex cursor-pointer flex-col gap-0.5 px-4 py-2.5 transition-colors ${t?"bg-ink/8 text-ink":"hover:bg-ink/4 text-ink-2"}`,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("span",{className:`truncate text-xs font-medium ${t?"text-ink":"text-ink-2"}`,children:s}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,r.jsx)("span",{className:"text-[10px] text-ink-4",children:i}),(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),n()},"aria-label":"Delete conversation",className:"ml-0.5 hidden rounded p-0.5 text-ink-4 transition-colors hover:text-err group-hover:inline-flex",children:(0,r.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[(0,r.jsx)("polyline",{points:"1 3 11 3"}),(0,r.jsx)("path",{d:"M4 3V2h4v1"}),(0,r.jsx)("path",{d:"M2 3l.8 7.2A1 1 0 003.8 11h4.4a1 1 0 001-.8L10 3"})]})})]})]}),l&&(0,r.jsx)("p",{className:"truncate text-[11px] text-ink-4",children:l})]})}function j({rootName:e}){let t=(e??"A").charAt(0).toUpperCase();return(0,r.jsx)("div",{className:"mt-5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-run text-xs font-semibold text-ink",children:t})}function k({message:e,rootName:t}){return"user"===e.role?(0,r.jsxs)("div",{className:"flex justify-end gap-2.5",children:[(0,r.jsxs)("div",{className:"flex max-w-[80%] flex-col items-end",children:[(0,r.jsx)("span",{className:"mb-1 text-xs font-medium text-ink-3",children:"You"}),(0,r.jsx)("div",{className:"whitespace-pre-wrap rounded-2xl rounded-br-sm bg-ink px-3.5 py-2 text-sm text-canvas",children:e.content})]}),(0,r.jsx)("div",{className:"mt-5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-ink/10 text-xs font-semibold text-ink-3",children:"Y"})]}):(0,r.jsxs)("div",{className:"flex justify-start gap-2.5",children:[(0,r.jsx)(j,{rootName:t}),(0,r.jsxs)("div",{className:"flex max-w-[80%] flex-col items-start",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-ink-2",children:t??"Agent"}),(0,r.jsx)("span",{className:"rounded bg-ink/10 px-1 py-px text-[9px] font-semibold uppercase tracking-widest text-ink-3",children:"Orchestrator"})]}),""!==e.content.trim()&&(0,r.jsx)("div",{className:"whitespace-pre-wrap rounded-2xl rounded-bl-sm border border-rule bg-canvas px-3.5 py-2 text-sm text-ink-2",children:e.content}),e.jobId&&(0,r.jsx)(y,{jobId:e.jobId})]})]})}function w({status:e}){let t="completed"===e,a="failed"===e||"cancelled"===e;return(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium ${t?"border-ok/40 text-ok":a?"border-err/40 text-err":"border-run/40 text-run"}`,children:[!t&&!a&&(0,r.jsx)("span",{className:"animate-pulse",children:"●"}),t?"Done":a?"Failed":"Running"]})}function y({jobId:e}){let[t,a]=(0,n.useState)(null);(0,n.useEffect)(()=>{let t,r=!1,n=0,s=async()=>{let l=await f(e);r||(l.ok&&a(l.data),!(l.ok&&b.has(l.data.status))&&n<150&&(n+=1,t=setTimeout(()=>void s(),2e3)))};return s(),()=>{r=!0,t&&clearTimeout(t)}},[e]);let s=t?.status??"pending",l=t?.children??[];return(0,r.jsxs)("div",{className:"mt-2 w-full rounded-lg border border-rule-2 bg-canvas/60 p-2.5",children:[(0,r.jsxs)("div",{className:"mb-1.5 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-ink-4",children:l.length>0?`↘ Dispatched to ${l.length} agent${l.length>1?"s":""}`:"↘ Task"}),0===l.length&&(0,r.jsx)(w,{status:s})]}),l.length>0?(0,r.jsx)("div",{className:"space-y-1",children:l.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-rule bg-paper px-2.5 py-1.5",children:[(0,r.jsx)("span",{className:"truncate text-xs font-medium text-ink-2",children:e.agentName}),(0,r.jsx)(w,{status:e.status})]},t))}):null,t&&b.has(s)&&t.result&&(0,r.jsx)("p",{className:"mt-1.5 whitespace-pre-wrap text-xs text-ink-3",children:t.result})]})}},53087:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var r=a(78604);let n=(0,r.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),s=r.forwardRef((e,t)=>{let{alt:a,color:s,size:l,weight:i,mirrored:o,children:c,weights:d,...u}=e,{color:m="currentColor",size:x,weight:p="regular",mirrored:f=!1,...h}=r.useContext(n);return r.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=l?l:x,height:null!=l?l:x,fill:null!=s?s:m,viewBox:"0 0 256 256",transform:o||f?"scale(-1, 1)":void 0,...h,...u},!!a&&r.createElement("title",null,a),c,d.get(null!=i?i:p))});s.displayName="IconBase"},54805:(e,t,a)=>{"use strict";a.d(t,{B:()=>i});var r=a(78604),n=a(53087);let s=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM40,76H216a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24ZM216,180H40a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,64V192H40V64Z",opacity:"0.2"}),r.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["fill",r.createElement(r.Fragment,null,r.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,32ZM192,184H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128ZM40,70H216a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12ZM216,186H40a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128ZM40,68H216a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8ZM216,188H40a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Z"}))]]),l=r.forwardRef((e,t)=>r.createElement(n.A,{ref:t,...e,weights:s}));l.displayName="ListIcon";let i=l},64678:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return s.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let s=a(22673),l=a(43145),i=a(87478)}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=44891)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2771],{14308:(e,r,t)=>{"use strict";t.d(r,{A:()=>l});var n=t(3680),s=t(78604),a=t(51869);function l({open:e,title:r,message:t,confirmLabel:o="Confirm",cancelLabel:i="Cancel",destructive:d=!0,onConfirm:c,onCancel:u}){let b=(0,s.useRef)(null),[x,p]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{p(!0)},[]),(0,s.useEffect)(()=>{if(e)return b.current?.focus(),window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r);function r(e){"Escape"===e.key&&u()}},[e,u]),e&&x)?(0,a.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:u,"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:r}),t&&(0,n.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:t}),(0,n.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,n.jsx)("button",{ref:b,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:i}),(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:o})]})]})]}),document.body):null}},27540:(e,r,t)=>{"use strict";var n=t(71268);t.o(n,"usePathname")&&t.d(r,{usePathname:function(){return n.usePathname}}),t.o(n,"useRouter")&&t.d(r,{useRouter:function(){return n.useRouter}}),t.o(n,"useSearchParams")&&t.d(r,{useSearchParams:function(){return n.useSearchParams}})},64678:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={callServer:function(){return a.callServer},createServerReference:function(){return o.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var s in n)Object.defineProperty(r,s,{enumerable:!0,get:n[s]});let a=t(22673),l=t(43145),o=t(87478)},67926:(e,r,t)=>{"use strict";t.d(r,{default:()=>c});var n=t(3680),s=t(78604),a=t(27540),l=t(39504),o=t(14308),i=t(64678);let d=(0,i.createServerReference)("402d1dae72e7231c36679c809c8d55365674695323",i.callServer,void 0,i.findSourceMapURL,"cancelJobAction");function c({jobId:e}){let[r,t]=(0,s.useState)(!1),[i,u]=(0,s.useTransition)(),b=(0,a.useRouter)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",onClick:()=>t(!0),disabled:i,className:"inline-flex h-[30px] items-center gap-1.5 rounded-md border border-rule px-3 text-[12px] font-medium leading-none text-ink-3 transition-colors hover:border-warn/60 hover:bg-warn-bg hover:text-warn disabled:cursor-not-allowed disabled:opacity-50",children:i?"Cancelling…":"Cancel"}),(0,n.jsx)(o.A,{open:r,title:"Cancel this job?",message:"In-flight LLM turns will finish naturally — the loop bails at the next checkpoint. Use this to stop a job that's pending, awaiting, or stuck mid-execution.",confirmLabel:"Cancel job",cancelLabel:"Keep running",destructive:!0,onConfirm:function(){t(!1),u(async()=>{let r=await d(e);r.ok?(l.oR.success("Job cancelled"),b.refresh()):l.oR.error(r.message)})},onCancel:()=>t(!1)})]})}},82920:(e,r,t)=>{Promise.resolve().then(t.bind(t,67926)),Promise.resolve().then(t.bind(t,94438)),Promise.resolve().then(t.t.bind(t,63363,23))},94438:(e,r,t)=>{"use strict";t.d(r,{default:()=>c});var n=t(3680),s=t(78604),a=t(64678);let l=(0,a.createServerReference)("400f1516aea326fe8ab6e2c07202680b0da997a3bf",a.callServer,void 0,a.findSourceMapURL,"getJobStatusAction"),o={completed:{bg:"bg-ok-bg border border-ok/30",text:"text-ok",dot:"bg-ok",pulse:!1},failed:{bg:"bg-warn-bg border border-err/30",text:"text-err",dot:"bg-err",pulse:!1},processing:{bg:"bg-warn-bg border border-warn/30",text:"text-warn",dot:"bg-warn",pulse:!0},pending:{bg:"bg-hover border border-rule",text:"text-ink-3",dot:"bg-ink-3",pulse:!1},awaiting_approval:{bg:"bg-run-bg border border-run/30",text:"text-run",dot:"bg-run",pulse:!0},awaiting_delegation:{bg:"bg-run-bg border border-run/30",text:"text-run",dot:"bg-run",pulse:!0},cancelled:{bg:"bg-hover border border-rule",text:"text-ink-3",dot:"bg-ink-4",pulse:!1}};function i({status:e}){let r=o[e]??o.pending;return(0,n.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-xs font-semibold ${r.bg} ${r.text}`,children:[(0,n.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${r.dot} ${r.pulse?"animate-pulse":""}`}),e]})}let d=new Set(["completed","failed","cancelled"]);function c({jobId:e,initialStatus:r}){let[t,a]=(0,s.useState)({status:r,result:null,error:null});return(0,s.useEffect)(()=>{if(d.has(t.status))return;let r=async()=>{let r=await l(e);r.ok&&a(r.data)},n=setInterval(()=>{r()},3e3);return()=>clearInterval(n)},[e,t.status]),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(i,{status:t.status}),!d.has(t.status)&&(0,n.jsx)("span",{className:"text-xs text-ink-4 animate-pulse",children:"Polling…"})]}),t.result&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs text-ink-3 font-semibold uppercase tracking-wider mb-1",children:"Result"}),(0,n.jsx)("pre",{className:"text-sm text-ink-2 whitespace-pre-wrap bg-paper rounded-lg p-4 border border-rule-2 max-h-80 overflow-auto",children:t.result})]}),t.error&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs text-err font-semibold uppercase tracking-wider mb-1",children:"Error"}),(0,n.jsx)("pre",{className:"text-sm text-err whitespace-pre-wrap bg-warn-bg rounded-lg p-4 border border-err/30",children:t.error})]})]})}}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=82920)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7513],{1489:(e,t,r)=>{Promise.resolve().then(r.bind(r,24170))},5977:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(78604);let n=a.forwardRef((e,t)=>{let{alt:r,color:n="currentColor",size:s="1em",weight:l="regular",mirrored:i=!1,children:o,weights:d,...c}=e;return a.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:n,viewBox:"0 0 256 256",transform:i?"scale(-1, 1)":void 0,...c},!!r&&a.createElement("title",null,r),o,d.get(l))});n.displayName="SSRBase"},14308:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var a=r(3680),n=r(78604),s=r(51869);function l({open:e,title:t,message:r,confirmLabel:i="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:u}){let m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{p(!0)},[]),(0,n.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&u()}},[e,u]),e&&x)?(0,s.createPortal)((0,a.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,a.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:u,"aria-hidden":"true"}),(0,a.jsxs)("div",{className:"relative bg-paper border border-rule-2 rounded-xl p-6 max-w-md w-full shadow-2xl",children:[(0,a.jsx)("h2",{id:"confirm-dialog-title",className:"text-base font-semibold text-ink",children:t}),r&&(0,a.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:r}),(0,a.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,a.jsx)("button",{ref:m,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,a.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}},22089:(e,t,r)=>{"use strict";r.d(t,{N:()=>i});var a=r(78604),n=r(5977);let s=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),l=a.forwardRef((e,t)=>a.createElement(n.A,{ref:t,...e,weights:s}));l.displayName="WarningIcon";let i=l},24170:(e,t,r)=>{"use strict";r.d(t,{default:()=>I});var a=r(3680),n=r(78604),s=r(27540),l=r(32307),i=r(65668),o=r(28870),d=r(66736),c=r(13260),u=r(81630),m=r(88499),x=r(93606),p=r(39504),h=r(64678);let b=(0,h.createServerReference)("409c323309b6e0c70c7e5fa891476c4f8a5724ed85",h.callServer,void 0,h.findSourceMapURL,"deleteMcpServerAction"),g=(0,h.createServerReference)("60e1dae0f6fcb459194ac6847f177cd7ea5167958d",h.callServer,void 0,h.findSourceMapURL,"renameMcpServerAction"),v=(0,h.createServerReference)("60a525fb1a7d0371de2f00a8eb7c3bda7a31685ea6",h.callServer,void 0,h.findSourceMapURL,"updateMcpServerApiKeyAction");var f=r(14308);let k=(0,h.createServerReference)("4067a8d48830fe5172f84c37187e6a2383152974dc",h.callServer,void 0,h.findSourceMapURL,"getMcpServerConfigAction"),j=(0,h.createServerReference)("60b2ec0fde8727e97be37bfe26f8a86ad2dcb409be",h.callServer,void 0,h.findSourceMapURL,"updateMcpServerConfigAction"),y="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";function N({mcpServerId:e,onDone:t,onCancel:r}){let[s,l]=(0,n.useState)(null),[i,o]=(0,n.useState)(null),[d,c]=(0,n.useTransition)(),[u,m]=(0,n.useState)(""),[x,h]=(0,n.useState)(""),[b,g]=(0,n.useState)("header"),[v,f]=(0,n.useState)(""),[C,w]=(0,n.useState)(""),[A,S]=(0,n.useState)(""),[R,$]=(0,n.useState)(""),[M,E]=(0,n.useState)([]);if((0,n.useEffect)(()=>{let t=!1;return(async()=>{let r=await k(e);if(t)return;if(!r.ok)return o(r.message);let a=r.data;l(a),m(a.name),h(a.url??""),g(a.authScheme??"header"),f(a.authParamName??""),S(a.command??""),$(a.args.join("\n")),E(a.envKeys.length>0?a.envKeys.map(e=>({key:e,value:""})):[{key:"",value:""}])})(),()=>{t=!0}},[e]),i)return(0,a.jsx)("div",{className:"bg-paper border border-rule-2 rounded-xl px-5 py-4",children:(0,a.jsx)("p",{className:"text-xs text-err",children:i})});if(!s)return(0,a.jsx)("div",{className:"bg-paper border border-rule-2 rounded-xl px-5 py-4",children:(0,a.jsx)("p",{className:"text-xs text-ink-4",children:"Loading configuration…"})});let L="stdio"===s.transport;function P(e,t){E(r=>r.map((r,a)=>a===e?{...r,...t}:r))}return(0,a.jsxs)("form",{onSubmit:function(e){if(e.preventDefault(),!s)return;let r=u.trim();if(!r)return void p.oR.error("Name is required");let a={name:r};if("http"===s.transport){let e=x.trim();if(!e)return void p.oR.error("Server URL is required");if(a.url=e,a.authScheme=b,"bearer"!==b){let e=v.trim();if(!e)return void p.oR.error("Auth param name is required for this scheme");a.authParamName=e}let t=C.trim();t&&(a.apiKey=t)}else{let e=A.trim();if(!e)return void p.oR.error("Command is required");a.command=e,a.args=R.split("\n").map(e=>e.trim()).filter(Boolean);let t={};for(let e of M){let r=e.key.trim();r&&(t[r]=e.value)}a.env=t}c(async()=>{let e=await j(s.id,a);e.ok?(p.oR.success("Configuration updated"),t?.()):p.oR.error(e.message)})},className:"bg-paper border border-rule-2 rounded-xl px-5 py-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wider text-ink-4 font-mono",children:[(0,a.jsx)("span",{children:s.slug}),(0,a.jsx)("span",{children:"\xb7"}),(0,a.jsx)("span",{children:s.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`edit-name-${s.id}`,className:"block text-xs text-ink-3 mb-1",children:"Name"}),(0,a.jsx)("input",{id:`edit-name-${s.id}`,type:"text",required:!0,value:u,onChange:e=>m(e.target.value),className:y})]}),!L&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`edit-url-${s.id}`,className:"block text-xs text-ink-3 mb-1",children:"Server URL"}),(0,a.jsx)("input",{id:`edit-url-${s.id}`,type:"url",required:!0,value:x,onChange:e=>h(e.target.value),placeholder:"https://…",className:`${y} font-mono`})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"block text-xs text-ink-3",children:"Auth scheme"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:["header","query","bearer"].map(e=>(0,a.jsxs)("label",{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs cursor-pointer border ${b===e?"bg-hover border-ink-3 text-ink":"bg-paper border-rule text-ink-3 hover:border-rule"}`,children:[(0,a.jsx)("input",{type:"radio",name:`edit-scheme-${s.id}`,value:e,checked:b===e,onChange:()=>g(e),className:"sr-only"}),"header"===e?"Header":"query"===e?"Query param":"Bearer"]},e))}),"bearer"!==b&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`edit-auth-param-${s.id}`,className:"block text-xs text-ink-3 mb-1",children:"header"===b?"Header name":"Query param name"}),(0,a.jsx)("input",{id:`edit-auth-param-${s.id}`,type:"text",required:!0,value:v,onChange:e=>f(e.target.value),placeholder:"header"===b?"x-api-key":"api_key",className:`${y} font-mono`})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`edit-key-${s.id}`,className:"block text-xs text-ink-3 mb-1",children:"API key"}),(0,a.jsx)("input",{id:`edit-key-${s.id}`,type:"password",autoComplete:"off",value:C,onChange:e=>w(e.target.value),placeholder:s.apiKeyLast4?`•••• ${s.apiKeyLast4} — leave blank to keep`:"Paste a key",className:`${y} font-mono`}),(0,a.jsx)("p",{className:"text-[11px] text-ink-4 mt-1",children:"Leave blank to keep the current key. The new config is verified against the live server before saving."})]})]}),L&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`edit-command-${s.id}`,className:"block text-xs text-ink-3 mb-1",children:"Command"}),(0,a.jsx)("input",{id:`edit-command-${s.id}`,type:"text",required:!0,value:A,onChange:e=>S(e.target.value),placeholder:"npx",className:`${y} font-mono`})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:`edit-args-${s.id}`,className:"block text-xs text-ink-3 mb-1",children:["Arguments ",(0,a.jsx)("span",{className:"text-ink-4",children:"(one per line)"})]}),(0,a.jsx)("textarea",{id:`edit-args-${s.id}`,rows:Math.max(3,R.split("\n").length),value:R,onChange:e=>$(e.target.value),className:`${y} font-mono resize-none`})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"block text-xs text-ink-3 mb-1",children:["Environment variables"," ",(0,a.jsx)("span",{className:"text-ink-4",children:"(encrypted — leave value blank to keep)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:M.map((e,t)=>(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:e.key,onChange:e=>P(t,{key:e.target.value}),placeholder:"VAR_NAME",className:`${y} flex-1 font-mono`}),(0,a.jsx)("input",{type:"password",autoComplete:"off",value:e.value,onChange:e=>P(t,{value:e.target.value}),placeholder:s.envKeys.includes(e.key)?"leave blank to keep":"value",className:`${y} flex-1 font-mono`}),(0,a.jsx)("button",{type:"button",onClick:()=>{E(e=>e.filter((e,r)=>r!==t))},"aria-label":"Remove env var",className:"px-2 text-ink-3 hover:text-err",children:"\xd7"})]},t))}),(0,a.jsx)("button",{type:"button",onClick:function(){E(e=>[...e,{key:"",value:""}])},className:"mt-2 text-[11px] text-ink-3 hover:text-ink",children:"+ Add variable"})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 items-center pt-1",children:[(0,a.jsx)("button",{type:"submit",disabled:d||!u.trim(),className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:d?"Verifying…":"Save changes"}),r&&(0,a.jsx)("button",{type:"button",onClick:r,className:"text-xs text-ink-3 hover:text-ink underline",children:"Cancel"})]})]})}function C({instance:e,catalogLabel:t,description:r}){let l=(0,s.useRouter)(),[i,o]=(0,n.useTransition)(),[d,c]=(0,n.useState)(!1),[u,m]=(0,n.useState)(!1),[x,h]=(0,n.useState)(!1),[k,j]=(0,n.useState)(e.name),[y,w]=(0,n.useState)(!1),[A,S]=(0,n.useState)("");function R(){let t=k.trim();t&&t!==e.name?o(async()=>{let r=await g(e.id,t);r.ok?(p.oR.success("Renamed"),h(!1)):p.oR.error(r.message)}):h(!1)}function $(){let t=A.trim();t?o(async()=>{let r=await v(e.id,t);r.ok?(p.oR.success(`${e.name} key rotated`),w(!1),S("")):p.oR.error(r.message)}):p.oR.error("New API key is required")}return(0,a.jsxs)("div",{className:"bg-paper border border-rule-2 rounded-xl px-5 py-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[x?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{autoFocus:!0,value:k,onChange:e=>j(e.target.value),onKeyDown:t=>{"Enter"===t.key&&R(),"Escape"===t.key&&(j(e.name),h(!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,a.jsx)("button",{type:"button",onClick:R,disabled:i,className:"text-xs text-ok hover:text-ok disabled:opacity-40",children:"Save"}),(0,a.jsx)("button",{type:"button",onClick:()=>{j(e.name),h(!1)},className:"text-xs text-ink-3 hover:text-ink-2",children:"Cancel"})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"text-ink font-medium",children:e.name}),(0,a.jsx)("button",{type:"button",onClick:()=>h(!0),"aria-label":"Rename MCP server",className:"text-ink-4 hover:text-ink-3 transition-colors text-xs leading-none",title:"Rename",children:"✎"}),(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink-3 font-mono",children:t}),(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ok",children:"connected"})]}),r&&(0,a.jsx)("p",{className:"text-xs text-ink-3 mt-0.5",children:r}),(0,a.jsxs)("p",{className:"text-xs text-ink-4 mt-1",children:[e.toolCount," tool",1===e.toolCount?"":"s"," discovered",e.apiKeyLast4?` \xb7 key …${e.apiKeyLast4}`:""]})]}),(0,a.jsxs)("div",{className:"shrink-0 flex gap-2 flex-wrap justify-end",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{m(e=>!e),w(!1)},disabled:i,className:"px-2.5 py-1 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:u?"Cancel":"Edit config"}),(0,a.jsx)("button",{type:"button",onClick:()=>w(e=>!e),disabled:i,className:"px-2.5 py-1 text-xs font-medium border border-rule-2 text-ink-3 rounded-md hover:border-rule hover:text-ink disabled:opacity-40",children:y?"Cancel":"Rotate key"}),(0,a.jsx)("button",{type:"button",onClick:()=>c(!0),disabled:i,className:"px-2.5 py-1 text-xs font-medium border border-err/30 text-err rounded-md hover:border-err/30 hover:text-err disabled:opacity-40",children:"Disconnect"})]})]}),y&&(0,a.jsxs)("div",{className:"space-y-3 pt-3 mt-3 border-t border-rule-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`mcp-rotate-${e.id}`,className:"block text-xs text-ink-3 mb-1",children:"New API key"}),(0,a.jsx)("input",{id:`mcp-rotate-${e.id}`,type:"password",autoComplete:"off",autoFocus:!0,value:A,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&$(),"Escape"===e.key&&(S(""),w(!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,a.jsx)("p",{className:"text-[11px] text-ink-4 mt-1",children:"Agent assignments stay intact — the key is verified against the server before being saved."})]}),(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,a.jsx)("button",{type:"button",onClick:$,disabled:i||!A.trim(),className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:i?"Verifying…":"Save new key"}),(0,a.jsx)("button",{type:"button",onClick:()=>{S(""),w(!1)},className:"text-xs text-ink-3 hover:text-ink underline",children:"Cancel"})]})]}),u&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(N,{mcpServerId:e.id,onDone:()=>{m(!1),l.refresh()},onCancel:()=>m(!1)})}),(0,a.jsx)(f.A,{open:d,title:`Disconnect "${e.name}"?`,message:"The MCP connector and all its agent assignments will be removed. Re-connecting later requires the API key again.",confirmLabel:"Disconnect",onConfirm:function(){c(!1),o(async()=>{let t=await b(e.id);t.ok?p.oR.success(`${e.name} disconnected`):p.oR.error(t.message)})},onCancel:()=>c(!1)})]})}function w({instances:e,catalog:t}){return(0,a.jsx)("div",{className:"overflow-hidden rounded-2xl border border-rule-2 bg-paper",children:(0,a.jsxs)("table",{className:"w-full border-collapse",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)(A,{label:"Server"}),(0,a.jsx)(A,{label:"Tools"}),(0,a.jsx)(A,{label:"Transport"}),(0,a.jsx)(A,{label:"Status"}),(0,a.jsx)(A,{label:"Actions",align:"right"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>{let r=t.find(t=>t.slug===e.slug);return(0,a.jsx)(S,{instance:e,catalogLabel:r?.label??e.name,description:r?.description??"",transport:r?.transport??"http"},e.id)})})]})})}function A({label:e,align:t="left"}){return(0,a.jsx)("th",{className:`border-b border-rule-2 px-[18px] pt-3.5 pb-2.5 font-mono text-[9.5px] font-normal whitespace-nowrap uppercase tracking-[0.16em] text-ink-4 ${"right"===t?"text-right":"text-left"}`,scope:"col",children:e})}function S({instance:e,catalogLabel:t,description:r,transport:s}){let[l,i]=(0,n.useState)(!1),o=t.slice(0,2).toUpperCase();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:"border-b border-rule-2 last:border-0 hover:bg-hover",children:[(0,a.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(u.A,{variant:"conn",size:"sm",shape:"square",background:"#3565ff",children:(0,a.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:o})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[13.5px] font-medium leading-[1.2] text-ink",children:e.name}),(0,a.jsx)("div",{className:"mt-0.5 font-mono text-[10.5px] uppercase tracking-[0.12em] text-ink-4",children:t})]})]})}),(0,a.jsxs)("td",{className:"px-[18px] py-[13px] align-middle",children:[(0,a.jsx)("span",{className:"font-mono text-[12.5px] text-ink-2",children:e.toolCount}),0===e.toolCount&&(0,a.jsx)("span",{className:"ml-1 font-mono text-[11px] text-ink-4",children:"none"})]}),(0,a.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,a.jsx)(m.A,{children:s})}),(0,a.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,a.jsx)(x.A,{variant:e.active?"done":"warn",label:e.active?"Connected":"Inactive"})}),(0,a.jsx)("td",{className:"px-[18px] py-[13px] align-middle",children:(0,a.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,a.jsx)("button",{type:"button",onClick:()=>i(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,a.jsx)("tr",{className:"border-b border-rule-2 last:border-0 bg-hover/40",children:(0,a.jsx)("td",{colSpan:5,className:"px-[18px] py-3",children:(0,a.jsx)(C,{instance:e,catalogLabel:t,description:r})})})]})}var R=r(40319),$=r(42357),M=r(37820),E=r(16237);let L=(0,h.createServerReference)("40c2a1a8bbe7ffe80d3ff0c990a6c8654ded77d9a1",h.callServer,void 0,h.findSourceMapURL,"createMcpServerFromCatalogAction");function P({catalogItem:e,onDone:t}){let[r,s]=(0,n.useTransition)(),[l,i]=(0,n.useState)(""),[o,d]=(0,n.useState)(""),[c,u]=(0,n.useState)(""),[m,x]=(0,n.useState)(""),[h,b]=(0,n.useState)("header"),[g,v]=(0,n.useState)(""),[f,k]=(0,n.useState)(""),[j,y]=(0,n.useState)(""),[N,C]=(0,n.useState)(()=>(e.args??[]).join("\n")),[w,A]=(0,n.useState)(()=>{let t=e.envVarNames??[];return t.length>0?t.map(e=>({key:e,value:""})):[{key:"",value:""}]}),S="custom-http-mcp"===e.slug,R="custom-stdio-mcp"===e.slug,$="stdio"===e.transport,M=$&&!R,E=!$&&null===e.serverUrl;function Z(){i(""),d(""),u(""),x(""),b("header"),v(""),k(""),y(""),C((e.args??[]).join("\n"));let t=e.envVarNames??[];A(t.length>0?t.map(e=>({key:e,value:""})):[{key:"",value:""}])}function F(){A(e=>[...e,{key:"",value:""}])}function _(e){A(t=>t.filter((t,r)=>r!==e))}function q(e,t){A(r=>r.map((r,a)=>a===e?{...r,...t}:r))}let I=m.trim()?`${m.trim().replace(/-/g,"_")}__list_things`:"my_slug__list_things";return(0,a.jsxs)("form",{onSubmit:function(r){r.preventDefault();let a=l.trim();if(!a)return void p.oR.error("Name is required");if(M){let r=N.split("\n").map(e=>e.trim()).filter(Boolean),n={};for(let e of w){let t=e.key.trim();t&&(n[t]=e.value)}s(async()=>{let s=await L({slug:e.slug,name:a,customArgs:r,customEnv:Object.keys(n).length>0?n:void 0});s.ok?(p.oR.success(`${a} connected`),Z(),t?.()):p.oR.error(s.message)});return}if(R){let r=m.trim(),n=f.trim();if(!r)return p.oR.error("Server slug is required");if(!/^[a-z0-9-]+$/.test(r))return p.oR.error("Slug must be lowercase letters, digits, dashes");if(!n)return p.oR.error("Command is required");let l=j.split("\n").map(e=>e.trim()).filter(Boolean),i={};for(let e of w){let t=e.key.trim();t&&(i[t]=e.value)}return void s(async()=>{let s=await L({slug:e.slug,name:a,customSlug:r,customCommand:n,customArgs:l,customEnv:i});s.ok?(p.oR.success(`${a} connected`),Z(),t?.()):p.oR.error(s.message)})}let n=o.trim(),i=c.trim();if(!n)return void p.oR.error("API key is required");if(E&&!i)return void p.oR.error("Server URL is required");if(S){let e=m.trim();if(!e)return p.oR.error("Server slug is required");if(!/^[a-z0-9-]+$/.test(e))return p.oR.error("Slug must be lowercase letters, digits, dashes");if("bearer"!==h&&!g.trim())return p.oR.error("Auth param name is required for this scheme")}s(async()=>{let r={slug:e.slug,name:a,apiKey:n};E&&(r.url=i),S&&(r.customSlug=m.trim(),r.customAuthScheme=h,"bearer"!==h&&(r.customAuthParamName=g.trim()));let s=await L(r);s.ok?(p.oR.success(`${a} connected`),Z(),t?.()):p.oR.error(s.message)})},className:"space-y-3",children:[e.description&&(0,a.jsx)("p",{className:"text-xs text-ink-4",children:e.description}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:`mcp-name-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:["Name ",(0,a.jsx)("span",{className:"text-ink-4",children:'(e.g. "Cortex — perso")'})]}),(0,a.jsx)("input",{id:`mcp-name-${e.slug}`,type:"text",required:!0,value:l,onChange:e=>i(e.target.value),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"})]}),(S||R)&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:`mcp-slug-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:["Server slug ",(0,a.jsx)("span",{className:"text-ink-4",children:"(tool name prefix)"})]}),(0,a.jsx)("input",{id:`mcp-slug-${e.slug}`,type:"text",required:!0,value:m,onChange:e=>x(e.target.value),placeholder:"my-server",pattern:"[a-z0-9-]+",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,a.jsxs)("p",{className:"text-[11px] text-ink-4 mt-1",children:["Tools will be named like ",(0,a.jsx)("span",{className:"font-mono text-ink-3",children:I}),". Lowercase letters, digits, dashes."]})]}),E&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`mcp-url-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:"Server URL"}),(0,a.jsx)("input",{id:`mcp-url-${e.slug}`,type:"url",required:!0,value:c,onChange:e=>u(e.target.value),placeholder:"https://…",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"})]}),S&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"block text-xs text-ink-3",children:"Auth scheme"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:["header","query","bearer"].map(t=>(0,a.jsxs)("label",{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs cursor-pointer border ${h===t?"bg-hover border-ink-3 text-ink":"bg-paper border-rule text-ink-3 hover:border-rule"}`,children:[(0,a.jsx)("input",{type:"radio",name:`mcp-scheme-${e.slug}`,value:t,checked:h===t,onChange:()=>b(t),className:"sr-only"}),"header"===t?"Header":"query"===t?"Query param":"Bearer"]},t))}),"bearer"!==h&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`mcp-auth-param-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:"header"===h?"Header name":"Query param name"}),(0,a.jsx)("input",{id:`mcp-auth-param-${e.slug}`,type:"text",required:!0,value:g,onChange:e=>v(e.target.value),placeholder:"header"===h?"x-api-key":"api_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,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`mcp-key-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:"API key"}),(0,a.jsx)("input",{id:`mcp-key-${e.slug}`,type:"password",required:!0,autoComplete:"off",value:o,onChange:e=>d(e.target.value),placeholder:e.keyPrefix[0]?`${e.keyPrefix[0]}…`:"",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"}),e.docsHint&&(0,a.jsx)("p",{className:"text-[11px] text-ink-4 mt-1",children:e.docsHint})]}),M&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:`mcp-prefilled-args-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:["Arguments"," ",(0,a.jsx)("span",{className:"text-ink-4",children:"(one per line — edit placeholders like <root-directory>)"})]}),(0,a.jsx)("textarea",{id:`mcp-prefilled-args-${e.slug}`,rows:Math.max(3,(e.args??[]).length+1),value:N,onChange:e=>C(e.target.value),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 resize-none"}),(0,a.jsxs)("p",{className:"text-[11px] text-ink-4 mt-1",children:["Command: ",(0,a.jsx)("span",{className:"font-mono text-ink-3",children:e.command??"npx"})]})]}),(e.envVarNames??[]).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"block text-xs text-ink-3 mb-1",children:["Environment variables ",(0,a.jsx)("span",{className:"text-ink-4",children:"(encrypted at rest)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:w.map((e,t)=>(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:e.key,onChange:e=>q(t,{key:e.target.value}),placeholder:"VAR_NAME",className:"flex-1 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,a.jsx)("input",{type:"password",autoComplete:"off",value:e.value,onChange:e=>q(t,{value:e.target.value}),placeholder:"value",className:"flex-1 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,a.jsx)("button",{type:"button",onClick:()=>_(t),disabled:1===w.length,"aria-label":"Remove env var",className:"px-2 text-ink-3 hover:text-err disabled:opacity-30",children:"\xd7"})]},t))}),(0,a.jsx)("button",{type:"button",onClick:F,className:"mt-2 text-[11px] text-ink-3 hover:text-ink",children:"+ Add variable"})]}),e.docsHint&&(0,a.jsx)("p",{className:"text-[11px] text-ink-4",children:e.docsHint})]}),R&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:`mcp-command-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:"Command"}),(0,a.jsx)("input",{id:`mcp-command-${e.slug}`,type:"text",required:!0,value:f,onChange:e=>k(e.target.value),placeholder:"npx",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,a.jsx)("p",{className:"text-[11px] text-ink-4 mt-1",children:"Executable name (resolved via PATH) or absolute path."})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:`mcp-args-${e.slug}`,className:"block text-xs text-ink-3 mb-1",children:["Arguments ",(0,a.jsx)("span",{className:"text-ink-4",children:"(one per line)"})]}),(0,a.jsx)("textarea",{id:`mcp-args-${e.slug}`,rows:3,value:j,onChange:e=>y(e.target.value),placeholder:"-y\n@modelcontextprotocol/server-filesystem\n/path/to/folder",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 resize-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"block text-xs text-ink-3 mb-1",children:["Environment variables ",(0,a.jsx)("span",{className:"text-ink-4",children:"(encrypted at rest)"})]}),(0,a.jsx)("div",{className:"space-y-2",children:w.map((e,t)=>(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:e.key,onChange:e=>q(t,{key:e.target.value}),placeholder:"GITHUB_TOKEN",className:"flex-1 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,a.jsx)("input",{type:"password",autoComplete:"off",value:e.value,onChange:e=>q(t,{value:e.target.value}),placeholder:"value",className:"flex-1 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,a.jsx)("button",{type:"button",onClick:()=>_(t),disabled:1===w.length,"aria-label":"Remove env var",className:"px-2 text-ink-3 hover:text-err disabled:opacity-30",children:"\xd7"})]},t))}),(0,a.jsx)("button",{type:"button",onClick:F,className:"mt-2 text-[11px] text-ink-3 hover:text-ink",children:"+ Add variable"}),e.docsHint&&(0,a.jsx)("p",{className:"text-[11px] text-ink-4 mt-2",children:e.docsHint})]})]}),(0,a.jsx)("button",{type:"submit",disabled:r||!l.trim(),className:"px-4 py-2 text-sm font-semibold bg-ink text-canvas rounded-md hover:brightness-[0.92] disabled:opacity-50",children:r?"Connecting…":"Connect"})]})}function Z(e){return"cogni-cortex"===e?"Comms":"stripe"===e||"mcp-postgres"===e||"supabase"===e||"airtable"===e?"Data":"mcp-filesystem"===e||"mcp-git"===e||"mcp-github"===e||"sentry"===e?"Dev":"mcp-fetch"===e||"mcp-playwright"===e||"apify"===e?"Web":"composio"===e||"linear"===e||"n8n"===e||"notion"===e?"Productivity":e.startsWith("custom-")?"Custom":"Other"}let F=[{value:"All",label:"All"},{value:"Comms",label:"Comms"},{value:"Data",label:"Data"},{value:"Dev",label:"Dev"},{value:"Web",label:"Web"},{value:"Productivity",label:"Productivity"},{value:"Custom",label:"Custom"},{value:"Other",label:"Other"}];function _({catalog:e,instances:t,category:r,onCategoryChange:n}){return(0,a.jsxs)("div",{children:[(0,a.jsx)($.A,{items:F,value:r,onChange:n,className:"mb-[18px]"}),0===e.length?(0,a.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:(0,a.jsx)("p",{className:"text-[13px] text-ink-3",children:"No servers in this category."})}):(0,a.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),n=r.length>0;return(0,a.jsx)(q,{catalogItem:e,isInstalled:n,installedCount:r.length},e.slug)})})]})}function q({catalogItem:e,isInstalled:t,installedCount:r}){let[l,i]=(0,n.useState)(!1),o=(0,s.useRouter)(),d=e.label.slice(0,2).toUpperCase(),u=Z(e.slug),m="pending"===e.status;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M.A,{glyph:(0,a.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:d}),glyphVariant:"conn",glyphBackground:"#3565ff",name:e.label,description:e.description,category:u,topRight:t||m?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[m&&(0,a.jsx)("span",{className:"inline-flex items-center rounded-[6px] bg-warn-bg px-2 py-1 font-sans text-[11px] font-medium text-warn",title:"Not yet verified end-to-end — connection params may need adjusting.",children:"Test pending"}),t&&(0,a.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,a.jsx)(R.r,{size:11,weight:"regular"}),r," installed"]})]}):void 0,foot:(0,a.jsx)(E.A,{ctaLabel:t?"Add account":"Install",ctaVariant:"blue",onCta:()=>i(!0)})}),(0,a.jsx)(c.A,{open:l,onClose:()=>i(!1),title:t?`Add account — ${e.label}`:`Install ${e.label}`,children:(0,a.jsx)(P,{catalogItem:e,onDone:function(){i(!1),o.refresh()}})})]})}function I({instances:e,catalog:t}){let r=(0,s.useRouter)(),[u,m]=(0,n.useState)(e.length>0?"installed":"marketplace"),[x,p]=(0,n.useState)(""),[h,b]=(0,n.useState)("All"),[g,v]=(0,n.useState)(!1),[f,k]=(0,n.useState)("stdio"),j=t.find(e=>"custom-http-mcp"===e.slug),y=t.find(e=>"custom-stdio-mcp"===e.slug),N="http"===f?j:y,C=(0,n.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,x]),A=(0,n.useMemo)(()=>{let e=t;if("All"!==h&&(e=e.filter(e=>Z(e.slug)===h)),x.trim()){let t=x.toLowerCase();e=e.filter(e=>e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t))}return e},[t,h,x]);return(0,a.jsxs)("div",{className:"pb-10",children:[(0,a.jsx)(l.A,{title:"MCP Connectors",subtitle:"Model Context Protocol servers your agents can call. Install from the marketplace or wire a custom HTTP / stdio server."}),(0,a.jsx)(i.A,{tabs:(0,a.jsx)(o.A,{value:u,onChange:e=>{m(e),p(""),b("All")},tabs:[{value:"installed",label:"Installed",count:e.length},{value:"marketplace",label:"Marketplace",count:t.length}]}),search:(0,a.jsx)(d.A,{value:x,onChange:p,placeholder:"installed"===u?"Search MCP servers…":"Search catalog…"}),cta:(0,a.jsx)("button",{type:"button",onClick:()=>v(!0),className:"inline-flex h-[34px] items-center gap-1.5 rounded-md bg-conn-vivid px-3.5 text-[13px] font-medium leading-none text-white transition-[filter] hover:brightness-[0.94]",children:"+ Add custom MCP"})}),(0,a.jsx)("div",{className:"pt-5",children:"installed"===u?0===e.length?(0,a.jsx)(H,{onBrowse:()=>m("marketplace")}):0===C.length?(0,a.jsx)(T,{}):(0,a.jsx)(w,{instances:C,catalog:t}):(0,a.jsx)(_,{catalog:A,instances:e,category:h,onCategoryChange:b})}),(0,a.jsx)(c.A,{open:g,onClose:()=>v(!1),title:"Add a custom MCP server",children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"flex gap-2",children:["stdio","http"].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>k(e),className:`flex-1 rounded-md border px-3 py-2 text-xs font-medium ${f===e?"border-ink-3 bg-hover text-ink":"border-rule bg-paper text-ink-3 hover:border-rule"}`,children:"stdio"===e?"Local subprocess (stdio)":"Remote server (HTTP)"},e))}),(0,a.jsx)("p",{className:"text-[11px] text-ink-4",children:"stdio"===f?"Run any MCP package locally (npx, python, a binary…). Provide the command, args, and env vars.":"Connect any Streamable-HTTP MCP server. Provide the URL, auth scheme, and API key."}),N?(0,a.jsx)(P,{catalogItem:N,onDone:()=>{v(!1),r.refresh()}},f):(0,a.jsx)("p",{className:"text-xs text-err",children:"Custom MCP option is unavailable."})]})})]})}function H({onBrowse:e}){return(0,a.jsxs)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:[(0,a.jsxs)("p",{className:"text-[13px] leading-[1.5] text-ink-3",children:["No MCP servers installed yet.",(0,a.jsx)("br",{}),"Pick one from the Marketplace — its tools become available to any agent you assign it to."]}),(0,a.jsx)("div",{className:"mt-4 inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:e,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md bg-conn-vivid px-3.5 text-[13px] font-medium leading-none text-white transition-[filter] hover:brightness-[0.94]",children:"Browse Marketplace"})})]})}function T(){return(0,a.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center",children:(0,a.jsx)("p",{className:"text-[13px] leading-[1.5] text-ink-3",children:"No servers match your search."})})}},27540:(e,t,r)=>{"use strict";var a=r(71268);r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}}),r.o(a,"useSearchParams")&&r.d(t,{useSearchParams:function(){return a.useSearchParams}})},40319:(e,t,r)=>{"use strict";r.d(t,{r:()=>i});var a=r(78604),n=r(53087),s=r(54935);let l=a.forwardRef((e,t)=>a.createElement(n.A,{ref:t,...e,weights:s.A}));l.displayName="CheckCircleIcon";let i=l},42357:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(3680);function n({items:e,value:t,onChange:r,className:s=""}){return(0,a.jsx)("div",{className:`flex flex-wrap items-center gap-2 ${s}`,children:e.map(e=>{let n=e.value===t;return(0,a.jsxs)("button",{type:"button",onClick:()=>r(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 ${n?"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,a.jsx)("span",{className:`font-mono text-[11px] leading-none ${n?"opacity-65":"opacity-55"}`,children:e.count})]},e.value)})})}},54935:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(78604);let n=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={callServer:function(){return s.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var n in a)Object.defineProperty(t,n,{enumerable:!0,get:a[n]});let s=r(22673),l=r(43145),i=r(87478)},82592:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var a=r(3680);let n={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},s={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 l({variant:e="ok",size:t="sm",animate:r=!0,className:i=""}){return(0,a.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${n[e]} ${r?s[e]:""} ${i}`})}},86127:(e,t,r)=>{"use strict";r.d(t,{r:()=>i});var a=r(78604),n=r(5977),s=r(54935);let l=a.forwardRef((e,t)=>a.createElement(n.A,{ref:t,...e,weights:s.A}));l.displayName="CheckCircleIcon";let i=l},93606:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var a=r(3680),n=r(86127),s=r(22089),l=r(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:r,className:c=""}){let u=t??i[e],m=null;return void 0!==r?m=r:"done"===e?m=(0,a.jsx)(n.r,{size:11,weight:"regular"}):"warn"===e?m=(0,a.jsx)(s.N,{size:11,weight:"regular"}):"run"===e&&(m=(0,a.jsx)(l.A,{variant:"blue",size:"sm"})),(0,a.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:[m,u]})}}},e=>{e.O(0,[3363,9504,8396,1065,8724,7358],()=>e(e.s=1489)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4244],{1442:(e,t,r)=>{"use strict";r.d(t,{default:()=>Z});var l=r(3680),a=r(78604),n=r(63363),s=r.n(n),i=r(39504),c=r(32307),o=r(65668),d=r(28870),x=r(66736),m=r(77045),u=r(5977);let p=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,144l-72,72L56,144Z",opacity:"0.2"}),a.createElement("path",{d:"M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z"}))]]),h=a.forwardRef((e,t)=>a.createElement(u.A,{ref:t,...e,weights:p}));h.displayName="ArrowDownIcon";let g=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),a.createElement("path",{d:"M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z"}))]]),f=a.forwardRef((e,t)=>a.createElement(u.A,{ref:t,...e,weights:g}));function v({label:e,value:t,unit:r,subtle:a,delta:n}){let s=n?.upIsGood??!0,i=n&&"up"===n.direction===s,c=n?i?"text-ok":"text-err":"",o=n?.direction==="down"?h:f;return(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 rounded-xl border border-rule-2 bg-paper px-3.5 py-3",children:[(0,l.jsx)("div",{className:"truncate font-mono text-[9.5px] uppercase tracking-[0.14em] text-ink-4",children:e}),(0,l.jsxs)("div",{className:"mt-1 truncate text-[22px] font-medium leading-[1.1] tracking-[-0.02em] text-ink",children:[t,r&&(0,l.jsx)("span",{className:"ml-0.5 text-[11px] font-medium text-ink-4",children:r})]}),a&&(0,l.jsx)("div",{className:"text-[11px] leading-none text-ink-3",children:a}),n&&(0,l.jsxs)("div",{className:`mt-0.5 inline-flex items-center gap-1 font-mono text-[11px] leading-none tracking-[0.02em] ${c}`,children:[(0,l.jsx)(o,{size:9,weight:"bold"}),n.text]})]})}f.displayName="ArrowUpIcon";var b=r(42357),w=r(81630),j=r(99203),k=r(82592);function y({children:e,badge:t,size:r="md",className:a="",type:n="button",...s}){return(0,l.jsxs)("button",{type:n,className:`relative flex shrink-0 items-center justify-center border border-rule-2 bg-paper text-ink-2 transition-colors hover:text-ink ${"md"===r?"h-[34px] w-[34px] rounded-md":"h-[30px] w-[30px] rounded-[7px]"} ${a}`,...s,children:[e,t&&(0,l.jsx)("span",{className:"absolute top-[6px] right-[7px] h-1.5 w-1.5 rounded-full bg-skill-vivid"})]})}var N=r(14308),M=r(64678);let A=(0,M.createServerReference)("40d69a1ce58eda67b96c81a500c437e9107611b2d7",M.callServer,void 0,M.findSourceMapURL,"unarchiveMemoryAction"),E=(0,M.createServerReference)("4052b64a6183fe248882f2c27441addf9e9e07bb4a",M.callServer,void 0,M.findSourceMapURL,"archiveMemoryAction"),_=(0,M.createServerReference)("406bc57145dd20a43bf9eb44ad644423cd40feacc5",M.callServer,void 0,M.findSourceMapURL,"deleteMemoryAction"),C={preference:{color:"#3565ff",label:"Preference",icon:(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[(0,l.jsx)("circle",{cx:"4",cy:"5",r:"1",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"4",cy:"11",r:"1",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"4",cy:"8",r:"1",fill:"currentColor"}),(0,l.jsx)("path",{d:"M7 5h6M7 8h6M7 11h4"})]})},context:{color:"#22a3aa",label:"Context",icon:(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[(0,l.jsx)("circle",{cx:"8",cy:"8",r:"5.5"}),(0,l.jsx)("path",{d:"M3 8h10M8 2.5c2 1.5 3 3.3 3 5.5s-1 4-3 5.5c-2-1.5-3-3.3-3-5.5s1-4 3-5.5z"})]})},outcome:{color:"#1e7a44",label:"Outcome",icon:(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:[(0,l.jsx)("path",{d:"M3.5 2.5h6L12.5 5.5v8h-9z"}),(0,l.jsx)("path",{d:"M9.5 2.5v3h3"})]})},learned_rule:{color:"#ff5631",label:"Rule",icon:(0,l.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:(0,l.jsx)("path",{d:"M2.5 3.5h9v6h-5l-3 3v-3h-1zM5.5 7.5h8v4h-1l-2 2v-2h-5z"})})}};function $(e){return C[e??"context"]??C.context}function L({category:e}){let t=$(e);return(0,l.jsxs)("span",{style:{background:t.color+"22",color:t.color},className:"inline-flex h-[24px] items-center gap-1.5 rounded-[6px] px-2.5 text-[11.5px] font-medium leading-none capitalize [&_svg]:h-[12px] [&_svg]:w-[12px]",children:[t.icon,t.label]})}function S({id:e,archived:t}){let[r,n]=(0,a.useTransition)(),[s,c]=(0,a.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,l.jsx)("button",{type:"button",onClick:function(){n(async()=>{let r=await (t?A:E)(e);r.ok?i.oR.success(t?"Memory restored":"Memory archived"):i.oR.error(r.message)})},disabled:r,className:"rounded-md border border-rule-2 px-2.5 py-1 text-[11.5px] font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:t?"Restore":"Archive"}),(0,l.jsx)(y,{size:"sm",disabled:r,onClick:()=>c(!0),title:"Delete memory",children:(0,l.jsxs)("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"h-[13px] w-[13px]",children:[(0,l.jsx)("circle",{cx:"4",cy:"8",r:"1.2"}),(0,l.jsx)("circle",{cx:"8",cy:"8",r:"1.2"}),(0,l.jsx)("circle",{cx:"12",cy:"8",r:"1.2"})]})})]}),(0,l.jsx)(N.A,{open:s,title:"Delete memory?",message:"This memory will be permanently removed. This action cannot be undone.",confirmLabel:"Delete",onConfirm:function(){c(!1),n(async()=>{let t=await _(e);t.ok?i.oR.success("Memory deleted"):i.oR.error(t.message)})},onCancel:()=>c(!1)})]})}function Z({initialItems:e,agents:t,totalCount:r}){let[n,i]=(0,a.useState)("all"),[u,p]=(0,a.useState)("all"),[h,g]=(0,a.useState)(""),f=(0,a.useMemo)(()=>e.filter(e=>!e.archived).length,[e]),y=(0,a.useMemo)(()=>e.filter(e=>e.archived).length,[e]),N=(0,a.useMemo)(()=>{let t=e;if(t="all"===n?t.filter(e=>!e.archived):t.filter(e=>e.archived),"all"!==u&&(t=t.filter(e=>e.agent_id===u)),h.trim()){let e=h.toLowerCase();t=t.filter(t=>t.fact.toLowerCase().includes(e)||(t.agentName??"").toLowerCase().includes(e)||(t.category??"").toLowerCase().includes(e)||(t.skill_tags??[]).some(t=>t.toLowerCase().includes(e)))}return t},[e,n,u,h]),M=(0,a.useMemo)(()=>{let a=new Map;for(let t of e)t.agent_id&&t.agentName&&a.set(t.agent_id,(a.get(t.agent_id)??0)+1);let n=[{value:"all",label:"All agents",count:`\xb7 ${r}`}];for(let e of t){let t=a.get(e.id);t&&n.push({value:e.id,label:(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,l.jsx)("span",{className:"h-[7px] w-[7px] rounded-full bg-agent-vivid"}),e.name]}),count:`\xb7 ${t}`})}return n},[e,t,r]);return(0,l.jsxs)("div",{className:"pb-10",children:[(0,l.jsx)(c.A,{title:"Memory",subtitle:"What your agents remember between runs. Search across facts and outcomes, filter by agent, or archive what's no longer relevant."}),(0,l.jsx)(o.A,{tabs:(0,l.jsx)(d.A,{tabs:[{value:"all",label:"All",count:f},{value:"archived",label:"Archived",count:y}],value:n,onChange:i}),search:(0,l.jsx)(x.A,{value:h,onChange:g,placeholder:"Search memories…",minWidth:260}),cta:(0,l.jsx)(m.A,{variant:"coral",disabled:!0,children:"+ Add source"})}),(0,l.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2.5 md:grid-cols-2",children:[(0,l.jsx)(v,{label:"Total memories",value:String(r)}),(0,l.jsx)(v,{label:"Archived",value:String(y),subtle:"excluded from agent context"})]}),(0,l.jsx)(b.A,{items:M,value:u,onChange:p,className:"mt-3"}),(0,l.jsx)("div",{className:"mt-4 overflow-hidden rounded-xl border border-rule-2 bg-paper",children:0===N.length?(0,l.jsxs)("div",{className:"px-6 py-12 text-center text-sm text-ink-4",children:["No memories match these filters."," ","all"!==n||h||"all"!==u?"Try a different filter.":"Agents save memories automatically when they call save_memory."]}):(0,l.jsxs)("table",{className:"w-full text-sm",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{className:"border-b border-rule-2",children:[(0,l.jsx)("th",{className:"px-5 py-3 text-left text-[10.5px] font-semibold uppercase tracking-wider whitespace-nowrap text-ink-4",children:"Memory"}),(0,l.jsx)("th",{className:"hidden px-5 py-3 text-left text-[10.5px] font-semibold uppercase tracking-wider whitespace-nowrap text-ink-4 md:table-cell",children:"Agent"}),(0,l.jsx)("th",{className:"hidden px-5 py-3 text-left text-[10.5px] font-semibold uppercase tracking-wider whitespace-nowrap text-ink-4 lg:table-cell",children:"Category"}),(0,l.jsx)("th",{className:"hidden px-5 py-3 text-left text-[10.5px] font-semibold uppercase tracking-wider whitespace-nowrap text-ink-4 xl:table-cell",children:"Last accessed"}),(0,l.jsx)("th",{className:"px-5 py-3 text-right text-[10.5px] font-semibold uppercase tracking-wider whitespace-nowrap text-ink-4",children:"Actions"})]})}),(0,l.jsx)("tbody",{children:N.map(e=>{let t=$(e.category),r=function(e){if(!e)return!1;let t=e instanceof Date?e:new Date(e);return Date.now()-t.getTime()<12e4}(e.last_accessed_at);return(0,l.jsxs)("tr",{className:"align-middle border-b border-rule-2/60 transition-colors last:border-0 hover:bg-hover/50",children:[(0,l.jsx)("td",{className:"px-5 py-3.5",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)(w.A,{variant:"neutral",size:"md",shape:"square",background:t.color,className:"mt-0.5 shrink-0 [&_svg]:h-[14px] [&_svg]:w-[14px]",children:t.icon}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("div",{className:"line-clamp-2 text-[13px] leading-snug text-ink",children:e.fact}),(0,l.jsxs)("div",{className:"mt-0.5 font-mono text-[11px] text-ink-4",children:[e.created_at?new Date(e.created_at).toLocaleString():"—",(e.access_count??0)>0?` \xb7 accessed ${e.access_count}\xd7`:""]})]})]})}),(0,l.jsx)("td",{className:"hidden px-5 py-3.5 md:table-cell",children:e.agentName?(0,l.jsxs)(s(),{href:"/agents",className:"inline-flex items-center gap-2 text-[12px] text-ink-2 transition-colors hover:text-ink",children:[(0,l.jsx)(j.A,{name:e.agentName,size:"sm"}),e.agentName]}):(0,l.jsx)("span",{className:"text-ink-4",children:"—"})}),(0,l.jsx)("td",{className:"hidden px-5 py-3.5 lg:table-cell",children:(0,l.jsx)(L,{category:e.category})}),(0,l.jsx)("td",{className:"hidden px-5 py-3.5 xl:table-cell",children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-mono text-[12px] text-ink-3",children:[function(e){if(!e)return"—";let t=e instanceof Date?e:new Date(e),r=Date.now()-t.getTime();return r<6e4?"just now":r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:t.toLocaleDateString()}(e.last_accessed_at),r&&(0,l.jsx)(k.A,{variant:"ok",size:"sm"})]})}),(0,l.jsx)("td",{className:"px-5 py-3.5 text-right",children:(0,l.jsx)(S,{id:e.id,archived:e.archived??!1})})]},e.id)})})]})})]})}},5977:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var l=r(78604);let a=l.forwardRef((e,t)=>{let{alt:r,color:a="currentColor",size:n="1em",weight:s="regular",mirrored:i=!1,children:c,weights:o,...d}=e;return l.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,fill:a,viewBox:"0 0 256 256",transform:i?"scale(-1, 1)":void 0,...d},!!r&&l.createElement("title",null,r),c,o.get(s))});a.displayName="SSRBase"},14308:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var l=r(3680),a=r(78604),n=r(51869);function s({open:e,title:t,message:r,confirmLabel:i="Confirm",cancelLabel:c="Cancel",destructive:o=!0,onConfirm:d,onCancel:x}){let m=(0,a.useRef)(null),[u,p]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{p(!0)},[]),(0,a.useEffect)(()=>{if(e)return m.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&x()}},[e,x]),e&&u)?(0,n.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}),r&&(0,l.jsx)("p",{className:"mt-2 text-sm text-ink-3 leading-relaxed",children:r}),(0,l.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,l.jsx)("button",{ref:m,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:c}),(0,l.jsx)("button",{type:"button",onClick:d,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${o?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:i})]})]})]}),document.body):null}},28870:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var l=r(3680),a=r(78604);function n({tabs:e,value:t,defaultValue:r,onChange:s}){let[i,c]=(0,a.useState)(t??r??e[0].value),o=t??i;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 r=e.value===o;return(0,l.jsxs)("button",{type:"button",role:"tab","aria-selected":r,onClick:()=>{void 0===t&&c(e.value),s?.(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 ${r?"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 ${r?"opacity-65":"opacity-60"}`,children:["\xb7 ",e.count]})]},e.value)})})}},32307:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var l=r(3680);function a({title:e,subtitle:t,actions:r,className:n=""}){return(0,l.jsxs)("div",{className:`flex flex-wrap items-end justify-between gap-4 pt-7 pb-5 ${n}`,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})]}),r&&(0,l.jsx)("div",{className:"shrink-0",children:r})]})}},32928:(e,t,r)=>{"use strict";r.d(t,{e:()=>i});var l=r(78604),a=r(53087);let n=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"}))]]),s=l.forwardRef((e,t)=>l.createElement(a.A,{ref:t,...e,weights:n}));s.displayName="MagnifyingGlassIcon";let i=s},42357:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var l=r(3680);function a({items:e,value:t,onChange:r,className:n=""}){return(0,l.jsx)("div",{className:`flex flex-wrap items-center gap-2 ${n}`,children:e.map(e=>{let a=e.value===t;return(0,l.jsxs)("button",{type:"button",onClick:()=>r(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 ${a?"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 ${a?"opacity-65":"opacity-55"}`,children:e.count})]},e.value)})})}},53087:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var l=r(78604);let a=(0,l.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),n=l.forwardRef((e,t)=>{let{alt:r,color:n,size:s,weight:i,mirrored:c,children:o,weights:d,...x}=e,{color:m="currentColor",size:u,weight:p="regular",mirrored:h=!1,...g}=l.useContext(a);return l.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=s?s:u,height:null!=s?s:u,fill:null!=n?n:m,viewBox:"0 0 256 256",transform:c||h?"scale(-1, 1)":void 0,...g,...x},!!r&&l.createElement("title",null,r),o,d.get(null!=i?i:p))});n.displayName="IconBase"},64678:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l={callServer:function(){return n.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return s.findSourceMapURL}};for(var a in l)Object.defineProperty(t,a,{enumerable:!0,get:l[a]});let n=r(22673),s=r(43145),i=r(87478)},65668:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var l=r(3680);function a({tabs:e,search:t,cta:r,extra:n,className:s=""}){return(0,l.jsxs)("div",{className:`flex flex-wrap items-center gap-2.5 pt-4 ${s}`,children:[e,(0,l.jsx)("div",{className:"flex-1"}),t,n,r]})}},66736:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var l=r(3680),a=r(32928);function n({value:e,onChange:t,placeholder:r="Search…",minWidth:s=300,className:i=""}){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 ${i}`,style:{minWidth:s},children:[(0,l.jsx)(a.e,{size:13,className:"shrink-0"}),(0,l.jsx)("input",{type:"search",value:e,onChange:e=>t(e.target.value),placeholder:r,className:"flex-1 border-0 bg-transparent text-[13px] leading-none text-ink outline-none placeholder:text-ink-4"})]})}},68769:(e,t,r)=>{Promise.resolve().then(r.bind(r,1442))},77045:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(3680),a=r(63363),n=r.n(a);let s={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 i(e){let{children:t,variant:r="ink",size:a="md",className:i=""}=e,c=`inline-flex items-center justify-center gap-1.5 rounded-md font-medium leading-none border-0 cursor-pointer transition-[filter] ${"md"===a?"h-[34px] px-3.5 text-[13px]":"h-[30px] px-3 text-[12px]"} ${s[r]} ${i}`;if("href"in e&&e.href){let{href:r,variant:a,size:s,className:i,children:o,...d}=e;return(0,l.jsx)(n(),{href:r,className:c,...d,children:t})}let{variant:o,size:d,className:x,children:m,...u}=e;return(0,l.jsx)("button",{type:"button",className:c,...u,children:t})}},81630:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var l=r(3680);let a={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"},n={sm:"h-[30px] w-[30px]",md:"h-[34px] w-[34px]",lg:"h-[38px] w-[38px]",xl:"h-[42px] w-[42px]"},s={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:r="round",background:c,children:o,className:d=""}){let x=c?"":a[e];return(0,l.jsx)("span",{style:c?{background:c}:void 0,className:`inline-flex shrink-0 items-center justify-center ${n[t]} ${s[t]} ${"round"===r?"rounded-full":"rounded-[9px]"} ${x} ${c?"text-white":""} ${d}`,children:o})}},82592:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var l=r(3680);let a={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},n={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 s({variant:e="ok",size:t="sm",animate:r=!0,className:i=""}){return(0,l.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${a[e]} ${r?n[e]:""} ${i}`})}},99203:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var l=r(3680),a=r(22575);let n={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 s({name:e,imageUrl:t,size:r="md",shape:i="round",className:c=""}){let o=n[r],d=`inline-flex shrink-0 items-center justify-center overflow-hidden bg-hover font-mono font-semibold tracking-[0.04em] text-ink-2 ${o.box} ${o.text} ${"round"===i?"rounded-full":"rounded-[8px]"} ${c}`;return t?(0,l.jsx)("span",{className:d,children:(0,l.jsx)(a.default,{src:t,alt:e,width:o.px,height:o.px,className:"h-full w-full object-cover"})}):(0,l.jsx)("span",{className:d,children:function(e){let t=e.trim();if(!t)return"?";let r=t.split(/\s+/);return r.length>=2?((r[0][0]??"")+(r[1][0]??"")).toUpperCase():t.slice(0,2).toUpperCase()}(e)})}}},e=>{e.O(0,[3363,9504,2575,1065,8724,7358],()=>e(e.s=68769)),_N_E=e.O()}]);