nodal-agents 0.4.2 → 0.4.3

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 (131) hide show
  1. package/README.md +6 -10
  2. package/package.json +2 -1
  3. package/runner.js +91 -16
  4. package/web/.next/BUILD_ID +1 -1
  5. package/web/.next/app-path-routes-manifest.json +1 -1
  6. package/web/.next/build-manifest.json +2 -2
  7. package/web/.next/prerender-manifest.json +3 -3
  8. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js +3 -3
  9. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page.js.nft.json +1 -1
  10. package/web/.next/server/app/(dashboard)/agents/[id]/edit/page_client-reference-manifest.js +1 -1
  11. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page.js +1 -1
  12. package/web/.next/server/app/(dashboard)/agents/[id]/telegram/page_client-reference-manifest.js +1 -1
  13. package/web/.next/server/app/(dashboard)/agents/page.js +2 -2
  14. package/web/.next/server/app/(dashboard)/agents/page_client-reference-manifest.js +1 -1
  15. package/web/.next/server/app/(dashboard)/approvals/page.js +2 -2
  16. package/web/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
  17. package/web/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
  18. package/web/.next/server/app/(dashboard)/automations/page.js +2 -2
  19. package/web/.next/server/app/(dashboard)/automations/page_client-reference-manifest.js +1 -1
  20. package/web/.next/server/app/(dashboard)/billing/page.js +1 -1
  21. package/web/.next/server/app/(dashboard)/billing/page_client-reference-manifest.js +1 -1
  22. package/web/.next/server/app/(dashboard)/chat/page.js +1 -1
  23. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  24. package/web/.next/server/app/(dashboard)/connectors/page.js +1 -1
  25. package/web/.next/server/app/(dashboard)/connectors/page.js.nft.json +1 -1
  26. package/web/.next/server/app/(dashboard)/connectors/page_client-reference-manifest.js +1 -1
  27. package/web/.next/server/app/(dashboard)/credentials/page.js +1 -1
  28. package/web/.next/server/app/(dashboard)/credentials/page.js.nft.json +1 -1
  29. package/web/.next/server/app/(dashboard)/credentials/page_client-reference-manifest.js +1 -1
  30. package/web/.next/server/app/(dashboard)/jobs/[id]/page.js +2 -2
  31. package/web/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
  32. package/web/.next/server/app/(dashboard)/jobs/page.js +2 -2
  33. package/web/.next/server/app/(dashboard)/jobs/page.js.nft.json +1 -1
  34. package/web/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
  35. package/web/.next/server/app/(dashboard)/llm-providers/page.js +2 -2
  36. package/web/.next/server/app/(dashboard)/llm-providers/page_client-reference-manifest.js +1 -1
  37. package/web/.next/server/app/(dashboard)/logs/page.js +1 -1
  38. package/web/.next/server/app/(dashboard)/logs/page_client-reference-manifest.js +1 -1
  39. package/web/.next/server/app/(dashboard)/mcp/page.js +1 -1
  40. package/web/.next/server/app/(dashboard)/mcp/page_client-reference-manifest.js +1 -1
  41. package/web/.next/server/app/(dashboard)/memories/page.js +2 -2
  42. package/web/.next/server/app/(dashboard)/memories/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/page.js +3 -3
  44. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  45. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  46. package/web/.next/server/app/(dashboard)/settings/page.js +2 -2
  47. package/web/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  48. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js +1 -1
  49. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page.js.nft.json +1 -1
  50. package/web/.next/server/app/(dashboard)/skills/[id]/edit/page_client-reference-manifest.js +1 -1
  51. package/web/.next/server/app/(dashboard)/skills/new/page.js +2 -2
  52. package/web/.next/server/app/(dashboard)/skills/new/page.js.nft.json +1 -1
  53. package/web/.next/server/app/(dashboard)/skills/new/page_client-reference-manifest.js +1 -1
  54. package/web/.next/server/app/(dashboard)/skills/page.js +1 -1
  55. package/web/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
  56. package/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  57. package/web/.next/server/app/_global-error.html +1 -1
  58. package/web/.next/server/app/_global-error.rsc +2 -2
  59. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +2 -2
  60. package/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  61. package/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  62. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  63. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +2 -2
  64. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  65. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  66. package/web/.next/server/app/_not-found.html +1 -1
  67. package/web/.next/server/app/_not-found.rsc +2 -2
  68. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  69. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  70. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  71. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  72. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  73. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  74. package/web/.next/server/app/api/oauth/[provider]/callback/route.js +1 -1
  75. package/web/.next/server/app/login/page_client-reference-manifest.js +1 -1
  76. package/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  77. package/web/.next/server/app/onboarding.html +1 -1
  78. package/web/.next/server/app/onboarding.rsc +2 -2
  79. package/web/.next/server/app/onboarding.segments/_full.segment.rsc +2 -2
  80. package/web/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  81. package/web/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
  82. package/web/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  83. package/web/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
  84. package/web/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  85. package/web/.next/server/app-paths-manifest.json +1 -1
  86. package/web/.next/server/chunks/3233.js +1 -1
  87. package/web/.next/server/chunks/7741.js +1 -1
  88. package/web/.next/server/chunks/8052.js +1 -0
  89. package/web/.next/server/chunks/8766.js +1 -0
  90. package/web/.next/server/chunks/{4839.js → 8782.js} +1 -1
  91. package/web/.next/server/chunks/{1945.js → 9084.js} +1 -1
  92. package/web/.next/server/middleware-build-manifest.js +1 -1
  93. package/web/.next/server/pages/404.html +1 -1
  94. package/web/.next/server/pages/500.html +1 -1
  95. package/web/.next/server/server-reference-manifest.js +1 -1
  96. package/web/.next/server/server-reference-manifest.json +1 -1
  97. package/web/.next/static/chunks/{9123-20653d928e33410a.js → 9123-5c5ad180c831baa4.js} +1 -1
  98. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/edit/page-de6c8fc7cb73a3de.js +2 -0
  99. package/web/.next/static/chunks/app/(dashboard)/agents/[id]/telegram/page-6d4161f1e0b19885.js +1 -0
  100. package/web/.next/static/chunks/app/(dashboard)/agents/{page-b258b8975ac6450b.js → page-50005050a3304bee.js} +1 -1
  101. package/web/.next/static/chunks/app/(dashboard)/approvals/{page-79dea6e91956eeba.js → page-7f4314908d1024f6.js} +1 -1
  102. package/web/.next/static/chunks/app/(dashboard)/automations/page-7693601b49363371.js +1 -0
  103. package/web/.next/static/chunks/app/(dashboard)/chat/page-839128f211f63728.js +1 -0
  104. package/web/.next/static/chunks/app/(dashboard)/connectors/{page-4a437ba82f4086da.js → page-a6a1d8f0a33d2faf.js} +1 -1
  105. package/web/.next/static/chunks/app/(dashboard)/jobs/[id]/page-4fc570c6c1e39edb.js +1 -0
  106. package/web/.next/static/chunks/app/(dashboard)/jobs/{page-94a311f688a255d8.js → page-cf861b235dc54ced.js} +1 -1
  107. package/web/.next/static/chunks/app/(dashboard)/{layout-e1b0d4fad2926646.js → layout-769de8a52528194a.js} +1 -1
  108. package/web/.next/static/chunks/app/(dashboard)/llm-providers/page-99eab754716f9071.js +1 -0
  109. package/web/.next/static/chunks/app/(dashboard)/mcp/{page-c071c54f76273ac4.js → page-082442b4f9ac0f91.js} +1 -1
  110. package/web/.next/static/chunks/app/(dashboard)/memories/page-e201633b4bbbdf73.js +1 -0
  111. package/web/.next/static/chunks/app/(dashboard)/page-a42d880f7036e866.js +1 -0
  112. package/web/.next/static/chunks/app/(dashboard)/settings/page-d85cac3728506241.js +1 -0
  113. package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-ecaf3520da303237.js +1 -0
  114. package/web/.next/static/chunks/app/(dashboard)/skills/new/page-cdbc2aada2be0bfc.js +1 -0
  115. package/web/.next/static/chunks/app/(dashboard)/skills/page-234553540bef945b.js +1 -0
  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)/automations/page-3b863b7af8e2c1a3.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)/llm-providers/page-e5e2c4e2b783d37f.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)/page-fb50e1576a3ab2e4.js +0 -1
  126. package/web/.next/static/chunks/app/(dashboard)/settings/page-7b256e9c462e97f8.js +0 -1
  127. package/web/.next/static/chunks/app/(dashboard)/skills/[id]/edit/page-12930816795e8b20.js +0 -1
  128. package/web/.next/static/chunks/app/(dashboard)/skills/new/page-e3a19abaf7468db9.js +0 -1
  129. package/web/.next/static/chunks/app/(dashboard)/skills/page-43f1475a0bc9c45f.js +0 -1
  130. /package/web/.next/static/{ZuUX-HBTQOhLf0tFI6JQI → n6jP_zB4kqJScKY_T2ciu}/_buildManifest.js +0 -0
  131. /package/web/.next/static/{ZuUX-HBTQOhLf0tFI6JQI → n6jP_zB4kqJScKY_T2ciu}/_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([[7665],{14308:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(3680),s=n(78604),a=n(51869);function i({open:e,title:t,message:n,confirmLabel:l="Confirm",cancelLabel:o="Cancel",destructive:d=!0,onConfirm:c,onCancel:u}){let m=(0,s.useRef)(null),[x,h]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{h(!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&&x)?(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:o}),(0,r.jsx)("button",{type:"button",onClick:c,className:`px-4 py-2 text-sm font-semibold rounded-lg transition-colors ${d?"bg-err hover:brightness-[0.94] text-ink":"bg-ink hover:brightness-[0.92] text-canvas"}`,children:l})]})]})]}),document.body):null}},21369:(e,t,n)=>{"use strict";n.d(t,{E$:()=>s,Ff:()=>o,X3:()=>d,_6:()=>i});var r=n(74178);function s(e,t=new Date){if(!e||"string"!=typeof e)return{ok:!1,error:"Empty expression"};try{let n=r.CronExpressionParser.parse(e.trim(),{currentDate:t}),s=[];for(let e=0;e<3;e++)s.push(n.next().toDate());return{ok:!0,nextRuns:s,humanLabel:i(e)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"Invalid cron expression"}}}let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function i(e){let t=e.trim().split(/\s+/);if(5!==t.length)return e;let[n,r,s,i,o]=t;if("*"===n&&"*"===r&&"*"===s&&"*"===i&&"*"===o)return"Every minute";let d=n?.match(/^\*\/(\d+)$/);if(d&&"*"===r&&"*"===s&&"*"===i&&"*"===o)return`Every ${d[1]} minutes`;if("*"===r&&"*"===s&&"*"===i&&"*"===o&&/^\d+$/.test(n??""))return"0"===n?"Every hour (top of hour)":`Every hour at :${(n??"").padStart(2,"0")}`;if("*"===s&&"*"===i&&"*"===o&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??""))return`Every day at ${l(r)}:${l(n)}`;if("*"===s&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")){let e=function(e){if("*"===e)return"day";if("1-5"===e)return"weekday";if("0,6"===e||"6,0"===e)return"weekend";if(/^\d$/.test(e)){let t=parseInt(e,10);if(t>=0&&t<=6)return a[t]??null}return/^[0-6](,[0-6])+$/.test(e)?e.split(",").map(e=>a[parseInt(e,10)]).filter(Boolean).join(", "):null}(o??"");if(e)return`Every ${e} at ${l(r)}:${l(n)}`}return"*"===i&&"*"===o&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")&&/^\d+$/.test(s??"")?`Day ${s} of every month at ${l(r)}:${l(n)}`:e}function l(e){return(e??"").padStart(2,"0")}function o(e){let t=function(e){if(!e)return{hour:9,minute:0};let t=e.match(/^(\d{1,2}):(\d{2})$/);return t?{hour:Math.max(0,Math.min(23,parseInt(t[1]??"0",10))),minute:Math.max(0,Math.min(59,parseInt(t[2]??"0",10)))}:{hour:9,minute:0}}(e.time);switch(e.mode){case"minutes":{let t=e.everyMinutes&&e.everyMinutes>0?e.everyMinutes:5;return`*/${t} * * * *`}case"hourly":return`${t.minute} * * * *`;case"daily":return`${t.minute} ${t.hour} * * *`;case"weekly":{let n=e.weekdays&&e.weekdays.length>0?e.weekdays.slice().sort().join(","):"1";return`${t.minute} ${t.hour} * * ${n}`}case"monthly":{let n=e.dayOfMonth&&e.dayOfMonth>0?e.dayOfMonth:1;return`${t.minute} ${t.hour} ${n} * *`}case"custom":return(e.custom??"").trim()}}function d(e){let t=e.trim().split(/\s+/);if(5!==t.length)return{mode:"custom",values:{mode:"custom",custom:e}};let[n,r,s,a,i]=t,o=n?.match(/^\*\/(\d+)$/);if(o&&"*"===r&&"*"===s&&"*"===a&&"*"===i)return{mode:"minutes",values:{mode:"minutes",everyMinutes:parseInt(o[1]??"5",10)}};if("*"===r&&"*"===s&&"*"===a&&"*"===i&&/^\d+$/.test(n??""))return{mode:"hourly",values:{mode:"hourly",time:`00:${l(n)}`}};if("*"===s&&"*"===a&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??""))return{mode:"daily",values:{mode:"daily",time:`${l(r)}:${l(n)}`}};if("*"===s&&"*"===a&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")){let e=function(e){if("*"===e)return[0,1,2,3,4,5,6];if("1-5"===e)return[1,2,3,4,5];if("0,6"===e||"6,0"===e)return[0,6];if(/^\d$/.test(e)){let t=parseInt(e,10);if(t>=0&&t<=6)return[t]}return/^[0-6](,[0-6])+$/.test(e)?e.split(",").map(e=>parseInt(e,10)):null}(i??"");if(e)return{mode:"weekly",values:{mode:"weekly",time:`${l(r)}:${l(n)}`,weekdays:e}}}return"*"===a&&"*"===i&&/^\d+$/.test(n??"")&&/^\d+$/.test(r??"")&&/^\d+$/.test(s??"")?{mode:"monthly",values:{mode:"monthly",time:`${l(r)}:${l(n)}`,dayOfMonth:parseInt(s??"1",10)}}:{mode:"custom",values:{mode:"custom",custom:e}}}},30922:(e,t,n)=>{Promise.resolve().then(n.bind(n,73980)),Promise.resolve().then(n.bind(n,32786))},32786:(e,t,n)=>{"use strict";n.d(t,{default:()=>h});var r=n(3680),s=n(78604),a=n(39504),i=n(64678);let l=(0,i.createServerReference)("400ca4c91c055218dcdc663b53bc21d219783e16f2",i.callServer,void 0,i.findSourceMapURL,"toggleScheduleAction"),o=(0,i.createServerReference)("4069f5841b60ff6b623370147903caf7970d85fc29",i.callServer,void 0,i.findSourceMapURL,"deleteScheduleAction"),d=(0,i.createServerReference)("404912c6c805f1cee60f4f4fc38f2528b768406fb6",i.callServer,void 0,i.findSourceMapURL,"runScheduleNowAction");var c=n(14308),u=n(73980),m=n(21369),x=n(93606);function h({schedule:e,agents:t}){let[n,i]=(0,s.useTransition)(),[b,p]=(0,s.useState)(!1),[f,v]=(0,s.useState)(!1);return f?(0,r.jsx)("div",{className:"space-y-2",children:(0,r.jsx)(u.default,{mode:"edit",agents:t,initial:e,onDone:()=>v(!1)})}):(0,r.jsxs)("div",{className:"space-y-3 rounded-xl border border-rule-2 bg-paper p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-ink",children:e.name}),(0,r.jsx)(x.A,{variant:e.active?"done":"idle",label:e.active?"Active":"Paused"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-ink-3",children:[(0,r.jsx)("span",{children:(0,m._6)(e.cronExpr)}),e.agentName&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-rule",children:"\xb7"}),(0,r.jsxs)("span",{children:[e.agentName," ",(0,r.jsx)("span",{className:"font-mono text-ink-4",children:e.agentSlug})]})]}),e.notifyOnSuccess&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-rule",children:"\xb7"}),(0,r.jsx)("span",{title:"Sends you a Telegram confirmation when it succeeds",children:"\uD83D\uDD14 Notifies"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-[10px] text-ink-4",children:[e.nextRun&&e.active&&(0,r.jsxs)("span",{children:["Next run ",new Date(e.nextRun).toLocaleString()]}),e.lastRun&&(0,r.jsxs)("span",{children:["Last run ",new Date(e.lastRun).toLocaleString(),e.lastStatus&&(0,r.jsxs)("span",{className:`ml-1 ${"success"===e.lastStatus?"text-ok":"failed"===e.lastStatus?"text-err":"text-ink-4"}`,children:["(",e.lastStatus,")"]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button",onClick:function(){i(async()=>{let t=await d(e.id);t.ok?a.oR.success(`Running "${e.name}" now`):a.oR.error(t.message)})},disabled:n||!e.task,title:e.task?"Run this automation now, outside its schedule":"No task to run",className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:"▶ Run now"}),(0,r.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:n,className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:"Edit"}),(0,r.jsx)("button",{type:"button",onClick:function(){i(async()=>{let t=await l(e.id);t.ok?a.oR.success(t.data.active?"Schedule enabled":"Schedule disabled"):a.oR.error(t.message)})},disabled:n,className:"rounded-md border border-rule-2 px-2.5 py-1 text-xs font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink disabled:opacity-40",children:e.active?"Pause":"Enable"}),(0,r.jsx)("button",{type:"button",onClick:()=>p(!0),disabled:n,className:"rounded-md border border-err/30 px-2.5 py-1 text-xs font-medium text-err transition-colors hover:border-err/60 disabled:opacity-40",children:"Delete"})]})]}),e.task&&(0,r.jsxs)("details",{className:"rounded-md border border-rule bg-canvas",children:[(0,r.jsx)("summary",{className:"cursor-pointer px-3 py-2 text-xs text-ink-3 hover:text-ink-2",children:"Task instructions"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap px-3 pb-3 text-xs text-ink-2",children:e.task})]}),(0,r.jsx)(c.A,{open:b,title:"Delete schedule?",message:"This cron schedule will be removed. Past runs are kept for audit.",confirmLabel:"Delete",onConfirm:function(){p(!1),i(async()=>{let t=await o(e.id);t.ok?a.oR.success("Schedule deleted"):a.oR.error(t.message)})},onCancel:()=>p(!1)})]})}},73980:(e,t,n)=>{"use strict";n.d(t,{default:()=>h});var r=n(3680),s=n(78604),a=n(39504),i=n(64678);let l=(0,i.createServerReference)("405441c5447e7f0cc99b8c935b54e903aa38a592ca",i.callServer,void 0,i.findSourceMapURL,"updateScheduleAction"),o=(0,i.createServerReference)("404ae92a4884f24a9d0d96b484c9a0eb05289bdc1c",i.callServer,void 0,i.findSourceMapURL,"createScheduleAction");var d=n(21369);let c=[{n:1,label:"Mon"},{n:2,label:"Tue"},{n:3,label:"Wed"},{n:4,label:"Thu"},{n:5,label:"Fri"},{n:6,label:"Sat"},{n:0,label:"Sun"}],u=[1,5,10,15,30];function m({name:e="cronExpr",initial:t}){let n=(0,s.useMemo)(()=>t?(0,d.X3)(t):{mode:"daily",values:{mode:"daily",time:"09:00"}},[t]),[a,i]=(0,s.useState)(n.mode),[l,o]=(0,s.useState)(n.values.everyMinutes??5),[h,b]=(0,s.useState)(n.values.time??"09:00"),[p,f]=(0,s.useState)(n.values.weekdays??[1,2,3,4,5]),[v,k]=(0,s.useState)(n.values.dayOfMonth??1),[g,y]=(0,s.useState)(n.values.custom??t??"0 9 * * *"),j=(0,s.useMemo)(()=>(0,d.Ff)({mode:a,everyMinutes:l,time:h,weekdays:p,dayOfMonth:v,custom:g}),[a,l,h,p,v,g]),N=(0,s.useMemo)(()=>(0,d.E$)(j),[j]);return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("input",{type:"hidden",name:e,value:j}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-mode",className:"block text-xs text-ink-3 mb-1",children:"Frequency"}),(0,r.jsxs)("select",{id:"cron-mode",value:a,onChange:e=>i(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,r.jsx)("option",{value:"minutes",children:"Every N minutes"}),(0,r.jsx)("option",{value:"hourly",children:"Hourly"}),(0,r.jsx)("option",{value:"daily",children:"Daily"}),(0,r.jsx)("option",{value:"weekly",children:"Weekly"}),(0,r.jsx)("option",{value:"monthly",children:"Monthly"}),(0,r.jsx)("option",{value:"custom",children:"Custom (cron)"})]})]}),"minutes"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-every",className:"block text-xs text-ink-3 mb-1",children:"Every"}),(0,r.jsx)("select",{id:"cron-every",value:l,onChange:e=>o(parseInt(e.target.value,10)),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:u.map(e=>(0,r.jsxs)("option",{value:e,children:[e," ",1===e?"minute":"minutes"]},e))})]}),"hourly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-min-of-hour",className:"block text-xs text-ink-3 mb-1",children:"At minute"}),(0,r.jsx)("input",{id:"cron-min-of-hour",type:"number",min:0,max:59,value:parseInt(h.split(":")[1]??"0",10),onChange:e=>{let t=Math.max(0,Math.min(59,parseInt(e.target.value||"0",10)));b(`00:${String(t).padStart(2,"0")}`)},className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]}),("daily"===a||"weekly"===a||"monthly"===a)&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-time",className:"block text-xs text-ink-3 mb-1",children:"Time"}),(0,r.jsx)("input",{id:"cron-time",type:"time",value:h,onChange:e=>b(e.target.value),className:"w-full bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]})]}),"weekly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs text-ink-3 mb-1",children:"Days"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map(e=>{let t=p.includes(e.n);return(0,r.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.n,void f(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t].sort())},className:`px-2.5 py-1 text-xs font-medium rounded border ${t?"bg-run-bg border-run/30 text-run":"border-rule-2 text-ink-3 hover:border-rule hover:text-ink"}`,children:e.label},e.n)})})]}),"monthly"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-dom",className:"block text-xs text-ink-3 mb-1",children:"Day of month"}),(0,r.jsx)("input",{id:"cron-dom",type:"number",min:1,max:31,value:v,onChange:e=>k(Math.max(1,Math.min(31,parseInt(e.target.value||"1",10)))),className:"w-32 bg-hover border border-rule rounded-md px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none"})]}),"custom"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"cron-custom",className:"block text-xs text-ink-3 mb-1",children:"Cron expression"}),(0,r.jsx)("input",{id:"cron-custom",type:"text",value:g,onChange:e=>y(e.target.value),placeholder:"0 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,r.jsx)("p",{className:"text-[10px] text-ink-4 mt-1",children:"Format: minute hour day-of-month month day-of-week"})]}),(0,r.jsx)(x,{expr:j,preview:N})]})}function x({expr:e,preview:t}){return t.ok?(0,r.jsxs)("div",{className:"bg-canvas border border-rule-2 rounded-md px-3 py-2 space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"text-ink-3",children:"Schedule:"}),(0,r.jsx)("span",{className:"text-ink",children:t.humanLabel}),(0,r.jsx)("code",{className:"ml-auto font-mono text-[10px] text-run",children:e})]}),(0,r.jsxs)("div",{className:"text-[10px] text-ink-4",suppressHydrationWarning:!0,children:["Next runs: ",t.nextRuns.map(e=>e.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})).join(" \xb7 ")]})]}):(0,r.jsxs)("div",{className:"bg-warn-bg border border-err/30 rounded-md px-3 py-2 text-xs text-err",children:[(0,r.jsx)("span",{className:"font-semibold",children:"Invalid:"})," ",t.error]})}function h(e){let t="edit"===e.mode,[n,i]=(0,s.useState)(t),[d,c]=(0,s.useTransition)(),[u,x]=(0,s.useState)(t?e.initial.agentId:""),[h,b]=(0,s.useState)(!!t&&!0===e.initial.notifyOnSuccess);if(!t&&!n)return(0,r.jsx)("button",{type:"button",onClick:()=>i(!0),disabled:0===e.agents.length,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border-0 bg-ink px-3.5 text-[13px] font-medium leading-none text-canvas transition-[filter] hover:brightness-[0.92] disabled:cursor-not-allowed disabled:opacity-40",title:0===e.agents.length?"Create an agent first":"",children:"+ New schedule"});let p=t?e.initial.name:"",f=t?e.initial.task??"":"",v=t?e.initial.cronExpr:"0 9 * * *",k=e.agents.find(e=>e.id===u),g=h&&null!=k&&!k.telegramBotToken;return(0,r.jsxs)("form",{onSubmit:function(n){n.preventDefault();let r=n.currentTarget,s=new FormData(r);c(async()=>{if(t){let t=await l({id:e.initial.id,agentId:u,name:s.get("name"),cronExpr:s.get("cronExpr"),task:s.get("task"),notifyOnSuccess:h});t.ok?(a.oR.success("Schedule updated"),e.onDone?.()):a.oR.error(t.message)}else{let t=await o({agentId:u,name:s.get("name"),cronExpr:s.get("cronExpr"),task:s.get("task"),notifyOnSuccess:h});t.ok?(a.oR.success("Schedule created"),r.reset(),x(""),b(!1),i(!1),e.onDone?.()):a.oR.error(t.message)}})},className:"space-y-3 rounded-xl border border-rule-2 bg-paper p-5",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-ink",children:t?"Edit schedule":"New schedule"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-agent",children:"Agent"}),(0,r.jsxs)("select",{id:"schedule-agent",name:"agentId",required:!0,value:u,onChange:e=>x(e.target.value),className:"w-full rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink focus:border-ink-3 focus:outline-none",children:[(0,r.jsx)("option",{value:"",children:"Select…"}),e.agents.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-name",children:"Name"}),(0,r.jsx)("input",{id:"schedule-name",name:"name",required:!0,defaultValue:p,placeholder:"Daily standup",className:"w-full rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]})]}),(0,r.jsx)(m,{name:"cronExpr",initial:v}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs text-ink-3",htmlFor:"schedule-task",children:"Task instructions"}),(0,r.jsx)("textarea",{id:"schedule-task",name:"task",required:!0,rows:4,defaultValue:f,placeholder:"What should the agent do each time this fires?",className:"w-full resize-y rounded-md border border-rule bg-canvas px-2 py-1.5 text-sm text-ink placeholder-ink-4 focus:border-ink-3 focus:outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"flex items-start gap-2.5 rounded-md border border-rule bg-canvas px-3 py-2.5 text-sm",children:[(0,r.jsx)("input",{type:"checkbox",name:"notifyOnSuccess",checked:h,onChange:e=>b(e.target.checked),className:"mt-0.5 h-4 w-4 shrink-0 accent-ink"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"font-medium text-ink",children:"Notify me on Telegram when it succeeds"}),(0,r.jsx)("span",{className:"mt-0.5 block text-xs text-ink-3",children:"The agent sends you a short confirmation each time this automation finishes. Requires a Telegram bot on the agent (DM it once so it knows where to reach you)."})]})]}),g&&(0,r.jsxs)("p",{className:"rounded-md border border-warn/30 bg-warn-bg px-3 py-2 text-xs text-warn",children:["⚠️ ",(0,r.jsx)("span",{className:"font-medium",children:k?.name})," has no Telegram bot, so it can't send you this confirmation. Schedule this automation on a Telegram-connected agent, or connect a bot to this one."]})]}),(0,r.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,r.jsx)("button",{type:"submit",disabled:d,className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border-0 bg-ink px-3.5 text-[13px] font-medium leading-none text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-50",children:d?t?"Saving…":"Creating…":t?"Save changes":"Create schedule"}),(0,r.jsx)("button",{type:"button",onClick:()=>{t?e.onDone?.():i(!1)},className:"inline-flex h-[34px] items-center rounded-md border border-rule-2 px-3.5 text-[13px] font-medium text-ink-3 transition-colors hover:border-rule hover:text-ink",children:"Cancel"})]})]})}},81444:()=>{},82592:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(3680);let s={ok:"bg-ok",lime:"bg-agent-vivid",coral:"bg-skill-vivid",blue:"bg-conn-vivid"},a={ok:"animate-[blip_1.4s_ease-out_infinite]",lime:"animate-[blip-lime_1.5s_ease-out_infinite]",coral:"animate-[blip-coral_1.4s_ease-out_infinite]",blue:"animate-[blip-blue_1.4s_ease-out_infinite]"};function i({variant:e="ok",size:t="sm",animate:n=!0,className:l=""}){return(0,r.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${s[e]} ${n?a[e]:""} ${l}`})}},93606:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var r=n(3680),s=n(86127),a=n(22089),i=n(82592);let l={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 u=t??l[e],m=null;return void 0!==n?m=n:"done"===e?m=(0,r.jsx)(s.r,{size:11,weight:"regular"}):"warn"===e?m=(0,r.jsx)(a.N,{size:11,weight:"regular"}):"run"===e&&(m=(0,r.jsx)(i.A,{variant:"blue",size:"sm"})),(0,r.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]})}},96333:()=>{}},e=>{e.O(0,[4641,9504,9167,1065,8724,7358],()=>e(e.s=30922)),_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([[173],{14308:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var r=a(3680),n=a(78604),l=a(51869);function i({open:e,title:t,message:a,confirmLabel:s="Confirm",cancelLabel:o="Cancel",destructive:c=!0,onConfirm:d,onCancel:m}){let u=(0,n.useRef)(null),[p,x]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{x(!0)},[]),(0,n.useEffect)(()=>{if(e)return u.current?.focus(),window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&m()}},[e,m]),e&&p)?(0,l.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:m,"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:u,type:"button",onClick:m,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:s})]})]})]}),document.body):null}},27540:(e,t,a)=>{"use strict";var r=a(71268);a.o(r,"usePathname")&&a.d(t,{usePathname:function(){return r.usePathname}}),a.o(r,"useRouter")&&a.d(t,{useRouter:function(){return r.useRouter}}),a.o(r,"useSearchParams")&&a.d(t,{useSearchParams:function(){return r.useSearchParams}})},40189:(e,t,a)=>{"use strict";a.d(t,{F:()=>s});var r=a(78604),n=a(53087);let l=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",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:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",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,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),i=r.forwardRef((e,t)=>r.createElement(n.A,{ref:t,...e,weights:l}));i.displayName="PlusIcon";let s=i},53087:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var r=a(78604);let n=(0,r.createContext)({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),l=r.forwardRef((e,t)=>{let{alt:a,color:l,size:i,weight:s,mirrored:o,children:c,weights:d,...m}=e,{color:u="currentColor",size:p,weight:x="regular",mirrored:f=!1,...h}=r.useContext(n);return r.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:null!=i?i:p,height:null!=i?i:p,fill:null!=l?l:u,viewBox:"0 0 256 256",transform:o||f?"scale(-1, 1)":void 0,...h,...m},!!a&&r.createElement("title",null,a),c,d.get(null!=s?s:x))});l.displayName="IconBase"},63217:(e,t,a)=>{"use strict";function r(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}}a.d(t,{R:()=>r})},64678:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return l.callServer},createServerReference:function(){return s.createServerReference},findSourceMapURL:function(){return i.findSourceMapURL}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let l=a(22673),i=a(43145),s=a(87478)},70397:(e,t,a)=>{Promise.resolve().then(a.bind(a,80492))},76613:(e,t,a)=>{"use strict";a.d(t,{_:()=>s});var r=a(78604),n=a(53087);let l=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,76a52,52,0,1,0,52,52A52.06,52.06,0,0,0,128,76Zm0,80a28,28,0,1,1,28-28A28,28,0,0,1,128,156Zm113.86-49.57A12,12,0,0,0,236,98.34L208.21,82.49l-.11-31.31a12,12,0,0,0-4.25-9.12,116,116,0,0,0-38-21.41,12,12,0,0,0-9.68.89L128,37.27,99.83,21.53a12,12,0,0,0-9.7-.9,116.06,116.06,0,0,0-38,21.47,12,12,0,0,0-4.24,9.1l-.14,31.34L20,98.35a12,12,0,0,0-5.85,8.11,110.7,110.7,0,0,0,0,43.11A12,12,0,0,0,20,157.66l27.82,15.85.11,31.31a12,12,0,0,0,4.25,9.12,116,116,0,0,0,38,21.41,12,12,0,0,0,9.68-.89L128,218.73l28.14,15.74a12,12,0,0,0,9.7.9,116.06,116.06,0,0,0,38-21.47,12,12,0,0,0,4.24-9.1l.14-31.34,27.81-15.81a12,12,0,0,0,5.85-8.11A110.7,110.7,0,0,0,241.86,106.43Zm-22.63,33.18-26.88,15.28a11.94,11.94,0,0,0-4.55,4.59c-.54,1-1.11,1.93-1.7,2.88a12,12,0,0,0-1.83,6.31L184.13,199a91.83,91.83,0,0,1-21.07,11.87l-27.15-15.19a12,12,0,0,0-5.86-1.53h-.29c-1.14,0-2.3,0-3.44,0a12.08,12.08,0,0,0-6.14,1.51L93,210.82A92.27,92.27,0,0,1,71.88,199l-.11-30.24a12,12,0,0,0-1.83-6.32c-.58-.94-1.16-1.91-1.7-2.88A11.92,11.92,0,0,0,63.7,155L36.8,139.63a86.53,86.53,0,0,1,0-23.24l26.88-15.28a12,12,0,0,0,4.55-4.58c.54-1,1.11-1.94,1.7-2.89a12,12,0,0,0,1.83-6.31L71.87,57A91.83,91.83,0,0,1,92.94,45.17l27.15,15.19a11.92,11.92,0,0,0,6.15,1.52c1.14,0,2.3,0,3.44,0a12.08,12.08,0,0,0,6.14-1.51L163,45.18A92.27,92.27,0,0,1,184.12,57l.11,30.24a12,12,0,0,0,1.83,6.32c.58.94,1.16,1.91,1.7,2.88A11.92,11.92,0,0,0,192.3,101l26.9,15.33A86.53,86.53,0,0,1,219.23,139.61Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M230.1,108.76,198.25,90.62c-.64-1.16-1.31-2.29-2-3.41l-.12-36A104.61,104.61,0,0,0,162,32L130,49.89c-1.34,0-2.69,0-4,0L94,32A104.58,104.58,0,0,0,59.89,51.25l-.16,36c-.7,1.12-1.37,2.26-2,3.41l-31.84,18.1a99.15,99.15,0,0,0,0,38.46l31.85,18.14c.64,1.16,1.31,2.29,2,3.41l.12,36A104.61,104.61,0,0,0,94,224l32-17.87c1.34,0,2.69,0,4,0L162,224a104.58,104.58,0,0,0,34.08-19.25l.16-36c.7-1.12,1.37-2.26,2-3.41l31.84-18.1A99.15,99.15,0,0,0,230.1,108.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z",opacity:"0.2"}),r.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm109.94-52.79a8,8,0,0,0-3.89-5.4l-29.83-17-.12-33.62a8,8,0,0,0-2.83-6.08,111.91,111.91,0,0,0-36.72-20.67,8,8,0,0,0-6.46.59L128,41.85,97.88,25a8,8,0,0,0-6.47-.6A111.92,111.92,0,0,0,54.73,45.15a8,8,0,0,0-2.83,6.07l-.15,33.65-29.83,17a8,8,0,0,0-3.89,5.4,106.47,106.47,0,0,0,0,41.56,8,8,0,0,0,3.89,5.4l29.83,17,.12,33.63a8,8,0,0,0,2.83,6.08,111.91,111.91,0,0,0,36.72,20.67,8,8,0,0,0,6.46-.59L128,214.15,158.12,231a7.91,7.91,0,0,0,3.9,1,8.09,8.09,0,0,0,2.57-.42,112.1,112.1,0,0,0,36.68-20.73,8,8,0,0,0,2.83-6.07l.15-33.65,29.83-17a8,8,0,0,0,3.89-5.4A106.47,106.47,0,0,0,237.94,107.21Zm-15,34.91-28.57,16.25a8,8,0,0,0-3,3c-.58,1-1.19,2.06-1.81,3.06a7.94,7.94,0,0,0-1.22,4.21l-.15,32.25a95.89,95.89,0,0,1-25.37,14.3L134,199.13a8,8,0,0,0-3.91-1h-.19c-1.21,0-2.43,0-3.64,0a8.1,8.1,0,0,0-4.1,1l-28.84,16.1A96,96,0,0,1,67.88,201l-.11-32.2a8,8,0,0,0-1.22-4.22c-.62-1-1.23-2-1.8-3.06a8.09,8.09,0,0,0-3-3.06l-28.6-16.29a90.49,90.49,0,0,1,0-28.26L61.67,97.63a8,8,0,0,0,3-3c.58-1,1.19-2.06,1.81-3.06a7.94,7.94,0,0,0,1.22-4.21l.15-32.25a95.89,95.89,0,0,1,25.37-14.3L122,56.87a8,8,0,0,0,4.1,1c1.21,0,2.43,0,3.64,0a8,8,0,0,0,4.1-1l28.84-16.1A96,96,0,0,1,188.12,55l.11,32.2a8,8,0,0,0,1.22,4.22c.62,1,1.23,2,1.8,3.06a8.09,8.09,0,0,0,3,3.06l28.6,16.29A90.49,90.49,0,0,1,222.9,142.12Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M237.94,107.21a8,8,0,0,0-3.89-5.4l-29.83-17-.12-33.62a8,8,0,0,0-2.83-6.08,111.91,111.91,0,0,0-36.72-20.67,8,8,0,0,0-6.46.59L128,41.85,97.88,25a8,8,0,0,0-6.47-.6A111.92,111.92,0,0,0,54.73,45.15a8,8,0,0,0-2.83,6.07l-.15,33.65-29.83,17a8,8,0,0,0-3.89,5.4,106.47,106.47,0,0,0,0,41.56,8,8,0,0,0,3.89,5.4l29.83,17,.12,33.63a8,8,0,0,0,2.83,6.08,111.91,111.91,0,0,0,36.72,20.67,8,8,0,0,0,6.46-.59L128,214.15,158.12,231a7.91,7.91,0,0,0,3.9,1,8.09,8.09,0,0,0,2.57-.42,112.1,112.1,0,0,0,36.68-20.73,8,8,0,0,0,2.83-6.07l.15-33.65,29.83-17a8,8,0,0,0,3.89-5.4A106.47,106.47,0,0,0,237.94,107.21ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,82a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Zm108-54.4a6,6,0,0,0-2.92-4L202.64,86.22l-.42-.71L202.1,51.2A6,6,0,0,0,200,46.64a110.12,110.12,0,0,0-36.07-20.31,6,6,0,0,0-4.84.45L128.46,43.86h-1L96.91,26.76a6,6,0,0,0-4.86-.44A109.92,109.92,0,0,0,56,46.68a6,6,0,0,0-2.12,4.55l-.16,34.34c-.14.23-.28.47-.41.71L22.91,103.57A6,6,0,0,0,20,107.62a104.81,104.81,0,0,0,0,40.78,6,6,0,0,0,2.92,4l30.42,17.33.42.71.12,34.31A6,6,0,0,0,56,209.36a110.12,110.12,0,0,0,36.07,20.31,6,6,0,0,0,4.84-.45l30.61-17.08h1l30.56,17.1A6.09,6.09,0,0,0,162,230a5.83,5.83,0,0,0,1.93-.32,109.92,109.92,0,0,0,36-20.36,6,6,0,0,0,2.12-4.55l.16-34.34c.14-.23.28-.47.41-.71l30.42-17.29a6,6,0,0,0,2.92-4.05A104.81,104.81,0,0,0,236,107.6Zm-11.25,35.79L195.32,160.1a6.07,6.07,0,0,0-2.28,2.3c-.59,1-1.21,2.11-1.86,3.14a6,6,0,0,0-.91,3.16l-.16,33.21a98.15,98.15,0,0,1-27.52,15.53L133,200.88a6,6,0,0,0-2.93-.77h-.14c-1.24,0-2.5,0-3.74,0a6,6,0,0,0-3.07.76L93.45,217.43a98,98,0,0,1-27.56-15.49l-.12-33.17a6,6,0,0,0-.91-3.16c-.64-1-1.27-2.08-1.86-3.14a6,6,0,0,0-2.27-2.3L31.3,143.4a93,93,0,0,1,0-30.79L60.68,95.9A6.07,6.07,0,0,0,63,93.6c.59-1,1.21-2.11,1.86-3.14a6,6,0,0,0,.91-3.16l.16-33.21A98.15,98.15,0,0,1,93.41,38.56L123,55.12a5.81,5.81,0,0,0,3.07.76c1.24,0,2.5,0,3.74,0a6,6,0,0,0,3.07-.76l29.65-16.56a98,98,0,0,1,27.56,15.49l.12,33.17a6,6,0,0,0,.91,3.16c.64,1,1.27,2.08,1.86,3.14a6,6,0,0,0,2.27,2.3L224.7,112.6A93,93,0,0,1,224.73,143.39Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm109.94-52.79a8,8,0,0,0-3.89-5.4l-29.83-17-.12-33.62a8,8,0,0,0-2.83-6.08,111.91,111.91,0,0,0-36.72-20.67,8,8,0,0,0-6.46.59L128,41.85,97.88,25a8,8,0,0,0-6.47-.6A112.1,112.1,0,0,0,54.73,45.15a8,8,0,0,0-2.83,6.07l-.15,33.65-29.83,17a8,8,0,0,0-3.89,5.4,106.47,106.47,0,0,0,0,41.56,8,8,0,0,0,3.89,5.4l29.83,17,.12,33.62a8,8,0,0,0,2.83,6.08,111.91,111.91,0,0,0,36.72,20.67,8,8,0,0,0,6.46-.59L128,214.15,158.12,231a7.91,7.91,0,0,0,3.9,1,8.09,8.09,0,0,0,2.57-.42,112.1,112.1,0,0,0,36.68-20.73,8,8,0,0,0,2.83-6.07l.15-33.65,29.83-17a8,8,0,0,0,3.89-5.4A106.47,106.47,0,0,0,237.94,107.21Zm-15,34.91-28.57,16.25a8,8,0,0,0-3,3c-.58,1-1.19,2.06-1.81,3.06a7.94,7.94,0,0,0-1.22,4.21l-.15,32.25a95.89,95.89,0,0,1-25.37,14.3L134,199.13a8,8,0,0,0-3.91-1h-.19c-1.21,0-2.43,0-3.64,0a8.08,8.08,0,0,0-4.1,1l-28.84,16.1A96,96,0,0,1,67.88,201l-.11-32.2a8,8,0,0,0-1.22-4.22c-.62-1-1.23-2-1.8-3.06a8.09,8.09,0,0,0-3-3.06l-28.6-16.29a90.49,90.49,0,0,1,0-28.26L61.67,97.63a8,8,0,0,0,3-3c.58-1,1.19-2.06,1.81-3.06a7.94,7.94,0,0,0,1.22-4.21l.15-32.25a95.89,95.89,0,0,1,25.37-14.3L122,56.87a8,8,0,0,0,4.1,1c1.21,0,2.43,0,3.64,0a8.08,8.08,0,0,0,4.1-1l28.84-16.1A96,96,0,0,1,188.12,55l.11,32.2a8,8,0,0,0,1.22,4.22c.62,1,1.23,2,1.8,3.06a8.09,8.09,0,0,0,3,3.06l28.6,16.29A90.49,90.49,0,0,1,222.9,142.12Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Zm106-56a4,4,0,0,0-2-2.7l-30.89-17.6q-.47-.82-1-1.62L200.1,51.2a3.94,3.94,0,0,0-1.42-3,107.8,107.8,0,0,0-35.41-19.94,4,4,0,0,0-3.23.29L129,45.87h-2l-31-17.36a4,4,0,0,0-3.23-.3,108.05,108.05,0,0,0-35.39,20,4,4,0,0,0-1.41,3l-.16,34.9-1,1.62L23.9,105.3A4,4,0,0,0,22,108a102.76,102.76,0,0,0,0,40,4,4,0,0,0,1.95,2.7l30.89,17.6q.47.83,1,1.62l.12,34.87a3.94,3.94,0,0,0,1.42,3,107.8,107.8,0,0,0,35.41,19.94,4,4,0,0,0,3.23-.29L127,210.13h2l31,17.36a4,4,0,0,0,3.23.3,108.05,108.05,0,0,0,35.39-20,4,4,0,0,0,1.41-3l.16-34.9,1-1.62L232.1,150.7a4,4,0,0,0,2-2.71A102.76,102.76,0,0,0,234,108Zm-7.48,36.67L196.3,161.84a4,4,0,0,0-1.51,1.53c-.61,1.09-1.25,2.17-1.91,3.24a3.92,3.92,0,0,0-.61,2.1l-.16,34.15a99.8,99.8,0,0,1-29.7,16.77l-30.4-17a4.06,4.06,0,0,0-2-.51H130c-1.28,0-2.57,0-3.84,0a4.1,4.1,0,0,0-2.05.51l-30.45,17A100.23,100.23,0,0,1,63.89,202.9l-.12-34.12a3.93,3.93,0,0,0-.61-2.11c-.66-1-1.3-2.14-1.91-3.23a4,4,0,0,0-1.51-1.53L29.49,144.68a94.78,94.78,0,0,1,0-33.34L59.7,94.16a4,4,0,0,0,1.51-1.53c.61-1.09,1.25-2.17,1.91-3.23a4,4,0,0,0,.61-2.11l.16-34.15a99.8,99.8,0,0,1,29.7-16.77l30.4,17a4.1,4.1,0,0,0,2.05.51c1.28,0,2.57,0,3.84,0a4,4,0,0,0,2.05-.51l30.45-17A100.23,100.23,0,0,1,192.11,53.1l.12,34.12a3.93,3.93,0,0,0,.61,2.11c.66,1,1.3,2.14,1.91,3.23a4,4,0,0,0,1.51,1.53l30.25,17.23A94.78,94.78,0,0,1,226.54,144.66Z"}))]]),i=r.forwardRef((e,t)=>r.createElement(n.A,{ref:t,...e,weights:l}));i.displayName="GearSixIcon";let s=i},80492:(e,t,a)=>{"use strict";a.d(t,{default:()=>R});var r=a(3680),n=a(78604),l=a(27540),i=a(40189),s=a(63363),o=a.n(s),c=a(39504),d=a(76613),m=a(14308),u=a(64678);let p=(0,u.createServerReference)("40de046de0bddf3387f259087a088306728aef5546",u.callServer,void 0,u.findSourceMapURL,"deleteLlmKeyAction"),x=(0,u.createServerReference)("6027df2597319ed4f15048c44cfae75dec92fd42fc",u.callServer,void 0,u.findSourceMapURL,"setLlmKeyActiveAction");var f=a(63217);function h({row:e,onEdit:t,onDeleted:a}){let i=(0,l.useRouter)(),[s,o]=(0,n.useTransition)(),[u,v]=(0,n.useState)(!1),[b,k]=(0,n.useTransition)(),{bg:A,fg:j,initials:L}=function(e){switch(e){case"anthropic":return{bg:"#c96442",fg:"#fff",initials:"AN"};case"openai":return{bg:"#0fa47c",fg:"#fff",initials:"OA"};case"openai-compatible":return{bg:"#7c5cbf",fg:"#fff",initials:"LC"};case"ollama":return{bg:"#3b5a8a",fg:"#fff",initials:"OL"};case"openrouter":return{bg:"#b5455a",fg:"#fff",initials:"OR"};case"google":return{bg:"#1a73c8",fg:"#fff",initials:"GG"};case"mistral":return{bg:"#c47a1a",fg:"#fff",initials:"MI"};case"groq":return{bg:"#a33b50",fg:"#fff",initials:"GQ"};default:return{bg:"#4a4a50",fg:"#fff",initials:e.slice(0,2).toUpperCase()}}}(e.provider);return(0,r.jsxs)("div",{className:"flex flex-col gap-3 rounded-2xl border border-rule-2 bg-paper p-[18px]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex h-[42px] w-[42px] shrink-0 items-center justify-center rounded-xl font-mono text-[13px] font-semibold tracking-[0.04em]",style:{background:A,color:j},children:L}),(0,r.jsx)("div",{className:"min-w-0 flex-1",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[15px] font-semibold leading-[1.2] tracking-[-0.005em] text-ink",children:e.nickname??(0,f.R)(e.provider)}),e.nickname&&(0,r.jsx)("span",{className:"font-mono text-[10.5px] uppercase tracking-[0.06em] text-ink-4",children:(0,f.R)(e.provider)})]})}),(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":e.isActive,"aria-label":e.isActive?"Deactivate provider":"Activate provider",onClick:function(){k(async()=>{let t=await x(e.id,!e.isActive);t.ok?i.refresh():c.oR.error(t.message)})},disabled:b||s,className:["relative inline-flex h-[22px] w-[38px] shrink-0 cursor-pointer items-center rounded-full border transition-colors focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",e.isActive?"border-ok/40 bg-ok/20":"border-rule-2 bg-canvas"].join(" "),children:(0,r.jsx)("span",{className:["inline-block h-[16px] w-[16px] rounded-full shadow-sm transition-transform",e.isActive?"translate-x-[18px] bg-ok":"translate-x-[2px] bg-ink-4"].join(" ")})})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[e.baseUrl&&(0,r.jsx)("div",{className:"flex items-center gap-2 rounded-lg bg-canvas px-[10px] py-[7px]",children:(0,r.jsx)("code",{className:"flex-1 truncate font-mono text-[12px] leading-none text-ink",children:e.baseUrl})}),(0,r.jsx)("div",{className:"flex items-center gap-2 rounded-lg bg-canvas px-[10px] py-[7px]",children:e.hasApiKey?(0,r.jsxs)("code",{className:"font-mono text-[12px] leading-none tracking-widest text-ink-3",children:["••••••••",e.apiKeyLast4??""]}):(0,r.jsx)("span",{className:"text-[12px] leading-none text-warn",children:"No API key"})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between border-t border-rule-2 pt-[10px]",children:[(0,r.jsx)(g,{count:e.agentCount,keyId:e.id}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsxs)("button",{type:"button",onClick:t,className:"inline-flex h-[28px] items-center gap-1 rounded-md border border-rule px-[10px] text-[11.5px] font-medium text-ink-3 transition-colors hover:border-rule-2 hover:text-ink",children:[(0,r.jsx)(d._,{size:12,weight:"regular"}),"Configure"]}),(0,r.jsx)("button",{type:"button",onClick:()=>v(!0),disabled:s,className:"inline-flex h-[28px] items-center rounded-md border border-err/30 px-[10px] text-[11.5px] font-medium text-err transition-colors hover:border-err/60 hover:bg-warn-bg disabled:opacity-40",children:"Delete"})]})]}),(0,r.jsx)(m.A,{open:u,title:"Remove LLM provider?",message:`"${e.nickname??(0,f.R)(e.provider)}" will be removed. Agents using it will fall back to the default env-configured provider until reassigned.`,confirmLabel:"Remove",onConfirm:function(){v(!1),o(async()=>{let t=await p(e.id);t.ok?(c.oR.success("LLM provider removed"),a()):c.oR.error(t.message)})},onCancel:()=>v(!1)})]})}function g({count:e,keyId:t}){return 0===e?(0,r.jsx)("span",{className:"font-sans text-[12.5px] leading-none text-ink-3",children:"Not in use"}):(0,r.jsxs)(o(),{href:`/agents?llmKeyId=${t}`,className:"font-sans text-[12.5px] leading-none text-ink-3 transition-colors hover:text-ink",title:`${e} agent${1===e?"":"s"} use this key`,children:[(0,r.jsx)("span",{className:"font-mono tabular-nums",children:e})," agent",1===e?"":"s"," using"]})}let v=(0,u.createServerReference)("40162d8df2e52a907c99cd0a9d8d4bc05202f4d5e5",u.callServer,void 0,u.findSourceMapURL,"testLlmKeyAction"),b=(0,u.createServerReference)("4037207befca10bb542d700e5232bd286c98781d5e",u.callServer,void 0,u.findSourceMapURL,"updateLlmKeyAction"),k=(0,u.createServerReference)("405e6ab4f6b3f7d0ca79943dd7c850fefad7099fbe",u.callServer,void 0,u.findSourceMapURL,"createLlmKeyAction"),A={anthropic:"https://api.anthropic.com/v1",openai:"https://api.openai.com/v1","openai-compatible":"http://localhost:1234/v1",ollama:"http://localhost:11434",openrouter:"https://openrouter.ai/api/v1",google:"https://generativelanguage.googleapis.com/v1beta",mistral:"https://api.mistral.ai/v1",groq:"https://api.groq.com/openai/v1"},j=["anthropic","openai","openai-compatible","ollama","openrouter","google","mistral","groq"],L="block font-mono text-[10px] uppercase tracking-[0.12em] text-ink-4 mb-1.5",y="w-full rounded-lg border border-rule bg-canvas px-3 py-2 text-[13px] text-ink placeholder-ink-4 transition-colors focus:border-ink-3 focus:outline-none",N=`${y} font-mono`;function w(e){let t="edit"===e.mode,a=t?e.initial:null,l=a?.provider??"anthropic",i="create"===e.mode?j.filter(t=>!e.configuredProviders.includes(t)):j,s="create"===e.mode?i[0]??"anthropic":l,[o,d]=(0,n.useState)(s),[m,u]=(0,n.useState)(a?.baseUrl??""),[p,x]=(0,n.useState)(""),[h,g]=(0,n.useState)(a?.isActive??!0),[w,R]=(0,n.useState)({state:"idle"}),[E,S]=(0,n.useTransition)(),[M,C]=(0,n.useState)(!1),Z=t&&0===p.length,F=t&&a?.apiKeyLast4!=null&&!M&&0===p.length;function H(){"idle"!==w.state&&R({state:"idle"})}async function P(){R({state:"testing"});let e=t&&0===p.length&&a?.id,r=await v({provider:o,baseUrl:m||void 0,apiKey:p||void 0,...e?{keyId:a.id}:{}});r.ok?R({state:"pass",message:r.data.message}):R({state:"fail",message:r.message})}let V=A[o]||"https://...";return(0,r.jsxs)("form",{onSubmit:function(r){(r.preventDefault(),"pass"===w.state||Z)?S(async()=>{if(t&&a){let t=await b({id:a.id,provider:o,baseUrl:m||void 0,apiKey:p||void 0,isActive:h});if(!t.ok)return void c.oR.error(t.message);c.oR.success("LLM provider updated"),e.onDone("saved")}else{let t=await k({provider:o,baseUrl:m||void 0,apiKey:p||void 0,isActive:h});if(!t.ok)return void c.oR.error(t.message);c.oR.success("LLM provider added"),e.onDone("saved")}}):c.oR.error("Test the connection before saving")},className:"space-y-4 rounded-2xl border border-rule-2 bg-paper p-5",children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:L,htmlFor:"llm-provider",children:"Provider"}),t?(0,r.jsx)("div",{className:`${y} cursor-not-allowed bg-hover text-ink-3`,children:(0,f.R)(o)}):0===i.length?(0,r.jsx)("p",{className:"text-[12.5px] text-warn",children:"All providers already configured. Edit an existing key instead."}):(0,r.jsx)("select",{id:"llm-provider",value:o,onChange:e=>{var t;d(t=e.target.value),!m&&A[t]&&u(A[t]),H()},className:y,children:i.map(e=>(0,r.jsx)("option",{value:e,children:(0,f.R)(e)},e))})]})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:L,htmlFor:"llm-base-url",children:["Base URL","openai-compatible"===o||"ollama"===o?(0,r.jsx)("span",{className:"ml-2 normal-case font-sans text-[11px] tracking-normal text-warn",children:"required"}):(0,r.jsx)("span",{className:"ml-2 normal-case font-sans text-[11px] tracking-normal text-ink-4",children:"optional"})]}),(0,r.jsx)("input",{id:"llm-base-url",type:"text",required:"openai-compatible"===o||"ollama"===o,value:m,onChange:e=>{u(e.target.value),H()},placeholder:V||"leave blank to use the provider default",className:N})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:L,htmlFor:"llm-api-key",children:"API key"}),F?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"flex-1 rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[13px] tracking-widest text-ink-3 select-none",children:["••••••••",a.apiKeyLast4]}),(0,r.jsx)("button",{type:"button",onClick:()=>{C(!0),H()},className:"shrink-0 rounded-md border border-rule px-3 py-2 text-[12px] font-medium text-ink-3 transition-colors hover:border-ink-3 hover:text-ink",children:"Replace"})]}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{id:"llm-api-key",type:"password",autoComplete:"new-password",value:p,onChange:e=>{x(e.target.value),H()},placeholder:t&&!M?"Leave blank to keep current":"",className:"flex-1 rounded-lg border border-rule bg-canvas px-3 py-2 font-mono text-[13px] text-ink placeholder-ink-4 transition-colors focus:border-ink-3 focus:outline-none"}),t&&M&&(0,r.jsx)("button",{type:"button",onClick:()=>{C(!1),x(""),H()},className:"shrink-0 px-3 py-2 text-[12px] font-medium text-ink-4 transition-colors hover:text-ink-2",children:"Cancel"})]})]}),(0,r.jsxs)("label",{className:"flex cursor-pointer items-center gap-2.5 text-[13px] text-ink-2",children:[(0,r.jsx)("input",{type:"checkbox",checked:h,onChange:e=>g(e.target.checked),className:"accent-conn-vivid"}),(0,r.jsx)("span",{children:"Active — agents may select this provider"})]}),"pass"===w.state&&(0,r.jsx)("div",{className:"rounded-md border border-ok/30 bg-ok-bg px-3 py-2 text-[12px] text-ok",children:w.message}),"fail"===w.state&&(0,r.jsx)("div",{className:"rounded-md border border-err/30 bg-warn-bg px-3 py-2 text-[12px] text-err break-all",children:w.message}),(0,r.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,r.jsx)("button",{type:"button",onClick:P,disabled:"testing"===w.state||E,className:"inline-flex h-[34px] items-center rounded-md border border-rule px-3.5 text-[13px] font-medium text-ink-2 transition-colors hover:border-rule-2 hover:text-ink disabled:opacity-50",children:"testing"===w.state?"Testing…":"Test connection"}),(0,r.jsx)("button",{type:"submit",disabled:E||"testing"===w.state||"pass"!==w.state&&!Z,className:"inline-flex h-[34px] items-center rounded-md bg-ink px-3.5 text-[13px] font-semibold text-canvas transition-[filter] hover:brightness-[0.92] disabled:opacity-50",title:"pass"===w.state||Z?void 0:"Test the connection before saving",children:E?"Saving…":t?"Save changes":"Add provider"}),(0,r.jsx)("button",{type:"button",onClick:()=>e.onDone("cancelled"),className:"inline-flex h-[34px] items-center px-3.5 text-[13px] font-medium text-ink-3 transition-colors hover:text-ink-2",children:"Cancel"})]})]})}function R({initialRows:e}){let t=(0,l.useRouter)(),[,a]=(0,n.useTransition)(),[s,o]=(0,n.useState)({kind:"closed"}),c=e.map(e=>e.provider);function d(){a(()=>{t.refresh()})}return(0,r.jsxs)("div",{className:"space-y-3",children:[0===e.length?(0,r.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-6 py-12 text-center text-[13px] text-ink-3",children:"No LLM providers yet. Add one to start configuring agents."}):(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,r.jsx)(h,{row:e,onEdit:()=>o({kind:"edit",row:e}),onDeleted:d},e.id))}),"closed"===s.kind&&(0,r.jsxs)("button",{type:"button",onClick:()=>o({kind:"create"}),className:"inline-flex h-[34px] items-center gap-1.5 rounded-md border border-rule bg-paper px-3.5 text-[13px] font-medium text-ink-2 transition-colors hover:border-rule-2 hover:text-ink",children:[(0,r.jsx)(i.F,{size:13,weight:"bold"}),"Add provider"]}),"create"===s.kind&&(0,r.jsx)(w,{mode:"create",configuredProviders:c,onDone:e=>{o({kind:"closed"}),"saved"===e&&d()}}),"edit"===s.kind&&(0,r.jsx)(w,{mode:"edit",initial:s.row,onDone:e=>{o({kind:"closed"}),"saved"===e&&d()}})]})}}},e=>{e.O(0,[3363,9504,1065,8724,7358],()=>e(e.s=70397)),_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()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1966],{41736:(e,t,n)=>{Promise.resolve().then(n.bind(n,52021)),Promise.resolve().then(n.bind(n,47549)),Promise.resolve().then(n.t.bind(n,63363,23)),Promise.resolve().then(n.t.bind(n,27364,23))},47549:(e,t,n)=>{"use strict";n.d(t,{default:()=>u});var a=n(3680),i=n(22799),s=n(87404),l=n(61453),r=n(81906),o=n(80957),c=n(14099),d=n(78986),x=n(53878);let m={completed:{color:"#d4ff2e",label:"Completed"},awaiting:{color:"#3565ff",label:"Awaiting"},pending:{color:"#8aa8ff",label:"Pending"},cancelled:{color:"#9a9a9a",label:"Cancelled"},failed:{color:"#ff5631",label:"Failed"}};function p(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function u({data:e}){let t=e.reduce((e,t)=>e+t.completed+t.awaiting+t.pending+t.cancelled+t.failed,0);return(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"mb-2 font-mono text-[10.5px] uppercase tracking-[0.16em] text-ink-4",children:"Weekly activity"}),(0,a.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-3 py-4",children:0===t?(0,a.jsx)("div",{className:"flex h-[220px] items-center justify-center text-sm text-ink-3",children:"No jobs in the last 12 weeks."}):(0,a.jsx)(i.u,{width:"100%",height:220,children:(0,a.jsxs)(s.E,{data:e,margin:{top:5,right:10,left:-20,bottom:0},children:[(0,a.jsx)(l.d,{stroke:"var(--c-rule-2)",vertical:!1}),(0,a.jsx)(r.W,{dataKey:"week",tickFormatter:p,stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1}),(0,a.jsx)(o.h,{stroke:"var(--c-ink-4)",tick:{fill:"var(--c-ink-4)",fontSize:11},axisLine:!1,tickLine:!1,allowDecimals:!1}),(0,a.jsx)(c.m,{cursor:{fill:"var(--c-hover)"},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)"},labelFormatter:e=>`Week of ${p(String(e??""))}`}),(0,a.jsx)(d.s,{wrapperStyle:{fontSize:11,paddingTop:8,color:"var(--c-ink-3)"},formatter:e=>m[e]?.label??e}),Object.keys(m).map(e=>(0,a.jsx)(x.yP,{dataKey:e,stackId:"status",fill:m[e].color},e))]})})})]})}},52021:(e,t,n)=>{"use strict";n.d(t,{default:()=>d});var a=n(3680),i=n(63363),s=n.n(i),l=n(78604),r=n(57581),o=n(99203),c=n(82592);function d({initial:e}){let[t,n]=(0,l.useState)(e),[i,s]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=!1,t=async()=>{let t=await (0,r.V)();e||(t.ok?(n(t.data),s(!1)):s(!0))},a=setInterval(()=>void t(),5e3);return()=>{e=!0,clearInterval(a)}},[]),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"font-mono text-[10.5px] uppercase tracking-[0.16em] text-ink-4",children:"Agents at work"}),(0,a.jsx)("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] text-ink-4",children:i?"reconnect…":(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.A,{variant:"lime",size:"sm"}),"live \xb7 ",5,"s"]})})]}),0===t.length?(0,a.jsx)("div",{className:"rounded-2xl border border-rule-2 bg-paper px-5 py-6 text-center text-sm text-ink-3",children:"All agents idle — no jobs in flight."}):(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.map(e=>(0,a.jsx)(x,{row:e},e.agentId))})]})}function x({row:e}){return(0,a.jsxs)(s(),{href:`/jobs?agentId=${e.agentId}`,className:"block rounded-2xl border border-rule-2 bg-paper px-4 py-3 transition-colors hover:border-ink-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,a.jsx)(o.A,{name:e.agentName,imageUrl:e.avatarUrl,size:"lg",shape:"round"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-[14px] font-semibold leading-[1.2] text-ink",children:e.agentName}),(0,a.jsx)("p",{className:"truncate font-mono text-[11px] text-ink-4",children:e.agentSlug})]})]}),(0,a.jsx)("span",{className:"shrink-0 font-mono text-[24px] font-semibold leading-none tracking-[-0.02em] text-ink tabular-nums",children:e.total})]}),(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-3 text-[11px]",children:[e.processing>0&&(0,a.jsxs)("span",{className:"text-run",children:[(0,a.jsx)("span",{className:"font-mono tabular-nums",children:e.processing})," running"]}),e.awaiting>0&&(0,a.jsxs)("span",{className:"text-warn",children:[(0,a.jsx)("span",{className:"font-mono tabular-nums",children:e.awaiting})," awaiting"]}),e.pending>0&&(0,a.jsxs)("span",{className:"text-ink-3",children:[(0,a.jsx)("span",{className:"font-mono tabular-nums",children:e.pending})," pending"]})]})]})}},57581:(e,t,n)=>{"use strict";n.d(t,{V:()=>i});var a=n(64678);let i=(0,a.createServerReference)("00e93f5a30fbb4748e0f30addc55e311d26b3a1e21",a.callServer,void 0,a.findSourceMapURL,"getActiveJobsByAgentAction")},82592:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(3680);let i={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:n=!0,className:r=""}){return(0,a.jsx)("span",{className:`inline-block shrink-0 rounded-full ${"sm"===t?"h-[7px] w-[7px]":"h-2 w-2"} ${i[e]} ${n?s[e]:""} ${r}`})}},99203:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(3680),i=n(22575);let s={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 l({name:e,imageUrl:t,size:n="md",shape:r="round",className:o=""}){let c=s[n],d=`inline-flex shrink-0 items-center justify-center overflow-hidden bg-hover font-mono font-semibold tracking-[0.04em] text-ink-2 ${c.box} ${c.text} ${"round"===r?"rounded-full":"rounded-[8px]"} ${o}`;return t?(0,a.jsx)("span",{className:d,children:(0,a.jsx)(i.default,{src:t,alt:e,width:c.px,height:c.px,className:"h-full w-full object-cover"})}):(0,a.jsx)("span",{className:d,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,2575,269,3233,1065,8724,7358],()=>e(e.s=41736)),_N_E=e.O()}]);