madarx 2.17.0 → 2.18.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 (511) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +536 -536
  3. package/.next/standalone/.next/app-path-routes-manifest.json +68 -68
  4. package/.next/standalone/.next/build-manifest.json +5 -5
  5. package/.next/standalone/.next/prerender-manifest.json +15 -15
  6. package/.next/standalone/.next/react-loadable-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  8. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/_not-found.html +2 -1
  11. package/.next/standalone/.next/server/app/_not-found.rsc +4 -4
  12. package/.next/standalone/.next/server/app/activity/page.js +1 -1
  13. package/.next/standalone/.next/server/app/activity/page.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/activity/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/admin/page.js +4 -4
  16. package/.next/standalone/.next/server/app/admin/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/agents/[id]/page.js +4 -4
  19. package/.next/standalone/.next/server/app/agents/[id]/page.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/agents/page.js +1 -1
  22. package/.next/standalone/.next/server/app/agents/page.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  24. package/.next/standalone/.next/server/app/api/activity/route_client-reference-manifest.js +1 -1
  25. package/.next/standalone/.next/server/app/api/admin/audit-export/route_client-reference-manifest.js +1 -1
  26. package/.next/standalone/.next/server/app/api/admin/share-links/route_client-reference-manifest.js +1 -1
  27. package/.next/standalone/.next/server/app/api/agent-memory/route_client-reference-manifest.js +1 -1
  28. package/.next/standalone/.next/server/app/api/agent-runs/[id]/cancel/route_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/api/agent-runs/[id]/events/route_client-reference-manifest.js +1 -1
  30. package/.next/standalone/.next/server/app/api/agent-runs/[id]/log/route_client-reference-manifest.js +1 -1
  31. package/.next/standalone/.next/server/app/api/agent-runs/[id]/route_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/api/agent-runs/route_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/api/agents/[id]/active-run/route_client-reference-manifest.js +1 -1
  34. package/.next/standalone/.next/server/app/api/agents/[id]/chain/route_client-reference-manifest.js +1 -1
  35. package/.next/standalone/.next/server/app/api/agents/[id]/memory/route_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/api/agents/[id]/reports/route_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/app/api/agents/[id]/run/route_client-reference-manifest.js +1 -1
  38. package/.next/standalone/.next/server/app/api/agents/[id]/skills/route_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/api/agents/create/route_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/api/agents/ops/route_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/api/approvals/[id]/route_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/api/approvals/route_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/api/artifacts/[id]/acl/route_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/api/artifacts/[id]/protect/route_client-reference-manifest.js +1 -1
  45. package/.next/standalone/.next/server/app/api/artifacts/[id]/raw/route_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/api/artifacts/[id]/route_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/api/artifacts/[id]/share-link/[linkId]/route_client-reference-manifest.js +1 -1
  48. package/.next/standalone/.next/server/app/api/artifacts/[id]/share-link/route_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/api/artifacts/upload/route_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/api/audit/list/route_client-reference-manifest.js +1 -1
  51. package/.next/standalone/.next/server/app/api/audit/search/route_client-reference-manifest.js +1 -1
  52. package/.next/standalone/.next/server/app/api/auth/callback/route_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/api/auth/config/route_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/api/auth/join-bootstrap/route_client-reference-manifest.js +1 -1
  55. package/.next/standalone/.next/server/app/api/auth/session/route_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/app/api/brand/route_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/api/brand/share/route_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/app/api/chat/sessions/[id]/route_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/api/chat/sessions/route_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/api/config/env/route.js +1 -1
  61. package/.next/standalone/.next/server/app/api/config/env/route_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/api/config/route_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/api/connections/[service]/route_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/api/connections/[service]/verify/route.js +1 -1
  65. package/.next/standalone/.next/server/app/api/connections/[service]/verify/route_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/app/api/connections/route_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/app/api/cron/tick/route_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/move/route_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/route_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/share-link/[linkId]/route_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/share-link/route_client-reference-manifest.js +1 -1
  72. package/.next/standalone/.next/server/app/api/dashboard/spaces/import/route_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/api/dashboard/spaces/route_client-reference-manifest.js +1 -1
  74. package/.next/standalone/.next/server/app/api/disk/files/[id]/blob/route_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/api/disk/files/[id]/route_client-reference-manifest.js +1 -1
  76. package/.next/standalone/.next/server/app/api/disk/files/[id]/transcribe/route_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/api/disk/files/route_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/api/disk/folders/route_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/api/events/since/[cursor]/route_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/api/events/stream/route_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/app/api/fs/create-folder/route_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/api/fs/pick-folder/route.js +2 -2
  83. package/.next/standalone/.next/server/app/api/fs/pick-folder/route_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/blueprint/route_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/diagnostic/route_client-reference-manifest.js +1 -1
  86. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/governance/route_client-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/interview/route_client-reference-manifest.js +1 -1
  88. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/pilot/route_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/quarterly/route_client-reference-manifest.js +1 -1
  90. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/route_client-reference-manifest.js +1 -1
  91. package/.next/standalone/.next/server/app/api/hail/engagements/[id]/setup-package/route_client-reference-manifest.js +1 -1
  92. package/.next/standalone/.next/server/app/api/hail/engagements/route_client-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/app/api/hail/interviews/[id]/responses/route_client-reference-manifest.js +1 -1
  94. package/.next/standalone/.next/server/app/api/hail/interviews/[id]/route_client-reference-manifest.js +1 -1
  95. package/.next/standalone/.next/server/app/api/hail/setup-packages/[id]/apply/route_client-reference-manifest.js +1 -1
  96. package/.next/standalone/.next/server/app/api/hail/setup-packages/validate/route_client-reference-manifest.js +1 -1
  97. package/.next/standalone/.next/server/app/api/heartbeat/tick/route_client-reference-manifest.js +1 -1
  98. package/.next/standalone/.next/server/app/api/heartbeat/worker/route_client-reference-manifest.js +1 -1
  99. package/.next/standalone/.next/server/app/api/help/route_client-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/app/api/hermes/jobs/[id]/events/route_client-reference-manifest.js +1 -1
  101. package/.next/standalone/.next/server/app/api/hermes/jobs/[id]/route_client-reference-manifest.js +1 -1
  102. package/.next/standalone/.next/server/app/api/hermes/jobs/route_client-reference-manifest.js +1 -1
  103. package/.next/standalone/.next/server/app/api/integrations/google/callback/route_client-reference-manifest.js +1 -1
  104. package/.next/standalone/.next/server/app/api/integrations/google/oauth/route_client-reference-manifest.js +1 -1
  105. package/.next/standalone/.next/server/app/api/marketplace/[id]/route_client-reference-manifest.js +1 -1
  106. package/.next/standalone/.next/server/app/api/marketplace/open-design/route_client-reference-manifest.js +1 -1
  107. package/.next/standalone/.next/server/app/api/marketplace/route_client-reference-manifest.js +1 -1
  108. package/.next/standalone/.next/server/app/api/mines/import-roots/route_client-reference-manifest.js +1 -1
  109. package/.next/standalone/.next/server/app/api/mines/portfolio/route_client-reference-manifest.js +1 -1
  110. package/.next/standalone/.next/server/app/api/mines/projects/[id]/chunks/route_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/api/mines/projects/[id]/diligence/route_client-reference-manifest.js +1 -1
  112. package/.next/standalone/.next/server/app/api/mines/projects/[id]/import/route_client-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/app/api/mines/projects/[id]/publish/route_client-reference-manifest.js +1 -1
  114. package/.next/standalone/.next/server/app/api/mines/projects/route_client-reference-manifest.js +1 -1
  115. package/.next/standalone/.next/server/app/api/missions/route_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  117. package/.next/standalone/.next/server/app/api/onboarding/blueprint/route_client-reference-manifest.js +1 -1
  118. package/.next/standalone/.next/server/app/api/onboarding/launch/route_client-reference-manifest.js +1 -1
  119. package/.next/standalone/.next/server/app/api/orchestrator/command/route_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/api/orchestrator/stream/route.js +13 -13
  121. package/.next/standalone/.next/server/app/api/orchestrator/stream/route_client-reference-manifest.js +1 -1
  122. package/.next/standalone/.next/server/app/api/orchestrator/upload/route_client-reference-manifest.js +1 -1
  123. package/.next/standalone/.next/server/app/api/org/route_client-reference-manifest.js +1 -1
  124. package/.next/standalone/.next/server/app/api/orgs/[id]/invites/[inviteId]/route_client-reference-manifest.js +1 -1
  125. package/.next/standalone/.next/server/app/api/orgs/[id]/invites/route_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/api/orgs/[id]/members/[userId]/role/route_client-reference-manifest.js +1 -1
  127. package/.next/standalone/.next/server/app/api/orgs/[id]/members/[userId]/route_client-reference-manifest.js +1 -1
  128. package/.next/standalone/.next/server/app/api/orgs/[id]/members/route_client-reference-manifest.js +1 -1
  129. package/.next/standalone/.next/server/app/api/orgs/[id]/route_client-reference-manifest.js +1 -1
  130. package/.next/standalone/.next/server/app/api/orgs/invites/pending/route_client-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/app/api/orgs/join/route_client-reference-manifest.js +1 -1
  132. package/.next/standalone/.next/server/app/api/orgs/join-complete/route_client-reference-manifest.js +1 -1
  133. package/.next/standalone/.next/server/app/api/orgs/route_client-reference-manifest.js +1 -1
  134. package/.next/standalone/.next/server/app/api/printing-press/clis/route_client-reference-manifest.js +1 -1
  135. package/.next/standalone/.next/server/app/api/printing-press/install/route_client-reference-manifest.js +1 -1
  136. package/.next/standalone/.next/server/app/api/printing-press/security-mode/route_client-reference-manifest.js +1 -1
  137. package/.next/standalone/.next/server/app/api/privacy/config/route_client-reference-manifest.js +1 -1
  138. package/.next/standalone/.next/server/app/api/privacy/verify/route_client-reference-manifest.js +1 -1
  139. package/.next/standalone/.next/server/app/api/processes/[id]/route_client-reference-manifest.js +1 -1
  140. package/.next/standalone/.next/server/app/api/processes/[id]/share-link/route_client-reference-manifest.js +1 -1
  141. package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/override/route_client-reference-manifest.js +1 -1
  142. package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/retry/route_client-reference-manifest.js +1 -1
  143. package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/submit/route_client-reference-manifest.js +1 -1
  144. package/.next/standalone/.next/server/app/api/processes/definitions/[slug]/route_client-reference-manifest.js +1 -1
  145. package/.next/standalone/.next/server/app/api/processes/definitions/[slug]/settings/route_client-reference-manifest.js +1 -1
  146. package/.next/standalone/.next/server/app/api/processes/definitions/route_client-reference-manifest.js +1 -1
  147. package/.next/standalone/.next/server/app/api/processes/definitions/validate/route_client-reference-manifest.js +1 -1
  148. package/.next/standalone/.next/server/app/api/processes/route_client-reference-manifest.js +1 -1
  149. package/.next/standalone/.next/server/app/api/processes/start-and-route/route_client-reference-manifest.js +1 -1
  150. package/.next/standalone/.next/server/app/api/projects/[slug]/library/route_client-reference-manifest.js +1 -1
  151. package/.next/standalone/.next/server/app/api/projects/[slug]/route_client-reference-manifest.js +1 -1
  152. package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  153. package/.next/standalone/.next/server/app/api/runs/approve-claude-run/route_client-reference-manifest.js +1 -1
  154. package/.next/standalone/.next/server/app/api/runs/claude-code-dry-run/route_client-reference-manifest.js +1 -1
  155. package/.next/standalone/.next/server/app/api/runs/competitor-report/route_client-reference-manifest.js +1 -1
  156. package/.next/standalone/.next/server/app/api/runs/engine-ping/route_client-reference-manifest.js +1 -1
  157. package/.next/standalone/.next/server/app/api/runs/marketing-plan/route_client-reference-manifest.js +1 -1
  158. package/.next/standalone/.next/server/app/api/schedules/upsert/route_client-reference-manifest.js +1 -1
  159. package/.next/standalone/.next/server/app/api/secrets/[name]/route_client-reference-manifest.js +1 -1
  160. package/.next/standalone/.next/server/app/api/secrets/route_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/api/settings/trust-mode/route_client-reference-manifest.js +1 -1
  162. package/.next/standalone/.next/server/app/api/share/[token]/otp/route_client-reference-manifest.js +1 -1
  163. package/.next/standalone/.next/server/app/api/share/[token]/route_client-reference-manifest.js +1 -1
  164. package/.next/standalone/.next/server/app/api/share/[token]/verify/route_client-reference-manifest.js +1 -1
  165. package/.next/standalone/.next/server/app/api/share/space/[token]/otp/route_client-reference-manifest.js +1 -1
  166. package/.next/standalone/.next/server/app/api/share/space/[token]/route_client-reference-manifest.js +1 -1
  167. package/.next/standalone/.next/server/app/api/share/space/[token]/verify/route_client-reference-manifest.js +1 -1
  168. package/.next/standalone/.next/server/app/api/shared/spaces/[id]/acl/route_client-reference-manifest.js +1 -1
  169. package/.next/standalone/.next/server/app/api/shared/spaces/publish/route_client-reference-manifest.js +1 -1
  170. package/.next/standalone/.next/server/app/api/shared/spaces/route_client-reference-manifest.js +1 -1
  171. package/.next/standalone/.next/server/app/api/shared/spaces/status/route_client-reference-manifest.js +1 -1
  172. package/.next/standalone/.next/server/app/api/shared/spaces/unpublish/route_client-reference-manifest.js +1 -1
  173. package/.next/standalone/.next/server/app/api/state/route_client-reference-manifest.js +1 -1
  174. package/.next/standalone/.next/server/app/api/system/update/route_client-reference-manifest.js +1 -1
  175. package/.next/standalone/.next/server/app/api/tasks/[id]/active-run/route_client-reference-manifest.js +1 -1
  176. package/.next/standalone/.next/server/app/api/tasks/[id]/attachments/route_client-reference-manifest.js +1 -1
  177. package/.next/standalone/.next/server/app/api/tasks/[id]/checklist/[itemId]/route_client-reference-manifest.js +1 -1
  178. package/.next/standalone/.next/server/app/api/tasks/[id]/checklist/route_client-reference-manifest.js +1 -1
  179. package/.next/standalone/.next/server/app/api/tasks/[id]/checkout/route_client-reference-manifest.js +1 -1
  180. package/.next/standalone/.next/server/app/api/tasks/[id]/children/route_client-reference-manifest.js +1 -1
  181. package/.next/standalone/.next/server/app/api/tasks/[id]/comments/route_client-reference-manifest.js +1 -1
  182. package/.next/standalone/.next/server/app/api/tasks/[id]/events/route_client-reference-manifest.js +1 -1
  183. package/.next/standalone/.next/server/app/api/tasks/[id]/live-runs/route_client-reference-manifest.js +1 -1
  184. package/.next/standalone/.next/server/app/api/tasks/[id]/release/route_client-reference-manifest.js +1 -1
  185. package/.next/standalone/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
  186. package/.next/standalone/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
  187. package/.next/standalone/.next/server/app/api/tool-allowlists/[id]/route_client-reference-manifest.js +1 -1
  188. package/.next/standalone/.next/server/app/api/tool-allowlists/route_client-reference-manifest.js +1 -1
  189. package/.next/standalone/.next/server/app/api/tool-egress/route_client-reference-manifest.js +1 -1
  190. package/.next/standalone/.next/server/app/api/tools/[name]/approve/route_client-reference-manifest.js +1 -1
  191. package/.next/standalone/.next/server/app/api/tools/[name]/route_client-reference-manifest.js +1 -1
  192. package/.next/standalone/.next/server/app/api/tools/route_client-reference-manifest.js +1 -1
  193. package/.next/standalone/.next/server/app/api/transcripts/route_client-reference-manifest.js +1 -1
  194. package/.next/standalone/.next/server/app/api/voice/providers/route_client-reference-manifest.js +1 -1
  195. package/.next/standalone/.next/server/app/api/voice/realtime/context/route_client-reference-manifest.js +1 -1
  196. package/.next/standalone/.next/server/app/api/voice/realtime/session/route.js +2 -2
  197. package/.next/standalone/.next/server/app/api/voice/realtime/session/route_client-reference-manifest.js +1 -1
  198. package/.next/standalone/.next/server/app/api/voice/realtime/tool-result/route.js +2 -2
  199. package/.next/standalone/.next/server/app/api/voice/realtime/tool-result/route_client-reference-manifest.js +1 -1
  200. package/.next/standalone/.next/server/app/api/voice/realtime/tools/route.js +1 -1
  201. package/.next/standalone/.next/server/app/api/voice/realtime/tools/route_client-reference-manifest.js +1 -1
  202. package/.next/standalone/.next/server/app/api/voice/tts/route_client-reference-manifest.js +1 -1
  203. package/.next/standalone/.next/server/app/api/whatsapp/allowlist/route_client-reference-manifest.js +1 -1
  204. package/.next/standalone/.next/server/app/api/whatsapp/disconnect/route_client-reference-manifest.js +1 -1
  205. package/.next/standalone/.next/server/app/api/whatsapp/messages/route_client-reference-manifest.js +1 -1
  206. package/.next/standalone/.next/server/app/api/whatsapp/qr/route_client-reference-manifest.js +1 -1
  207. package/.next/standalone/.next/server/app/api/whatsapp/send/route_client-reference-manifest.js +1 -1
  208. package/.next/standalone/.next/server/app/api/whatsapp/status/route_client-reference-manifest.js +1 -1
  209. package/.next/standalone/.next/server/app/approvals/page.js +2 -2
  210. package/.next/standalone/.next/server/app/approvals/page.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/approvals/page_client-reference-manifest.js +1 -1
  212. package/.next/standalone/.next/server/app/architecture/page.js +1 -1
  213. package/.next/standalone/.next/server/app/architecture/page.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/architecture/page_client-reference-manifest.js +1 -1
  215. package/.next/standalone/.next/server/app/architecture.html +2 -2
  216. package/.next/standalone/.next/server/app/architecture.rsc +4 -4
  217. package/.next/standalone/.next/server/app/audit/live/page.js +1 -1
  218. package/.next/standalone/.next/server/app/audit/live/page.js.nft.json +1 -1
  219. package/.next/standalone/.next/server/app/audit/live/page_client-reference-manifest.js +1 -1
  220. package/.next/standalone/.next/server/app/audit/page.js +1 -1
  221. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  222. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  223. package/.next/standalone/.next/server/app/brand/page.js +1 -1
  224. package/.next/standalone/.next/server/app/brand/page.js.nft.json +1 -1
  225. package/.next/standalone/.next/server/app/brand/page_client-reference-manifest.js +1 -1
  226. package/.next/standalone/.next/server/app/brand.html +2 -1
  227. package/.next/standalone/.next/server/app/brand.rsc +4 -4
  228. package/.next/standalone/.next/server/app/disk/page.js +1 -1
  229. package/.next/standalone/.next/server/app/disk/page.js.nft.json +1 -1
  230. package/.next/standalone/.next/server/app/disk/page_client-reference-manifest.js +1 -1
  231. package/.next/standalone/.next/server/app/federated-ai/page.js +1 -1
  232. package/.next/standalone/.next/server/app/federated-ai/page.js.nft.json +1 -1
  233. package/.next/standalone/.next/server/app/federated-ai/page_client-reference-manifest.js +1 -1
  234. package/.next/standalone/.next/server/app/federated-ai.html +2 -2
  235. package/.next/standalone/.next/server/app/federated-ai.rsc +4 -4
  236. package/.next/standalone/.next/server/app/hail/[id]/governance/page.js +1 -1
  237. package/.next/standalone/.next/server/app/hail/[id]/governance/page.js.nft.json +1 -1
  238. package/.next/standalone/.next/server/app/hail/[id]/governance/page_client-reference-manifest.js +1 -1
  239. package/.next/standalone/.next/server/app/hail/[id]/interview/page.js +1 -1
  240. package/.next/standalone/.next/server/app/hail/[id]/interview/page.js.nft.json +1 -1
  241. package/.next/standalone/.next/server/app/hail/[id]/interview/page_client-reference-manifest.js +1 -1
  242. package/.next/standalone/.next/server/app/hail/[id]/page.js +1 -1
  243. package/.next/standalone/.next/server/app/hail/[id]/page.js.nft.json +1 -1
  244. package/.next/standalone/.next/server/app/hail/[id]/page_client-reference-manifest.js +1 -1
  245. package/.next/standalone/.next/server/app/hail/[id]/setup/page.js +1 -1
  246. package/.next/standalone/.next/server/app/hail/[id]/setup/page.js.nft.json +1 -1
  247. package/.next/standalone/.next/server/app/hail/[id]/setup/page_client-reference-manifest.js +1 -1
  248. package/.next/standalone/.next/server/app/hail/page.js +2 -2
  249. package/.next/standalone/.next/server/app/hail/page.js.nft.json +1 -1
  250. package/.next/standalone/.next/server/app/hail/page_client-reference-manifest.js +1 -1
  251. package/.next/standalone/.next/server/app/help/[slug]/page.js +1 -1
  252. package/.next/standalone/.next/server/app/help/[slug]/page.js.nft.json +1 -1
  253. package/.next/standalone/.next/server/app/help/[slug]/page_client-reference-manifest.js +1 -1
  254. package/.next/standalone/.next/server/app/help/page.js +1 -1
  255. package/.next/standalone/.next/server/app/help/page.js.nft.json +1 -1
  256. package/.next/standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  257. package/.next/standalone/.next/server/app/index.html +2 -2
  258. package/.next/standalone/.next/server/app/index.rsc +5 -5
  259. package/.next/standalone/.next/server/app/join/page.js +1 -1
  260. package/.next/standalone/.next/server/app/join/page.js.nft.json +1 -1
  261. package/.next/standalone/.next/server/app/join/page_client-reference-manifest.js +1 -1
  262. package/.next/standalone/.next/server/app/join.html +1 -1
  263. package/.next/standalone/.next/server/app/join.rsc +4 -4
  264. package/.next/standalone/.next/server/app/login/page.js +1 -1
  265. package/.next/standalone/.next/server/app/login/page.js.nft.json +1 -1
  266. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  267. package/.next/standalone/.next/server/app/marketplace/page.js +4 -4
  268. package/.next/standalone/.next/server/app/marketplace/page.js.nft.json +1 -1
  269. package/.next/standalone/.next/server/app/marketplace/page_client-reference-manifest.js +1 -1
  270. package/.next/standalone/.next/server/app/mines/[projectId]/page.js +1 -1
  271. package/.next/standalone/.next/server/app/mines/[projectId]/page.js.nft.json +1 -1
  272. package/.next/standalone/.next/server/app/mines/[projectId]/page_client-reference-manifest.js +1 -1
  273. package/.next/standalone/.next/server/app/mines/[projectId]/results/page.js +1 -1
  274. package/.next/standalone/.next/server/app/mines/[projectId]/results/page.js.nft.json +1 -1
  275. package/.next/standalone/.next/server/app/mines/[projectId]/results/page_client-reference-manifest.js +1 -1
  276. package/.next/standalone/.next/server/app/mines/page.js +1 -1
  277. package/.next/standalone/.next/server/app/mines/page.js.nft.json +1 -1
  278. package/.next/standalone/.next/server/app/mines/page_client-reference-manifest.js +1 -1
  279. package/.next/standalone/.next/server/app/missions/page.js +2 -2
  280. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  281. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  282. package/.next/standalone/.next/server/app/onboarding/org/page.js +1 -1
  283. package/.next/standalone/.next/server/app/onboarding/org/page.js.nft.json +1 -1
  284. package/.next/standalone/.next/server/app/onboarding/org/page_client-reference-manifest.js +1 -1
  285. package/.next/standalone/.next/server/app/onboarding/page.js +1 -1
  286. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  287. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  288. package/.next/standalone/.next/server/app/onboarding.html +2 -2
  289. package/.next/standalone/.next/server/app/onboarding.rsc +4 -4
  290. package/.next/standalone/.next/server/app/org/page.js +1 -1
  291. package/.next/standalone/.next/server/app/org/page.js.nft.json +1 -1
  292. package/.next/standalone/.next/server/app/org/page_client-reference-manifest.js +1 -1
  293. package/.next/standalone/.next/server/app/page.js +5 -5
  294. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  295. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  296. package/.next/standalone/.next/server/app/projects/[slug]/log/page.js +1 -1
  297. package/.next/standalone/.next/server/app/projects/[slug]/log/page.js.nft.json +1 -1
  298. package/.next/standalone/.next/server/app/projects/[slug]/log/page_client-reference-manifest.js +1 -1
  299. package/.next/standalone/.next/server/app/projects/[slug]/page.js +1 -1
  300. package/.next/standalone/.next/server/app/projects/[slug]/page.js.nft.json +1 -1
  301. package/.next/standalone/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  302. package/.next/standalone/.next/server/app/projects/new/page.js +3 -3
  303. package/.next/standalone/.next/server/app/projects/new/page.js.nft.json +1 -1
  304. package/.next/standalone/.next/server/app/projects/new/page_client-reference-manifest.js +1 -1
  305. package/.next/standalone/.next/server/app/projects/new.html +2 -2
  306. package/.next/standalone/.next/server/app/projects/new.rsc +5 -5
  307. package/.next/standalone/.next/server/app/projects/page.js +34 -24
  308. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  309. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  310. package/.next/standalone/.next/server/app/reports/[file]/route_client-reference-manifest.js +1 -1
  311. package/.next/standalone/.next/server/app/reports/page.js +1 -1
  312. package/.next/standalone/.next/server/app/reports/page.js.nft.json +1 -1
  313. package/.next/standalone/.next/server/app/reports/page_client-reference-manifest.js +1 -1
  314. package/.next/standalone/.next/server/app/runtime/page.js +1 -1
  315. package/.next/standalone/.next/server/app/runtime/page.js.nft.json +1 -1
  316. package/.next/standalone/.next/server/app/runtime/page_client-reference-manifest.js +1 -1
  317. package/.next/standalone/.next/server/app/schedules/page.js +2 -2
  318. package/.next/standalone/.next/server/app/schedules/page.js.nft.json +1 -1
  319. package/.next/standalone/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
  320. package/.next/standalone/.next/server/app/settings/account/page.js +1 -1
  321. package/.next/standalone/.next/server/app/settings/account/page.js.nft.json +1 -1
  322. package/.next/standalone/.next/server/app/settings/account/page_client-reference-manifest.js +1 -1
  323. package/.next/standalone/.next/server/app/settings/advanced/page.js +1 -1
  324. package/.next/standalone/.next/server/app/settings/advanced/page.js.nft.json +1 -1
  325. package/.next/standalone/.next/server/app/settings/advanced/page_client-reference-manifest.js +1 -1
  326. package/.next/standalone/.next/server/app/settings/appearance/page.js +1 -1
  327. package/.next/standalone/.next/server/app/settings/appearance/page.js.nft.json +1 -1
  328. package/.next/standalone/.next/server/app/settings/appearance/page_client-reference-manifest.js +1 -1
  329. package/.next/standalone/.next/server/app/settings/brand/page.js +1 -1
  330. package/.next/standalone/.next/server/app/settings/brand/page.js.nft.json +1 -1
  331. package/.next/standalone/.next/server/app/settings/brand/page_client-reference-manifest.js +1 -1
  332. package/.next/standalone/.next/server/app/settings/brand.html +2 -2
  333. package/.next/standalone/.next/server/app/settings/brand.rsc +5 -5
  334. package/.next/standalone/.next/server/app/settings/connectors/page.js +1 -1
  335. package/.next/standalone/.next/server/app/settings/connectors/page.js.nft.json +1 -1
  336. package/.next/standalone/.next/server/app/settings/connectors/page_client-reference-manifest.js +1 -1
  337. package/.next/standalone/.next/server/app/settings/engines/page.js +1 -1
  338. package/.next/standalone/.next/server/app/settings/engines/page.js.nft.json +1 -1
  339. package/.next/standalone/.next/server/app/settings/engines/page_client-reference-manifest.js +1 -1
  340. package/.next/standalone/.next/server/app/settings/onboarding/page.js +1 -1
  341. package/.next/standalone/.next/server/app/settings/onboarding/page.js.nft.json +1 -1
  342. package/.next/standalone/.next/server/app/settings/onboarding/page_client-reference-manifest.js +1 -1
  343. package/.next/standalone/.next/server/app/settings/onboarding.html +2 -2
  344. package/.next/standalone/.next/server/app/settings/onboarding.rsc +5 -5
  345. package/.next/standalone/.next/server/app/settings/organization/page.js +2 -2
  346. package/.next/standalone/.next/server/app/settings/organization/page.js.nft.json +1 -1
  347. package/.next/standalone/.next/server/app/settings/organization/page_client-reference-manifest.js +1 -1
  348. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  349. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  350. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  351. package/.next/standalone/.next/server/app/settings/runtime/page.js +1 -1
  352. package/.next/standalone/.next/server/app/settings/runtime/page.js.nft.json +1 -1
  353. package/.next/standalone/.next/server/app/settings/runtime/page_client-reference-manifest.js +1 -1
  354. package/.next/standalone/.next/server/app/settings/team/page.js +1 -1
  355. package/.next/standalone/.next/server/app/settings/team/page.js.nft.json +1 -1
  356. package/.next/standalone/.next/server/app/settings/team/page_client-reference-manifest.js +1 -1
  357. package/.next/standalone/.next/server/app/settings/tools/page.js +1 -1
  358. package/.next/standalone/.next/server/app/settings/tools/page.js.nft.json +1 -1
  359. package/.next/standalone/.next/server/app/settings/tools/page_client-reference-manifest.js +1 -1
  360. package/.next/standalone/.next/server/app/settings.html +2 -2
  361. package/.next/standalone/.next/server/app/settings.rsc +5 -5
  362. package/.next/standalone/.next/server/app/share/[token]/page.js +1 -1
  363. package/.next/standalone/.next/server/app/share/[token]/page.js.nft.json +1 -1
  364. package/.next/standalone/.next/server/app/share/[token]/page_client-reference-manifest.js +1 -1
  365. package/.next/standalone/.next/server/app/share/space/[token]/page.js +1 -1
  366. package/.next/standalone/.next/server/app/share/space/[token]/page.js.nft.json +1 -1
  367. package/.next/standalone/.next/server/app/share/space/[token]/page_client-reference-manifest.js +1 -1
  368. package/.next/standalone/.next/server/app/tasks/[id]/page.js +2 -2
  369. package/.next/standalone/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
  370. package/.next/standalone/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  371. package/.next/standalone/.next/server/app/tasks/page.js +2 -2
  372. package/.next/standalone/.next/server/app/tasks/page.js.nft.json +1 -1
  373. package/.next/standalone/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  374. package/.next/standalone/.next/server/app/team/[agentId]/page.js +1 -1
  375. package/.next/standalone/.next/server/app/team/[agentId]/page.js.nft.json +1 -1
  376. package/.next/standalone/.next/server/app/team/[agentId]/page_client-reference-manifest.js +1 -1
  377. package/.next/standalone/.next/server/app/team/page.js +1 -1
  378. package/.next/standalone/.next/server/app/team/page.js.nft.json +1 -1
  379. package/.next/standalone/.next/server/app/team/page_client-reference-manifest.js +1 -1
  380. package/.next/standalone/.next/server/app/tools/page.js +1 -1
  381. package/.next/standalone/.next/server/app/tools/page.js.nft.json +1 -1
  382. package/.next/standalone/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  383. package/.next/standalone/.next/server/app/whatsapp/page.js +1 -1
  384. package/.next/standalone/.next/server/app/whatsapp/page.js.nft.json +1 -1
  385. package/.next/standalone/.next/server/app/whatsapp/page_client-reference-manifest.js +1 -1
  386. package/.next/standalone/.next/server/app/whatsapp.html +2 -2
  387. package/.next/standalone/.next/server/app/whatsapp.rsc +4 -4
  388. package/.next/standalone/.next/server/app/workflows/[caseId]/page.js +1 -1
  389. package/.next/standalone/.next/server/app/workflows/[caseId]/page.js.nft.json +1 -1
  390. package/.next/standalone/.next/server/app/workflows/[caseId]/page_client-reference-manifest.js +1 -1
  391. package/.next/standalone/.next/server/app/workflows/new/[caseId]/page.js +1 -1
  392. package/.next/standalone/.next/server/app/workflows/new/[caseId]/page.js.nft.json +1 -1
  393. package/.next/standalone/.next/server/app/workflows/new/[caseId]/page_client-reference-manifest.js +1 -1
  394. package/.next/standalone/.next/server/app/workflows/new/definition/page.js +1 -1
  395. package/.next/standalone/.next/server/app/workflows/new/definition/page.js.nft.json +1 -1
  396. package/.next/standalone/.next/server/app/workflows/new/definition/page_client-reference-manifest.js +1 -1
  397. package/.next/standalone/.next/server/app/workflows/page.js +1 -1
  398. package/.next/standalone/.next/server/app/workflows/page.js.nft.json +1 -1
  399. package/.next/standalone/.next/server/app/workflows/page_client-reference-manifest.js +1 -1
  400. package/.next/standalone/.next/server/app/workflows/share/[caseId]/page.js +1 -1
  401. package/.next/standalone/.next/server/app/workflows/share/[caseId]/page.js.nft.json +1 -1
  402. package/.next/standalone/.next/server/app/workflows/share/[caseId]/page_client-reference-manifest.js +1 -1
  403. package/.next/standalone/.next/server/app-paths-manifest.json +68 -68
  404. package/.next/standalone/.next/server/chunks/1648.js +1 -1
  405. package/.next/standalone/.next/server/chunks/1699.js +35 -18
  406. package/.next/standalone/.next/server/chunks/{3806.js → 3379.js} +1 -1
  407. package/.next/standalone/.next/server/chunks/4804.js +1 -1
  408. package/.next/standalone/.next/server/chunks/6059.js +1 -1
  409. package/.next/standalone/.next/server/chunks/{9195.js → 9483.js} +1 -1
  410. package/.next/standalone/.next/server/functions-config-manifest.json +45 -45
  411. package/.next/standalone/.next/server/middleware-build-manifest.js +1 -1
  412. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  413. package/.next/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  414. package/.next/standalone/.next/server/pages/404.html +2 -1
  415. package/.next/standalone/.next/server/pages/500.html +1 -1
  416. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  417. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  418. package/.next/standalone/.next/static/chunks/494-02cf75066d25e8ac.js +1 -0
  419. package/.next/standalone/.next/static/chunks/8217.9459315d921fdd61.js +1 -0
  420. package/.next/{static/chunks/app/agents/[id]/page-e4bcb0ace2900a11.js → standalone/.next/static/chunks/app/agents/[id]/page-fd263522f6c29653.js} +1 -1
  421. package/.next/{static/chunks/app/agents/page-47a00aa58327a35e.js → standalone/.next/static/chunks/app/agents/page-5860869c305cc54b.js} +1 -1
  422. package/.next/standalone/.next/static/chunks/app/layout-457acc50d33a5e0e.js +1 -0
  423. package/.next/standalone/.next/static/chunks/app/login/page-69e66f7316e3aaf2.js +1 -0
  424. package/.next/standalone/.next/static/chunks/app/marketplace/page-b21a9b2946742aa4.js +1 -0
  425. package/.next/standalone/.next/static/chunks/app/page-9a013fdb2983cbf4.js +1 -0
  426. package/.next/standalone/.next/static/chunks/app/projects/page-3d7140091264933a.js +1 -0
  427. package/.next/standalone/.next/static/chunks/app/settings/layout-fd443bfa8cac181e.js +1 -0
  428. package/.next/standalone/.next/static/chunks/webpack-e4f2cfb4ad98f256.js +1 -0
  429. package/.next/standalone/.next/static/css/31fb2fdadf8f1c6b.css +1 -0
  430. package/.next/standalone/CHANGELOG.md +25 -0
  431. package/.next/standalone/package.json +1 -1
  432. package/.next/static/chunks/494-02cf75066d25e8ac.js +1 -0
  433. package/.next/static/chunks/8217.9459315d921fdd61.js +1 -0
  434. package/.next/{standalone/.next/static/chunks/app/agents/[id]/page-e4bcb0ace2900a11.js → static/chunks/app/agents/[id]/page-fd263522f6c29653.js} +1 -1
  435. package/.next/{standalone/.next/static/chunks/app/agents/page-47a00aa58327a35e.js → static/chunks/app/agents/page-5860869c305cc54b.js} +1 -1
  436. package/.next/static/chunks/app/layout-457acc50d33a5e0e.js +1 -0
  437. package/.next/static/chunks/app/login/page-69e66f7316e3aaf2.js +1 -0
  438. package/.next/static/chunks/app/marketplace/page-b21a9b2946742aa4.js +1 -0
  439. package/.next/static/chunks/app/page-9a013fdb2983cbf4.js +1 -0
  440. package/.next/static/chunks/app/projects/page-3d7140091264933a.js +1 -0
  441. package/.next/static/chunks/app/settings/layout-fd443bfa8cac181e.js +1 -0
  442. package/.next/static/chunks/webpack-e4f2cfb4ad98f256.js +1 -0
  443. package/.next/static/css/31fb2fdadf8f1c6b.css +1 -0
  444. package/CHANGELOG.md +25 -0
  445. package/CLAUDE.md +1 -1
  446. package/README.md +1 -1
  447. package/ai-docs/key-constraints.md +9 -1
  448. package/app/agents/agent-events-bus.js +11 -1
  449. package/app/api/connections/[service]/verify/route.js +29 -1
  450. package/app/api/fs/pick-folder/route.js +13 -11
  451. package/app/api/orchestrator/stream/route.js +92 -9
  452. package/app/api/voice/realtime/session/route.js +4 -0
  453. package/app/components/app-topbar.jsx +265 -28
  454. package/app/components/dashboard/chat-panel.jsx +54 -5
  455. package/app/components/dashboard/thinking-disclosure.jsx +59 -0
  456. package/app/components/dashboard/tool-steps.js +9 -0
  457. package/app/components/dashboard/use-main-agent-stream.js +2 -0
  458. package/app/components/dashboard/use-realtime-voice.js +33 -5
  459. package/app/components/dashboard/use-stream-command.js +29 -2
  460. package/app/components/dashboard/voice-panel.jsx +148 -36
  461. package/app/components/ui/marketplace/install-toggle.jsx +44 -9
  462. package/app/globals.css +148 -8
  463. package/app/login/login-client.jsx +23 -5
  464. package/app/marketplace/connection-setup-modal.jsx +31 -1
  465. package/app/marketplace/connection-setup-steps/api-key-step.jsx +20 -3
  466. package/app/marketplace/install-toast.jsx +1 -1
  467. package/app/marketplace/marketplace-row.jsx +8 -1
  468. package/app/marketplace/marketplace-shell.jsx +78 -7
  469. package/app/marketplace/workflow-card.jsx +2 -1
  470. package/lib/agent-config.js +7 -0
  471. package/lib/agent-engines.js +182 -21
  472. package/lib/auth-config.js +24 -8
  473. package/lib/claude.js +19 -2
  474. package/lib/cli/doctor.js +25 -0
  475. package/lib/connection-seeds.js +1 -1
  476. package/lib/engine-verbosity.js +42 -0
  477. package/lib/env-file.js +3 -0
  478. package/lib/pick-folder-authz.js +15 -0
  479. package/lib/realtime-openai.js +49 -1
  480. package/lib/tools/adapters/browser-session.js +37 -8
  481. package/lib/tools/adapters/github.js +47 -5
  482. package/lib/tools/adapters/skill-bridge.js +146 -0
  483. package/lib/tools/registry.js +40 -4
  484. package/lib/voice/context.js +1 -1
  485. package/lib/voice/tools.js +34 -2
  486. package/package.json +1 -1
  487. package/scripts/migrate-auth-v1.mjs +92 -0
  488. package/.next/standalone/.next/static/chunks/3054-451abdd7b9afc2ac.js +0 -1
  489. package/.next/standalone/.next/static/chunks/8217.0beb0a316c7ad5d8.js +0 -1
  490. package/.next/standalone/.next/static/chunks/app/layout-b7e1918b9125641e.js +0 -1
  491. package/.next/standalone/.next/static/chunks/app/login/page-d2298bc1803944ae.js +0 -1
  492. package/.next/standalone/.next/static/chunks/app/marketplace/page-0b7d3a6309302de3.js +0 -1
  493. package/.next/standalone/.next/static/chunks/app/page-887ef6f96897f78a.js +0 -1
  494. package/.next/standalone/.next/static/chunks/app/projects/page-739d4cc74824d336.js +0 -1
  495. package/.next/standalone/.next/static/chunks/app/settings/layout-08f6b30132b26dd1.js +0 -1
  496. package/.next/standalone/.next/static/chunks/webpack-f916d679fe38a701.js +0 -1
  497. package/.next/standalone/.next/static/css/2587cd46c922a6d8.css +0 -1
  498. package/.next/static/chunks/3054-451abdd7b9afc2ac.js +0 -1
  499. package/.next/static/chunks/8217.0beb0a316c7ad5d8.js +0 -1
  500. package/.next/static/chunks/app/layout-b7e1918b9125641e.js +0 -1
  501. package/.next/static/chunks/app/login/page-d2298bc1803944ae.js +0 -1
  502. package/.next/static/chunks/app/marketplace/page-0b7d3a6309302de3.js +0 -1
  503. package/.next/static/chunks/app/page-887ef6f96897f78a.js +0 -1
  504. package/.next/static/chunks/app/projects/page-739d4cc74824d336.js +0 -1
  505. package/.next/static/chunks/app/settings/layout-08f6b30132b26dd1.js +0 -1
  506. package/.next/static/chunks/webpack-f916d679fe38a701.js +0 -1
  507. package/.next/static/css/2587cd46c922a6d8.css +0 -1
  508. /package/.next/standalone/.next/static/{ZxaTPKGC9lESQlvHfrHgp → -FRz43s1H_LZFhx24FvnL}/_buildManifest.js +0 -0
  509. /package/.next/standalone/.next/static/{ZxaTPKGC9lESQlvHfrHgp → -FRz43s1H_LZFhx24FvnL}/_ssgManifest.js +0 -0
  510. /package/.next/static/{ZxaTPKGC9lESQlvHfrHgp → -FRz43s1H_LZFhx24FvnL}/_buildManifest.js +0 -0
  511. /package/.next/static/{ZxaTPKGC9lESQlvHfrHgp → -FRz43s1H_LZFhx24FvnL}/_ssgManifest.js +0 -0
@@ -1 +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]),v=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]),y=t.useMemo(()=>v.reduce((e,a)=>{let[,l]=a;return e+l.length},0),[v]),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===y?(0,n.jsxs)("div",{className:"tool-picker-empty",children:["No tools match “",p,"”."]}):v.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,v]=t.useState(!1),y=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:y,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=>{v(!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:y,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,[v,y]=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:()=>y(e=>!e),className:"admin-button secondary icon ".concat(v?"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})})]})]}),v?(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:()=>y(!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)(()=>{let e=!1;return fetch("/api/agents/".concat(encodeURIComponent(a),"/active-run")).then(e=>e.ok?e.json():null).then(a=>{!e&&(null==a?void 0:a.active)&&i(!0)}).catch(()=>{}),()=>{e=!0}},[a]),(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()}]);
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]),v=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]),y=t.useMemo(()=>v.reduce((e,a)=>{let[,l]=a;return e+l.length},0),[v]),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===y?(0,n.jsxs)("div",{className:"tool-picker-empty",children:["No tools match “",p,"”."]}):v.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,v]=t.useState(!1),y=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:y,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=>{v(!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:y,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,[v,y]=t.useState(!1),[f,b]=t.useState(!1),[N,k]=t.useState(""),w=t.useRef(null),C=t.useRef(null),S="DELETE"===N.trim(),_=t.useCallback(()=>{let e=w.current;e&&e.open&&e.close(),b(!1),k("")},[]),E=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(),_()},l=()=>{b(!1),k("")};return e.addEventListener("cancel",a),e.addEventListener("close",l),()=>{e.removeEventListener("cancel",a),e.removeEventListener("close",l)}},[_]),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:()=>y(e=>!e),className:"admin-button secondary icon ".concat(v?"on":""),children:(0,n.jsx)(r,{size:13})}),(0,n.jsx)("button",{type:"button","aria-label":"Delete agent",title:"Delete agent",onClick:E,className:"admin-button danger icon",children:(0,n.jsx)(o.A,{size:13})})]})]}),v?(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:()=>y(!1),className:"admin-button secondary",children:"Cancel"})]})]}):null,(0,n.jsx)("dialog",{ref:w,className:"agent-delete-dialog",onClick:e=>{e.target===w.current&&_()},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:_,"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:_,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","agent_tool_start","agent_tool_result"],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)(()=>{let e=!1;return fetch("/api/agents/".concat(encodeURIComponent(a),"/active-run")).then(e=>e.ok?e.json():null).then(a=>{!e&&(null==a?void 0:a.active)&&i(!0)}).catch(()=>{}),()=>{e=!0}},[a]),(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([[7177],{41290:()=>{},44022:(e,t,a)=>{"use strict";a.d(t,{default:()=>D});var s=a(95155),r=a(12115),n=a(52619),i=a.n(n),l=a(20063),o=a(49565),c=a(27629),d=a(18987),u=a(25709),h=a(41516),p=a(4733),m=a(51745),g=a(64597),f=a(51092),v=a(85893),b=a(66351),y=a(67657),k=a(53437),x=a(96898),w=a(34227),j=a(78661),N=a(61510),S=a(18080),_=a(14333),E=a(65898);let A="madarx:sidebarAvatar";function C(){let[e,t]=(0,r.useState)(null),a=(0,r.useRef)(null);return(0,r.useEffect)(()=>{try{let e=localStorage.getItem(A);e&&t(e)}catch(e){}},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=a.current)?void 0:e.click()},"aria-label":e?"Change avatar":"Upload an avatar",title:e?"Change avatar":"Upload an avatar",className:"group relative w-9 h-9 rounded-full overflow-hidden flex items-center justify-center cursor-pointer border border-[rgba(20,22,26,0.16)] bg-[rgba(17,19,24,0.035)] transition-colors hover:border-[rgba(20,22,26,0.32)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#111318] focus-visible:ring-offset-2 focus-visible:ring-offset-white/50",children:[e?(0,s.jsx)("img",{src:e,alt:"Avatar",className:"w-full h-full object-cover"}):(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#9aa1ab",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M12 16V8M8 12h8"})}),(0,s.jsx)("span",{className:"absolute inset-0 hidden group-hover:flex items-center justify-center bg-black/35 text-white",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M12 16V6M12 6 7.5 10.5M12 6l4.5 4.5"}),(0,s.jsx)("path",{d:"M5 18v1.5A1.5 1.5 0 0 0 6.5 21h11a1.5 1.5 0 0 0 1.5-1.5V18"})]})}),e?(0,s.jsx)("span",{role:"button",tabIndex:-1,onClick:function(e){e.stopPropagation(),t(null);try{localStorage.removeItem(A)}catch(e){}},"aria-label":"Remove avatar",className:"absolute -top-0.5 -right-0.5 hidden group-hover:flex w-4 h-4 items-center justify-center rounded-full bg-[#111318] text-white text-[9px] leading-none",children:"\xd7"}):null]}),(0,s.jsx)("input",{ref:a,type:"file",accept:"image/*",hidden:!0,onChange:function(e){var a;let s=null==(a=e.target.files)?void 0:a[0];if(e.target.value="",!s||!s.type.startsWith("image/")||s.size>2097152)return;let r=new FileReader;r.onload=()=>{let e=String(r.result||"");if(e){t(e);try{localStorage.setItem(A,e)}catch(e){}}},r.readAsDataURL(s)}})]})}let L=[{group:"work",name:"Spaces",href:"/",icon:d.A},{group:"work",name:"Projects",href:"/projects",icon:u.A},{group:"work",name:"Agents",href:"/agents",icon:h.A},{group:"work",name:"Tasks",href:"/tasks",icon:p.A},{group:"work",name:"Workflows",href:"/workflows",icon:m.A},{group:"work",name:"Approvals",href:"/approvals",icon:g.A},{group:"library",name:"Marketplace",href:"/marketplace",icon:f.A}],R={Pickaxe:v.A,Boxes:b.A,Gem:y.A,FlaskConical:k.A,Factory:x.A,Building2:w.A,Package:f.A,FolderOpen:u.A,Workflow:m.A},P=[{name:"Settings",icon:j.A,href:"/settings"}];function T(e,t){return!!e&&("/"===t?"/"===e:e===t||e.startsWith("".concat(t,"/")))}function M(e){var t,a;null==(a=e.currentTarget)||null==(t=a.blur)||t.call(a)}function W(e){let{item:t,active:a}=e,r=t.icon;return(0,s.jsxs)(i(),{href:t.href,prefetch:!0,"aria-label":t.name,"aria-current":a?"page":void 0,"data-active":a?"true":void 0,onClick:M,className:"".concat("relative flex items-center justify-center p-2 rounded-lg transition-colors duration-150 group"," ").concat(a?"text-[#C2452A]":"text-[#69707a] hover:text-[#111318] hover:bg-[rgba(17,19,24,0.08)] active:bg-[rgba(17,19,24,0.12)]"),children:[(0,s.jsx)(r,{className:"w-5 h-5",strokeWidth:1.75,"aria-hidden":"true"}),(0,s.jsx)("span",{className:"absolute left-12 px-2 py-1 rounded-md whitespace-nowrap text-xs text-white bg-[#111318] hidden group-hover:inline-block group-focus-visible:inline-block z-50 shadow-lg pointer-events-none",children:t.name})]})}function D(e){let{moduleNav:t=[]}=e,a=(0,l.usePathname)(),{session:n,signOut:d}=(0,E.$)(),[u,h]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=!0;return fetch("/api/system/update").then(e=>e.ok?e.json():null).then(t=>{e&&t&&h(t)}).catch(()=>{}),()=>{e=!1}},[]);let p=(Array.isArray(t)?t:[]).map(e=>({group:"module",name:e.label,href:e.href,icon:R[e.icon]||b.A})),m=[...L.filter(e=>"work"===e.group),...p,...L.filter(e=>"library"===e.group)],g=(null==n?void 0:n.email)||"Local owner",f="local"===((null==n?void 0:n.auth_mode)||"local"),v=((null==n?void 0:n.email)||(null==n?void 0:n.display_name)||"AK").slice(0,2).toUpperCase();return(0,s.jsxs)("aside",{className:"relative z-30 h-full w-full rounded-[18px] border border-white/75 bg-[var(--glass)] backdrop-blur-[22px] backdrop-saturate-150 flex flex-col","aria-label":"Primary navigation",children:[(0,s.jsx)("div",{className:"h-20 flex items-center justify-center px-3 shrink-0",children:(0,s.jsx)(C,{})}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,s.jsx)("ul",{className:"list-none m-0 p-0 px-3 text-sm font-medium flex-1 space-y-1",children:m.map((e,t)=>{let r=m[t-1],n=r&&r.group!==e.group,i=T(a,e.href);return(0,s.jsxs)("li",{children:[n?(0,s.jsx)("div",{"aria-hidden":"true",className:"mx-2 my-2 h-px bg-[rgba(20,22,26,0.09)]"}):null,(0,s.jsx)(W,{item:e,active:i})]},e.name)})}),(0,s.jsx)("ul",{className:"list-none m-0 p-0 px-3 pb-3 pt-2 text-sm font-medium space-y-1",children:P.map(e=>{let t=T(a,e.href);return(0,s.jsx)("li",{children:(0,s.jsx)(W,{item:e,active:t})},e.name)})}),(0,s.jsx)("div",{className:"relative py-4 px-3 border-t border-[rgba(20,22,26,0.09)] flex justify-center",children:(0,s.jsxs)(o.bL,{children:[(0,s.jsx)(o.l9,{className:"outline-none rounded-full border-0 bg-transparent p-0 appearance-none cursor-pointer focus-visible:ring-2 focus-visible:ring-[#111318] focus-visible:ring-offset-2 focus-visible:ring-offset-white/50","aria-label":"Account menu",children:(0,s.jsxs)(c.bL,{className:"w-10 h-10 rounded-full overflow-hidden cursor-pointer block",children:[(0,s.jsx)(c._V,{className:"w-full h-full object-cover",src:"/madarx-mark.svg",alt:"AK"}),(0,s.jsx)(c.H4,{className:"flex w-full h-full items-center justify-center text-white text-xs font-bold tracking-wider bg-gradient-to-br from-[#111318] to-[#565d6b]",delayMs:150,children:v})]})}),(0,s.jsx)(o.ZL,{children:(0,s.jsxs)(o.UC,{side:"right",align:"end",sideOffset:12,className:"w-64 rounded-xl bg-white shadow-[0_22px_60px_rgba(17,19,24,0.20)] border border-[rgba(20,22,26,0.09)] text-sm text-[#59606b] p-2 z-[100]",children:[(0,s.jsx)("div",{className:"px-2 py-1.5 text-[11px] uppercase tracking-[0.14em] text-[var(--accent-600)] font-bold",children:f?"Local operator":"Signed in"}),(0,s.jsx)("span",{className:"block text-[#68707b] px-2 pb-2 truncate",children:g}),(0,s.jsx)(o.q7,{asChild:!0,className:"outline-none",children:(0,s.jsx)(i(),{href:"/",className:"block w-full p-2 text-left rounded-md hover:bg-[rgba(17,19,24,0.05)] active:bg-[rgba(17,19,24,0.1)] duration-150 cursor-pointer no-underline text-[#313740]",children:"Spaces"})}),(0,s.jsx)(o.q7,{asChild:!0,className:"outline-none",children:(0,s.jsx)(i(),{href:"/settings",className:"block w-full p-2 text-left rounded-md hover:bg-[rgba(17,19,24,0.05)] active:bg-[rgba(17,19,24,0.1)] duration-150 cursor-pointer no-underline text-[#313740]",children:"Settings"})}),(0,s.jsx)(o.wv,{className:"my-1 h-px bg-[rgba(20,22,26,0.09)]"}),(null==u?void 0:u.behind)&&(null==u?void 0:u.latest)?(0,s.jsx)(o.q7,{asChild:!0,className:"outline-none",children:(0,s.jsxs)(i(),{href:"/",className:"flex items-center justify-between gap-x-2 w-full p-2 text-left rounded-md hover:bg-[rgba(17,19,24,0.05)] active:bg-[rgba(17,19,24,0.1)] duration-150 cursor-pointer no-underline text-[#313740]",children:[(0,s.jsxs)("span",{className:"flex items-center gap-x-2",children:[(0,s.jsx)(N.A,{className:"w-4 h-4 text-[var(--accent-600)]",strokeWidth:1.75}),"Update available"]}),(0,s.jsxs)("span",{className:"text-[11px] font-semibold text-[var(--accent-600)]",children:["v",u.latest]})]})}):(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-2 text-[12px] text-[#9aa1ab]",children:[(0,s.jsx)("span",{children:"Version"}),(0,s.jsx)("span",{className:"font-medium text-[#68707b]",children:(null==u?void 0:u.current)?"v".concat(u.current):"—"})]}),(0,s.jsx)(o.wv,{className:"my-1 h-px bg-[rgba(20,22,26,0.09)]"}),f?(0,s.jsx)(o.q7,{asChild:!0,className:"outline-none",children:(0,s.jsxs)(i(),{href:"/settings/account",className:"flex items-center gap-x-2 w-full p-2 text-left rounded-md hover:bg-[rgba(17,19,24,0.05)] active:bg-[rgba(17,19,24,0.1)] duration-150 cursor-pointer no-underline text-[#313740]",children:[(0,s.jsx)(S.A,{className:"w-4 h-4",strokeWidth:1.75}),"Sign in with an account"]})}):(0,s.jsx)(o.q7,{asChild:!0,className:"outline-none",children:(0,s.jsxs)("button",{type:"button",onClick:d,className:"flex items-center gap-x-2 w-full p-2 text-left rounded-md hover:bg-[rgba(17,19,24,0.05)] active:bg-[rgba(17,19,24,0.1)] duration-150 cursor-pointer text-[#313740]",children:[(0,s.jsx)(_.A,{className:"w-4 h-4",strokeWidth:1.75}),"Sign out"]})})]})})]})})]})]})}},59077:(e,t,a)=>{"use strict";a.d(t,{U_:()=>l,bX:()=>o,wb:()=>i});let s={Bash:"run command",WebSearch:"web search",WebFetch:"fetch",Read:"read",Write:"write",Edit:"edit",MultiEdit:"edit",NotebookEdit:"edit notebook",Glob:"find files",Grep:"search files",LS:"list",TodoWrite:"plan",Task:"subagent",Skill:"skill",SlashCommand:"command",ExitPlanMode:"exit plan",AskUserQuestion:"ask"};function r(e){if(!e)return"";let t=String(e);return t.split("/").filter(Boolean).pop()||t}function n(e){try{return new URL(String(e)).hostname}catch(t){return String(e).slice(0,52)}}function i(e){if(!e||e<0)return null;if(e<1e3)return"".concat(Math.round(e),"ms");if(e<6e4)return"".concat((e/1e3).toFixed(1),"s");let t=Math.round(e/1e3);return"".concat(Math.floor(t/60),"m ").concat(t%60,"s")}function l(e){if(!e)return"";if(s[e])return s[e];if("string"==typeof e&&e.startsWith("mcp__")){let t=e.split("__");return t[t.length-1].replace(/_/g," ")}return e.replace(/_/g," ")}function o(e,t){return t?"web_search"===e&&t.query?'"'.concat(String(t.query).slice(0,52),'"'):"web_fetch"===e&&t.url?n(t.url):"browser_harness_run"===e&&t.script?"browser script":"create_artifact"===e&&t.title?'"'.concat(String(t.title).slice(0,40),'"'):"create_agent"===e&&t.name?'"'.concat(String(t.name).slice(0,40),'"'):("file_read"===e||"file_write"===e)&&t.path?r(t.path).slice(0,40):"Bash"===e&&t.command?String(t.command).slice(0,80):"WebSearch"===e&&t.query?'"'.concat(String(t.query).slice(0,52),'"'):"WebFetch"===e&&t.url?n(t.url):("Read"===e||"Write"===e||"Edit"===e||"MultiEdit"===e||"NotebookEdit"===e)&&t.file_path?r(t.file_path).slice(0,40):("Glob"===e||"Grep"===e)&&(t.pattern||t.path)?String(t.pattern||t.path).slice(0,52):"LS"===e&&t.path?r(t.path).slice(0,40)||"/":"TodoWrite"===e&&Array.isArray(t.todos)?"".concat(t.todos.length," item").concat(1===t.todos.length?"":"s"):"Task"===e&&t.description?'"'.concat(String(t.description).slice(0,52),'"'):"Skill"===e&&t.skill?"/".concat(t.skill):"SlashCommand"===e&&t.command?String(t.command).slice(0,52):null:null}},65898:(e,t,a)=>{"use strict";a.d(t,{$:()=>n});var s=a(12115),r=a(20063);function n(){let[e,t]=(0,s.useState)(null),a=(0,r.useRouter)();return(0,s.useEffect)(()=>{let e=!0;return fetch("/api/auth/session",{cache:"no-store"}).then(e=>e.json()).then(a=>{e&&t((null==a?void 0:a.user)||null)}).catch(()=>{e&&t(null)}),()=>{e=!1}},[]),{session:e,signOut:async function(){await fetch("/api/auth/session",{method:"DELETE"}).catch(()=>null),a.replace("/login"),a.refresh()}}}},69088:(e,t,a)=>{"use strict";a.d(t,{N:()=>i});let s=["agent_created","agent_run_start","agent_run_complete","agent_tool_start","agent_tool_result"],r=null,n=new Set;function i(e){return!function(){if(!r&&window.EventSource)for(let e of(r=new EventSource("/api/events/stream"),s))r.addEventListener(e,t=>{let a={};try{a=JSON.parse(t.data)}catch(e){}let s={...a,type:e};for(let e of n)try{e(s)}catch(e){}})}(),n.add(e),()=>{if(n.delete(e),0===n.size&&r){try{r.close()}catch(e){}r=null}}}},72455:(e,t,a)=>{Promise.resolve().then(a.bind(a,97190)),Promise.resolve().then(a.bind(a,44022)),Promise.resolve().then(a.t.bind(a,52295,23)),Promise.resolve().then(a.t.bind(a,41290,23))},97167:(e,t,a)=>{"use strict";a.d(t,{Nl:()=>n,Sr:()=>i,YE:()=>o,wx:()=>l});var s=a(95155),r=a(12115);function n(){return(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",children:(0,s.jsx)("circle",{cx:"5.5",cy:"5.5",r:"4",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"6 4",strokeLinecap:"round",children:(0,s.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 5.5 5.5",to:"360 5.5 5.5",dur:"0.75s",repeatCount:"indefinite"})})})}function i(){return(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",children:(0,s.jsx)("path",{d:"M2 5.5L4.5 8L9 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function l(){return(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",children:(0,s.jsx)("path",{d:"M2.5 2.5L8.5 8.5M8.5 2.5L2.5 8.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function o(e){let{startTime:t}=e,[a,n]=(0,r.useState)(0);return((0,r.useEffect)(()=>{n(Math.floor((Date.now()-t)/1e3));let e=setInterval(()=>n(e=>e+1),1e3);return()=>clearInterval(e)},[t]),a<60)?(0,s.jsxs)(s.Fragment,{children:[a,"s"]}):(0,s.jsxs)(s.Fragment,{children:[Math.floor(a/60),"m ",a%60,"s"]})}},97190:(e,t,a)=>{"use strict";a.d(t,{default:()=>N});var s=a(95155),r=a(12115),n=a(20063);let i=[{id:"set-anthropic-key",title:"Set Anthropic API key",category:"Credentials",keywords:["anthropic","api key","claude","apikey","llm","token","cloud engine"],kind:"secret",secretName:"ANTHROPIC_API_KEY",field:{label:"ANTHROPIC_API_KEY",type:"password",placeholder:"sk-ant-…",help:"Used by the Anthropic cloud engine. Stored encrypted in the secrets vault."},settingsHref:"/settings/tools",docSlug:"set-anthropic-key"},{id:"set-resend-key",title:"Set Resend API key (email)",category:"Credentials",keywords:["resend","email","api key","smtp","send mail"],kind:"secret",secretName:"RESEND_API_KEY",field:{label:"RESEND_API_KEY",type:"password",placeholder:"re_…",help:"Enables the email tool. Encrypted at rest."},settingsHref:"/settings/connectors",docSlug:"set-resend-key"},{id:"set-github-token",title:"Set GitHub token",category:"Credentials",keywords:["github","token","pat","api key","git","repo"],kind:"secret",secretName:"GITHUB_TOKEN",field:{label:"GITHUB_TOKEN",type:"password",placeholder:"ghp_… / github_pat_…",help:"Personal access token for the GitHub tool adapter."},settingsHref:"/settings/connectors",docSlug:"set-github-token"},{id:"set-supabase-url",title:"Set Supabase URL",category:"Credentials",keywords:["supabase","url","database","project url","connect"],kind:"secret",secretName:"SUPABASE_URL",field:{label:"SUPABASE_URL",type:"text",placeholder:"https://xxxx.supabase.co",help:"Project URL for Supabase writes + shared cloud layer."},settingsHref:"/settings/connectors",docSlug:"connect-supabase"},{id:"set-supabase-service-key",title:"Set Supabase service-role key",category:"Credentials",keywords:["supabase","service role","key","api key","secret","database"],kind:"secret",secretName:"SUPABASE_SERVICE_ROLE_KEY",field:{label:"SUPABASE_SERVICE_ROLE_KEY",type:"password",placeholder:"eyJ…",help:"Server-side service-role key. Never exposed to the browser."},settingsHref:"/settings/connectors",docSlug:"connect-supabase"},{id:"set-default-model",title:"Set default model",category:"Agent runtime",keywords:["model","default model","llm","opus","sonnet","haiku","picker"],kind:"config",configKey:"model",field:{label:"Default model",type:"select",help:"Model the main agent uses by default.",options:[{value:"claude-opus-4-7",label:"Opus 4.7"},{value:"claude-sonnet-4-6",label:"Sonnet 4.6"},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5"}]},settingsHref:"/settings/engines",docSlug:"choose-agent-engine"},{id:"set-design-style",title:"Set artifact design style",category:"Agent runtime",keywords:["design","style","aesthetic","minimal","bold","soft","balanced","artifact"],kind:"config",configKey:"designStyle",field:{label:"Design style",type:"select",help:"Visual style agents use when producing artifacts.",options:[{value:"balanced",label:"Balanced"},{value:"minimal",label:"Minimal"},{value:"bold",label:"Bold"},{value:"soft",label:"Soft"}]},settingsHref:"/settings/brand",docSlug:null},{id:"set-trust-mode",title:"Set main-agent trust mode",category:"Agent runtime",keywords:["trust","trust mode","auto","approval","safety","permission","gate"],kind:"trust-mode",field:{label:"Trust mode",type:"select",help:"Warning: auto lets the main agent run high-and-below risk tool calls WITHOUT asking you first (irreversible_external is always gated). Saving auto confirms this. approval_required is the safe default.",options:[{value:"approval_required",label:"Approval required (safe default)"},{value:"auto",label:"Auto (skip gate for ≤ high risk)"}]},settingsHref:"/settings/advanced",docSlug:"set-trust-mode"}],l=[{id:"start-whatsapp-bridge",slug:"start-whatsapp-bridge",title:"Start the WhatsApp bridge",summary:"Pair a dedicated WhatsApp number and run the gateway daemon so agents can send and receive messages.",category:"Channels",keywords:["whatsapp","bridge","gateway","baileys","pair","daemon","messages"],related:["secrets-vault-overview"]},{id:"set-api-key",slug:"set-api-key",title:"Set an API key",summary:"How API keys and secrets are stored, and the fastest way to add one from anywhere with Cmd+K.",category:"Credentials",keywords:["api key","secret","credential","token","vault","set key"],related:["set-anthropic-key","connect-supabase","secrets-vault-overview"]},{id:"set-anthropic-key",slug:"set-anthropic-key",title:"Set the Anthropic API key",summary:"Add the Anthropic key that powers the cloud engine.",category:"Credentials",keywords:["anthropic","api key","claude","cloud engine","llm"],related:["choose-agent-engine","set-api-key"]},{id:"set-resend-key",slug:"set-resend-key",title:"Set the Resend API key (email)",summary:"Enable the email tool by adding a Resend key.",category:"Credentials",keywords:["resend","email","api key","send mail"],related:["set-api-key"]},{id:"set-github-token",slug:"set-github-token",title:"Set a GitHub token",summary:"Add a personal access token to unlock the GitHub tool adapter.",category:"Credentials",keywords:["github","token","pat","repo","api key"],related:["set-api-key"]},{id:"connect-supabase",slug:"connect-supabase",title:"Connect Supabase",summary:"Wire up Supabase URL and keys for database writes and the shared cloud layer.",category:"Credentials",keywords:["supabase","database","connect","url","service role","shared cloud"],related:["set-api-key","secrets-vault-overview"]},{id:"choose-agent-engine",slug:"choose-agent-engine",title:"Choose an agent engine",summary:"Pick between claude-code, anthropic, ollama, codex, and hermes — and what each needs.",category:"Agent runtime",keywords:["engine","model","claude-code","ollama","codex","hermes","anthropic","local"],related:["set-anthropic-key"]},{id:"set-trust-mode",slug:"set-trust-mode",title:"Set trust mode",summary:"Control whether the main agent gates risky tool calls or runs them automatically.",category:"Agent runtime",keywords:["trust","trust mode","auto","approval","safety","risk","gate"],related:["create-agent"]},{id:"create-agent",slug:"create-agent",title:"Create an agent",summary:"Spin up a worker, set its schedule, scope its tools, and run it.",category:"Getting started",keywords:["agent","create","worker","new agent","caretaker","roster"],related:["schedules-and-cron","set-trust-mode"]},{id:"schedules-and-cron",slug:"schedules-and-cron",title:"Schedules and cron",summary:"How schedules queue durable heartbeat work, backfill missed windows, and run automatically.",category:"Getting started",keywords:["schedule","cron","daily","heartbeat","backfill","recurring"],related:["create-agent"]},{id:"secrets-vault-overview",slug:"secrets-vault-overview",title:"Secrets vault overview",summary:"Where credentials live, how they are encrypted, and why values are never shown back.",category:"Credentials",keywords:["secrets","vault","encryption","aes","master key","security"],related:["set-api-key"]},{id:"keyboard-shortcuts",slug:"keyboard-shortcuts",title:"Keyboard shortcuts",summary:"Every shortcut, including Cmd+K smart search and the composer keys.",category:"Getting started",keywords:["keyboard","shortcut","cmd k","command","hotkey","search"],related:[]}];function o(e){var t,a;let{action:i,current:l,onClose:o,onSaved:c}=e;(0,n.useRouter)();let d=(0,r.useRef)(null),u=i.field,[h,p]=(0,r.useState)("select"===u.type&&((null==l?void 0:l.value)||(null==(a=u.options)||null==(t=a[0])?void 0:t.value))||""),[m,g]=(0,r.useState)(!1),[f,v]=(0,r.useState)(""),[b,y]=(0,r.useState)(!1);async function k(e){if(e.preventDefault(),m)return;let t=String(h).trim();if(!t)return void v("Enter a value.");g(!0),v("");try{let{endpoint:e,method:s,body:r}=function(e,t){switch(e.kind){case"secret":return{endpoint:"/api/secrets",method:"POST",body:{name:e.secretName,value:t,scope:"global",source:"help-modal"}};case"config":return{endpoint:"/api/config",method:"PUT",body:{[e.configKey]:t}};case"trust-mode":return{endpoint:"/api/settings/trust-mode",method:"PATCH",body:"auto"===t?{mode:t,confirm:!0}:{mode:t}};default:throw Error("unknown action kind: ".concat(e.kind))}}(i,t),n=await fetch(e,{method:s,headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!n.ok){if(403===n.status)v("You need admin or owner access to change this.");else if(401===n.status)v("Sign in to change this setting.");else{let e=await n.text().catch(()=>""),t=e;try{var a;t=(null==(a=JSON.parse(e))?void 0:a.error)||e}catch(e){}v(t||"Failed (".concat(n.status,")."))}g(!1);return}y(!0),g(!1),null==c||c(i),window.setTimeout(()=>o(),700)}catch(e){v((null==e?void 0:e.message)||"Network error."),g(!1)}}(0,r.useEffect)(()=>{let e=window.setTimeout(()=>{var e;return null==(e=d.current)?void 0:e.focus()},0);return()=>window.clearTimeout(e)},[]),(0,r.useEffect)(()=>{function e(e){"Escape"===e.key&&(e.preventDefault(),o())}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o]);let x=function(e,t){if(!t)return null;if("secret"===e.kind)return"set"===t.status?"Currently set":"Not set";if(null!=t.value){var a;let s=null==(a=e.field.options)?void 0:a.find(e=>e.value===t.value);return"Currently: ".concat(s?s.label:t.value)}return null}(i,l);return(0,s.jsx)("div",{className:"help-value-overlay",role:"presentation",onMouseDown:e=>{e.target===e.currentTarget&&o()},children:(0,s.jsxs)("form",{className:"help-value-modal",role:"dialog","aria-modal":"true","aria-label":i.title,onSubmit:k,children:[(0,s.jsxs)("header",{className:"help-value-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("small",{children:i.category}),(0,s.jsx)("h2",{children:i.title})]}),(0,s.jsx)("button",{type:"button",className:"help-value-close",onClick:o,"aria-label":"Close",children:"esc"})]}),(0,s.jsxs)("div",{className:"help-value-body",children:[(0,s.jsxs)("label",{className:"help-value-field",children:[(0,s.jsxs)("span",{className:"help-value-label",children:[u.label,x?(0,s.jsx)("em",{className:"help-value-status",children:x}):null]}),"select"===u.type?(0,s.jsx)("select",{ref:d,value:h,onChange:e=>p(e.target.value),disabled:m||b,children:u.options.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,s.jsx)("input",{ref:d,type:"password"===u.type?"password":"text",value:h,placeholder:u.placeholder||"",onChange:e=>p(e.target.value),disabled:m||b,autoComplete:"off",spellCheck:!1})]}),u.help?(0,s.jsx)("p",{className:"help-value-help",children:u.help}):null,f?(0,s.jsx)("p",{className:"help-value-error",role:"alert",children:f}):null,b?(0,s.jsx)("p",{className:"help-value-ok",role:"status",children:"Saved."}):null]}),(0,s.jsxs)("footer",{className:"help-value-foot",children:[(0,s.jsxs)("div",{className:"help-value-links",children:[(0,s.jsx)("a",{href:i.settingsHref,onClick:o,children:"Open full settings"}),i.docSlug?(0,s.jsx)("a",{href:"/help/".concat(i.docSlug),onClick:o,children:"Read the guide"}):null]}),(0,s.jsxs)("div",{className:"help-value-actions",children:[(0,s.jsx)("button",{type:"button",className:"help-value-btn ghost",onClick:o,disabled:m,children:"Cancel"}),(0,s.jsx)("button",{type:"submit",className:"help-value-btn primary",disabled:m||b,children:m?"Saving…":"Save"})]})]})]})})}let c=[{title:"Overview",href:"/",section:"Navigate",keys:["dashboard","home","canvas","main"]},{title:"Agents",href:"/agents",section:"Navigate",keys:["agent","worker","roster","team"]},{title:"Tasks",href:"/tasks",section:"Navigate",keys:["task","work","todo","kanban"]},{title:"Approvals",href:"/approvals",section:"Navigate",keys:["approve","permission","review"]},{title:"Tools",href:"/tools",section:"Navigate",keys:["tool","connector","capability"]},{title:"Schedules",href:"/schedules",section:"Navigate",keys:["cron","schedule","calendar"]},{title:"Reports",href:"/reports",section:"Navigate",keys:["report","artifact","brief"]},{title:"Activity",href:"/activity",section:"Navigate",keys:["activity","runs","history"]},{title:"Runtime",href:"/runtime",section:"Navigate",keys:["runtime","diagnostics","heartbeat","process"]},{title:"Brand",href:"/brand",section:"Navigate",keys:["brand","identity","design"]},{title:"Settings",href:"/settings",section:"Navigate",keys:["settings","config","preferences"]},{title:"Help",href:"/help",section:"Navigate",keys:["help","guide","docs","documentation","shortcuts"]}],d=[{id:"focus-main-agent",title:"Focus main agent composer",detail:"Jump to the prompt box without leaving the keyboard.",section:"Action",shortcut:"⌘J",keys:["chat","composer","prompt","ask","agent"],run:e=>{let{router:t,pathname:a}=e;"/"!==a?(t.push("/"),window.setTimeout(()=>window.dispatchEvent(new Event("madarx:focus-composer")),180)):window.dispatchEvent(new Event("madarx:focus-composer"))}},{id:"new-chat",title:"New main-agent chat",detail:"Fresh conversation without using ⌘N, which belongs to the browser.",section:"Action",shortcut:"⌘⇧J",keys:["new","session","chat","fresh"],run:e=>{let{router:t,pathname:a}=e;"/"!==a&&t.push("/"),window.setTimeout(()=>window.dispatchEvent(new Event("madarx:new-chat")),180*("/"!==a))}},{id:"settings-modal",title:"Open agent configuration",detail:"Close to the right thumb, but avoids browser-level ⌘, preferences.",section:"Action",shortcut:"⌘;",keys:["settings","preferences","config","model"],run:e=>{let{router:t,pathname:a}=e;"/"!==a?(t.push("/"),window.setTimeout(()=>window.dispatchEvent(new Event("madarx:open-config")),180)):window.dispatchEvent(new Event("madarx:open-config"))}},{id:"shortcut-help",title:"Show keyboard shortcuts",detail:"Open this palette and filter to shortcut help.",section:"Action",shortcut:"⌘/",keys:["keyboard","shortcut","help","command"],run:e=>{let{openWithQuery:t}=e;return t("shortcuts")}}],u=[{title:"Open smart search",detail:"⌘Space or ⌘K. Thumb + home-row fallback; Ctrl Space also works when macOS owns Spotlight.",section:"Shortcuts",keys:["shortcut","search","spotlight","command space"]},{title:"Focus main agent",detail:"⌘J. Right thumb + index on home row; avoids browser shortcuts.",section:"Shortcuts",keys:["shortcut","composer","prompt"]},{title:"New chat",detail:"⌘⇧J. Same hand position as focus, with Shift; avoids ⌘N.",section:"Shortcuts",keys:["shortcut","new chat","session"]},{title:"Agents / Tasks / Runtime",detail:"⌘⇧A, ⌘⇧T, ⌘⇧D. Left-hand clusters for common operating surfaces.",section:"Shortcuts",keys:["shortcut","navigation","agents","tasks","runtime"]},{title:"Agent settings",detail:"⌘; sits under the right hand and avoids browser Preferences on ⌘,.",section:"Shortcuts",keys:["shortcut","settings","preferences"]}];function h(e){return String(e||"").toLowerCase().trim()}function p(){let e=(0,n.useRouter)(),t=(0,n.usePathname)(),a=(0,r.useRef)(null),[p,m]=(0,r.useState)(!1),[g,f]=(0,r.useState)(""),[v,b]=(0,r.useState)(0),[y,k]=(0,r.useState)({}),[x,w]=(0,r.useState)(!1),[j,N]=(0,r.useState)(null),S=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/help",{cache:"no-store"});if(!e.ok)return;let t=await e.json(),a={};for(let e of t.actions||[])a[e.id]=e.current;k(a),w(!0)}catch(e){}},[]),_=(0,r.useMemo)(()=>{let e=c.map(e=>({...e,id:"nav:".concat(e.href),kind:"nav",detail:"/"===e.href?"Return to the main command center.":"Open ".concat(e.href),run:t=>{let{router:a}=t;return a.push(e.href)}}));return[...d,...i.map(e=>{var t;return{id:"set:".concat(e.id),kind:"setting",action:e,title:e.title,detail:(null==(t=e.field)?void 0:t.help)||"Set this value.",section:"Set",keys:e.keywords}}),...l.map(e=>({id:"doc:".concat(e.slug),kind:"doc",title:e.title,detail:e.summary,section:"Doc",href:"/help/".concat(e.slug),keys:e.keywords})),...e,...u]},[]),E=(0,r.useMemo)(()=>{let e=h(g);if(!e)return _.slice(0,10);let t=e.split(/\s+/).filter(Boolean);return _.map(a=>{let s=[a.title,a.detail,a.section,a.href,...a.keys||[]].filter(Boolean).join(" ").toLowerCase(),r=t.reduce((e,t)=>e+ +!!s.includes(t),0),n=3*!!h(a.title).startsWith(e);return{item:a,score:r+n}}).filter(e=>{let{score:t}=e;return t>0}).sort((e,t)=>t.score-e.score||e.item.title.localeCompare(t.item.title)).map(e=>{let{item:t}=e;return t}).slice(0,12)},[_,g]),A=e=>{f(e||""),m(!0),b(0)},C=()=>{m(!1),f(""),b(0)},L=(0,r.useCallback)(e=>{let t=i.find(t=>t.id===e);t&&N(t)},[]),R=(0,r.useCallback)(()=>N(null),[]),P=a=>{if(a){if("setting"===a.kind){N(a.action),C();return}if("doc"===a.kind){e.push(a.href),C();return}a.run&&(a.run({router:e,pathname:t,openWithQuery:A}),"Shortcuts"!==a.section&&C())}};(0,r.useEffect)(()=>{(p||j)&&!x&&S()},[p,j,x,S]),(0,r.useEffect)(()=>{if(!p)return;let e=window.setTimeout(()=>{var e;return null==(e=a.current)?void 0:e.focus()},0);return()=>window.clearTimeout(e)},[p]),(0,r.useEffect)(()=>{b(0)},[g,p]),(0,r.useEffect)(()=>{function e(e){var t;let a=null==e||null==(t=e.detail)?void 0:t.id;a&&L(a)}return window.addEventListener("madarx:open-setting",e),()=>window.removeEventListener("madarx:open-setting",e)},[L]),(0,r.useEffect)(()=>{function e(e){var t;let a=null==e||null==(t=e.detail)?void 0:t.query;A("string"==typeof a?a:"")}return window.addEventListener("madarx:open-search",e),()=>window.removeEventListener("madarx:open-search",e)},[]),(0,r.useEffect)(()=>{function a(a){let s=(a.key||"").toLowerCase(),r=a.metaKey||a.ctrlKey,n=function(e){var t;let a=null==e||null==(t=e.tagName)?void 0:t.toLowerCase();return(null==e?void 0:e.isContentEditable)||"input"===a||"textarea"===a||"select"===a}(a.target);if(p){if("Escape"===a.key){a.preventDefault(),C();return}if("ArrowDown"===a.key){a.preventDefault(),b(e=>Math.min(e+1,Math.max(0,E.length-1)));return}if("ArrowUp"===a.key){a.preventDefault(),b(e=>Math.max(0,e-1));return}if("Enter"===a.key){a.preventDefault(),P(E[v]);return}}if(a.metaKey&&"Space"===a.code||a.metaKey&&"k"===s||a.ctrlKey&&"Space"===a.code){a.preventDefault(),m(e=>(e||N(null),!e));return}if(r&&!n){if(a.metaKey&&"j"===s&&!a.shiftKey){a.preventDefault(),d[0].run({router:e,pathname:t});return}if(a.metaKey&&"j"===s&&a.shiftKey){a.preventDefault(),d[1].run({router:e,pathname:t});return}if(a.metaKey&&";"===s){a.preventDefault(),d[2].run({router:e,pathname:t});return}if(a.metaKey&&"/"===s){a.preventDefault(),A("shortcuts");return}a.metaKey&&a.shiftKey&&["a","t","d"].includes(s)&&(a.preventDefault(),e.push("a"===s?"/agents":"t"===s?"/tasks":"/runtime"))}}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[v,p,t,E,e]);let T=j?(0,s.jsx)(o,{action:j,current:y[j.id],onClose:R,onSaved:S}):null;return p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"smart-search-overlay",role:"presentation",onMouseDown:e=>{e.target===e.currentTarget&&C()},children:(0,s.jsxs)("section",{className:"smart-search-panel",role:"dialog","aria-modal":"true","aria-label":"Smart search",children:[(0,s.jsxs)("div",{className:"smart-search-head",children:[(0,s.jsx)("span",{className:"smart-search-orb","aria-hidden":"true"}),(0,s.jsx)("input",{ref:a,value:g,onChange:e=>f(e.target.value),placeholder:"Search docs, settings, pages…","aria-label":"Search madarX OS"}),(0,s.jsx)("kbd",{children:"esc"})]}),(0,s.jsx)("div",{className:"smart-search-results",role:"listbox","aria-label":"Smart search results",children:E.length?E.map((e,t)=>{let a="setting"===e.kind?y[e.action.id]:null,r=a&&"secret"===e.action.kind&&"set"===a.status?"Set":null;return(0,s.jsxs)("button",{type:"button",className:"smart-search-row"+(t===v?" is-active":""),onMouseEnter:()=>b(t),onClick:()=>P(e),role:"option","aria-selected":t===v,children:[(0,s.jsxs)("span",{className:"smart-search-row-main",children:[(0,s.jsxs)("small",{children:[(0,s.jsx)("span",{className:"smart-search-kind kind-".concat(e.kind||"nav"),children:e.section}),r?(0,s.jsx)("span",{className:"smart-search-pill",children:r}):null]}),(0,s.jsx)("b",{children:e.title}),(0,s.jsx)("em",{children:e.detail})]}),e.shortcut?(0,s.jsx)("kbd",{children:e.shortcut}):e.href?(0,s.jsx)("kbd",{children:e.href}):null]},e.id||e.title)}):(0,s.jsx)("div",{className:"smart-search-empty",children:"No matches. Try “api key”, “whatsapp”, “agent”, or “shortcut”."})}),(0,s.jsxs)("footer",{className:"smart-search-foot",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("kbd",{children:"↑"}),(0,s.jsx)("kbd",{children:"↓"})," select"]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("kbd",{children:"return"})," open"]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("kbd",{children:"⌘J"})," composer"]})]})]})}),T]}):T}var m=a(47650),g=a(4441),f=a(37230),v=a(92263),b=a(69088),y=a(97167),k=a(59077);let x=[["/agents","Agents"],["/tasks","Tasks"],["/approvals","Approvals"],["/marketplace","Marketplace"],["/tools","Tools"],["/schedules","Schedules"],["/reports","Reports"],["/activity","Activity"],["/runtime","Runtime"],["/workflows","Workflows"],["/brand","Brand"],["/team","Team"],["/whatsapp","WhatsApp"],["/settings","Settings"],["/help","Help"]];function w(){let e=(0,n.usePathname)(),t=(0,r.useMemo)(()=>(function(e){if(!e||"/"===e)return"Overview";let t=x.find(t=>{let[a]=t;return e===a||e.startsWith("".concat(a,"/"))});return t?t[1]:"madarX"})(e),[e]),[a,i]=(0,r.useState)({}),[l,o]=(0,r.useState)(!1),c=(0,r.useRef)(null);(0,r.useEffect)(()=>(0,b.N)(e=>{i(t=>(function(e,t){var a,s,r,n;let i=t.agent_id;if(!i)return e;let l=e[i];switch(t.type){case"agent_run_start":return{...e,[i]:{agent_id:i,agent_name:t.agent_name||i,triggered_by:t.triggered_by||null,status:"running",started_at:t.ts||Date.now(),current_tool:null,current_input:null,last_activity:t.ts||Date.now(),steps:null!=(s=null==l||null==(a=l.steps)?void 0:a.slice(-4))?s:[]}};case"agent_tool_start":{let a=l||{agent_id:i,agent_name:t.agent_name||i,triggered_by:null,status:"running",started_at:Date.now(),steps:[]},s=t.ts||Date.now();return{...e,[i]:{...a,agent_name:t.agent_name||a.agent_name,status:"running",current_tool:t.tool,current_input:null!=(r=t.input_summary)?r:null,last_activity:s,steps:[...a.steps,{tool:t.tool,input:null!=(n=t.input_summary)?n:null,status:"running",ts:s}].slice(-8)}}}case"agent_tool_result":{if(!l)return e;let a=[...l.steps];for(let e=a.length-1;e>=0;e--)if(a[e].tool===t.tool&&"running"===a[e].status){a[e]={...a[e],status:t.isError?"error":"done"};break}return{...e,[i]:{...l,current_tool:null,last_activity:t.ts||Date.now(),steps:a}}}case"agent_run_complete":if(!l)return e;return{...e,[i]:{...l,status:t.isError?"failed":"complete",finished_at:t.ts||Date.now(),current_tool:null}};default:return e}})(t,e))}),[]),(0,r.useEffect)(()=>{let e=setInterval(()=>{let e=Date.now();i(t=>{let a=!1,s={};for(let[r,n]of Object.entries(t)){if("running"!==n.status){if(n.finished_at&&e-n.finished_at>6e3){a=!0;continue}}else if((n.last_activity||n.started_at||0)<e-12e4){a=!0;continue}s[r]=n}return a?s:t})},4e3);return()=>clearInterval(e)},[]);let d=(0,r.useRef)(null),[u,h]=(0,r.useState)(null);(0,r.useLayoutEffect)(()=>{if(l)return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)};function e(){let e=c.current;if(!e)return;let t=e.getBoundingClientRect();h({top:Math.round(t.bottom+8),right:Math.round(window.innerWidth-t.right)})}},[l]),(0,r.useEffect)(()=>{o(!1)},[e]),(0,r.useEffect)(()=>{if(l)return document.addEventListener("keydown",e),document.addEventListener("mousedown",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)};function e(e){"Escape"===e.key&&o(!1)}function t(e){let t=c.current&&c.current.contains(e.target),a=d.current&&d.current.contains(e.target);t||a||o(!1)}},[l]);let p=(0,r.useMemo)(()=>Object.values(a).sort((e,t)=>(t.started_at||0)-(e.started_at||0)),[a]),w=p.filter(e=>"running"===e.status),j=w.length,N="Activity";if(1===j){let e=w[0];N=e.current_tool?"".concat(e.agent_name," \xb7 ").concat((0,k.U_)(e.current_tool)):e.agent_name}else j>1&&(N="".concat(j," agents running"));return(0,s.jsxs)("header",{className:"app-topbar",role:"banner",children:[(0,s.jsxs)("div",{className:"app-topbar-left",children:[(0,s.jsxs)("span",{className:"app-topbar-brand",children:["madar",(0,s.jsx)("b",{children:"X"})]}),(0,s.jsx)("span",{className:"app-topbar-sep","aria-hidden":!0}),(0,s.jsx)("span",{className:"app-topbar-section",children:t})]}),(0,s.jsxs)("div",{className:"app-topbar-right",children:[(0,s.jsx)("div",{id:"app-topbar-slot",className:"app-topbar-slot"}),(0,s.jsxs)("div",{className:"app-topbar-activity-wrap",ref:c,children:[(0,s.jsxs)("button",{type:"button",className:"app-topbar-activity is-clickable ".concat(j?"is-running":""),title:j?"".concat(j," agent").concat(1===j?"":"s"," running — click for details"):"Background agent activity",onClick:()=>o(e=>!e),"aria-expanded":l,"aria-haspopup":"dialog",children:[(0,s.jsx)(g.A,{size:12,className:"app-topbar-activity-glyph","aria-hidden":!0}),(0,s.jsx)("span",{className:"app-topbar-dot","aria-hidden":!0}),(0,s.jsx)("span",{className:"app-topbar-activity-label",children:N})]}),l&&"undefined"!=typeof document&&(0,m.createPortal)((0,s.jsxs)("div",{className:"bg-activity-pop",role:"dialog","aria-label":"Background agent activity",ref:d,style:u?{top:u.top,right:u.right}:{visibility:"hidden"},children:[(0,s.jsxs)("div",{className:"bg-activity-head",children:[(0,s.jsx)("b",{children:"Background agents"}),(0,s.jsx)("small",{children:j?"".concat(j," working now"):p.length?"Recently finished":"Live view of agents the Main Agent spawns"})]}),0===p.length&&(0,s.jsxs)("div",{className:"bg-activity-empty",children:[(0,s.jsx)(g.A,{size:18,"aria-hidden":!0}),(0,s.jsx)("span",{children:"No background agents active right now."}),(0,s.jsx)("small",{children:"When the Main Agent calls a sub-agent, it shows here live."})]}),(0,s.jsx)("div",{className:"bg-activity-list",children:p.map(e=>(0,s.jsxs)("div",{className:"bg-activity-agent bg-activity-agent--".concat(e.status),children:[(0,s.jsxs)("div",{className:"bg-activity-agent-head",children:[(0,s.jsxs)("span",{className:"bg-activity-agent-icon","aria-hidden":!0,children:["running"===e.status&&(0,s.jsx)(y.Nl,{}),"complete"===e.status&&(0,s.jsx)(y.Sr,{}),"failed"===e.status&&(0,s.jsx)(y.wx,{})]}),(0,s.jsx)("span",{className:"bg-activity-agent-name",children:e.agent_name}),e.triggered_by&&(0,s.jsxs)("span",{className:"bg-activity-agent-by",children:["via ",e.triggered_by]}),(0,s.jsx)("span",{className:"bg-activity-agent-status",children:"running"===e.status?e.current_tool?(0,k.U_)(e.current_tool):"working…":"complete"===e.status?"done":"failed"})]}),e.steps.length>0&&(0,s.jsx)("div",{className:"bg-activity-steps",children:e.steps.slice(-5).map((e,t)=>(0,s.jsxs)("div",{className:"bg-activity-step bg-activity-step--".concat(e.status),children:[(0,s.jsxs)("span",{className:"bg-activity-step-icon","aria-hidden":!0,children:["running"===e.status&&(0,s.jsx)(y.Nl,{}),"done"===e.status&&(0,s.jsx)(y.Sr,{}),"error"===e.status&&(0,s.jsx)(y.wx,{})]}),(0,s.jsx)("code",{className:"bg-activity-step-name",children:(0,k.U_)(e.tool)}),(0,k.bX)(e.tool,e.input)&&(0,s.jsx)("span",{className:"bg-activity-step-sub",children:(0,k.bX)(e.tool,e.input)})]},t))})]},e.agent_id))}),(0,s.jsx)("a",{className:"bg-activity-foot",href:"/activity",children:"Open activity log →"})]}),document.body)]}),(0,s.jsxs)("button",{type:"button",className:"app-topbar-search",onClick:function(){window.dispatchEvent(new CustomEvent("madarx:open-search"))},"aria-label":"Open search (Command K)",children:[(0,s.jsx)(f.A,{size:13,"aria-hidden":!0}),(0,s.jsx)("span",{children:"Search"}),(0,s.jsxs)("kbd",{children:[(0,s.jsx)(v.A,{size:10,"aria-hidden":!0}),"K"]})]})]})]})}let j=["/login","/share"];function N(e){let{children:t,sidebar:a}=e,i=(0,n.usePathname)();return(0,r.useMemo)(()=>j.some(e=>i===e||(null==i?void 0:i.startsWith("".concat(e,"/")))),[i])?(0,s.jsx)("div",{className:"chromeless-page",children:t}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"app-shell",children:[(0,s.jsx)(w,{}),(0,s.jsx)("div",{className:"app-rail",children:null!=a?a:null}),(0,s.jsx)("div",{className:"app-content",children:t})]}),(0,s.jsx)(p,{})]})}}},e=>{e.O(0,[3045,1741,2619,494,8441,1255,7358],()=>e(e.s=72455)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{30407:(e,n,t)=>{Promise.resolve().then(t.bind(t,57622))},57622:(e,n,t)=>{"use strict";t.d(n,{default:()=>d});var s=t(95155),i=t(12115),a=t(95704);function o(){return(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M5 12h14M12 5l7 7-7 7"})})}function l(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),(0,s.jsx)("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),(0,s.jsx)("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),(0,s.jsx)("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}function r(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,s.jsx)("rect",{x:"1",y:"1",width:"10",height:"10",fill:"#f25022"}),(0,s.jsx)("rect",{x:"13",y:"1",width:"10",height:"10",fill:"#7fba00"}),(0,s.jsx)("rect",{x:"1",y:"13",width:"10",height:"10",fill:"#00a4ef"}),(0,s.jsx)("rect",{x:"13",y:"13",width:"10",height:"10",fill:"#ffb900"})]})}let c={width:"100%",padding:"13px 14px",borderRadius:14,border:"1px solid rgba(232,232,229,.18)",background:"rgba(255,255,255,.06)",color:"#E8E8E5",outline:"none",fontSize:14};function d(e){let{authMode:n,nextPath:d="/",errorCode:h="",forceSupabase:u=!1,initialView:g=""}=e,p="local"===n,m="string"==typeof d&&d.startsWith("/")?d:"/",[x,j]=(0,i.useState)("personal"===g||"team"===g?g:p&&!u?"personal":"team"),[y,b]=(0,i.useState)("password"),[f,v]=(0,i.useState)(""),[k,w]=(0,i.useState)(""),[N,S]=(0,i.useState)(!1),[C,E]=(0,i.useState)(h?"Supabase could not complete sign-in. Try again.":""),[O,A]=(0,i.useState)(null),[T,_]=(0,i.useState)(!1),[L,K]=(0,i.useState)(!1),[P,B]=(0,i.useState)(""),[I,W]=(0,i.useState)(""),[U,M]=(0,i.useState)({url:"",anonKey:"",serviceKey:""}),[R,F]=(0,i.useState)("");(0,i.useEffect)(()=>{let e=!0;return fetch("/api/auth/config",{cache:"no-store"}).then(e=>e.json()).then(n=>{e&&A(n)}).catch(()=>{e&&A({authMode:n,supabaseConfigured:!1})}),()=>{e=!1}},[n]);let z=O?!!(O.supabaseUrl&&O.supabaseAnonKey):!p,X=(null==O?void 0:O.authMode)||n,D=!!(O&&"supabase"===X&&!z);async function q(){if(!P.trim())return void E("Enter the recovery token to switch.");_(!0),E("");try{let e=await fetch("/api/auth/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"save",mode:"local",recoveryToken:P.trim()})}),n=await e.json().catch(()=>({}));if(e.ok&&n.ok)return void window.location.assign("/");_(!1),E(403===e.status?"Invalid recovery token.":"Could not switch to personal mode.")}catch(e){_(!1),E("Could not switch to personal mode.")}}async function H(e){e.preventDefault(),F("save"),E("");try{let e=await fetch("/api/auth/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"save",mode:"supabase",url:U.url.trim(),anonKey:U.anonKey.trim(),serviceKey:U.serviceKey.trim()})}),n=await e.json().catch(()=>({}));if(!e.ok||!n.ok)throw Error("connection_failed"===n.error?"Could not connect to that Supabase project. Check the URL and keys.":n.error||"Could not save team settings.");A(e=>({...e||{},authMode:"supabase",supabaseConfigured:!0,supabaseUrl:U.url.trim(),supabaseAnonKey:U.anonKey.trim()})),E("Team created. Sign in to finish — your first sign-in makes you the owner.")}catch(e){E((null==e?void 0:e.message)||"Could not create the team.")}finally{F("")}}async function J(){F("test"),E("");try{let e=await fetch("/api/auth/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"test",url:U.url.trim(),anonKey:U.anonKey.trim()})}),n=await e.json().catch(()=>({}));E(n.ok?"Connection OK. Create the team to continue.":"Connection failed. Check the URL and anon key.")}catch(e){E("Connection test failed.")}finally{F("")}}async function G(){let{createBrowserClient:e}=await Promise.all([t.e(5730),t.e(840)]).then(t.bind(t,9230)),n=null==O?void 0:O.supabaseUrl,s=null==O?void 0:O.supabaseAnonKey;if(!n||!s)try{let e=await fetch("/api/auth/config",{cache:"no-store"}).then(e=>e.json());A(e),n=null==e?void 0:e.supabaseUrl,s=null==e?void 0:e.supabaseAnonKey}catch(e){}if(!n||!s)throw Error("Supabase is not configured. Create a team or set it in Settings → Account.");return e(n,s)}async function Y(e){e.preventDefault(),S(!0),E("");try{let e=await G(),n="".concat(window.location.origin,"/api/auth/callback?next=").concat(encodeURIComponent(m)),t="magic"===y?await e.auth.signInWithOtp({email:f,options:{emailRedirectTo:n}}):await e.auth.signInWithPassword({email:f,password:k});if(t.error)throw t.error;"magic"===y?E("Secure sign-in link sent to ".concat(f,".")):window.location.assign(m)}catch(e){E((null==e?void 0:e.message)||"Sign-in failed.")}finally{S(!1)}}async function V(e){S(!0),E("");try{let n=await G(),{error:t}=await n.auth.signInWithOAuth({provider:e,options:{redirectTo:"".concat(window.location.origin,"/api/auth/callback?next=").concat(encodeURIComponent(m))}});if(t)throw t}catch(e){E((null==e?void 0:e.message)||"SSO failed."),S(!1)}}return(0,s.jsxs)("main",{className:"login-page-shell",children:[(0,s.jsxs)("section",{className:"login-hero-panel","aria-label":"madarX OS landing",children:[(0,s.jsx)("div",{className:"login-orbit","aria-hidden":"true",children:(0,s.jsxs)("svg",{viewBox:"0 0 700 700",width:"700",height:"700",children:[(0,s.jsxs)("g",{className:"login-orbit-spin",children:[(0,s.jsx)("circle",{cx:"350",cy:"350",r:"320",stroke:"#E8E8E5",strokeWidth:"1",fill:"none",opacity:".10"}),(0,s.jsx)("circle",{cx:"350",cy:"350",r:"240",stroke:"#E8E8E5",strokeWidth:"1",fill:"none",opacity:".08"})]}),(0,s.jsxs)("g",{className:"login-orbit-spin login-orbit-spin--rev",children:[(0,s.jsx)("circle",{cx:"350",cy:"350",r:"160",stroke:"#C2452A",strokeWidth:"1.2",fill:"none",opacity:".30"}),(0,s.jsx)("circle",{cx:"350",cy:"350",r:"80",stroke:"#E8E8E5",strokeWidth:".8",fill:"none",opacity:".06"})]}),(0,s.jsx)("g",{className:"login-orbit-bead",children:(0,s.jsx)("circle",{cx:"350",cy:"190",r:"3.5",fill:"#C2452A"})}),(0,s.jsx)("g",{className:"login-orbit-bead login-orbit-bead--outer",children:(0,s.jsx)("circle",{cx:"350",cy:"30",r:"2.5",fill:"#E8E8E5",opacity:".5"})})]})}),(0,s.jsxs)("div",{className:"login-brand-lockup",children:[(0,s.jsxs)("svg",{className:"login-mark",width:"40",height:"40",viewBox:"0 0 100 100","aria-hidden":"true",children:[(0,s.jsx)("path",{className:"lm-arc",d:"M 85.32 31.22 A 40 40 0 1 1 78.78 22.20",stroke:"#E8E8E5",strokeWidth:"2.4",fill:"none",strokeLinecap:"round"}),(0,s.jsx)("line",{className:"lm-x1",x1:"21.72",y1:"21.72",x2:"78.28",y2:"78.28",stroke:"#E8E8E5",strokeWidth:"2.4",strokeLinecap:"round"}),(0,s.jsx)("line",{className:"lm-x2",x1:"21.72",y1:"78.28",x2:"78.28",y2:"21.72",stroke:"#E8E8E5",strokeWidth:"2.4",strokeLinecap:"round"}),(0,s.jsx)("circle",{className:"lm-bead",cx:"82.36",cy:"26.49",r:"3",fill:"#C2452A"})]}),(0,s.jsxs)("div",{className:"login-wordmark",children:["madar",(0,s.jsx)("span",{children:"X"})," OS"]})]}),(0,s.jsx)("p",{className:"login-kicker",children:"Core operating layer"}),(0,s.jsx)("h1",{children:"AI does the work. You hold the controls."}),(0,s.jsx)("p",{className:"login-lede",children:"madarX OS is the operating layer for AI-run operations. Agents draft, plan, and execute — every consequential action waits for a human, and nothing happens off the record."}),(0,s.jsxs)("div",{className:"login-proof-grid",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("b",{children:"Human in the loop"}),(0,s.jsx)("span",{children:"Agents propose. People approve. The HAIL methodology, built in."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("b",{children:"One operating logic"}),(0,s.jsx)("span",{children:"Workflows, governance, and orchestration in a single layer."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("b",{children:"Every action logged"}),(0,s.jsx)("span",{children:"Nothing is inferred. Creation, access, and approval are recorded."})]})]})]}),(0,s.jsxs)("section",{className:"login-card","aria-label":"Sign in",children:[(0,s.jsxs)("div",{className:"login-seg",role:"tablist","aria-label":"Account type",children:[(0,s.jsx)("button",{type:"button",role:"tab","aria-selected":"personal"===x,className:"personal"===x?"active":"",onClick:()=>j("personal"),children:"Personal"}),(0,s.jsx)("button",{type:"button",role:"tab","aria-selected":"team"===x,className:"team"===x?"active":"",onClick:()=>j("team"),children:"Team"})]}),"personal"===x?p&&!z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"login-card-head",children:[(0,s.jsx)("p",{children:"This device"}),(0,s.jsx)("h2",{children:"Personal mode"})]}),(0,s.jsx)("p",{className:"login-footnote",style:{marginTop:0},children:"You're the local owner — no account needed. Work stays on this machine and sharing uses the local signed-link registry."}),C?(0,s.jsx)("div",{className:"login-message",children:C}):null,(0,s.jsxs)("a",{className:"login-link-button",href:m,style:{margin:"20px 0 0"},children:["Enter dashboard ",(0,s.jsx)(o,{})]}),(0,s.jsxs)("button",{type:"button",className:"login-link-button login-link-button--ghost",style:{margin:"12px 0 0",cursor:"pointer"},onClick:()=>{E(""),j("team")},children:["Create or join a team ",(0,s.jsx)(o,{})]}),(0,s.jsx)("p",{className:"login-footnote",style:{textAlign:"center"},children:"Collaborate with others through a shared Supabase organization."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"login-card-head",children:[(0,s.jsx)("p",{children:"This device"}),(0,s.jsx)("h2",{children:"Use it personally"})]}),(0,s.jsxs)("div",{className:"login-message login-message--warn",children:["This server runs in ",(0,s.jsx)("b",{children:"team mode"}),". Switching to personal (local) mode turns off organization sign-in for everyone on this server, so it needs the on-disk recovery token."]}),C?(0,s.jsx)("div",{className:"login-message",children:C}):null,L?(0,s.jsxs)("div",{className:"login-form",children:[(0,s.jsxs)("label",{children:["Recovery token",(0,s.jsx)("input",{style:c,type:"text",value:P,onChange:e=>B(e.target.value),placeholder:"paste recovery token",autoComplete:"off"})]}),(0,s.jsxs)("span",{className:"login-footnote",style:{marginTop:0},children:["Found in ",(0,s.jsx)("code",{children:"data/.auth-recovery-token"})," on the server machine."]}),(0,s.jsx)("button",{type:"button",className:"login-btn",disabled:T,onClick:q,children:T?"Switching…":"Switch to personal mode"})]}):(0,s.jsxs)("button",{type:"button",className:"login-link-button login-link-button--ghost",style:{cursor:"pointer"},onClick:()=>K(!0),children:["Switch to personal mode ",(0,s.jsx)(o,{})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"login-card-head",children:[(0,s.jsx)("p",{children:"Secure access"}),(0,s.jsx)("h2",{children:z?"Sign in to your team":"Set up your team"})]}),D?(0,s.jsxs)("div",{className:"login-message login-message--warn",children:["Team mode is on, but Supabase isn’t configured on this server yet. Enter your project details below to finish setup — or switch to ",(0,s.jsx)("b",{children:"Personal"})," to use this device locally."]}):null,C?(0,s.jsx)("div",{className:"login-message",children:C}):null,z?(0,s.jsxs)(s.Fragment,{children:[p?(0,s.jsxs)("div",{className:"login-message login-message--warn",children:["Server is in ",(0,s.jsx)("b",{children:"local mode"}),". You can sign in to test, but sessions persist only after switching to team mode in ",(0,s.jsx)("a",{href:"/settings/account",children:"Settings → Account"}),"."]}):null,(0,s.jsxs)("div",{className:"login-mode-toggle",role:"tablist","aria-label":"Sign-in method",children:[(0,s.jsx)("button",{type:"button",className:"password"===y?"active":"",onClick:()=>b("password"),children:"Password"}),(0,s.jsx)("button",{type:"button",className:"magic"===y?"active":"",onClick:()=>b("magic"),children:"Magic link"})]}),(0,s.jsxs)("form",{onSubmit:Y,className:"login-form",children:[(0,s.jsxs)("label",{children:["Email",(0,s.jsx)("input",{style:c,type:"email",value:f,onChange:e=>v(e.target.value),placeholder:"you@company.com",autoComplete:"email",required:!0})]}),"password"===y?(0,s.jsxs)("label",{children:["Password",(0,s.jsx)("input",{style:c,type:"password",value:k,onChange:e=>w(e.target.value),placeholder:"Password",autoComplete:"current-password",required:!0})]}):null,(0,s.jsxs)("button",{type:"submit",className:"login-btn",disabled:N,children:[N?"Working...":"password"===y?"Sign in":"Send magic link"," ",N?null:(0,s.jsx)(o,{})]})]}),"true"===a.env.NEXT_PUBLIC_GOOGLE_SSO_ENABLED||"true"===a.env.NEXT_PUBLIC_MICROSOFT_SSO_ENABLED?(0,s.jsxs)("div",{className:"login-sso",children:[(0,s.jsx)("span",{children:"or continue with"}),"true"===a.env.NEXT_PUBLIC_GOOGLE_SSO_ENABLED?(0,s.jsxs)("button",{type:"button",onClick:()=>V("google"),className:"login-btn login-btn--ghost",children:[(0,s.jsx)(l,{})," Google"]}):null,"true"===a.env.NEXT_PUBLIC_MICROSOFT_SSO_ENABLED?(0,s.jsxs)("button",{type:"button",onClick:()=>V("azure"),className:"login-btn login-btn--ghost",children:[(0,s.jsx)(r,{})," Microsoft"]}):null]}):null]}):(0,s.jsxs)("form",{className:"login-form login-create-team",onSubmit:H,children:[(0,s.jsx)("p",{className:"login-footnote",style:{marginTop:0},children:"Connect a Supabase project to host your team. Your first sign-in becomes the owner. Keys are stored encrypted on this server, never in the browser."}),(0,s.jsxs)("label",{children:["Supabase URL",(0,s.jsx)("input",{style:c,type:"url",value:U.url,onChange:e=>M(n=>({...n,url:e.target.value})),placeholder:"https://xxxx.supabase.co",autoComplete:"off",required:!0})]}),(0,s.jsxs)("label",{children:["Anon key",(0,s.jsx)("input",{style:c,type:"text",value:U.anonKey,onChange:e=>M(n=>({...n,anonKey:e.target.value})),placeholder:"eyJ…",autoComplete:"off",required:!0})]}),(0,s.jsxs)("label",{children:["Service-role key",(0,s.jsx)("input",{style:c,type:"password",value:U.serviceKey,onChange:e=>M(n=>({...n,serviceKey:e.target.value})),placeholder:"eyJ… (kept server-side)",autoComplete:"off",required:!0})]}),(0,s.jsxs)("div",{className:"login-create-actions",children:[(0,s.jsx)("button",{type:"button",className:"login-btn login-btn--ghost login-btn--inline",disabled:!!R,onClick:J,children:"test"===R?"Testing…":"Test"}),(0,s.jsxs)("button",{type:"submit",className:"login-btn",disabled:!!R,children:["save"===R?"Creating…":"Create team"," ",R?null:(0,s.jsx)(o,{})]})]})]}),(0,s.jsxs)("div",{className:"login-join",children:[(0,s.jsx)("span",{className:"login-join-label",children:"Have an invite link?"}),(0,s.jsxs)("form",{className:"login-join-row",onSubmit:function(e){e.preventDefault();let n=I.trim();if(!n)return void E("Paste your invite link first.");let t="#invite=",s=n.indexOf(t),i=s>=0?n.slice(s+t.length):n;if(!(i=i.split(/[?&\s]/)[0]))return void E("That invite link looks incomplete.");window.location.href="/join#invite=".concat(i)},children:[(0,s.jsx)("input",{style:c,type:"text",value:I,onChange:e=>W(e.target.value),placeholder:"paste invite link",autoComplete:"off"}),(0,s.jsx)("button",{type:"submit",className:"login-btn login-btn--ghost login-btn--inline",children:"Join"})]})]}),z?(0,s.jsx)("p",{className:"login-footnote",children:"Supabase stores identity. madarX OS stores local runtime state, artifact ACLs, and share-link audit events."}):null]})]})]})}}},e=>{e.O(0,[8441,1255,7358],()=>e(e.s=30407)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5094],{20063:(e,n,t)=>{"use strict";var l=t(47260);t.o(l,"usePathname")&&t.d(n,{usePathname:function(){return l.usePathname}}),t.o(l,"useRouter")&&t.d(n,{useRouter:function(){return l.useRouter}}),t.o(l,"useSearchParams")&&t.d(n,{useSearchParams:function(){return l.useSearchParams}})},60874:(e,n,t)=>{"use strict";t.d(n,{default:()=>W});var l=t(95155),s=t(12115),a=t(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"}],o={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 c(e){let{activeKind:n,onKindChange:t,counts:s,categories:a,categoryCounts:c={},scopeCount:r,activeCategory:d,onCategoryChange:u}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.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,l.jsxs)("button",{type:"button",role:"tab","aria-selected":i,className:"mkt-tab ".concat(i?"on":""),onClick:()=>t(e.id),children:[e.label,(0,l.jsx)("span",{className:"mkt-tab-count",children:a})]},e.id)})}),a.length?(0,l.jsxs)("div",{className:"mkt-filters",role:"toolbar","aria-label":"Category filters",children:[(0,l.jsxs)("button",{type:"button",className:"mkt-chip ".concat(d?"":"on"),onClick:()=>u(null),children:["All categories","number"==typeof r?(0,l.jsx)("span",{className:"mkt-chip-count",children:r}):null]}),a.map(e=>(0,l.jsxs)("button",{type:"button",className:"mkt-chip ".concat(d===e?"on":""),onClick:()=>u(d===e?null:e),children:[function(e){if(o[e])return o[e];let n=String(e).replaceAll("_"," ");return n.charAt(0).toUpperCase()+n.slice(1)}(e),c[e]?(0,l.jsx)("span",{className:"mkt-chip-count",children:c[e]}):null]},e))]}):null]})}function r(e){let{value:n,onChange:t}=e,a=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){var n,l,s;(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()?(e.preventDefault(),null==(n=a.current)||n.focus(),null==(l=a.current)||l.select()):"Escape"===e.key&&document.activeElement===a.current&&(t(""),null==(s=a.current)||s.blur())}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let i="undefined"!=typeof navigator&&/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent||"")?"⌘":"Ctrl";return(0,l.jsxs)("div",{className:"mkt-search",role:"search",children:[(0,l.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,l.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,l.jsx)("path",{d:"M21 21l-4.3-4.3"})]}),(0,l.jsx)("input",{ref:a,type:"search",className:"mkt-search-input",placeholder:"Search tools, skills, bundles, authors…",value:n,onChange:e=>t(e.target.value),"aria-label":"Search marketplace"}),(0,l.jsxs)("span",{className:"mkt-search-kbd","aria-hidden":"true",children:[(0,l.jsx)("kbd",{children:i}),(0,l.jsx)("kbd",{children:"K"})]})]})}var d=t(44304);function u(e){let{kind:n,category:t,size:s=18}=e,a="mkt-chip-tile kind-".concat(n);return"tool"===n?(0,l.jsx)("span",{className:a,"aria-hidden":"true",children:(0,l.jsx)(d.si,{category:t,size:s})}):(0,l.jsx)("span",{className:a,"aria-hidden":"true",children:(0,l.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,t=h[n]||n;return(0,l.jsx)("span",{className:"mkt-kind-badge kind-".concat(n),children:t})}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 t="irreversible_external"===n?"irreversible":"local"===n?"low":n||"low",s=m[n]||n;return(0,l.jsxs)("span",{className:"mkt-risk",children:[(0,l.jsx)("span",{className:"mkt-risk-dot ".concat(t),"aria-hidden":"true"}),s]})}function g(e){let{action:n,onToggle:t,itemId:a,installed:i,available:o=!0,disabled:c=!1,label:r,slugHint:d,currentKind:u}=e,[h,p]=(0,s.useState)(!1),m=c||!o||h,j=r||"".concat(i?"Uninstall":"Install"," ").concat(a);return"function"==typeof t?(0,l.jsx)("button",{className:"mkt-toggle ".concat(i?"on":""),type:"button",role:"switch","aria-checked":i,"aria-label":j,"aria-busy":h||void 0,disabled:m,onClick:async()=>{if(!m){p(!0);try{await t(!i)}finally{p(!1)}}}}):(0,l.jsxs)("form",{action:n,className:"mkt-toggle-form",children:[(0,l.jsx)("input",{type:"hidden",name:"item_id",value:a}),(0,l.jsx)("input",{type:"hidden",name:"installed",value:String(!i)}),d?(0,l.jsx)("input",{type:"hidden",name:"slug_hint",value:d}):null,u?(0,l.jsx)("input",{type:"hidden",name:"current_kind",value:u}):null,(0,l.jsx)("button",{className:"mkt-toggle ".concat(i?"on":""),type:"submit",role:"switch","aria-checked":i,"aria-label":j,disabled:c||!o})]})}var x=t(85649);function b(e){let{value:n,onChange:t,supportsScopes:a=["global","project","agent"],disabled:i}=e,[o,c]=s.useState([]),[r,d]=s.useState([]),[u,h]=s.useState(null),p=a.includes("project"),m=a.includes("agent");function j(e){var n,l;"global"===e?t({scope:"global",project_id:null,agent_id:null}):"project"===e?t({scope:"project",project_id:(null==(n=o[0])?void 0:n.id)||null,agent_id:null}):"agent"===e&&t({scope:"agent",project_id:null,agent_id:(null==(l=r[0])?void 0:l.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[t,l]=await Promise.all(n);if(e)return;c(Array.isArray(null==t?void 0:t.projects)?t.projects:[]);let s=Array.isArray(null==l?void 0:l.agents)?l.agents:[];d(s)}catch(n){e||h(String((null==n?void 0:n.message)||n))}}(),()=>{e=!0}},[p,m]),1===a.length)?(0,l.jsxs)("div",{className:"scope-picker scope-picker--locked",children:[(0,l.jsx)("span",{className:"scope-picker-label",children:"Scope"}),(0,l.jsx)("span",{className:"scope-picker-locked-value",children:a[0]})]}):(0,l.jsxs)("fieldset",{className:"scope-picker",disabled:i,children:[(0,l.jsx)("legend",{className:"scope-picker-legend",children:"Scope"}),a.includes("global")?(0,l.jsxs)("label",{className:"scope-picker-radio",children:[(0,l.jsx)("input",{type:"radio",name:"scope",value:"global",checked:"global"===n.scope,onChange:()=>j("global")}),(0,l.jsxs)("span",{className:"scope-picker-radio-body",children:[(0,l.jsx)("b",{children:"Global"}),(0,l.jsx)("small",{children:"Available to every project and every agent on this Mac."})]})]}):null,a.includes("project")?(0,l.jsxs)("label",{className:"scope-picker-radio",children:[(0,l.jsx)("input",{type:"radio",name:"scope",value:"project",checked:"project"===n.scope,onChange:()=>j("project"),disabled:0===o.length}),(0,l.jsxs)("span",{className:"scope-picker-radio-body",children:[(0,l.jsx)("b",{children:"Project"}),(0,l.jsx)("small",{children:0===o.length?"No projects yet — create one in the Projects tab.":"Resolved when a tool runs inside this project."}),"project"===n.scope&&o.length>0?(0,l.jsx)("select",{className:"scope-picker-select",value:n.project_id||"",onChange:e=>t({scope:"project",project_id:e.target.value,agent_id:null}),children:o.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))}):null]})]}):null,a.includes("agent")?(0,l.jsxs)("label",{className:"scope-picker-radio",children:[(0,l.jsx)("input",{type:"radio",name:"scope",value:"agent",checked:"agent"===n.scope,onChange:()=>j("agent"),disabled:0===r.length}),(0,l.jsxs)("span",{className:"scope-picker-radio-body",children:[(0,l.jsx)("b",{children:"Agent"}),(0,l.jsx)("small",{children:0===r.length?"No agents yet.":"Only this specific agent can use these credentials."}),"agent"===n.scope&&r.length>0?(0,l.jsx)("select",{className:"scope-picker-select",value:n.agent_id||"",onChange:e=>t({scope:"agent",project_id:null,agent_id:e.target.value}),children:r.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name||e.id},e.id))}):null]})]}):null,u?(0,l.jsxs)("small",{className:"scope-picker-error",children:["Couldn't load projects or agents: ",u]}):null]})}function f(e){var n,t,s,a,i;let{connection:o,credentials:c,onChange:r,scope:d,onScopeChange:u,onSubmit:h,onCancel:p,error:m,hint:j,busy:g}=e,x=(null==o||null==(n=o.connection)?void 0:n.credentials)||(null==o||null==(t=o.manifest)?void 0:t.credentials)||[],f=Array.isArray(null==o||null==(s=o.connection)?void 0:s.supports_scopes)?o.connection.supports_scopes:Array.isArray(null==o||null==(a=o.manifest)?void 0:a.supports_scopes)?o.manifest.supports_scopes:["global","project","agent"],k=x.filter(e=>e.required&&0===String(c[e.name]||"").trim().length).map(e=>e.label||e.name),v=0===k.length,y="global"===d.scope||"project"===d.scope&&!!d.project_id||"agent"===d.scope&&!!d.agent_id,N=g?null:v?y?null:"Choose where to store this connection to continue.":"Enter ".concat(k.join(" and ")," to continue.");return(0,l.jsxs)("form",{className:"connection-setup-step connection-setup-step-form",onSubmit:function(e){e.preventDefault(),h(c)},children:[(0,l.jsxs)("p",{className:"connection-setup-intro",children:["Madarx will use this to ",(null==(i=o.connection)?void 0:i.benefit)||"connect to the service","."," ","Your credentials are encrypted on this Mac and never echoed back."]}),(0,l.jsx)(b,{value:d,onChange:u,supportsScopes:f,disabled:g}),x.map(e=>(0,l.jsxs)("label",{className:"connection-setup-field",children:[(0,l.jsxs)("span",{className:"connection-setup-field-label",children:[e.label,e.required?null:(0,l.jsx)("small",{children:" (optional)"})]}),(0,l.jsx)("input",{type:"password"===e.type?"password":"text",name:e.name,placeholder:e.placeholder||"",autoComplete:"off",spellCheck:!1,value:c[e.name]||"",onChange:n=>{var t,l;return t=e.name,l=n.target.value,void r({...c,[t]:l})},disabled:g,"aria-required":e.required?"true":void 0}),e.help_text||e.help_url?(0,l.jsxs)("small",{className:"connection-setup-field-help",children:[e.help_text||"Find this in the provider settings.",e.help_url?(0,l.jsxs)(l.Fragment,{children:[" ",(0,l.jsx)("a",{href:e.help_url,target:"_blank",rel:"noreferrer noopener",children:"Where do I find this? →"})]}):null]}):null]},e.name)),m?(0,l.jsxs)("p",{className:"connection-setup-error",children:[m,j?(0,l.jsxs)("small",{children:[" ",j]}):null]}):null,N?(0,l.jsx)("p",{className:"connection-setup-disabled-hint",role:"status",children:N}):null,(0,l.jsxs)("div",{className:"connection-setup-actions",children:[(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:p,disabled:g,children:"Cancel"}),(0,l.jsx)("button",{type:"submit",className:"admin-button",disabled:g||!v||!y,title:N||void 0,children:g?"Verifying…":"Connect"})]})]})}var k=t(52769);function v(e){var n;let{connection:t,onPaired:a}=e,[i,o]=s.useState(null),[c,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[t,l]=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;o(t||null),r((null==l?void 0:l.health)||null),p(!!l&&!!(null==l?void 0:l.health)),((null==t?void 0:t.paired)||(null==l||null==(n=l.health)?void 0:n.pairing_state)==="paired")&&!m.current&&(m.current=!0,a())}catch(n){e||p(!1)}}n();let t=setInterval(n,3500);return()=>{e=!0,clearInterval(t)}},[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==c?void 0:c.pairing_state)||(!1===h?"offline":"starting"),g=(null==t||null==(n=t.connection)?void 0:n.requires_daemon)||"npm run whatsapp:bridge",x=!1===h||"offline"===j;return(0,l.jsxs)("section",{className:"connection-setup-step connection-setup-step-qr",children:[(0,l.jsxs)("p",{className:"connection-setup-intro",children:["Open WhatsApp on your phone → ",(0,l.jsx)("b",{children:"Settings"})," → ",(0,l.jsx)("b",{children:"Linked Devices"})," → ",(0,l.jsx)("b",{children:"Link a Device"}),", then scan the code below. Madarx will receive incoming WhatsApp messages through this number."]}),x?(0,l.jsxs)("div",{className:"connection-setup-warning",children:[(0,l.jsx)("p",{children:"The WhatsApp bridge daemon is not running."}),(0,l.jsxs)("p",{children:["Run ",(0,l.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,l.jsxs)("div",{className:"connection-setup-qr-row",children:[d?(0,l.jsx)("div",{className:"connection-setup-qr-box",children:(0,l.jsx)("img",{src:d,alt:"WhatsApp pairing QR code",width:240,height:240})}):"paired"===j?(0,l.jsx)("div",{className:"connection-setup-qr-pending",children:"Paired — finishing up…"}):(0,l.jsx)("div",{className:"connection-setup-qr-pending",children:x?"Waiting for the daemon…":"Waiting for QR…"}),(0,l.jsxs)("div",{className:"connection-setup-qr-copy",children:[(0,l.jsxs)("p",{children:["Pair only a ",(0,l.jsx)("b",{children:"dedicated WhatsApp number"}),", not your personal account. Baileys is an unofficial Web client and the paired account can be banned."]}),(0,l.jsx)("p",{className:"connection-setup-qr-status",children:(0,l.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,t,a,i,o,c,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==(t=u.connection)?void 0:t.credentials)||[]).find(e=>"HERMES_AGENT_DIR"===e.name),C=(null==b||null==(a=b.probe)?void 0:a.hermes_dir)||(null==b||null==(c=b.connection)||null==(o=c.connection)||null==(i=o.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,l.jsxs)("form",{className:"connection-setup-step connection-setup-step-form",onSubmit:function(e){e.preventDefault(),m(h)},children:[(0,l.jsxs)("p",{className:"connection-setup-intro",children:["Madarx looks for a local Hermes checkout at ",(0,l.jsx)("code",{children:"../hermes-agent"}),". Override the path below if your checkout lives elsewhere."]}),(0,l.jsx)("div",{className:"connection-setup-probe ".concat(S?"ok":"warn"),children:y?(0,l.jsx)("span",{children:"Probing…"}):S?(0,l.jsxs)("span",{children:[(0,l.jsx)("b",{children:"Hermes detected."})," Path: ",(0,l.jsx)("code",{children:C})]}):(0,l.jsxs)("span",{children:[(0,l.jsx)("b",{children:"Hermes not detected."})," ",(null==b?void 0:b.hint)||k||"Provide an override path or clone hermes-agent."]})}),w?(0,l.jsxs)("label",{className:"connection-setup-field",children:[(0,l.jsx)("span",{className:"connection-setup-field-label",children:w.label}),(0,l.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,l.jsx)("small",{className:"connection-setup-field-help",children:w.help_text})]}):null,(0,l.jsxs)("div",{className:"connection-setup-actions",children:[(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:j,disabled:g,children:"Cancel"}),(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:_,disabled:g||y,children:y?"Probing…":"Re-detect"}),(0,l.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,l.jsx)("span",{className:"connection-status ".concat(n.status),children:n.label}):null}function w(e){var n,t,i,o;let{open:c,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),[E,P]=s.useState(null),[T,I]=s.useState(null),[L,R]=s.useState(!1);if(s.useEffect(()=>{var e,n;c&&(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),I(null),P((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),R(!1))},[c,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 U=d.connection||d.manifest||{},q=(null==d||null==(n=d.connection)?void 0:n.setup_kind)||(null==d||null==(t=d.manifest)?void 0:t.setup_kind)||"api_key",M=U.verify_endpoint;U.verify_supported;let D=U.deep_link,O=Array.isArray(U.unlocks_tool_slugs)?U.unlocks_tool_slugs:[],W=Array.isArray(U.engines)?U.engines:[];async function B(e){if(!M){C("This connection is missing its setup endpoint."),m(N.SETUP);return}m(N.VERIFYING),C(null),A(null),I(null),R(!0);try{let n=await fetch(M,{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})}),t=await n.json().catch(()=>({}));if(!n.ok||!(null==t?void 0:t.ok)){C((null==t?void 0:t.error)||"We could not verify those credentials."),A((null==t?void 0:t.hint)||null),m(N.SETUP);return}P(t.summary||null),I(t.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{R(!1)}}async function F(){if(confirm("Disconnect ".concat(d.title,"? Stored credentials will be revoked."))){R(!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({}),P(null),h.refresh(),r()}finally{R(!1)}}}return(0,l.jsx)(x.A,{open:c,onClose:r,eyebrow:"Marketplace \xb7 Connection",title:"Connect ".concat(d.title),children:(0,l.jsxs)("div",{className:"connection-setup",children:[p===N.BENEFIT?(0,l.jsxs)("section",{className:"connection-setup-step connection-setup-step-benefit",children:[(0,l.jsx)("p",{className:"connection-setup-benefit",children:U.benefit||d.description}),O.length||W.length?(0,l.jsxs)("ul",{className:"connection-setup-unlocks",children:[W.length?(0,l.jsxs)("li",{children:[(0,l.jsx)("b",{children:"Engine:"})," ",W.join(", ")]}):null,O.length?(0,l.jsxs)("li",{children:[(0,l.jsxs)("b",{children:["Unlocks ",O.length," tool",1===O.length?"":"s",":"]})," ",O.slice(0,6).join(", "),O.length>6?", +".concat(O.length-6," more"):""]}):null]}):null,d.risk_summary?(0,l.jsxs)("p",{className:"connection-setup-risk",children:[(0,l.jsx)("b",{children:"Heads up:"})," ",d.risk_summary]}):null,(0,l.jsxs)("div",{className:"connection-setup-actions",children:[(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:r,disabled:L,children:"Cancel"}),(0,l.jsx)("button",{type:"button",className:"admin-button",onClick:()=>m(N.SETUP),disabled:L,children:"Continue"})]})]}):null,p===N.SETUP?"qr_pair"===q?(0,l.jsx)(v,{connection:d,onPaired:()=>B({})}):"binary_detect"===q?(0,l.jsx)(y,{connection:d,credentials:j,onChange:g,onSubmit:e=>B(e),onCancel:r,busy:L}):(0,l.jsx)(f,{connection:d,credentials:j,onChange:g,scope:b,onScopeChange:k,onSubmit:e=>B(e),onCancel:r,error:w,hint:S,busy:L}):null,p===N.VERIFYING?(0,l.jsx)("section",{className:"connection-setup-step connection-setup-step-verify",children:(0,l.jsxs)("p",{children:["Verifying with ",d.title,"…"]})}):null,p===N.DONE?(0,l.jsxs)("section",{className:"connection-setup-step connection-setup-step-done",children:[(0,l.jsxs)("div",{className:"connection-setup-done-head",children:[(0,l.jsx)(_,{status:{status:"connected",label:"Connected"}}),(0,l.jsxs)("h3",{children:[d.title," is connected"]})]}),(null==E?void 0:E.account_label)||(null==E?void 0:E.last_4)?(0,l.jsxs)("p",{className:"connection-setup-summary",children:[E.account_label?(0,l.jsxs)("span",{children:["Account: ",E.account_label]}):null,E.last_4?(0,l.jsxs)("span",{children:[" \xb7 Key ends in ••• ",E.last_4]}):null]}):(0,l.jsx)("p",{className:"connection-setup-summary",children:"Credentials stored in your local vault."}),T?(0,l.jsxs)("p",{className:"connection-setup-warning",children:[(0,l.jsx)("b",{children:"Heads up:"})," ",(T&&"owner_only_access"===T.reason?"Connected, but this token can only see your own repos. To read org or shared repos, grant the token access to them (and authorize SAML SSO if the org requires it), then rotate the key.":null)||"".concat("SUPABASE_ACCESS_TOKEN"===(i=T.field)?"Personal access token":"GITHUB_TOKEN"===i?"Token":i||"Optional field"," could not be verified (").concat("unauthorized"===(o=T.reason)?"rejected by the provider":"invalid_key"===o?"invalid":"network"===o?"network error":o||"unknown","). Other credentials were saved.")]}):null,O.length?(0,l.jsxs)("p",{className:"connection-setup-unlocked",children:[O.length," tool",1===O.length?"":"s"," now available in the marketplace."]}):null,D?(0,l.jsx)("p",{className:"connection-setup-deeplink",children:(0,l.jsxs)("a",{href:D,className:"admin-link",children:["Open ",d.title," operations →"]})}):null,(0,l.jsxs)("div",{className:"connection-setup-actions",children:[(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:F,disabled:L,children:"Disconnect"}),(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:()=>{g({}),C(null),A(null),I(null),m(N.SETUP)},disabled:L,children:"Rotate key"}),(0,l.jsx)("button",{type:"button",className:"admin-button",onClick:r,disabled:L,children:"Done"})]})]}):null]})})}function C(e){let n,{install:t,projectName:s,agentName:a}=e,i=(null==t?void 0:t.scope)||"global";n="project"===i?s||t.project_id||"Project":"agent"===i?a||t.agent_id||"Agent":"Global";let o=(null==t?void 0:t.account_label)||((null==t?void 0:t.last_4)?"••• ".concat(t.last_4):null);return(0,l.jsxs)("span",{className:"connection-scope-badge scope-".concat(i),children:[(0,l.jsx)("span",{className:"connection-scope-badge-scope",children:i}),(0,l.jsx)("span",{className:"connection-scope-badge-label",children:n}),o?(0,l.jsx)("span",{className:"connection-scope-badge-sub",children:o}):null]})}function S(e){let{status:n}=e;return n?(0,l.jsx)("span",{className:"connection-status ".concat(n.status),children:n.label}):null}function A(e){var n;let{item:t,status:a,prefillScope:i=null}=e,[o,c]=(0,s.useState)(!1),[r,d]=(0,s.useState)(i),[u,h]=(0,s.useState)({projects:{},agents:{}}),m=t.connection||t.manifest||{},j=Array.isArray(m.unlocks_tool_slugs)?m.unlocks_tool_slugs:[],g=Array.isArray(m.engines)?m.engines:[],x=Array.isArray(t.installs)?t.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),c(!0)}return(0,s.useEffect)(()=>{(null==i?void 0:i.scope)&&(d(i),c(!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 t=!1;return async function(){try{let l=[];l.push(e?fetch("/api/projects").then(e=>e.json()):Promise.resolve({projects:[]})),l.push(n?fetch("/api/state").then(e=>e.json()):Promise.resolve({agents:[]}));let[s,a]=await Promise.all(l);if(t)return;let i={};for(let e of(null==s?void 0:s.projects)||[])i[e.id]=e.name;let o={};for(let e of(null==a?void 0:a.agents)||[])o[e.id]=e.name||e.id;h({projects:i,agents:o})}catch(e){}}(),()=>{t=!0}},[x.length]),(0,l.jsxs)("li",{className:"mkt-card kind-connection ".concat(b?"on":""),children:[(0,l.jsxs)("div",{className:"mkt-card-head",children:[(0,l.jsx)("span",{className:"mkt-chip-tile kind-connection","aria-hidden":"true",children:(0,l.jsx)(E,{glyph:m.logo_glyph||t.slug})}),(0,l.jsx)(p,{kind:"connection"}),(0,l.jsx)(S,{status:a})]}),(0,l.jsxs)("div",{className:"mkt-card-body",children:[(0,l.jsx)("h3",{className:"mkt-card-title",children:t.title}),(0,l.jsx)("p",{className:"mkt-card-desc",children:t.description})]}),(0,l.jsxs)("div",{className:"mkt-card-meta",children:[g.length?(0,l.jsxs)("span",{children:["Engine ",(0,l.jsx)("b",{children:g.join(" \xb7 ")})]}):null,j.length?(0,l.jsxs)("span",{children:["Unlocks ",(0,l.jsxs)("b",{children:[j.length," tool",1===j.length?"":"s"]})]}):null,m.setup_kind?(0,l.jsxs)("span",{children:["Setup ",(0,l.jsx)("b",{children:"qr_pair"===(n=m.setup_kind)?"QR pairing":"binary_detect"===n?"Local binary":"API key"})]}):null,t.risk_summary?(0,l.jsxs)("span",{children:["Risk ",(0,l.jsx)("b",{children:t.risk_summary.length>40?t.risk_summary.slice(0,40)+"…":t.risk_summary})]}):null]}),x.length>0?(0,l.jsxs)("ul",{className:"connection-card-installs",children:[x.map(e=>(0,l.jsx)("li",{children:(0,l.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,l.jsx)("li",{children:(0,l.jsx)("button",{type:"button",className:"connection-card-add",onClick:()=>f({scope:"global",project_id:null,agent_id:null}),children:"+ Add another"})})]}):null,(0,l.jsxs)("div",{className:"mkt-card-foot",children:[(0,l.jsx)("span",{className:"mkt-availability",children:(null==a?void 0:a.footer)||(b?"Ready to use":"Not configured yet")}),(0,l.jsx)("button",{type:"button",className:"admin-button".concat(b?" secondary":""),onClick:()=>f(null),children:b?"Manage":"Configure"})]}),(0,l.jsx)(w,{open:o,onClose:()=>{c(!1),d(null)},connection:t,prefillScope:r})]})}function E(e){let{glyph:n}=e,t=String(n||"?").slice(0,1).toUpperCase();return(0,l.jsxs)("svg",{viewBox:"0 0 20 20",width:"20",height:"20","aria-hidden":"true",children:[(0,l.jsx)("rect",{x:"0",y:"0",width:"20",height:"20",rx:"5",fill:"currentColor",opacity:"0.08"}),(0,l.jsx)("text",{x:"10",y:"14",textAnchor:"middle",fontSize:"11",fontWeight:"600",fontFamily:"'IBM Plex Mono', monospace",fill:"currentColor",children:t})]})}let P={intake_form:"intake",agent_run:"agent",policy_gate:"policy",human_approval:"approval",package:"package"};function T(e){var n;let{item:t,toggleAction:s,onToggle:a,currentKind:i}=e,o=!!t.installed,c=t.workflow||{};return(0,l.jsxs)("li",{className:"mkt-card kind-workflow ".concat(o?"on":""),children:[(0,l.jsxs)("div",{className:"mkt-card-head",children:[(0,l.jsx)(u,{kind:"workflow",size:20}),(0,l.jsx)(p,{kind:"workflow"})]}),(0,l.jsxs)("div",{className:"mkt-card-body",children:[(0,l.jsx)("h3",{className:"mkt-card-title",children:t.slug}),(0,l.jsx)("p",{className:"mkt-card-desc",children:t.description})]}),(0,l.jsxs)("div",{className:"mkt-card-meta",children:[(0,l.jsxs)("span",{children:["Stages ",(0,l.jsx)("b",{children:c.stage_count||0})]}),(0,l.jsxs)("span",{children:["Shape ",(0,l.jsx)("b",{children:Array.isArray(n=c.stage_kinds)&&n.length?n.map(e=>P[e]||e).join(" → "):"—"})]}),(0,l.jsxs)("span",{children:["By ",(0,l.jsx)("b",{children:t.author})]}),t.version?(0,l.jsxs)("span",{children:["Version ",(0,l.jsx)("b",{children:t.version})]}):null,t.risk_summary?(0,l.jsxs)("span",{children:["Risk ",(0,l.jsx)("b",{children:t.risk_summary.length>60?"".concat(t.risk_summary.slice(0,60),"…"):t.risk_summary})]}):null]}),(0,l.jsxs)("div",{className:"mkt-card-foot",children:[(0,l.jsx)("span",{className:"mkt-availability ".concat(o?"installed":""),children:o?"Installed":"Available"}),(0,l.jsx)(g,{action:s,onToggle:a,itemId:t.id,installed:o,available:!0,label:"".concat(o?"Uninstall":"Install"," ").concat(t.slug),slugHint:t.slug,currentKind:i})]})]})}function I(e){var n;let{item:t,toggleAction:s,installItem:a,onBundleClick:i,onConnectionClick:o,connectionStatus:c,connectionPrefill:r,currentKind:d}=e,h="function"==typeof a?e=>a(t,e):void 0,m="tool"===t.kind,x="skill"===t.kind,b="bundle"===t.kind,f="agent"===t.kind,k="connection"===t.kind,v="workflow"===t.kind,y=!!t.installed,N=!!t.available;return k?(0,l.jsx)(A,{item:t,status:c,prefillScope:r}):v?(0,l.jsx)(T,{item:t,toggleAction:s,onToggle:h,currentKind:d}):(0,l.jsxs)("li",{className:"mkt-card kind-".concat(t.kind," ").concat(y?"on":""),children:[(0,l.jsxs)("div",{className:"mkt-card-head",children:[(0,l.jsx)(u,{kind:t.kind,category:t.category,size:20}),(0,l.jsx)(p,{kind:t.kind}),m&&t.tool?(0,l.jsx)(j,{level:t.tool.risk_level}):null]}),(0,l.jsxs)("div",{className:"mkt-card-body",children:[(0,l.jsx)("h3",{className:"mkt-card-title",children:t.slug}),(0,l.jsx)("p",{className:"mkt-card-desc",children:t.description})]}),(0,l.jsxs)("div",{className:"mkt-card-meta",children:[m&&t.tool?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:["Approval mode ",(0,l.jsx)("b",{children:t.tool.approval_mode})]}),(0,l.jsxs)("span",{children:["Config ",(0,l.jsx)("b",{children:(null==(n=t.tool.required_env)?void 0:n.length)?t.tool.required_env.join(" \xb7 "):"none"})]})]}):null,x&&t.skill?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:["Invocation ",(0,l.jsx)("b",{children:t.skill.invocation})]}),(0,l.jsxs)("span",{children:["Author ",(0,l.jsx)("b",{children:t.author})]})]}):null,b&&t.bundle?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:["Items ",(0,l.jsx)("b",{children:t.bundle.published_count})]}),(0,l.jsxs)("span",{children:["By ",(0,l.jsxs)("b",{children:[t.author,t.bundle.license?" \xb7 ".concat(t.bundle.license):""]})]})]}):null,f&&t.agent?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{children:["Role ",(0,l.jsx)("b",{children:t.agent.role})]}),(0,l.jsxs)("span",{children:["Engine ",(0,l.jsx)("b",{children:t.agent.engine_default})]}),(0,l.jsxs)("span",{children:["Installed ",(0,l.jsxs)("b",{children:[t.install_count||0,"x"]})]})]}):null,!m&&t.risk_summary?(0,l.jsxs)("span",{children:["Risk ",(0,l.jsx)("b",{children:t.risk_summary.length>40?t.risk_summary.slice(0,40)+"…":t.risk_summary})]}):null,t.version?(0,l.jsxs)("span",{children:["Version ",(0,l.jsx)("b",{children:t.version})]}):null]}),(0,l.jsxs)("div",{className:"mkt-card-foot",children:[(0,l.jsx)("span",{className:"mkt-availability ".concat(y?"installed":N?"":"warn"),children:y?"Installed":m&&!N?"Missing config":"Available"}),b?(0,l.jsx)("button",{type:"button",className:"mkt-toggle",role:"switch","aria-checked":!1,"aria-label":"Install ".concat(t.slug," (Phase 2)"),onClick:i}):(0,l.jsx)(g,{action:s,onToggle:h,itemId:t.id,installed:y,available:N,label:"".concat(y?"Uninstall":"Install"," ").concat(t.slug),slugHint:t.slug,currentKind:d})]})]})}function L(e){let{open:n,onClose:t,action:s,mode:a="github",bundleSlug:i}=e,o="bundle"===a;return(0,l.jsx)(x.A,{open:n,onClose:t,eyebrow:o?"Bundle install \xb7 Phase 2":"Import from GitHub \xb7 Phase 2",title:o?"Installing ".concat(i||"this bundle"," lands in Phase 2"):"Importer lands in Phase 2",children:(0,l.jsxs)("form",{className:"agents-modal-form",action:s,children:[(0,l.jsx)("p",{className:"agents-modal-help",children:o?"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."}),o?(0,l.jsx)("input",{type:"hidden",name:"url",value:i?"bundle:".concat(i):"bundle:unknown"}):(0,l.jsx)("section",{className:"agents-modal-section",children:(0,l.jsxs)("label",{className:"agents-modal-field wide",children:[(0,l.jsx)("span",{children:"Repository URL"}),(0,l.jsx)("input",{name:"url",type:"url",placeholder:"https://github.com/owner/repo",disabled:!0,readOnly:!0,"aria-label":"GitHub repository URL"})]})}),(0,l.jsx)("p",{className:"agents-modal-help",style:{fontSize:11,color:"#9aa0aa"},children:o?"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,l.jsxs)("footer",{className:"agents-modal-foot",children:[(0,l.jsx)("button",{type:"button",className:"admin-button secondary",onClick:t,children:"Close"}),(0,l.jsx)("button",{className:"admin-button",type:"submit",disabled:!0,children:o?"Coming Phase 2":"Coming next"})]})]})})}function R(e,n){let t=n?'"'.concat(n,'"'):"item";return"installed"===e?{tone:"success",eyebrow:"Installed",text:"".concat(t," is now installed and available to your agents.")}:"uninstalled"===e?{tone:"success",eyebrow:"Uninstalled",text:"".concat(t," has been removed from your installed catalog.")}:"deferred"===e?{tone:"info",eyebrow:"Pending",text:"Bundle install for ".concat(t," 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(t," to finish connecting it.")}:"already_present"===e?{tone:"info",eyebrow:"Already installed",text:"A workflow with the same slug as ".concat(t," already exists. Edit it on /workflows.")}:"in_flight_cases"===e?{tone:"info",eyebrow:"Uninstall blocked",text:"".concat(t," has cases still running. Finish or cancel them before uninstalling.")}:"error"===e?{tone:"error",eyebrow:"Action failed",text:"Could not update ".concat(t,". Check the runtime panel for details.")}:null}let U=["toast","slug","toast_kind"];function q(e,n,t){let l=n instanceof URLSearchParams?new URLSearchParams(n):new URLSearchParams(n.toString()),s=!1;for(let e of U)l.has(e)&&(l.delete(e),s=!0);if(!s)return;let a=l.toString();t.replace(a?"".concat(e,"?").concat(a):e,{scroll:!1})}function M(){let e=(0,a.useRouter)(),n=(0,a.usePathname)(),t=(0,a.useSearchParams)(),i=t.get("toast"),o=t.get("slug")||"",[c,r]=(0,s.useState)(()=>i?{state:i,slug:o,key:"".concat(i,":").concat(o,":").concat(Date.now())}:null),[d,u]=(0,s.useState)(!!i),h=t.toString();if((0,s.useEffect)(()=>{if(!i)return;r({state:i,slug:o,key:"".concat(i,":").concat(o,":").concat(Date.now())}),u(!0);let t=setTimeout(()=>u(!1),3800),l=setTimeout(()=>q(n,new URLSearchParams(h),e),4e3);return()=>{clearTimeout(t),clearTimeout(l)}},[i,o,h]),!d||!c)return null;let p=R(c.state,c.slug);return p?(0,l.jsxs)("div",{className:"mkt-toast ".concat(p.tone),role:"status","aria-live":"polite",children:[(0,l.jsx)("span",{children:p.eyebrow}),(0,l.jsx)("p",{children:p.text}),(0,l.jsx)("button",{type:"button",onClick:()=>{u(!1),q(n,t,e)},"aria-label":"Dismiss notification",children:"\xd7"})]},c.key):null}let D=["all","connection","tool","skill","bundle","agent","workflow"];function O(e,n){if(!n)return 0;let t=n.toLowerCase(),l=String(e.slug||"").toLowerCase(),s=String(e.title||"").toLowerCase();return l.startsWith(t)||s.startsWith(t)?100:l.includes(t)||s.includes(t)?80:String(e.author||"").toLowerCase().includes(t)?60:Array.isArray(e.tags)&&e.tags.join(" ").toLowerCase().includes(t)?50:30}function W(e){let{items:n,counts:t,categoriesByKind:i,toggleAction:o,importAction:d,initialKind:u="all"}=e,h=D.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,S]=(0,s.useState)(n);(0,s.useEffect)(()=>{S(n)},[n]);let[A,E]=(0,s.useState)(null);function P(e,n){S(t=>t.map(t=>t.id===e?{...t,...n}:t))}async function T(e,n){let t=e.id,l=!!e.installed;P(t,{installed:n});let s=0;try{let a=await fetch("/api/marketplace/".concat(encodeURIComponent(t)),{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({installed:n})}),i=await a.json().catch(()=>({}));if(!a.ok){P(t,{installed:l}),E({state:"error",slug:e.slug,key:++s});return}if(i.deferred){P(t,{installed:l}),E({state:"deferred",slug:e.slug,key:++s});return}if(i.setup_required){P(t,{installed:l}),E({state:"setup_required",slug:e.slug,key:++s});return}i.item&&"object"==typeof i.item?P(t,i.item):P(t,{installed:n}),E({state:n?"installed":"uninstalled",slug:e.slug,key:++s})}catch(n){P(t,{installed:l}),E({state:"error",slug:e.slug,key:++s})}}(0,s.useEffect)(()=>{if(!A)return;let e=setTimeout(()=>E(null),3800);return()=>clearTimeout(e)},[A]);let U=(0,a.useSearchParams)(),q=(null==U?void 0:U.get("connection"))||null,W=(null==U?void 0:U.get("prefill_scope"))||null,B=(null==U?void 0:U.get("prefill_project_id"))||null,F=(null==U?void 0:U.get("prefill_agent_id"))||null,H=W?{scope:W,project_id:B,agent_id:F}:null;(0,s.useEffect)(()=>{g(null)},[p]);let G=(0,s.useMemo)(()=>{if("all"===p){let e=new Set,n=[];for(let t of Object.values(i||{}))for(let l of t)e.has(l)||(e.add(l),n.push(l));return n}return(null==i?void 0:i[p])||[]},[p,i]),K=(0,s.useMemo)(()=>{let e={};for(let n of"all"===p?C:C.filter(e=>e.kind===p))n.category&&(e[n.category]=(e[n.category]||0)+1);return e},[C,p]),z=(0,s.useMemo)(()=>{let e=C;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 t=n.toLowerCase(),l=String(e.slug||"").toLowerCase(),s=String(e.title||"").toLowerCase(),a=String(e.description||"").toLowerCase(),i=String(e.author||"").toLowerCase(),o=Array.isArray(e.tags)?e.tags.join(" ").toLowerCase():"";return l.includes(t)||s.includes(t)||a.includes(t)||i.includes(t)||o.includes(t)})(e,n)).slice().sort((e,t)=>O(t,n)-O(e,n))}return e},[C,p,j,x]),V=C.filter(e=>e.installed).length,J=A?R(A.state,A.slug):null;return(0,l.jsxs)("div",{className:"mkt-page",children:[(0,l.jsx)(M,{}),J?(0,l.jsxs)("div",{className:"mkt-toast ".concat(J.tone),role:"status","aria-live":"polite",children:[(0,l.jsx)("span",{children:J.eyebrow}),(0,l.jsx)("p",{children:J.text}),(0,l.jsx)("button",{type:"button",onClick:()=>E(null),"aria-label":"Dismiss notification",children:"\xd7"})]},A.key):null,(0,l.jsxs)("section",{className:"mkt-stats",children:[(0,l.jsxs)("div",{className:"mkt-stat",children:[(0,l.jsx)("b",{children:t.all}),(0,l.jsx)("span",{children:"Catalog"})]}),(0,l.jsxs)("div",{className:"mkt-stat connection",children:[(0,l.jsx)("b",{children:t.connection||0}),(0,l.jsx)("span",{children:"Connections"})]}),(0,l.jsxs)("div",{className:"mkt-stat",children:[(0,l.jsx)("b",{children:t.tool}),(0,l.jsx)("span",{children:"Tools"})]}),(0,l.jsxs)("div",{className:"mkt-stat",children:[(0,l.jsx)("b",{children:t.skill}),(0,l.jsx)("span",{children:"Skills"})]}),(0,l.jsxs)("div",{className:"mkt-stat",children:[(0,l.jsx)("b",{children:t.bundle}),(0,l.jsx)("span",{children:"Bundles"})]}),(0,l.jsxs)("div",{className:"mkt-stat agent",children:[(0,l.jsx)("b",{children:t.agent||0}),(0,l.jsx)("span",{children:"Agents"})]}),(0,l.jsxs)("div",{className:"mkt-stat workflow",children:[(0,l.jsx)("b",{children:t.workflow||0}),(0,l.jsx)("span",{children:"Workflows"})]})]}),(0,l.jsxs)("section",{className:"mkt-toolbar","aria-label":"Discover",children:[(0,l.jsx)(r,{value:x,onChange:b}),(0,l.jsxs)("button",{type:"button",className:"mkt-cta",onClick:()=>k(!0),children:[(0,l.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,l.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,l.jsx)(c,{activeKind:p,onKindChange:m,counts:t,categories:G,categoryCounts:K,scopeCount:"all"===p?t.all:t[p]||0,activeCategory:j,onCategoryChange:g}),(0,l.jsx)("section",{className:"mkt-section","aria-live":"polite",children:z.length?(0,l.jsx)("ul",{className:"mkt-grid",children:z.map(e=>(0,l.jsx)(I,{item:e,toggleAction:o,installItem:T,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 t=[];if(n.account_label&&t.push(n.account_label),n.last_4&&t.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?t.push("verified just now"):e<60?t.push("verified ".concat(e,"m ago")):e<1440?t.push("verified ".concat(Math.round(e/60),"h ago")):t.push("verified ".concat(Math.round(e/1440),"d ago"))}catch(e){}return{status:"connected",label:"Connected",footer:t.length?t.join(" \xb7 "):null}}(e):null,connectionPrefill:"connection"===e.kind&&q&&e.slug===q?H:null,currentKind:p},e.id))}):(0,l.jsxs)("div",{className:"mkt-empty",children:[(0,l.jsx)("b",{children:"Nothing matches your search yet."}),(0,l.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,l.jsxs)("small",{children:[V," installed \xb7 ",t.all," total"]})]})},"".concat(p,":").concat(j)),(0,l.jsx)(L,{open:f,onClose:()=>k(!1),action:d,mode:"github"}),(0,l.jsx)(L,{open:v.open,onClose:()=>y({open:!1,slug:null}),action:d,mode:"bundle",bundleSlug:v.slug}),(0,l.jsx)(w,{open:N.open,onClose:()=>_({open:!1,item:null}),connection:N.item})]})}},81969:(e,n,t)=>{Promise.resolve().then(t.bind(t,10677)),Promise.resolve().then(t.bind(t,60874))},85649:(e,n,t)=>{"use strict";t.d(n,{A:()=>i});var l=t(95155),s=t(12115),a=t(34788);function i(e){let{open:n,onClose:t,eyebrow:i,title:o,tone:c="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(),t()};return e.addEventListener("cancel",n),()=>e.removeEventListener("cancel",n)},[t]),(0,l.jsx)("dialog",{ref:u,className:"agents-modal".concat("wide"===r?" agents-modal--wide":""),onClick:e=>{e.target===u.current&&t()},children:n?(0,l.jsxs)("div",{className:"agents-modal-card".concat("danger"===c?" agents-modal-card--danger":""),onClick:e=>e.stopPropagation(),children:[(0,l.jsxs)("header",{className:"agents-modal-head",children:[(0,l.jsxs)("div",{children:[i?(0,l.jsx)("span",{className:"admin-kicker",children:i}):null,(0,l.jsx)("h2",{children:o})]}),(0,l.jsx)("button",{type:"button",className:"agents-modal-close",onClick:t,"aria-label":"Close",children:(0,l.jsx)(a.A,{size:14})})]}),d]}):null})}}},e=>{e.O(0,[2769,7695,8441,1255,7358],()=>e(e.s=81969)),_N_E=e.O()}]);