madarx 2.15.1 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +322 -321
  3. package/.next/standalone/.next/app-path-routes-manifest.json +81 -81
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/prerender-manifest.json +9 -9
  6. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  7. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  8. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  9. package/.next/standalone/.next/server/app/activity/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/admin/page.js +2 -2
  11. package/.next/standalone/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/agents/[id]/page.js +6 -6
  13. package/.next/standalone/.next/server/app/agents/[id]/page.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/agents/page.js +1 -1
  16. package/.next/standalone/.next/server/app/agents/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/api/activity/route_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/api/admin/audit-export/route_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/api/admin/share-links/route_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/api/agent-memory/route_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/api/agent-runs/[id]/cancel/route_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/api/agent-runs/[id]/events/route_client-reference-manifest.js +1 -1
  24. package/.next/standalone/.next/server/app/api/agent-runs/[id]/log/route_client-reference-manifest.js +1 -1
  25. package/.next/standalone/.next/server/app/api/agent-runs/[id]/route_client-reference-manifest.js +1 -1
  26. package/.next/standalone/.next/server/app/api/agent-runs/route_client-reference-manifest.js +1 -1
  27. package/.next/standalone/.next/server/app/api/agents/[id]/chain/route_client-reference-manifest.js +1 -1
  28. package/.next/standalone/.next/server/app/api/agents/[id]/memory/route_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/api/agents/[id]/reports/route_client-reference-manifest.js +1 -1
  30. package/.next/standalone/.next/server/app/api/agents/[id]/run/route_client-reference-manifest.js +1 -1
  31. package/.next/standalone/.next/server/app/api/agents/[id]/skills/route_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/api/agents/create/route_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/api/agents/ops/route_client-reference-manifest.js +1 -1
  34. package/.next/standalone/.next/server/app/api/approvals/[id]/route_client-reference-manifest.js +1 -1
  35. package/.next/standalone/.next/server/app/api/approvals/route_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/api/artifacts/[id]/acl/route_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/app/api/artifacts/[id]/protect/route_client-reference-manifest.js +1 -1
  38. package/.next/standalone/.next/server/app/api/artifacts/[id]/raw/route_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/api/artifacts/[id]/route_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/api/artifacts/[id]/share-link/[linkId]/route_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/api/artifacts/[id]/share-link/route_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/api/artifacts/upload/route_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/api/audit/list/route_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/api/audit/search/route_client-reference-manifest.js +1 -1
  45. package/.next/standalone/.next/server/app/api/auth/callback/route_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/api/auth/config/route_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/api/auth/join-bootstrap/route_client-reference-manifest.js +1 -1
  48. package/.next/standalone/.next/server/app/api/auth/session/route_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/api/brand/route_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/api/chat/sessions/[id]/route_client-reference-manifest.js +1 -1
  51. package/.next/standalone/.next/server/app/api/chat/sessions/route_client-reference-manifest.js +1 -1
  52. package/.next/standalone/.next/server/app/api/config/env/route_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/api/config/route_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/api/connections/[service]/route_client-reference-manifest.js +1 -1
  55. package/.next/standalone/.next/server/app/api/connections/[service]/verify/route.js +2 -2
  56. package/.next/standalone/.next/server/app/api/connections/[service]/verify/route_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/api/connections/route_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/app/api/cron/tick/route_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/move/route_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/route_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/share-link/[linkId]/route_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/share-link/route_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/api/dashboard/spaces/import/route_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/api/dashboard/spaces/route_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/api/disk/files/[id]/blob/route_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/app/api/disk/files/[id]/route_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/app/api/disk/files/[id]/transcribe/route_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/api/disk/files/route_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/api/disk/folders/route_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/app/api/events/since/[cursor]/route_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/api/events/stream/route_client-reference-manifest.js +1 -1
  72. package/.next/standalone/.next/server/app/api/fs/create-folder/route_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/api/fs/pick-folder/route_client-reference-manifest.js +1 -1
  74. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/blueprint/route_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/diagnostic/route_client-reference-manifest.js +1 -1
  76. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/governance/route_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/interview/route_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/pilot/route_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/quarterly/route_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/route_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/setup-package/route_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/api/hail/engagements/route_client-reference-manifest.js +1 -1
  83. package/.next/standalone/.next/server/app/api/hail/interviews/[id]/responses/route_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/app/api/hail/interviews/[id]/route_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/app/api/hail/setup-packages/[id]/apply/route_client-reference-manifest.js +1 -1
  86. package/.next/standalone/.next/server/app/api/hail/setup-packages/validate/route_client-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/app/api/heartbeat/tick/route_client-reference-manifest.js +1 -1
  88. package/.next/standalone/.next/server/app/api/heartbeat/worker/route_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app/api/help/route_client-reference-manifest.js +1 -1
  90. package/.next/standalone/.next/server/app/api/hermes/jobs/[id]/events/route_client-reference-manifest.js +1 -1
  91. package/.next/standalone/.next/server/app/api/hermes/jobs/[id]/route_client-reference-manifest.js +1 -1
  92. package/.next/standalone/.next/server/app/api/hermes/jobs/route_client-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/app/api/integrations/google/callback/route_client-reference-manifest.js +1 -1
  94. package/.next/standalone/.next/server/app/api/integrations/google/oauth/route_client-reference-manifest.js +1 -1
  95. package/.next/standalone/.next/server/app/api/marketplace/[id]/route_client-reference-manifest.js +1 -1
  96. package/.next/standalone/.next/server/app/api/marketplace/open-design/route_client-reference-manifest.js +1 -1
  97. package/.next/standalone/.next/server/app/api/marketplace/route_client-reference-manifest.js +1 -1
  98. package/.next/standalone/.next/server/app/api/mines/import-roots/route_client-reference-manifest.js +1 -1
  99. package/.next/standalone/.next/server/app/api/mines/portfolio/route_client-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/app/api/mines/projects/[id]/chunks/route_client-reference-manifest.js +1 -1
  101. package/.next/standalone/.next/server/app/api/mines/projects/[id]/diligence/route_client-reference-manifest.js +1 -1
  102. package/.next/standalone/.next/server/app/api/mines/projects/[id]/import/route_client-reference-manifest.js +1 -1
  103. package/.next/standalone/.next/server/app/api/mines/projects/[id]/publish/route_client-reference-manifest.js +1 -1
  104. package/.next/standalone/.next/server/app/api/mines/projects/route_client-reference-manifest.js +1 -1
  105. package/.next/standalone/.next/server/app/api/missions/route_client-reference-manifest.js +1 -1
  106. package/.next/standalone/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  107. package/.next/standalone/.next/server/app/api/onboarding/blueprint/route_client-reference-manifest.js +1 -1
  108. package/.next/standalone/.next/server/app/api/onboarding/launch/route_client-reference-manifest.js +1 -1
  109. package/.next/standalone/.next/server/app/api/orchestrator/command/route_client-reference-manifest.js +1 -1
  110. package/.next/standalone/.next/server/app/api/orchestrator/stream/route_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/api/orchestrator/upload/route_client-reference-manifest.js +1 -1
  112. package/.next/standalone/.next/server/app/api/org/route_client-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/app/api/orgs/[id]/invites/[inviteId]/route_client-reference-manifest.js +1 -1
  114. package/.next/standalone/.next/server/app/api/orgs/[id]/invites/route_client-reference-manifest.js +1 -1
  115. package/.next/standalone/.next/server/app/api/orgs/[id]/members/[userId]/role/route_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/api/orgs/[id]/members/[userId]/route_client-reference-manifest.js +1 -1
  117. package/.next/standalone/.next/server/app/api/orgs/[id]/members/route_client-reference-manifest.js +1 -1
  118. package/.next/standalone/.next/server/app/api/orgs/[id]/route_client-reference-manifest.js +1 -1
  119. package/.next/standalone/.next/server/app/api/orgs/invites/pending/route_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/api/orgs/join/route_client-reference-manifest.js +1 -1
  121. package/.next/standalone/.next/server/app/api/orgs/join-complete/route_client-reference-manifest.js +1 -1
  122. package/.next/standalone/.next/server/app/api/orgs/route_client-reference-manifest.js +1 -1
  123. package/.next/standalone/.next/server/app/api/printing-press/clis/route_client-reference-manifest.js +1 -1
  124. package/.next/standalone/.next/server/app/api/printing-press/install/route_client-reference-manifest.js +1 -1
  125. package/.next/standalone/.next/server/app/api/printing-press/security-mode/route_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/api/privacy/config/route_client-reference-manifest.js +1 -1
  127. package/.next/standalone/.next/server/app/api/privacy/verify/route_client-reference-manifest.js +1 -1
  128. package/.next/standalone/.next/server/app/api/processes/[id]/route_client-reference-manifest.js +1 -1
  129. package/.next/standalone/.next/server/app/api/processes/[id]/share-link/route_client-reference-manifest.js +1 -1
  130. package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/override/route_client-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/retry/route_client-reference-manifest.js +1 -1
  132. package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/submit/route_client-reference-manifest.js +1 -1
  133. package/.next/standalone/.next/server/app/api/processes/definitions/[slug]/route_client-reference-manifest.js +1 -1
  134. package/.next/standalone/.next/server/app/api/processes/definitions/[slug]/settings/route_client-reference-manifest.js +1 -1
  135. package/.next/standalone/.next/server/app/api/processes/definitions/route_client-reference-manifest.js +1 -1
  136. package/.next/standalone/.next/server/app/api/processes/definitions/validate/route_client-reference-manifest.js +1 -1
  137. package/.next/standalone/.next/server/app/api/processes/route_client-reference-manifest.js +1 -1
  138. package/.next/standalone/.next/server/app/api/processes/start-and-route/route_client-reference-manifest.js +1 -1
  139. package/.next/standalone/.next/server/app/api/projects/[slug]/library/route_client-reference-manifest.js +1 -1
  140. package/.next/standalone/.next/server/app/api/projects/[slug]/route_client-reference-manifest.js +1 -1
  141. package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  142. package/.next/standalone/.next/server/app/api/runs/approve-claude-run/route_client-reference-manifest.js +1 -1
  143. package/.next/standalone/.next/server/app/api/runs/claude-code-dry-run/route_client-reference-manifest.js +1 -1
  144. package/.next/standalone/.next/server/app/api/runs/competitor-report/route_client-reference-manifest.js +1 -1
  145. package/.next/standalone/.next/server/app/api/runs/engine-ping/route_client-reference-manifest.js +1 -1
  146. package/.next/standalone/.next/server/app/api/runs/marketing-plan/route_client-reference-manifest.js +1 -1
  147. package/.next/standalone/.next/server/app/api/schedules/upsert/route_client-reference-manifest.js +1 -1
  148. package/.next/standalone/.next/server/app/api/secrets/[name]/route_client-reference-manifest.js +1 -1
  149. package/.next/standalone/.next/server/app/api/secrets/route_client-reference-manifest.js +1 -1
  150. package/.next/standalone/.next/server/app/api/settings/trust-mode/route_client-reference-manifest.js +1 -1
  151. package/.next/standalone/.next/server/app/api/share/[token]/otp/route_client-reference-manifest.js +1 -1
  152. package/.next/standalone/.next/server/app/api/share/[token]/route_client-reference-manifest.js +1 -1
  153. package/.next/standalone/.next/server/app/api/share/[token]/verify/route_client-reference-manifest.js +1 -1
  154. package/.next/standalone/.next/server/app/api/share/space/[token]/otp/route_client-reference-manifest.js +1 -1
  155. package/.next/standalone/.next/server/app/api/share/space/[token]/route_client-reference-manifest.js +1 -1
  156. package/.next/standalone/.next/server/app/api/share/space/[token]/verify/route_client-reference-manifest.js +1 -1
  157. package/.next/standalone/.next/server/app/api/shared/spaces/[id]/acl/route_client-reference-manifest.js +1 -1
  158. package/.next/standalone/.next/server/app/api/shared/spaces/publish/route_client-reference-manifest.js +1 -1
  159. package/.next/standalone/.next/server/app/api/shared/spaces/route_client-reference-manifest.js +1 -1
  160. package/.next/standalone/.next/server/app/api/shared/spaces/status/route_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/api/shared/spaces/unpublish/route_client-reference-manifest.js +1 -1
  162. package/.next/standalone/.next/server/app/api/state/route_client-reference-manifest.js +1 -1
  163. package/.next/standalone/.next/server/app/api/system/update/route_client-reference-manifest.js +1 -1
  164. package/.next/standalone/.next/server/app/api/tasks/[id]/active-run/route_client-reference-manifest.js +1 -1
  165. package/.next/standalone/.next/server/app/api/tasks/[id]/attachments/route_client-reference-manifest.js +1 -1
  166. package/.next/standalone/.next/server/app/api/tasks/[id]/checklist/[itemId]/route_client-reference-manifest.js +1 -1
  167. package/.next/standalone/.next/server/app/api/tasks/[id]/checklist/route_client-reference-manifest.js +1 -1
  168. package/.next/standalone/.next/server/app/api/tasks/[id]/checkout/route_client-reference-manifest.js +1 -1
  169. package/.next/standalone/.next/server/app/api/tasks/[id]/children/route_client-reference-manifest.js +1 -1
  170. package/.next/standalone/.next/server/app/api/tasks/[id]/comments/route_client-reference-manifest.js +1 -1
  171. package/.next/standalone/.next/server/app/api/tasks/[id]/events/route_client-reference-manifest.js +1 -1
  172. package/.next/standalone/.next/server/app/api/tasks/[id]/live-runs/route_client-reference-manifest.js +1 -1
  173. package/.next/standalone/.next/server/app/api/tasks/[id]/release/route_client-reference-manifest.js +1 -1
  174. package/.next/standalone/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
  175. package/.next/standalone/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
  176. package/.next/standalone/.next/server/app/api/tool-allowlists/[id]/route_client-reference-manifest.js +1 -1
  177. package/.next/standalone/.next/server/app/api/tool-allowlists/route_client-reference-manifest.js +1 -1
  178. package/.next/standalone/.next/server/app/api/tool-egress/route_client-reference-manifest.js +1 -1
  179. package/.next/standalone/.next/server/app/api/tools/[name]/approve/route_client-reference-manifest.js +1 -1
  180. package/.next/standalone/.next/server/app/api/tools/[name]/route_client-reference-manifest.js +1 -1
  181. package/.next/standalone/.next/server/app/api/tools/route_client-reference-manifest.js +1 -1
  182. package/.next/standalone/.next/server/app/api/transcripts/route_client-reference-manifest.js +1 -1
  183. package/.next/standalone/.next/server/app/api/voice/providers/route_client-reference-manifest.js +1 -1
  184. package/.next/standalone/.next/server/app/api/voice/realtime/context/route_client-reference-manifest.js +1 -1
  185. package/.next/standalone/.next/server/app/api/voice/realtime/session/route_client-reference-manifest.js +1 -1
  186. package/.next/standalone/.next/server/app/api/voice/realtime/tool-result/route_client-reference-manifest.js +1 -1
  187. package/.next/standalone/.next/server/app/api/voice/realtime/tools/route_client-reference-manifest.js +1 -1
  188. package/.next/standalone/.next/server/app/api/voice/tts/route_client-reference-manifest.js +1 -1
  189. package/.next/standalone/.next/server/app/api/whatsapp/allowlist/route_client-reference-manifest.js +1 -1
  190. package/.next/standalone/.next/server/app/api/whatsapp/disconnect/route_client-reference-manifest.js +1 -1
  191. package/.next/standalone/.next/server/app/api/whatsapp/messages/route_client-reference-manifest.js +1 -1
  192. package/.next/standalone/.next/server/app/api/whatsapp/qr/route_client-reference-manifest.js +1 -1
  193. package/.next/standalone/.next/server/app/api/whatsapp/send/route_client-reference-manifest.js +1 -1
  194. package/.next/standalone/.next/server/app/api/whatsapp/status/route_client-reference-manifest.js +1 -1
  195. package/.next/standalone/.next/server/app/approvals/page.js +1 -1
  196. package/.next/standalone/.next/server/app/approvals/page_client-reference-manifest.js +1 -1
  197. package/.next/standalone/.next/server/app/architecture/page_client-reference-manifest.js +1 -1
  198. package/.next/standalone/.next/server/app/architecture.html +2 -2
  199. package/.next/standalone/.next/server/app/architecture.rsc +2 -2
  200. package/.next/standalone/.next/server/app/audit/live/page_client-reference-manifest.js +1 -1
  201. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  202. package/.next/standalone/.next/server/app/brand/page_client-reference-manifest.js +1 -1
  203. package/.next/standalone/.next/server/app/brand.html +1 -1
  204. package/.next/standalone/.next/server/app/brand.rsc +2 -2
  205. package/.next/standalone/.next/server/app/disk/page_client-reference-manifest.js +1 -1
  206. package/.next/standalone/.next/server/app/federated-ai/page_client-reference-manifest.js +1 -1
  207. package/.next/standalone/.next/server/app/federated-ai.html +2 -2
  208. package/.next/standalone/.next/server/app/federated-ai.rsc +2 -2
  209. package/.next/standalone/.next/server/app/hail/[id]/governance/page_client-reference-manifest.js +1 -1
  210. package/.next/standalone/.next/server/app/hail/[id]/interview/page.js +1 -1
  211. package/.next/standalone/.next/server/app/hail/[id]/interview/page_client-reference-manifest.js +1 -1
  212. package/.next/standalone/.next/server/app/hail/[id]/page.js +1 -1
  213. package/.next/standalone/.next/server/app/hail/[id]/page_client-reference-manifest.js +1 -1
  214. package/.next/standalone/.next/server/app/hail/[id]/setup/page.js +2 -2
  215. package/.next/standalone/.next/server/app/hail/[id]/setup/page_client-reference-manifest.js +1 -1
  216. package/.next/standalone/.next/server/app/hail/page.js +1 -1
  217. package/.next/standalone/.next/server/app/hail/page_client-reference-manifest.js +1 -1
  218. package/.next/standalone/.next/server/app/help/[slug]/page_client-reference-manifest.js +1 -1
  219. package/.next/standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app/index.html +2 -2
  221. package/.next/standalone/.next/server/app/index.rsc +2 -2
  222. package/.next/standalone/.next/server/app/join/page_client-reference-manifest.js +1 -1
  223. package/.next/standalone/.next/server/app/join.html +1 -1
  224. package/.next/standalone/.next/server/app/join.rsc +2 -2
  225. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  226. package/.next/standalone/.next/server/app/marketplace/page.js +4 -3
  227. package/.next/standalone/.next/server/app/marketplace/page.js.nft.json +1 -1
  228. package/.next/standalone/.next/server/app/marketplace/page_client-reference-manifest.js +1 -1
  229. package/.next/standalone/.next/server/app/mines/[projectId]/page_client-reference-manifest.js +1 -1
  230. package/.next/standalone/.next/server/app/mines/[projectId]/results/page_client-reference-manifest.js +1 -1
  231. package/.next/standalone/.next/server/app/mines/page_client-reference-manifest.js +1 -1
  232. package/.next/standalone/.next/server/app/missions/page.js +2 -2
  233. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  234. package/.next/standalone/.next/server/app/onboarding/org/page_client-reference-manifest.js +1 -1
  235. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  236. package/.next/standalone/.next/server/app/onboarding.html +2 -2
  237. package/.next/standalone/.next/server/app/onboarding.rsc +2 -2
  238. package/.next/standalone/.next/server/app/org/page.js +1 -1
  239. package/.next/standalone/.next/server/app/org/page.js.nft.json +1 -1
  240. package/.next/standalone/.next/server/app/org/page_client-reference-manifest.js +1 -1
  241. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  242. package/.next/standalone/.next/server/app/projects/[slug]/log/page_client-reference-manifest.js +1 -1
  243. package/.next/standalone/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  244. package/.next/standalone/.next/server/app/projects/new/page.js +3 -2
  245. package/.next/standalone/.next/server/app/projects/new/page.js.nft.json +1 -1
  246. package/.next/standalone/.next/server/app/projects/new/page_client-reference-manifest.js +1 -1
  247. package/.next/standalone/.next/server/app/projects/new.html +1 -1
  248. package/.next/standalone/.next/server/app/projects/new.rsc +3 -3
  249. package/.next/standalone/.next/server/app/projects/page.js +32 -15
  250. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  251. package/.next/standalone/.next/server/app/reports/[file]/route_client-reference-manifest.js +1 -1
  252. package/.next/standalone/.next/server/app/reports/page_client-reference-manifest.js +1 -1
  253. package/.next/standalone/.next/server/app/runtime/page_client-reference-manifest.js +1 -1
  254. package/.next/standalone/.next/server/app/schedules/page.js +2 -2
  255. package/.next/standalone/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
  256. package/.next/standalone/.next/server/app/settings/account/page_client-reference-manifest.js +1 -1
  257. package/.next/standalone/.next/server/app/settings/advanced/page_client-reference-manifest.js +1 -1
  258. package/.next/standalone/.next/server/app/settings/appearance/page.js +1 -1
  259. package/.next/standalone/.next/server/app/settings/appearance/page_client-reference-manifest.js +1 -1
  260. package/.next/standalone/.next/server/app/settings/brand/page.js +1 -1
  261. package/.next/standalone/.next/server/app/settings/brand/page_client-reference-manifest.js +1 -1
  262. package/.next/standalone/.next/server/app/settings/brand.html +2 -2
  263. package/.next/standalone/.next/server/app/settings/brand.rsc +3 -3
  264. package/.next/standalone/.next/server/app/settings/connectors/page_client-reference-manifest.js +1 -1
  265. package/.next/standalone/.next/server/app/settings/engines/page_client-reference-manifest.js +1 -1
  266. package/.next/standalone/.next/server/app/settings/onboarding/page.js +1 -1
  267. package/.next/standalone/.next/server/app/settings/onboarding/page_client-reference-manifest.js +1 -1
  268. package/.next/standalone/.next/server/app/settings/onboarding.html +2 -2
  269. package/.next/standalone/.next/server/app/settings/onboarding.rsc +3 -3
  270. package/.next/standalone/.next/server/app/settings/organization/page.js +2 -2
  271. package/.next/standalone/.next/server/app/settings/organization/page.js.nft.json +1 -1
  272. package/.next/standalone/.next/server/app/settings/organization/page_client-reference-manifest.js +1 -1
  273. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  274. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  275. package/.next/standalone/.next/server/app/settings/runtime/page.js +1 -1
  276. package/.next/standalone/.next/server/app/settings/runtime/page_client-reference-manifest.js +1 -1
  277. package/.next/standalone/.next/server/app/settings/team/page.js +1 -1
  278. package/.next/standalone/.next/server/app/settings/team/page_client-reference-manifest.js +1 -1
  279. package/.next/standalone/.next/server/app/settings/tools/page_client-reference-manifest.js +1 -1
  280. package/.next/standalone/.next/server/app/settings.html +2 -2
  281. package/.next/standalone/.next/server/app/settings.rsc +3 -3
  282. package/.next/standalone/.next/server/app/share/[token]/page_client-reference-manifest.js +1 -1
  283. package/.next/standalone/.next/server/app/share/space/[token]/page_client-reference-manifest.js +1 -1
  284. package/.next/standalone/.next/server/app/tasks/[id]/page.js +2 -2
  285. package/.next/standalone/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  286. package/.next/standalone/.next/server/app/tasks/page.js +2 -2
  287. package/.next/standalone/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  288. package/.next/standalone/.next/server/app/team/[agentId]/page_client-reference-manifest.js +1 -1
  289. package/.next/standalone/.next/server/app/team/page_client-reference-manifest.js +1 -1
  290. package/.next/standalone/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  291. package/.next/standalone/.next/server/app/whatsapp/page_client-reference-manifest.js +1 -1
  292. package/.next/standalone/.next/server/app/whatsapp.html +1 -1
  293. package/.next/standalone/.next/server/app/whatsapp.rsc +2 -2
  294. package/.next/standalone/.next/server/app/workflows/[caseId]/page_client-reference-manifest.js +1 -1
  295. package/.next/standalone/.next/server/app/workflows/new/[caseId]/page_client-reference-manifest.js +1 -1
  296. package/.next/standalone/.next/server/app/workflows/new/definition/page_client-reference-manifest.js +1 -1
  297. package/.next/standalone/.next/server/app/workflows/page_client-reference-manifest.js +1 -1
  298. package/.next/standalone/.next/server/app/workflows/share/[caseId]/page_client-reference-manifest.js +1 -1
  299. package/.next/standalone/.next/server/app-paths-manifest.json +81 -81
  300. package/.next/standalone/.next/server/chunks/1648.js +1 -1
  301. package/.next/standalone/.next/server/chunks/1699.js +39 -22
  302. package/.next/standalone/.next/server/chunks/3230.js +2 -2
  303. package/.next/standalone/.next/server/chunks/5093.js +1 -0
  304. package/.next/standalone/.next/server/chunks/5864.js +1 -0
  305. package/.next/standalone/.next/server/chunks/{9801.js → 7500.js} +1 -1
  306. package/.next/standalone/.next/server/functions-config-manifest.json +42 -42
  307. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  308. package/.next/standalone/.next/server/pages/404.html +1 -1
  309. package/.next/standalone/.next/server/pages/500.html +1 -1
  310. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  311. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  312. package/.next/standalone/.next/static/chunks/7695-04c7f1a5233de027.js +1 -0
  313. package/.next/standalone/.next/static/chunks/app/agents/[id]/page-474f640e84f7b4b5.js +1 -0
  314. package/.next/standalone/.next/static/chunks/app/agents/page-b79b611acd56712b.js +1 -0
  315. package/.next/standalone/.next/static/chunks/app/marketplace/page-0b7d3a6309302de3.js +1 -0
  316. package/.next/standalone/.next/static/chunks/app/projects/page-e1cfb0b17418e719.js +1 -0
  317. package/.next/standalone/.next/static/chunks/app/settings/layout-08f6b30132b26dd1.js +1 -0
  318. package/.next/standalone/.next/static/chunks/app/settings/team/page-9a2e675124de6aac.js +1 -0
  319. package/.next/standalone/.next/static/css/{65c472079b6fd086.css → 9fbf057b7ce95c36.css} +1 -1
  320. package/.next/standalone/CHANGELOG.md +14 -0
  321. package/.next/standalone/data/.artifacts-migrated-v1 +1 -1
  322. package/.next/standalone/data/.default-project-seeded +1 -1
  323. package/.next/standalone/data/madarx.sqlite +0 -0
  324. package/.next/standalone/data/madarx.sqlite-shm +0 -0
  325. package/.next/standalone/data/madarx.sqlite-wal +0 -0
  326. package/.next/standalone/package.json +1 -1
  327. package/.next/static/chunks/7695-04c7f1a5233de027.js +1 -0
  328. package/.next/static/chunks/app/agents/[id]/page-474f640e84f7b4b5.js +1 -0
  329. package/.next/static/chunks/app/agents/page-b79b611acd56712b.js +1 -0
  330. package/.next/static/chunks/app/marketplace/page-0b7d3a6309302de3.js +1 -0
  331. package/.next/static/chunks/app/projects/page-e1cfb0b17418e719.js +1 -0
  332. package/.next/static/chunks/app/settings/layout-08f6b30132b26dd1.js +1 -0
  333. package/.next/static/chunks/app/settings/team/page-9a2e675124de6aac.js +1 -0
  334. package/.next/static/css/{65c472079b6fd086.css → 9fbf057b7ce95c36.css} +1 -1
  335. package/CHANGELOG.md +14 -0
  336. package/app/agents/[id]/agent-activity-feed.tsx +96 -0
  337. package/app/agents/[id]/agent-detail-simple.tsx +71 -83
  338. package/app/agents/[id]/agent-quick-controls.tsx +497 -0
  339. package/app/agents/[id]/page.js +90 -2
  340. package/app/api/connections/[service]/verify/route.js +17 -2
  341. package/app/globals.css +347 -32
  342. package/lib/agent-templates.js +12 -0
  343. package/lib/connection-grant.js +106 -0
  344. package/lib/connection-seeds.js +126 -0
  345. package/lib/connections/health-check-verify.js +114 -0
  346. package/lib/connections/manifest-validator.js +161 -0
  347. package/lib/marketplace-modules.js +45 -0
  348. package/lib/marketplace-seeds.js +105 -0
  349. package/lib/marketplace.js +1 -0
  350. package/lib/oauth/flow.js +204 -0
  351. package/lib/oauth/provider-registry.js +102 -0
  352. package/lib/runtime.js +74 -1
  353. package/lib/schema.js +17 -0
  354. package/lib/tools/adapters/http-api-call.js +92 -28
  355. package/lib/tools/connectors/connector-validator.js +27 -1
  356. package/package.json +1 -1
  357. package/.next/standalone/.next/server/chunks/1887.js +0 -2
  358. package/.next/standalone/.next/server/chunks/3711.js +0 -1
  359. package/.next/standalone/.next/server/chunks/6098.js +0 -1
  360. package/.next/standalone/.next/static/chunks/9077-f54ea987eb597e43.js +0 -1
  361. package/.next/standalone/.next/static/chunks/app/agents/[id]/page-66477263de089865.js +0 -1
  362. package/.next/standalone/.next/static/chunks/app/agents/page-64d6bdc6ba3ad4d7.js +0 -1
  363. package/.next/standalone/.next/static/chunks/app/marketplace/page-45c6d49f8eddad67.js +0 -1
  364. package/.next/standalone/.next/static/chunks/app/projects/page-15a7a85fa216b575.js +0 -1
  365. package/.next/standalone/.next/static/chunks/app/settings/layout-2c1e6807acb6fdad.js +0 -1
  366. package/.next/standalone/.next/static/chunks/app/settings/team/page-0aee40dfa9e7a430.js +0 -1
  367. package/.next/static/chunks/9077-f54ea987eb597e43.js +0 -1
  368. package/.next/static/chunks/app/agents/[id]/page-66477263de089865.js +0 -1
  369. package/.next/static/chunks/app/agents/page-64d6bdc6ba3ad4d7.js +0 -1
  370. package/.next/static/chunks/app/marketplace/page-45c6d49f8eddad67.js +0 -1
  371. package/.next/static/chunks/app/projects/page-15a7a85fa216b575.js +0 -1
  372. package/.next/static/chunks/app/settings/layout-2c1e6807acb6fdad.js +0 -1
  373. package/.next/static/chunks/app/settings/team/page-0aee40dfa9e7a430.js +0 -1
  374. /package/.next/standalone/.next/static/{JcJc6PlL89SQvtZvP-LnU → JGJBLnQfb05RAKCcECbJt}/_buildManifest.js +0 -0
  375. /package/.next/standalone/.next/static/{JcJc6PlL89SQvtZvP-LnU → JGJBLnQfb05RAKCcECbJt}/_ssgManifest.js +0 -0
  376. /package/.next/static/{JcJc6PlL89SQvtZvP-LnU → JGJBLnQfb05RAKCcECbJt}/_buildManifest.js +0 -0
  377. /package/.next/static/{JcJc6PlL89SQvtZvP-LnU → JGJBLnQfb05RAKCcECbJt}/_ssgManifest.js +0 -0
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to Madarx OS. Newest first.
4
4
 
5
+ ## [2.16.0] - 2026-06-05
6
+
7
+ ### Added
8
+
9
+ - **Edit an agent without leaving the simple page.** The `/agents/[id]` overview now lets you change the destination space, the engine + model, the schedule, and the toolset inline. Each control is a card with a pencil that opens a calm editor drawer (one at a time), so non-technical owners can retune an agent without opening Configuration.
10
+ - **Plain-English schedule editor.** Pick On demand / Hourly / Daily / Weekly / Monthly with a time and day picker and a live preview ("Runs daily at 7:30 AM"), with an Advanced field for raw expressions like `every 5m`.
11
+ - **Tools as icons + a simple picker.** The agent's tools show as brand icons (the same vocabulary as the agents grid). The picker is searchable, grouped by category, and tags tools that need approval or setup. Adding a tool enables it for real (read-only → auto, write/send → approval-required) while deep per-tool permission modes stay in Configuration.
12
+ - **Searchable activity feed.** Recent activity now merges executions and approvals into one list you can filter by text.
13
+ - **Business agent marketplace foundation.** Connection-kind marketplace items plus the connections layer that backs them: OAuth2 connector auth with automatic access-token refresh on expiry (refreshed tokens re-stored in the vault, never logged), a generic manifest-driven "Test connection" health-check verifier so any OAuth/Tool-Smith connection with a declared `health_check` works with no route edits, connection-manifest validation, and a `grantConnectionToAgents` path for handing a verified connection to agents at the right default risk mode.
14
+
15
+ ### Changed
16
+
17
+ - The Simple/Details toggle is gone — the **Configuration** button is the single way into the advanced view, and the details view links back to the agent.
18
+
5
19
  ## [2.15.1] - 2026-06-04
6
20
 
7
21
  ### Changed
@@ -1,4 +1,4 @@
1
- 2026-06-04T19:26:14.771Z
1
+ 2026-06-04T22:37:49.159Z
2
2
  {
3
3
  "moved": 0,
4
4
  "rewritten": 0,
@@ -1 +1 @@
1
- 2026-06-04T19:26:14.769Z
1
+ 2026-06-04T22:37:49.156Z
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "madarx",
3
- "version": "2.15.1",
3
+ "version": "2.16.0",
4
4
  "type": "module",
5
5
  "description": "Madarx OS — Next.js product with SQLite-backed runtime, scheduled cron daemon, and approval-gated local runners.",
6
6
  "license": "MIT",
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7695],{45:(e,t,r)=>{r.d(t,{default:()=>s});var l=r(12115),n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},o=r(64250);let i=(0,l.createContext)({}),s=(0,l.forwardRef)((e,t)=>{var r,s,c;let{color:a,size:h,strokeWidth:d,absoluteStrokeWidth:u,className:x="",children:j,iconNode:f,...v}=e,{size:p=24,strokeWidth:k=2,absoluteStrokeWidth:g=!1,color:C="currentColor",className:m=""}=null!=(r=(0,l.useContext)(i))?r:{},w=(null!=u?u:g)?24*Number(null!=d?d:k)/Number(null!=h?h:p):null!=d?d:k;return(0,l.createElement)("svg",{ref:t,...n,width:null!=(s=null!=h?h:p)?s:n.width,height:null!=(c=null!=h?h:p)?c:n.height,stroke:null!=a?a:C,strokeWidth:w,className:(0,o.z)("lucide",m,x),...!j&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(v)&&{"aria-hidden":"true"},...v},[...f.map(e=>{let[t,r]=e;return(0,l.createElement)(t,r)}),...Array.isArray(j)?j:[j]])})},10677:(e,t,r)=>{r.d(t,{default:()=>o});var l=r(95155),n=r(12115);function o(){let[e,t]=(0,n.useState)([]),[r,o]=(0,n.useState)("");return(0,n.useEffect)(()=>{o(localStorage.getItem("madarx.activeProjectId")||""),fetch("/api/projects").then(e=>e.json()).then(e=>t(e.projects||[])).catch(()=>{})},[]),(0,l.jsx)("div",{className:"project-switcher","data-project-switcher":!0,children:(0,l.jsxs)("select",{value:r,onChange:e=>{var t;o(t=e.target.value),t?localStorage.setItem("madarx.activeProjectId",t):localStorage.removeItem("madarx.activeProjectId"),window.dispatchEvent(new CustomEvent("madarx:project-change",{detail:{project_id:t||null}}))},"aria-label":"Active project",children:[(0,l.jsx)("option",{value:"",children:"All projects"}),e.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})})}},13185:(e,t,r)=>{r.d(t,{A:()=>s});var l=r(12115),n=r(64250);let o=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var i=r(45);let s=(e,t)=>{let r=(0,l.forwardRef)((r,s)=>{let{className:c,...a}=r;return(0,l.createElement)(i.default,{ref:s,iconNode:t,className:(0,n.z)("lucide-".concat(o(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),c),...a})});return r.displayName=o(e),r}},34788:(e,t,r)=>{r.d(t,{A:()=>l});let l=(0,r(13185).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},44304:(e,t,r)=>{r.d(t,{IU:()=>d,S8:()=>s,si:()=>a,y2:()=>c});var l=r(95155);r(12115);let n=e=>({width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0}),o={github:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsx)("svg",{...n(t),...r,children:(0,l.jsx)("path",{fill:"currentColor",d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.92.57.1.78-.25.78-.55v-1.93c-3.2.69-3.87-1.54-3.87-1.54-.52-1.32-1.28-1.67-1.28-1.67-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.19 1.18.92-.26 1.91-.39 2.9-.39s1.98.13 2.9.39c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.69 5.41-5.26 5.69.41.36.77 1.06.77 2.13v3.16c0 .31.21.66.79.55C20.21 21.38 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5Z"})})},label:"GitHub",tint:"#181717"},supabase:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,children:[(0,l.jsx)("defs",{children:(0,l.jsxs)("linearGradient",{id:"sb-a",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,l.jsx)("stop",{offset:"0",stopColor:"#3ECF8E"}),(0,l.jsx)("stop",{offset:"1",stopColor:"#249361"})]})}),(0,l.jsx)("path",{fill:"url(#sb-a)",d:"M13.4 22.6c-.6.8-1.9.3-1.9-.7v-7.4H5.8c-1 0-1.5-1.1-.9-1.9L10.6 1.4c.6-.8 1.9-.3 1.9.7v7.4h5.7c1 0 1.5 1.1.9 1.9L13.4 22.6Z"})]})},label:"Supabase",tint:"#3ECF8E"},vercel:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsx)("svg",{...n(t),...r,children:(0,l.jsx)("path",{fill:"currentColor",d:"M12 2 22 20H2L12 2Z"})})},label:"Vercel",tint:"#111318"},email:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsx)("svg",{...n(t),...r,children:(0,l.jsx)("path",{fill:"currentColor",d:"M3 3h7.5c2.9 0 5 1.9 5 4.7 0 1.9-1 3.4-2.7 4.1l3.7 5.5c.4.6 0 1.5-.8 1.5h-2c-.4 0-.8-.2-1-.5l-3.3-5.1H7v4.6c0 .5-.4 1-1 1H4c-.6 0-1-.5-1-1V3Zm4 6.2h3.3c1.3 0 2.1-.7 2.1-1.8s-.8-1.7-2.1-1.7H7v3.5Z"})})},label:"Resend",tint:"#111318"},gmail:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,children:[(0,l.jsx)("path",{fill:"#4285F4",d:"M2 6.5C2 5.7 2.7 5 3.5 5h.7L12 11l7.8-6h.7c.8 0 1.5.7 1.5 1.5V18c0 .8-.7 1.5-1.5 1.5h-2V10l-6.5 5L5 10v9.5H3.5C2.7 19.5 2 18.8 2 18V6.5Z"}),(0,l.jsx)("path",{fill:"#34A853",d:"M5 10v9.5H3.5C2.7 19.5 2 18.8 2 18V6.5L5 10Z"}),(0,l.jsx)("path",{fill:"#FBBC04",d:"M22 6.5V18c0 .8-.7 1.5-1.5 1.5H19V10l3-3.5Z"}),(0,l.jsx)("path",{fill:"#EA4335",d:"M2 6.5C2 5.7 2.7 5 3.5 5h.7L12 11 4.2 5h-.7C2.7 5 2 5.7 2 6.5Z"})]})},label:"Gmail",tint:"#EA4335"},web:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,l.jsx)("path",{d:"M3 12h18M12 3a13 13 0 010 18M12 3a13 13 0 000 18"})]})},label:"Web",tint:"#5A7099"},local_machine:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("rect",{x:"2.5",y:"4.5",width:"19",height:"15",rx:"2.5"}),(0,l.jsx)("path",{d:"m7 10 3 2-3 2M13 14h4"})]})},label:"Local",tint:"#1f242c"},travel:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsx)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:(0,l.jsx)("path",{d:"M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9l-8 5v2l8-2.5V18l-2 1.5V21l3.5-1L15 21v-1.5L13 18v-4.5l8 2.5Z"})})},label:"Travel",tint:"#2563EB"},calendar:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("rect",{x:"3.5",y:"5",width:"17",height:"15",rx:"2"}),(0,l.jsx)("path",{d:"M3.5 10h17M8 3v4M16 3v4"})]})},label:"Calendar",tint:"#1f6c9f"},core:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),(0,l.jsx)("rect",{x:"9.5",y:"9.5",width:"5",height:"5"}),(0,l.jsx)("path",{d:"M9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3"})]})},label:"Core",tint:"#3a3f47"}},i={"claude-code":{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsx)("svg",{...n(t),...r,children:(0,l.jsx)("path",{fill:"#D97757",d:"M5.9 16.6 9.4 8.6h.7l3.5 8h-1.6l-.9-2.2h-3l-.9 2.2H5.9Zm3-3.5h2.2l-1.1-2.7-1.1 2.7Zm5.8 3.5v-8h2.6c1.6 0 2.7 1 2.7 2.5 0 1.6-1.1 2.5-2.7 2.5h-1v3h-1.6Zm1.6-4.4h.9c.8 0 1.3-.4 1.3-1.1 0-.7-.5-1.1-1.3-1.1h-.9v2.2Z"})})},label:"Claude Code",tint:"#D97757"},anthropic:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsx)("svg",{...n(t),...r,children:(0,l.jsx)("path",{fill:"currentColor",d:"M6 19 11 5h2l5 14h-2.3l-1.1-3.2H9.4L8.3 19H6Zm4-5h4l-2-5.9-2 5.9Z"})})},label:"Anthropic",tint:"#1f1a12"},ollama:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("path",{d:"M12 3c4 0 7 3.5 7 8v4a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3v-4c0-4.5 3-8 7-8Z"}),(0,l.jsx)("circle",{cx:"9.5",cy:"11.5",r:"1",fill:"currentColor"}),(0,l.jsx)("circle",{cx:"14.5",cy:"11.5",r:"1",fill:"currentColor"})]})},label:"Ollama",tint:"#1f242c"}};function s(e){return e&&o[e]||null}function c(e){return e&&i[e]||null}function a(e){let{category:t,size:r=14,className:n}=e,o=s(t);if(!o)return null;let{Icon:i,tint:c}=o;return(0,l.jsx)(i,{size:r,className:n,style:{color:c}})}let h={skill:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("path",{d:"M4 5.5A1.5 1.5 0 0 1 5.5 4H11v15H5.5A1.5 1.5 0 0 1 4 17.5v-12Z"}),(0,l.jsx)("path",{d:"M20 5.5A1.5 1.5 0 0 0 18.5 4H13v15h5.5a1.5 1.5 0 0 0 1.5-1.5v-12Z"}),(0,l.jsx)("path",{d:"M7 8h1.5M7 11h1.5M15.5 8H17M15.5 11H17"})]})},label:"Skill"},bundle:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("rect",{x:"3.5",y:"3.5",width:"9",height:"9",rx:"2"}),(0,l.jsx)("rect",{x:"11.5",y:"11.5",width:"9",height:"9",rx:"2"}),(0,l.jsx)("rect",{x:"7.5",y:"7.5",width:"9",height:"9",rx:"2"})]})},label:"Bundle"},agent:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("circle",{cx:"12",cy:"8",r:"3.5"}),(0,l.jsx)("path",{d:"M4.5 20c.7-3.8 3.8-6 7.5-6s6.8 2.2 7.5 6"})]})},label:"Agent"},workflow:{Icon:function(e){let{size:t=16,...r}=e;return(0,l.jsxs)("svg",{...n(t),...r,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("rect",{x:"3",y:"9",width:"5",height:"6",rx:"1.4"}),(0,l.jsx)("rect",{x:"9.5",y:"9",width:"5",height:"6",rx:"1.4"}),(0,l.jsx)("rect",{x:"16",y:"9",width:"5",height:"6",rx:"1.4"}),(0,l.jsx)("path",{d:"M8 12h1.5M14.5 12H16"})]})},label:"Workflow"}};function d(e){let{kind:t,size:r=18,className:n}=e,o=h[t];if(!o)return null;let{Icon:i}=o;return(0,l.jsx)(i,{size:r,className:n})}},64250:(e,t,r)=>{r.d(t,{z:()=>l});let l=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3969],{29084:(e,a,t)=>{"use strict";t.d(a,{AgentQuickControls:()=>m});var n=t(95155),s=t(12115),l=t(88977),d=t(78129),i=t(34788),c=t(37230),r=t(81115),o=t(44304),u=t(84705);function m(e){var a,t;let{agentId:d,engine:i,model:c,engines:m,scheduleRaw:y,lastRun:j,statusLabel:f,statusTone:N,defaultSpaceId:b,spaces:g,agentTools:w,availableTools:k,toolCategories:C,updateModelAction:S,updateScheduleAction:A,updateToolsAction:_,updateDefaultSpaceAction:M}=e,[R,q]=(0,s.useState)(null),L=e=>q(a=>a===e?null:e),z=(null==(a=m.find(e=>e.id===i))?void 0:a.label)||i||"—",T=c||"default",P=(null==(t=g.find(e=>e.id===b))?void 0:t.name)||"Active space (default)";return(0,n.jsxs)("div",{className:"ad-controls",children:[(0,n.jsxs)("div",{className:"ad-facts",children:[(0,n.jsx)(h,{label:"Publish artifacts to",value:P,active:"publish"===R,onClick:()=>L("publish")}),(0,n.jsx)(h,{label:"Model",value:"".concat(z," \xb7 ").concat(T),active:"model"===R,onClick:()=>L("model")}),(0,n.jsx)(h,{label:"Schedule",value:(0,u.NU)(y),active:"schedule"===R,onClick:()=>L("schedule")}),(0,n.jsxs)("div",{className:"ad-fact ad-fact--static",children:[(0,n.jsx)("span",{className:"ad-fact-label",children:"Last run"}),(0,n.jsx)("span",{className:"ad-fact-value",children:j||"Never run yet"})]}),(0,n.jsxs)("div",{className:"ad-fact ad-fact--static",children:[(0,n.jsx)("span",{className:"ad-fact-label",children:"Status"}),(0,n.jsxs)("span",{className:"ad-fact-value ad-fact-status tone-".concat(N),children:[(0,n.jsx)("span",{className:"ad-dot","aria-hidden":!0}),f]})]})]}),(0,n.jsxs)("div",{className:"ad-tools-strip",children:[(0,n.jsx)("span",{className:"ad-fact-label",children:"Tools"}),(0,n.jsx)("div",{className:"ad-tools-icons",children:C.length?C.slice(0,10).map(e=>{let a=(0,o.S8)(e);return(0,n.jsx)("span",{className:"ad-tool-chip",title:(null==a?void 0:a.label)||e,children:(0,n.jsx)(o.si,{category:e,size:14})},e)}):(0,n.jsx)("span",{className:"ad-tools-empty",children:"No tools yet"})}),(0,n.jsxs)("button",{type:"button",className:"admin-button secondary ad-edit-btn ".concat("tools"===R?"on":""),onClick:()=>L("tools"),children:[(0,n.jsx)(l.A,{size:13}),w.length?"Edit tools":"Add tools"]})]}),(0,n.jsx)("div",{className:"ad-drawer","data-open":R?"true":"false",children:(0,n.jsxs)("div",{className:"ad-drawer-inner",children:["publish"===R?(0,n.jsx)(p,{title:"Where artifacts are saved",onClose:()=>q(null),children:(0,n.jsxs)("form",{action:M,className:"ad-editor-form",children:[(0,n.jsx)("input",{type:"hidden",name:"agent_id",value:d}),(0,n.jsxs)("label",{className:"ad-field",children:[(0,n.jsx)("span",{children:"Publish artifacts to"}),(0,n.jsxs)("select",{name:"default_space_id",defaultValue:b||"",className:"admin-input",children:[(0,n.jsx)("option",{value:"",children:"Active space (default)"}),g.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,n.jsxs)("div",{className:"ad-editor-actions",children:[(0,n.jsx)("button",{type:"submit",className:"admin-button",children:"Save destination"}),(0,n.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>q(null),children:"Cancel"})]})]})}):null,"model"===R?(0,n.jsx)(p,{title:"Choose the model",onClose:()=>q(null),children:(0,n.jsxs)("form",{action:S,className:"ad-editor-form",children:[(0,n.jsx)("input",{type:"hidden",name:"agent_id",value:d}),(0,n.jsx)("div",{className:"ad-editor-row",children:(0,n.jsx)(r.default,{engines:m,initialEngine:i,initialModel:c||""})}),(0,n.jsxs)("div",{className:"ad-editor-actions",children:[(0,n.jsx)("button",{type:"submit",className:"admin-button",children:"Save model"}),(0,n.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>q(null),children:"Cancel"})]})]})}):null,"schedule"===R?(0,n.jsx)(p,{title:"Set the schedule",onClose:()=>q(null),children:(0,n.jsx)(v,{agentId:d,initial:y,action:A,onCancel:()=>q(null)})}):null,"tools"===R?(0,n.jsx)(p,{title:"Pick this agent's tools",onClose:()=>q(null),children:(0,n.jsx)(x,{agentId:d,selected:w,tools:k,action:_,onCancel:()=>q(null)})}):null]})})]})}function h(e){let{label:a,value:t,active:s,onClick:l}=e;return(0,n.jsxs)("button",{type:"button",className:"ad-fact ad-fact--edit ".concat(s?"is-active":""),onClick:l,"aria-expanded":s,children:[(0,n.jsx)("span",{className:"ad-fact-label",children:a}),(0,n.jsx)("span",{className:"ad-fact-value",children:t}),(0,n.jsx)("span",{className:"ad-fact-edit","aria-hidden":!0,children:(0,n.jsx)(d.A,{size:12})})]})}function p(e){let{title:a,onClose:t,children:s}=e;return(0,n.jsxs)("section",{className:"ad-editor",children:[(0,n.jsxs)("header",{className:"ad-editor-head",children:[(0,n.jsx)("h3",{children:a}),(0,n.jsx)("button",{type:"button",className:"ad-editor-close","aria-label":"Close",onClick:t,children:(0,n.jsx)(i.A,{size:14})})]}),s]})}let y=[["mon","Monday"],["tue","Tuesday"],["wed","Wednesday"],["thu","Thursday"],["fri","Friday"],["sat","Saturday"],["sun","Sunday"]];function v(e){let{agentId:a,initial:t,action:l,onCancel:d}=e,[i,c]=(0,s.useState)(()=>(function(e){let a,t=String(e||"").trim().toLowerCase(),n={freq:"ondemand",time:"09:00",day:"mon",dom:"1",everyN:1,advanced:t};return!t||["on demand","manual","event based","live"].includes(t)?n:(a=t.match(/^every\s+(\d+)\s*h$/))?{...n,freq:"hourly",everyN:Number(a[1])}:(a=t.match(/^daily\s+(\d{1,2}):(\d{2})$/))?{...n,freq:"daily",time:"".concat(a[1].padStart(2,"0"),":").concat(a[2])}:(a=t.match(/^weekly\s+(\w+)\s+(\d{1,2}):(\d{2})$/))?{...n,freq:"weekly",day:a[1].slice(0,3),time:"".concat(a[2].padStart(2,"0"),":").concat(a[3])}:(a=t.match(/^monthly\s+(last|\d{1,2})\s+(\d{1,2}):(\d{2})$/))?{...n,freq:"monthly",dom:a[1],time:"".concat(a[2].padStart(2,"0"),":").concat(a[3])}:{...n,freq:"advanced",advanced:t}})(t)),r=e=>c(a=>({...a,...e})),o=function(e){switch(e.freq){case"ondemand":return"on demand";case"hourly":return"every ".concat(Math.max(1,e.everyN),"h");case"daily":return"daily ".concat(e.time);case"weekly":return"weekly ".concat(e.day," ").concat(e.time);case"monthly":return"monthly ".concat(e.dom," ").concat(e.time);case"advanced":return e.advanced.trim()||"on demand"}}(i);return(0,n.jsxs)("form",{action:l,className:"ad-editor-form",children:[(0,n.jsx)("input",{type:"hidden",name:"agent_id",value:a}),(0,n.jsx)("input",{type:"hidden",name:"schedule",value:o}),(0,n.jsxs)("div",{className:"ad-sched-grid",children:[(0,n.jsxs)("label",{className:"ad-field",children:[(0,n.jsx)("span",{children:"Frequency"}),(0,n.jsxs)("select",{value:i.freq,onChange:e=>r({freq:e.target.value}),className:"admin-input",children:[(0,n.jsx)("option",{value:"ondemand",children:"On demand"}),(0,n.jsx)("option",{value:"hourly",children:"Hourly"}),(0,n.jsx)("option",{value:"daily",children:"Daily"}),(0,n.jsx)("option",{value:"weekly",children:"Weekly"}),(0,n.jsx)("option",{value:"monthly",children:"Monthly"}),(0,n.jsx)("option",{value:"advanced",children:"Advanced…"})]})]}),"hourly"===i.freq?(0,n.jsxs)("label",{className:"ad-field",children:[(0,n.jsx)("span",{children:"Every"}),(0,n.jsxs)("span",{className:"ad-inline-num",children:[(0,n.jsx)("input",{type:"number",min:1,max:24,value:i.everyN,onChange:e=>r({everyN:Number(e.target.value)}),className:"admin-input"}),(0,n.jsx)("em",{children:"hours"})]})]}):null,"daily"===i.freq||"weekly"===i.freq||"monthly"===i.freq?(0,n.jsxs)("label",{className:"ad-field",children:[(0,n.jsx)("span",{children:"At"}),(0,n.jsx)("input",{type:"time",value:i.time,onChange:e=>r({time:e.target.value}),className:"admin-input"})]}):null,"weekly"===i.freq?(0,n.jsxs)("label",{className:"ad-field",children:[(0,n.jsx)("span",{children:"On"}),(0,n.jsx)("select",{value:i.day,onChange:e=>r({day:e.target.value}),className:"admin-input",children:y.map(e=>{let[a,t]=e;return(0,n.jsx)("option",{value:a,children:t},a)})})]}):null,"monthly"===i.freq?(0,n.jsxs)("label",{className:"ad-field",children:[(0,n.jsx)("span",{children:"Day"}),(0,n.jsxs)("select",{value:i.dom,onChange:e=>r({dom:e.target.value}),className:"admin-input",children:[Array.from({length:28},(e,a)=>String(a+1)).map(e=>(0,n.jsx)("option",{value:e,children:e},e)),(0,n.jsx)("option",{value:"last",children:"Last day"})]})]}):null,"advanced"===i.freq?(0,n.jsxs)("label",{className:"ad-field ad-field--wide",children:[(0,n.jsx)("span",{children:"Schedule expression"}),(0,n.jsx)("input",{type:"text",value:i.advanced,onChange:e=>r({advanced:e.target.value}),placeholder:"e.g. every 5m \xb7 daily 07:30 \xb7 weekly fri 17:00",className:"admin-input"})]}):null]}),(0,n.jsx)("p",{className:"ad-sched-preview",children:(0,u.NU)(o)}),(0,n.jsxs)("div",{className:"ad-editor-actions",children:[(0,n.jsx)("button",{type:"submit",className:"admin-button",children:"Save schedule"}),(0,n.jsx)("button",{type:"button",className:"admin-button secondary",onClick:d,children:"Cancel"})]})]})}function x(e){let{agentId:a,selected:t,tools:l,action:d,onCancel:i}=e,[r,u]=(0,s.useState)(()=>new Set(t)),[m,h]=(0,s.useState)(""),p=(0,s.useMemo)(()=>{let e=m.trim().toLowerCase(),a=new Map;for(let t of l){if(!(!e||t.title.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))&&!r.has(t.name))continue;let n=t.category||"core";a.has(n)||a.set(n,[]),a.get(n).push(t)}return[...a.entries()].sort((e,a)=>e[0].localeCompare(a[0]))},[l,m,r]);return(0,n.jsxs)("form",{action:d,className:"ad-editor-form",children:[(0,n.jsx)("input",{type:"hidden",name:"agent_id",value:a}),[...r].map(e=>(0,n.jsx)("input",{type:"hidden",name:"tool",value:e},e)),(0,n.jsxs)("div",{className:"ad-tools-search",children:[(0,n.jsx)(c.A,{size:14,"aria-hidden":!0}),(0,n.jsx)("input",{type:"text",value:m,onChange:e=>h(e.target.value),placeholder:"Search tools","aria-label":"Search tools"}),(0,n.jsxs)("span",{className:"ad-tools-count",children:[r.size," selected"]})]}),(0,n.jsx)("div",{className:"ad-tools-groups",children:p.length?p.map(e=>{let[a,t]=e,s=(0,o.S8)(a);return(0,n.jsxs)("div",{className:"ad-tools-group",children:[(0,n.jsxs)("div",{className:"ad-tools-group-head",children:[(0,n.jsx)(o.si,{category:a,size:13}),(0,n.jsx)("span",{children:(null==s?void 0:s.label)||a})]}),(0,n.jsx)("div",{className:"ad-tools-options",children:t.map(e=>{let a=r.has(e.name),t=!e.available;return(0,n.jsxs)("button",{type:"button",className:"ad-tool-option ".concat(a?"is-on":""),onClick:()=>{let a;return a=e.name,u(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},title:e.description,"aria-pressed":a,children:[(0,n.jsx)("span",{className:"ad-tool-option-name",children:e.title}),"low"!==e.risk_level?(0,n.jsx)("span",{className:"ad-tool-tag",children:"approval"}):null,t?(0,n.jsx)("span",{className:"ad-tool-tag warn",children:"setup"}):null]},e.name)})})]},a)}):(0,n.jsxs)("p",{className:"ad-tools-noresult",children:["No tools match “",m,"”."]})}),(0,n.jsxs)("div",{className:"ad-editor-actions",children:[(0,n.jsx)("button",{type:"submit",className:"admin-button",children:"Save tools"}),(0,n.jsx)("button",{type:"button",className:"admin-button secondary",onClick:i,children:"Cancel"})]})]})}},35564:(e,a,t)=>{Promise.resolve().then(t.bind(t,62395)),Promise.resolve().then(t.bind(t,29084)),Promise.resolve().then(t.bind(t,72606)),Promise.resolve().then(t.bind(t,81115)),Promise.resolve().then(t.bind(t,10677)),Promise.resolve().then(t.t.bind(t,52619,23))},37230:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(13185).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},62395:(e,a,t)=>{"use strict";t.d(a,{AgentActivityFeed:()=>o});var n=t(95155),s=t(12115),l=t(37230),d=t(13185);let i=(0,d.A)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),c=(0,d.A)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var r=t(84705);function o(e){let{items:a}=e,[t,d]=(0,s.useState)(""),o=(0,s.useMemo)(()=>{let e=t.trim().toLowerCase();return e?a.filter(a=>a.title.toLowerCase().includes(e)||a.status.toLowerCase().includes(e)||a.kind.includes(e)):a},[a,t]);return(0,n.jsxs)("section",{className:"ad-activity",children:[(0,n.jsxs)("div",{className:"ad-activity-head",children:[(0,n.jsx)("span",{className:"ad-activity-title",children:"Recent activity"}),a.length?(0,n.jsxs)("label",{className:"ad-activity-search",children:[(0,n.jsx)(l.A,{size:13,"aria-hidden":!0}),(0,n.jsx)("input",{type:"text",value:t,onChange:e=>d(e.target.value),placeholder:"Search runs & approvals","aria-label":"Search activity"})]}):null]}),o.length?(0,n.jsx)("ul",{className:"ad-feed",children:o.map(e=>{var a;let t=function(e){let a=String(e||"").toLowerCase();return a.includes("complete")||a.includes("ok")||"approved"===a?"ok":a.includes("wait")||a.includes("approval")||"pending"===a||a.includes("queue")?"warn":a.includes("fail")||a.includes("error")||a.includes("denied")||a.includes("block")?"bad":"neutral"}(e.status);return(0,n.jsxs)("li",{className:"ad-feed-row",children:[(0,n.jsx)("span",{className:"ad-feed-icon kind-".concat(e.kind),"aria-hidden":!0,children:"approval"===e.kind?(0,n.jsx)(i,{size:14}):(0,n.jsx)(c,{size:13})}),(0,n.jsxs)("span",{className:"ad-feed-main",children:[(0,n.jsx)("span",{className:"ad-feed-title",children:e.title}),(0,n.jsxs)("span",{className:"ad-feed-meta",children:["approval"===e.kind?"Approval":"Run",e.risk&&"low"!==e.risk?" \xb7 ".concat(e.risk," risk"):""]})]}),(0,n.jsx)("span",{className:"ad-feed-status tone-".concat(t),children:"approval"===(a=e).kind?"used"===a.status.toLowerCase()?"Approved":a.status?a.status.charAt(0).toUpperCase()+a.status.slice(1):"Pending":(0,r.Tk)(a.status)}),(0,n.jsx)("span",{className:"ad-feed-when",children:(0,r.fw)(e.at)||"—"})]},e.id)})}):a.length?(0,n.jsxs)("div",{className:"ad-feed-empty",children:["No activity matches “",t,"”."]}):(0,n.jsxs)("div",{className:"ad-feed-empty",children:[(0,n.jsx)("strong",{children:"Nothing has happened yet."}),(0,n.jsx)("span",{children:"When this agent runs or asks for approval, you’ll see it here."})]})]})}},69088:(e,a,t)=>{"use strict";t.d(a,{N:()=>d});let n=["agent_created","agent_run_start","agent_run_complete"],s=null,l=new Set;function d(e){return!function(){if(!s&&window.EventSource)for(let e of(s=new EventSource("/api/events/stream"),n))s.addEventListener(e,a=>{let t={};try{t=JSON.parse(a.data)}catch(e){}let n={...t,type:e};for(let e of l)try{e(n)}catch(e){}})}(),l.add(e),()=>{if(l.delete(e),0===l.size&&s){try{s.close()}catch(e){}s=null}}}},72606:(e,a,t)=>{"use strict";t.d(a,{default:()=>d});var n=t(95155),s=t(12115),l=t(69088);function d(e){let{agentId:a}=e,[t,d]=(0,s.useState)(!1),[i,c]=(0,s.useState)(!1);async function r(){if(!t&&!i){c(!0),d(!0);try{(await fetch("/api/agents/".concat(encodeURIComponent(a),"/run"),{method:"POST"})).ok||d(!1)}catch(e){d(!1)}finally{c(!1)}}}(0,s.useEffect)(()=>(0,l.N)(e=>{e.agent_id===a&&("agent_run_start"===e.type?d(!0):"agent_run_complete"===e.type&&d(!1))}),[a]);let o=t||i;return(0,n.jsx)("button",{type:"button",className:"admin-button",title:o?"Agent is running":"Run now",onClick:r,disabled:o,"aria-busy":o||void 0,children:o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"agent-run-spinner","aria-hidden":"true"}),"Running…"]}):"Run"})}},78129:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(13185).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},81115:(e,a,t)=>{"use strict";t.d(a,{default:()=>l});var n=t(95155),s=t(12115);function l(e){let{engines:a,initialEngine:t="claude-code",initialModel:l=""}=e,[d,i]=(0,s.useState)(t),c=a.find(e=>e.id===d),r=(null==c?void 0:c.models)||[],o=r.some(e=>e.name===l),u=o?l:(null==c?void 0:c.default_model)||"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("select",{name:"engine",value:d,onChange:e=>i(e.target.value),"aria-label":"Engine",children:a.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.label,e.available?"":" — unavailable"]},e.id))}),r.length>0?(0,n.jsx)("select",{name:"model",defaultValue:u,"aria-label":"Model",children:r.map(e=>(0,n.jsx)("option",{value:e.name,children:e.name},e.name))},d):(0,n.jsx)("input",{name:"model",defaultValue:o?l:"",placeholder:"model id (optional)","aria-label":"Model"},d)]})}},84705:(e,a,t)=>{"use strict";function n(e){if(!e)return null;let a=new Date(e).getTime();if(Number.isNaN(a))return null;let t=Date.now()-a;return t<0||t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):t<6048e5?"".concat(Math.floor(t/864e5),"d ago"):e.slice(0,10)}t.d(a,{NU:()=>d,Tk:()=>i,fw:()=>n});let s={sun:"Sunday",sunday:"Sunday",mon:"Monday",monday:"Monday",tue:"Tuesday",tues:"Tuesday",tuesday:"Tuesday",wed:"Wednesday",wednesday:"Wednesday",thu:"Thursday",thurs:"Thursday",thursday:"Thursday",fri:"Friday",friday:"Friday",sat:"Saturday",saturday:"Saturday"};function l(e,a){let t=Number(e);return"".concat((t+11)%12+1,":").concat(a," ").concat(t>=12?"PM":"AM")}function d(e){let a=String(e||"").trim().toLowerCase();if(!a||"on demand"===a||"manual"===a||"event based"===a||"live"===a)return"Runs on demand";let t=a.match(/^at\s+(.+)$/);if(t){let e=new Date(t[1]);if(Number.isNaN(e.getTime()))return"Runs once (date pending)";let a=e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),n=e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return"Runs once on ".concat(a," at ").concat(n)}let n=a.match(/^daily\s+(\d{1,2}):(\d{2})$/);if(n)return"Runs daily at ".concat(l(n[1],n[2]));let d=a.match(/^weekly\s+(\w+)\s+(\d{1,2}):(\d{2})$/);if(d){let e=s[d[1]];if(e)return"Runs every ".concat(e," at ").concat(l(d[2],d[3]))}let i=a.match(/^monthly\s+(last|\d{1,2})\s+(\d{1,2}):(\d{2})$/);if(i){let e=i[1],a=l(i[2],i[3]),t="last"===e?"the last day":"the ".concat(function(e){let a=e%10,t=e%100;return 1===a&&11!==t?"".concat(e,"st"):2===a&&12!==t?"".concat(e,"nd"):3===a&&13!==t?"".concat(e,"rd"):"".concat(e,"th")}(Number(e)));return"Runs on ".concat(t," of each month at ").concat(a)}let c=a.match(/^every\s+(\d{1,3})\s*mo$/);if(c){let e=Number(c[1]);return 12===e?"Runs once a year":1===e?"Runs once a month":"Runs every ".concat(e," months")}let r=a.match(/^every\s+(\d{1,3})\s*h$/);if(r){let e=Number(r[1]);return 1===e?"Runs every hour":"Runs every ".concat(e," hours")}let o=a.match(/^every\s+(\d{1,4})\s*m$/);if(o){let e=Number(o[1]);return 1===e?"Runs every minute":"Runs every ".concat(e," minutes")}return"Runs ".concat(a)}function i(e){let a=String(e||"").trim().toLowerCase();return a?"complete"===a||"completed"===a||a.includes("ok")?"Completed":"running"===a?"Running":"queued"===a||"leased"===a?"Queued":"failed"===a||a.includes("error")?"Failed":a.includes("waiting")||a.includes("approval")?"Waiting for approval":"paused"===a?"Paused":a.charAt(0).toUpperCase()+a.slice(1):"Unknown"}},88977:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(13185).A)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]])}},e=>{e.O(0,[2619,7695,8441,1255,7358],()=>e(e.s=35564)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7165],{654:(e,a,l)=>{Promise.resolve().then(l.bind(l,91913)),Promise.resolve().then(l.bind(l,28911)),Promise.resolve().then(l.bind(l,10677)),Promise.resolve().then(l.bind(l,56453)),Promise.resolve().then(l.t.bind(l,52619,23))},20063:(e,a,l)=>{"use strict";var n=l(47260);l.o(n,"usePathname")&&l.d(a,{usePathname:function(){return n.usePathname}}),l.o(n,"useRouter")&&l.d(a,{useRouter:function(){return n.useRouter}}),l.o(n,"useSearchParams")&&l.d(a,{useSearchParams:function(){return n.useSearchParams}})},25352:(e,a,l)=>{"use strict";l.d(a,{A:()=>n});let n=(0,l(13185).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},27667:(e,a,l)=>{"use strict";l.d(a,{A:()=>n});let n=(0,l(13185).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},28911:(e,a,l)=>{"use strict";l.d(a,{default:()=>g});var n=l(95155),t=l(12115),s=l(85649),i=l(81115),c=l(34788),r=l(37230),o=l(25352),d=l(44304);let u=["github","supabase","vercel","email","gmail","web","local_machine","core"],m={github:"GitHub",supabase:"Supabase",vercel:"Vercel",email:"Email",gmail:"Gmail",web:"Web",local_machine:"Local machine",core:"Core"};function h(e){let{tools:a,name:l="tools",defaultSelected:s=[]}=e,[i,h]=t.useState(()=>new Set(s)),[p,x]=t.useState(""),j=t.useRef(null),g=t.useMemo(()=>{let e=new Map;for(let l of a)e.set(l.name,l);return e},[a]),y=t.useMemo(()=>{let e=String(p||"").toLowerCase().trim(),l=new Map;for(let n of a){if(e&&!"".concat(n.name," ").concat(n.title," ").concat(n.category," ").concat(n.description).toLowerCase().includes(e))continue;let a=n.category||"core";l.has(a)||l.set(a,[]),l.get(a).push(n)}let n=[];for(let e of u)l.has(e)&&n.push([e,l.get(e)]);for(let[e,a]of l)u.includes(e)||n.push([e,a]);return n},[a,p]),v=t.useMemo(()=>y.reduce((e,a)=>{let[,l]=a;return e+l.length},0),[y]),f=t.useCallback(e=>{h(a=>{let l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),b=t.useCallback(e=>{h(a=>{let l=new Set(a);return l.delete(e),l})},[]),N=t.useCallback(()=>h(new Set),[]),k=t.useMemo(()=>Array.from(i).join(","),[i]),w=t.useMemo(()=>Array.from(i).map(e=>g.get(e)).filter(Boolean),[i,g]);return(0,n.jsxs)("div",{className:"tool-picker",children:[(0,n.jsx)("input",{type:"hidden",name:l,value:k}),(0,n.jsx)("div",{className:"tool-picker-chip-row","aria-live":"polite",children:0===w.length?(0,n.jsx)("span",{className:"tool-picker-chip-empty",children:"No tools selected — pick from the list below."}):(0,n.jsxs)(n.Fragment,{children:[w.map(e=>(0,n.jsxs)("span",{className:"tool-picker-chip",children:[(0,n.jsx)(d.si,{category:e.category,size:12}),(0,n.jsx)("span",{className:"tool-picker-chip-title",children:e.title}),(0,n.jsx)("button",{type:"button",className:"tool-picker-chip-x",onClick:()=>b(e.name),"aria-label":"Remove ".concat(e.title),children:(0,n.jsx)(c.A,{size:11})})]},e.name)),(0,n.jsx)("button",{type:"button",className:"tool-picker-clear",onClick:N,children:"Clear all"})]})}),(0,n.jsxs)("div",{className:"tool-picker-search",children:[(0,n.jsx)(r.A,{size:13,"aria-hidden":!0}),(0,n.jsx)("input",{ref:j,type:"text",value:p,onChange:e=>x(e.target.value),placeholder:"Search tools…","aria-label":"Search tools"}),p?(0,n.jsx)("button",{type:"button",className:"tool-picker-search-clear",onClick:()=>x(""),"aria-label":"Clear search",children:(0,n.jsx)(c.A,{size:12})}):null]}),(0,n.jsx)("div",{className:"tool-picker-list",role:"listbox","aria-multiselectable":"true",children:0===v?(0,n.jsxs)("div",{className:"tool-picker-empty",children:["No tools match “",p,"”."]}):y.map(e=>{let[a,l]=e;return(0,n.jsxs)("div",{className:"tool-picker-group",children:[(0,n.jsxs)("div",{className:"tool-picker-group-head",children:[(0,n.jsx)(d.si,{category:a,size:12}),(0,n.jsx)("span",{children:m[a]||a}),(0,n.jsx)("small",{children:l.length})]}),(0,n.jsx)("ul",{className:"tool-picker-options",children:l.map(e=>{let a=i.has(e.name),l=function(e){if(!e.available){var a;return{label:"Setup",tone:"soft",hint:(null==(a=e.missing_env)?void 0:a.length)?"Needs ".concat(e.missing_env.join(", ")):"Needs setup before this agent can use it"}}return"irreversible_external"===e.risk_level?{label:"Permanent",tone:"danger",hint:"This action cannot be undone"}:"high"===e.risk_level?{label:"Approval",tone:"warn",hint:"Asks before running"}:null}(e);return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":a,className:"tool-picker-option ".concat(a?"on":""),onClick:()=>f(e.name),title:e.description,children:[(0,n.jsx)("span",{className:"tool-picker-option-icon",children:(0,n.jsx)(d.si,{category:e.category,size:14})}),(0,n.jsxs)("span",{className:"tool-picker-option-body",children:[(0,n.jsx)("span",{className:"tool-picker-option-title",children:e.title}),(0,n.jsx)("span",{className:"tool-picker-option-name",children:e.name})]}),l?(0,n.jsx)("span",{className:"tool-picker-pill ".concat(l.tone),title:l.hint,children:l.label}):null,(0,n.jsx)("span",{className:"tool-picker-check ".concat(a?"on":""),"aria-hidden":!0,children:a?(0,n.jsx)(o.A,{size:12,strokeWidth:2.5}):null})]})},e.name)})})]},a)})}),(0,n.jsx)("div",{className:"tool-picker-foot",children:(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:i.size})," selected \xb7 ",a.length," available"]})})]})}let p=[{key:"sun",label:"S",long:"Sunday"},{key:"mon",label:"M",long:"Monday"},{key:"tue",label:"T",long:"Tuesday"},{key:"wed",label:"W",long:"Wednesday"},{key:"thu",label:"T",long:"Thursday"},{key:"fri",label:"F",long:"Friday"},{key:"sat",label:"S",long:"Saturday"}],x=[{value:"on-demand",label:"On demand only"},{value:"hourly",label:"Every few hours"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"monthly",label:"Monthly"},{value:"every-n-months",label:"Every few months"},{value:"once",label:"Run once on a date"}];function j(e){let{defaultValue:a="on demand",name:l="schedule"}=e,[s,i]=t.useState(()=>{let e=function(e){let a,l=String(e||"").trim().toLowerCase();return l&&"on demand"!==l&&"manual"!==l&&"live"!==l&&"event based"!==l?(a=l.match(/^every\s+(\d{1,3})\s*h$/))?{frequency:"hourly",interval:Number(a[1])}:(a=l.match(/^daily\s+(\d{1,2}):(\d{2})$/))?{frequency:"daily",time:"".concat(a[1].padStart(2,"0"),":").concat(a[2])}:(a=l.match(/^weekly\s+(\w+)\s+(\d{1,2}):(\d{2})$/))?{frequency:"weekly",day:a[1].slice(0,3),time:"".concat(a[2].padStart(2,"0"),":").concat(a[3])}:(a=l.match(/^monthly\s+(last|\d{1,2})\s+(\d{1,2}):(\d{2})$/))?{frequency:"monthly",dom:a[1],time:"".concat(a[2].padStart(2,"0"),":").concat(a[3])}:(a=l.match(/^every\s+(\d{1,3})\s*mo$/))?{frequency:"every-n-months",months:Number(a[1])}:(a=l.match(/^at\s+(.+)$/))?{frequency:"once",datetime:a[1]}:{frequency:"on-demand"}:{frequency:"on-demand"}}(a);return{frequency:e.frequency,interval:e.interval||6,time:e.time||"09:00",day:e.day||"mon",dom:e.dom||"1",months:e.months||3,datetime:e.datetime||""}}),c=e=>i(a=>({...a,...e})),r=function(e){switch(e.frequency){case"on-demand":default:return"on demand";case"hourly":return"every ".concat(e.interval||1,"h");case"daily":return"daily ".concat(e.time||"09:00");case"weekly":return"weekly ".concat(e.day||"mon"," ").concat(e.time||"09:00");case"monthly":return"monthly ".concat(e.dom||"1"," ").concat(e.time||"09:00");case"every-n-months":return"every ".concat(e.months||3,"mo");case"once":return e.datetime?"at ".concat(e.datetime):"on demand"}}(s),o=t.useMemo(()=>{if(!s.datetime)return"";let e=new Date(s.datetime);if(Number.isNaN(e.getTime()))return"";let a=e=>String(e).padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(a(e.getMonth()+1),"-").concat(a(e.getDate()),"T").concat(a(e.getHours()),":").concat(a(e.getMinutes()))},[s.datetime]);return(0,n.jsxs)("div",{className:"schedule-picker",children:[(0,n.jsx)("input",{type:"hidden",name:l,value:r}),(0,n.jsx)("label",{className:"agents-modal-field wide",children:(0,n.jsx)("select",{value:s.frequency,onChange:e=>c({frequency:e.target.value}),"aria-label":"How often this agent runs",children:x.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))})}),"hourly"===s.frequency&&(0,n.jsxs)("div",{className:"schedule-picker-row",children:[(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"Every"}),(0,n.jsx)("select",{className:"schedule-picker-select",value:s.interval,onChange:e=>c({interval:Number(e.target.value)}),"aria-label":"Interval in hours",children:[1,2,3,4,6,8,12].map(e=>(0,n.jsx)("option",{value:e,children:e},e))}),(0,n.jsx)("span",{className:"schedule-picker-suffix",children:1===s.interval?"hour":"hours"})]}),"daily"===s.frequency&&(0,n.jsxs)("div",{className:"schedule-picker-row",children:[(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"At"}),(0,n.jsx)("input",{className:"schedule-picker-time",type:"time",value:s.time,onChange:e=>c({time:e.target.value}),"aria-label":"Time of day"})]}),"weekly"===s.frequency&&(0,n.jsxs)("div",{className:"schedule-picker-stack",children:[(0,n.jsx)("div",{className:"schedule-picker-day-row",role:"radiogroup","aria-label":"Day of week",children:p.map(e=>(0,n.jsxs)("label",{className:"schedule-picker-day-chip".concat(s.day===e.key?" on":""),title:e.long,children:[(0,n.jsx)("input",{type:"radio",name:"schedule-day",value:e.key,checked:s.day===e.key,onChange:()=>c({day:e.key}),"aria-label":e.long}),(0,n.jsx)("span",{children:e.label})]},e.key))}),(0,n.jsxs)("div",{className:"schedule-picker-row",children:[(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"At"}),(0,n.jsx)("input",{className:"schedule-picker-time",type:"time",value:s.time,onChange:e=>c({time:e.target.value}),"aria-label":"Time of day"})]})]}),"monthly"===s.frequency&&(0,n.jsxs)("div",{className:"schedule-picker-row",children:[(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"On day"}),(0,n.jsxs)("select",{className:"schedule-picker-select",value:s.dom,onChange:e=>c({dom:e.target.value}),"aria-label":"Day of month",children:[Array.from({length:28},(e,a)=>a+1).map(e=>(0,n.jsx)("option",{value:String(e),children:e},e)),(0,n.jsx)("option",{value:"last",children:"Last day"})]}),(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"at"}),(0,n.jsx)("input",{className:"schedule-picker-time",type:"time",value:s.time,onChange:e=>c({time:e.target.value}),"aria-label":"Time of day"})]}),"every-n-months"===s.frequency&&(0,n.jsxs)("div",{className:"schedule-picker-row",children:[(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"Every"}),(0,n.jsxs)("select",{className:"schedule-picker-select",value:s.months,onChange:e=>c({months:Number(e.target.value)}),"aria-label":"Number of months",children:[(0,n.jsx)("option",{value:2,children:"2 months"}),(0,n.jsx)("option",{value:3,children:"3 months \xb7 quarterly"}),(0,n.jsx)("option",{value:4,children:"4 months"}),(0,n.jsx)("option",{value:6,children:"6 months \xb7 biannually"}),(0,n.jsx)("option",{value:12,children:"12 months \xb7 yearly"})]})]}),"once"===s.frequency&&(0,n.jsxs)("div",{className:"schedule-picker-row",children:[(0,n.jsx)("span",{className:"schedule-picker-prefix",children:"On"}),(0,n.jsx)("input",{className:"schedule-picker-datetime",type:"datetime-local",value:o,onChange:e=>{let a=e.target.value;c({datetime:a?new Date(a).toISOString():""})},"aria-label":"Date and time"})]})]})}function g(e){var a;let{engines:l,agents:c,tools:r,projects:o=[],currentProjectId:d,defaultTools:u=[],createAction:m}=e,[p,x]=t.useState(!1),[g,y]=t.useState(!1),v=t.useCallback(()=>{g||x(!1)},[g]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"admin-button agents-new-cta",onClick:()=>x(!0),children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"agents-new-cta-glyph",children:"+"}),"New agent"]}),(0,n.jsx)(s.A,{open:p,onClose:v,eyebrow:"New agent",title:"Compose a worker",size:"wide",children:(0,n.jsxs)("form",{className:"agents-modal-form agents-modal-form--split",action:async e=>{y(!0),await m(e)},children:[(0,n.jsxs)("div",{className:"agents-modal-body",children:[(0,n.jsxs)("aside",{className:"agents-modal-aside","aria-label":"Tools",children:[(0,n.jsxs)("div",{className:"agents-modal-aside-head",children:[(0,n.jsx)("h3",{children:"Tools"}),(0,n.jsx)("p",{children:"Pick the capabilities this agent can use."})]}),(0,n.jsx)(h,{tools:r,defaultSelected:u})]}),(0,n.jsxs)("div",{className:"agents-modal-main",children:[(0,n.jsxs)("section",{className:"agents-modal-section",children:[(0,n.jsxs)("label",{className:"agents-modal-field wide",children:[(0,n.jsx)("span",{children:"Name"}),(0,n.jsx)("input",{name:"name",required:!0,placeholder:"Competitor Intel",autoFocus:!0})]}),(0,n.jsxs)("label",{className:"agents-modal-field wide",children:[(0,n.jsx)("span",{children:"Mission"}),(0,n.jsx)("textarea",{name:"mission",rows:3,required:!0,placeholder:"What this agent owns, in one or two sentences.",defaultValue:"Support madarX OS operations."})]}),o.length>1?(0,n.jsxs)("label",{className:"agents-modal-field wide",children:[(0,n.jsx)("span",{children:"Project"}),(0,n.jsx)("select",{name:"project_id",defaultValue:d||"personal",children:o.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))})]}):(0,n.jsx)("input",{type:"hidden",name:"project_id",value:d||(null==(a=o[0])?void 0:a.id)||"personal"})]}),(0,n.jsxs)("section",{className:"agents-modal-section",children:[(0,n.jsxs)("div",{className:"agents-modal-section-head",children:[(0,n.jsx)("span",{children:"Engine"}),(0,n.jsx)("small",{children:"Runtime that executes this agent."})]}),(0,n.jsx)("div",{className:"agent-engine-form agents-modal-engine",children:(0,n.jsx)(i.default,{engines:l,initialEngine:"claude-code"})})]}),(0,n.jsxs)("section",{className:"agents-modal-section",children:[(0,n.jsxs)("div",{className:"agents-modal-section-head",children:[(0,n.jsx)("span",{children:"Identity"}),(0,n.jsx)("small",{children:"Optional — used by agent chart."})]}),(0,n.jsxs)("div",{className:"agents-modal-grid",children:[(0,n.jsxs)("label",{className:"agents-modal-field",children:[(0,n.jsx)("span",{children:"Title"}),(0,n.jsx)("input",{name:"title",placeholder:"e.g. Head of Marketing"})]}),(0,n.jsxs)("label",{className:"agents-modal-field",children:[(0,n.jsx)("span",{children:"Role"}),(0,n.jsxs)("select",{name:"role",defaultValue:"individual_contributor",children:[(0,n.jsx)("option",{value:"executive",children:"Executive"}),(0,n.jsx)("option",{value:"manager",children:"Manager"}),(0,n.jsx)("option",{value:"team_lead",children:"Team Lead"}),(0,n.jsx)("option",{value:"individual_contributor",children:"Contributor"})]})]}),(0,n.jsxs)("label",{className:"agents-modal-field wide",children:[(0,n.jsx)("span",{children:"Reports to"}),(0,n.jsxs)("select",{name:"reports_to",defaultValue:"",children:[(0,n.jsx)("option",{value:"",children:"— None (top of chain)"}),c.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]}),(0,n.jsxs)("section",{className:"agents-modal-section",children:[(0,n.jsxs)("div",{className:"agents-modal-section-head",children:[(0,n.jsx)("span",{children:"Schedule"}),(0,n.jsx)("small",{children:"When this agent runs."})]}),(0,n.jsx)(j,{})]}),(0,n.jsxs)("section",{className:"agents-modal-section",children:[(0,n.jsxs)("div",{className:"agents-modal-section-head",children:[(0,n.jsx)("span",{children:"Approval"}),(0,n.jsx)("small",{children:"How autonomously this agent can act."})]}),(0,n.jsxs)("div",{className:"agents-modal-radio-group",role:"radiogroup","aria-label":"Approval mode",children:[(0,n.jsxs)("label",{className:"agents-modal-radio",children:[(0,n.jsx)("input",{type:"radio",name:"approval",value:"human-in-loop",defaultChecked:!0}),(0,n.jsxs)("div",{className:"agents-modal-radio-body",children:[(0,n.jsx)("b",{children:"Standard"}),(0,n.jsx)("small",{children:"Asks before risky actions — deploy, merge, send email, delete data."})]})]}),(0,n.jsxs)("label",{className:"agents-modal-radio",children:[(0,n.jsx)("input",{type:"radio",name:"approval",value:"owner-required"}),(0,n.jsxs)("div",{className:"agents-modal-radio-body",children:[(0,n.jsx)("b",{children:"Strict"}),(0,n.jsx)("small",{children:"Asks before every action. Best for new agents you don't fully trust yet."})]})]})]})]})]})]}),(0,n.jsxs)("footer",{className:"agents-modal-foot",children:[(0,n.jsx)("button",{type:"button",className:"admin-button secondary",onClick:v,disabled:g,children:"Cancel"}),(0,n.jsx)("button",{type:"submit",className:"admin-button",disabled:g,"aria-busy":g||void 0,children:g?"Creating…":"Create agent"})]})]})})]})}},37230:(e,a,l)=>{"use strict";l.d(a,{A:()=>n});let n=(0,l(13185).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},56453:(e,a,l)=>{"use strict";l.d(a,{AgentBuilderCard:()=>x});var n=l(95155),t=l(12115),s=l(52619),i=l.n(s),c=l(13185);let r=(0,c.A)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);var o=l(27667);let d=(0,c.A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var u=l(34788),m=l(44304),h=l(72606),p=l(81115);function x(e){var a;let{agent:l,scheduleLabel:s,toolCategories:c,engines:x,updateAction:j,deleteAction:g}=e,[y,v]=t.useState(!1),[f,b]=t.useState(!1),[N,k]=t.useState(""),w=t.useRef(null),C=t.useRef(null),S="DELETE"===N.trim(),E=t.useCallback(()=>{let e=w.current;e&&e.open&&e.close(),b(!1),k("")},[]),_=t.useCallback(()=>{let e=w.current;e&&(k(""),"function"==typeof e.showModal?e.showModal():e.setAttribute("open",""),b(!0))},[]);t.useEffect(()=>{let e=w.current;if(!e)return;let a=e=>{e.preventDefault(),E()},l=()=>{b(!1),k("")};return e.addEventListener("cancel",a),e.addEventListener("close",l),()=>{e.removeEventListener("cancel",a),e.removeEventListener("close",l)}},[E]),t.useEffect(()=>{if(f){let e=window.setTimeout(()=>{var e;return null==(e=C.current)?void 0:e.focus()},50);return()=>window.clearTimeout(e)}},[f]);let M=(null==(a=x.find(e=>e.id===l.engine))?void 0:a.label)||l.engine,A=(0,m.y2)(l.engine),q=function(e){if(!e)return null;let a=new Date(e).getTime();if(Number.isNaN(a))return null;let l=Date.now()-a;return l<6e4?"just now":l<36e5?"".concat(Math.floor(l/6e4),"m"):l<864e5?"".concat(Math.floor(l/36e5),"h"):l<6048e5?"".concat(Math.floor(l/864e5),"d"):e.slice(0,10)}(l.last_run_at||l.last_heartbeat),T=function(e){let a=(e||"").toLowerCase();return a?a.includes("ok")||a.includes("complete")||a.includes("running")?{label:"Active",tone:"active",full:e}:a.includes("fail")||a.includes("error")||a.includes("blocked")?{label:"Error",tone:"error",full:e}:{label:"Idle",tone:"idle",full:e}:{label:"Idle",tone:"idle"}}(l.status);return(0,n.jsxs)("li",{className:"mkt-card agent-card-mkt ".concat("active"===T.tone?"on":""),children:[(0,n.jsxs)(i(),{href:"/agents/".concat(l.id),prefetch:!1,className:"agent-card-link","aria-label":"Open ".concat(l.name),children:[(0,n.jsxs)("div",{className:"mkt-card-head",children:[(0,n.jsx)("span",{className:"mkt-chip-tile agent-card-tile",style:A?{color:A.tint}:void 0,"aria-hidden":"true",children:A?(0,n.jsx)(A.Icon,{size:18}):(0,n.jsx)("span",{className:"agent-card-tile-glyph",children:l.name.slice(0,1).toUpperCase()})}),(0,n.jsxs)("span",{className:"agent-card-status tone-".concat(T.tone),title:T.full||T.label,children:[(0,n.jsx)("span",{className:"agent-card-status-dot","aria-hidden":!0}),T.label]})]}),(0,n.jsxs)("div",{className:"mkt-card-body",children:[(0,n.jsx)("h3",{className:"mkt-card-title",children:l.name}),l.title?(0,n.jsx)("span",{className:"agent-card-role-tag",children:l.title}):null,l.mission?(0,n.jsx)("p",{className:"mkt-card-desc",children:l.mission}):null]}),(0,n.jsxs)("div",{className:"mkt-card-meta",children:[(0,n.jsxs)("span",{children:["Engine ",(0,n.jsx)("b",{children:M})]}),l.model?(0,n.jsxs)("span",{children:["Model ",(0,n.jsx)("b",{children:l.model})]}):null,(0,n.jsxs)("span",{children:["Schedule ",(0,n.jsx)("b",{children:s})]}),(0,n.jsxs)("span",{children:["Last run ",(0,n.jsx)("b",{children:q?"".concat(q," ago"):"never"})]})]})]}),(0,n.jsxs)("div",{className:"mkt-card-foot agent-card-foot",children:[(0,n.jsxs)("div",{className:"agent-card-tools",children:[c.slice(0,6).map(e=>(0,n.jsx)("span",{title:e,className:"agent-card-tool","aria-hidden":"true",children:(0,n.jsx)(m.si,{category:e,size:12})},e)),0===c.length?(0,n.jsx)("span",{className:"agent-card-tools-empty",children:"no tools"}):null]}),(0,n.jsxs)("div",{className:"agent-card-actions",children:[(0,n.jsx)(h.default,{agentId:l.id}),(0,n.jsx)("button",{type:"button","aria-label":"Change engine",title:"Change engine",onClick:()=>v(e=>!e),className:"admin-button secondary icon ".concat(y?"on":""),children:(0,n.jsx)(r,{size:13})}),(0,n.jsx)("button",{type:"button","aria-label":"Delete agent",title:"Delete agent",onClick:_,className:"admin-button danger icon",children:(0,n.jsx)(o.A,{size:13})})]})]}),y?(0,n.jsxs)("form",{action:j,className:"agent-card-engine-form",children:[(0,n.jsx)("input",{type:"hidden",name:"agent_id",value:l.id}),(0,n.jsxs)("div",{className:"agent-engine-form",children:[(0,n.jsx)(p.default,{engines:x,initialEngine:l.engine,initialModel:l.model||""}),(0,n.jsx)("button",{type:"submit",className:"admin-button",children:"Save"}),(0,n.jsx)("button",{type:"button",onClick:()=>v(!1),className:"admin-button secondary",children:"Cancel"})]})]}):null,(0,n.jsx)("dialog",{ref:w,className:"agent-delete-dialog",onClick:e=>{e.target===w.current&&E()},children:f?(0,n.jsxs)("div",{className:"agent-delete-modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"agent-delete-modal-head",children:[(0,n.jsxs)("div",{className:"agent-delete-modal-title",children:[(0,n.jsx)("span",{className:"agent-delete-modal-icon","aria-hidden":!0,children:(0,n.jsx)(d,{size:16})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{children:"Delete agent"}),(0,n.jsx)("p",{children:"This action cannot be undone."})]})]}),(0,n.jsx)("button",{type:"button",onClick:E,"aria-label":"Close",className:"agent-delete-modal-close",children:(0,n.jsx)(u.A,{size:14})})]}),(0,n.jsxs)("form",{action:g,onSubmit:e=>{if(!S)return void e.preventDefault();b(!1)},className:"agent-delete-modal-body",children:[(0,n.jsx)("input",{type:"hidden",name:"agent_id",value:l.id}),(0,n.jsxs)("p",{children:["You are about to permanently delete"," ",(0,n.jsx)("b",{children:l.name}),". Its runs, schedules, and workspace files will be removed."]}),(0,n.jsxs)("label",{className:"agent-delete-confirm-label",children:[(0,n.jsxs)("span",{children:["Type ",(0,n.jsx)("code",{children:"DELETE"})," to confirm"]}),(0,n.jsx)("input",{ref:C,type:"text",value:N,onChange:e=>k(e.target.value),autoComplete:"off",spellCheck:!1,placeholder:"DELETE"})]}),(0,n.jsxs)("div",{className:"agent-delete-modal-actions",children:[(0,n.jsx)("button",{type:"button",onClick:E,className:"admin-button secondary",children:"Cancel"}),(0,n.jsx)("button",{type:"submit",disabled:!S,className:"admin-button danger",children:"Delete agent"})]})]})]}):null})]})}},69088:(e,a,l)=>{"use strict";l.d(a,{N:()=>i});let n=["agent_created","agent_run_start","agent_run_complete"],t=null,s=new Set;function i(e){return!function(){if(!t&&window.EventSource)for(let e of(t=new EventSource("/api/events/stream"),n))t.addEventListener(e,a=>{let l={};try{l=JSON.parse(a.data)}catch(e){}let n={...l,type:e};for(let e of s)try{e(n)}catch(e){}})}(),s.add(e),()=>{if(s.delete(e),0===s.size&&t){try{t.close()}catch(e){}t=null}}}},72606:(e,a,l)=>{"use strict";l.d(a,{default:()=>i});var n=l(95155),t=l(12115),s=l(69088);function i(e){let{agentId:a}=e,[l,i]=(0,t.useState)(!1),[c,r]=(0,t.useState)(!1);async function o(){if(!l&&!c){r(!0),i(!0);try{(await fetch("/api/agents/".concat(encodeURIComponent(a),"/run"),{method:"POST"})).ok||i(!1)}catch(e){i(!1)}finally{r(!1)}}}(0,t.useEffect)(()=>(0,s.N)(e=>{e.agent_id===a&&("agent_run_start"===e.type?i(!0):"agent_run_complete"===e.type&&i(!1))}),[a]);let d=l||c;return(0,n.jsx)("button",{type:"button",className:"admin-button",title:d?"Agent is running":"Run now",onClick:o,disabled:d,"aria-busy":d||void 0,children:d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"agent-run-spinner","aria-hidden":"true"}),"Running…"]}):"Run"})}},81115:(e,a,l)=>{"use strict";l.d(a,{default:()=>s});var n=l(95155),t=l(12115);function s(e){let{engines:a,initialEngine:l="claude-code",initialModel:s=""}=e,[i,c]=(0,t.useState)(l),r=a.find(e=>e.id===i),o=(null==r?void 0:r.models)||[],d=o.some(e=>e.name===s),u=d?s:(null==r?void 0:r.default_model)||"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("select",{name:"engine",value:i,onChange:e=>c(e.target.value),"aria-label":"Engine",children:a.map(e=>(0,n.jsxs)("option",{value:e.id,children:[e.label,e.available?"":" — unavailable"]},e.id))}),o.length>0?(0,n.jsx)("select",{name:"model",defaultValue:u,"aria-label":"Model",children:o.map(e=>(0,n.jsx)("option",{value:e.name,children:e.name},e.name))},i):(0,n.jsx)("input",{name:"model",defaultValue:d?s:"",placeholder:"model id (optional)","aria-label":"Model"},i)]})}},85649:(e,a,l)=>{"use strict";l.d(a,{A:()=>i});var n=l(95155),t=l(12115),s=l(34788);function i(e){let{open:a,onClose:l,eyebrow:i,title:c,tone:r="default",size:o="default",children:d}=e,u=t.useRef(null);return t.useEffect(()=>{let e=u.current;e&&(a&&!e.open&&("function"==typeof e.showModal?e.showModal():e.setAttribute("open","")),!a&&e.open&&e.close())},[a]),t.useEffect(()=>{let e=u.current;if(!e)return;let a=e=>{e.preventDefault(),l()};return e.addEventListener("cancel",a),()=>e.removeEventListener("cancel",a)},[l]),(0,n.jsx)("dialog",{ref:u,className:"agents-modal".concat("wide"===o?" agents-modal--wide":""),onClick:e=>{e.target===u.current&&l()},children:a?(0,n.jsxs)("div",{className:"agents-modal-card".concat("danger"===r?" agents-modal-card--danger":""),onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("header",{className:"agents-modal-head",children:[(0,n.jsxs)("div",{children:[i?(0,n.jsx)("span",{className:"admin-kicker",children:i}):null,(0,n.jsx)("h2",{children:c})]}),(0,n.jsx)("button",{type:"button",className:"agents-modal-close",onClick:l,"aria-label":"Close",children:(0,n.jsx)(s.A,{size:14})})]}),d]}):null})}},91913:(e,a,l)=>{"use strict";l.d(a,{default:()=>i});var n=l(12115),t=l(20063),s=l(69088);function i(){let e=(0,t.useRouter)();return(0,n.useEffect)(()=>(0,s.N)(a=>{("agent_created"===a.type||"agent_run_complete"===a.type)&&e.refresh()}),[e]),null}}},e=>{e.O(0,[2619,7695,8441,1255,7358],()=>e(e.s=654)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5094],{20063:(e,n,l)=>{"use strict";var t=l(47260);l.o(t,"usePathname")&&l.d(n,{usePathname:function(){return t.usePathname}}),l.o(t,"useRouter")&&l.d(n,{useRouter:function(){return t.useRouter}}),l.o(t,"useSearchParams")&&l.d(n,{useSearchParams:function(){return t.useSearchParams}})},60874:(e,n,l)=>{"use strict";l.d(n,{default:()=>W});var t=l(95155),s=l(12115),a=l(20063);let i=[{id:"all",label:"All"},{id:"connection",label:"Connections"},{id:"tool",label:"Tools"},{id:"skill",label:"Skills"},{id:"bundle",label:"Bundles"},{id:"agent",label:"Agents"},{id:"workflow",label:"Workflows"}],c={github:"GitHub",supabase:"Supabase",vercel:"Vercel",email:"Email",web:"Web",local_machine:"Local machine",travel:"Travel",calendar:"Calendar",design:"Design",review:"Review",security:"Security",engineering:"Engineering",engine:"Engines",integration:"Integrations",channel:"Channels",procurement:"Procurement",legal:"Legal",support:"Support",workflow:"Workflow"};function o(e){let{activeKind:n,onKindChange:l,counts:s,categories:a,categoryCounts:o={},scopeCount:r,activeCategory:d,onCategoryChange:u}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mkt-tabs",role:"tablist","aria-label":"Marketplace kind",children:i.map(e=>{let a="all"===e.id?s.all:s[e.id]||0,i=e.id===n;return(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":i,className:"mkt-tab ".concat(i?"on":""),onClick:()=>l(e.id),children:[e.label,(0,t.jsx)("span",{className:"mkt-tab-count",children:a})]},e.id)})}),a.length?(0,t.jsxs)("div",{className:"mkt-filters",role:"toolbar","aria-label":"Category filters",children:[(0,t.jsxs)("button",{type:"button",className:"mkt-chip ".concat(d?"":"on"),onClick:()=>u(null),children:["All categories","number"==typeof r?(0,t.jsx)("span",{className:"mkt-chip-count",children:r}):null]}),a.map(e=>(0,t.jsxs)("button",{type:"button",className:"mkt-chip ".concat(d===e?"on":""),onClick:()=>u(d===e?null:e),children:[function(e){if(c[e])return c[e];let n=String(e).replaceAll("_"," ");return n.charAt(0).toUpperCase()+n.slice(1)}(e),o[e]?(0,t.jsx)("span",{className:"mkt-chip-count",children:o[e]}):null]},e))]}):null]})}function r(e){let{value:n,onChange:l}=e,a=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){var n,t,s;(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()?(e.preventDefault(),null==(n=a.current)||n.focus(),null==(t=a.current)||t.select()):"Escape"===e.key&&document.activeElement===a.current&&(l(""),null==(s=a.current)||s.blur())}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l]);let i="undefined"!=typeof navigator&&/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent||"")?"⌘":"Ctrl";return(0,t.jsxs)("div",{className:"mkt-search",role:"search",children:[(0,t.jsxs)("svg",{className:"mkt-search-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,t.jsx)("path",{d:"M21 21l-4.3-4.3"})]}),(0,t.jsx)("input",{ref:a,type:"search",className:"mkt-search-input",placeholder:"Search tools, skills, bundles, authors…",value:n,onChange:e=>l(e.target.value),"aria-label":"Search marketplace"}),(0,t.jsxs)("span",{className:"mkt-search-kbd","aria-hidden":"true",children:[(0,t.jsx)("kbd",{children:i}),(0,t.jsx)("kbd",{children:"K"})]})]})}var d=l(44304);function u(e){let{kind:n,category:l,size:s=18}=e,a="mkt-chip-tile kind-".concat(n);return"tool"===n?(0,t.jsx)("span",{className:a,"aria-hidden":"true",children:(0,t.jsx)(d.si,{category:l,size:s})}):(0,t.jsx)("span",{className:a,"aria-hidden":"true",children:(0,t.jsx)(d.IU,{kind:n,size:s})})}let h={tool:"Tool",skill:"Skill",bundle:"Bundle",agent:"Agent",connection:"Connection",workflow:"Workflow"};function p(e){let{kind:n}=e,l=h[n]||n;return(0,t.jsx)("span",{className:"mkt-kind-badge kind-".concat(n),children:l})}let m={low:"low",medium:"medium",high:"high",local:"local",irreversible_external:"irreversible"};function j(e){let{level:n}=e;if(!n)return null;let l="irreversible_external"===n?"irreversible":"local"===n?"low":n||"low",s=m[n]||n;return(0,t.jsxs)("span",{className:"mkt-risk",children:[(0,t.jsx)("span",{className:"mkt-risk-dot ".concat(l),"aria-hidden":"true"}),s]})}function g(e){let{action:n,itemId:l,installed:s,available:a=!0,disabled:i=!1,label:c,slugHint:o,currentKind:r}=e,d=c||"".concat(s?"Uninstall":"Install"," ").concat(l);return(0,t.jsxs)("form",{action:n,className:"mkt-toggle-form",children:[(0,t.jsx)("input",{type:"hidden",name:"item_id",value:l}),(0,t.jsx)("input",{type:"hidden",name:"installed",value:String(!s)}),o?(0,t.jsx)("input",{type:"hidden",name:"slug_hint",value:o}):null,r?(0,t.jsx)("input",{type:"hidden",name:"current_kind",value:r}):null,(0,t.jsx)("button",{className:"mkt-toggle ".concat(s?"on":""),type:"submit",role:"switch","aria-checked":s,"aria-label":d,disabled:i||!a})]})}var x=l(85649);function b(e){let{value:n,onChange:l,supportsScopes:a=["global","project","agent"],disabled:i}=e,[c,o]=s.useState([]),[r,d]=s.useState([]),[u,h]=s.useState(null),p=a.includes("project"),m=a.includes("agent");function j(e){var n,t;"global"===e?l({scope:"global",project_id:null,agent_id:null}):"project"===e?l({scope:"project",project_id:(null==(n=c[0])?void 0:n.id)||null,agent_id:null}):"agent"===e&&l({scope:"agent",project_id:null,agent_id:(null==(t=r[0])?void 0:t.id)||null})}return(s.useEffect(()=>{let e=!1;return async function(){try{let n=[];p?n.push(fetch("/api/projects").then(e=>e.json())):n.push(Promise.resolve({projects:[]})),m?n.push(fetch("/api/state").then(e=>e.json())):n.push(Promise.resolve({agents:[]}));let[l,t]=await Promise.all(n);if(e)return;o(Array.isArray(null==l?void 0:l.projects)?l.projects:[]);let s=Array.isArray(null==t?void 0:t.agents)?t.agents:[];d(s)}catch(n){e||h(String((null==n?void 0:n.message)||n))}}(),()=>{e=!0}},[p,m]),1===a.length)?(0,t.jsxs)("div",{className:"scope-picker scope-picker--locked",children:[(0,t.jsx)("span",{className:"scope-picker-label",children:"Scope"}),(0,t.jsx)("span",{className:"scope-picker-locked-value",children:a[0]})]}):(0,t.jsxs)("fieldset",{className:"scope-picker",disabled:i,children:[(0,t.jsx)("legend",{className:"scope-picker-legend",children:"Scope"}),a.includes("global")?(0,t.jsxs)("label",{className:"scope-picker-radio",children:[(0,t.jsx)("input",{type:"radio",name:"scope",value:"global",checked:"global"===n.scope,onChange:()=>j("global")}),(0,t.jsxs)("span",{className:"scope-picker-radio-body",children:[(0,t.jsx)("b",{children:"Global"}),(0,t.jsx)("small",{children:"Available to every project and every agent on this Mac."})]})]}):null,a.includes("project")?(0,t.jsxs)("label",{className:"scope-picker-radio",children:[(0,t.jsx)("input",{type:"radio",name:"scope",value:"project",checked:"project"===n.scope,onChange:()=>j("project"),disabled:0===c.length}),(0,t.jsxs)("span",{className:"scope-picker-radio-body",children:[(0,t.jsx)("b",{children:"Project"}),(0,t.jsx)("small",{children:0===c.length?"No projects yet — create one in the Projects tab.":"Resolved when a tool runs inside this project."}),"project"===n.scope&&c.length>0?(0,t.jsx)("select",{className:"scope-picker-select",value:n.project_id||"",onChange:e=>l({scope:"project",project_id:e.target.value,agent_id:null}),children:c.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))}):null]})]}):null,a.includes("agent")?(0,t.jsxs)("label",{className:"scope-picker-radio",children:[(0,t.jsx)("input",{type:"radio",name:"scope",value:"agent",checked:"agent"===n.scope,onChange:()=>j("agent"),disabled:0===r.length}),(0,t.jsxs)("span",{className:"scope-picker-radio-body",children:[(0,t.jsx)("b",{children:"Agent"}),(0,t.jsx)("small",{children:0===r.length?"No agents yet.":"Only this specific agent can use these credentials."}),"agent"===n.scope&&r.length>0?(0,t.jsx)("select",{className:"scope-picker-select",value:n.agent_id||"",onChange:e=>l({scope:"agent",project_id:null,agent_id:e.target.value}),children:r.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name||e.id},e.id))}):null]})]}):null,u?(0,t.jsxs)("small",{className:"scope-picker-error",children:["Couldn't load projects or agents: ",u]}):null]})}function f(e){var n,l,s,a,i;let{connection:c,credentials:o,onChange:r,scope:d,onScopeChange:u,onSubmit:h,onCancel:p,error:m,hint:j,busy:g}=e,x=(null==c||null==(n=c.connection)?void 0:n.credentials)||(null==c||null==(l=c.manifest)?void 0:l.credentials)||[],f=Array.isArray(null==c||null==(s=c.connection)?void 0:s.supports_scopes)?c.connection.supports_scopes:Array.isArray(null==c||null==(a=c.manifest)?void 0:a.supports_scopes)?c.manifest.supports_scopes:["global","project","agent"],k=x.filter(e=>e.required).every(e=>String(o[e.name]||"").trim().length>0),v="global"===d.scope||"project"===d.scope&&!!d.project_id||"agent"===d.scope&&!!d.agent_id;return(0,t.jsxs)("form",{className:"connection-setup-step connection-setup-step-form",onSubmit:function(e){e.preventDefault(),h(o)},children:[(0,t.jsxs)("p",{className:"connection-setup-intro",children:["Madarx will use this to ",(null==(i=c.connection)?void 0:i.benefit)||"connect to the service","."," ","Your credentials are encrypted on this Mac and never echoed back."]}),(0,t.jsx)(b,{value:d,onChange:u,supportsScopes:f,disabled:g}),x.map(e=>(0,t.jsxs)("label",{className:"connection-setup-field",children:[(0,t.jsxs)("span",{className:"connection-setup-field-label",children:[e.label,e.required?null:(0,t.jsx)("small",{children:" (optional)"})]}),(0,t.jsx)("input",{type:"password"===e.type?"password":"text",name:e.name,placeholder:e.placeholder||"",autoComplete:"off",spellCheck:!1,value:o[e.name]||"",onChange:n=>{var l,t;return l=e.name,t=n.target.value,void r({...o,[l]:t})},disabled:g}),e.help_text||e.help_url?(0,t.jsxs)("small",{className:"connection-setup-field-help",children:[e.help_text||"Find this in the provider settings.",e.help_url?(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:e.help_url,target:"_blank",rel:"noreferrer noopener",children:"Where do I find this? →"})]}):null]}):null]},e.name)),m?(0,t.jsxs)("p",{className:"connection-setup-error",children:[m,j?(0,t.jsxs)("small",{children:[" ",j]}):null]}):null,(0,t.jsxs)("div",{className:"connection-setup-actions",children:[(0,t.jsx)("button",{type:"button",className:"admin-button secondary",onClick:p,disabled:g,children:"Cancel"}),(0,t.jsx)("button",{type:"submit",className:"admin-button",disabled:g||!k||!v,children:g?"Verifying…":"Connect"})]})]})}var k=l(52769);function v(e){var n;let{connection:l,onPaired:a}=e,[i,c]=s.useState(null),[o,r]=s.useState(null),[d,u]=s.useState(""),[h,p]=s.useState(null),m=s.useRef(!1);s.useEffect(()=>{let e=!1;async function n(){try{var n;let[l,t]=await Promise.all([fetch("/api/whatsapp/qr").then(e=>e.json()).catch(()=>null),fetch("/api/whatsapp/status").then(e=>e.json()).catch(()=>null)]);if(e)return;c(l||null),r((null==t?void 0:t.health)||null),p(!!t&&!!(null==t?void 0:t.health)),((null==l?void 0:l.paired)||(null==t||null==(n=t.health)?void 0:n.pairing_state)==="paired")&&!m.current&&(m.current=!0,a())}catch(n){e||p(!1)}}n();let l=setInterval(n,3500);return()=>{e=!0,clearInterval(l)}},[a]),s.useEffect(()=>{let e=!1;return async function(){if((null==i?void 0:i.paired)||!(null==i?void 0:i.qr))return u("");try{let n=await k.toDataURL(i.qr,{margin:1,width:240,errorCorrectionLevel:"M"});e||u(n)}catch(n){e||u("")}}(),()=>{e=!0}},[i]);let j=(null==o?void 0:o.pairing_state)||(!1===h?"offline":"starting"),g=(null==l||null==(n=l.connection)?void 0:n.requires_daemon)||"npm run whatsapp:bridge",x=!1===h||"offline"===j;return(0,t.jsxs)("section",{className:"connection-setup-step connection-setup-step-qr",children:[(0,t.jsxs)("p",{className:"connection-setup-intro",children:["Open WhatsApp on your phone → ",(0,t.jsx)("b",{children:"Settings"})," → ",(0,t.jsx)("b",{children:"Linked Devices"})," → ",(0,t.jsx)("b",{children:"Link a Device"}),", then scan the code below. Madarx will receive incoming WhatsApp messages through this number."]}),x?(0,t.jsxs)("div",{className:"connection-setup-warning",children:[(0,t.jsx)("p",{children:"The WhatsApp bridge daemon is not running."}),(0,t.jsxs)("p",{children:["Run ",(0,t.jsx)("code",{children:g})," in a terminal, then return to this screen. The QR code will appear automatically once the daemon is up."]})]}):null,(0,t.jsxs)("div",{className:"connection-setup-qr-row",children:[d?(0,t.jsx)("div",{className:"connection-setup-qr-box",children:(0,t.jsx)("img",{src:d,alt:"WhatsApp pairing QR code",width:240,height:240})}):"paired"===j?(0,t.jsx)("div",{className:"connection-setup-qr-pending",children:"Paired — finishing up…"}):(0,t.jsx)("div",{className:"connection-setup-qr-pending",children:x?"Waiting for the daemon…":"Waiting for QR…"}),(0,t.jsxs)("div",{className:"connection-setup-qr-copy",children:[(0,t.jsxs)("p",{children:["Pair only a ",(0,t.jsx)("b",{children:"dedicated WhatsApp number"}),", not your personal account. Baileys is an unofficial Web client and the paired account can be banned."]}),(0,t.jsx)("p",{className:"connection-setup-qr-status",children:(0,t.jsx)("span",{className:"connection-status ".concat("paired"===j?"connected":"needs_setup"),children:"paired"===j?"Paired":"qr_required"===j?"Awaiting scan":j})})]})]})]})}function y(e){var n,l,a,i,c,o,r,d;let{connection:u,credentials:h,onChange:p,onSubmit:m,onCancel:j,busy:g}=e,x=null==u||null==(n=u.connection)?void 0:n.verify_endpoint,[b,f]=s.useState(null),[k,v]=s.useState(null),[y,N]=s.useState(!1),_=s.useCallback(async()=>{if(x){N(!0),v(null);try{let e=await fetch(x,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({credentials:{},dry_run:!0})}),n=await e.json().catch(()=>({}));f(n)}catch(e){v("We couldn't probe the local Hermes path.")}finally{N(!1)}}},[x]);s.useEffect(()=>{_()},[_]);let w=((null==u||null==(l=u.connection)?void 0:l.credentials)||[]).find(e=>"HERMES_AGENT_DIR"===e.name),C=(null==b||null==(a=b.probe)?void 0:a.hermes_dir)||(null==b||null==(o=b.connection)||null==(c=o.connection)||null==(i=c.summary)?void 0:i.hermes_dir)||(null==b?void 0:b.hermes_dir)||(null==b||null==(d=b.connection)||null==(r=d.connection)?void 0:r.account_label),S=(null==b?void 0:b.ok)===!0;return(0,t.jsxs)("form",{className:"connection-setup-step connection-setup-step-form",onSubmit:function(e){e.preventDefault(),m(h)},children:[(0,t.jsxs)("p",{className:"connection-setup-intro",children:["Madarx looks for a local Hermes checkout at ",(0,t.jsx)("code",{children:"../hermes-agent"}),". Override the path below if your checkout lives elsewhere."]}),(0,t.jsx)("div",{className:"connection-setup-probe ".concat(S?"ok":"warn"),children:y?(0,t.jsx)("span",{children:"Probing…"}):S?(0,t.jsxs)("span",{children:[(0,t.jsx)("b",{children:"Hermes detected."})," Path: ",(0,t.jsx)("code",{children:C})]}):(0,t.jsxs)("span",{children:[(0,t.jsx)("b",{children:"Hermes not detected."})," ",(null==b?void 0:b.hint)||k||"Provide an override path or clone hermes-agent."]})}),w?(0,t.jsxs)("label",{className:"connection-setup-field",children:[(0,t.jsx)("span",{className:"connection-setup-field-label",children:w.label}),(0,t.jsx)("input",{type:"text",name:w.name,placeholder:w.placeholder||"",autoComplete:"off",spellCheck:!1,value:h[w.name]||"",onChange:e=>p({...h,[w.name]:e.target.value}),disabled:g}),(0,t.jsx)("small",{className:"connection-setup-field-help",children:w.help_text})]}):null,(0,t.jsxs)("div",{className:"connection-setup-actions",children:[(0,t.jsx)("button",{type:"button",className:"admin-button secondary",onClick:j,disabled:g,children:"Cancel"}),(0,t.jsx)("button",{type:"button",className:"admin-button secondary",onClick:_,disabled:g||y,children:y?"Probing…":"Re-detect"}),(0,t.jsx)("button",{type:"submit",className:"admin-button",disabled:g||!S&&!h[null==w?void 0:w.name],children:g?"Verifying…":"Connect"})]})]})}let N={BENEFIT:"benefit",SETUP:"setup",VERIFYING:"verifying",DONE:"done"};function _(e){let{status:n}=e;return n?(0,t.jsx)("span",{className:"connection-status ".concat(n.status),children:n.label}):null}function w(e){var n,l,i,c;let{open:o,onClose:r,connection:d,prefillScope:u}=e,h=(0,a.useRouter)(),[p,m]=s.useState(N.BENEFIT),[j,g]=s.useState({}),[b,k]=s.useState({scope:"global",project_id:null,agent_id:null}),[w,C]=s.useState(null),[S,A]=s.useState(null),[P,E]=s.useState(null),[I,L]=s.useState(null),[R,T]=s.useState(!1);if(s.useEffect(()=>{var e,n;o&&(m((null==d?void 0:d.installed)?N.DONE:N.BENEFIT),g({}),(null==u?void 0:u.scope)?k({scope:u.scope,project_id:u.project_id||null,agent_id:u.agent_id||null}):k({scope:"global",project_id:null,agent_id:null}),C(null),A(null),L(null),E((null==d?void 0:d.installed)?{account_label:null==(e=d.connection)?void 0:e.account_label,last_4:null==(n=d.connection)?void 0:n.last_4}:null),T(!1))},[o,null==d?void 0:d.id,null==u?void 0:u.scope,null==u?void 0:u.project_id,null==u?void 0:u.agent_id]),!d)return null;let M=d.connection||d.manifest||{},U=(null==d||null==(n=d.connection)?void 0:n.setup_kind)||(null==d||null==(l=d.manifest)?void 0:l.setup_kind)||"api_key",q=M.verify_endpoint;M.verify_supported;let D=M.deep_link,W=Array.isArray(M.unlocks_tool_slugs)?M.unlocks_tool_slugs:[],B=Array.isArray(M.engines)?M.engines:[];async function O(e){if(!q){C("This connection is missing its setup endpoint."),m(N.SETUP);return}m(N.VERIFYING),C(null),A(null),L(null),T(!0);try{let n=await fetch(q,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({credentials:e||j,scope:b.scope,project_id:b.project_id||null,agent_id:b.agent_id||null})}),l=await n.json().catch(()=>({}));if(!n.ok||!(null==l?void 0:l.ok)){C((null==l?void 0:l.error)||"We could not verify those credentials."),A((null==l?void 0:l.hint)||null),m(N.SETUP);return}E(l.summary||null),L(l.warning||null),m(N.DONE),h.refresh()}catch(e){C("We couldn't reach the service. Check your network and try again."),m(N.SETUP)}finally{T(!1)}}async function F(){if(confirm("Disconnect ".concat(d.title,"? Stored credentials will be revoked."))){T(!0);try{let e=await fetch("/api/connections/".concat(d.slug),{method:"DELETE"}),n=await e.json().catch(()=>({}));if(!e.ok)return void C((null==n?void 0:n.error)||"Could not disconnect.");m(N.BENEFIT),g({}),E(null),h.refresh(),r()}finally{T(!1)}}}return(0,t.jsx)(x.A,{open:o,onClose:r,eyebrow:"Marketplace \xb7 Connection",title:"Connect ".concat(d.title),children:(0,t.jsxs)("div",{className:"connection-setup",children:[p===N.BENEFIT?(0,t.jsxs)("section",{className:"connection-setup-step connection-setup-step-benefit",children:[(0,t.jsx)("p",{className:"connection-setup-benefit",children:M.benefit||d.description}),W.length||B.length?(0,t.jsxs)("ul",{className:"connection-setup-unlocks",children:[B.length?(0,t.jsxs)("li",{children:[(0,t.jsx)("b",{children:"Engine:"})," ",B.join(", ")]}):null,W.length?(0,t.jsxs)("li",{children:[(0,t.jsxs)("b",{children:["Unlocks ",W.length," tool",1===W.length?"":"s",":"]})," ",W.slice(0,6).join(", "),W.length>6?", +".concat(W.length-6," more"):""]}):null]}):null,d.risk_summary?(0,t.jsxs)("p",{className:"connection-setup-risk",children:[(0,t.jsx)("b",{children:"Heads up:"})," ",d.risk_summary]}):null,(0,t.jsxs)("div",{className:"connection-setup-actions",children:[(0,t.jsx)("button",{type:"button",className:"admin-button secondary",onClick:r,disabled:R,children:"Cancel"}),(0,t.jsx)("button",{type:"button",className:"admin-button",onClick:()=>m(N.SETUP),disabled:R,children:"Continue"})]})]}):null,p===N.SETUP?"qr_pair"===U?(0,t.jsx)(v,{connection:d,onPaired:()=>O({})}):"binary_detect"===U?(0,t.jsx)(y,{connection:d,credentials:j,onChange:g,onSubmit:e=>O(e),onCancel:r,busy:R}):(0,t.jsx)(f,{connection:d,credentials:j,onChange:g,scope:b,onScopeChange:k,onSubmit:e=>O(e),onCancel:r,error:w,hint:S,busy:R}):null,p===N.VERIFYING?(0,t.jsx)("section",{className:"connection-setup-step connection-setup-step-verify",children:(0,t.jsxs)("p",{children:["Verifying with ",d.title,"…"]})}):null,p===N.DONE?(0,t.jsxs)("section",{className:"connection-setup-step connection-setup-step-done",children:[(0,t.jsxs)("div",{className:"connection-setup-done-head",children:[(0,t.jsx)(_,{status:{status:"connected",label:"Connected"}}),(0,t.jsxs)("h3",{children:[d.title," is connected"]})]}),(null==P?void 0:P.account_label)||(null==P?void 0:P.last_4)?(0,t.jsxs)("p",{className:"connection-setup-summary",children:[P.account_label?(0,t.jsxs)("span",{children:["Account: ",P.account_label]}):null,P.last_4?(0,t.jsxs)("span",{children:[" \xb7 Key ends in ••• ",P.last_4]}):null]}):(0,t.jsx)("p",{className:"connection-setup-summary",children:"Credentials stored in your local vault."}),I?(0,t.jsxs)("p",{className:"connection-setup-warning",children:[(0,t.jsx)("b",{children:"Warning:"})," ","SUPABASE_ACCESS_TOKEN"===(i=I.field)?"Personal access token":i||"Optional field"," could not be verified (","unauthorized"===(c=I.reason)?"rejected by the provider":"invalid_key"===c?"invalid":"network"===c?"network error":c||"unknown","). Other credentials were saved."]}):null,W.length?(0,t.jsxs)("p",{className:"connection-setup-unlocked",children:[W.length," tool",1===W.length?"":"s"," now available in the marketplace."]}):null,D?(0,t.jsx)("p",{className:"connection-setup-deeplink",children:(0,t.jsxs)("a",{href:D,className:"admin-link",children:["Open ",d.title," operations →"]})}):null,(0,t.jsxs)("div",{className:"connection-setup-actions",children:[(0,t.jsx)("button",{type:"button",className:"admin-button secondary",onClick:F,disabled:R,children:"Disconnect"}),(0,t.jsx)("button",{type:"button",className:"admin-button",onClick:r,disabled:R,children:"Done"})]})]}):null]})})}function C(e){let n,{install:l,projectName:s,agentName:a}=e,i=(null==l?void 0:l.scope)||"global";n="project"===i?s||l.project_id||"Project":"agent"===i?a||l.agent_id||"Agent":"Global";let c=(null==l?void 0:l.account_label)||((null==l?void 0:l.last_4)?"••• ".concat(l.last_4):null);return(0,t.jsxs)("span",{className:"connection-scope-badge scope-".concat(i),children:[(0,t.jsx)("span",{className:"connection-scope-badge-scope",children:i}),(0,t.jsx)("span",{className:"connection-scope-badge-label",children:n}),c?(0,t.jsx)("span",{className:"connection-scope-badge-sub",children:c}):null]})}function S(e){let{status:n}=e;return n?(0,t.jsx)("span",{className:"connection-status ".concat(n.status),children:n.label}):null}function A(e){var n;let{item:l,status:a,prefillScope:i=null}=e,[c,o]=(0,s.useState)(!1),[r,d]=(0,s.useState)(i),[u,h]=(0,s.useState)({projects:{},agents:{}}),m=l.connection||l.manifest||{},j=Array.isArray(m.unlocks_tool_slugs)?m.unlocks_tool_slugs:[],g=Array.isArray(m.engines)?m.engines:[],x=Array.isArray(l.installs)?l.installs:[],b=(null==a?void 0:a.status)==="connected"||x.length>0;function f(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;d(e),o(!0)}return(0,s.useEffect)(()=>{(null==i?void 0:i.scope)&&(d(i),o(!0))},[null==i?void 0:i.scope,null==i?void 0:i.project_id,null==i?void 0:i.agent_id]),(0,s.useEffect)(()=>{if(0===x.length)return;let e=x.some(e=>"project"===e.scope&&e.project_id),n=x.some(e=>"agent"===e.scope&&e.agent_id);if(!e&&!n)return;let l=!1;return async function(){try{let t=[];t.push(e?fetch("/api/projects").then(e=>e.json()):Promise.resolve({projects:[]})),t.push(n?fetch("/api/state").then(e=>e.json()):Promise.resolve({agents:[]}));let[s,a]=await Promise.all(t);if(l)return;let i={};for(let e of(null==s?void 0:s.projects)||[])i[e.id]=e.name;let c={};for(let e of(null==a?void 0:a.agents)||[])c[e.id]=e.name||e.id;h({projects:i,agents:c})}catch(e){}}(),()=>{l=!0}},[x.length]),(0,t.jsxs)("li",{className:"mkt-card kind-connection ".concat(b?"on":""),children:[(0,t.jsxs)("div",{className:"mkt-card-head",children:[(0,t.jsx)("span",{className:"mkt-chip-tile kind-connection","aria-hidden":"true",children:(0,t.jsx)(P,{glyph:m.logo_glyph||l.slug})}),(0,t.jsx)(p,{kind:"connection"}),(0,t.jsx)(S,{status:a})]}),(0,t.jsxs)("div",{className:"mkt-card-body",children:[(0,t.jsx)("h3",{className:"mkt-card-title",children:l.title}),(0,t.jsx)("p",{className:"mkt-card-desc",children:l.description})]}),(0,t.jsxs)("div",{className:"mkt-card-meta",children:[g.length?(0,t.jsxs)("span",{children:["Engine ",(0,t.jsx)("b",{children:g.join(" \xb7 ")})]}):null,j.length?(0,t.jsxs)("span",{children:["Unlocks ",(0,t.jsxs)("b",{children:[j.length," tool",1===j.length?"":"s"]})]}):null,m.setup_kind?(0,t.jsxs)("span",{children:["Setup ",(0,t.jsx)("b",{children:"qr_pair"===(n=m.setup_kind)?"QR pairing":"binary_detect"===n?"Local binary":"API key"})]}):null,l.risk_summary?(0,t.jsxs)("span",{children:["Risk ",(0,t.jsx)("b",{children:l.risk_summary.length>40?l.risk_summary.slice(0,40)+"…":l.risk_summary})]}):null]}),x.length>0?(0,t.jsxs)("ul",{className:"connection-card-installs",children:[x.map(e=>(0,t.jsx)("li",{children:(0,t.jsx)(C,{install:e,projectName:e.project_id?u.projects[e.project_id]:null,agentName:e.agent_id?u.agents[e.agent_id]:null})},"".concat(e.scope,":").concat(e.project_id||"",":").concat(e.agent_id||""))),(0,t.jsx)("li",{children:(0,t.jsx)("button",{type:"button",className:"connection-card-add",onClick:()=>f({scope:"global",project_id:null,agent_id:null}),children:"+ Add another"})})]}):null,(0,t.jsxs)("div",{className:"mkt-card-foot",children:[(0,t.jsx)("span",{className:"mkt-availability",children:(null==a?void 0:a.footer)||(b?"Ready to use":"Not configured yet")}),(0,t.jsx)("button",{type:"button",className:"admin-button".concat(b?" secondary":""),onClick:()=>f(null),children:b?"Manage":"Configure"})]}),(0,t.jsx)(w,{open:c,onClose:()=>{o(!1),d(null)},connection:l,prefillScope:r})]})}function P(e){let{glyph:n}=e,l=String(n||"?").slice(0,1).toUpperCase();return(0,t.jsxs)("svg",{viewBox:"0 0 20 20",width:"20",height:"20","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"0",y:"0",width:"20",height:"20",rx:"5",fill:"currentColor",opacity:"0.08"}),(0,t.jsx)("text",{x:"10",y:"14",textAnchor:"middle",fontSize:"11",fontWeight:"600",fontFamily:"'IBM Plex Mono', monospace",fill:"currentColor",children:l})]})}let E={intake_form:"intake",agent_run:"agent",policy_gate:"policy",human_approval:"approval",package:"package"};function I(e){var n;let{item:l,toggleAction:s,currentKind:a}=e,i=!!l.installed,c=l.workflow||{};return(0,t.jsxs)("li",{className:"mkt-card kind-workflow ".concat(i?"on":""),children:[(0,t.jsxs)("div",{className:"mkt-card-head",children:[(0,t.jsx)(u,{kind:"workflow",size:20}),(0,t.jsx)(p,{kind:"workflow"})]}),(0,t.jsxs)("div",{className:"mkt-card-body",children:[(0,t.jsx)("h3",{className:"mkt-card-title",children:l.slug}),(0,t.jsx)("p",{className:"mkt-card-desc",children:l.description})]}),(0,t.jsxs)("div",{className:"mkt-card-meta",children:[(0,t.jsxs)("span",{children:["Stages ",(0,t.jsx)("b",{children:c.stage_count||0})]}),(0,t.jsxs)("span",{children:["Shape ",(0,t.jsx)("b",{children:Array.isArray(n=c.stage_kinds)&&n.length?n.map(e=>E[e]||e).join(" → "):"—"})]}),(0,t.jsxs)("span",{children:["By ",(0,t.jsx)("b",{children:l.author})]}),l.version?(0,t.jsxs)("span",{children:["Version ",(0,t.jsx)("b",{children:l.version})]}):null,l.risk_summary?(0,t.jsxs)("span",{children:["Risk ",(0,t.jsx)("b",{children:l.risk_summary.length>60?"".concat(l.risk_summary.slice(0,60),"…"):l.risk_summary})]}):null]}),(0,t.jsxs)("div",{className:"mkt-card-foot",children:[(0,t.jsx)("span",{className:"mkt-availability ".concat(i?"installed":""),children:i?"Installed":"Available"}),(0,t.jsx)(g,{action:s,itemId:l.id,installed:i,available:!0,label:"".concat(i?"Uninstall":"Install"," ").concat(l.slug),slugHint:l.slug,currentKind:a})]})]})}function L(e){var n;let{item:l,toggleAction:s,onBundleClick:a,onConnectionClick:i,connectionStatus:c,connectionPrefill:o,currentKind:r}=e,d="tool"===l.kind,h="skill"===l.kind,m="bundle"===l.kind,x="agent"===l.kind,b="connection"===l.kind,f="workflow"===l.kind,k=!!l.installed,v=!!l.available;return b?(0,t.jsx)(A,{item:l,status:c,prefillScope:o}):f?(0,t.jsx)(I,{item:l,toggleAction:s,currentKind:r}):(0,t.jsxs)("li",{className:"mkt-card kind-".concat(l.kind," ").concat(k?"on":""),children:[(0,t.jsxs)("div",{className:"mkt-card-head",children:[(0,t.jsx)(u,{kind:l.kind,category:l.category,size:20}),(0,t.jsx)(p,{kind:l.kind}),d&&l.tool?(0,t.jsx)(j,{level:l.tool.risk_level}):null]}),(0,t.jsxs)("div",{className:"mkt-card-body",children:[(0,t.jsx)("h3",{className:"mkt-card-title",children:l.slug}),(0,t.jsx)("p",{className:"mkt-card-desc",children:l.description})]}),(0,t.jsxs)("div",{className:"mkt-card-meta",children:[d&&l.tool?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{children:["Approval mode ",(0,t.jsx)("b",{children:l.tool.approval_mode})]}),(0,t.jsxs)("span",{children:["Config ",(0,t.jsx)("b",{children:(null==(n=l.tool.required_env)?void 0:n.length)?l.tool.required_env.join(" \xb7 "):"none"})]})]}):null,h&&l.skill?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{children:["Invocation ",(0,t.jsx)("b",{children:l.skill.invocation})]}),(0,t.jsxs)("span",{children:["Author ",(0,t.jsx)("b",{children:l.author})]})]}):null,m&&l.bundle?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{children:["Items ",(0,t.jsx)("b",{children:l.bundle.published_count})]}),(0,t.jsxs)("span",{children:["By ",(0,t.jsxs)("b",{children:[l.author,l.bundle.license?" \xb7 ".concat(l.bundle.license):""]})]})]}):null,x&&l.agent?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{children:["Role ",(0,t.jsx)("b",{children:l.agent.role})]}),(0,t.jsxs)("span",{children:["Engine ",(0,t.jsx)("b",{children:l.agent.engine_default})]}),(0,t.jsxs)("span",{children:["Installed ",(0,t.jsxs)("b",{children:[l.install_count||0,"x"]})]})]}):null,!d&&l.risk_summary?(0,t.jsxs)("span",{children:["Risk ",(0,t.jsx)("b",{children:l.risk_summary.length>40?l.risk_summary.slice(0,40)+"…":l.risk_summary})]}):null,l.version?(0,t.jsxs)("span",{children:["Version ",(0,t.jsx)("b",{children:l.version})]}):null]}),(0,t.jsxs)("div",{className:"mkt-card-foot",children:[(0,t.jsx)("span",{className:"mkt-availability ".concat(k?"installed":v?"":"warn"),children:k?"Installed":d&&!v?"Missing config":"Available"}),m?(0,t.jsx)("button",{type:"button",className:"mkt-toggle",role:"switch","aria-checked":!1,"aria-label":"Install ".concat(l.slug," (Phase 2)"),onClick:a}):(0,t.jsx)(g,{action:s,itemId:l.id,installed:k,available:v,label:"".concat(k?"Uninstall":"Install"," ").concat(l.slug),slugHint:l.slug,currentKind:r})]})]})}function R(e){let{open:n,onClose:l,action:s,mode:a="github",bundleSlug:i}=e,c="bundle"===a;return(0,t.jsx)(x.A,{open:n,onClose:l,eyebrow:c?"Bundle install \xb7 Phase 2":"Import from GitHub \xb7 Phase 2",title:c?"Installing ".concat(i||"this bundle"," lands in Phase 2"):"Importer lands in Phase 2",children:(0,t.jsxs)("form",{className:"agents-modal-form",action:s,children:[(0,t.jsx)("p",{className:"agents-modal-help",children:c?"Bundle installs walk through every contained tool and skill, surface a per-item risk roll-up, and let you confirm selectively. Phase 1 catalogs bundles so the UI shape is ready — install execution arrives in the next phase.":"Paste any public GitHub repo URL. Phase 2 will clone the repo read-only into workspace/imports/, parse skills/ and tools/ directories, classify each item by risk, and surface them for selective install with a code-review gate on JS adapters."}),c?(0,t.jsx)("input",{type:"hidden",name:"url",value:i?"bundle:".concat(i):"bundle:unknown"}):(0,t.jsx)("section",{className:"agents-modal-section",children:(0,t.jsxs)("label",{className:"agents-modal-field wide",children:[(0,t.jsx)("span",{children:"Repository URL"}),(0,t.jsx)("input",{name:"url",type:"url",placeholder:"https://github.com/owner/repo",disabled:!0,readOnly:!0,"aria-label":"GitHub repository URL"})]})}),(0,t.jsx)("p",{className:"agents-modal-help",style:{fontSize:11,color:"#9aa0aa"},children:c?"Agent personas are managed in the Agent Marketplace (coming soon).":"No code is fetched in Phase 1. Click queues an audit row so the team can prioritise."}),(0,t.jsxs)("footer",{className:"agents-modal-foot",children:[(0,t.jsx)("button",{type:"button",className:"admin-button secondary",onClick:l,children:"Close"}),(0,t.jsx)("button",{className:"admin-button",type:"submit",disabled:!0,children:c?"Coming Phase 2":"Coming next"})]})]})})}let T=["toast","slug","toast_kind"];function M(e,n,l){let t=n instanceof URLSearchParams?new URLSearchParams(n):new URLSearchParams(n.toString()),s=!1;for(let e of T)t.has(e)&&(t.delete(e),s=!0);if(!s)return;let a=t.toString();l.replace(a?"".concat(e,"?").concat(a):e,{scroll:!1})}function U(){let e=(0,a.useRouter)(),n=(0,a.usePathname)(),l=(0,a.useSearchParams)(),i=l.get("toast"),c=l.get("slug")||"",[o,r]=(0,s.useState)(()=>i?{state:i,slug:c,key:"".concat(i,":").concat(c,":").concat(Date.now())}:null),[d,u]=(0,s.useState)(!!i),h=l.toString();if((0,s.useEffect)(()=>{if(!i)return;r({state:i,slug:c,key:"".concat(i,":").concat(c,":").concat(Date.now())}),u(!0);let l=setTimeout(()=>u(!1),3800),t=setTimeout(()=>M(n,new URLSearchParams(h),e),4e3);return()=>{clearTimeout(l),clearTimeout(t)}},[i,c,h]),!d||!o)return null;let p=function(e,n){let l=n?'"'.concat(n,'"'):"item";return"installed"===e?{tone:"success",eyebrow:"Installed",text:"".concat(l," is now installed and available to your agents.")}:"uninstalled"===e?{tone:"success",eyebrow:"Uninstalled",text:"".concat(l," has been removed from your installed catalog.")}:"deferred"===e?{tone:"info",eyebrow:"Pending",text:"Bundle install for ".concat(l," lands in Phase 2 — the catalog now reflects the request.")}:"setup_required"===e?{tone:"info",eyebrow:"Setup required",text:"Open the setup assistant for ".concat(l," to finish connecting it.")}:"already_present"===e?{tone:"info",eyebrow:"Already installed",text:"A workflow with the same slug as ".concat(l," already exists. Edit it on /workflows.")}:"in_flight_cases"===e?{tone:"info",eyebrow:"Uninstall blocked",text:"".concat(l," has cases still running. Finish or cancel them before uninstalling.")}:"error"===e?{tone:"error",eyebrow:"Action failed",text:"Could not update ".concat(l,". Check the runtime panel for details.")}:null}(o.state,o.slug);return p?(0,t.jsxs)("div",{className:"mkt-toast ".concat(p.tone),role:"status","aria-live":"polite",children:[(0,t.jsx)("span",{children:p.eyebrow}),(0,t.jsx)("p",{children:p.text}),(0,t.jsx)("button",{type:"button",onClick:()=>{u(!1),M(n,l,e)},"aria-label":"Dismiss notification",children:"\xd7"})]},o.key):null}let q=["all","connection","tool","skill","bundle","agent","workflow"];function D(e,n){if(!n)return 0;let l=n.toLowerCase(),t=String(e.slug||"").toLowerCase(),s=String(e.title||"").toLowerCase();return t.startsWith(l)||s.startsWith(l)?100:t.includes(l)||s.includes(l)?80:String(e.author||"").toLowerCase().includes(l)?60:Array.isArray(e.tags)&&e.tags.join(" ").toLowerCase().includes(l)?50:30}function W(e){let{items:n,counts:l,categoriesByKind:i,toggleAction:c,importAction:d,initialKind:u="all"}=e,h=q.includes(u)?u:"all",[p,m]=(0,s.useState)(h),[j,g]=(0,s.useState)(null),[x,b]=(0,s.useState)(""),[f,k]=(0,s.useState)(!1),[v,y]=(0,s.useState)({open:!1,slug:null}),[N,_]=(0,s.useState)({open:!1,item:null}),C=(0,a.useSearchParams)(),S=(null==C?void 0:C.get("connection"))||null,A=(null==C?void 0:C.get("prefill_scope"))||null,P=(null==C?void 0:C.get("prefill_project_id"))||null,E=(null==C?void 0:C.get("prefill_agent_id"))||null,I=A?{scope:A,project_id:P,agent_id:E}:null;(0,s.useEffect)(()=>{g(null)},[p]);let T=(0,s.useMemo)(()=>{if("all"===p){let e=new Set,n=[];for(let l of Object.values(i||{}))for(let t of l)e.has(t)||(e.add(t),n.push(t));return n}return(null==i?void 0:i[p])||[]},[p,i]),M=(0,s.useMemo)(()=>{let e={};for(let l of"all"===p?n:n.filter(e=>e.kind===p))l.category&&(e[l.category]=(e[l.category]||0)+1);return e},[n,p]),W=(0,s.useMemo)(()=>{let e=n;if("all"!==p&&(e=e.filter(e=>e.kind===p)),j&&(e=e.filter(e=>e.category===j)),x.trim()){let n=x.trim();e=e.filter(e=>(function(e,n){if(!n)return!0;let l=n.toLowerCase(),t=String(e.slug||"").toLowerCase(),s=String(e.title||"").toLowerCase(),a=String(e.description||"").toLowerCase(),i=String(e.author||"").toLowerCase(),c=Array.isArray(e.tags)?e.tags.join(" ").toLowerCase():"";return t.includes(l)||s.includes(l)||a.includes(l)||i.includes(l)||c.includes(l)})(e,n)).slice().sort((e,l)=>D(l,n)-D(e,n))}return e},[n,p,j,x]),B=n.filter(e=>e.installed).length;return(0,t.jsxs)("div",{className:"mkt-page",children:[(0,t.jsx)(U,{}),(0,t.jsxs)("section",{className:"mkt-stats",children:[(0,t.jsxs)("div",{className:"mkt-stat",children:[(0,t.jsx)("b",{children:l.all}),(0,t.jsx)("span",{children:"Catalog"})]}),(0,t.jsxs)("div",{className:"mkt-stat connection",children:[(0,t.jsx)("b",{children:l.connection||0}),(0,t.jsx)("span",{children:"Connections"})]}),(0,t.jsxs)("div",{className:"mkt-stat",children:[(0,t.jsx)("b",{children:l.tool}),(0,t.jsx)("span",{children:"Tools"})]}),(0,t.jsxs)("div",{className:"mkt-stat",children:[(0,t.jsx)("b",{children:l.skill}),(0,t.jsx)("span",{children:"Skills"})]}),(0,t.jsxs)("div",{className:"mkt-stat",children:[(0,t.jsx)("b",{children:l.bundle}),(0,t.jsx)("span",{children:"Bundles"})]}),(0,t.jsxs)("div",{className:"mkt-stat agent",children:[(0,t.jsx)("b",{children:l.agent||0}),(0,t.jsx)("span",{children:"Agents"})]}),(0,t.jsxs)("div",{className:"mkt-stat workflow",children:[(0,t.jsx)("b",{children:l.workflow||0}),(0,t.jsx)("span",{children:"Workflows"})]})]}),(0,t.jsxs)("section",{className:"mkt-toolbar","aria-label":"Discover",children:[(0,t.jsx)(r,{value:x,onChange:b}),(0,t.jsxs)("button",{type:"button",className:"mkt-cta",onClick:()=>k(!0),children:[(0,t.jsx)("svg",{className:"mkt-cta-mark",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.92.57.1.78-.25.78-.55v-1.93c-3.2.69-3.87-1.54-3.87-1.54-.52-1.32-1.28-1.67-1.28-1.67-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.19 1.18.92-.26 1.91-.39 2.9-.39s1.98.13 2.9.39c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.69 5.41-5.26 5.69.41.36.77 1.06.77 2.13v3.16c0 .31.21.66.79.55C20.21 21.38 23.5 17.08 23.5 12 23.5 5.65 18.35.5 12 .5Z"})}),"Import from GitHub"]})]}),(0,t.jsx)(o,{activeKind:p,onKindChange:m,counts:l,categories:T,categoryCounts:M,scopeCount:"all"===p?l.all:l[p]||0,activeCategory:j,onCategoryChange:g}),(0,t.jsx)("section",{className:"mkt-section","aria-live":"polite",children:W.length?(0,t.jsx)("ul",{className:"mkt-grid",children:W.map(e=>(0,t.jsx)(L,{item:e,toggleAction:c,onBundleClick:()=>y({open:!0,slug:e.slug}),onConnectionClick:()=>_({open:!0,item:e}),connectionStatus:"connection"===e.kind?function(e){let n=e.connection;if(!n||!e.installed)return{status:"needs_setup",label:"Not connected",footer:null};let l=[];if(n.account_label&&l.push(n.account_label),n.last_4&&l.push("••• ".concat(n.last_4)),n.last_verified_at)try{let e=Math.round((Date.now()-new Date(n.last_verified_at).getTime())/6e4);e<1?l.push("verified just now"):e<60?l.push("verified ".concat(e,"m ago")):e<1440?l.push("verified ".concat(Math.round(e/60),"h ago")):l.push("verified ".concat(Math.round(e/1440),"d ago"))}catch(e){}return{status:"connected",label:"Connected",footer:l.length?l.join(" \xb7 "):null}}(e):null,connectionPrefill:"connection"===e.kind&&S&&e.slug===S?I:null,currentKind:p},e.id))}):(0,t.jsxs)("div",{className:"mkt-empty",children:[(0,t.jsx)("b",{children:"Nothing matches your search yet."}),(0,t.jsx)("p",{children:"Try a broader term, switch the kind tab, or clear the category filter. Looking for an agent persona? Those land in the Agent Marketplace (coming soon)."}),(0,t.jsxs)("small",{children:[B," installed \xb7 ",l.all," total"]})]})},"".concat(p,":").concat(j)),(0,t.jsx)(R,{open:f,onClose:()=>k(!1),action:d,mode:"github"}),(0,t.jsx)(R,{open:v.open,onClose:()=>y({open:!1,slug:null}),action:d,mode:"bundle",bundleSlug:v.slug}),(0,t.jsx)(w,{open:N.open,onClose:()=>_({open:!1,item:null}),connection:N.item})]})}},81969:(e,n,l)=>{Promise.resolve().then(l.bind(l,10677)),Promise.resolve().then(l.bind(l,60874))},85649:(e,n,l)=>{"use strict";l.d(n,{A:()=>i});var t=l(95155),s=l(12115),a=l(34788);function i(e){let{open:n,onClose:l,eyebrow:i,title:c,tone:o="default",size:r="default",children:d}=e,u=s.useRef(null);return s.useEffect(()=>{let e=u.current;e&&(n&&!e.open&&("function"==typeof e.showModal?e.showModal():e.setAttribute("open","")),!n&&e.open&&e.close())},[n]),s.useEffect(()=>{let e=u.current;if(!e)return;let n=e=>{e.preventDefault(),l()};return e.addEventListener("cancel",n),()=>e.removeEventListener("cancel",n)},[l]),(0,t.jsx)("dialog",{ref:u,className:"agents-modal".concat("wide"===r?" agents-modal--wide":""),onClick:e=>{e.target===u.current&&l()},children:n?(0,t.jsxs)("div",{className:"agents-modal-card".concat("danger"===o?" agents-modal-card--danger":""),onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("header",{className:"agents-modal-head",children:[(0,t.jsxs)("div",{children:[i?(0,t.jsx)("span",{className:"admin-kicker",children:i}):null,(0,t.jsx)("h2",{children:c})]}),(0,t.jsx)("button",{type:"button",className:"agents-modal-close",onClick:l,"aria-label":"Close",children:(0,t.jsx)(a.A,{size:14})})]}),d]}):null})}}},e=>{e.O(0,[2769,7695,8441,1255,7358],()=>e(e.s=81969)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[893],{45:(e,a,t)=>{"use strict";t.d(a,{default:()=>o});var s=t(12115),n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},l=t(64250);let r=(0,s.createContext)({}),o=(0,s.forwardRef)((e,a)=>{var t,o,c;let{color:i,size:d,strokeWidth:u,absoluteStrokeWidth:m,className:h="",children:p,iconNode:f,...j}=e,{size:x=24,strokeWidth:g=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:y=""}=null!=(t=(0,s.useContext)(r))?t:{},k=(null!=m?m:v)?24*Number(null!=u?u:g)/Number(null!=d?d:x):null!=u?u:g;return(0,s.createElement)("svg",{ref:a,...n,width:null!=(o=null!=d?d:x)?o:n.width,height:null!=(c=null!=d?d:x)?c:n.height,stroke:null!=i?i:b,strokeWidth:k,className:(0,l.z)("lucide",y,h),...!p&&!(e=>{for(let a in e)if(a.startsWith("aria-")||"role"===a||"title"===a)return!0;return!1})(j)&&{"aria-hidden":"true"},...j},[...f.map(e=>{let[a,t]=e;return(0,s.createElement)(a,t)}),...Array.isArray(p)?p:[p]])})},291:(e,a,t)=>{"use strict";t.d(a,{default:()=>d});var s=t(95155),n=t(12115),l=t(47650),r=t(85649),o=t(30926);let c=(0,o.createServerReference)("408a46cc54bebc1669f3b253a5f64a7eb4954bc12b",o.callServer,void 0,o.findSourceMapURL,"deleteProjectAction");function i(e){let{disabled:a}=e,{pending:t}=(0,l.useFormStatus)();return(0,s.jsx)("button",{type:"submit",className:"admin-button danger",disabled:t||a,"aria-busy":t?"true":void 0,children:t?"Deleting…":"Delete project"})}function d(e){let{projectId:a,projectName:t,projectSlug:l,isProtected:o}=e,[d,u]=n.useState(!1),[m,h]=n.useState("");if(o)return(0,s.jsxs)("span",{className:"admin-button secondary project-delete is-locked","aria-disabled":"true",title:"The Personal project is the default scope and cannot be deleted.",children:[(0,s.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{marginRight:6,verticalAlign:"-1px"},children:[(0,s.jsx)("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2"}),(0,s.jsx)("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Protected"]});n.useEffect(()=>{d||h("")},[d]);let p=m.trim()===l;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"admin-button secondary project-delete",onClick:()=>u(!0),"aria-label":"Delete ".concat(t),children:"Delete"}),(0,s.jsx)(r.A,{open:d,onClose:()=>u(!1),eyebrow:"Delete project",title:"Delete ".concat(t,"?"),tone:"danger",children:(0,s.jsxs)("form",{className:"agents-modal-form",action:c,children:[(0,s.jsx)("input",{type:"hidden",name:"project_id",value:a}),(0,s.jsx)("p",{className:"agents-modal-help",children:"This removes the project, its agents, Disk files, memory, secrets, and audit history. The folder on your local drive is left untouched."}),(0,s.jsx)("section",{className:"agents-modal-section",children:(0,s.jsxs)("label",{className:"agents-modal-field wide",children:[(0,s.jsxs)("span",{children:["Type ",(0,s.jsx)("code",{className:"agents-modal-inline-code",children:l})," to confirm"]}),(0,s.jsx)("input",{type:"text",autoComplete:"off",spellCheck:!1,value:m,onChange:e=>h(e.target.value),placeholder:l,autoFocus:!0})]})}),(0,s.jsxs)("footer",{className:"agents-modal-foot",children:[(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>u(!1),children:"Cancel"}),(0,s.jsx)(i,{disabled:!p})]})]})})]})}},10677:(e,a,t)=>{"use strict";t.d(a,{default:()=>l});var s=t(95155),n=t(12115);function l(){let[e,a]=(0,n.useState)([]),[t,l]=(0,n.useState)("");return(0,n.useEffect)(()=>{l(localStorage.getItem("madarx.activeProjectId")||""),fetch("/api/projects").then(e=>e.json()).then(e=>a(e.projects||[])).catch(()=>{})},[]),(0,s.jsx)("div",{className:"project-switcher","data-project-switcher":!0,children:(0,s.jsxs)("select",{value:t,onChange:e=>{var a;l(a=e.target.value),a?localStorage.setItem("madarx.activeProjectId",a):localStorage.removeItem("madarx.activeProjectId"),window.dispatchEvent(new CustomEvent("madarx:project-change",{detail:{project_id:a||null}}))},"aria-label":"Active project",children:[(0,s.jsx)("option",{value:"",children:"All projects"}),e.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})})}},13185:(e,a,t)=>{"use strict";t.d(a,{A:()=>o});var s=t(12115),n=t(64250);let l=e=>{let a=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,a,t)=>t?t.toUpperCase():a.toLowerCase());return a.charAt(0).toUpperCase()+a.slice(1)};var r=t(45);let o=(e,a)=>{let t=(0,s.forwardRef)((t,o)=>{let{className:c,...i}=t;return(0,s.createElement)(r.default,{ref:o,iconNode:a,className:(0,n.z)("lucide-".concat(l(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),c),...i})});return t.displayName=l(e),t}},30926:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),!function(e,a){for(var t in a)Object.defineProperty(e,t,{enumerable:!0,get:a[t]})}(a,{callServer:function(){return s.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return n.findSourceMapURL}});let s=t(41209),n=t(85153),l=t(77197)},34788:(e,a,t)=>{"use strict";t.d(a,{A:()=>s});let s=(0,t(13185).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},59097:(e,a,t)=>{"use strict";t.d(a,{A:()=>l});var s=t(95155),n=t(12115);function l(e){let{name:a="folder_path",value:t,onChange:l,inputRef:r,placeholder:o="/Users/you/Documents/my-project"}=e,[c,i]=n.useState(null),[d,u]=n.useState(!1),[m,h]=n.useState(""),[p,f]=n.useState(""),[j,x]=n.useState(null);async function g(){var e;let a;if(i(null),!(null==(e=navigator.clipboard)?void 0:e.readText))return void i({kind:"error",message:"Clipboard not available."});try{a=await navigator.clipboard.readText()}catch(e){i({kind:"error",message:"Allow clipboard access."});return}let t=(a||"").trim();if((t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),t.startsWith("file://"))try{t=decodeURI(t.slice(7))}catch(e){}return t?t.startsWith("/")||t.startsWith("~")?void(l(t),i({kind:"success",message:"Pasted."})):void i({kind:"error",message:"Path must be absolute."}):void i({kind:"error",message:"Clipboard is empty."})}async function v(){i(null),x("pick");try{let e=await fetch("/api/fs/pick-folder",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({title:"Choose project folder",start_path:t&&t.startsWith("/")?t:void 0})});if(499===e.status)return void i({kind:"error",message:"Cancelled."});let a=await e.json();if(!e.ok)return void i({kind:"error",message:a.error||"Picker failed."});l(a.folder_path),i({kind:"success",message:"Selected ".concat(a.folder_path)})}catch(e){i({kind:"error",message:String((null==e?void 0:e.message)||e)})}finally{x(null)}}async function b(){if(i(null),!m.trim()||!p.trim())return void i({kind:"error",message:"Parent and name required."});x("create");try{let e=await fetch("/api/fs/create-folder",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({parent:m.trim(),name:p.trim()})}),a=await e.json();if(!e.ok)return void i({kind:"error",message:a.error||"Create failed."});l(a.folder_path),u(!1),f(""),i({kind:"success",message:"Created ".concat(a.folder_path)})}catch(e){i({kind:"error",message:String((null==e?void 0:e.message)||e)})}finally{x(null)}}return n.useEffect(()=>{d&&!m&&h(t||"~/Documents")},[d,t,m]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"agents-modal-paste-row",children:[(0,s.jsx)("input",{ref:r,name:a,type:"text",placeholder:o,autoComplete:"off",spellCheck:!1,value:t||"",onChange:e=>{l(e.target.value),c&&i(null)},required:!0}),(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:v,disabled:"pick"===j,children:"pick"===j?"Opening…":"Choose folder…"})]}),(0,s.jsxs)("div",{className:"agents-modal-folder-tools",children:[(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:g,children:"Paste from clipboard"}),(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>l("~/Documents"),children:"~/Documents"}),(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>l("~/Desktop"),children:"~/Desktop"}),(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>u(e=>!e),children:d?"Cancel new folder":"+ New folder"})]}),d?(0,s.jsxs)("div",{className:"agents-modal-create-folder",children:[(0,s.jsx)("small",{children:"Create a folder anywhere outside system directories. Parent must exist."}),(0,s.jsx)("div",{className:"agents-modal-create-row",children:(0,s.jsx)("input",{type:"text",placeholder:"Parent (e.g. ~/Documents)",value:m,onChange:e=>h(e.target.value),spellCheck:!1,autoComplete:"off"})}),(0,s.jsxs)("div",{className:"agents-modal-create-row",children:[(0,s.jsx)("input",{type:"text",placeholder:"New folder name",value:p,onChange:e=>f(e.target.value),spellCheck:!1,autoComplete:"off"}),(0,s.jsx)("button",{type:"button",className:"admin-button",onClick:b,disabled:"create"===j,children:"create"===j?"Creating…":"Create"})]})]}):null,c?(0,s.jsx)("p",{className:"agents-modal-feedback ".concat(c.kind),role:"status","aria-live":"polite",children:c.message}):null]})}},64250:(e,a,t)=>{"use strict";t.d(a,{z:()=>s});let s=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.filter((e,a,t)=>!!e&&""!==e.trim()&&t.indexOf(e)===a).join(" ").trim()}},76324:(e,a,t)=>{"use strict";t.d(a,{default:()=>m});var s=t(95155),n=t(12115),l=t(47650),r=t(85649),o=t(30926);let c=(0,o.createServerReference)("40f83c2d35104ffdcbb711c7db5fe718605e2177f3",o.callServer,void 0,o.findSourceMapURL,"createProjectAction");var i=t(59097);let d=[{value:"#c2452a",name:"Mars Red"},{value:"#a83a22",name:"Deep Red"},{value:"#7c2b19",name:"Dark Red"},{value:"#111318",name:"Charcoal"},{value:"#3f3a30",name:"Warm Black"},{value:"#68707b",name:"Slate"},{value:"#cdb78a",name:"Warm Sand"},{value:"#1f6c9f",name:"Skill Blue"}];function u(){let{pending:e}=(0,l.useFormStatus)();return(0,s.jsx)("button",{type:"submit",className:"admin-button",disabled:e,"aria-busy":e?"true":void 0,children:e?"Creating…":"Create project"})}function m(e){let{workspaceRoot:a="~/workspace/projects"}=e,[t,l]=n.useState(!1),[o,m]=n.useState(""),[h,p]=n.useState("workspace"),[f,j]=n.useState(""),x=n.useRef(null),g=n.useMemo(()=>"".concat(a.replace(/\/$/,""),"/").concat(String(o||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"project"),[a,o]);return n.useEffect(()=>{var e;"custom"===h&&(null==(e=x.current)||e.focus())},[h]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{type:"button",className:"admin-button agents-new-cta",onClick:()=>l(!0),children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"agents-new-cta-glyph",children:"+"}),"New project"]}),(0,s.jsx)(r.A,{open:t,onClose:()=>l(!1),eyebrow:"New project",title:"Create a project",children:(0,s.jsxs)("form",{className:"agents-modal-form",action:c,children:[(0,s.jsx)("p",{className:"agents-modal-help",children:"Scope agents, documents, memory, and integrations together."}),(0,s.jsx)("section",{className:"agents-modal-section",children:(0,s.jsxs)("label",{className:"agents-modal-field wide",children:[(0,s.jsx)("span",{children:"Name"}),(0,s.jsx)("input",{name:"name",type:"text",required:!0,placeholder:"Acme Co.",autoComplete:"off",value:o,onChange:e=>m(e.target.value),autoFocus:!0})]})}),(0,s.jsxs)("section",{className:"agents-modal-section",children:[(0,s.jsxs)("div",{className:"agents-modal-section-head",children:[(0,s.jsx)("span",{children:"Folder location"}),(0,s.jsx)("small",{children:"Where this project lives on disk."})]}),(0,s.jsxs)("div",{className:"agents-modal-radio-group",children:[(0,s.jsxs)("label",{className:"agents-modal-radio ".concat("workspace"===h?"on":""),children:[(0,s.jsx)("input",{type:"radio",name:"folder_mode",value:"workspace",checked:"workspace"===h,onChange:()=>p("workspace")}),(0,s.jsxs)("span",{className:"agents-modal-radio-body",children:[(0,s.jsx)("b",{children:"madarX workspace"}),(0,s.jsx)("code",{title:g,children:function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:48;if(!e||e.length<=a)return e;let t=e.slice(0,Math.floor(a/2)-1),s=e.slice(e.length-Math.floor(a/2)+2);return"".concat(t,"…").concat(s)}(g)})]})]}),(0,s.jsxs)("label",{className:"agents-modal-radio ".concat("custom"===h?"on":""),children:[(0,s.jsx)("input",{type:"radio",name:"folder_mode",value:"custom",checked:"custom"===h,onChange:()=>p("custom")}),(0,s.jsxs)("span",{className:"agents-modal-radio-body",children:[(0,s.jsx)("b",{children:"Custom path"}),(0,s.jsx)("small",{children:"Any absolute folder. Created if missing."})]})]})]}),"custom"===h?(0,s.jsx)(i.A,{inputRef:x,value:f,onChange:j}):(0,s.jsx)("input",{type:"hidden",name:"folder_path",value:""})]}),(0,s.jsxs)("section",{className:"agents-modal-section",children:[(0,s.jsxs)("div",{className:"agents-modal-section-head",children:[(0,s.jsx)("span",{children:"Color"}),(0,s.jsx)("small",{children:"Used for the project tile across the app."})]}),(0,s.jsxs)("fieldset",{className:"agents-modal-swatches",children:[(0,s.jsx)("legend",{className:"visually-hidden",children:"Project color"}),d.map(e=>(0,s.jsxs)("label",{className:"agents-modal-swatch",style:{"--swatch":e.value},children:[(0,s.jsx)("input",{type:"radio",name:"color",value:e.value,defaultChecked:"#c2452a"===e.value}),(0,s.jsx)("span",{className:"agents-modal-swatch-ring","aria-hidden":"true"}),(0,s.jsx)("span",{className:"visually-hidden",children:e.name})]},e.value))]})]}),(0,s.jsxs)("section",{className:"agents-modal-section",children:[(0,s.jsxs)("div",{className:"agents-modal-section-head",children:[(0,s.jsx)("span",{children:"Description"}),(0,s.jsx)("small",{children:"Used as context for agents working in this project."})]}),(0,s.jsx)("label",{className:"agents-modal-field wide",children:(0,s.jsx)("textarea",{name:"description",rows:3,placeholder:"What is this project for? Goals, audience, voice, constraints."})})]}),(0,s.jsxs)("footer",{className:"agents-modal-foot",children:[(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>l(!1),children:"Cancel"}),(0,s.jsx)(u,{})]})]})})]})}},85649:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});var s=t(95155),n=t(12115),l=t(34788);function r(e){let{open:a,onClose:t,eyebrow:r,title:o,tone:c="default",size:i="default",children:d}=e,u=n.useRef(null);return n.useEffect(()=>{let e=u.current;e&&(a&&!e.open&&("function"==typeof e.showModal?e.showModal():e.setAttribute("open","")),!a&&e.open&&e.close())},[a]),n.useEffect(()=>{let e=u.current;if(!e)return;let a=e=>{e.preventDefault(),t()};return e.addEventListener("cancel",a),()=>e.removeEventListener("cancel",a)},[t]),(0,s.jsx)("dialog",{ref:u,className:"agents-modal".concat("wide"===i?" agents-modal--wide":""),onClick:e=>{e.target===u.current&&t()},children:a?(0,s.jsxs)("div",{className:"agents-modal-card".concat("danger"===c?" agents-modal-card--danger":""),onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("header",{className:"agents-modal-head",children:[(0,s.jsxs)("div",{children:[r?(0,s.jsx)("span",{className:"admin-kicker",children:r}):null,(0,s.jsx)("h2",{children:o})]}),(0,s.jsx)("button",{type:"button",className:"agents-modal-close",onClick:t,"aria-label":"Close",children:(0,s.jsx)(l.A,{size:14})})]}),d]}):null})}},97749:(e,a,t)=>{"use strict";t.d(a,{default:()=>m});var s=t(95155),n=t(12115),l=t(47650),r=t(85649),o=t(30926);let c=(0,o.createServerReference)("40f2f10cd28c6fb5936fd8cb77ad59d514e3951c3a",o.callServer,void 0,o.findSourceMapURL,"updateProjectAction");var i=t(59097);let d=[{value:"#c2452a",name:"Mars Red"},{value:"#a83a22",name:"Deep Red"},{value:"#7c2b19",name:"Dark Red"},{value:"#111318",name:"Charcoal"},{value:"#3f3a30",name:"Warm Black"},{value:"#68707b",name:"Slate"},{value:"#cdb78a",name:"Warm Sand"},{value:"#1f6c9f",name:"Skill Blue"}];function u(){let{pending:e}=(0,l.useFormStatus)();return(0,s.jsx)("button",{type:"submit",className:"admin-button",disabled:e,"aria-busy":e?"true":void 0,children:e?"Saving…":"Save changes"})}function m(e){let{projectId:a,projectName:t,projectColor:l,projectDescription:o,projectFolderPath:m}=e,[h,p]=n.useState(!1),[f,j]=n.useState("keep"),[x,g]=n.useState(m||""),v=n.useRef(null);return n.useEffect(()=>{h&&(j("keep"),g(m||""))},[h,m]),n.useEffect(()=>{var e;"custom"===f&&(null==(e=v.current)||e.focus())},[f]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"admin-button secondary project-edit",onClick:()=>p(!0),"aria-label":"Edit ".concat(t),children:"Edit"}),(0,s.jsx)(r.A,{open:h,onClose:()=>p(!1),eyebrow:"Edit project",title:"Edit ".concat(t),children:(0,s.jsxs)("form",{className:"agents-modal-form",action:c,children:[(0,s.jsx)("input",{type:"hidden",name:"project_id",value:a}),(0,s.jsx)("section",{className:"agents-modal-section",children:(0,s.jsxs)("label",{className:"agents-modal-field wide",children:[(0,s.jsx)("span",{children:"Name"}),(0,s.jsx)("input",{name:"name",type:"text",defaultValue:t,autoComplete:"off",required:!0})]})}),(0,s.jsxs)("section",{className:"agents-modal-section",children:[(0,s.jsxs)("div",{className:"agents-modal-section-head",children:[(0,s.jsx)("span",{children:"Folder location"}),(0,s.jsx)("small",{children:"Where project files live on disk. Move only if you've already moved the folder yourself."})]}),(0,s.jsxs)("div",{className:"agents-modal-radio-group",children:[(0,s.jsxs)("label",{className:"agents-modal-radio ".concat("keep"===f?"on":""),children:[(0,s.jsx)("input",{type:"radio",name:"folder_mode",value:"keep",checked:"keep"===f,onChange:()=>j("keep")}),(0,s.jsxs)("span",{className:"agents-modal-radio-body",children:[(0,s.jsx)("b",{children:"Keep current"}),(0,s.jsx)("code",{title:m||"",children:function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:48;if(!e||e.length<=a)return e;let t=e.slice(0,Math.floor(a/2)-1),s=e.slice(e.length-Math.floor(a/2)+2);return"".concat(t,"…").concat(s)}(m)||"(not set)"})]})]}),(0,s.jsxs)("label",{className:"agents-modal-radio ".concat("custom"===f?"on":""),children:[(0,s.jsx)("input",{type:"radio",name:"folder_mode",value:"custom",checked:"custom"===f,onChange:()=>j("custom")}),(0,s.jsxs)("span",{className:"agents-modal-radio-body",children:[(0,s.jsx)("b",{children:"Change to…"}),(0,s.jsx)("small",{children:"Absolute path. Must already exist or be writable."})]})]})]}),"custom"===f?(0,s.jsx)(i.A,{inputRef:v,value:x,onChange:g}):(0,s.jsx)("input",{type:"hidden",name:"folder_path",value:""})]}),(0,s.jsxs)("section",{className:"agents-modal-section",children:[(0,s.jsxs)("div",{className:"agents-modal-section-head",children:[(0,s.jsx)("span",{children:"Color"}),(0,s.jsx)("small",{children:"Tile color across the app."})]}),(0,s.jsxs)("fieldset",{className:"agents-modal-swatches",children:[(0,s.jsx)("legend",{className:"visually-hidden",children:"Project color"}),d.map(e=>(0,s.jsxs)("label",{className:"agents-modal-swatch",style:{"--swatch":e.value},children:[(0,s.jsx)("input",{type:"radio",name:"color",value:e.value,defaultChecked:e.value===(l||"#c2452a")}),(0,s.jsx)("span",{className:"agents-modal-swatch-ring","aria-hidden":"true"}),(0,s.jsx)("span",{className:"visually-hidden",children:e.name})]},e.value))]})]}),(0,s.jsxs)("section",{className:"agents-modal-section",children:[(0,s.jsxs)("div",{className:"agents-modal-section-head",children:[(0,s.jsx)("span",{children:"Description"}),(0,s.jsx)("small",{children:"Used as context for agents working in this project."})]}),(0,s.jsx)("label",{className:"agents-modal-field wide",children:(0,s.jsx)("textarea",{name:"description",rows:3,defaultValue:o||"",placeholder:"What is this project for? Goals, audience, voice, constraints."})})]}),(0,s.jsxs)("footer",{className:"agents-modal-foot",children:[(0,s.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(u,{})]})]})})]})}},99168:(e,a,t)=>{Promise.resolve().then(t.bind(t,10677)),Promise.resolve().then(t.bind(t,291)),Promise.resolve().then(t.bind(t,97749)),Promise.resolve().then(t.bind(t,76324)),Promise.resolve().then(t.t.bind(t,52619,23))}},e=>{e.O(0,[2619,8441,1255,7358],()=>e(e.s=99168)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1953],{45:(e,t,a)=>{"use strict";a.d(t,{default:()=>l});var r=a(12115),s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},i=a(64250);let n=(0,r.createContext)({}),l=(0,r.forwardRef)((e,t)=>{var a,l,c;let{color:h,size:d,strokeWidth:o,absoluteStrokeWidth:u,className:m="",children:g,iconNode:p,...y}=e,{size:k=24,strokeWidth:f=2,absoluteStrokeWidth:x=!1,color:v="currentColor",className:b=""}=null!=(a=(0,r.useContext)(n))?a:{},A=(null!=u?u:x)?24*Number(null!=o?o:f)/Number(null!=d?d:k):null!=o?o:f;return(0,r.createElement)("svg",{ref:t,...s,width:null!=(l=null!=d?d:k)?l:s.width,height:null!=(c=null!=d?d:k)?c:s.height,stroke:null!=h?h:v,strokeWidth:A,className:(0,i.z)("lucide",b,m),...!g&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(y)&&{"aria-hidden":"true"},...y},[...p.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(g)?g:[g]])})},13185:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var r=a(12115),s=a(64250);let i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var n=a(45);let l=(e,t)=>{let a=(0,r.forwardRef)((a,l)=>{let{className:c,...h}=a;return(0,r.createElement)(n.default,{ref:l,iconNode:t,className:(0,s.z)("lucide-".concat(i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),c),...h})});return a.displayName=i(e),a}},20063:(e,t,a)=>{"use strict";var r=a(47260);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}})},32881:(e,t,a)=>{"use strict";a.d(t,{default:()=>v});var r=a(95155),s=a(52619),i=a.n(s),n=a(20063),l=a(13185);let c=(0,l.A)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),h=(0,l.A)("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);var d=a(41516);let o=(0,l.A)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),u=(0,l.A)("brush",[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]]),m=(0,l.A)("compass",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]),g=(0,l.A)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),p=(0,l.A)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]),y=(0,l.A)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);var k=a(88977);let f=(0,l.A)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),x=[{label:"General",items:[{id:"account",name:"Account",icon:c,href:"/settings/account"},{id:"appearance",name:"Appearance",icon:h,href:"/settings/appearance"}]},{label:"Identity",items:[{id:"team",name:"Team",icon:d.A,href:"/settings/team"},{id:"organization",name:"Agent chart",icon:o,href:"/settings/organization"},{id:"brand",name:"Brand templates",icon:u,href:"/settings/brand"},{id:"onboarding",name:"Onboarding",icon:m,href:"/settings/onboarding"}]},{label:"Agent runtime",items:[{id:"engines",name:"Engines",icon:g,href:"/settings/engines"},{id:"connectors",name:"Connectors",icon:p,href:"/settings/connectors"},{id:"tools",name:"Tools & secrets",icon:y,href:"/settings/tools"}]},{label:"Advanced",items:[{id:"advanced",name:"Advanced",icon:k.A,href:"/settings/advanced"},{id:"runtime",name:"Runtime diagnostics",icon:f,href:"/settings/runtime"}]}];function v(){let e=(0,n.usePathname)()||"/settings";return(0,r.jsxs)("nav",{className:"settings-rail","aria-label":"Settings sections",children:[(0,r.jsxs)("div",{className:"settings-rail-head",children:[(0,r.jsx)("span",{className:"settings-rail-title",children:"Settings"}),(0,r.jsx)("small",{className:"settings-rail-sub",children:"madarX OS v1.0"})]}),(0,r.jsx)("ul",{className:"settings-rail-list",children:x.map((t,a)=>(0,r.jsxs)("li",{className:"settings-rail-group",children:[a>0?(0,r.jsx)("hr",{className:"settings-rail-divider","aria-hidden":"true"}):null,(0,r.jsx)("span",{className:"settings-rail-group-label",children:t.label}),(0,r.jsx)("ul",{className:"settings-rail-sublist",children:t.items.map(t=>{let a=t.icon,s=!t.stub&&!!t.href&&(t.href===e||e.startsWith("".concat(t.href,"/")));return t.stub?(0,r.jsx)("li",{children:(0,r.jsxs)("span",{className:"settings-rail-item","data-stub":"true","aria-disabled":"true",title:"Coming soon",children:[(0,r.jsx)(a,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),(0,r.jsx)("span",{className:"settings-rail-label",children:t.name}),(0,r.jsx)("span",{className:"settings-rail-tag",children:"soon"})]})},t.id):(0,r.jsx)("li",{children:(0,r.jsxs)(i(),{href:t.href,prefetch:!0,className:"settings-rail-item","data-active":s?"true":void 0,"aria-current":s?"page":void 0,children:[(0,r.jsx)(a,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),(0,r.jsx)("span",{className:"settings-rail-label",children:t.name})]})},t.id)})})]},t.label))})]})}},37642:(e,t,a)=>{Promise.resolve().then(a.bind(a,32881))},41516:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(13185).A)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},64250:(e,t,a)=>{"use strict";a.d(t,{z:()=>r});let r=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim()}},88977:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});let r=(0,a(13185).A)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]])}},e=>{e.O(0,[2619,8441,1255,7358],()=>e(e.s=37642)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5226],{45:(e,a,t)=>{"use strict";t.d(a,{default:()=>r});var n=t(12115),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},s=t(64250);let l=(0,n.createContext)({}),r=(0,n.forwardRef)((e,a)=>{var t,r,o;let{color:c,size:d,strokeWidth:m,absoluteStrokeWidth:u,className:h="",children:p,iconNode:x,...y}=e,{size:g=24,strokeWidth:v=2,absoluteStrokeWidth:j=!1,color:f="currentColor",className:b=""}=null!=(t=(0,n.useContext)(l))?t:{},k=(null!=u?u:j)?24*Number(null!=m?m:v)/Number(null!=d?d:g):null!=m?m:v;return(0,n.createElement)("svg",{ref:a,...i,width:null!=(r=null!=d?d:g)?r:i.width,height:null!=(o=null!=d?d:g)?o:i.height,stroke:null!=c?c:f,strokeWidth:k,className:(0,s.z)("lucide",b,h),...!p&&!(e=>{for(let a in e)if(a.startsWith("aria-")||"role"===a||"title"===a)return!0;return!1})(y)&&{"aria-hidden":"true"},...y},[...x.map(e=>{let[a,t]=e;return(0,n.createElement)(a,t)}),...Array.isArray(p)?p:[p]])})},1253:(e,a,t)=>{"use strict";t.d(a,{default:()=>r});var n=t(95155),i=t(12115),s=t(20063),l=t(78129);function r(e){let{orgId:a,name:t,canRename:r=!1}=e,o=(0,s.useRouter)(),[c,d]=(0,i.useState)(!1),[m,u]=(0,i.useState)(t),[h,p]=(0,i.useState)(!1),[x,y]=(0,i.useState)("");async function g(e){e.preventDefault();let n=m.trim();if(!n||n===t){d(!1),u(t);return}y(""),p(!0);try{let e=await fetch("/api/orgs/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n})}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||t.message||"Could not rename organization.");d(!1),o.refresh()}catch(e){y(e.message)}finally{p(!1)}}return r?c?(0,n.jsxs)("form",{onSubmit:g,style:{display:"inline-flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[(0,n.jsx)("input",{className:"admin-input",value:m,onChange:e=>u(e.target.value),maxLength:80,autoFocus:!0,"aria-label":"Organization name",style:{minWidth:220}}),(0,n.jsx)("button",{type:"submit",className:"admin-btn-primary admin-btn-sm",disabled:h||!m.trim(),children:h?"Saving…":"Save"}),(0,n.jsx)("button",{type:"button",className:"admin-btn-sm",disabled:h,onClick:()=>{d(!1),u(t),y("")},children:"Cancel"}),x?(0,n.jsx)("span",{role:"alert",style:{color:"var(--accent-600)",fontSize:"0.85em",width:"100%"},children:x}):null]}):(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,n.jsx)("b",{children:t}),(0,n.jsxs)("button",{type:"button",className:"admin-btn-sm",onClick:()=>{u(t),d(!0),y("")},style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},"aria-label":"Rename organization",children:[(0,n.jsx)(l.A,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),"Rename"]})]}):(0,n.jsx)("b",{children:t})}},9609:(e,a,t)=>{Promise.resolve().then(t.bind(t,10677)),Promise.resolve().then(t.bind(t,55781)),Promise.resolve().then(t.bind(t,70658)),Promise.resolve().then(t.bind(t,80175)),Promise.resolve().then(t.bind(t,66737)),Promise.resolve().then(t.bind(t,1253)),Promise.resolve().then(t.bind(t,45))},10677:(e,a,t)=>{"use strict";t.d(a,{default:()=>s});var n=t(95155),i=t(12115);function s(){let[e,a]=(0,i.useState)([]),[t,s]=(0,i.useState)("");return(0,i.useEffect)(()=>{s(localStorage.getItem("madarx.activeProjectId")||""),fetch("/api/projects").then(e=>e.json()).then(e=>a(e.projects||[])).catch(()=>{})},[]),(0,n.jsx)("div",{className:"project-switcher","data-project-switcher":!0,children:(0,n.jsxs)("select",{value:t,onChange:e=>{var a;s(a=e.target.value),a?localStorage.setItem("madarx.activeProjectId",a):localStorage.removeItem("madarx.activeProjectId"),window.dispatchEvent(new CustomEvent("madarx:project-change",{detail:{project_id:a||null}}))},"aria-label":"Active project",children:[(0,n.jsx)("option",{value:"",children:"All projects"}),e.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})})}},13185:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});var n=t(12115),i=t(64250);let s=e=>{let a=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,a,t)=>t?t.toUpperCase():a.toLowerCase());return a.charAt(0).toUpperCase()+a.slice(1)};var l=t(45);let r=(e,a)=>{let t=(0,n.forwardRef)((t,r)=>{let{className:o,...c}=t;return(0,n.createElement)(l.default,{ref:r,iconNode:a,className:(0,i.z)("lucide-".concat(s(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),o),...c})});return t.displayName=s(e),t}},20063:(e,a,t)=>{"use strict";var n=t(47260);t.o(n,"usePathname")&&t.d(a,{usePathname:function(){return n.usePathname}}),t.o(n,"useRouter")&&t.d(a,{useRouter:function(){return n.useRouter}}),t.o(n,"useSearchParams")&&t.d(a,{useSearchParams:function(){return n.useSearchParams}})},25352:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(13185).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},27667:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(13185).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},55781:(e,a,t)=>{"use strict";t.d(a,{default:()=>s});var n=t(95155),i=t(12115);function s(e){let{initial:a}=e,[t,s]=(0,i.useState)((null==a?void 0:a.mode)||"local"),[l,r]=(0,i.useState)((null==a?void 0:a.url)||""),[o,c]=(0,i.useState)((null==a?void 0:a.anonKey)||""),[d,m]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1),[p,x]=(0,i.useState)(!1),[y,g]=(0,i.useState)(null),v=!!(null==a?void 0:a.envLocked),j=!!(null==a?void 0:a.serviceKeySet),f=(null==a?void 0:a.mode)==="supabase";async function b(e){let a=await fetch("/api/auth/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),t=await a.json().catch(()=>({}));return{status:a.status,data:t}}async function k(){g(null),h(!0);try{var e;let{status:a,data:t}=await b({action:"test",url:l,anonKey:o});t.ok?g({tone:"ok",text:"Connection succeeded — Supabase project is reachable."}):403===a?g({tone:"err",text:"Not authorized — your session did not resolve as an owner/admin (this is not a connectivity problem). Reload after signing in, or reset to local mode using the recovery token in data/.auth-recovery-token."}):(null==(e=t.test)?void 0:e.error)?g({tone:"err",text:"Connection failed: ".concat(t.test.error,".")}):g({tone:"err",text:"Connection test failed: ".concat(t.error||"unknown error",".")})}catch(e){g({tone:"err",text:"Could not reach the server to run the test."})}finally{h(!1)}}async function N(){g(null),x(!0);try{let a={action:"save",mode:t};l&&(a.url=l),o&&(a.anonKey=o),d&&(a.serviceKey=d);let{status:n,data:i}=await b(a);if(422===n){var e;g({tone:"err",text:"Cannot switch to Supabase — connection test failed: ".concat((null==(e=i.test)?void 0:e.error)||"unreachable",". Fix the URL/anon key and try again.")});return}if(403===n)return void g({tone:"err",text:"Not allowed — you must be an owner or admin to change auth settings."});if(!i.ok)return void g({tone:"err",text:"Save failed: ".concat(i.error||"unknown error",".")});if("supabase"===t&&!f){g({tone:"info",text:"Saved. Supabase mode enabled — redirecting to sign in…"}),setTimeout(()=>window.location.assign("/login"),800);return}g({tone:"ok",text:"Authentication settings saved."}),setTimeout(()=>window.location.reload(),700)}catch(e){g({tone:"err",text:"Could not reach the server to save."})}finally{x(!1)}}return(0,n.jsxs)("div",{className:"auth-config-form",style:{display:"grid",gap:"0.85rem"},children:[(0,n.jsxs)("div",{className:"auth-mode-toggle",role:"radiogroup","aria-label":"Authentication mode",children:[(0,n.jsxs)("button",{type:"button",role:"radio","aria-checked":"local"===t,className:"local"===t?"active":"",onClick:()=>!v&&s("local"),disabled:v,children:["Local operator",(0,n.jsx)("small",{children:"Single owner, no sign-in. Default."})]}),(0,n.jsxs)("button",{type:"button",role:"radio","aria-checked":"supabase"===t,className:"supabase"===t?"active":"",onClick:()=>!v&&s("supabase"),disabled:v,children:["Supabase accounts",(0,n.jsx)("small",{children:"Real sign-in, orgs, cloud sync."})]})]}),v?(0,n.jsxs)("p",{className:"admin-muted",style:{fontSize:"0.82em"},children:["Auth mode is locked by the ",(0,n.jsx)("code",{children:"MADARX_AUTH_MODE"})," environment variable. Unset it to manage the mode here."]}):null,(0,n.jsxs)("div",{className:"admin-form-row",style:{display:"grid",gap:"0.75rem"},children:[(0,n.jsxs)("label",{className:"admin-field",children:[(0,n.jsx)("span",{children:"Supabase project URL"}),(0,n.jsx)("input",{type:"url",className:"admin-input",placeholder:"https://YOUR-PROJECT.supabase.co",value:l,onChange:e=>r(e.target.value),autoComplete:"off"})]}),(0,n.jsxs)("label",{className:"admin-field",children:[(0,n.jsx)("span",{children:"Anon (public) key"}),(0,n.jsx)("input",{type:"text",className:"admin-input",placeholder:"eyJhbGciOi…",value:o,onChange:e=>c(e.target.value),autoComplete:"off"})]}),(0,n.jsxs)("label",{className:"admin-field",children:[(0,n.jsxs)("span",{children:["Service-role key ",j?(0,n.jsx)("em",{style:{color:"#1d7a47",fontStyle:"normal"},children:"\xb7 set"}):null]}),(0,n.jsx)("input",{type:"password",className:"admin-input",placeholder:j?"•••••••• (leave blank to keep)":"eyJhbGciOi… (enables cloud sync)",value:d,onChange:e=>m(e.target.value),autoComplete:"off"})]}),(0,n.jsx)("p",{className:"admin-muted",style:{fontSize:"0.78em",margin:0},children:"Stored encrypted in the local secrets vault. The service-role key never leaves the server and powers cloud sync and shared spaces."}),(0,n.jsxs)("p",{className:"admin-muted",style:{fontSize:"0.78em",margin:0},children:["Lockout safety: if Supabase sign-in ever fails, reset to local mode from the login page using the recovery token in ",(0,n.jsx)("code",{children:"data/.auth-recovery-token"}),", or set ",(0,n.jsx)("code",{children:"MADARX_AUTH_MODE=local"})," in the environment."]})]}),y?(0,n.jsx)("div",{style:{...{ok:{background:"rgba(34,139,84,.10)",color:"#1d7a47",border:"1px solid rgba(34,139,84,.25)"},err:{background:"rgba(194,69,42,.08)",color:"#a8331c",border:"1px solid rgba(194,69,42,.22)"},info:{background:"rgba(20,22,26,.05)",color:"#3a3f47",border:"1px solid rgba(20,22,26,.12)"}}[y.tone],padding:"0.6rem 0.8rem",borderRadius:10,fontSize:"0.85em"},children:y.text}):null,(0,n.jsxs)("div",{className:"admin-form-actions",style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[(0,n.jsx)("button",{type:"button",className:"admin-btn-sm",onClick:k,disabled:u||p||!l||!o,children:u?"Testing…":"Test connection"}),(0,n.jsx)("button",{type:"button",className:"admin-btn-primary",onClick:N,disabled:p||u||v,children:p?"Saving…":"supabase"!==t||f?"Save settings":"Save & switch to Supabase"})]})]})}},64250:(e,a,t)=>{"use strict";t.d(a,{z:()=>n});let n=function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.filter((e,a,t)=>!!e&&""!==e.trim()&&t.indexOf(e)===a).join(" ").trim()}},66737:(e,a,t)=>{"use strict";t.d(a,{default:()=>c});var n=t(95155),i=t(12115),s=t(20063);let l=(0,t(13185).A)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]),r={owner:"mars",admin:"ready",member:"neutral",viewer:"neutral"},o=["owner","admin","member","viewer"];function c(e){let{orgId:a,members:t,currentUserId:c,canManage:m,isOwner:u}=e,h=(0,s.useRouter)(),[p,x]=(0,i.useState)(""),[y,g]=(0,i.useState)("");async function v(e,t){g(""),x(e);try{let n=await fetch("/api/orgs/".concat(a,"/members/").concat(e,"/role"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:t})}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(i.error||i.message||"Could not change role.");h.refresh()}catch(e){g(e.message)}finally{x("")}}async function j(e,t){if(window.confirm("Remove ".concat(t," from this organization?"))){g(""),x(e);try{let t=await fetch("/api/orgs/".concat(a,"/members/").concat(e),{method:"DELETE"}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||n.message||"Could not remove member.");h.refresh()}catch(e){g(e.message)}finally{x("")}}}return t&&0!==t.length?(0,n.jsxs)("div",{className:"admin-card-list",children:[y?(0,n.jsx)("div",{className:"admin-record",role:"alert",style:{borderColor:"var(--accent-500)",color:"var(--accent-600)"},children:y}):null,(0,n.jsxs)("table",{className:"admin-table",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Member"}),(0,n.jsx)("th",{children:"Role"}),(0,n.jsx)("th",{children:"Joined"}),m?(0,n.jsx)("th",{"aria-label":"Actions"}):null]})}),(0,n.jsx)("tbody",{children:t.map(e=>{let a=e.user_id===c,t=e.display_name||e.email||e.user_id,i=p===e.user_id;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.6rem"},children:[(0,n.jsx)("div",{className:"org-card-avatar small","aria-hidden":"true",children:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(e||a||"").split(/[\s@.]+/).map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()||"\xb7"}(e.display_name,e.email)}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{style:{fontWeight:600},children:[e.display_name||(0,n.jsx)("span",{className:"admin-muted",children:"—"}),a?(0,n.jsx)("span",{className:"admin-muted",style:{fontWeight:400},children:" \xb7 you"}):null]}),(0,n.jsx)("div",{className:"admin-muted",style:{fontSize:"0.85em"},children:e.email||"—"})]})]})}),(0,n.jsx)("td",{children:u&&!a?(0,n.jsx)("select",{className:"admin-select",defaultValue:e.role,disabled:i,onChange:a=>v(e.user_id,a.target.value),"aria-label":"Role for ".concat(t),children:o.map(e=>(0,n.jsx)("option",{value:e,children:e},e))}):(0,n.jsx)(d,{tone:r[e.role]||"neutral",children:e.role})}),(0,n.jsx)("td",{className:"admin-muted",children:e.accepted_at?e.accepted_at.slice(0,10):"—"}),m?(0,n.jsx)("td",{style:{textAlign:"right"},children:a?null:(0,n.jsxs)("button",{type:"button",className:"admin-btn-danger-sm",disabled:i,onClick:()=>j(e.user_id,t),style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},children:[(0,n.jsx)(l,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),i?"Removing…":"Remove"]})}):null]},e.user_id)})})]})]}):(0,n.jsx)("div",{className:"admin-card-list",children:(0,n.jsx)("div",{className:"admin-record admin-muted",children:"No members yet. Invite teammates below."})})}function d(e){let{tone:a,children:t}=e;return(0,n.jsx)("span",{className:"admin-pill ".concat(a),children:t})}},70658:(e,a,t)=>{"use strict";t.d(a,{default:()=>r});var n=t(95155),i=t(12115),s=t(20063);function l(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)||"org"}function r(){let e=(0,s.useRouter)(),[a,t]=(0,i.useState)(""),[r,o]=(0,i.useState)(!1),[c,d]=(0,i.useState)("");async function m(t){t.preventDefault(),d(""),o(!0);try{let t=await fetch("/api/orgs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.trim(),slug:l(a)})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Could not create organization.");e.refresh()}catch(e){d(e.message)}finally{o(!1)}}return(0,n.jsxs)("form",{onSubmit:m,style:{display:"grid",gap:"0.75rem"},children:[(0,n.jsx)("p",{className:"admin-muted",style:{margin:0,fontSize:"0.9em"},children:"Start fresh — you'll be the owner. You can invite teammates once it exists."}),(0,n.jsxs)("label",{className:"admin-field",children:[(0,n.jsx)("span",{children:"Organization name"}),(0,n.jsx)("input",{className:"admin-input",value:a,onChange:e=>t(e.target.value),placeholder:"Acme Robotics",required:!0,autoComplete:"off"})]}),a.trim()?(0,n.jsxs)("p",{className:"admin-muted",style:{margin:0,fontSize:"0.78em"},children:["Slug: ",(0,n.jsx)("code",{className:"mono",children:l(a)})]}):null,c?(0,n.jsx)("div",{role:"alert",style:{color:"var(--accent-600)",fontSize:"0.85em"},children:c}):null,(0,n.jsx)("div",{className:"admin-form-actions",children:(0,n.jsx)("button",{type:"submit",className:"admin-btn-primary",disabled:r||!a.trim(),children:r?"Creating…":"Create organization"})})]})}},78129:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(13185).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},80175:(e,a,t)=>{"use strict";t.d(a,{default:()=>p});var n=t(95155),i=t(12115),s=t(25352),l=t(13185);let r=(0,l.A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),o=(0,l.A)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),c=(0,l.A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),d=(0,l.A)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);var m=t(27667);let u={owner:["admin","member","viewer"],admin:["member","viewer"]};function h(e){if(!e)return"no expiry";let a=new Date(e).getTime()-Date.now();if(a<=0)return"expired";let t=Math.round(a/36e5);return t<48?"in ".concat(t,"h"):"in ".concat(Math.round(t/24),"d")}function p(e){var a,t,l;let{orgId:p,creatorRole:x="owner",cloudReady:y=!1}=e,g=u[x]||["member","viewer"],v="/api/orgs/".concat(p,"/invites"),[j,f]=(0,i.useState)(null),[b,k]=(0,i.useState)(""),[N,w]=(0,i.useState)(""),[S,C]=(0,i.useState)(null),[A,W]=(0,i.useState)(""),[_,z]=(0,i.useState)(!1),[I,E]=(0,i.useState)("member"),[R,T]=(0,i.useState)("72"),[P,O]=(0,i.useState)(""),[M,L]=(0,i.useState)(""),[D,J]=(0,i.useState)("member"),U=(0,i.useCallback)(async()=>{try{let e=await fetch(v),a=await e.json().catch(()=>({}));if(!e.ok)throw Error(a.error||"Failed to load invites");f(a.invites||[]),k("")}catch(e){k(e.message),f([])}},[v]);(0,i.useEffect)(()=>{U()},[U]);let{emailInvites:H,linkInvites:F}=(0,i.useMemo)(()=>{let e=j||[];return{emailInvites:e.filter(e=>"email"===e.kind||e.email),linkInvites:e.filter(e=>"link"===e.kind||!e.email&&e.has_token)}},[j]);async function q(e){var a;null==e||null==(a=e.preventDefault)||a.call(e),w("link"),k("");try{let e={role:I};""!==R&&(e.expiresInHours=Number(R)),""!==P&&(e.maxUses=Number(P));let a=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),t=await a.json().catch(()=>({}));if(!a.ok)throw Error(t.message||t.error||"Could not create link");let n=t.joinPath?"".concat(window.location.origin).concat(t.joinPath):"";C({token:t.token,invite:t.invite,url:n}),W(""),z(!1),await U()}catch(e){k(e.message)}finally{w("")}}async function K(e){e.preventDefault(),w("email"),k("");try{let e=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:M.trim(),role:D})}),a=await e.json().catch(()=>({}));if(!e.ok)throw Error(a.message||a.error||"Could not send invite");L(""),await U()}catch(e){k(e.message)}finally{w("")}}async function V(e){w(e),k("");try{let a=await fetch("".concat(v,"/").concat(e),{method:"DELETE"});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||"Could not revoke")}await U()}catch(e){k(e.message)}finally{w("")}}async function $(e,a){try{await navigator.clipboard.writeText(e),W(a),setTimeout(()=>W(""),2e3)}catch(e){}}let B=(0,n.jsx)(n.Fragment,{children:g.map(e=>(0,n.jsx)("option",{value:e,children:e},e))});return(0,n.jsxs)("div",{className:"admin-card-list",children:[b?(0,n.jsx)("div",{className:"admin-record",role:"alert",style:{borderColor:"var(--accent-500)",color:"var(--accent-600)"},children:b}):null,S?(0,n.jsxs)("div",{className:"admin-record",style:{borderColor:"var(--accent-500)"},children:[(0,n.jsxs)("div",{className:"admin-record-top",children:[(0,n.jsxs)("b",{style:{display:"inline-flex",alignItems:"center",gap:"0.45rem"},children:[(0,n.jsx)(s.A,{className:"settings-rail-icon",strokeWidth:2,"aria-hidden":"true"}),"Invite link ready"]}),(0,n.jsx)("span",{className:"admin-pill mars",children:"Shown once"})]}),(0,n.jsx)("p",{className:"admin-muted",style:{fontSize:"0.85em",margin:"0.35rem 0 0.6rem"},children:S.url?"Send this link. They sign in once and join automatically.":"Connect Supabase to generate a one-click link. For now, share this code — they paste it under “Join with code”."}),S.url?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("code",{className:"team-invite-code",children:S.url}),(0,n.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.5rem"},children:[(0,n.jsxs)("button",{className:"admin-btn-primary admin-btn-sm",onClick:()=>$(S.url,"link"),style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:["link"===A?(0,n.jsx)(s.A,{className:"settings-rail-icon",strokeWidth:2}):(0,n.jsx)(r,{className:"settings-rail-icon",strokeWidth:1.75}),"link"===A?"Copied":"Copy link"]}),(0,n.jsx)("button",{className:"admin-btn-sm",onClick:()=>C(null),children:"Done"})]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("code",{className:"team-invite-code",children:S.token}),(0,n.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.5rem"},children:[(0,n.jsxs)("button",{className:"admin-btn-primary admin-btn-sm",onClick:()=>$(S.token,"code"),style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:["code"===A?(0,n.jsx)(s.A,{className:"settings-rail-icon",strokeWidth:2}):(0,n.jsx)(r,{className:"settings-rail-icon",strokeWidth:1.75}),"code"===A?"Copied":"Copy code"]}),(0,n.jsx)("button",{className:"admin-btn-sm",onClick:()=>C(null),children:"Done"})]})]}),(0,n.jsxs)("div",{className:"admin-muted",style:{fontSize:"0.8em",marginTop:"0.5rem"},children:[null==(a=S.invite)?void 0:a.role," \xb7 ",(null==(t=S.invite)?void 0:t.max_uses)?"".concat(S.invite.max_uses," uses"):"unlimited uses"," \xb7 expires ",h(null==(l=S.invite)?void 0:l.expires_at)]})]}):null,(0,n.jsxs)("div",{className:"admin-record",children:[(0,n.jsxs)("div",{className:"admin-record-top",children:[(0,n.jsxs)("b",{style:{display:"inline-flex",alignItems:"center",gap:"0.45rem"},children:[(0,n.jsx)(o,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),"Shareable invite link"]}),(0,n.jsx)("button",{type:"button",className:"admin-btn-sm",onClick:()=>z(e=>!e),children:_?"Hide options":"Options"})]}),(0,n.jsxs)("p",{className:"admin-muted",style:{fontSize:"0.85em",margin:"0.35rem 0 0.6rem"},children:["One link, sign in, joined. ",y?"":"Connect Supabase above for one-click links."]}),(0,n.jsxs)("form",{onSubmit:q,style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"flex-end"},children:[_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"admin-field",style:{minWidth:120},children:[(0,n.jsx)("span",{children:"Role"}),(0,n.jsx)("select",{className:"admin-select",value:I,onChange:e=>E(e.target.value),children:B})]}),(0,n.jsxs)("label",{className:"admin-field",style:{minWidth:120},children:[(0,n.jsx)("span",{children:"Expires"}),(0,n.jsxs)("select",{className:"admin-select",value:R,onChange:e=>T(e.target.value),children:[(0,n.jsx)("option",{value:"24",children:"24 hours"}),(0,n.jsx)("option",{value:"72",children:"72 hours"}),(0,n.jsx)("option",{value:"168",children:"7 days"}),(0,n.jsx)("option",{value:"",children:"No expiry"})]})]}),(0,n.jsxs)("label",{className:"admin-field",style:{minWidth:140},children:[(0,n.jsx)("span",{children:"Max uses"}),(0,n.jsx)("input",{className:"admin-input",type:"number",min:"1",value:P,onChange:e=>O(e.target.value),placeholder:"Unlimited"})]})]}):null,(0,n.jsxs)("button",{type:"submit",className:"admin-btn-primary",disabled:"link"===N,style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:[(0,n.jsx)(c,{className:"settings-rail-icon",strokeWidth:2,"aria-hidden":"true"}),"link"===N?"Creating…":"Create invite link"]})]})]}),(0,n.jsxs)("form",{className:"admin-record",onSubmit:K,children:[(0,n.jsx)("div",{className:"admin-record-top",children:(0,n.jsxs)("b",{style:{display:"inline-flex",alignItems:"center",gap:"0.45rem"},children:[(0,n.jsx)(d,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),"Invite by email"]})}),(0,n.jsx)("p",{className:"admin-muted",style:{fontSize:"0.85em",margin:"0.35rem 0 0.6rem"},children:"They join automatically the first time they sign in with this email."}),(0,n.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"flex-end"},children:[(0,n.jsxs)("label",{className:"admin-field",style:{flex:1,minWidth:200},children:[(0,n.jsx)("span",{children:"Email"}),(0,n.jsx)("input",{className:"admin-input",type:"email",value:M,onChange:e=>L(e.target.value),placeholder:"teammate@example.com"})]}),(0,n.jsxs)("label",{className:"admin-field",style:{minWidth:120},children:[(0,n.jsx)("span",{children:"Role"}),(0,n.jsx)("select",{className:"admin-select",value:D,onChange:e=>J(e.target.value),children:B})]}),(0,n.jsx)("button",{type:"submit",className:"admin-btn-primary",disabled:"email"===N||!M.trim(),children:"email"===N?"Sending…":"Add"})]})]}),null===j?(0,n.jsx)("div",{className:"admin-record admin-muted",children:"Loading invites…"}):0===H.length&&0===F.length?(0,n.jsx)("div",{className:"admin-record admin-muted",children:"No active invites."}):(0,n.jsxs)("div",{className:"admin-record",children:[(0,n.jsx)("div",{className:"admin-record-top",children:(0,n.jsx)("b",{children:"Active invites"})}),(0,n.jsxs)("ul",{className:"team-invite-list",children:[F.map(e=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:[(0,n.jsx)(o,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),e.label||"Invite link"," \xb7 ",e.role," \xb7 ",e.used_count,e.max_uses?"/".concat(e.max_uses):""," used \xb7 expires ",h(e.expires_at)]}),(0,n.jsxs)("button",{className:"admin-btn-danger-sm",disabled:N===e.id,onClick:()=>V(e.id),style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},children:[(0,n.jsx)(m.A,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),N===e.id?"…":"Revoke"]})]},e.id)),H.map(e=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:[(0,n.jsx)(d,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),e.email," \xb7 ",e.role," \xb7 expires ",h(e.expires_at)]}),(0,n.jsxs)("button",{className:"admin-btn-danger-sm",disabled:N===e.id,onClick:()=>V(e.id),style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},children:[(0,n.jsx)(m.A,{className:"settings-rail-icon",strokeWidth:1.75,"aria-hidden":"true"}),N===e.id?"…":"Revoke"]})]},e.id))]})]})]})}}},e=>{e.O(0,[8441,1255,7358],()=>e(e.s=9609)),_N_E=e.O()}]);