@agenticmail/enterprise 0.3.2 → 0.4.1

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 (1741) hide show
  1. package/.github/CODEOWNERS +23 -0
  2. package/.github/workflows/publish-community-skills.yml +121 -0
  3. package/.github/workflows/validate-community-skills.yml +172 -0
  4. package/ARCHITECTURE.md +184 -167
  5. package/CONTRIBUTING.md +254 -0
  6. package/DEPLOYMENT.md +1031 -0
  7. package/README.md +355 -174
  8. package/community-skills/_template/README.md +31 -0
  9. package/community-skills/_template/agenticmail-skill.json +48 -0
  10. package/community-skills/activecampaign/README.md +21 -0
  11. package/community-skills/activecampaign/agenticmail-skill.json +56 -0
  12. package/community-skills/adobe-sign/README.md +21 -0
  13. package/community-skills/adobe-sign/agenticmail-skill.json +72 -0
  14. package/community-skills/adp/README.md +21 -0
  15. package/community-skills/adp/agenticmail-skill.json +65 -0
  16. package/community-skills/airtable-bases/README.md +29 -0
  17. package/community-skills/airtable-bases/agenticmail-skill.json +69 -0
  18. package/community-skills/apollo-io/README.md +21 -0
  19. package/community-skills/apollo-io/agenticmail-skill.json +50 -0
  20. package/community-skills/asana-tasks/README.md +30 -0
  21. package/community-skills/asana-tasks/agenticmail-skill.json +70 -0
  22. package/community-skills/auth0/README.md +21 -0
  23. package/community-skills/auth0/agenticmail-skill.json +56 -0
  24. package/community-skills/aws-services/README.md +38 -0
  25. package/community-skills/aws-services/agenticmail-skill.json +70 -0
  26. package/community-skills/azure-devops/README.md +21 -0
  27. package/community-skills/azure-devops/agenticmail-skill.json +57 -0
  28. package/community-skills/bamboohr/README.md +21 -0
  29. package/community-skills/bamboohr/agenticmail-skill.json +56 -0
  30. package/community-skills/basecamp/README.md +21 -0
  31. package/community-skills/basecamp/agenticmail-skill.json +56 -0
  32. package/community-skills/bigcommerce/README.md +21 -0
  33. package/community-skills/bigcommerce/agenticmail-skill.json +55 -0
  34. package/community-skills/bitbucket-repos/README.md +29 -0
  35. package/community-skills/bitbucket-repos/agenticmail-skill.json +70 -0
  36. package/community-skills/box/README.md +21 -0
  37. package/community-skills/box/agenticmail-skill.json +48 -0
  38. package/community-skills/brex/README.md +21 -0
  39. package/community-skills/brex/agenticmail-skill.json +48 -0
  40. package/community-skills/buffer/README.md +21 -0
  41. package/community-skills/buffer/agenticmail-skill.json +50 -0
  42. package/community-skills/calendly/README.md +20 -0
  43. package/community-skills/calendly/agenticmail-skill.json +43 -0
  44. package/community-skills/canva-design/README.md +33 -0
  45. package/community-skills/canva-design/agenticmail-skill.json +60 -0
  46. package/community-skills/chargebee/README.md +21 -0
  47. package/community-skills/chargebee/agenticmail-skill.json +55 -0
  48. package/community-skills/circleci-pipelines/README.md +28 -0
  49. package/community-skills/circleci-pipelines/agenticmail-skill.json +66 -0
  50. package/community-skills/clickup/README.md +21 -0
  51. package/community-skills/clickup/agenticmail-skill.json +48 -0
  52. package/community-skills/close-crm/README.md +21 -0
  53. package/community-skills/close-crm/agenticmail-skill.json +49 -0
  54. package/community-skills/cloudflare-cdn/README.md +37 -0
  55. package/community-skills/cloudflare-cdn/agenticmail-skill.json +67 -0
  56. package/community-skills/confluence-wiki/README.md +31 -0
  57. package/community-skills/confluence-wiki/agenticmail-skill.json +74 -0
  58. package/community-skills/contentful/README.md +21 -0
  59. package/community-skills/contentful/agenticmail-skill.json +62 -0
  60. package/community-skills/copper-crm/README.md +21 -0
  61. package/community-skills/copper-crm/agenticmail-skill.json +56 -0
  62. package/community-skills/crisp/README.md +21 -0
  63. package/community-skills/crisp/agenticmail-skill.json +56 -0
  64. package/community-skills/crowdstrike/README.md +21 -0
  65. package/community-skills/crowdstrike/agenticmail-skill.json +69 -0
  66. package/community-skills/datadog-monitoring/README.md +37 -0
  67. package/community-skills/datadog-monitoring/agenticmail-skill.json +73 -0
  68. package/community-skills/digitalocean/README.md +21 -0
  69. package/community-skills/digitalocean/agenticmail-skill.json +48 -0
  70. package/community-skills/discord/README.md +45 -0
  71. package/community-skills/discord/agenticmail-skill.json +65 -0
  72. package/community-skills/docker-containers/README.md +38 -0
  73. package/community-skills/docker-containers/agenticmail-skill.json +70 -0
  74. package/community-skills/docusign-esign/README.md +35 -0
  75. package/community-skills/docusign-esign/agenticmail-skill.json +66 -0
  76. package/community-skills/drift/README.md +21 -0
  77. package/community-skills/drift/agenticmail-skill.json +50 -0
  78. package/community-skills/dropbox-storage/README.md +36 -0
  79. package/community-skills/dropbox-storage/agenticmail-skill.json +67 -0
  80. package/community-skills/figma-design/README.md +36 -0
  81. package/community-skills/figma-design/agenticmail-skill.json +66 -0
  82. package/community-skills/firebase/README.md +21 -0
  83. package/community-skills/firebase/agenticmail-skill.json +56 -0
  84. package/community-skills/flyio/README.md +21 -0
  85. package/community-skills/flyio/agenticmail-skill.json +56 -0
  86. package/community-skills/freshbooks/README.md +21 -0
  87. package/community-skills/freshbooks/agenticmail-skill.json +55 -0
  88. package/community-skills/freshdesk/README.md +21 -0
  89. package/community-skills/freshdesk/agenticmail-skill.json +57 -0
  90. package/community-skills/freshsales/README.md +21 -0
  91. package/community-skills/freshsales/agenticmail-skill.json +55 -0
  92. package/community-skills/freshservice/README.md +21 -0
  93. package/community-skills/freshservice/agenticmail-skill.json +56 -0
  94. package/community-skills/front/README.md +21 -0
  95. package/community-skills/front/agenticmail-skill.json +48 -0
  96. package/community-skills/github/README.md +49 -0
  97. package/community-skills/github/agenticmail-skill.json +73 -0
  98. package/community-skills/github-actions/README.md +29 -0
  99. package/community-skills/github-actions/agenticmail-skill.json +72 -0
  100. package/community-skills/gitlab-ci/README.md +51 -0
  101. package/community-skills/gitlab-ci/agenticmail-skill.json +66 -0
  102. package/community-skills/gong/README.md +21 -0
  103. package/community-skills/gong/agenticmail-skill.json +50 -0
  104. package/community-skills/google-ads/README.md +36 -0
  105. package/community-skills/google-ads/agenticmail-skill.json +58 -0
  106. package/community-skills/google-analytics/README.md +28 -0
  107. package/community-skills/google-analytics/agenticmail-skill.json +69 -0
  108. package/community-skills/google-cloud/README.md +33 -0
  109. package/community-skills/google-cloud/agenticmail-skill.json +59 -0
  110. package/community-skills/google-drive/README.md +36 -0
  111. package/community-skills/google-drive/agenticmail-skill.json +65 -0
  112. package/community-skills/gotomeeting/README.md +20 -0
  113. package/community-skills/gotomeeting/agenticmail-skill.json +45 -0
  114. package/community-skills/grafana/README.md +21 -0
  115. package/community-skills/grafana/agenticmail-skill.json +56 -0
  116. package/community-skills/greenhouse/README.md +21 -0
  117. package/community-skills/greenhouse/agenticmail-skill.json +49 -0
  118. package/community-skills/gusto/README.md +21 -0
  119. package/community-skills/gusto/agenticmail-skill.json +49 -0
  120. package/community-skills/hashicorp-vault/README.md +21 -0
  121. package/community-skills/hashicorp-vault/agenticmail-skill.json +58 -0
  122. package/community-skills/heroku/README.md +21 -0
  123. package/community-skills/heroku/agenticmail-skill.json +48 -0
  124. package/community-skills/hibob/README.md +21 -0
  125. package/community-skills/hibob/agenticmail-skill.json +48 -0
  126. package/community-skills/hootsuite/README.md +21 -0
  127. package/community-skills/hootsuite/agenticmail-skill.json +48 -0
  128. package/community-skills/hubspot-crm/README.md +36 -0
  129. package/community-skills/hubspot-crm/agenticmail-skill.json +70 -0
  130. package/community-skills/huggingface/README.md +21 -0
  131. package/community-skills/huggingface/agenticmail-skill.json +48 -0
  132. package/community-skills/index.json +1320 -0
  133. package/community-skills/intercom-support/README.md +36 -0
  134. package/community-skills/intercom-support/agenticmail-skill.json +64 -0
  135. package/community-skills/jira/README.md +53 -0
  136. package/community-skills/jira/agenticmail-skill.json +72 -0
  137. package/community-skills/klaviyo/README.md +21 -0
  138. package/community-skills/klaviyo/agenticmail-skill.json +48 -0
  139. package/community-skills/kubernetes-cluster/README.md +36 -0
  140. package/community-skills/kubernetes-cluster/agenticmail-skill.json +72 -0
  141. package/community-skills/lattice/README.md +21 -0
  142. package/community-skills/lattice/agenticmail-skill.json +49 -0
  143. package/community-skills/launchdarkly/README.md +21 -0
  144. package/community-skills/launchdarkly/agenticmail-skill.json +48 -0
  145. package/community-skills/lever/README.md +21 -0
  146. package/community-skills/lever/agenticmail-skill.json +49 -0
  147. package/community-skills/linear/README.md +29 -0
  148. package/community-skills/linear/agenticmail-skill.json +81 -0
  149. package/community-skills/linkedin/README.md +21 -0
  150. package/community-skills/linkedin/agenticmail-skill.json +48 -0
  151. package/community-skills/livechat/README.md +20 -0
  152. package/community-skills/livechat/agenticmail-skill.json +43 -0
  153. package/community-skills/loom-video/README.md +20 -0
  154. package/community-skills/loom-video/agenticmail-skill.json +44 -0
  155. package/community-skills/mailchimp-campaigns/README.md +37 -0
  156. package/community-skills/mailchimp-campaigns/agenticmail-skill.json +69 -0
  157. package/community-skills/mailgun/README.md +21 -0
  158. package/community-skills/mailgun/agenticmail-skill.json +71 -0
  159. package/community-skills/microsoft-teams/README.md +51 -0
  160. package/community-skills/microsoft-teams/agenticmail-skill.json +66 -0
  161. package/community-skills/miro-boards/README.md +20 -0
  162. package/community-skills/miro-boards/agenticmail-skill.json +44 -0
  163. package/community-skills/mixpanel-analytics/README.md +34 -0
  164. package/community-skills/mixpanel-analytics/agenticmail-skill.json +64 -0
  165. package/community-skills/monday-boards/README.md +28 -0
  166. package/community-skills/monday-boards/agenticmail-skill.json +68 -0
  167. package/community-skills/mongodb-atlas/README.md +21 -0
  168. package/community-skills/mongodb-atlas/agenticmail-skill.json +58 -0
  169. package/community-skills/neon/README.md +21 -0
  170. package/community-skills/neon/agenticmail-skill.json +50 -0
  171. package/community-skills/netlify/README.md +21 -0
  172. package/community-skills/netlify/agenticmail-skill.json +48 -0
  173. package/community-skills/netsuite/README.md +21 -0
  174. package/community-skills/netsuite/agenticmail-skill.json +57 -0
  175. package/community-skills/newrelic/README.md +21 -0
  176. package/community-skills/newrelic/agenticmail-skill.json +58 -0
  177. package/community-skills/notion/README.md +49 -0
  178. package/community-skills/notion/agenticmail-skill.json +72 -0
  179. package/community-skills/okta/README.md +21 -0
  180. package/community-skills/okta/agenticmail-skill.json +57 -0
  181. package/community-skills/openai/README.md +21 -0
  182. package/community-skills/openai/agenticmail-skill.json +48 -0
  183. package/community-skills/opsgenie/README.md +21 -0
  184. package/community-skills/opsgenie/agenticmail-skill.json +48 -0
  185. package/community-skills/outreach/README.md +21 -0
  186. package/community-skills/outreach/agenticmail-skill.json +50 -0
  187. package/community-skills/paddle/README.md +21 -0
  188. package/community-skills/paddle/agenticmail-skill.json +55 -0
  189. package/community-skills/pagerduty/README.md +21 -0
  190. package/community-skills/pagerduty/agenticmail-skill.json +48 -0
  191. package/community-skills/pandadoc/README.md +21 -0
  192. package/community-skills/pandadoc/agenticmail-skill.json +48 -0
  193. package/community-skills/paypal/README.md +21 -0
  194. package/community-skills/paypal/agenticmail-skill.json +55 -0
  195. package/community-skills/personio/README.md +21 -0
  196. package/community-skills/personio/agenticmail-skill.json +48 -0
  197. package/community-skills/pinecone/README.md +21 -0
  198. package/community-skills/pinecone/agenticmail-skill.json +48 -0
  199. package/community-skills/pipedrive-deals/README.md +33 -0
  200. package/community-skills/pipedrive-deals/agenticmail-skill.json +60 -0
  201. package/community-skills/plaid/README.md +21 -0
  202. package/community-skills/plaid/agenticmail-skill.json +65 -0
  203. package/community-skills/postmark/README.md +21 -0
  204. package/community-skills/postmark/agenticmail-skill.json +48 -0
  205. package/community-skills/power-automate/README.md +21 -0
  206. package/community-skills/power-automate/agenticmail-skill.json +59 -0
  207. package/community-skills/quickbooks-accounting/README.md +38 -0
  208. package/community-skills/quickbooks-accounting/agenticmail-skill.json +70 -0
  209. package/community-skills/recurly/README.md +21 -0
  210. package/community-skills/recurly/agenticmail-skill.json +48 -0
  211. package/community-skills/reddit/README.md +21 -0
  212. package/community-skills/reddit/agenticmail-skill.json +48 -0
  213. package/community-skills/render/README.md +21 -0
  214. package/community-skills/render/agenticmail-skill.json +48 -0
  215. package/community-skills/ringcentral/README.md +20 -0
  216. package/community-skills/ringcentral/agenticmail-skill.json +43 -0
  217. package/community-skills/rippling/README.md +21 -0
  218. package/community-skills/rippling/agenticmail-skill.json +48 -0
  219. package/community-skills/salesforce/README.md +53 -0
  220. package/community-skills/salesforce/agenticmail-skill.json +73 -0
  221. package/community-skills/salesloft/README.md +21 -0
  222. package/community-skills/salesloft/agenticmail-skill.json +48 -0
  223. package/community-skills/sanity/README.md +21 -0
  224. package/community-skills/sanity/agenticmail-skill.json +62 -0
  225. package/community-skills/sap/README.md +21 -0
  226. package/community-skills/sap/agenticmail-skill.json +63 -0
  227. package/community-skills/segment-cdp/README.md +37 -0
  228. package/community-skills/segment-cdp/agenticmail-skill.json +66 -0
  229. package/community-skills/sendgrid-email/README.md +51 -0
  230. package/community-skills/sendgrid-email/agenticmail-skill.json +71 -0
  231. package/community-skills/sentry/README.md +21 -0
  232. package/community-skills/sentry/agenticmail-skill.json +58 -0
  233. package/community-skills/servicenow/README.md +21 -0
  234. package/community-skills/servicenow/agenticmail-skill.json +56 -0
  235. package/community-skills/shopify/README.md +21 -0
  236. package/community-skills/shopify/agenticmail-skill.json +56 -0
  237. package/community-skills/shortcut/README.md +21 -0
  238. package/community-skills/shortcut/agenticmail-skill.json +48 -0
  239. package/community-skills/slack/README.md +45 -0
  240. package/community-skills/slack/agenticmail-skill.json +73 -0
  241. package/community-skills/smartsheet/README.md +21 -0
  242. package/community-skills/smartsheet/agenticmail-skill.json +48 -0
  243. package/community-skills/snowflake-warehouse/README.md +37 -0
  244. package/community-skills/snowflake-warehouse/agenticmail-skill.json +71 -0
  245. package/community-skills/snyk/README.md +21 -0
  246. package/community-skills/snyk/agenticmail-skill.json +48 -0
  247. package/community-skills/splunk/README.md +21 -0
  248. package/community-skills/splunk/agenticmail-skill.json +56 -0
  249. package/community-skills/square/README.md +21 -0
  250. package/community-skills/square/agenticmail-skill.json +55 -0
  251. package/community-skills/statuspage/README.md +21 -0
  252. package/community-skills/statuspage/agenticmail-skill.json +56 -0
  253. package/community-skills/stripe/README.md +45 -0
  254. package/community-skills/stripe/agenticmail-skill.json +66 -0
  255. package/community-skills/supabase/README.md +21 -0
  256. package/community-skills/supabase/agenticmail-skill.json +56 -0
  257. package/community-skills/teamwork/README.md +21 -0
  258. package/community-skills/teamwork/agenticmail-skill.json +56 -0
  259. package/community-skills/telegram-bot/README.md +20 -0
  260. package/community-skills/telegram-bot/agenticmail-skill.json +52 -0
  261. package/community-skills/terraform-iac/README.md +34 -0
  262. package/community-skills/terraform-iac/agenticmail-skill.json +66 -0
  263. package/community-skills/todoist-tasks/README.md +29 -0
  264. package/community-skills/todoist-tasks/agenticmail-skill.json +72 -0
  265. package/community-skills/trello-cards/README.md +30 -0
  266. package/community-skills/trello-cards/agenticmail-skill.json +72 -0
  267. package/community-skills/twilio-sms/README.md +47 -0
  268. package/community-skills/twilio-sms/agenticmail-skill.json +63 -0
  269. package/community-skills/twitter/README.md +21 -0
  270. package/community-skills/twitter/agenticmail-skill.json +48 -0
  271. package/community-skills/vercel-deployments/README.md +29 -0
  272. package/community-skills/vercel-deployments/agenticmail-skill.json +70 -0
  273. package/community-skills/weaviate/README.md +21 -0
  274. package/community-skills/weaviate/agenticmail-skill.json +56 -0
  275. package/community-skills/webex/README.md +20 -0
  276. package/community-skills/webex/agenticmail-skill.json +43 -0
  277. package/community-skills/webflow/README.md +21 -0
  278. package/community-skills/webflow/agenticmail-skill.json +48 -0
  279. package/community-skills/whatsapp-business/README.md +20 -0
  280. package/community-skills/whatsapp-business/agenticmail-skill.json +52 -0
  281. package/community-skills/whereby/README.md +20 -0
  282. package/community-skills/whereby/agenticmail-skill.json +43 -0
  283. package/community-skills/woocommerce/README.md +21 -0
  284. package/community-skills/woocommerce/agenticmail-skill.json +55 -0
  285. package/community-skills/wordpress/README.md +21 -0
  286. package/community-skills/wordpress/agenticmail-skill.json +56 -0
  287. package/community-skills/workday/README.md +21 -0
  288. package/community-skills/workday/agenticmail-skill.json +56 -0
  289. package/community-skills/wrike/README.md +21 -0
  290. package/community-skills/wrike/agenticmail-skill.json +48 -0
  291. package/community-skills/xero/README.md +21 -0
  292. package/community-skills/xero/agenticmail-skill.json +56 -0
  293. package/community-skills/youtube/README.md +21 -0
  294. package/community-skills/youtube/agenticmail-skill.json +52 -0
  295. package/community-skills/zendesk-tickets/README.md +37 -0
  296. package/community-skills/zendesk-tickets/agenticmail-skill.json +65 -0
  297. package/community-skills/zoho-crm/README.md +21 -0
  298. package/community-skills/zoho-crm/agenticmail-skill.json +74 -0
  299. package/community-skills/zoom-meetings/README.md +51 -0
  300. package/community-skills/zoom-meetings/agenticmail-skill.json +66 -0
  301. package/community-skills/zuora/README.md +21 -0
  302. package/community-skills/zuora/agenticmail-skill.json +55 -0
  303. package/dashboards/README.md +81 -70
  304. package/dashboards/django/app.py +117 -0
  305. package/dashboards/django/static/styles.css +284 -0
  306. package/dashboards/django/templates/agent_detail.html +501 -0
  307. package/dashboards/django/templates/agents.html +217 -0
  308. package/dashboards/django/templates/api_keys.html +41 -0
  309. package/dashboards/django/templates/audit.html +26 -0
  310. package/dashboards/django/templates/compliance.html +33 -0
  311. package/dashboards/django/templates/components/modal.html +6 -0
  312. package/dashboards/django/templates/components/pagination.html +9 -0
  313. package/dashboards/django/templates/components/stats.html +8 -0
  314. package/dashboards/django/templates/dashboard.html +24 -0
  315. package/dashboards/django/templates/dlp.html +70 -0
  316. package/dashboards/django/templates/guardrails.html +78 -0
  317. package/dashboards/django/templates/journal.html +39 -0
  318. package/dashboards/django/templates/layout.html +52 -0
  319. package/dashboards/django/templates/login.html +30 -0
  320. package/dashboards/django/templates/messages.html +38 -0
  321. package/dashboards/django/templates/settings.html +472 -0
  322. package/dashboards/django/templates/skills.html +66 -0
  323. package/dashboards/django/templates/users.html +34 -0
  324. package/dashboards/django/templates/vault.html +46 -0
  325. package/dashboards/django/utils/__init__.py +0 -0
  326. package/dashboards/django/utils/api.py +20 -0
  327. package/dashboards/django/utils/helpers.py +39 -0
  328. package/dashboards/django/views/__init__.py +38 -0
  329. package/dashboards/django/views/agents.py +343 -0
  330. package/dashboards/django/views/api_keys.py +47 -0
  331. package/dashboards/django/views/audit.py +35 -0
  332. package/dashboards/django/views/auth.py +34 -0
  333. package/dashboards/django/views/compliance.py +37 -0
  334. package/dashboards/django/views/dashboard.py +27 -0
  335. package/dashboards/django/views/dlp.py +53 -0
  336. package/dashboards/django/views/guardrails.py +61 -0
  337. package/dashboards/django/views/journal.py +41 -0
  338. package/dashboards/django/views/messages.py +65 -0
  339. package/dashboards/django/views/settings_view.py +335 -0
  340. package/dashboards/django/views/skills.py +50 -0
  341. package/dashboards/django/views/users.py +42 -0
  342. package/dashboards/django/views/vault.py +50 -0
  343. package/dashboards/dotnet/AgenticMailDashboard.csproj +10 -0
  344. package/dashboards/dotnet/Program.cs +53 -233
  345. package/dashboards/dotnet/Routes/AgentRoutes.cs +771 -0
  346. package/dashboards/dotnet/Routes/ApiKeyRoutes.cs +185 -0
  347. package/dashboards/dotnet/Routes/AuditRoutes.cs +86 -0
  348. package/dashboards/dotnet/Routes/AuthRoutes.cs +50 -0
  349. package/dashboards/dotnet/Routes/ComplianceRoutes.cs +143 -0
  350. package/dashboards/dotnet/Routes/DashboardRoutes.cs +81 -0
  351. package/dashboards/dotnet/Routes/DlpRoutes.cs +230 -0
  352. package/dashboards/dotnet/Routes/GuardrailRoutes.cs +285 -0
  353. package/dashboards/dotnet/Routes/JournalRoutes.cs +118 -0
  354. package/dashboards/dotnet/Routes/MessageRoutes.cs +167 -0
  355. package/dashboards/dotnet/Routes/SettingRoutes.cs +907 -0
  356. package/dashboards/dotnet/Routes/SkillRoutes.cs +198 -0
  357. package/dashboards/dotnet/Routes/UserRoutes.cs +111 -0
  358. package/dashboards/dotnet/Routes/VaultRoutes.cs +162 -0
  359. package/dashboards/dotnet/Services/ApiClient.cs +103 -0
  360. package/dashboards/dotnet/Services/HtmlBuilder.cs +249 -0
  361. package/dashboards/dotnet/wwwroot/styles.css +284 -0
  362. package/dashboards/express/app.js +37 -126
  363. package/dashboards/express/middleware/auth.js +10 -0
  364. package/dashboards/express/node_modules/.package-lock.json +913 -0
  365. package/dashboards/express/node_modules/accepts/HISTORY.md +250 -0
  366. package/dashboards/express/node_modules/accepts/LICENSE +23 -0
  367. package/dashboards/express/node_modules/accepts/README.md +140 -0
  368. package/dashboards/express/node_modules/accepts/index.js +238 -0
  369. package/dashboards/express/node_modules/accepts/package.json +47 -0
  370. package/dashboards/express/node_modules/body-parser/LICENSE +23 -0
  371. package/dashboards/express/node_modules/body-parser/README.md +494 -0
  372. package/dashboards/express/node_modules/body-parser/index.js +71 -0
  373. package/dashboards/express/node_modules/body-parser/lib/read.js +247 -0
  374. package/dashboards/express/node_modules/body-parser/lib/types/json.js +158 -0
  375. package/dashboards/express/node_modules/body-parser/lib/types/raw.js +42 -0
  376. package/dashboards/express/node_modules/body-parser/lib/types/text.js +36 -0
  377. package/dashboards/express/node_modules/body-parser/lib/types/urlencoded.js +142 -0
  378. package/dashboards/express/node_modules/body-parser/lib/utils.js +98 -0
  379. package/dashboards/express/node_modules/body-parser/package.json +52 -0
  380. package/dashboards/express/node_modules/bytes/History.md +97 -0
  381. package/dashboards/express/node_modules/bytes/LICENSE +23 -0
  382. package/dashboards/express/node_modules/bytes/Readme.md +152 -0
  383. package/dashboards/express/node_modules/bytes/index.js +170 -0
  384. package/dashboards/express/node_modules/bytes/package.json +42 -0
  385. package/dashboards/express/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  386. package/dashboards/express/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  387. package/dashboards/express/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  388. package/dashboards/express/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  389. package/dashboards/express/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  390. package/dashboards/express/node_modules/call-bind-apply-helpers/README.md +62 -0
  391. package/dashboards/express/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  392. package/dashboards/express/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  393. package/dashboards/express/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  394. package/dashboards/express/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  395. package/dashboards/express/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  396. package/dashboards/express/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  397. package/dashboards/express/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  398. package/dashboards/express/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  399. package/dashboards/express/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  400. package/dashboards/express/node_modules/call-bind-apply-helpers/index.js +15 -0
  401. package/dashboards/express/node_modules/call-bind-apply-helpers/package.json +85 -0
  402. package/dashboards/express/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  403. package/dashboards/express/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  404. package/dashboards/express/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  405. package/dashboards/express/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  406. package/dashboards/express/node_modules/call-bound/.eslintrc +13 -0
  407. package/dashboards/express/node_modules/call-bound/.github/FUNDING.yml +12 -0
  408. package/dashboards/express/node_modules/call-bound/.nycrc +9 -0
  409. package/dashboards/express/node_modules/call-bound/CHANGELOG.md +42 -0
  410. package/dashboards/express/node_modules/call-bound/LICENSE +21 -0
  411. package/dashboards/express/node_modules/call-bound/README.md +53 -0
  412. package/dashboards/express/node_modules/call-bound/index.d.ts +94 -0
  413. package/dashboards/express/node_modules/call-bound/index.js +19 -0
  414. package/dashboards/express/node_modules/call-bound/package.json +99 -0
  415. package/dashboards/express/node_modules/call-bound/test/index.js +61 -0
  416. package/dashboards/express/node_modules/call-bound/tsconfig.json +10 -0
  417. package/dashboards/express/node_modules/content-disposition/HISTORY.md +72 -0
  418. package/dashboards/express/node_modules/content-disposition/LICENSE +22 -0
  419. package/dashboards/express/node_modules/content-disposition/README.md +142 -0
  420. package/dashboards/express/node_modules/content-disposition/index.js +458 -0
  421. package/dashboards/express/node_modules/content-disposition/package.json +43 -0
  422. package/dashboards/express/node_modules/content-type/HISTORY.md +29 -0
  423. package/dashboards/express/node_modules/content-type/LICENSE +22 -0
  424. package/dashboards/express/node_modules/content-type/README.md +94 -0
  425. package/dashboards/express/node_modules/content-type/index.js +225 -0
  426. package/dashboards/express/node_modules/content-type/package.json +42 -0
  427. package/dashboards/express/node_modules/cookie/LICENSE +24 -0
  428. package/dashboards/express/node_modules/cookie/README.md +317 -0
  429. package/dashboards/express/node_modules/cookie/SECURITY.md +25 -0
  430. package/dashboards/express/node_modules/cookie/index.js +335 -0
  431. package/dashboards/express/node_modules/cookie/package.json +44 -0
  432. package/dashboards/express/node_modules/cookie-signature/History.md +70 -0
  433. package/dashboards/express/node_modules/cookie-signature/LICENSE +22 -0
  434. package/dashboards/express/node_modules/cookie-signature/Readme.md +23 -0
  435. package/dashboards/express/node_modules/cookie-signature/index.js +47 -0
  436. package/dashboards/express/node_modules/cookie-signature/package.json +24 -0
  437. package/dashboards/express/node_modules/debug/LICENSE +20 -0
  438. package/dashboards/express/node_modules/debug/README.md +481 -0
  439. package/dashboards/express/node_modules/debug/package.json +64 -0
  440. package/dashboards/express/node_modules/debug/src/browser.js +272 -0
  441. package/dashboards/express/node_modules/debug/src/common.js +292 -0
  442. package/dashboards/express/node_modules/debug/src/index.js +10 -0
  443. package/dashboards/express/node_modules/debug/src/node.js +263 -0
  444. package/dashboards/express/node_modules/depd/History.md +103 -0
  445. package/dashboards/express/node_modules/depd/LICENSE +22 -0
  446. package/dashboards/express/node_modules/depd/Readme.md +280 -0
  447. package/dashboards/express/node_modules/depd/index.js +538 -0
  448. package/dashboards/express/node_modules/depd/lib/browser/index.js +77 -0
  449. package/dashboards/express/node_modules/depd/package.json +45 -0
  450. package/dashboards/express/node_modules/dunder-proto/.eslintrc +5 -0
  451. package/dashboards/express/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  452. package/dashboards/express/node_modules/dunder-proto/.nycrc +13 -0
  453. package/dashboards/express/node_modules/dunder-proto/CHANGELOG.md +24 -0
  454. package/dashboards/express/node_modules/dunder-proto/LICENSE +21 -0
  455. package/dashboards/express/node_modules/dunder-proto/README.md +54 -0
  456. package/dashboards/express/node_modules/dunder-proto/get.d.ts +5 -0
  457. package/dashboards/express/node_modules/dunder-proto/get.js +30 -0
  458. package/dashboards/express/node_modules/dunder-proto/package.json +76 -0
  459. package/dashboards/express/node_modules/dunder-proto/set.d.ts +5 -0
  460. package/dashboards/express/node_modules/dunder-proto/set.js +35 -0
  461. package/dashboards/express/node_modules/dunder-proto/test/get.js +34 -0
  462. package/dashboards/express/node_modules/dunder-proto/test/index.js +4 -0
  463. package/dashboards/express/node_modules/dunder-proto/test/set.js +50 -0
  464. package/dashboards/express/node_modules/dunder-proto/tsconfig.json +9 -0
  465. package/dashboards/express/node_modules/ee-first/LICENSE +22 -0
  466. package/dashboards/express/node_modules/ee-first/README.md +80 -0
  467. package/dashboards/express/node_modules/ee-first/index.js +95 -0
  468. package/dashboards/express/node_modules/ee-first/package.json +29 -0
  469. package/dashboards/express/node_modules/encodeurl/LICENSE +22 -0
  470. package/dashboards/express/node_modules/encodeurl/README.md +109 -0
  471. package/dashboards/express/node_modules/encodeurl/index.js +60 -0
  472. package/dashboards/express/node_modules/encodeurl/package.json +40 -0
  473. package/dashboards/express/node_modules/es-define-property/.eslintrc +13 -0
  474. package/dashboards/express/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  475. package/dashboards/express/node_modules/es-define-property/.nycrc +9 -0
  476. package/dashboards/express/node_modules/es-define-property/CHANGELOG.md +29 -0
  477. package/dashboards/express/node_modules/es-define-property/LICENSE +21 -0
  478. package/dashboards/express/node_modules/es-define-property/README.md +49 -0
  479. package/dashboards/express/node_modules/es-define-property/index.d.ts +3 -0
  480. package/dashboards/express/node_modules/es-define-property/index.js +14 -0
  481. package/dashboards/express/node_modules/es-define-property/package.json +81 -0
  482. package/dashboards/express/node_modules/es-define-property/test/index.js +56 -0
  483. package/dashboards/express/node_modules/es-define-property/tsconfig.json +10 -0
  484. package/dashboards/express/node_modules/es-errors/.eslintrc +5 -0
  485. package/dashboards/express/node_modules/es-errors/.github/FUNDING.yml +12 -0
  486. package/dashboards/express/node_modules/es-errors/CHANGELOG.md +40 -0
  487. package/dashboards/express/node_modules/es-errors/LICENSE +21 -0
  488. package/dashboards/express/node_modules/es-errors/README.md +55 -0
  489. package/dashboards/express/node_modules/es-errors/eval.d.ts +3 -0
  490. package/dashboards/express/node_modules/es-errors/eval.js +4 -0
  491. package/dashboards/express/node_modules/es-errors/index.d.ts +3 -0
  492. package/dashboards/express/node_modules/es-errors/index.js +4 -0
  493. package/dashboards/express/node_modules/es-errors/package.json +80 -0
  494. package/dashboards/express/node_modules/es-errors/range.d.ts +3 -0
  495. package/dashboards/express/node_modules/es-errors/range.js +4 -0
  496. package/dashboards/express/node_modules/es-errors/ref.d.ts +3 -0
  497. package/dashboards/express/node_modules/es-errors/ref.js +4 -0
  498. package/dashboards/express/node_modules/es-errors/syntax.d.ts +3 -0
  499. package/dashboards/express/node_modules/es-errors/syntax.js +4 -0
  500. package/dashboards/express/node_modules/es-errors/test/index.js +19 -0
  501. package/dashboards/express/node_modules/es-errors/tsconfig.json +49 -0
  502. package/dashboards/express/node_modules/es-errors/type.d.ts +3 -0
  503. package/dashboards/express/node_modules/es-errors/type.js +4 -0
  504. package/dashboards/express/node_modules/es-errors/uri.d.ts +3 -0
  505. package/dashboards/express/node_modules/es-errors/uri.js +4 -0
  506. package/dashboards/express/node_modules/es-object-atoms/.eslintrc +16 -0
  507. package/dashboards/express/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  508. package/dashboards/express/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  509. package/dashboards/express/node_modules/es-object-atoms/LICENSE +21 -0
  510. package/dashboards/express/node_modules/es-object-atoms/README.md +63 -0
  511. package/dashboards/express/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  512. package/dashboards/express/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  513. package/dashboards/express/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  514. package/dashboards/express/node_modules/es-object-atoms/ToObject.js +10 -0
  515. package/dashboards/express/node_modules/es-object-atoms/index.d.ts +3 -0
  516. package/dashboards/express/node_modules/es-object-atoms/index.js +4 -0
  517. package/dashboards/express/node_modules/es-object-atoms/isObject.d.ts +3 -0
  518. package/dashboards/express/node_modules/es-object-atoms/isObject.js +6 -0
  519. package/dashboards/express/node_modules/es-object-atoms/package.json +80 -0
  520. package/dashboards/express/node_modules/es-object-atoms/test/index.js +38 -0
  521. package/dashboards/express/node_modules/es-object-atoms/tsconfig.json +6 -0
  522. package/dashboards/express/node_modules/escape-html/LICENSE +24 -0
  523. package/dashboards/express/node_modules/escape-html/Readme.md +43 -0
  524. package/dashboards/express/node_modules/escape-html/index.js +78 -0
  525. package/dashboards/express/node_modules/escape-html/package.json +24 -0
  526. package/dashboards/express/node_modules/etag/HISTORY.md +83 -0
  527. package/dashboards/express/node_modules/etag/LICENSE +22 -0
  528. package/dashboards/express/node_modules/etag/README.md +159 -0
  529. package/dashboards/express/node_modules/etag/index.js +131 -0
  530. package/dashboards/express/node_modules/etag/package.json +47 -0
  531. package/dashboards/express/node_modules/express/LICENSE +24 -0
  532. package/dashboards/express/node_modules/express/Readme.md +276 -0
  533. package/dashboards/express/node_modules/express/index.js +11 -0
  534. package/dashboards/express/node_modules/express/lib/application.js +631 -0
  535. package/dashboards/express/node_modules/express/lib/express.js +81 -0
  536. package/dashboards/express/node_modules/express/lib/request.js +514 -0
  537. package/dashboards/express/node_modules/express/lib/response.js +1053 -0
  538. package/dashboards/express/node_modules/express/lib/utils.js +271 -0
  539. package/dashboards/express/node_modules/express/lib/view.js +205 -0
  540. package/dashboards/express/node_modules/express/package.json +99 -0
  541. package/dashboards/express/node_modules/express-session/LICENSE +24 -0
  542. package/dashboards/express/node_modules/express-session/README.md +1061 -0
  543. package/dashboards/express/node_modules/express-session/index.js +700 -0
  544. package/dashboards/express/node_modules/express-session/node_modules/cookie-signature/History.md +42 -0
  545. package/dashboards/express/node_modules/express-session/node_modules/cookie-signature/Readme.md +42 -0
  546. package/dashboards/express/node_modules/express-session/node_modules/cookie-signature/index.js +51 -0
  547. package/dashboards/express/node_modules/express-session/node_modules/cookie-signature/package.json +18 -0
  548. package/dashboards/express/node_modules/express-session/node_modules/debug/.coveralls.yml +1 -0
  549. package/dashboards/express/node_modules/express-session/node_modules/debug/.eslintrc +11 -0
  550. package/dashboards/express/node_modules/express-session/node_modules/debug/.travis.yml +14 -0
  551. package/dashboards/express/node_modules/express-session/node_modules/debug/CHANGELOG.md +362 -0
  552. package/dashboards/express/node_modules/express-session/node_modules/debug/LICENSE +19 -0
  553. package/dashboards/express/node_modules/express-session/node_modules/debug/Makefile +50 -0
  554. package/dashboards/express/node_modules/express-session/node_modules/debug/README.md +312 -0
  555. package/dashboards/express/node_modules/express-session/node_modules/debug/component.json +19 -0
  556. package/dashboards/express/node_modules/express-session/node_modules/debug/karma.conf.js +70 -0
  557. package/dashboards/express/node_modules/express-session/node_modules/debug/node.js +1 -0
  558. package/dashboards/express/node_modules/express-session/node_modules/debug/package.json +49 -0
  559. package/dashboards/express/node_modules/express-session/node_modules/debug/src/browser.js +185 -0
  560. package/dashboards/express/node_modules/express-session/node_modules/debug/src/debug.js +202 -0
  561. package/dashboards/express/node_modules/express-session/node_modules/debug/src/index.js +10 -0
  562. package/dashboards/express/node_modules/express-session/node_modules/debug/src/inspector-log.js +15 -0
  563. package/dashboards/express/node_modules/express-session/node_modules/debug/src/node.js +248 -0
  564. package/dashboards/express/node_modules/express-session/node_modules/ms/index.js +152 -0
  565. package/dashboards/express/node_modules/express-session/node_modules/ms/license.md +21 -0
  566. package/dashboards/express/node_modules/express-session/node_modules/ms/package.json +37 -0
  567. package/dashboards/express/node_modules/express-session/node_modules/ms/readme.md +51 -0
  568. package/dashboards/express/node_modules/express-session/package.json +50 -0
  569. package/dashboards/express/node_modules/express-session/session/cookie.js +152 -0
  570. package/dashboards/express/node_modules/express-session/session/memory.js +187 -0
  571. package/dashboards/express/node_modules/express-session/session/session.js +143 -0
  572. package/dashboards/express/node_modules/express-session/session/store.js +102 -0
  573. package/dashboards/express/node_modules/finalhandler/HISTORY.md +239 -0
  574. package/dashboards/express/node_modules/finalhandler/LICENSE +22 -0
  575. package/dashboards/express/node_modules/finalhandler/README.md +150 -0
  576. package/dashboards/express/node_modules/finalhandler/index.js +293 -0
  577. package/dashboards/express/node_modules/finalhandler/package.json +47 -0
  578. package/dashboards/express/node_modules/forwarded/HISTORY.md +21 -0
  579. package/dashboards/express/node_modules/forwarded/LICENSE +22 -0
  580. package/dashboards/express/node_modules/forwarded/README.md +57 -0
  581. package/dashboards/express/node_modules/forwarded/index.js +90 -0
  582. package/dashboards/express/node_modules/forwarded/package.json +45 -0
  583. package/dashboards/express/node_modules/fresh/HISTORY.md +80 -0
  584. package/dashboards/express/node_modules/fresh/LICENSE +23 -0
  585. package/dashboards/express/node_modules/fresh/README.md +117 -0
  586. package/dashboards/express/node_modules/fresh/index.js +136 -0
  587. package/dashboards/express/node_modules/fresh/package.json +46 -0
  588. package/dashboards/express/node_modules/function-bind/.eslintrc +21 -0
  589. package/dashboards/express/node_modules/function-bind/.github/FUNDING.yml +12 -0
  590. package/dashboards/express/node_modules/function-bind/.github/SECURITY.md +3 -0
  591. package/dashboards/express/node_modules/function-bind/.nycrc +13 -0
  592. package/dashboards/express/node_modules/function-bind/CHANGELOG.md +136 -0
  593. package/dashboards/express/node_modules/function-bind/LICENSE +20 -0
  594. package/dashboards/express/node_modules/function-bind/README.md +46 -0
  595. package/dashboards/express/node_modules/function-bind/implementation.js +84 -0
  596. package/dashboards/express/node_modules/function-bind/index.js +5 -0
  597. package/dashboards/express/node_modules/function-bind/package.json +87 -0
  598. package/dashboards/express/node_modules/function-bind/test/.eslintrc +9 -0
  599. package/dashboards/express/node_modules/function-bind/test/index.js +252 -0
  600. package/dashboards/express/node_modules/get-intrinsic/.eslintrc +42 -0
  601. package/dashboards/express/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  602. package/dashboards/express/node_modules/get-intrinsic/.nycrc +9 -0
  603. package/dashboards/express/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  604. package/dashboards/express/node_modules/get-intrinsic/LICENSE +21 -0
  605. package/dashboards/express/node_modules/get-intrinsic/README.md +71 -0
  606. package/dashboards/express/node_modules/get-intrinsic/index.js +378 -0
  607. package/dashboards/express/node_modules/get-intrinsic/package.json +97 -0
  608. package/dashboards/express/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  609. package/dashboards/express/node_modules/get-proto/.eslintrc +10 -0
  610. package/dashboards/express/node_modules/get-proto/.github/FUNDING.yml +12 -0
  611. package/dashboards/express/node_modules/get-proto/.nycrc +9 -0
  612. package/dashboards/express/node_modules/get-proto/CHANGELOG.md +21 -0
  613. package/dashboards/express/node_modules/get-proto/LICENSE +21 -0
  614. package/dashboards/express/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  615. package/dashboards/express/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  616. package/dashboards/express/node_modules/get-proto/README.md +50 -0
  617. package/dashboards/express/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  618. package/dashboards/express/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  619. package/dashboards/express/node_modules/get-proto/index.d.ts +5 -0
  620. package/dashboards/express/node_modules/get-proto/index.js +27 -0
  621. package/dashboards/express/node_modules/get-proto/package.json +81 -0
  622. package/dashboards/express/node_modules/get-proto/test/index.js +68 -0
  623. package/dashboards/express/node_modules/get-proto/tsconfig.json +9 -0
  624. package/dashboards/express/node_modules/gopd/.eslintrc +16 -0
  625. package/dashboards/express/node_modules/gopd/.github/FUNDING.yml +12 -0
  626. package/dashboards/express/node_modules/gopd/CHANGELOG.md +45 -0
  627. package/dashboards/express/node_modules/gopd/LICENSE +21 -0
  628. package/dashboards/express/node_modules/gopd/README.md +40 -0
  629. package/dashboards/express/node_modules/gopd/gOPD.d.ts +1 -0
  630. package/dashboards/express/node_modules/gopd/gOPD.js +4 -0
  631. package/dashboards/express/node_modules/gopd/index.d.ts +5 -0
  632. package/dashboards/express/node_modules/gopd/index.js +15 -0
  633. package/dashboards/express/node_modules/gopd/package.json +77 -0
  634. package/dashboards/express/node_modules/gopd/test/index.js +36 -0
  635. package/dashboards/express/node_modules/gopd/tsconfig.json +9 -0
  636. package/dashboards/express/node_modules/has-symbols/.eslintrc +11 -0
  637. package/dashboards/express/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  638. package/dashboards/express/node_modules/has-symbols/.nycrc +9 -0
  639. package/dashboards/express/node_modules/has-symbols/CHANGELOG.md +91 -0
  640. package/dashboards/express/node_modules/has-symbols/LICENSE +21 -0
  641. package/dashboards/express/node_modules/has-symbols/README.md +46 -0
  642. package/dashboards/express/node_modules/has-symbols/index.d.ts +3 -0
  643. package/dashboards/express/node_modules/has-symbols/index.js +14 -0
  644. package/dashboards/express/node_modules/has-symbols/package.json +111 -0
  645. package/dashboards/express/node_modules/has-symbols/shams.d.ts +3 -0
  646. package/dashboards/express/node_modules/has-symbols/shams.js +45 -0
  647. package/dashboards/express/node_modules/has-symbols/test/index.js +22 -0
  648. package/dashboards/express/node_modules/has-symbols/test/shams/core-js.js +29 -0
  649. package/dashboards/express/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  650. package/dashboards/express/node_modules/has-symbols/test/tests.js +58 -0
  651. package/dashboards/express/node_modules/has-symbols/tsconfig.json +10 -0
  652. package/dashboards/express/node_modules/hasown/.eslintrc +5 -0
  653. package/dashboards/express/node_modules/hasown/.github/FUNDING.yml +12 -0
  654. package/dashboards/express/node_modules/hasown/.nycrc +13 -0
  655. package/dashboards/express/node_modules/hasown/CHANGELOG.md +40 -0
  656. package/dashboards/express/node_modules/hasown/LICENSE +21 -0
  657. package/dashboards/express/node_modules/hasown/README.md +40 -0
  658. package/dashboards/express/node_modules/hasown/index.d.ts +3 -0
  659. package/dashboards/express/node_modules/hasown/index.js +8 -0
  660. package/dashboards/express/node_modules/hasown/package.json +92 -0
  661. package/dashboards/express/node_modules/hasown/tsconfig.json +6 -0
  662. package/dashboards/express/node_modules/http-errors/HISTORY.md +186 -0
  663. package/dashboards/express/node_modules/http-errors/LICENSE +23 -0
  664. package/dashboards/express/node_modules/http-errors/README.md +169 -0
  665. package/dashboards/express/node_modules/http-errors/index.js +290 -0
  666. package/dashboards/express/node_modules/http-errors/package.json +54 -0
  667. package/dashboards/express/node_modules/iconv-lite/LICENSE +21 -0
  668. package/dashboards/express/node_modules/iconv-lite/README.md +138 -0
  669. package/dashboards/express/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  670. package/dashboards/express/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  671. package/dashboards/express/node_modules/iconv-lite/encodings/index.js +23 -0
  672. package/dashboards/express/node_modules/iconv-lite/encodings/internal.js +218 -0
  673. package/dashboards/express/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  674. package/dashboards/express/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  675. package/dashboards/express/node_modules/iconv-lite/encodings/sbcs-data.js +178 -0
  676. package/dashboards/express/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  677. package/dashboards/express/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  678. package/dashboards/express/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  679. package/dashboards/express/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  680. package/dashboards/express/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  681. package/dashboards/express/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  682. package/dashboards/express/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  683. package/dashboards/express/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  684. package/dashboards/express/node_modules/iconv-lite/encodings/utf16.js +187 -0
  685. package/dashboards/express/node_modules/iconv-lite/encodings/utf32.js +307 -0
  686. package/dashboards/express/node_modules/iconv-lite/encodings/utf7.js +283 -0
  687. package/dashboards/express/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  688. package/dashboards/express/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  689. package/dashboards/express/node_modules/iconv-lite/lib/index.d.ts +129 -0
  690. package/dashboards/express/node_modules/iconv-lite/lib/index.js +182 -0
  691. package/dashboards/express/node_modules/iconv-lite/lib/streams.js +105 -0
  692. package/dashboards/express/node_modules/iconv-lite/package.json +70 -0
  693. package/dashboards/express/node_modules/iconv-lite/types/encodings.d.ts +423 -0
  694. package/dashboards/express/node_modules/inherits/LICENSE +16 -0
  695. package/dashboards/express/node_modules/inherits/README.md +42 -0
  696. package/dashboards/express/node_modules/inherits/inherits.js +9 -0
  697. package/dashboards/express/node_modules/inherits/inherits_browser.js +27 -0
  698. package/dashboards/express/node_modules/inherits/package.json +29 -0
  699. package/dashboards/express/node_modules/ipaddr.js/LICENSE +19 -0
  700. package/dashboards/express/node_modules/ipaddr.js/README.md +233 -0
  701. package/dashboards/express/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  702. package/dashboards/express/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
  703. package/dashboards/express/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
  704. package/dashboards/express/node_modules/ipaddr.js/package.json +35 -0
  705. package/dashboards/express/node_modules/is-promise/LICENSE +19 -0
  706. package/dashboards/express/node_modules/is-promise/index.d.ts +2 -0
  707. package/dashboards/express/node_modules/is-promise/index.js +6 -0
  708. package/dashboards/express/node_modules/is-promise/index.mjs +3 -0
  709. package/dashboards/express/node_modules/is-promise/package.json +30 -0
  710. package/dashboards/express/node_modules/is-promise/readme.md +33 -0
  711. package/dashboards/express/node_modules/math-intrinsics/.eslintrc +16 -0
  712. package/dashboards/express/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  713. package/dashboards/express/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  714. package/dashboards/express/node_modules/math-intrinsics/LICENSE +21 -0
  715. package/dashboards/express/node_modules/math-intrinsics/README.md +50 -0
  716. package/dashboards/express/node_modules/math-intrinsics/abs.d.ts +1 -0
  717. package/dashboards/express/node_modules/math-intrinsics/abs.js +4 -0
  718. package/dashboards/express/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  719. package/dashboards/express/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  720. package/dashboards/express/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  721. package/dashboards/express/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  722. package/dashboards/express/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  723. package/dashboards/express/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  724. package/dashboards/express/node_modules/math-intrinsics/floor.d.ts +1 -0
  725. package/dashboards/express/node_modules/math-intrinsics/floor.js +4 -0
  726. package/dashboards/express/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  727. package/dashboards/express/node_modules/math-intrinsics/isFinite.js +12 -0
  728. package/dashboards/express/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  729. package/dashboards/express/node_modules/math-intrinsics/isInteger.js +16 -0
  730. package/dashboards/express/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  731. package/dashboards/express/node_modules/math-intrinsics/isNaN.js +6 -0
  732. package/dashboards/express/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  733. package/dashboards/express/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  734. package/dashboards/express/node_modules/math-intrinsics/max.d.ts +1 -0
  735. package/dashboards/express/node_modules/math-intrinsics/max.js +4 -0
  736. package/dashboards/express/node_modules/math-intrinsics/min.d.ts +1 -0
  737. package/dashboards/express/node_modules/math-intrinsics/min.js +4 -0
  738. package/dashboards/express/node_modules/math-intrinsics/mod.d.ts +3 -0
  739. package/dashboards/express/node_modules/math-intrinsics/mod.js +9 -0
  740. package/dashboards/express/node_modules/math-intrinsics/package.json +86 -0
  741. package/dashboards/express/node_modules/math-intrinsics/pow.d.ts +1 -0
  742. package/dashboards/express/node_modules/math-intrinsics/pow.js +4 -0
  743. package/dashboards/express/node_modules/math-intrinsics/round.d.ts +1 -0
  744. package/dashboards/express/node_modules/math-intrinsics/round.js +4 -0
  745. package/dashboards/express/node_modules/math-intrinsics/sign.d.ts +3 -0
  746. package/dashboards/express/node_modules/math-intrinsics/sign.js +11 -0
  747. package/dashboards/express/node_modules/math-intrinsics/test/index.js +192 -0
  748. package/dashboards/express/node_modules/math-intrinsics/tsconfig.json +3 -0
  749. package/dashboards/express/node_modules/media-typer/HISTORY.md +50 -0
  750. package/dashboards/express/node_modules/media-typer/LICENSE +22 -0
  751. package/dashboards/express/node_modules/media-typer/README.md +93 -0
  752. package/dashboards/express/node_modules/media-typer/index.js +143 -0
  753. package/dashboards/express/node_modules/media-typer/package.json +33 -0
  754. package/dashboards/express/node_modules/merge-descriptors/index.d.ts +11 -0
  755. package/dashboards/express/node_modules/merge-descriptors/index.js +26 -0
  756. package/dashboards/express/node_modules/merge-descriptors/license +11 -0
  757. package/dashboards/express/node_modules/merge-descriptors/package.json +50 -0
  758. package/dashboards/express/node_modules/merge-descriptors/readme.md +55 -0
  759. package/dashboards/express/node_modules/mime-db/HISTORY.md +541 -0
  760. package/dashboards/express/node_modules/mime-db/LICENSE +23 -0
  761. package/dashboards/express/node_modules/mime-db/README.md +109 -0
  762. package/dashboards/express/node_modules/mime-db/db.json +9342 -0
  763. package/dashboards/express/node_modules/mime-db/index.js +12 -0
  764. package/dashboards/express/node_modules/mime-db/package.json +56 -0
  765. package/dashboards/express/node_modules/mime-types/HISTORY.md +428 -0
  766. package/dashboards/express/node_modules/mime-types/LICENSE +23 -0
  767. package/dashboards/express/node_modules/mime-types/README.md +126 -0
  768. package/dashboards/express/node_modules/mime-types/index.js +211 -0
  769. package/dashboards/express/node_modules/mime-types/mimeScore.js +57 -0
  770. package/dashboards/express/node_modules/mime-types/package.json +49 -0
  771. package/dashboards/express/node_modules/ms/index.js +162 -0
  772. package/dashboards/express/node_modules/ms/license.md +21 -0
  773. package/dashboards/express/node_modules/ms/package.json +38 -0
  774. package/dashboards/express/node_modules/ms/readme.md +59 -0
  775. package/dashboards/express/node_modules/negotiator/HISTORY.md +114 -0
  776. package/dashboards/express/node_modules/negotiator/LICENSE +24 -0
  777. package/dashboards/express/node_modules/negotiator/README.md +212 -0
  778. package/dashboards/express/node_modules/negotiator/index.js +83 -0
  779. package/dashboards/express/node_modules/negotiator/lib/charset.js +169 -0
  780. package/dashboards/express/node_modules/negotiator/lib/encoding.js +205 -0
  781. package/dashboards/express/node_modules/negotiator/lib/language.js +179 -0
  782. package/dashboards/express/node_modules/negotiator/lib/mediaType.js +294 -0
  783. package/dashboards/express/node_modules/negotiator/package.json +43 -0
  784. package/dashboards/express/node_modules/object-inspect/.eslintrc +53 -0
  785. package/dashboards/express/node_modules/object-inspect/.github/FUNDING.yml +12 -0
  786. package/dashboards/express/node_modules/object-inspect/.nycrc +13 -0
  787. package/dashboards/express/node_modules/object-inspect/CHANGELOG.md +424 -0
  788. package/dashboards/express/node_modules/object-inspect/LICENSE +21 -0
  789. package/dashboards/express/node_modules/object-inspect/example/all.js +23 -0
  790. package/dashboards/express/node_modules/object-inspect/example/circular.js +6 -0
  791. package/dashboards/express/node_modules/object-inspect/example/fn.js +5 -0
  792. package/dashboards/express/node_modules/object-inspect/example/inspect.js +10 -0
  793. package/dashboards/express/node_modules/object-inspect/index.js +544 -0
  794. package/dashboards/express/node_modules/object-inspect/package-support.json +20 -0
  795. package/dashboards/express/node_modules/object-inspect/package.json +105 -0
  796. package/dashboards/express/node_modules/object-inspect/readme.markdown +84 -0
  797. package/dashboards/express/node_modules/object-inspect/test/bigint.js +58 -0
  798. package/dashboards/express/node_modules/object-inspect/test/browser/dom.js +15 -0
  799. package/dashboards/express/node_modules/object-inspect/test/circular.js +16 -0
  800. package/dashboards/express/node_modules/object-inspect/test/deep.js +12 -0
  801. package/dashboards/express/node_modules/object-inspect/test/element.js +53 -0
  802. package/dashboards/express/node_modules/object-inspect/test/err.js +48 -0
  803. package/dashboards/express/node_modules/object-inspect/test/fakes.js +29 -0
  804. package/dashboards/express/node_modules/object-inspect/test/fn.js +76 -0
  805. package/dashboards/express/node_modules/object-inspect/test/global.js +17 -0
  806. package/dashboards/express/node_modules/object-inspect/test/has.js +15 -0
  807. package/dashboards/express/node_modules/object-inspect/test/holes.js +15 -0
  808. package/dashboards/express/node_modules/object-inspect/test/indent-option.js +271 -0
  809. package/dashboards/express/node_modules/object-inspect/test/inspect.js +139 -0
  810. package/dashboards/express/node_modules/object-inspect/test/lowbyte.js +12 -0
  811. package/dashboards/express/node_modules/object-inspect/test/number.js +58 -0
  812. package/dashboards/express/node_modules/object-inspect/test/quoteStyle.js +26 -0
  813. package/dashboards/express/node_modules/object-inspect/test/toStringTag.js +40 -0
  814. package/dashboards/express/node_modules/object-inspect/test/undef.js +12 -0
  815. package/dashboards/express/node_modules/object-inspect/test/values.js +261 -0
  816. package/dashboards/express/node_modules/object-inspect/test-core-js.js +26 -0
  817. package/dashboards/express/node_modules/object-inspect/util.inspect.js +1 -0
  818. package/dashboards/express/node_modules/on-finished/HISTORY.md +98 -0
  819. package/dashboards/express/node_modules/on-finished/LICENSE +23 -0
  820. package/dashboards/express/node_modules/on-finished/README.md +162 -0
  821. package/dashboards/express/node_modules/on-finished/index.js +234 -0
  822. package/dashboards/express/node_modules/on-finished/package.json +39 -0
  823. package/dashboards/express/node_modules/on-headers/HISTORY.md +26 -0
  824. package/dashboards/express/node_modules/on-headers/LICENSE +22 -0
  825. package/dashboards/express/node_modules/on-headers/README.md +81 -0
  826. package/dashboards/express/node_modules/on-headers/index.js +180 -0
  827. package/dashboards/express/node_modules/on-headers/package.json +44 -0
  828. package/dashboards/express/node_modules/once/LICENSE +15 -0
  829. package/dashboards/express/node_modules/once/README.md +79 -0
  830. package/dashboards/express/node_modules/once/once.js +42 -0
  831. package/dashboards/express/node_modules/once/package.json +33 -0
  832. package/dashboards/express/node_modules/parseurl/HISTORY.md +58 -0
  833. package/dashboards/express/node_modules/parseurl/LICENSE +24 -0
  834. package/dashboards/express/node_modules/parseurl/README.md +133 -0
  835. package/dashboards/express/node_modules/parseurl/index.js +158 -0
  836. package/dashboards/express/node_modules/parseurl/package.json +40 -0
  837. package/dashboards/express/node_modules/path-to-regexp/LICENSE +21 -0
  838. package/dashboards/express/node_modules/path-to-regexp/Readme.md +224 -0
  839. package/dashboards/express/node_modules/path-to-regexp/dist/index.d.ts +144 -0
  840. package/dashboards/express/node_modules/path-to-regexp/dist/index.js +409 -0
  841. package/dashboards/express/node_modules/path-to-regexp/dist/index.js.map +1 -0
  842. package/dashboards/express/node_modules/path-to-regexp/package.json +64 -0
  843. package/dashboards/express/node_modules/proxy-addr/HISTORY.md +161 -0
  844. package/dashboards/express/node_modules/proxy-addr/LICENSE +22 -0
  845. package/dashboards/express/node_modules/proxy-addr/README.md +139 -0
  846. package/dashboards/express/node_modules/proxy-addr/index.js +327 -0
  847. package/dashboards/express/node_modules/proxy-addr/package.json +47 -0
  848. package/dashboards/express/node_modules/qs/.editorconfig +46 -0
  849. package/dashboards/express/node_modules/qs/.github/FUNDING.yml +12 -0
  850. package/dashboards/express/node_modules/qs/.github/SECURITY.md +11 -0
  851. package/dashboards/express/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  852. package/dashboards/express/node_modules/qs/.nycrc +13 -0
  853. package/dashboards/express/node_modules/qs/CHANGELOG.md +806 -0
  854. package/dashboards/express/node_modules/qs/LICENSE.md +29 -0
  855. package/dashboards/express/node_modules/qs/README.md +758 -0
  856. package/dashboards/express/node_modules/qs/dist/qs.js +141 -0
  857. package/dashboards/express/node_modules/qs/eslint.config.mjs +56 -0
  858. package/dashboards/express/node_modules/qs/lib/formats.js +23 -0
  859. package/dashboards/express/node_modules/qs/lib/index.js +11 -0
  860. package/dashboards/express/node_modules/qs/lib/parse.js +373 -0
  861. package/dashboards/express/node_modules/qs/lib/stringify.js +356 -0
  862. package/dashboards/express/node_modules/qs/lib/utils.js +342 -0
  863. package/dashboards/express/node_modules/qs/package.json +94 -0
  864. package/dashboards/express/node_modules/qs/test/empty-keys-cases.js +267 -0
  865. package/dashboards/express/node_modules/qs/test/parse.js +1568 -0
  866. package/dashboards/express/node_modules/qs/test/stringify.js +1310 -0
  867. package/dashboards/express/node_modules/qs/test/utils.js +404 -0
  868. package/dashboards/express/node_modules/random-bytes/HISTORY.md +4 -0
  869. package/dashboards/express/node_modules/random-bytes/LICENSE +21 -0
  870. package/dashboards/express/node_modules/random-bytes/README.md +77 -0
  871. package/dashboards/express/node_modules/random-bytes/index.js +101 -0
  872. package/dashboards/express/node_modules/random-bytes/package.json +36 -0
  873. package/dashboards/express/node_modules/range-parser/HISTORY.md +56 -0
  874. package/dashboards/express/node_modules/range-parser/LICENSE +23 -0
  875. package/dashboards/express/node_modules/range-parser/README.md +84 -0
  876. package/dashboards/express/node_modules/range-parser/index.js +162 -0
  877. package/dashboards/express/node_modules/range-parser/package.json +44 -0
  878. package/dashboards/express/node_modules/raw-body/LICENSE +22 -0
  879. package/dashboards/express/node_modules/raw-body/README.md +223 -0
  880. package/dashboards/express/node_modules/raw-body/index.d.ts +85 -0
  881. package/dashboards/express/node_modules/raw-body/index.js +336 -0
  882. package/dashboards/express/node_modules/raw-body/package.json +46 -0
  883. package/dashboards/express/node_modules/router/HISTORY.md +228 -0
  884. package/dashboards/express/node_modules/router/LICENSE +23 -0
  885. package/dashboards/express/node_modules/router/README.md +416 -0
  886. package/dashboards/express/node_modules/router/index.js +748 -0
  887. package/dashboards/express/node_modules/router/lib/layer.js +247 -0
  888. package/dashboards/express/node_modules/router/lib/route.js +242 -0
  889. package/dashboards/express/node_modules/router/package.json +44 -0
  890. package/dashboards/express/node_modules/safe-buffer/LICENSE +21 -0
  891. package/dashboards/express/node_modules/safe-buffer/README.md +584 -0
  892. package/dashboards/express/node_modules/safe-buffer/index.d.ts +187 -0
  893. package/dashboards/express/node_modules/safe-buffer/index.js +65 -0
  894. package/dashboards/express/node_modules/safe-buffer/package.json +51 -0
  895. package/dashboards/express/node_modules/safer-buffer/LICENSE +21 -0
  896. package/dashboards/express/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  897. package/dashboards/express/node_modules/safer-buffer/Readme.md +156 -0
  898. package/dashboards/express/node_modules/safer-buffer/dangerous.js +58 -0
  899. package/dashboards/express/node_modules/safer-buffer/package.json +34 -0
  900. package/dashboards/express/node_modules/safer-buffer/safer.js +77 -0
  901. package/dashboards/express/node_modules/safer-buffer/tests.js +406 -0
  902. package/dashboards/express/node_modules/send/LICENSE +23 -0
  903. package/dashboards/express/node_modules/send/README.md +317 -0
  904. package/dashboards/express/node_modules/send/index.js +997 -0
  905. package/dashboards/express/node_modules/send/package.json +63 -0
  906. package/dashboards/express/node_modules/serve-static/LICENSE +25 -0
  907. package/dashboards/express/node_modules/serve-static/README.md +253 -0
  908. package/dashboards/express/node_modules/serve-static/index.js +208 -0
  909. package/dashboards/express/node_modules/serve-static/package.json +44 -0
  910. package/dashboards/express/node_modules/setprototypeof/LICENSE +13 -0
  911. package/dashboards/express/node_modules/setprototypeof/README.md +31 -0
  912. package/dashboards/express/node_modules/setprototypeof/index.d.ts +2 -0
  913. package/dashboards/express/node_modules/setprototypeof/index.js +17 -0
  914. package/dashboards/express/node_modules/setprototypeof/package.json +38 -0
  915. package/dashboards/express/node_modules/setprototypeof/test/index.js +24 -0
  916. package/dashboards/express/node_modules/side-channel/.editorconfig +9 -0
  917. package/dashboards/express/node_modules/side-channel/.eslintrc +12 -0
  918. package/dashboards/express/node_modules/side-channel/.github/FUNDING.yml +12 -0
  919. package/dashboards/express/node_modules/side-channel/.nycrc +13 -0
  920. package/dashboards/express/node_modules/side-channel/CHANGELOG.md +110 -0
  921. package/dashboards/express/node_modules/side-channel/LICENSE +21 -0
  922. package/dashboards/express/node_modules/side-channel/README.md +61 -0
  923. package/dashboards/express/node_modules/side-channel/index.d.ts +14 -0
  924. package/dashboards/express/node_modules/side-channel/index.js +43 -0
  925. package/dashboards/express/node_modules/side-channel/package.json +85 -0
  926. package/dashboards/express/node_modules/side-channel/test/index.js +104 -0
  927. package/dashboards/express/node_modules/side-channel/tsconfig.json +9 -0
  928. package/dashboards/express/node_modules/side-channel-list/.editorconfig +9 -0
  929. package/dashboards/express/node_modules/side-channel-list/.eslintrc +11 -0
  930. package/dashboards/express/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  931. package/dashboards/express/node_modules/side-channel-list/.nycrc +13 -0
  932. package/dashboards/express/node_modules/side-channel-list/CHANGELOG.md +15 -0
  933. package/dashboards/express/node_modules/side-channel-list/LICENSE +21 -0
  934. package/dashboards/express/node_modules/side-channel-list/README.md +62 -0
  935. package/dashboards/express/node_modules/side-channel-list/index.d.ts +13 -0
  936. package/dashboards/express/node_modules/side-channel-list/index.js +113 -0
  937. package/dashboards/express/node_modules/side-channel-list/list.d.ts +14 -0
  938. package/dashboards/express/node_modules/side-channel-list/package.json +77 -0
  939. package/dashboards/express/node_modules/side-channel-list/test/index.js +104 -0
  940. package/dashboards/express/node_modules/side-channel-list/tsconfig.json +9 -0
  941. package/dashboards/express/node_modules/side-channel-map/.editorconfig +9 -0
  942. package/dashboards/express/node_modules/side-channel-map/.eslintrc +11 -0
  943. package/dashboards/express/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  944. package/dashboards/express/node_modules/side-channel-map/.nycrc +13 -0
  945. package/dashboards/express/node_modules/side-channel-map/CHANGELOG.md +22 -0
  946. package/dashboards/express/node_modules/side-channel-map/LICENSE +21 -0
  947. package/dashboards/express/node_modules/side-channel-map/README.md +62 -0
  948. package/dashboards/express/node_modules/side-channel-map/index.d.ts +15 -0
  949. package/dashboards/express/node_modules/side-channel-map/index.js +68 -0
  950. package/dashboards/express/node_modules/side-channel-map/package.json +80 -0
  951. package/dashboards/express/node_modules/side-channel-map/test/index.js +114 -0
  952. package/dashboards/express/node_modules/side-channel-map/tsconfig.json +9 -0
  953. package/dashboards/express/node_modules/side-channel-weakmap/.editorconfig +9 -0
  954. package/dashboards/express/node_modules/side-channel-weakmap/.eslintrc +12 -0
  955. package/dashboards/express/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  956. package/dashboards/express/node_modules/side-channel-weakmap/.nycrc +13 -0
  957. package/dashboards/express/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  958. package/dashboards/express/node_modules/side-channel-weakmap/LICENSE +21 -0
  959. package/dashboards/express/node_modules/side-channel-weakmap/README.md +62 -0
  960. package/dashboards/express/node_modules/side-channel-weakmap/index.d.ts +15 -0
  961. package/dashboards/express/node_modules/side-channel-weakmap/index.js +84 -0
  962. package/dashboards/express/node_modules/side-channel-weakmap/package.json +87 -0
  963. package/dashboards/express/node_modules/side-channel-weakmap/test/index.js +114 -0
  964. package/dashboards/express/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  965. package/dashboards/express/node_modules/statuses/HISTORY.md +87 -0
  966. package/dashboards/express/node_modules/statuses/LICENSE +23 -0
  967. package/dashboards/express/node_modules/statuses/README.md +139 -0
  968. package/dashboards/express/node_modules/statuses/codes.json +65 -0
  969. package/dashboards/express/node_modules/statuses/index.js +146 -0
  970. package/dashboards/express/node_modules/statuses/package.json +49 -0
  971. package/dashboards/express/node_modules/toidentifier/HISTORY.md +9 -0
  972. package/dashboards/express/node_modules/toidentifier/LICENSE +21 -0
  973. package/dashboards/express/node_modules/toidentifier/README.md +61 -0
  974. package/dashboards/express/node_modules/toidentifier/index.js +32 -0
  975. package/dashboards/express/node_modules/toidentifier/package.json +38 -0
  976. package/dashboards/express/node_modules/type-is/HISTORY.md +292 -0
  977. package/dashboards/express/node_modules/type-is/LICENSE +23 -0
  978. package/dashboards/express/node_modules/type-is/README.md +198 -0
  979. package/dashboards/express/node_modules/type-is/index.js +250 -0
  980. package/dashboards/express/node_modules/type-is/package.json +47 -0
  981. package/dashboards/express/node_modules/uid-safe/HISTORY.md +61 -0
  982. package/dashboards/express/node_modules/uid-safe/LICENSE +22 -0
  983. package/dashboards/express/node_modules/uid-safe/README.md +77 -0
  984. package/dashboards/express/node_modules/uid-safe/index.js +107 -0
  985. package/dashboards/express/node_modules/uid-safe/package.json +46 -0
  986. package/dashboards/express/node_modules/unpipe/HISTORY.md +4 -0
  987. package/dashboards/express/node_modules/unpipe/LICENSE +22 -0
  988. package/dashboards/express/node_modules/unpipe/README.md +43 -0
  989. package/dashboards/express/node_modules/unpipe/index.js +69 -0
  990. package/dashboards/express/node_modules/unpipe/package.json +27 -0
  991. package/dashboards/express/node_modules/vary/HISTORY.md +39 -0
  992. package/dashboards/express/node_modules/vary/LICENSE +22 -0
  993. package/dashboards/express/node_modules/vary/README.md +101 -0
  994. package/dashboards/express/node_modules/vary/index.js +149 -0
  995. package/dashboards/express/node_modules/vary/package.json +43 -0
  996. package/dashboards/express/node_modules/wrappy/LICENSE +15 -0
  997. package/dashboards/express/node_modules/wrappy/README.md +36 -0
  998. package/dashboards/express/node_modules/wrappy/package.json +29 -0
  999. package/dashboards/express/node_modules/wrappy/wrappy.js +33 -0
  1000. package/dashboards/express/package-lock.json +922 -0
  1001. package/dashboards/express/package.json +17 -0
  1002. package/dashboards/express/public/styles.css +284 -0
  1003. package/dashboards/express/routes/agents.js +771 -0
  1004. package/dashboards/express/routes/apiKeys.js +107 -0
  1005. package/dashboards/express/routes/audit.js +75 -0
  1006. package/dashboards/express/routes/auth.js +38 -0
  1007. package/dashboards/express/routes/compliance.js +93 -0
  1008. package/dashboards/express/routes/dashboard.js +65 -0
  1009. package/dashboards/express/routes/dlp.js +165 -0
  1010. package/dashboards/express/routes/guardrails.js +195 -0
  1011. package/dashboards/express/routes/journal.js +95 -0
  1012. package/dashboards/express/routes/messages.js +97 -0
  1013. package/dashboards/express/routes/settings.js +830 -0
  1014. package/dashboards/express/routes/skills.js +141 -0
  1015. package/dashboards/express/routes/users.js +69 -0
  1016. package/dashboards/express/routes/vault.js +141 -0
  1017. package/dashboards/express/utils/api.js +44 -0
  1018. package/dashboards/express/utils/helpers.js +46 -0
  1019. package/dashboards/express/views/components/modal.js +255 -0
  1020. package/dashboards/express/views/components/stats.js +22 -0
  1021. package/dashboards/express/views/components/table.js +31 -0
  1022. package/dashboards/express/views/layout.js +73 -0
  1023. package/dashboards/express/views/login.js +45 -0
  1024. package/dashboards/go/go.mod +3 -0
  1025. package/dashboards/go/handlers/agents.go +790 -0
  1026. package/dashboards/go/handlers/apikeys.go +38 -0
  1027. package/dashboards/go/handlers/audit.go +52 -0
  1028. package/dashboards/go/handlers/auth.go +39 -0
  1029. package/dashboards/go/handlers/compliance.go +58 -0
  1030. package/dashboards/go/handlers/dashboard.go +43 -0
  1031. package/dashboards/go/handlers/dlp.go +78 -0
  1032. package/dashboards/go/handlers/guardrails.go +89 -0
  1033. package/dashboards/go/handlers/journal.go +60 -0
  1034. package/dashboards/go/handlers/messages.go +59 -0
  1035. package/dashboards/go/handlers/settings.go +951 -0
  1036. package/dashboards/go/handlers/skills.go +129 -0
  1037. package/dashboards/go/handlers/users.go +54 -0
  1038. package/dashboards/go/handlers/vault.go +85 -0
  1039. package/dashboards/go/main.go +35 -485
  1040. package/dashboards/go/middleware/auth.go +17 -0
  1041. package/dashboards/go/services/api.go +38 -0
  1042. package/dashboards/go/services/session.go +52 -0
  1043. package/dashboards/go/static/styles.css +284 -0
  1044. package/dashboards/go/templates/components.go +45 -0
  1045. package/dashboards/go/templates/helpers.go +35 -0
  1046. package/dashboards/go/templates/layout.go +59 -0
  1047. package/dashboards/html/index.html +203 -450
  1048. package/dashboards/html/package.json +11 -0
  1049. package/dashboards/html/public/styles.css +149 -0
  1050. package/dashboards/html/src/api.js +36 -0
  1051. package/dashboards/html/src/components/badge.js +13 -0
  1052. package/dashboards/html/src/components/layout.js +11 -0
  1053. package/dashboards/html/src/components/modal.js +9 -0
  1054. package/dashboards/html/src/components/pagination.js +12 -0
  1055. package/dashboards/html/src/components/stat-card.js +14 -0
  1056. package/dashboards/html/src/components/table.js +6 -0
  1057. package/dashboards/html/src/main.js +83 -0
  1058. package/dashboards/html/src/pages/agents.js +831 -0
  1059. package/dashboards/html/src/pages/api-keys.js +80 -0
  1060. package/dashboards/html/src/pages/audit.js +50 -0
  1061. package/dashboards/html/src/pages/compliance.js +69 -0
  1062. package/dashboards/html/src/pages/dashboard.js +25 -0
  1063. package/dashboards/html/src/pages/dlp.js +112 -0
  1064. package/dashboards/html/src/pages/guardrails.js +127 -0
  1065. package/dashboards/html/src/pages/journal.js +54 -0
  1066. package/dashboards/html/src/pages/login.js +84 -0
  1067. package/dashboards/html/src/pages/messages.js +90 -0
  1068. package/dashboards/html/src/pages/settings.js +656 -0
  1069. package/dashboards/html/src/pages/skills.js +114 -0
  1070. package/dashboards/html/src/pages/users.js +62 -0
  1071. package/dashboards/html/src/pages/vault.js +105 -0
  1072. package/dashboards/html/src/router.js +40 -0
  1073. package/dashboards/html/src/utils/escape.js +7 -0
  1074. package/dashboards/html/src/utils/time.js +16 -0
  1075. package/dashboards/html/src/utils/toast.js +10 -0
  1076. package/dashboards/java/AgenticMailDashboard.java +123 -346
  1077. package/dashboards/java/handlers/AgentsHandler.java +807 -0
  1078. package/dashboards/java/handlers/ApiKeysHandler.java +201 -0
  1079. package/dashboards/java/handlers/AuditHandler.java +95 -0
  1080. package/dashboards/java/handlers/AuthHandler.java +71 -0
  1081. package/dashboards/java/handlers/ComplianceHandler.java +192 -0
  1082. package/dashboards/java/handlers/DashboardHandler.java +98 -0
  1083. package/dashboards/java/handlers/DlpHandler.java +230 -0
  1084. package/dashboards/java/handlers/GuardrailsHandler.java +272 -0
  1085. package/dashboards/java/handlers/JournalHandler.java +130 -0
  1086. package/dashboards/java/handlers/MessagesHandler.java +168 -0
  1087. package/dashboards/java/handlers/SettingsHandler.java +1017 -0
  1088. package/dashboards/java/handlers/SkillsHandler.java +198 -0
  1089. package/dashboards/java/handlers/UsersHandler.java +118 -0
  1090. package/dashboards/java/handlers/VaultHandler.java +168 -0
  1091. package/dashboards/java/services/ApiClient.java +233 -0
  1092. package/dashboards/java/services/SessionManager.java +138 -0
  1093. package/dashboards/java/static/styles.css +288 -0
  1094. package/dashboards/java/templates/Components.java +142 -0
  1095. package/dashboards/java/templates/Helpers.java +106 -0
  1096. package/dashboards/java/templates/Layout.java +98 -0
  1097. package/dashboards/laravel/controllers/AgentController.php +250 -0
  1098. package/dashboards/laravel/controllers/ApiKeyController.php +73 -0
  1099. package/dashboards/laravel/controllers/AuditController.php +31 -0
  1100. package/dashboards/laravel/controllers/AuthController.php +44 -0
  1101. package/dashboards/laravel/controllers/ComplianceController.php +55 -0
  1102. package/dashboards/laravel/controllers/DashboardController.php +28 -0
  1103. package/dashboards/laravel/controllers/DlpController.php +88 -0
  1104. package/dashboards/laravel/controllers/GuardrailController.php +110 -0
  1105. package/dashboards/laravel/controllers/JournalController.php +44 -0
  1106. package/dashboards/laravel/controllers/MessageController.php +47 -0
  1107. package/dashboards/laravel/controllers/SettingController.php +258 -0
  1108. package/dashboards/laravel/controllers/SkillController.php +74 -0
  1109. package/dashboards/laravel/controllers/UserController.php +47 -0
  1110. package/dashboards/laravel/controllers/VaultController.php +94 -0
  1111. package/dashboards/laravel/index.php +319 -0
  1112. package/dashboards/laravel/lib/Api.php +73 -0
  1113. package/dashboards/laravel/lib/Helpers.php +123 -0
  1114. package/dashboards/laravel/public/styles.css +291 -0
  1115. package/dashboards/laravel/views/agent-detail.php +534 -0
  1116. package/dashboards/laravel/views/agents.php +204 -0
  1117. package/dashboards/laravel/views/api-keys.php +55 -0
  1118. package/dashboards/laravel/views/audit.php +30 -0
  1119. package/dashboards/laravel/views/compliance.php +48 -0
  1120. package/dashboards/laravel/views/components/modal.php +59 -0
  1121. package/dashboards/laravel/views/components/stats.php +21 -0
  1122. package/dashboards/laravel/views/components/table.php +35 -0
  1123. package/dashboards/laravel/views/dashboard.php +31 -0
  1124. package/dashboards/laravel/views/dlp.php +87 -0
  1125. package/dashboards/laravel/views/guardrails.php +95 -0
  1126. package/dashboards/laravel/views/journal.php +50 -0
  1127. package/dashboards/laravel/views/layout.php +82 -0
  1128. package/dashboards/laravel/views/login.php +45 -0
  1129. package/dashboards/laravel/views/messages.php +60 -0
  1130. package/dashboards/laravel/views/settings.php +622 -0
  1131. package/dashboards/laravel/views/skills.php +74 -0
  1132. package/dashboards/laravel/views/users.php +42 -0
  1133. package/dashboards/laravel/views/vault.php +80 -0
  1134. package/dashboards/php/components/layout.php +80 -0
  1135. package/dashboards/php/components/modal.php +22 -0
  1136. package/dashboards/php/components/stats.php +20 -0
  1137. package/dashboards/php/components/table.php +33 -0
  1138. package/dashboards/php/index.php +663 -381
  1139. package/dashboards/php/lib/api.php +37 -0
  1140. package/dashboards/php/lib/auth.php +47 -0
  1141. package/dashboards/php/lib/helpers.php +69 -0
  1142. package/dashboards/php/pages/agent-detail.php +552 -0
  1143. package/dashboards/php/pages/agents.php +185 -0
  1144. package/dashboards/php/pages/api-keys.php +34 -0
  1145. package/dashboards/php/pages/audit.php +31 -0
  1146. package/dashboards/php/pages/compliance.php +38 -0
  1147. package/dashboards/php/pages/dashboard.php +29 -0
  1148. package/dashboards/php/pages/dlp.php +65 -0
  1149. package/dashboards/php/pages/guardrails.php +70 -0
  1150. package/dashboards/php/pages/journal.php +53 -0
  1151. package/dashboards/php/pages/login.php +34 -0
  1152. package/dashboards/php/pages/messages.php +53 -0
  1153. package/dashboards/php/pages/settings.php +687 -0
  1154. package/dashboards/php/pages/skills.php +70 -0
  1155. package/dashboards/php/pages/users.php +37 -0
  1156. package/dashboards/php/pages/vault.php +70 -0
  1157. package/dashboards/php/public/styles.css +81 -0
  1158. package/dashboards/python/app.py +61 -259
  1159. package/dashboards/python/routes/__init__.py +0 -0
  1160. package/dashboards/python/routes/agents.py +296 -0
  1161. package/dashboards/python/routes/api_keys.py +49 -0
  1162. package/dashboards/python/routes/audit.py +33 -0
  1163. package/dashboards/python/routes/auth.py +30 -0
  1164. package/dashboards/python/routes/compliance.py +50 -0
  1165. package/dashboards/python/routes/dashboard.py +32 -0
  1166. package/dashboards/python/routes/dlp.py +64 -0
  1167. package/dashboards/python/routes/guardrails.py +79 -0
  1168. package/dashboards/python/routes/journal.py +40 -0
  1169. package/dashboards/python/routes/messages.py +46 -0
  1170. package/dashboards/python/routes/settings.py +260 -0
  1171. package/dashboards/python/routes/skills.py +59 -0
  1172. package/dashboards/python/routes/users.py +43 -0
  1173. package/dashboards/python/routes/vault.py +59 -0
  1174. package/dashboards/python/static/styles.css +288 -0
  1175. package/dashboards/python/templates/agent_detail.html +552 -0
  1176. package/dashboards/python/templates/agents.html +246 -0
  1177. package/dashboards/python/templates/api_keys.html +64 -0
  1178. package/dashboards/python/templates/audit.html +50 -0
  1179. package/dashboards/python/templates/compliance.html +74 -0
  1180. package/dashboards/python/templates/components/modal.html +43 -0
  1181. package/dashboards/python/templates/components/stats.html +26 -0
  1182. package/dashboards/python/templates/components/table.html +43 -0
  1183. package/dashboards/python/templates/dashboard.html +34 -0
  1184. package/dashboards/python/templates/dlp.html +159 -0
  1185. package/dashboards/python/templates/guardrails.html +131 -0
  1186. package/dashboards/python/templates/journal.html +66 -0
  1187. package/dashboards/python/templates/layout.html +86 -0
  1188. package/dashboards/python/templates/login.html +36 -0
  1189. package/dashboards/python/templates/messages.html +90 -0
  1190. package/dashboards/python/templates/settings.html +624 -0
  1191. package/dashboards/python/templates/skills.html +89 -0
  1192. package/dashboards/python/templates/users.html +70 -0
  1193. package/dashboards/python/templates/vault.html +73 -0
  1194. package/dashboards/python/utils/__init__.py +0 -0
  1195. package/dashboards/python/utils/api.py +35 -0
  1196. package/dashboards/python/utils/helpers.py +90 -0
  1197. package/dashboards/rails/app.rb +56 -0
  1198. package/dashboards/rails/helpers/api.rb +39 -0
  1199. package/dashboards/rails/helpers/auth.rb +11 -0
  1200. package/dashboards/rails/helpers/view.rb +95 -0
  1201. package/dashboards/rails/public/styles.css +299 -0
  1202. package/dashboards/rails/routes/agents.rb +173 -0
  1203. package/dashboards/rails/routes/api_keys.rb +30 -0
  1204. package/dashboards/rails/routes/audit.rb +15 -0
  1205. package/dashboards/rails/routes/auth.rb +29 -0
  1206. package/dashboards/rails/routes/compliance.rb +25 -0
  1207. package/dashboards/rails/routes/dashboard.rb +13 -0
  1208. package/dashboards/rails/routes/dlp.rb +40 -0
  1209. package/dashboards/rails/routes/guardrails.rb +51 -0
  1210. package/dashboards/rails/routes/journal.rb +24 -0
  1211. package/dashboards/rails/routes/messages.rb +22 -0
  1212. package/dashboards/rails/routes/settings.rb +196 -0
  1213. package/dashboards/rails/routes/skills.rb +38 -0
  1214. package/dashboards/rails/routes/users.rb +18 -0
  1215. package/dashboards/rails/routes/vault.rb +37 -0
  1216. package/dashboards/rails/views/agent_detail.erb +550 -0
  1217. package/dashboards/rails/views/agents.erb +214 -0
  1218. package/dashboards/rails/views/api_keys.erb +52 -0
  1219. package/dashboards/rails/views/audit.erb +38 -0
  1220. package/dashboards/rails/views/compliance.erb +69 -0
  1221. package/dashboards/rails/views/dashboard.erb +46 -0
  1222. package/dashboards/rails/views/dlp.erb +104 -0
  1223. package/dashboards/rails/views/guardrails.erb +107 -0
  1224. package/dashboards/rails/views/journal.erb +65 -0
  1225. package/dashboards/rails/views/layout.erb +53 -0
  1226. package/dashboards/rails/views/login.erb +47 -0
  1227. package/dashboards/rails/views/messages.erb +62 -0
  1228. package/dashboards/rails/views/settings.erb +578 -0
  1229. package/dashboards/rails/views/skills.erb +66 -0
  1230. package/dashboards/rails/views/users.erb +53 -0
  1231. package/dashboards/rails/views/vault.erb +66 -0
  1232. package/dashboards/ruby/app.rb +53 -182
  1233. package/dashboards/ruby/helpers/api.rb +63 -0
  1234. package/dashboards/ruby/helpers/auth.rb +20 -0
  1235. package/dashboards/ruby/helpers/view.rb +91 -0
  1236. package/dashboards/ruby/public/styles.css +294 -0
  1237. package/dashboards/ruby/routes/agents.rb +197 -0
  1238. package/dashboards/ruby/routes/api_keys.rb +43 -0
  1239. package/dashboards/ruby/routes/audit.rb +15 -0
  1240. package/dashboards/ruby/routes/auth.rb +29 -0
  1241. package/dashboards/ruby/routes/compliance.rb +28 -0
  1242. package/dashboards/ruby/routes/dashboard.rb +13 -0
  1243. package/dashboards/ruby/routes/dlp.rb +55 -0
  1244. package/dashboards/ruby/routes/guardrails.rb +77 -0
  1245. package/dashboards/ruby/routes/journal.rb +24 -0
  1246. package/dashboards/ruby/routes/messages.rb +27 -0
  1247. package/dashboards/ruby/routes/settings.rb +214 -0
  1248. package/dashboards/ruby/routes/skills.rb +50 -0
  1249. package/dashboards/ruby/routes/users.rb +26 -0
  1250. package/dashboards/ruby/routes/vault.rb +49 -0
  1251. package/dashboards/ruby/views/agent_detail.erb +550 -0
  1252. package/dashboards/ruby/views/agents.erb +214 -0
  1253. package/dashboards/ruby/views/api_keys.erb +59 -0
  1254. package/dashboards/ruby/views/audit.erb +38 -0
  1255. package/dashboards/ruby/views/compliance.erb +45 -0
  1256. package/dashboards/ruby/views/dashboard.erb +46 -0
  1257. package/dashboards/ruby/views/dlp.erb +88 -0
  1258. package/dashboards/ruby/views/guardrails.erb +103 -0
  1259. package/dashboards/ruby/views/journal.erb +53 -0
  1260. package/dashboards/ruby/views/layout.erb +52 -0
  1261. package/dashboards/ruby/views/login.erb +31 -0
  1262. package/dashboards/ruby/views/messages.erb +51 -0
  1263. package/dashboards/ruby/views/settings.erb +579 -0
  1264. package/dashboards/ruby/views/skills.erb +66 -0
  1265. package/dashboards/ruby/views/users.erb +53 -0
  1266. package/dashboards/ruby/views/vault.erb +66 -0
  1267. package/dashboards/shared/styles.css +322 -0
  1268. package/dist/{chunk-TVF23PUW.js → chunk-7FVRYOP4.js} +22 -7
  1269. package/dist/chunk-DRXMYYKN.js +79 -0
  1270. package/dist/chunk-E23VJ3QX.js +9427 -0
  1271. package/dist/chunk-EOBN6RCA.js +12652 -0
  1272. package/dist/chunk-FLRYMSKY.js +23 -0
  1273. package/dist/chunk-HAUHDCUB.js +764 -0
  1274. package/dist/chunk-HSF6OJ5Z.js +154 -0
  1275. package/dist/{chunk-PNKVD2UK.js → chunk-KFQGP6VL.js} +7 -0
  1276. package/dist/chunk-LKAFZ343.js +591 -0
  1277. package/dist/{chunk-GXIEEA2T.js → chunk-NTVN3JHS.js} +10 -10
  1278. package/dist/chunk-RO537U6H.js +70 -0
  1279. package/dist/chunk-SGBTJHEF.js +2287 -0
  1280. package/dist/chunk-SMUXH6FM.js +1943 -0
  1281. package/dist/chunk-TY7NVD4U.js +275 -0
  1282. package/dist/chunk-X6UVWFHW.js +3455 -0
  1283. package/dist/{chunk-7RGCCHIT.js → chunk-XMDE2NGH.js} +2 -1
  1284. package/dist/chunk-ZNR5DDTA.js +239 -0
  1285. package/dist/cidr-LISVZSM2.js +17 -0
  1286. package/dist/cli-build-skill-XOYECCLE.js +235 -0
  1287. package/dist/cli-recover-SSGGSKZJ.js +97 -0
  1288. package/dist/cli-submit-skill-RSBLF5XN.js +162 -0
  1289. package/dist/cli-validate-WJBUOEGW.js +148 -0
  1290. package/dist/cli-verify-V3GPFMWU.js +98 -0
  1291. package/dist/cli.js +50 -376
  1292. package/dist/config-store-CRMKWBON.js +58 -0
  1293. package/dist/dashboard/app.js +246 -0
  1294. package/dist/dashboard/assets/logo.png +0 -0
  1295. package/dist/dashboard/components/error-boundary.js +21 -0
  1296. package/dist/dashboard/components/help-button.js +34 -0
  1297. package/dist/dashboard/components/icons.js +53 -0
  1298. package/dist/dashboard/components/modal.js +124 -0
  1299. package/dist/dashboard/components/persona-fields.js +271 -0
  1300. package/dist/dashboard/components/settings-help.js +191 -0
  1301. package/dist/dashboard/components/tag-input.js +96 -0
  1302. package/dist/dashboard/components/utils.js +148 -0
  1303. package/dist/dashboard/index.html +407 -874
  1304. package/dist/dashboard/pages/activity.js +62 -0
  1305. package/dist/dashboard/pages/agent-detail.js +3577 -0
  1306. package/dist/dashboard/pages/agents.js +1072 -0
  1307. package/dist/dashboard/pages/approvals.js +81 -0
  1308. package/dist/dashboard/pages/audit.js +133 -0
  1309. package/dist/dashboard/pages/community-skills.js +665 -0
  1310. package/dist/dashboard/pages/compliance.js +81 -0
  1311. package/dist/dashboard/pages/dashboard.js +150 -0
  1312. package/dist/dashboard/pages/dlp.js +107 -0
  1313. package/dist/dashboard/pages/domain-status.js +123 -0
  1314. package/dist/dashboard/pages/guardrails.js +995 -0
  1315. package/dist/dashboard/pages/journal.js +51 -0
  1316. package/dist/dashboard/pages/knowledge-contributions.js +763 -0
  1317. package/dist/dashboard/pages/knowledge.js +46 -0
  1318. package/dist/dashboard/pages/login.js +491 -0
  1319. package/dist/dashboard/pages/messages.js +274 -0
  1320. package/dist/dashboard/pages/settings.js +1554 -0
  1321. package/dist/dashboard/pages/skill-connections.js +452 -0
  1322. package/dist/dashboard/pages/skills.js +433 -0
  1323. package/dist/dashboard/pages/users.js +49 -0
  1324. package/dist/dashboard/pages/vault.js +538 -0
  1325. package/dist/dashboard/pages/workforce.js +569 -0
  1326. package/dist/dashboard/vendor/react-dom.production.min.js +267 -0
  1327. package/dist/dashboard/vendor/react.production.min.js +31 -0
  1328. package/dist/db-adapter-5PWMLY67.js +7 -0
  1329. package/dist/domain-lock-URIFILHB.js +7 -0
  1330. package/dist/{dynamodb-CCGL2E77.js → dynamodb-CD3LREWD.js} +4 -4
  1331. package/dist/{factory-HINWFYZ3.js → factory-FVJH5RRY.js} +2 -2
  1332. package/dist/firewall-AHIRE6UB.js +10 -0
  1333. package/dist/index.js +133 -448
  1334. package/dist/{managed-RZITNPXG.js → managed-QVTONZ7E.js} +4 -2
  1335. package/dist/{mongodb-ODTXIVPV.js → mongodb-73MGW7LD.js} +4 -4
  1336. package/dist/{mysql-RM3S2FV5.js → mysql-A2RYNBQG.js} +59 -6
  1337. package/dist/{postgres-LN7A6MGQ.js → postgres-OE23X46P.js} +63 -6
  1338. package/dist/registry/cli.js +411 -0
  1339. package/dist/routes-NJK5OI5N.js +5673 -0
  1340. package/dist/runtime-SMA6JUMP.js +46 -0
  1341. package/dist/server-ZT5NWHT4.js +11 -0
  1342. package/dist/setup-RCYNX5NA.js +20 -0
  1343. package/dist/skills-QNR3CCHA.js +14 -0
  1344. package/dist/soul-templates.json +1525 -0
  1345. package/dist/{sqlite-VLKVAJA4.js → sqlite-SFVNZPHX.js} +56 -8
  1346. package/dist/{turso-LDWODSDI.js → turso-L6WQAY7U.js} +59 -6
  1347. package/package.json +11 -10
  1348. package/schemas/agenticmail-skill.v1.schema.json +180 -0
  1349. package/src/admin/routes.ts +536 -5
  1350. package/src/agent-tools/common.ts +232 -0
  1351. package/src/agent-tools/index.ts +246 -0
  1352. package/src/agent-tools/merge.ts +62 -0
  1353. package/src/agent-tools/middleware.ts +436 -0
  1354. package/src/agent-tools/security.ts +352 -0
  1355. package/src/agent-tools/tools/bash.ts +154 -0
  1356. package/src/agent-tools/tools/browser.ts +236 -0
  1357. package/src/agent-tools/tools/edit.ts +100 -0
  1358. package/src/agent-tools/tools/enterprise-calendar.ts +561 -0
  1359. package/src/agent-tools/tools/enterprise-code-sandbox.ts +395 -0
  1360. package/src/agent-tools/tools/enterprise-database.ts +377 -0
  1361. package/src/agent-tools/tools/enterprise-diff.ts +580 -0
  1362. package/src/agent-tools/tools/enterprise-documents.ts +896 -0
  1363. package/src/agent-tools/tools/enterprise-finance.ts +484 -0
  1364. package/src/agent-tools/tools/enterprise-http.ts +477 -0
  1365. package/src/agent-tools/tools/enterprise-knowledge-search.ts +369 -0
  1366. package/src/agent-tools/tools/enterprise-logs.ts +479 -0
  1367. package/src/agent-tools/tools/enterprise-notifications.ts +532 -0
  1368. package/src/agent-tools/tools/enterprise-security-scan.ts +528 -0
  1369. package/src/agent-tools/tools/enterprise-spreadsheet.ts +825 -0
  1370. package/src/agent-tools/tools/enterprise-translation.ts +530 -0
  1371. package/src/agent-tools/tools/enterprise-vision.ts +348 -0
  1372. package/src/agent-tools/tools/enterprise-web-research.ts +422 -0
  1373. package/src/agent-tools/tools/enterprise-workflow.ts +308 -0
  1374. package/src/agent-tools/tools/glob.ts +129 -0
  1375. package/src/agent-tools/tools/grep.ts +178 -0
  1376. package/src/agent-tools/tools/memory.ts +194 -0
  1377. package/src/agent-tools/tools/read.ts +160 -0
  1378. package/src/agent-tools/tools/web-fetch-utils.ts +202 -0
  1379. package/src/agent-tools/tools/web-fetch.ts +456 -0
  1380. package/src/agent-tools/tools/web-search.ts +480 -0
  1381. package/src/agent-tools/tools/web-shared.ts +232 -0
  1382. package/src/agent-tools/tools/write.ts +68 -0
  1383. package/src/agent-tools/types.ts +193 -0
  1384. package/src/auth/routes.ts +916 -51
  1385. package/src/cli.ts +74 -14
  1386. package/src/dashboard/app.js +246 -0
  1387. package/src/dashboard/assets/logo.png +0 -0
  1388. package/src/dashboard/components/error-boundary.js +21 -0
  1389. package/src/dashboard/components/help-button.js +34 -0
  1390. package/src/dashboard/components/icons.js +53 -0
  1391. package/src/dashboard/components/modal.js +124 -0
  1392. package/src/dashboard/components/persona-fields.js +271 -0
  1393. package/src/dashboard/components/settings-help.js +191 -0
  1394. package/src/dashboard/components/tag-input.js +96 -0
  1395. package/src/dashboard/components/utils.js +148 -0
  1396. package/src/dashboard/index.html +407 -874
  1397. package/src/dashboard/pages/activity.js +62 -0
  1398. package/src/dashboard/pages/agent-detail.js +3577 -0
  1399. package/src/dashboard/pages/agents.js +1072 -0
  1400. package/src/dashboard/pages/approvals.js +81 -0
  1401. package/src/dashboard/pages/audit.js +133 -0
  1402. package/src/dashboard/pages/community-skills.js +665 -0
  1403. package/src/dashboard/pages/compliance.js +81 -0
  1404. package/src/dashboard/pages/dashboard.js +150 -0
  1405. package/src/dashboard/pages/dlp.js +107 -0
  1406. package/src/dashboard/pages/domain-status.js +123 -0
  1407. package/src/dashboard/pages/guardrails.js +995 -0
  1408. package/src/dashboard/pages/journal.js +51 -0
  1409. package/src/dashboard/pages/knowledge-contributions.js +763 -0
  1410. package/src/dashboard/pages/knowledge.js +46 -0
  1411. package/src/dashboard/pages/login.js +491 -0
  1412. package/src/dashboard/pages/messages.js +274 -0
  1413. package/src/dashboard/pages/settings.js +1554 -0
  1414. package/src/dashboard/pages/skill-connections.js +452 -0
  1415. package/src/dashboard/pages/skills.js +433 -0
  1416. package/src/dashboard/pages/users.js +49 -0
  1417. package/src/dashboard/pages/vault.js +538 -0
  1418. package/src/dashboard/pages/workforce.js +569 -0
  1419. package/src/dashboard/vendor/react-dom.production.min.js +267 -0
  1420. package/src/dashboard/vendor/react.production.min.js +31 -0
  1421. package/src/db/adapter.ts +134 -1
  1422. package/src/db/dynamodb.ts +2 -2
  1423. package/src/db/mongodb.ts +2 -2
  1424. package/src/db/mysql.ts +55 -1
  1425. package/src/db/postgres.ts +59 -1
  1426. package/src/db/proxy.ts +39 -0
  1427. package/src/db/sql-schema.ts +2 -1
  1428. package/src/db/sqlite.ts +51 -3
  1429. package/src/db/turso.ts +55 -1
  1430. package/src/deploy/fly.ts +2 -2
  1431. package/src/deploy/managed.ts +32 -11
  1432. package/src/domain-lock/cli-recover.ts +124 -0
  1433. package/src/domain-lock/cli-verify.ts +122 -0
  1434. package/src/domain-lock/index.ts +220 -0
  1435. package/src/engine/activity-routes.ts +116 -0
  1436. package/src/engine/activity.ts +62 -2
  1437. package/src/engine/agent-config.ts +190 -24
  1438. package/src/engine/agent-memory.ts +1062 -0
  1439. package/src/engine/agent-routes.ts +379 -0
  1440. package/src/engine/approvals.ts +309 -2
  1441. package/src/engine/catalog-routes.ts +155 -0
  1442. package/src/engine/cli-build-skill.ts +285 -0
  1443. package/src/engine/cli-submit-skill.ts +200 -0
  1444. package/src/engine/cli-validate.ts +188 -0
  1445. package/src/engine/communication-routes.ts +139 -0
  1446. package/src/engine/communication.ts +759 -0
  1447. package/src/engine/community-registry.ts +1509 -0
  1448. package/src/engine/community-routes.ts +233 -0
  1449. package/src/engine/compliance-routes.ts +93 -0
  1450. package/src/engine/compliance.ts +325 -0
  1451. package/src/engine/db-adapter.ts +349 -1
  1452. package/src/engine/db-schema.ts +971 -23
  1453. package/src/engine/deploy-schema-routes.ts +176 -0
  1454. package/src/engine/deployer.ts +6 -6
  1455. package/src/engine/dlp-routes.ts +59 -0
  1456. package/src/engine/dlp.ts +231 -0
  1457. package/src/engine/guardrail-routes.ts +125 -0
  1458. package/src/engine/guardrails.ts +403 -0
  1459. package/src/engine/index.ts +131 -10
  1460. package/src/engine/journal-routes.ts +56 -0
  1461. package/src/engine/journal.ts +249 -0
  1462. package/src/engine/knowledge-contribution-routes.ts +385 -0
  1463. package/src/engine/knowledge-contribution.ts +1319 -0
  1464. package/src/engine/knowledge-routes.ts +68 -0
  1465. package/src/engine/knowledge.ts +73 -1
  1466. package/src/engine/lifecycle.ts +487 -31
  1467. package/src/engine/memory-routes.ts +142 -0
  1468. package/src/engine/oauth-connect-routes.ts +366 -0
  1469. package/src/engine/oauth-connect.ts +304 -0
  1470. package/src/engine/onboarding-routes.ts +140 -0
  1471. package/src/engine/onboarding.ts +574 -0
  1472. package/src/engine/org-approval-routes.ts +146 -0
  1473. package/src/engine/org-policies.ts +497 -0
  1474. package/src/engine/policy-import-routes.ts +125 -0
  1475. package/src/engine/policy-import.ts +1186 -0
  1476. package/src/engine/policy-routes.ts +163 -0
  1477. package/src/engine/routes.ts +239 -482
  1478. package/src/engine/skill-updater-routes.ts +132 -0
  1479. package/src/engine/skill-updater.ts +480 -0
  1480. package/src/engine/skill-validator.ts +331 -0
  1481. package/src/engine/skills/enterprise-calendar.ts +142 -0
  1482. package/src/engine/skills/enterprise-code-sandbox.ts +112 -0
  1483. package/src/engine/skills/enterprise-database.ts +122 -0
  1484. package/src/engine/skills/enterprise-diff.ts +94 -0
  1485. package/src/engine/skills/enterprise-documents.ts +161 -0
  1486. package/src/engine/skills/enterprise-finance.ts +109 -0
  1487. package/src/engine/skills/enterprise-http.ts +98 -0
  1488. package/src/engine/skills/enterprise-knowledge-search.ts +106 -0
  1489. package/src/engine/skills/enterprise-logs.ts +115 -0
  1490. package/src/engine/skills/enterprise-notifications.ts +119 -0
  1491. package/src/engine/skills/enterprise-security-scan.ts +124 -0
  1492. package/src/engine/skills/enterprise-spreadsheet.ts +170 -0
  1493. package/src/engine/skills/enterprise-translation.ts +111 -0
  1494. package/src/engine/skills/enterprise-vision.ts +107 -0
  1495. package/src/engine/skills/enterprise-web-research.ts +114 -0
  1496. package/src/engine/skills/enterprise-workflow.ts +109 -0
  1497. package/src/engine/skills/gws-admin.ts +17 -0
  1498. package/src/engine/skills/gws-calendar.ts +19 -0
  1499. package/src/engine/skills/gws-chat.ts +16 -0
  1500. package/src/engine/skills/gws-docs.ts +17 -0
  1501. package/src/engine/skills/gws-drive.ts +20 -0
  1502. package/src/engine/skills/gws-forms.ts +16 -0
  1503. package/src/engine/skills/gws-gmail.ts +20 -0
  1504. package/src/engine/skills/gws-groups.ts +16 -0
  1505. package/src/engine/skills/gws-keep.ts +16 -0
  1506. package/src/engine/skills/gws-meet.ts +16 -0
  1507. package/src/engine/skills/gws-sheets.ts +18 -0
  1508. package/src/engine/skills/gws-sites.ts +15 -0
  1509. package/src/engine/skills/gws-slides.ts +16 -0
  1510. package/src/engine/skills/gws-vault.ts +16 -0
  1511. package/src/engine/skills/index.ts +121 -0
  1512. package/src/engine/skills/m365-admin.ts +17 -0
  1513. package/src/engine/skills/m365-bookings.ts +16 -0
  1514. package/src/engine/skills/m365-copilot.ts +16 -0
  1515. package/src/engine/skills/m365-excel.ts +59 -0
  1516. package/src/engine/skills/m365-forms.ts +16 -0
  1517. package/src/engine/skills/m365-onedrive.ts +59 -0
  1518. package/src/engine/skills/m365-onenote.ts +16 -0
  1519. package/src/engine/skills/m365-outlook.ts +26 -0
  1520. package/src/engine/skills/m365-planner.ts +17 -0
  1521. package/src/engine/skills/m365-power-automate.ts +17 -0
  1522. package/src/engine/skills/m365-power-bi.ts +18 -0
  1523. package/src/engine/skills/m365-powerpoint.ts +32 -0
  1524. package/src/engine/skills/m365-sharepoint.ts +19 -0
  1525. package/src/engine/skills/m365-teams.ts +20 -0
  1526. package/src/engine/skills/m365-todo.ts +16 -0
  1527. package/src/engine/skills/m365-whiteboard.ts +15 -0
  1528. package/src/engine/skills/m365-word.ts +41 -0
  1529. package/src/engine/skills.ts +353 -17
  1530. package/src/engine/soul-library.ts +142 -0
  1531. package/src/engine/soul-templates.json +1525 -0
  1532. package/src/engine/storage-manager.ts +252 -0
  1533. package/src/engine/storage-routes.ts +113 -0
  1534. package/src/engine/storage.ts +528 -0
  1535. package/src/engine/tenant.ts +69 -5
  1536. package/src/engine/tool-catalog.ts +177 -13
  1537. package/src/engine/vault-routes.ts +130 -0
  1538. package/src/engine/vault.ts +544 -0
  1539. package/src/engine/workforce-routes.ts +282 -0
  1540. package/src/engine/workforce.ts +957 -0
  1541. package/src/index.ts +9 -1
  1542. package/src/lib/cidr.ts +122 -0
  1543. package/src/lib/config-store.ts +86 -0
  1544. package/src/mcp/adapters/activecampaign.adapter.ts +391 -0
  1545. package/src/mcp/adapters/adobe-sign.adapter.ts +469 -0
  1546. package/src/mcp/adapters/adp.adapter.ts +358 -0
  1547. package/src/mcp/adapters/airtable.adapter.ts +273 -0
  1548. package/src/mcp/adapters/apollo.adapter.ts +420 -0
  1549. package/src/mcp/adapters/asana.adapter.ts +315 -0
  1550. package/src/mcp/adapters/auth0.adapter.ts +386 -0
  1551. package/src/mcp/adapters/aws.adapter.ts +345 -0
  1552. package/src/mcp/adapters/azure-devops.adapter.ts +389 -0
  1553. package/src/mcp/adapters/bamboohr.adapter.ts +376 -0
  1554. package/src/mcp/adapters/basecamp.adapter.ts +366 -0
  1555. package/src/mcp/adapters/bigcommerce.adapter.ts +429 -0
  1556. package/src/mcp/adapters/bitbucket.adapter.ts +260 -0
  1557. package/src/mcp/adapters/box.adapter.ts +350 -0
  1558. package/src/mcp/adapters/brex.adapter.ts +367 -0
  1559. package/src/mcp/adapters/buffer.adapter.ts +303 -0
  1560. package/src/mcp/adapters/calendly.adapter.ts +262 -0
  1561. package/src/mcp/adapters/canva.adapter.ts +256 -0
  1562. package/src/mcp/adapters/chargebee.adapter.ts +448 -0
  1563. package/src/mcp/adapters/circleci.adapter.ts +216 -0
  1564. package/src/mcp/adapters/clickup.adapter.ts +335 -0
  1565. package/src/mcp/adapters/close.adapter.ts +390 -0
  1566. package/src/mcp/adapters/cloudflare.adapter.ts +377 -0
  1567. package/src/mcp/adapters/confluence.adapter.ts +301 -0
  1568. package/src/mcp/adapters/contentful.adapter.ts +355 -0
  1569. package/src/mcp/adapters/copper.adapter.ts +468 -0
  1570. package/src/mcp/adapters/crisp.adapter.ts +415 -0
  1571. package/src/mcp/adapters/crowdstrike.adapter.ts +413 -0
  1572. package/src/mcp/adapters/datadog.adapter.ts +373 -0
  1573. package/src/mcp/adapters/digitalocean.adapter.ts +336 -0
  1574. package/src/mcp/adapters/discord.adapter.ts +248 -0
  1575. package/src/mcp/adapters/docker.adapter.ts +238 -0
  1576. package/src/mcp/adapters/docusign.adapter.ts +431 -0
  1577. package/src/mcp/adapters/drift.adapter.ts +386 -0
  1578. package/src/mcp/adapters/dropbox.adapter.ts +315 -0
  1579. package/src/mcp/adapters/figma.adapter.ts +302 -0
  1580. package/src/mcp/adapters/firebase.adapter.ts +446 -0
  1581. package/src/mcp/adapters/flyio.adapter.ts +302 -0
  1582. package/src/mcp/adapters/freshbooks.adapter.ts +474 -0
  1583. package/src/mcp/adapters/freshdesk.adapter.ts +441 -0
  1584. package/src/mcp/adapters/freshsales.adapter.ts +457 -0
  1585. package/src/mcp/adapters/freshservice.adapter.ts +481 -0
  1586. package/src/mcp/adapters/front.adapter.ts +357 -0
  1587. package/src/mcp/adapters/github-actions.adapter.ts +329 -0
  1588. package/src/mcp/adapters/github.adapter.ts +387 -0
  1589. package/src/mcp/adapters/gitlab.adapter.ts +368 -0
  1590. package/src/mcp/adapters/gong.adapter.ts +386 -0
  1591. package/src/mcp/adapters/google-ads.adapter.ts +363 -0
  1592. package/src/mcp/adapters/google-analytics.adapter.ts +316 -0
  1593. package/src/mcp/adapters/google-cloud.adapter.ts +312 -0
  1594. package/src/mcp/adapters/google-drive.adapter.ts +387 -0
  1595. package/src/mcp/adapters/gotomeeting.adapter.ts +255 -0
  1596. package/src/mcp/adapters/grafana.adapter.ts +361 -0
  1597. package/src/mcp/adapters/greenhouse.adapter.ts +354 -0
  1598. package/src/mcp/adapters/gusto.adapter.ts +329 -0
  1599. package/src/mcp/adapters/hashicorp-vault.adapter.ts +355 -0
  1600. package/src/mcp/adapters/heroku.adapter.ts +291 -0
  1601. package/src/mcp/adapters/hibob.adapter.ts +334 -0
  1602. package/src/mcp/adapters/hootsuite.adapter.ts +322 -0
  1603. package/src/mcp/adapters/hubspot.adapter.ts +400 -0
  1604. package/src/mcp/adapters/huggingface.adapter.ts +349 -0
  1605. package/src/mcp/adapters/index.ts +530 -0
  1606. package/src/mcp/adapters/intercom.adapter.ts +269 -0
  1607. package/src/mcp/adapters/jira.adapter.ts +482 -0
  1608. package/src/mcp/adapters/klaviyo.adapter.ts +353 -0
  1609. package/src/mcp/adapters/kubernetes.adapter.ts +431 -0
  1610. package/src/mcp/adapters/lattice.adapter.ts +339 -0
  1611. package/src/mcp/adapters/launchdarkly.adapter.ts +368 -0
  1612. package/src/mcp/adapters/lever.adapter.ts +347 -0
  1613. package/src/mcp/adapters/linear.adapter.ts +300 -0
  1614. package/src/mcp/adapters/linkedin.adapter.ts +331 -0
  1615. package/src/mcp/adapters/livechat.adapter.ts +259 -0
  1616. package/src/mcp/adapters/loom.adapter.ts +230 -0
  1617. package/src/mcp/adapters/mailchimp.adapter.ts +394 -0
  1618. package/src/mcp/adapters/mailgun.adapter.ts +425 -0
  1619. package/src/mcp/adapters/microsoft-teams.adapter.ts +251 -0
  1620. package/src/mcp/adapters/miro.adapter.ts +274 -0
  1621. package/src/mcp/adapters/mixpanel.adapter.ts +324 -0
  1622. package/src/mcp/adapters/monday.adapter.ts +308 -0
  1623. package/src/mcp/adapters/mongodb-atlas.adapter.ts +345 -0
  1624. package/src/mcp/adapters/neon.adapter.ts +312 -0
  1625. package/src/mcp/adapters/netlify.adapter.ts +324 -0
  1626. package/src/mcp/adapters/netsuite.adapter.ts +411 -0
  1627. package/src/mcp/adapters/newrelic.adapter.ts +339 -0
  1628. package/src/mcp/adapters/notion.adapter.ts +338 -0
  1629. package/src/mcp/adapters/okta.adapter.ts +394 -0
  1630. package/src/mcp/adapters/openai.adapter.ts +315 -0
  1631. package/src/mcp/adapters/opsgenie.adapter.ts +375 -0
  1632. package/src/mcp/adapters/outreach.adapter.ts +372 -0
  1633. package/src/mcp/adapters/paddle.adapter.ts +467 -0
  1634. package/src/mcp/adapters/pagerduty.adapter.ts +412 -0
  1635. package/src/mcp/adapters/pandadoc.adapter.ts +389 -0
  1636. package/src/mcp/adapters/paypal.adapter.ts +465 -0
  1637. package/src/mcp/adapters/personio.adapter.ts +401 -0
  1638. package/src/mcp/adapters/pinecone.adapter.ts +340 -0
  1639. package/src/mcp/adapters/pipedrive.adapter.ts +324 -0
  1640. package/src/mcp/adapters/plaid.adapter.ts +444 -0
  1641. package/src/mcp/adapters/postmark.adapter.ts +387 -0
  1642. package/src/mcp/adapters/power-automate.adapter.ts +388 -0
  1643. package/src/mcp/adapters/quickbooks.adapter.ts +431 -0
  1644. package/src/mcp/adapters/recurly.adapter.ts +433 -0
  1645. package/src/mcp/adapters/reddit.adapter.ts +371 -0
  1646. package/src/mcp/adapters/render.adapter.ts +332 -0
  1647. package/src/mcp/adapters/ringcentral.adapter.ts +281 -0
  1648. package/src/mcp/adapters/rippling.adapter.ts +287 -0
  1649. package/src/mcp/adapters/salesforce.adapter.ts +321 -0
  1650. package/src/mcp/adapters/salesloft.adapter.ts +413 -0
  1651. package/src/mcp/adapters/sanity.adapter.ts +363 -0
  1652. package/src/mcp/adapters/sap.adapter.ts +483 -0
  1653. package/src/mcp/adapters/segment.adapter.ts +260 -0
  1654. package/src/mcp/adapters/sendgrid.adapter.ts +265 -0
  1655. package/src/mcp/adapters/sentry.adapter.ts +331 -0
  1656. package/src/mcp/adapters/servicenow.adapter.ts +468 -0
  1657. package/src/mcp/adapters/shopify.adapter.ts +451 -0
  1658. package/src/mcp/adapters/shortcut.adapter.ts +290 -0
  1659. package/src/mcp/adapters/slack.adapter.ts +380 -0
  1660. package/src/mcp/adapters/smartsheet.adapter.ts +326 -0
  1661. package/src/mcp/adapters/snowflake.adapter.ts +347 -0
  1662. package/src/mcp/adapters/snyk.adapter.ts +394 -0
  1663. package/src/mcp/adapters/splunk.adapter.ts +403 -0
  1664. package/src/mcp/adapters/square.adapter.ts +467 -0
  1665. package/src/mcp/adapters/statuspage.adapter.ts +401 -0
  1666. package/src/mcp/adapters/stripe.adapter.ts +380 -0
  1667. package/src/mcp/adapters/supabase.adapter.ts +334 -0
  1668. package/src/mcp/adapters/teamwork.adapter.ts +404 -0
  1669. package/src/mcp/adapters/telegram.adapter.ts +299 -0
  1670. package/src/mcp/adapters/terraform.adapter.ts +300 -0
  1671. package/src/mcp/adapters/todoist.adapter.ts +239 -0
  1672. package/src/mcp/adapters/trello.adapter.ts +316 -0
  1673. package/src/mcp/adapters/twilio.adapter.ts +233 -0
  1674. package/src/mcp/adapters/twitter.adapter.ts +348 -0
  1675. package/src/mcp/adapters/vercel.adapter.ts +219 -0
  1676. package/src/mcp/adapters/weaviate.adapter.ts +371 -0
  1677. package/src/mcp/adapters/webex.adapter.ts +237 -0
  1678. package/src/mcp/adapters/webflow.adapter.ts +287 -0
  1679. package/src/mcp/adapters/whatsapp.adapter.ts +273 -0
  1680. package/src/mcp/adapters/whereby.adapter.ts +240 -0
  1681. package/src/mcp/adapters/woocommerce.adapter.ts +454 -0
  1682. package/src/mcp/adapters/wordpress.adapter.ts +455 -0
  1683. package/src/mcp/adapters/workday.adapter.ts +354 -0
  1684. package/src/mcp/adapters/wrike.adapter.ts +349 -0
  1685. package/src/mcp/adapters/xero.adapter.ts +472 -0
  1686. package/src/mcp/adapters/youtube.adapter.ts +401 -0
  1687. package/src/mcp/adapters/zendesk.adapter.ts +399 -0
  1688. package/src/mcp/adapters/zoho-crm.adapter.ts +410 -0
  1689. package/src/mcp/adapters/zoom.adapter.ts +241 -0
  1690. package/src/mcp/adapters/zuora.adapter.ts +476 -0
  1691. package/src/mcp/framework/api-executor.ts +192 -0
  1692. package/src/mcp/framework/aws-sigv4.ts +216 -0
  1693. package/src/mcp/framework/credential-resolver.ts +128 -0
  1694. package/src/mcp/framework/skill-mcp-framework.ts +226 -0
  1695. package/src/mcp/framework/types.ts +130 -0
  1696. package/src/mcp/index.ts +124 -0
  1697. package/src/middleware/egress-filter.ts +81 -0
  1698. package/src/middleware/firewall.ts +121 -0
  1699. package/src/middleware/index.ts +33 -0
  1700. package/src/registry/cli.ts +63 -0
  1701. package/src/registry/server.ts +504 -0
  1702. package/src/runtime/agent-loop.ts +504 -0
  1703. package/src/runtime/email-channel.ts +120 -0
  1704. package/src/runtime/followup.ts +211 -0
  1705. package/src/runtime/gateway.ts +260 -0
  1706. package/src/runtime/hooks.ts +472 -0
  1707. package/src/runtime/index.ts +679 -0
  1708. package/src/runtime/llm-client.ts +1019 -0
  1709. package/src/runtime/providers.ts +231 -0
  1710. package/src/runtime/session-manager.ts +340 -0
  1711. package/src/runtime/subagent.ts +154 -0
  1712. package/src/runtime/tool-executor.ts +202 -0
  1713. package/src/runtime/types.ts +215 -0
  1714. package/src/server.ts +157 -45
  1715. package/src/setup/company.ts +127 -8
  1716. package/src/setup/database.ts +2 -1
  1717. package/src/setup/domain.ts +33 -4
  1718. package/src/setup/index.ts +19 -7
  1719. package/src/setup/provision.ts +128 -8
  1720. package/src/setup/registration.ts +227 -0
  1721. package/src/types/hono-env.ts +14 -0
  1722. package/src/types/optional-deps.d.ts +10 -0
  1723. package/dist/chunk-77IDQJL3.js +0 -7
  1724. package/dist/chunk-BE7MXVLA.js +0 -757
  1725. package/dist/chunk-BS2WCSHO.js +0 -48
  1726. package/dist/chunk-FL3VQBGL.js +0 -757
  1727. package/dist/chunk-IQWA44WT.js +0 -970
  1728. package/dist/chunk-N2JVTNNJ.js +0 -2553
  1729. package/dist/chunk-YFDSE4BW.js +0 -1355
  1730. package/dist/db-adapter-DEWEFNIV.js +0 -7
  1731. package/dist/factory-V37IG5AT.js +0 -9
  1732. package/dist/routes-2JEPIIKC.js +0 -441
  1733. package/dist/server-32YYCI3A.js +0 -8
  1734. package/dist/server-H3C6WUOS.js +0 -8
  1735. package/dist/sqlite-3K5YOZ4K.js +0 -439
  1736. package/live-test.mjs +0 -165
  1737. package/serve.mjs +0 -19
  1738. package/src/engine/agenticmail-bridge.ts +0 -296
  1739. package/src/engine/openclaw-hook.ts +0 -371
  1740. package/start-live.mjs +0 -39
  1741. package/test-integration.mjs +0 -383
@@ -0,0 +1,3577 @@
1
+ import { h, useState, useEffect, useCallback, Fragment, useApp, apiCall, engineCall, formatUptime, buildAgentDataMap, renderAgentBadge, showConfirm } from '../components/utils.js';
2
+ import { I } from '../components/icons.js';
3
+ import { DetailModal } from '../components/modal.js';
4
+ import { CULTURES, LANGUAGES, DEFAULT_TRAITS, computeAge, PersonaForm } from '../components/persona-fields.js';
5
+ import { TagInput } from '../components/tag-input.js';
6
+
7
+ // ════════════════════════════════════════════════════════════
8
+ // HELPERS
9
+ // ════════════════════════════════════════════════════════════
10
+
11
+ function Badge(props) {
12
+ return h('span', {
13
+ style: { display: 'inline-block', padding: '2px 8px', borderRadius: 4, fontSize: 11, fontWeight: 600, color: '#fff', background: props.color || '#64748b', whiteSpace: 'nowrap' }
14
+ }, props.children);
15
+ }
16
+
17
+ function StatCard(props) {
18
+ return h('div', { className: 'stat-card' },
19
+ h('div', { className: 'stat-label' }, props.label),
20
+ h('div', { className: 'stat-value', style: props.color ? { color: props.color } : null }, props.value),
21
+ props.sub && h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginTop: 2 } }, props.sub)
22
+ );
23
+ }
24
+
25
+ function ProgressBar(props) {
26
+ var pct = props.total > 0 ? Math.round((props.value / props.total) * 100) : 0;
27
+ var barColor = pct < 50 ? 'var(--success)' : pct < 80 ? 'var(--warning)' : 'var(--danger)';
28
+ return h('div', { style: { marginBottom: 12 } },
29
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', fontSize: 12, marginBottom: 4 } },
30
+ h('span', { style: { color: 'var(--text-secondary)' } }, props.label),
31
+ h('span', { style: { color: 'var(--text-muted)' } }, props.value + ' / ' + props.total + (props.unit ? ' ' + props.unit : ''))
32
+ ),
33
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, width: '100%' } },
34
+ h('div', { style: { flex: 1, height: 8, background: 'var(--border)', borderRadius: 4, overflow: 'hidden' } },
35
+ h('div', { style: { width: Math.min(pct, 100) + '%', height: '100%', background: barColor, borderRadius: 4, transition: 'width 0.3s' } })
36
+ ),
37
+ h('span', { style: { fontSize: 12, color: 'var(--text-muted)', minWidth: 40 } }, pct + '%')
38
+ )
39
+ );
40
+ }
41
+
42
+ function EmptyState(props) {
43
+ return h('div', { style: { textAlign: 'center', padding: '40px 20px', color: 'var(--text-muted)' } },
44
+ props.icon && h('div', { style: { fontSize: 32, marginBottom: 8, opacity: 0.5 } }, props.icon),
45
+ h('div', { style: { fontSize: 14, marginBottom: 8 } }, props.message || 'No data'),
46
+ props.action && h('button', { className: 'btn btn-primary btn-sm', onClick: props.action.onClick }, props.action.label)
47
+ );
48
+ }
49
+
50
+ function formatNumber(n) {
51
+ if (n == null) return '0';
52
+ if (n >= 1000000) return (n / 1000000).toFixed(1) + 'M';
53
+ if (n >= 1000) return (n / 1000).toFixed(1) + 'K';
54
+ return String(n);
55
+ }
56
+
57
+ function formatCost(n) {
58
+ if (n == null) return '$0.00';
59
+ return '$' + Number(n).toFixed(4);
60
+ }
61
+
62
+ function riskBadgeClass(level) {
63
+ if (!level) return 'badge badge-neutral';
64
+ var l = level.toLowerCase();
65
+ if (l === 'low') return 'badge badge-success';
66
+ if (l === 'medium') return 'badge badge-warning';
67
+ if (l === 'high' || l === 'critical') return 'badge badge-danger';
68
+ return 'badge badge-neutral';
69
+ }
70
+
71
+ // ════════════════════════════════════════════════════════════
72
+ // OVERVIEW SECTION
73
+ // ════════════════════════════════════════════════════════════
74
+
75
+ function formatTime(iso) { return iso ? new Date(iso).toLocaleString() : '-'; }
76
+
77
+ var MEMORY_CATEGORIES = [
78
+ { value: 'org_knowledge', label: 'Org Knowledge', color: '#6366f1' },
79
+ { value: 'interaction_pattern', label: 'Interaction Pattern', color: '#0ea5e9' },
80
+ { value: 'preference', label: 'Preference', color: '#10b981' },
81
+ { value: 'correction', label: 'Correction', color: '#f59e0b' },
82
+ { value: 'skill', label: 'Skill', color: '#8b5cf6' },
83
+ { value: 'context', label: 'Context', color: '#64748b' },
84
+ { value: 'reflection', label: 'Reflection', color: '#ec4899' },
85
+ ];
86
+
87
+ function memCatColor(cat) { var f = MEMORY_CATEGORIES.find(function(c) { return c.value === cat; }); return f ? f.color : '#64748b'; }
88
+ function memCatLabel(cat) { var f = MEMORY_CATEGORIES.find(function(c) { return c.value === cat; }); return f ? f.label : cat; }
89
+ function importanceBadgeColor(imp) { return imp === 'critical' ? '#ef4444' : imp === 'high' ? '#f97316' : imp === 'normal' ? '#0ea5e9' : '#64748b'; }
90
+
91
+ var CATEGORY_COLORS = {
92
+ code_of_conduct: '#6366f1', communication: '#0ea5e9', data_handling: '#f59e0b',
93
+ brand_voice: '#ec4899', security: '#ef4444', escalation: '#8b5cf6', custom: '#64748b'
94
+ };
95
+ var ENFORCEMENT_COLORS = { mandatory: '#ef4444', recommended: '#f59e0b', informational: '#0ea5e9' };
96
+
97
+ // ════════════════════════════════════════════════════════════
98
+ // OVERVIEW SECTION
99
+ // ════════════════════════════════════════════════════════════
100
+
101
+ function OverviewSection(props) {
102
+ var agent = props.agent;
103
+ var engineAgent = props.engineAgent;
104
+ var profile = props.profile;
105
+ var agentId = props.agentId;
106
+ var reload = props.reload;
107
+ var agents = props.agents;
108
+
109
+ var app = useApp();
110
+ var toast = app.toast;
111
+
112
+ var _usage = useState(null);
113
+ var usageData = _usage[0]; var setUsageData = _usage[1];
114
+ var _onb = useState(null);
115
+ var onboardingStatus = _onb[0]; var setOnboardingStatus = _onb[1];
116
+ var _guard = useState(null);
117
+ var guardrailStatus = _guard[0]; var setGuardrailStatus = _guard[1];
118
+ var _work = useState(null);
119
+ var workforceStatus = _work[0]; var setWorkforceStatus = _work[1];
120
+ var _loading = useState(true);
121
+ var loading = _loading[0]; var setLoading = _loading[1];
122
+ var _acting = useState('');
123
+ var acting = _acting[0]; var setActing = _acting[1];
124
+
125
+ useEffect(function() {
126
+ setLoading(true);
127
+ Promise.all([
128
+ engineCall('/agents/' + agentId + '/usage').catch(function() { return null; }),
129
+ engineCall('/onboarding/status/' + agentId).catch(function() { return null; }),
130
+ engineCall('/guardrails/status/' + agentId).catch(function() { return null; }),
131
+ engineCall('/workforce/status/' + agentId).catch(function() { return null; })
132
+ ]).then(function(results) {
133
+ setUsageData(results[0]);
134
+ setOnboardingStatus(results[1]);
135
+ setGuardrailStatus(results[2]);
136
+ setWorkforceStatus(results[3]);
137
+ setLoading(false);
138
+ });
139
+ }, [agentId]);
140
+
141
+ // ─── Action Handlers ───────────────────────────────────
142
+
143
+ var doAction = function(action) {
144
+ setActing(action);
145
+ engineCall('/agents/' + agentId + '/' + action, { method: 'POST' })
146
+ .then(function() { toast('Agent ' + action + ' successful', 'success'); reload(); })
147
+ .catch(function(err) { toast(err.message, 'error'); })
148
+ .finally(function() { setActing(''); });
149
+ };
150
+
151
+ var pauseAgent = function() {
152
+ setActing('pause');
153
+ engineCall('/guardrails/pause/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual pause from dashboard' }) })
154
+ .then(function() { toast('Agent paused', 'success'); setGuardrailStatus(function(s) { return Object.assign({}, s, { paused: true }); }); reload(); })
155
+ .catch(function(err) { toast(err.message, 'error'); })
156
+ .finally(function() { setActing(''); });
157
+ };
158
+
159
+ var resumeAgent = function() {
160
+ setActing('resume');
161
+ engineCall('/guardrails/resume/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual resume from dashboard' }) })
162
+ .then(function() { toast('Agent resumed', 'success'); setGuardrailStatus(function(s) { return Object.assign({}, s, { paused: false }); }); reload(); })
163
+ .catch(function(err) { toast(err.message, 'error'); })
164
+ .finally(function() { setActing(''); });
165
+ };
166
+
167
+ var clockIn = function() {
168
+ setActing('clockIn');
169
+ engineCall('/workforce/clock-in/' + agentId, { method: 'POST' })
170
+ .then(function() { toast('Agent clocked in', 'success'); setWorkforceStatus(function(s) { return Object.assign({}, s, { clockedIn: true }); }); reload(); })
171
+ .catch(function(err) { toast(err.message, 'error'); })
172
+ .finally(function() { setActing(''); });
173
+ };
174
+
175
+ var clockOut = function() {
176
+ setActing('clockOut');
177
+ engineCall('/workforce/clock-out/' + agentId, { method: 'POST' })
178
+ .then(function() { toast('Agent clocked out', 'success'); setWorkforceStatus(function(s) { return Object.assign({}, s, { clockedIn: false }); }); reload(); })
179
+ .catch(function(err) { toast(err.message, 'error'); })
180
+ .finally(function() { setActing(''); });
181
+ };
182
+
183
+ var deleteAgent = async function() {
184
+ var ok = await showConfirm({
185
+ title: 'Delete Agent',
186
+ message: 'Are you sure you want to delete agent "' + (engineAgent?.name || agentId) + '"? This will remove all associated data.',
187
+ warning: 'This action cannot be undone.',
188
+ danger: true,
189
+ confirmText: 'Delete Agent'
190
+ });
191
+ if (!ok) return;
192
+ setActing('delete');
193
+ try {
194
+ await apiCall('/bridge/agents/' + agentId, { method: 'DELETE' });
195
+ toast('Agent deleted', 'success');
196
+ if (props.onBack) props.onBack();
197
+ } catch (err) {
198
+ toast(err.message, 'error');
199
+ }
200
+ setActing('');
201
+ };
202
+
203
+ var initiateOnboarding = function() {
204
+ setActing('onboard');
205
+ engineCall('/onboarding/initiate/' + agentId, { method: 'POST', body: JSON.stringify({ orgId: 'default' }) })
206
+ .then(function() { toast('Onboarding initiated', 'success'); setOnboardingStatus(function(s) { return Object.assign({}, s, { onboarded: true, status: 'in_progress' }); }); reload(); })
207
+ .catch(function(err) { toast(err.message, 'error'); })
208
+ .finally(function() { setActing(''); });
209
+ };
210
+
211
+ // ─── Derived Values ─────────────────────────────────────
212
+
213
+ var config = engineAgent?.config || {};
214
+ var identity = config.identity || {};
215
+ var agentName = identity.name || engineAgent?.name || 'Unnamed Agent';
216
+ var agentRole = identity.role || config.role || 'agent';
217
+ var agentModel = typeof config.model === 'string' ? config.model : (config.model ? (config.model.modelId || config.model.provider || 'unknown') : 'unknown');
218
+ var agentDesc = identity.description || config.description || '';
219
+ var createdAt = engineAgent?.createdAt || engineAgent?.created_at || agent?.createdAt;
220
+ var agentState = engineAgent?.state || engineAgent?.status || agent?.status || 'unknown';
221
+ var stateColor = { running: 'success', active: 'success', deploying: 'info', starting: 'info', ready: 'primary', degraded: 'warning', error: 'danger', stopped: 'neutral', draft: 'neutral' }[agentState] || 'neutral';
222
+
223
+ // Personality traits — can be object (keyed) or array
224
+ var rawTraits = identity.personality_traits || identity.traits || config.personality_traits || {};
225
+ var traitList = Array.isArray(rawTraits) ? rawTraits : Object.values(rawTraits);
226
+
227
+ var tokensToday = usageData?.tokensToday || usageData?.today?.tokens || 0;
228
+ var costToday = usageData?.costToday || usageData?.today?.cost || 0;
229
+ var uptime = usageData?.uptime || usageData?.uptimeSeconds || 0;
230
+ var errorRate = usageData?.errorRate || usageData?.today?.errorRate || 0;
231
+ var activeSessions = usageData?.activeSessions || usageData?.sessions?.active || 0;
232
+
233
+ if (loading) {
234
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading overview...');
235
+ }
236
+
237
+ return h(Fragment, null,
238
+
239
+ // ─── Agent Summary Card ─────────────────────────────
240
+ h('div', { className: 'card', style: { marginBottom: 20 } },
241
+ h('div', { className: 'card-body' },
242
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr 1fr 1fr', gap: 16 } },
243
+ h('div', null,
244
+ h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4, textTransform: 'uppercase', letterSpacing: '0.05em', fontWeight: 600 } }, 'Status'),
245
+ h('span', { className: 'badge badge-' + stateColor, style: { textTransform: 'capitalize' } }, agentState)
246
+ ),
247
+ h('div', null,
248
+ h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4, textTransform: 'uppercase', letterSpacing: '0.05em', fontWeight: 600 } }, 'Role'),
249
+ h('span', { style: { fontSize: 13, fontWeight: 500, textTransform: 'capitalize' } }, agentRole)
250
+ ),
251
+ h('div', null,
252
+ h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4, textTransform: 'uppercase', letterSpacing: '0.05em', fontWeight: 600 } }, 'Model'),
253
+ h('span', { style: { fontSize: 13, fontWeight: 500, fontFamily: 'var(--font-mono, monospace)' } }, agentModel)
254
+ ),
255
+ h('div', null,
256
+ h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4, textTransform: 'uppercase', letterSpacing: '0.05em', fontWeight: 600 } }, 'Created'),
257
+ h('span', { style: { fontSize: 13, fontWeight: 500 } }, createdAt ? new Date(createdAt).toLocaleDateString() : '—')
258
+ )
259
+ ),
260
+ agentDesc && h('div', { style: { marginTop: 14, paddingTop: 14, borderTop: '1px solid var(--border)', fontSize: 13, color: 'var(--text-secondary)', lineHeight: 1.6 } }, agentDesc),
261
+ traitList.length > 0 && h('div', { style: { marginTop: 12, display: 'flex', flexWrap: 'wrap', gap: 6 } },
262
+ traitList.map(function(trait, i) {
263
+ return h('span', { key: i, className: 'badge badge-neutral', style: { fontSize: 11, textTransform: 'capitalize' } }, String(trait));
264
+ })
265
+ )
266
+ )
267
+ ),
268
+
269
+ // ─── Stats Grid ─────────────────────────────────────
270
+ h('div', { className: 'stat-grid', style: { marginBottom: 20 } },
271
+ h(StatCard, { label: 'Tokens Today', value: formatNumber(tokensToday) }),
272
+ h(StatCard, { label: 'Cost Today', value: formatCost(costToday) }),
273
+ h(StatCard, { label: 'Uptime', value: formatUptime(uptime) }),
274
+ h(StatCard, { label: 'Error Rate', value: (errorRate * 100).toFixed(1) + '%', color: errorRate > 0.05 ? 'var(--danger)' : undefined }),
275
+ h(StatCard, { label: 'Active Sessions', value: String(activeSessions) })
276
+ ),
277
+
278
+ // ─── Status Indicators ──────────────────────────────
279
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 16, marginBottom: 20 } },
280
+
281
+ // Onboarding Status
282
+ h('div', { className: 'card' },
283
+ h('div', { className: 'card-header' }, h('span', null, 'Onboarding')),
284
+ h('div', { className: 'card-body' },
285
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 } },
286
+ onboardingStatus?.onboarded
287
+ ? h('span', { className: 'badge badge-success' }, I.check(), ' Onboarded')
288
+ : h('span', { className: 'badge badge-warning' }, 'Not Onboarded')
289
+ ),
290
+ onboardingStatus?.status && h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 8 } }, 'Status: ' + onboardingStatus.status),
291
+ !onboardingStatus?.onboarded && h('button', {
292
+ className: 'btn btn-primary btn-sm',
293
+ disabled: acting === 'onboard',
294
+ onClick: initiateOnboarding
295
+ }, acting === 'onboard' ? 'Starting...' : 'Start Onboarding')
296
+ )
297
+ ),
298
+
299
+ // Guardrails Status
300
+ h('div', { className: 'card' },
301
+ h('div', { className: 'card-header' }, h('span', null, 'Guardrails')),
302
+ h('div', { className: 'card-body' },
303
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 } },
304
+ guardrailStatus?.paused
305
+ ? h('span', { className: 'badge badge-warning' }, I.pause(), ' Paused')
306
+ : h('span', { className: 'badge badge-success' }, I.shield(), ' Active')
307
+ ),
308
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)' } },
309
+ 'Interventions: ', h('strong', null, String(guardrailStatus?.interventionCount || guardrailStatus?.interventions || 0))
310
+ )
311
+ )
312
+ ),
313
+
314
+ // Workforce Status
315
+ h('div', { className: 'card' },
316
+ h('div', { className: 'card-header' }, h('span', null, 'Workforce')),
317
+ h('div', { className: 'card-body' },
318
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 } },
319
+ workforceStatus?.clockedIn
320
+ ? h('span', { className: 'badge badge-success' }, I.check(), ' Clocked In')
321
+ : h('span', { className: 'badge badge-neutral' }, I.clock(), ' Clocked Out')
322
+ ),
323
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)' } },
324
+ 'Active Tasks: ', h('strong', null, String(workforceStatus?.taskCount || workforceStatus?.activeTasks || 0))
325
+ )
326
+ )
327
+ )
328
+ ),
329
+
330
+ // ─── Quick Actions Bar ──────────────────────────────
331
+ h('div', { className: 'card', style: { marginBottom: 20 } },
332
+ h('div', { className: 'card-header' }, h('span', null, 'Quick Actions')),
333
+ h('div', { className: 'card-body', style: { display: 'flex', flexWrap: 'wrap', gap: 10 } },
334
+
335
+ // Deploy / Stop / Restart
336
+ (agentState !== 'running' && agentState !== 'active') && h('button', {
337
+ className: 'btn btn-primary btn-sm',
338
+ disabled: !!acting,
339
+ onClick: function() { doAction('deploy'); }
340
+ }, I.play(), ' Deploy'),
341
+
342
+ (agentState === 'running' || agentState === 'active') && h('button', {
343
+ className: 'btn btn-danger btn-sm',
344
+ disabled: !!acting,
345
+ onClick: function() { doAction('stop'); }
346
+ }, I.stop(), ' Stop'),
347
+
348
+ (agentState === 'running' || agentState === 'active' || agentState === 'stopped') && h('button', {
349
+ className: 'btn btn-secondary btn-sm',
350
+ disabled: !!acting,
351
+ onClick: function() { doAction('restart'); }
352
+ }, I.refresh(), ' Restart'),
353
+
354
+ // Pause / Resume
355
+ guardrailStatus && !guardrailStatus.paused && h('button', {
356
+ className: 'btn btn-secondary btn-sm',
357
+ disabled: !!acting,
358
+ onClick: pauseAgent
359
+ }, I.pause(), ' Pause'),
360
+
361
+ guardrailStatus && guardrailStatus.paused && h('button', {
362
+ className: 'btn btn-secondary btn-sm',
363
+ disabled: !!acting,
364
+ onClick: resumeAgent
365
+ }, I.play(), ' Resume'),
366
+
367
+ // Clock In / Out
368
+ workforceStatus && !workforceStatus.clockedIn && h('button', {
369
+ className: 'btn btn-secondary btn-sm',
370
+ disabled: !!acting,
371
+ onClick: clockIn
372
+ }, I.clock(), ' Clock In'),
373
+
374
+ workforceStatus && workforceStatus.clockedIn && h('button', {
375
+ className: 'btn btn-secondary btn-sm',
376
+ disabled: !!acting,
377
+ onClick: clockOut
378
+ }, I.clock(), ' Clock Out'),
379
+
380
+ // Spacer
381
+ h('div', { style: { flex: 1 } }),
382
+
383
+ // Delete
384
+ h('button', {
385
+ className: 'btn btn-danger btn-sm',
386
+ disabled: acting === 'delete',
387
+ onClick: deleteAgent
388
+ }, I.trash(), ' Delete Agent')
389
+ )
390
+ )
391
+ );
392
+ }
393
+
394
+ // ════════════════════════════════════════════════════════════
395
+ // PERSONAL DETAILS SECTION
396
+ // ════════════════════════════════════════════════════════════
397
+
398
+ var ROLE_OPTIONS = ['agent', 'assistant', 'manager', 'specialist', 'analyst', 'coordinator', 'advisor', 'support', 'engineer', 'other'];
399
+
400
+ function PersonalDetailsSection(props) {
401
+ var agentId = props.agentId;
402
+ var engineAgent = props.engineAgent;
403
+ var reload = props.reload;
404
+ var toast = useApp().toast;
405
+
406
+ var ea = engineAgent || {};
407
+ var config = ea.config || {};
408
+ var identity = config.identity || {};
409
+
410
+ var _editing = useState(false);
411
+ var editing = _editing[0]; var setEditing = _editing[1];
412
+ var _saving = useState(false);
413
+ var saving = _saving[0]; var setSaving = _saving[1];
414
+
415
+ // Build form state from current config
416
+ var _form = useState({});
417
+ var form = _form[0]; var setForm = _form[1];
418
+
419
+ // Initialize form when entering edit mode
420
+ var startEdit = function() {
421
+ setForm({
422
+ name: identity.name || config.name || config.displayName || ea.name || '',
423
+ displayName: config.displayName || identity.name || '',
424
+ email: identity.email || config.email || ea.email || '',
425
+ role: identity.role || config.role || 'agent',
426
+ avatar: identity.avatar || null,
427
+ gender: identity.gender || '',
428
+ dateOfBirth: identity.dateOfBirth || '',
429
+ maritalStatus: identity.maritalStatus || '',
430
+ culturalBackground: identity.culturalBackground || '',
431
+ language: identity.language || 'en-us',
432
+ description: identity.description || config.description || '',
433
+ traits: identity.traits && typeof identity.traits === 'object' && !Array.isArray(identity.traits)
434
+ ? Object.assign({}, DEFAULT_TRAITS, identity.traits)
435
+ : Object.assign({}, DEFAULT_TRAITS),
436
+ });
437
+ setEditing(true);
438
+ };
439
+
440
+ var set = function(key, value) {
441
+ setForm(function(prev) {
442
+ var next = Object.assign({}, prev);
443
+ next[key] = value;
444
+ return next;
445
+ });
446
+ };
447
+
448
+ var saveDetails = function() {
449
+ setSaving(true);
450
+ var updates = {
451
+ name: form.name,
452
+ displayName: form.displayName,
453
+ email: form.email,
454
+ description: form.description,
455
+ identity: Object.assign({}, identity, {
456
+ role: form.role,
457
+ avatar: form.avatar,
458
+ gender: form.gender,
459
+ dateOfBirth: form.dateOfBirth,
460
+ maritalStatus: form.maritalStatus,
461
+ culturalBackground: form.culturalBackground,
462
+ language: form.language,
463
+ description: form.description,
464
+ traits: form.traits,
465
+ name: form.name,
466
+ email: form.email,
467
+ }),
468
+ };
469
+
470
+ // Use hot-update if running, else regular config update
471
+ var isRunning = ea.state === 'running' || ea.state === 'active' || ea.state === 'degraded';
472
+ var endpoint = isRunning
473
+ ? '/agents/' + agentId + '/hot-update'
474
+ : '/agents/' + agentId + '/config';
475
+ var method = isRunning ? 'POST' : 'PATCH';
476
+
477
+ engineCall(endpoint, {
478
+ method: method,
479
+ body: JSON.stringify({ updates: updates, updatedBy: 'dashboard' })
480
+ }).then(function() {
481
+ toast('Personal details saved', 'success');
482
+ setEditing(false);
483
+ setSaving(false);
484
+ reload();
485
+ }).catch(function(err) {
486
+ toast('Failed to save: ' + err.message, 'error');
487
+ setSaving(false);
488
+ });
489
+ };
490
+
491
+ // ─── Display helpers ───────────────────────────────────
492
+
493
+ var inputStyle = { width: '100%', padding: '8px 10px', borderRadius: 6, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', fontSize: 13 };
494
+ var labelStyle = { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 };
495
+ var fieldGroupStyle = { marginBottom: 16 };
496
+ var rowStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 };
497
+ var selectStyle = Object.assign({}, inputStyle, { cursor: 'pointer' });
498
+
499
+ // ─── View Mode ─────────────────────────────────────────
500
+
501
+ if (!editing) {
502
+ var displayName = identity.name || config.name || config.displayName || ea.name || '—';
503
+ var displayDisplayName = config.displayName || identity.name || '—';
504
+ var displayEmail = identity.email || config.email || ea.email || '—';
505
+ var displayRole = identity.role || config.role || 'agent';
506
+ var displayAvatar = identity.avatar || '';
507
+ var displayGender = identity.gender || '—';
508
+ var displayDob = identity.dateOfBirth || '—';
509
+ var displayMarital = identity.maritalStatus || '—';
510
+ var displayCulture = identity.culturalBackground || '';
511
+ var displayLang = identity.language || '—';
512
+ var displayDesc = identity.description || config.description || '—';
513
+ var displayTraits = identity.traits && typeof identity.traits === 'object' && !Array.isArray(identity.traits) ? identity.traits : {};
514
+ var age = computeAge(identity.dateOfBirth);
515
+
516
+ var cultureName = displayCulture ? (CULTURES.find(function(c) { return c.id === displayCulture; }) || {}).name || displayCulture : '—';
517
+ var langName = displayLang !== '—' ? (LANGUAGES.find(function(l) { return l.id === displayLang; }) || {}).name || displayLang : '—';
518
+
519
+ var fieldView = function(label, value) {
520
+ return h('div', { style: fieldGroupStyle },
521
+ h('div', { style: labelStyle }, label),
522
+ h('div', { style: { fontSize: 14, color: 'var(--text-primary)' } }, value)
523
+ );
524
+ };
525
+
526
+ return h(Fragment, null,
527
+ // Header with Edit button
528
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
529
+ h('h3', { style: { margin: 0, fontSize: 16, fontWeight: 600 } }, 'Personal Details'),
530
+ h('button', { className: 'btn btn-primary btn-sm', onClick: startEdit }, I.journal(), ' Edit Details')
531
+ ),
532
+
533
+ // Avatar + Identity Card
534
+ h('div', { className: 'card', style: { marginBottom: 20 } },
535
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 20, padding: 20 } },
536
+ h('div', { style: {
537
+ width: 80, height: 80, borderRadius: '50%', flexShrink: 0,
538
+ background: displayAvatar && displayAvatar.length > 2 ? 'none' : 'var(--accent)',
539
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
540
+ fontSize: 32, fontWeight: 700, color: '#fff', overflow: 'hidden',
541
+ border: '3px solid var(--border)'
542
+ } },
543
+ displayAvatar && displayAvatar.length > 2
544
+ ? h('img', { src: displayAvatar, style: { width: '100%', height: '100%', objectFit: 'cover' } })
545
+ : (displayName !== '—' ? displayName.charAt(0).toUpperCase() : '?')
546
+ ),
547
+ h('div', { style: { flex: 1 } },
548
+ h('div', { style: { fontSize: 22, fontWeight: 700, marginBottom: 4 } }, displayName),
549
+ displayDisplayName !== '—' && h('div', { style: { fontSize: 14, color: 'var(--text-secondary)', marginBottom: 4 } }, displayDisplayName),
550
+ h('div', { style: { fontSize: 13, fontFamily: 'var(--font-mono, monospace)', color: 'var(--text-muted)', marginBottom: 6 } }, displayEmail),
551
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
552
+ h('span', { className: 'badge badge-primary', style: { textTransform: 'capitalize' } }, displayRole),
553
+ age !== null && h('span', { style: { padding: '2px 10px', background: 'var(--accent-soft)', borderRadius: 'var(--radius)', fontSize: 12, fontWeight: 600, color: 'var(--accent-text)' } }, age + ' years old')
554
+ )
555
+ )
556
+ )
557
+ ),
558
+
559
+ // Identity Details Grid
560
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
561
+ h('h4', { style: { margin: '0 0 16px', fontSize: 14, fontWeight: 600 } }, 'Identity Details'),
562
+ h('div', { style: rowStyle },
563
+ fieldView('Gender', displayGender),
564
+ fieldView('Date of Birth', displayDob !== '—' ? displayDob + (age !== null ? ' (' + age + ' years old)' : '') : '—')
565
+ ),
566
+ h('div', { style: rowStyle },
567
+ fieldView('Marital Status', displayMarital),
568
+ fieldView('Language', langName)
569
+ ),
570
+ fieldView('Cultural Background', cultureName)
571
+ ),
572
+
573
+ // Description
574
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
575
+ h('h4', { style: { margin: '0 0 16px', fontSize: 14, fontWeight: 600 } }, 'Description'),
576
+ fieldView('Description', displayDesc)
577
+ ),
578
+
579
+ // Personality Traits
580
+ h('div', { className: 'card', style: { padding: 20 } },
581
+ h('h4', { style: { margin: '0 0 16px', fontSize: 14, fontWeight: 600 } }, 'Personality Traits'),
582
+ Object.keys(displayTraits).length > 0
583
+ ? h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8 } },
584
+ Object.entries(displayTraits).map(function(pair) {
585
+ return h('div', { key: pair[0], style: { display: 'flex', alignItems: 'center', gap: 6, padding: '6px 12px', borderRadius: 6, background: 'var(--bg-secondary)', border: '1px solid var(--border)' } },
586
+ h('span', { style: { fontSize: 11, color: 'var(--text-muted)', textTransform: 'capitalize' } }, pair[0] + ':'),
587
+ h('span', { style: { fontSize: 13, fontWeight: 600, textTransform: 'capitalize' } }, pair[1])
588
+ );
589
+ })
590
+ )
591
+ : h('span', { style: { fontSize: 13, color: 'var(--text-muted)' } }, 'No traits configured')
592
+ )
593
+ );
594
+ }
595
+
596
+ // ─── Edit Mode — uses shared PersonaForm ───────────────
597
+
598
+ return h(Fragment, null,
599
+ // Header
600
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
601
+ h('h3', { style: { margin: 0, fontSize: 16, fontWeight: 600 } }, 'Edit Personal Details'),
602
+ h('div', { style: { display: 'flex', gap: 8 } },
603
+ h('button', { className: 'btn btn-primary btn-sm', disabled: saving, onClick: saveDetails }, saving ? 'Saving...' : 'Save Changes'),
604
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { setEditing(false); } }, 'Cancel')
605
+ )
606
+ ),
607
+
608
+ // Core Identity Fields (name, display name, email, role)
609
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
610
+ h('h4', { style: { margin: '0 0 16px', fontSize: 14, fontWeight: 600 } }, 'Core Identity'),
611
+
612
+ h('div', { style: rowStyle },
613
+ h('div', { style: fieldGroupStyle },
614
+ h('label', { style: labelStyle }, 'Name'),
615
+ h('input', { className: 'input', type: 'text', value: form.name, placeholder: 'Agent name', onChange: function(e) { set('name', e.target.value); } })
616
+ ),
617
+ h('div', { style: fieldGroupStyle },
618
+ h('label', { style: labelStyle }, 'Display Name'),
619
+ h('input', { className: 'input', type: 'text', value: form.displayName, placeholder: 'Display name (optional)', onChange: function(e) { set('displayName', e.target.value); } })
620
+ )
621
+ ),
622
+
623
+ h('div', { style: rowStyle },
624
+ h('div', { style: fieldGroupStyle },
625
+ h('label', { style: labelStyle }, 'Email'),
626
+ h('input', { className: 'input', type: 'email', value: form.email, placeholder: 'agent@company.com', onChange: function(e) { set('email', e.target.value); } })
627
+ ),
628
+ h('div', { style: fieldGroupStyle },
629
+ h('label', { style: labelStyle }, 'Role'),
630
+ h('select', { className: 'input', style: { cursor: 'pointer' }, value: form.role, onChange: function(e) { set('role', e.target.value); } },
631
+ ROLE_OPTIONS.map(function(r) { return h('option', { key: r, value: r }, r.charAt(0).toUpperCase() + r.slice(1)); })
632
+ )
633
+ )
634
+ ),
635
+
636
+ h('div', { style: fieldGroupStyle },
637
+ h('label', { style: labelStyle }, 'Description'),
638
+ h('textarea', { className: 'input', style: { minHeight: 80, resize: 'vertical' }, value: form.description, placeholder: 'Describe what this agent does...', onChange: function(e) { set('description', e.target.value); } })
639
+ )
640
+ ),
641
+
642
+ // Persona Form (shared component: avatar, DOB, gender, marital, culture, language, traits)
643
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
644
+ h('h4', { style: { margin: '0 0 16px', fontSize: 14, fontWeight: 600 } }, 'Persona & Identity'),
645
+ h(PersonaForm, { form: form, set: set, toast: toast })
646
+ ),
647
+
648
+ // Bottom save bar
649
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
650
+ h('button', { className: 'btn btn-primary', disabled: saving, onClick: saveDetails }, saving ? 'Saving...' : 'Save All Changes'),
651
+ h('button', { className: 'btn btn-ghost', onClick: function() { setEditing(false); } }, 'Cancel')
652
+ )
653
+ );
654
+ }
655
+
656
+ // ════════════════════════════════════════════════════════════
657
+ // PERMISSIONS SECTION
658
+ // ════════════════════════════════════════════════════════════
659
+
660
+ var ALL_SIDE_EFFECTS = ['sends-email', 'sends-message', 'sends-sms', 'posts-social', 'runs-code', 'modifies-files', 'deletes-data', 'controls-device', 'financial'];
661
+ var ALL_RISK_LEVELS = ['low', 'medium', 'high', 'critical'];
662
+
663
+ function PermissionsSection(props) {
664
+ var initialProfile = props.profile;
665
+ var agentId = props.agentId;
666
+ var reload = props.reload;
667
+
668
+ var app = useApp();
669
+ var toast = app.toast;
670
+
671
+ var _policies = useState([]);
672
+ var policies = _policies[0]; var setPolicies = _policies[1];
673
+ var _presets = useState([]);
674
+ var presets = _presets[0]; var setPresets = _presets[1];
675
+ var _soulCategories = useState({});
676
+ var soulCategories = _soulCategories[0]; var setSoulCategories = _soulCategories[1];
677
+ var _soulMeta = useState({});
678
+ var soulMeta = _soulMeta[0]; var setSoulMeta = _soulMeta[1];
679
+ var _soulSearch = useState('');
680
+ var soulSearch = _soulSearch[0]; var setSoulSearch = _soulSearch[1];
681
+ var _soulOpen = useState(false);
682
+ var soulOpen = _soulOpen[0]; var setSoulOpen = _soulOpen[1];
683
+ var _loading = useState(true);
684
+ var loading = _loading[0]; var setLoading = _loading[1];
685
+ var _profile = useState(initialProfile);
686
+ var profile = _profile[0]; var setProfile = _profile[1];
687
+ var _editing = useState(false);
688
+ var editing = _editing[0]; var setEditing = _editing[1];
689
+ var _saving = useState(false);
690
+ var saving = _saving[0]; var setSaving = _saving[1];
691
+ var _form = useState({});
692
+ var form = _form[0]; var setForm = _form[1];
693
+ var _applyingSoul = useState(null);
694
+ var applyingSoul = _applyingSoul[0]; var setApplyingSoul = _applyingSoul[1];
695
+
696
+ // Sync when parent passes new profile
697
+ useEffect(function() { setProfile(initialProfile); }, [initialProfile]);
698
+
699
+ // Load policies + presets + soul templates
700
+ useEffect(function() {
701
+ setLoading(true);
702
+ Promise.all([
703
+ engineCall('/policies/agent/' + agentId + '?orgId=default').catch(function() { return { policies: [] }; }),
704
+ engineCall('/profiles/presets').catch(function() { return { presets: [] }; }),
705
+ engineCall('/souls/by-category').catch(function() { return { categories: {}, categoryMeta: {} }; })
706
+ ]).then(function(results) {
707
+ setPolicies(results[0].policies || results[0] || []);
708
+ setPresets(results[1].presets || results[1] || []);
709
+ setSoulCategories(results[2].categories || {});
710
+ setSoulMeta(results[2].categoryMeta || {});
711
+ setLoading(false);
712
+ });
713
+ }, [agentId]);
714
+
715
+ // ─── Apply Preset ──────────────────────────────────────
716
+
717
+ var applyPreset = function(presetName) {
718
+ setSaving(true);
719
+ engineCall('/profiles/' + agentId + '/apply-preset', {
720
+ method: 'POST',
721
+ body: JSON.stringify({ presetName: presetName })
722
+ }).then(function(res) {
723
+ toast('Preset "' + presetName + '" applied', 'success');
724
+ setProfile(res.profile || res);
725
+ setSaving(false);
726
+ setEditing(false);
727
+ reload();
728
+ }).catch(function(err) {
729
+ toast('Failed: ' + err.message, 'error');
730
+ setSaving(false);
731
+ });
732
+ };
733
+
734
+ // ─── Apply Soul Template ────────────────────────────────
735
+
736
+ var applySoulTemplate = function(tpl) {
737
+ setApplyingSoul(tpl.id);
738
+
739
+ // 1. Update agent config with role, personality, description from soul
740
+ var configUpdates = {
741
+ identity: {
742
+ role: tpl.identity && tpl.identity.role || tpl.name || 'agent',
743
+ personality: tpl.personality || '',
744
+ description: tpl.description || '',
745
+ },
746
+ description: tpl.description || '',
747
+ };
748
+
749
+ var isRunning = props.engineAgent && (props.engineAgent.state === 'running' || props.engineAgent.state === 'active');
750
+ var configEndpoint = isRunning ? '/agents/' + agentId + '/hot-update' : '/agents/' + agentId + '/config';
751
+ var configMethod = isRunning ? 'POST' : 'PATCH';
752
+
753
+ // 2. Apply permission preset if soul suggests one
754
+ var presetName = tpl.suggestedPreset || null;
755
+
756
+ Promise.all([
757
+ engineCall(configEndpoint, {
758
+ method: configMethod,
759
+ body: JSON.stringify({ updates: configUpdates, updatedBy: 'dashboard' })
760
+ }).catch(function(err) { return { error: err.message }; }),
761
+ presetName
762
+ ? engineCall('/profiles/' + agentId + '/apply-preset', {
763
+ method: 'POST',
764
+ body: JSON.stringify({ presetName: presetName })
765
+ }).catch(function(err) { return { error: err.message }; })
766
+ : Promise.resolve(null)
767
+ ]).then(function(results) {
768
+ if (results[1] && results[1].profile) {
769
+ setProfile(results[1].profile);
770
+ }
771
+ toast('Role template "' + tpl.name + '" applied', 'success');
772
+ setApplyingSoul(null);
773
+ reload();
774
+ }).catch(function(err) {
775
+ toast('Failed: ' + err.message, 'error');
776
+ setApplyingSoul(null);
777
+ });
778
+ };
779
+
780
+ // ─── Edit Mode Init ────────────────────────────────────
781
+
782
+ var startEdit = function() {
783
+ var p = profile || {};
784
+ var rl = p.rateLimits || p.rate_limits || {};
785
+ var con = p.constraints || {};
786
+ var appr = p.requireApproval || p.approvalSettings || p.approval || {};
787
+ setForm({
788
+ maxRiskLevel: p.maxRiskLevel || p.max_risk_level || 'medium',
789
+ blockedSideEffects: (p.blockedSideEffects || p.blocked_side_effects || []).slice(),
790
+ sandboxMode: p.sandboxMode || p.sandbox_mode || false,
791
+ approvalEnabled: appr.enabled !== undefined ? appr.enabled : false,
792
+ approvalRiskLevels: (appr.forRiskLevels || appr.riskLevels || appr.risk_levels || []).slice(),
793
+ approvalSideEffects: (appr.forSideEffects || appr.sideEffects || appr.side_effects || []).slice(),
794
+ approvalTimeout: appr.timeoutMinutes || appr.timeout || 30,
795
+ callsPerMinute: rl.toolCallsPerMinute || rl.callsPerMinute || rl.calls_per_minute || 30,
796
+ callsPerHour: rl.toolCallsPerHour || rl.callsPerHour || rl.calls_per_hour || 500,
797
+ callsPerDay: rl.toolCallsPerDay || rl.callsPerDay || rl.calls_per_day || 5000,
798
+ externalPerHour: rl.externalActionsPerHour || rl.externalPerHour || rl.external_per_hour || 50,
799
+ maxConcurrentTasks: con.maxConcurrentTasks || con.max_concurrent_tasks || 5,
800
+ maxSessionDuration: con.maxSessionDurationMinutes || con.maxSessionDuration || con.max_session_duration || 480,
801
+ });
802
+ setEditing(true);
803
+ };
804
+
805
+ var setField = function(key, value) {
806
+ setForm(function(prev) { var n = Object.assign({}, prev); n[key] = value; return n; });
807
+ };
808
+
809
+ var toggleInArray = function(key, item) {
810
+ setForm(function(prev) {
811
+ var arr = (prev[key] || []).slice();
812
+ var idx = arr.indexOf(item);
813
+ if (idx >= 0) arr.splice(idx, 1); else arr.push(item);
814
+ var n = Object.assign({}, prev); n[key] = arr; return n;
815
+ });
816
+ };
817
+
818
+ // ─── Save Custom Profile ───────────────────────────────
819
+
820
+ var saveProfile = function() {
821
+ setSaving(true);
822
+ var updated = {
823
+ id: agentId,
824
+ name: (profile && profile.name) || 'Custom',
825
+ maxRiskLevel: form.maxRiskLevel,
826
+ blockedSideEffects: form.blockedSideEffects,
827
+ sandboxMode: form.sandboxMode,
828
+ requireApproval: {
829
+ enabled: form.approvalEnabled,
830
+ forRiskLevels: form.approvalRiskLevels,
831
+ forSideEffects: form.approvalSideEffects,
832
+ approvers: [],
833
+ timeoutMinutes: Number(form.approvalTimeout) || 30,
834
+ },
835
+ rateLimits: {
836
+ toolCallsPerMinute: Number(form.callsPerMinute) || 0,
837
+ toolCallsPerHour: Number(form.callsPerHour) || 0,
838
+ toolCallsPerDay: Number(form.callsPerDay) || 0,
839
+ externalActionsPerHour: Number(form.externalPerHour) || 0,
840
+ },
841
+ constraints: {
842
+ maxConcurrentTasks: Number(form.maxConcurrentTasks) || 5,
843
+ maxSessionDurationMinutes: Number(form.maxSessionDuration) || 480,
844
+ sandboxMode: form.sandboxMode,
845
+ },
846
+ createdAt: (profile && profile.createdAt) || new Date().toISOString(),
847
+ updatedAt: new Date().toISOString(),
848
+ };
849
+
850
+ engineCall('/profiles/' + agentId, {
851
+ method: 'PUT',
852
+ body: JSON.stringify(updated)
853
+ }).then(function(res) {
854
+ toast('Permissions saved', 'success');
855
+ setProfile(res.profile || updated);
856
+ setEditing(false);
857
+ setSaving(false);
858
+ reload();
859
+ }).catch(function(err) {
860
+ toast('Failed: ' + err.message, 'error');
861
+ setSaving(false);
862
+ });
863
+ };
864
+
865
+ // ─── Loading ───────────────────────────────────────────
866
+
867
+ if (loading) {
868
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading permissions...');
869
+ }
870
+
871
+ // ─── Shared styles ─────────────────────────────────────
872
+
873
+ var CATEGORY_COLORS = {
874
+ code_of_conduct: '#6366f1', communication: '#0ea5e9', data_handling: '#f59e0b',
875
+ brand_voice: '#ec4899', security: '#ef4444', escalation: '#8b5cf6', custom: '#64748b'
876
+ };
877
+ var ENFORCEMENT_COLORS = { mandatory: '#ef4444', recommended: '#f59e0b', informational: '#0ea5e9' };
878
+ var inputStyle = { padding: '8px 10px', borderRadius: 6, border: '1px solid var(--border)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', fontSize: 13, width: '100%' };
879
+ var labelStyle = { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 };
880
+
881
+ // ─── Edit Mode ─────────────────────────────────────────
882
+
883
+ if (editing) {
884
+ return h(Fragment, null,
885
+ // Header
886
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
887
+ h('h3', { style: { margin: 0, fontSize: 16, fontWeight: 600 } }, 'Edit Permissions'),
888
+ h('div', { style: { display: 'flex', gap: 8 } },
889
+ h('button', { className: 'btn btn-primary btn-sm', disabled: saving, onClick: saveProfile }, saving ? 'Saving...' : 'Save'),
890
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { setEditing(false); } }, 'Cancel')
891
+ )
892
+ ),
893
+
894
+ // Max Risk Level
895
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
896
+ h('h4', { style: { margin: '0 0 8px', fontSize: 14, fontWeight: 600 } }, 'Maximum Risk Level'),
897
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 12 } }, 'The highest risk level of tools this agent can use.'),
898
+ h('div', { style: { display: 'flex', gap: 8 } },
899
+ ALL_RISK_LEVELS.map(function(level) {
900
+ return h('button', { key: level, className: 'btn btn-sm' + (form.maxRiskLevel === level ? ' btn-primary' : ' btn-secondary'), onClick: function() { setField('maxRiskLevel', level); }, style: { textTransform: 'capitalize' } }, level);
901
+ })
902
+ )
903
+ ),
904
+
905
+ // Blocked Side Effects
906
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
907
+ h('h4', { style: { margin: '0 0 8px', fontSize: 14, fontWeight: 600 } }, 'Blocked Side Effects'),
908
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 12 } }, 'Actions this agent is never allowed to perform.'),
909
+ h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8 } },
910
+ ALL_SIDE_EFFECTS.map(function(se) {
911
+ var active = form.blockedSideEffects.indexOf(se) >= 0;
912
+ return h('div', { key: se, style: { display: 'flex', alignItems: 'center', gap: 6, padding: '6px 12px', borderRadius: 6, cursor: 'pointer', border: '1px solid ' + (active ? 'var(--danger)' : 'var(--border)'), background: active ? 'rgba(239,68,68,0.1)' : 'var(--bg-secondary)', fontSize: 12 }, onClick: function() { toggleInArray('blockedSideEffects', se); } },
913
+ h('input', { type: 'checkbox', checked: active, readOnly: true, style: { accentColor: 'var(--danger)' } }),
914
+ se
915
+ );
916
+ })
917
+ )
918
+ ),
919
+
920
+ // Approval Settings
921
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
922
+ h('h4', { style: { margin: '0 0 12px', fontSize: 14, fontWeight: 600 } }, 'Approval Settings'),
923
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 10, marginBottom: 16 } },
924
+ h('label', { style: { fontSize: 13, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 6 } },
925
+ h('input', { type: 'checkbox', checked: form.approvalEnabled, onChange: function() { setField('approvalEnabled', !form.approvalEnabled); } }),
926
+ 'Require approval for risky actions'
927
+ )
928
+ ),
929
+ form.approvalEnabled && h(Fragment, null,
930
+ h('div', { style: { marginBottom: 14 } },
931
+ h('div', { style: labelStyle }, 'Risk levels requiring approval:'),
932
+ h('div', { style: { display: 'flex', gap: 8 } },
933
+ ALL_RISK_LEVELS.map(function(level) {
934
+ var active = form.approvalRiskLevels.indexOf(level) >= 0;
935
+ return h('button', { key: level, className: 'btn btn-sm' + (active ? ' btn-primary' : ' btn-secondary'), onClick: function() { toggleInArray('approvalRiskLevels', level); }, style: { textTransform: 'capitalize' } }, level);
936
+ })
937
+ )
938
+ ),
939
+ h('div', { style: { marginBottom: 14 } },
940
+ h('div', { style: labelStyle }, 'Side effects requiring approval:'),
941
+ h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 6 } },
942
+ ALL_SIDE_EFFECTS.map(function(se) {
943
+ var active = form.approvalSideEffects.indexOf(se) >= 0;
944
+ return h('button', { key: se, className: 'btn btn-sm' + (active ? ' btn-info' : ' btn-ghost'), onClick: function() { toggleInArray('approvalSideEffects', se); }, style: { fontSize: 11 } }, se);
945
+ })
946
+ )
947
+ ),
948
+ h('div', { style: { maxWidth: 200 } },
949
+ h('div', { style: labelStyle }, 'Timeout (minutes)'),
950
+ h('input', { type: 'number', style: inputStyle, value: form.approvalTimeout, min: 1, onChange: function(e) { setField('approvalTimeout', e.target.value); } })
951
+ )
952
+ )
953
+ ),
954
+
955
+ // Rate Limits
956
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
957
+ h('h4', { style: { margin: '0 0 12px', fontSize: 14, fontWeight: 600 } }, 'Rate Limits'),
958
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
959
+ h('div', null, h('div', { style: labelStyle }, 'Calls / Minute'), h('input', { type: 'number', style: inputStyle, value: form.callsPerMinute, min: 0, onChange: function(e) { setField('callsPerMinute', e.target.value); } })),
960
+ h('div', null, h('div', { style: labelStyle }, 'Calls / Hour'), h('input', { type: 'number', style: inputStyle, value: form.callsPerHour, min: 0, onChange: function(e) { setField('callsPerHour', e.target.value); } })),
961
+ h('div', null, h('div', { style: labelStyle }, 'Calls / Day'), h('input', { type: 'number', style: inputStyle, value: form.callsPerDay, min: 0, onChange: function(e) { setField('callsPerDay', e.target.value); } })),
962
+ h('div', null, h('div', { style: labelStyle }, 'External Actions / Hour'), h('input', { type: 'number', style: inputStyle, value: form.externalPerHour, min: 0, onChange: function(e) { setField('externalPerHour', e.target.value); } }))
963
+ )
964
+ ),
965
+
966
+ // Constraints
967
+ h('div', { className: 'card', style: { padding: 20, marginBottom: 20 } },
968
+ h('h4', { style: { margin: '0 0 12px', fontSize: 14, fontWeight: 600 } }, 'Constraints'),
969
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 16 } },
970
+ h('div', null, h('div', { style: labelStyle }, 'Max Concurrent Tasks'), h('input', { type: 'number', style: inputStyle, value: form.maxConcurrentTasks, min: 1, onChange: function(e) { setField('maxConcurrentTasks', e.target.value); } })),
971
+ h('div', null, h('div', { style: labelStyle }, 'Max Session Duration (min)'), h('input', { type: 'number', style: inputStyle, value: form.maxSessionDuration, min: 1, onChange: function(e) { setField('maxSessionDuration', e.target.value); } }))
972
+ ),
973
+ h('label', { style: { fontSize: 13, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 6 } },
974
+ h('input', { type: 'checkbox', checked: form.sandboxMode, onChange: function() { setField('sandboxMode', !form.sandboxMode); } }),
975
+ 'Sandbox Mode (restrict to safe tools only)'
976
+ )
977
+ ),
978
+
979
+ // Bottom save bar
980
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
981
+ h('button', { className: 'btn btn-primary', disabled: saving, onClick: saveProfile }, saving ? 'Saving...' : 'Save Permissions'),
982
+ h('button', { className: 'btn btn-ghost', onClick: function() { setEditing(false); } }, 'Cancel')
983
+ )
984
+ );
985
+ }
986
+
987
+ // ─── View Mode ─────────────────────────────────────────
988
+
989
+ // ─── Soul Template / Role Selector ──────────────────────
990
+
991
+ var filteredSoulCategories = {};
992
+ var soulEntries = Object.entries(soulCategories);
993
+ for (var si = 0; si < soulEntries.length; si++) {
994
+ var sCat = soulEntries[si][0];
995
+ var sTemplates = soulEntries[si][1];
996
+ if (!soulSearch) { filteredSoulCategories[sCat] = sTemplates; continue; }
997
+ var sq = soulSearch.toLowerCase();
998
+ var sFiltered = sTemplates.filter(function(t) { return t.name.toLowerCase().indexOf(sq) >= 0 || t.description.toLowerCase().indexOf(sq) >= 0 || (t.tags || []).some(function(tag) { return tag.indexOf(sq) >= 0; }); });
999
+ if (sFiltered.length > 0) filteredSoulCategories[sCat] = sFiltered;
1000
+ }
1001
+
1002
+ var soulCard = h('div', { className: 'card', style: { marginBottom: 20 } },
1003
+ h('div', { className: 'card-header', style: { cursor: 'pointer', display: 'flex', justifyContent: 'space-between', alignItems: 'center', userSelect: 'none' }, onClick: function() { setSoulOpen(!soulOpen); } },
1004
+ h('span', null, 'Role Templates'),
1005
+ h('span', { style: { fontSize: 11, color: 'var(--text-muted)', display: 'flex', alignItems: 'center', gap: 6 } },
1006
+ h('span', null, Object.values(soulCategories).reduce(function(sum, arr) { return sum + arr.length; }, 0) + ' templates'),
1007
+ h('span', { style: { transition: 'transform 0.2s', transform: soulOpen ? 'rotate(180deg)' : 'rotate(0deg)', display: 'inline-block', lineHeight: 1 } },
1008
+ h('svg', { width: 14, height: 14, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' }, h('polyline', { points: '6 9 12 15 18 9' }))
1009
+ )
1010
+ )
1011
+ ),
1012
+ soulOpen && h('div', { className: 'card-body' },
1013
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 12 } }, 'Apply a role template to configure this agent\'s personality, description, skills, and permissions in one click.'),
1014
+ h('div', { style: { marginBottom: 12 } },
1015
+ h('input', { className: 'input', type: 'text', placeholder: 'Search role templates...', value: soulSearch, onChange: function(e) { setSoulSearch(e.target.value); }, style: { maxWidth: 300 } })
1016
+ ),
1017
+ Object.keys(filteredSoulCategories).length > 0
1018
+ ? Object.entries(filteredSoulCategories).map(function(entry) {
1019
+ var cat = entry[0];
1020
+ var templates = entry[1];
1021
+ var meta = soulMeta[cat] || {};
1022
+ return h('div', { key: cat, style: { marginBottom: 16 } },
1023
+ h('h4', { style: { fontSize: 11, fontWeight: 700, textTransform: 'uppercase', letterSpacing: '0.06em', color: 'var(--text-muted)', marginBottom: 8 } },
1024
+ (meta.icon || '') + ' ' + (meta.name || cat)
1025
+ ),
1026
+ h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))', gap: 8 } },
1027
+ templates.map(function(tpl) {
1028
+ var isApplying = applyingSoul === tpl.id;
1029
+ return h('div', { key: tpl.id, className: 'preset-card', style: { padding: '10px 14px', cursor: isApplying ? 'wait' : 'pointer', opacity: isApplying ? 0.6 : 1 }, onClick: function() { if (!isApplying && !applyingSoul) applySoulTemplate(tpl); } },
1030
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
1031
+ h('h4', { style: { fontSize: 13, fontWeight: 600, margin: 0 } }, tpl.name),
1032
+ isApplying && h('span', { style: { fontSize: 11, color: 'var(--accent)' } }, 'Applying...')
1033
+ ),
1034
+ h('p', { style: { fontSize: 11, color: 'var(--text-muted)', margin: '4px 0 0' } }, tpl.description ? (tpl.description.length > 80 ? tpl.description.slice(0, 80) + '...' : tpl.description) : ''),
1035
+ tpl.suggestedPreset && h('span', { className: 'badge badge-info', style: { fontSize: 10, marginTop: 6 } }, tpl.suggestedPreset)
1036
+ );
1037
+ })
1038
+ )
1039
+ );
1040
+ })
1041
+ : h('div', { style: { fontSize: 13, color: 'var(--text-muted)', padding: 12 } }, 'No role templates found.')
1042
+ )
1043
+ );
1044
+
1045
+ // Preset selector card (always visible)
1046
+ var presetCard = h('div', { className: 'card', style: { marginBottom: 20 } },
1047
+ h('div', { className: 'card-header' }, h('span', null, 'Apply a Permission Preset')),
1048
+ h('div', { className: 'card-body' },
1049
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 12 } }, 'Select a preset to quickly configure this agent\'s permissions. This will replace the current profile.'),
1050
+ presets.length > 0
1051
+ ? h('div', { className: 'preset-grid', style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))', gap: 10 } },
1052
+ presets.map(function(p) {
1053
+ var isActive = profile && (profile.name === p.name);
1054
+ return h('div', { key: p.name, className: 'preset-card' + (isActive ? ' selected' : ''), style: { padding: '12px 16px', borderRadius: 8, border: '1px solid ' + (isActive ? 'var(--accent)' : 'var(--border)'), cursor: 'pointer', background: isActive ? 'var(--accent-soft)' : 'var(--bg-secondary)' }, onClick: function() { if (!isActive) applyPreset(p.name); } },
1055
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 } },
1056
+ h('h4', { style: { fontSize: 13, fontWeight: 600, margin: 0 } }, p.name),
1057
+ isActive && h('span', { style: { color: 'var(--accent)' } }, I.check())
1058
+ ),
1059
+ h('p', { style: { fontSize: 11, color: 'var(--text-muted)', margin: '4px 0 6px' } }, p.description || ''),
1060
+ p.maxRiskLevel && h('span', { className: riskBadgeClass(p.maxRiskLevel), style: { fontSize: 10 } }, 'Risk: ' + p.maxRiskLevel)
1061
+ );
1062
+ })
1063
+ )
1064
+ : h('div', { style: { fontSize: 13, color: 'var(--text-muted)' } }, 'No presets available.')
1065
+ )
1066
+ );
1067
+
1068
+ if (!profile) {
1069
+ return h(Fragment, null,
1070
+ soulCard,
1071
+ presetCard,
1072
+ h(EmptyState, { icon: I.shield(), message: 'No permission profile assigned to this agent. Select a role template or preset above, or create a custom profile.' }),
1073
+ h('div', { style: { textAlign: 'center', marginTop: 12 } },
1074
+ h('button', { className: 'btn btn-primary', onClick: startEdit }, 'Create Custom Profile')
1075
+ )
1076
+ );
1077
+ }
1078
+
1079
+ // ─── Derived Values ─────────────────────────────────────
1080
+
1081
+ var maxRisk = profile.maxRiskLevel || profile.max_risk_level || 'medium';
1082
+ var blockedSideEffects = profile.blockedSideEffects || profile.blocked_side_effects || [];
1083
+ var sandboxMode = profile.sandboxMode || profile.sandbox_mode || false;
1084
+ var approval = profile.requireApproval || profile.approvalSettings || profile.approval || {};
1085
+ var approvalEnabled = approval.enabled !== undefined ? approval.enabled : false;
1086
+ var approvalRiskLevels = approval.forRiskLevels || approval.riskLevels || approval.risk_levels || [];
1087
+ var approvalSideEffects = approval.forSideEffects || approval.sideEffects || approval.side_effects || [];
1088
+ var approvalTimeout = approval.timeoutMinutes || approval.timeout || 30;
1089
+ var rateLimits = profile.rateLimits || profile.rate_limits || {};
1090
+ var callsPerMin = rateLimits.toolCallsPerMinute || rateLimits.callsPerMinute || rateLimits.calls_per_minute || 0;
1091
+ var callsPerHr = rateLimits.toolCallsPerHour || rateLimits.callsPerHour || rateLimits.calls_per_hour || 0;
1092
+ var callsPerDay = rateLimits.toolCallsPerDay || rateLimits.callsPerDay || rateLimits.calls_per_day || 0;
1093
+ var externalPerHr = rateLimits.externalActionsPerHour || rateLimits.externalPerHour || rateLimits.external_per_hour || 0;
1094
+ var constraints = profile.constraints || {};
1095
+ var maxConcurrent = constraints.maxConcurrentTasks || constraints.max_concurrent_tasks || '-';
1096
+ var maxSessionDuration = constraints.maxSessionDurationMinutes || constraints.maxSessionDuration || constraints.max_session_duration || '-';
1097
+ var allowedIPs = constraints.allowedIPs || constraints.allowed_ips || [];
1098
+ var skills = profile.skills || profile.tools || {};
1099
+ var blockedTools = skills.blocked || [];
1100
+ var allowedTools = skills.allowed || [];
1101
+
1102
+ return h(Fragment, null,
1103
+
1104
+ // Role template selector
1105
+ soulCard,
1106
+
1107
+ // Preset selector
1108
+ presetCard,
1109
+
1110
+ // ─── Current Profile + Edit Button ──────────────────
1111
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1112
+ h('div', { className: 'card-header', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
1113
+ h('span', null, 'Current Permission Profile'),
1114
+ h('button', { className: 'btn btn-primary btn-sm', onClick: startEdit }, I.journal(), ' Edit')
1115
+ ),
1116
+ h('div', { className: 'card-body' },
1117
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 12, marginBottom: 16 } },
1118
+ h('h3', { style: { fontSize: 16, fontWeight: 600, margin: 0 } }, profile.name || profile.profileName || 'Custom Profile'),
1119
+ h('span', { className: riskBadgeClass(maxRisk) }, 'Max Risk: ' + maxRisk)
1120
+ ),
1121
+ h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8, marginBottom: 12 } },
1122
+ h('span', { style: { fontSize: 12, color: 'var(--text-muted)', marginRight: 4 } }, 'Blocked Side Effects:'),
1123
+ blockedSideEffects.length > 0
1124
+ ? blockedSideEffects.map(function(se, i) {
1125
+ return h('span', { key: i, className: 'badge badge-danger', style: { fontSize: 11 } }, se);
1126
+ })
1127
+ : h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'None')
1128
+ ),
1129
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
1130
+ h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Sandbox Mode:'),
1131
+ h('span', { className: sandboxMode ? 'badge badge-warning' : 'badge badge-neutral' }, sandboxMode ? 'Enabled' : 'Disabled')
1132
+ )
1133
+ )
1134
+ ),
1135
+
1136
+ // ─── Approval Settings Card ─────────────────────────
1137
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1138
+ h('div', { className: 'card-header' }, h('span', null, 'Approval Settings')),
1139
+ h('div', { className: 'card-body' },
1140
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 12, marginBottom: 16 } },
1141
+ h('span', { style: { fontSize: 13, color: 'var(--text-secondary)' } }, 'Approval Required:'),
1142
+ h('span', { className: approvalEnabled ? 'badge badge-success' : 'badge badge-neutral' }, approvalEnabled ? 'Enabled' : 'Disabled')
1143
+ ),
1144
+ approvalEnabled && h(Fragment, null,
1145
+ h('div', { style: { marginBottom: 12 } },
1146
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 6 } }, 'Risk Levels Requiring Approval:'),
1147
+ h('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap' } },
1148
+ approvalRiskLevels.length > 0
1149
+ ? approvalRiskLevels.map(function(rl, i) { return h('span', { key: i, className: riskBadgeClass(rl) }, rl); })
1150
+ : h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'None')
1151
+ )
1152
+ ),
1153
+ h('div', { style: { marginBottom: 12 } },
1154
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 6 } }, 'Side Effects Requiring Approval:'),
1155
+ h('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap' } },
1156
+ approvalSideEffects.length > 0
1157
+ ? approvalSideEffects.map(function(se, i) { return h('span', { key: i, className: 'badge badge-info', style: { fontSize: 11 } }, se); })
1158
+ : h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'None')
1159
+ )
1160
+ ),
1161
+ h('div', { style: { fontSize: 12, color: 'var(--text-secondary)' } }, 'Timeout: ', h('strong', null, approvalTimeout + ' minutes'))
1162
+ )
1163
+ )
1164
+ ),
1165
+
1166
+ // ─── Rate Limits Card ───────────────────────────────
1167
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1168
+ h('div', { className: 'card-header' }, h('span', null, 'Rate Limits')),
1169
+ h('div', { className: 'card-body' },
1170
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
1171
+ h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8 } }, h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4 } }, 'Calls / Minute'), h('div', { style: { fontSize: 20, fontWeight: 700 } }, String(callsPerMin || 'Unlimited'))),
1172
+ h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8 } }, h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4 } }, 'Calls / Hour'), h('div', { style: { fontSize: 20, fontWeight: 700 } }, String(callsPerHr || 'Unlimited'))),
1173
+ h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8 } }, h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4 } }, 'Calls / Day'), h('div', { style: { fontSize: 20, fontWeight: 700 } }, String(callsPerDay || 'Unlimited'))),
1174
+ h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8 } }, h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 4 } }, 'External / Hour'), h('div', { style: { fontSize: 20, fontWeight: 700 } }, String(externalPerHr || 'Unlimited')))
1175
+ )
1176
+ )
1177
+ ),
1178
+
1179
+ // ─── Constraints Card ───────────────────────────────
1180
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1181
+ h('div', { className: 'card-header' }, h('span', null, 'Constraints')),
1182
+ h('div', { className: 'card-body' },
1183
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
1184
+ h('div', null, h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Max Concurrent Tasks'), h('div', { style: { fontSize: 14, fontWeight: 600 } }, String(maxConcurrent))),
1185
+ h('div', null, h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Max Session Duration'), h('div', { style: { fontSize: 14, fontWeight: 600 } }, String(maxSessionDuration))),
1186
+ h('div', null, h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Sandbox Mode'), h('span', { className: sandboxMode ? 'badge badge-warning' : 'badge badge-neutral' }, sandboxMode ? 'Enabled' : 'Disabled')),
1187
+ h('div', null, h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Allowed IPs'), allowedIPs.length > 0 ? h('div', { style: { display: 'flex', gap: 4, flexWrap: 'wrap' } }, allowedIPs.map(function(ip, i) { return h('span', { key: i, className: 'badge badge-neutral', style: { fontSize: 11, fontFamily: 'monospace' } }, ip); })) : h('div', { style: { fontSize: 13, color: 'var(--text-muted)' } }, 'Any'))
1188
+ )
1189
+ )
1190
+ ),
1191
+
1192
+ // ─── Tools Card ─────────────────────────────────────
1193
+ (blockedTools.length > 0 || allowedTools.length > 0) && h('div', { className: 'card', style: { marginBottom: 20 } },
1194
+ h('div', { className: 'card-header' }, h('span', null, 'Tool Overrides')),
1195
+ h('div', { className: 'card-body' },
1196
+ blockedTools.length > 0 && h('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap', marginBottom: 8 } },
1197
+ h('span', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Blocked:'),
1198
+ blockedTools.map(function(t, i) { return h('span', { key: i, className: 'badge badge-danger', style: { fontSize: 11 } }, t); })
1199
+ ),
1200
+ allowedTools.length > 0 && h('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap' } },
1201
+ h('span', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Allowed:'),
1202
+ allowedTools.map(function(t, i) { return h('span', { key: i, className: 'badge badge-success', style: { fontSize: 11 } }, t); })
1203
+ )
1204
+ )
1205
+ ),
1206
+
1207
+ // ─── Applicable Policies Table ──────────────────────
1208
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1209
+ h('div', { className: 'card-header' }, h('span', null, 'Applicable Policies')),
1210
+ policies.length > 0
1211
+ ? h('div', { className: 'card-body-flush' },
1212
+ h('table', { className: 'data-table' },
1213
+ h('thead', null,
1214
+ h('tr', null, h('th', null, 'Name'), h('th', null, 'Category'), h('th', null, 'Enforcement'), h('th', null, 'Status'))
1215
+ ),
1216
+ h('tbody', null,
1217
+ policies.map(function(p, i) {
1218
+ var cat = p.category || 'custom';
1219
+ var enf = p.enforcement || p.enforcementType || 'informational';
1220
+ var enabled = p.enabled !== false;
1221
+ return h('tr', { key: p.id || i },
1222
+ h('td', { style: { fontWeight: 500, fontSize: 13 } }, p.name || p.title || 'Untitled'),
1223
+ h('td', null, h(Badge, { color: CATEGORY_COLORS[cat] || '#64748b' }, cat.replace(/_/g, ' '))),
1224
+ h('td', null, h(Badge, { color: ENFORCEMENT_COLORS[enf] || '#64748b' }, enf)),
1225
+ h('td', null, h('span', { className: enabled ? 'badge badge-success' : 'badge badge-neutral' }, enabled ? 'Enabled' : 'Disabled'))
1226
+ );
1227
+ })
1228
+ )
1229
+ )
1230
+ )
1231
+ : h('div', { className: 'card-body' },
1232
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No policies applied to this agent.')
1233
+ )
1234
+ )
1235
+ );
1236
+ }
1237
+
1238
+ // ════════════════════════════════════════════════════════════
1239
+ // BUDGET SECTION
1240
+ // ════════════════════════════════════════════════════════════
1241
+
1242
+ function BudgetSection(props) {
1243
+ var agentId = props.agentId;
1244
+
1245
+ var app = useApp();
1246
+ var toast = app.toast;
1247
+
1248
+ var _usage = useState(null);
1249
+ var usageData = _usage[0]; var setUsageData = _usage[1];
1250
+ var _budget = useState(null);
1251
+ var budgetConfig = _budget[0]; var setBudgetConfig = _budget[1];
1252
+ var _alerts = useState([]);
1253
+ var budgetAlerts = _alerts[0]; var setBudgetAlerts = _alerts[1];
1254
+ var _loading = useState(true);
1255
+ var loading = _loading[0]; var setLoading = _loading[1];
1256
+ var _editing = useState(false);
1257
+ var editing = _editing[0]; var setEditing = _editing[1];
1258
+ var _saving = useState(false);
1259
+ var saving = _saving[0]; var setSaving = _saving[1];
1260
+ var _form = useState({ dailyTokens: 0, dailyCost: 0, monthlyTokens: 0, monthlyCost: 0 });
1261
+ var form = _form[0]; var setForm = _form[1];
1262
+
1263
+ var loadData = function() {
1264
+ setLoading(true);
1265
+ Promise.all([
1266
+ engineCall('/agents/' + agentId + '/usage').catch(function() { return null; }),
1267
+ engineCall('/agents/' + agentId + '/budget').catch(function() { return null; }),
1268
+ engineCall('/budget/alerts?agentId=' + agentId).catch(function() { return { alerts: [] }; })
1269
+ ]).then(function(results) {
1270
+ setUsageData(results[0]);
1271
+ // Unwrap: GET /agents/:id/budget returns { budgetConfig: {...} }
1272
+ var bc = results[1]?.budgetConfig || results[1] || null;
1273
+ setBudgetConfig(bc);
1274
+ setBudgetAlerts(results[2]?.alerts || results[2] || []);
1275
+ if (bc) {
1276
+ setForm({
1277
+ dailyTokens: bc.dailyTokens || bc.daily_tokens || bc.limits?.dailyTokens || 0,
1278
+ dailyCost: bc.dailyCost || bc.daily_cost || bc.limits?.dailyCost || 0,
1279
+ monthlyTokens: bc.monthlyTokens || bc.monthly_tokens || bc.limits?.monthlyTokens || 0,
1280
+ monthlyCost: bc.monthlyCost || bc.monthly_cost || bc.limits?.monthlyCost || 0
1281
+ });
1282
+ }
1283
+ setLoading(false);
1284
+ });
1285
+ };
1286
+
1287
+ useEffect(function() { loadData(); }, [agentId]);
1288
+
1289
+ // ─── Derived Usage Values ───────────────────────────────
1290
+
1291
+ var tokensToday = usageData?.tokensToday || usageData?.today?.tokens || 0;
1292
+ var tokensMonth = usageData?.tokensMonth || usageData?.month?.tokens || usageData?.thisMonth?.tokens || 0;
1293
+ var costToday = usageData?.costToday || usageData?.today?.cost || 0;
1294
+ var costMonth = usageData?.costMonth || usageData?.month?.cost || usageData?.thisMonth?.cost || 0;
1295
+ var sessionsToday = usageData?.sessionsToday || usageData?.today?.sessions || 0;
1296
+ var errorsToday = usageData?.errorsToday || usageData?.today?.errors || 0;
1297
+
1298
+ // ─── Budget Limits ──────────────────────────────────────
1299
+
1300
+ var limits = budgetConfig?.limits || budgetConfig || null;
1301
+ var hasBudget = limits && (limits.dailyTokens || limits.daily_tokens || limits.dailyCost || limits.daily_cost || limits.monthlyTokens || limits.monthly_tokens || limits.monthlyCost || limits.monthly_cost || form.dailyTokens || form.dailyCost || form.monthlyTokens || form.monthlyCost);
1302
+ var budgetDailyTokens = limits?.dailyTokens || limits?.daily_tokens || form.dailyTokens || 0;
1303
+ var budgetDailyCost = limits?.dailyCost || limits?.daily_cost || form.dailyCost || 0;
1304
+ var budgetMonthlyTokens = limits?.monthlyTokens || limits?.monthly_tokens || form.monthlyTokens || 0;
1305
+ var budgetMonthlyCost = limits?.monthlyCost || limits?.monthly_cost || form.monthlyCost || 0;
1306
+
1307
+ // ─── Save Budget ────────────────────────────────────────
1308
+
1309
+ var saveBudget = function() {
1310
+ setSaving(true);
1311
+ engineCall('/agents/' + agentId + '/budget', {
1312
+ method: 'PUT',
1313
+ body: JSON.stringify({
1314
+ dailyTokens: Number(form.dailyTokens) || 0,
1315
+ dailyCost: Number(form.dailyCost) || 0,
1316
+ monthlyTokens: Number(form.monthlyTokens) || 0,
1317
+ monthlyCost: Number(form.monthlyCost) || 0
1318
+ })
1319
+ })
1320
+ .then(function() { toast('Budget updated', 'success'); setEditing(false); loadData(); })
1321
+ .catch(function(err) { toast(err.message, 'error'); })
1322
+ .finally(function() { setSaving(false); });
1323
+ };
1324
+
1325
+ // ─── Acknowledge Alert ──────────────────────────────────
1326
+
1327
+ var acknowledgeAlert = function(alertId) {
1328
+ engineCall('/budget/alerts/' + alertId + '/acknowledge', { method: 'POST' })
1329
+ .then(function() { toast('Alert acknowledged', 'success'); loadData(); })
1330
+ .catch(function(err) { toast(err.message, 'error'); });
1331
+ };
1332
+
1333
+ if (loading) {
1334
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading budget data...');
1335
+ }
1336
+
1337
+ return h(Fragment, null,
1338
+
1339
+ // ─── Usage Stats Grid ───────────────────────────────
1340
+ h('div', { className: 'stat-grid', style: { marginBottom: 20 } },
1341
+ h(StatCard, { label: 'Tokens Today', value: formatNumber(tokensToday) }),
1342
+ h(StatCard, { label: 'Tokens This Month', value: formatNumber(tokensMonth) }),
1343
+ h(StatCard, { label: 'Cost Today', value: formatCost(costToday) }),
1344
+ h(StatCard, { label: 'Cost This Month', value: formatCost(costMonth) }),
1345
+ h(StatCard, { label: 'Sessions Today', value: String(sessionsToday) }),
1346
+ h(StatCard, { label: 'Errors Today', value: String(errorsToday), color: errorsToday > 0 ? 'var(--danger)' : undefined })
1347
+ ),
1348
+
1349
+ // ─── Budget Limits Card ─────────────────────────────
1350
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1351
+ h('div', { className: 'card-header', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
1352
+ h('span', null, 'Budget Limits'),
1353
+ !editing && h('button', { className: 'btn btn-secondary btn-sm', onClick: function() { setEditing(true); } }, 'Edit Budget')
1354
+ ),
1355
+ h('div', { className: 'card-body' },
1356
+
1357
+ // Edit Mode
1358
+ editing ? h('div', null,
1359
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 20 } },
1360
+ h('div', { className: 'form-group' },
1361
+ h('label', { className: 'form-label' }, 'Daily Token Limit'),
1362
+ h('input', {
1363
+ className: 'input', type: 'number', value: form.dailyTokens,
1364
+ onChange: function(e) { setForm(function(f) { return Object.assign({}, f, { dailyTokens: e.target.value }); }); }
1365
+ })
1366
+ ),
1367
+ h('div', { className: 'form-group' },
1368
+ h('label', { className: 'form-label' }, 'Daily Cost Limit ($)'),
1369
+ h('input', {
1370
+ className: 'input', type: 'number', step: '0.01', value: form.dailyCost,
1371
+ onChange: function(e) { setForm(function(f) { return Object.assign({}, f, { dailyCost: e.target.value }); }); }
1372
+ })
1373
+ ),
1374
+ h('div', { className: 'form-group' },
1375
+ h('label', { className: 'form-label' }, 'Monthly Token Limit'),
1376
+ h('input', {
1377
+ className: 'input', type: 'number', value: form.monthlyTokens,
1378
+ onChange: function(e) { setForm(function(f) { return Object.assign({}, f, { monthlyTokens: e.target.value }); }); }
1379
+ })
1380
+ ),
1381
+ h('div', { className: 'form-group' },
1382
+ h('label', { className: 'form-label' }, 'Monthly Cost Limit ($)'),
1383
+ h('input', {
1384
+ className: 'input', type: 'number', step: '0.01', value: form.monthlyCost,
1385
+ onChange: function(e) { setForm(function(f) { return Object.assign({}, f, { monthlyCost: e.target.value }); }); }
1386
+ })
1387
+ )
1388
+ ),
1389
+ h('div', { style: { display: 'flex', gap: 10 } },
1390
+ h('button', { className: 'btn btn-primary btn-sm', disabled: saving, onClick: saveBudget }, saving ? 'Saving...' : 'Save Budget'),
1391
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { setEditing(false); } }, 'Cancel')
1392
+ )
1393
+ )
1394
+
1395
+ // Display Mode
1396
+ : hasBudget ? h('div', null,
1397
+ budgetDailyTokens > 0 && h(ProgressBar, { label: 'Daily Tokens', value: tokensToday, total: budgetDailyTokens, unit: 'tokens' }),
1398
+ budgetDailyCost > 0 && h(ProgressBar, { label: 'Daily Cost', value: costToday, total: budgetDailyCost, unit: '$' }),
1399
+ budgetMonthlyTokens > 0 && h(ProgressBar, { label: 'Monthly Tokens', value: tokensMonth, total: budgetMonthlyTokens, unit: 'tokens' }),
1400
+ budgetMonthlyCost > 0 && h(ProgressBar, { label: 'Monthly Cost', value: costMonth, total: budgetMonthlyCost, unit: '$' }),
1401
+ !budgetDailyTokens && !budgetDailyCost && !budgetMonthlyTokens && !budgetMonthlyCost && h('div', { style: { color: 'var(--text-muted)', fontSize: 13 } }, 'No budget limits configured.')
1402
+ )
1403
+ : h('div', { style: { textAlign: 'center', padding: 20 } },
1404
+ h('div', { style: { color: 'var(--text-muted)', fontSize: 13, marginBottom: 12 } }, 'No budget limits configured.'),
1405
+ h('button', { className: 'btn btn-primary btn-sm', onClick: function() { setEditing(true); } }, I.plus(), ' Set Budget')
1406
+ )
1407
+ )
1408
+ ),
1409
+
1410
+ // ─── Budget Alerts Table ────────────────────────────
1411
+ h('div', { className: 'card', style: { marginBottom: 20 } },
1412
+ h('div', { className: 'card-header' }, h('span', null, 'Budget Alerts')),
1413
+ budgetAlerts.length > 0
1414
+ ? h('div', { className: 'card-body-flush' },
1415
+ h('table', { className: 'data-table' },
1416
+ h('thead', null,
1417
+ h('tr', null,
1418
+ h('th', null, 'Time'),
1419
+ h('th', null, 'Type'),
1420
+ h('th', null, 'Budget Type'),
1421
+ h('th', null, 'Current'),
1422
+ h('th', null, 'Limit'),
1423
+ h('th', null, 'Status'),
1424
+ h('th', null, '')
1425
+ )
1426
+ ),
1427
+ h('tbody', null,
1428
+ budgetAlerts.map(function(alert, i) {
1429
+ var alertType = alert.type || alert.alertType || 'warning';
1430
+ var budgetType = alert.budgetType || alert.budget_type || 'tokens';
1431
+ var current = alert.currentValue || alert.current || 0;
1432
+ var limit = alert.limitValue || alert.limit || 0;
1433
+ var acknowledged = alert.acknowledged || alert.acked || false;
1434
+ var time = alert.createdAt || alert.created_at || alert.timestamp;
1435
+ var typeColor = alertType === 'critical' ? 'badge-danger' : alertType === 'warning' ? 'badge-warning' : 'badge-info';
1436
+
1437
+ return h('tr', { key: alert.id || i },
1438
+ h('td', { style: { fontSize: 12 } }, time ? new Date(time).toLocaleString() : '-'),
1439
+ h('td', null, h('span', { className: 'badge ' + typeColor }, alertType)),
1440
+ h('td', null, h('span', { className: 'badge badge-neutral' }, budgetType)),
1441
+ h('td', { style: { fontFamily: 'monospace', fontSize: 12 } }, budgetType === 'cost' ? formatCost(current) : formatNumber(current)),
1442
+ h('td', { style: { fontFamily: 'monospace', fontSize: 12 } }, budgetType === 'cost' ? formatCost(limit) : formatNumber(limit)),
1443
+ h('td', null, h('span', { className: acknowledged ? 'badge badge-neutral' : 'badge badge-warning' }, acknowledged ? 'Acknowledged' : 'Pending')),
1444
+ h('td', null,
1445
+ !acknowledged && h('button', {
1446
+ className: 'btn btn-ghost btn-sm',
1447
+ onClick: function() { acknowledgeAlert(alert.id); }
1448
+ }, I.check(), ' Ack')
1449
+ )
1450
+ );
1451
+ })
1452
+ )
1453
+ )
1454
+ )
1455
+ : h('div', { className: 'card-body' },
1456
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No budget alerts.')
1457
+ )
1458
+ )
1459
+ );
1460
+ }
1461
+ // --- ActivitySection ------------------------------------------------
1462
+
1463
+ function ActivitySection(props) {
1464
+ var agentId = props.agentId;
1465
+ var app = useApp();
1466
+ var toast = app.toast;
1467
+
1468
+ var _tab = useState('events');
1469
+ var activeTab = _tab[0]; var setActiveTab = _tab[1];
1470
+
1471
+ var _events = useState([]);
1472
+ var events = _events[0]; var setEvents = _events[1];
1473
+ var _toolCalls = useState([]);
1474
+ var toolCalls = _toolCalls[0]; var setToolCalls = _toolCalls[1];
1475
+ var _journal = useState([]);
1476
+ var journalEntries = _journal[0]; var setJournalEntries = _journal[1];
1477
+ var _loading = useState(false);
1478
+ var loading = _loading[0]; var setLoading = _loading[1];
1479
+ var _selectedItem = useState(null);
1480
+ var selectedItem = _selectedItem[0]; var setSelectedItem = _selectedItem[1];
1481
+
1482
+ var loadEvents = function() {
1483
+ engineCall('/activity/events?agentId=' + agentId + '&limit=50')
1484
+ .then(function(d) { setEvents(d.events || []); })
1485
+ .catch(function() {});
1486
+ };
1487
+ var loadToolCalls = function() {
1488
+ engineCall('/activity/tool-calls?agentId=' + agentId + '&limit=50')
1489
+ .then(function(d) { setToolCalls(d.toolCalls || []); })
1490
+ .catch(function() {});
1491
+ };
1492
+ var loadJournal = function() {
1493
+ engineCall('/journal?agentId=' + agentId + '&orgId=default&limit=50')
1494
+ .then(function(d) { setJournalEntries(d.entries || []); })
1495
+ .catch(function() {});
1496
+ };
1497
+
1498
+ var loadAll = function() {
1499
+ setLoading(true);
1500
+ Promise.all([
1501
+ engineCall('/activity/events?agentId=' + agentId + '&limit=50').then(function(d) { setEvents(d.events || []); }).catch(function() {}),
1502
+ engineCall('/activity/tool-calls?agentId=' + agentId + '&limit=50').then(function(d) { setToolCalls(d.toolCalls || []); }).catch(function() {}),
1503
+ engineCall('/journal?agentId=' + agentId + '&orgId=default&limit=50').then(function(d) { setJournalEntries(d.entries || []); }).catch(function() {}),
1504
+ ]).then(function() { setLoading(false); }).catch(function() { setLoading(false); });
1505
+ };
1506
+
1507
+ useEffect(loadAll, []);
1508
+
1509
+ var rollback = function(id) {
1510
+ showConfirm({
1511
+ title: 'Rollback Action',
1512
+ message: 'Are you sure you want to rollback this journal entry? This will attempt to reverse the original action.',
1513
+ warning: true,
1514
+ confirmText: 'Rollback'
1515
+ }).then(function(confirmed) {
1516
+ if (!confirmed) return;
1517
+ engineCall('/journal/' + id + '/rollback', { method: 'POST', body: JSON.stringify({}) })
1518
+ .then(function(r) {
1519
+ if (r.success) { toast('Action rolled back', 'success'); loadJournal(); }
1520
+ else { toast('Rollback failed: ' + (r.error || 'Unknown'), 'error'); }
1521
+ })
1522
+ .catch(function(e) { toast(e.message, 'error'); });
1523
+ });
1524
+ };
1525
+
1526
+ var refreshCurrent = function() {
1527
+ if (activeTab === 'events') loadEvents();
1528
+ else if (activeTab === 'tools') loadToolCalls();
1529
+ else if (activeTab === 'journal') loadJournal();
1530
+ };
1531
+
1532
+ return h('div', { className: 'card' },
1533
+ h('div', { className: 'card-header', style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
1534
+ h('h3', { style: { margin: 0, fontSize: 15, fontWeight: 600 } }, 'Activity'),
1535
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: refreshCurrent }, I.refresh(), ' Refresh')
1536
+ ),
1537
+ h('div', { style: { borderBottom: '1px solid var(--border)' } },
1538
+ h('div', { className: 'tabs', style: { padding: '0 16px' } },
1539
+ h('div', { className: 'tab' + (activeTab === 'events' ? ' active' : ''), onClick: function() { setActiveTab('events'); } }, 'Events'),
1540
+ h('div', { className: 'tab' + (activeTab === 'tools' ? ' active' : ''), onClick: function() { setActiveTab('tools'); } }, 'Tool Calls'),
1541
+ h('div', { className: 'tab' + (activeTab === 'journal' ? ' active' : ''), onClick: function() { setActiveTab('journal'); } }, 'Journal')
1542
+ )
1543
+ ),
1544
+ h('div', { className: 'card-body-flush' },
1545
+
1546
+ // Events Tab
1547
+ activeTab === 'events' && (
1548
+ events.length === 0
1549
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No events recorded for this agent')
1550
+ : h('table', { className: 'data-table' },
1551
+ h('thead', null,
1552
+ h('tr', null,
1553
+ h('th', null, 'Time'),
1554
+ h('th', null, 'Type'),
1555
+ h('th', null, 'Details')
1556
+ )
1557
+ ),
1558
+ h('tbody', null,
1559
+ events.map(function(ev, i) {
1560
+ var details = typeof ev.data === 'object' ? JSON.stringify(ev.data) : (ev.details || ev.data || '-');
1561
+ return h('tr', { key: ev.id || i, onClick: function() { setSelectedItem(ev); }, style: { cursor: 'pointer' } },
1562
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, new Date(ev.timestamp || ev.createdAt).toLocaleString()),
1563
+ h('td', null, h('span', { className: 'badge badge-info' }, ev.type || ev.eventType || '-')),
1564
+ h('td', { style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12, maxWidth: 400, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: 'var(--text-secondary)' } }, details)
1565
+ );
1566
+ })
1567
+ )
1568
+ )
1569
+ ),
1570
+
1571
+ // Tool Calls Tab
1572
+ activeTab === 'tools' && (
1573
+ toolCalls.length === 0
1574
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No tool calls recorded for this agent')
1575
+ : h('table', { className: 'data-table' },
1576
+ h('thead', null,
1577
+ h('tr', null,
1578
+ h('th', null, 'Time'),
1579
+ h('th', null, 'Tool'),
1580
+ h('th', null, 'Duration'),
1581
+ h('th', null, 'Status')
1582
+ )
1583
+ ),
1584
+ h('tbody', null,
1585
+ toolCalls.map(function(tc, i) {
1586
+ var statusClass = tc.success === true ? 'badge badge-success' : tc.success === false ? 'badge badge-danger' : 'badge badge-neutral';
1587
+ var statusLabel = tc.success === true ? 'OK' : tc.success === false ? 'Failed' : (tc.status || 'Pending');
1588
+ return h('tr', { key: tc.id || i, onClick: function() { setSelectedItem(tc); }, style: { cursor: 'pointer' } },
1589
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, new Date(tc.timestamp || tc.createdAt).toLocaleString()),
1590
+ h('td', null, h('span', { style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12 } }, tc.tool || tc.toolName || '-')),
1591
+ h('td', null, tc.durationMs ? tc.durationMs + 'ms' : '-'),
1592
+ h('td', null, h('span', { className: statusClass }, statusLabel))
1593
+ );
1594
+ })
1595
+ )
1596
+ )
1597
+ ),
1598
+
1599
+ // Journal Tab
1600
+ activeTab === 'journal' && (
1601
+ journalEntries.length === 0
1602
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No journal entries for this agent')
1603
+ : h('table', { className: 'data-table' },
1604
+ h('thead', null,
1605
+ h('tr', null,
1606
+ h('th', null, 'Time'),
1607
+ h('th', null, 'Tool'),
1608
+ h('th', null, 'Action Type'),
1609
+ h('th', null, 'Reversible'),
1610
+ h('th', null, 'Status'),
1611
+ h('th', null, 'Actions')
1612
+ )
1613
+ ),
1614
+ h('tbody', null,
1615
+ journalEntries.map(function(e) {
1616
+ return h('tr', { key: e.id, onClick: function(evt) { if (evt.target.tagName === 'BUTTON' || evt.target.closest('button')) return; setSelectedItem(e); }, style: { cursor: 'pointer' } },
1617
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, new Date(e.createdAt).toLocaleString()),
1618
+ h('td', null, e.toolName || e.toolId || '-'),
1619
+ h('td', null, h('span', { className: 'badge-tag' }, e.actionType || '-')),
1620
+ h('td', null, e.reversible ? '\u2705' : '\u274C'),
1621
+ h('td', null,
1622
+ e.reversed
1623
+ ? h('span', { className: 'status-badge status-warning' }, 'Rolled Back')
1624
+ : h('span', { className: 'status-badge status-success' }, 'Active')
1625
+ ),
1626
+ h('td', null,
1627
+ e.reversible && !e.reversed && h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { rollback(e.id); } }, I.undo(), ' Rollback')
1628
+ )
1629
+ );
1630
+ })
1631
+ )
1632
+ )
1633
+ )
1634
+ ),
1635
+
1636
+ // ─── Activity Detail Modal ──────────────────────────────
1637
+ selectedItem && (function() {
1638
+ var item = selectedItem;
1639
+ var typeLabel = item.type || item.eventType || item.tool || item.toolName || item.actionType || 'Detail';
1640
+ var typeColor = typeLabel === 'error' ? 'var(--danger)' : typeLabel === 'deployed' || typeLabel === 'started' ? 'var(--success)' : typeLabel === 'stopped' ? 'var(--warning)' : 'var(--accent)';
1641
+ return h(DetailModal, {
1642
+ title: activeTab === 'events' ? 'Event Detail' : activeTab === 'tools' ? 'Tool Call Detail' : 'Journal Entry Detail',
1643
+ onClose: function() { setSelectedItem(null); },
1644
+ badge: { label: typeLabel, color: typeColor },
1645
+ data: item,
1646
+ exclude: ['agentId']
1647
+ });
1648
+ })()
1649
+ );
1650
+ }
1651
+
1652
+ // --- CommunicationSection -------------------------------------------
1653
+
1654
+ function CommunicationSection(props) {
1655
+ var agentId = props.agentId;
1656
+ var agents = props.agents || [];
1657
+ var app = useApp();
1658
+ var toast = app.toast;
1659
+
1660
+ var agentData = buildAgentDataMap(agents);
1661
+
1662
+ var _tab = useState('all');
1663
+ var activeTab = _tab[0]; var setActiveTab = _tab[1];
1664
+
1665
+ var _messages = useState([]);
1666
+ var messages = _messages[0]; var setMessages = _messages[1];
1667
+ var _inbox = useState([]);
1668
+ var inbox = _inbox[0]; var setInbox = _inbox[1];
1669
+ var _topology = useState(null);
1670
+ var topology = _topology[0]; var setTopology = _topology[1];
1671
+ var _showSend = useState(false);
1672
+ var showSend = _showSend[0]; var setShowSend = _showSend[1];
1673
+ var _form = useState({ toAgentId: '', subject: '', content: '', priority: 'normal' });
1674
+ var form = _form[0]; var setForm = _form[1];
1675
+
1676
+ var loadMessages = function() {
1677
+ engineCall('/messages?agentId=' + agentId + '&orgId=default&limit=50')
1678
+ .then(function(d) { setMessages(d.messages || []); })
1679
+ .catch(function() {});
1680
+ };
1681
+ var loadInbox = function() {
1682
+ engineCall('/messages/inbox/' + agentId + '?orgId=default')
1683
+ .then(function(d) { setInbox(d.messages || []); })
1684
+ .catch(function() {});
1685
+ };
1686
+ var loadTopology = function() {
1687
+ engineCall('/messages/topology?agentId=' + agentId + '&orgId=default')
1688
+ .then(function(d) { setTopology(d.topology || d || null); })
1689
+ .catch(function() {});
1690
+ };
1691
+
1692
+ var loadAll = function() {
1693
+ loadMessages();
1694
+ loadInbox();
1695
+ loadTopology();
1696
+ };
1697
+
1698
+ useEffect(loadAll, []);
1699
+
1700
+ var markRead = function(id) {
1701
+ engineCall('/messages/' + id + '/read', { method: 'POST', body: JSON.stringify({}) })
1702
+ .then(function() { toast('Message marked as read', 'success'); loadInbox(); })
1703
+ .catch(function(e) { toast(e.message, 'error'); });
1704
+ };
1705
+
1706
+ var sendMessage = function() {
1707
+ if (!form.toAgentId || !form.subject) { toast('Recipient and subject are required', 'error'); return; }
1708
+ var body = {
1709
+ fromAgentId: agentId,
1710
+ toAgentId: form.toAgentId,
1711
+ orgId: 'default',
1712
+ subject: form.subject,
1713
+ content: form.content,
1714
+ priority: form.priority
1715
+ };
1716
+ engineCall('/messages', { method: 'POST', body: JSON.stringify(body) })
1717
+ .then(function() {
1718
+ toast('Message sent', 'success');
1719
+ setShowSend(false);
1720
+ setForm({ toAgentId: '', subject: '', content: '', priority: 'normal' });
1721
+ loadMessages();
1722
+ loadInbox();
1723
+ loadTopology();
1724
+ })
1725
+ .catch(function(e) { toast(e.message, 'error'); });
1726
+ };
1727
+
1728
+ var refreshCurrent = function() {
1729
+ if (activeTab === 'all') loadMessages();
1730
+ else if (activeTab === 'inbox') loadInbox();
1731
+ else if (activeTab === 'topology') loadTopology();
1732
+ };
1733
+
1734
+ var directionBadge = function(msg) {
1735
+ var dir = msg.direction || (msg.fromAgentId === agentId ? 'sent' : 'received');
1736
+ if (dir === 'sent' || dir === 'outbound') return h('span', { className: 'badge badge-primary' }, 'Sent');
1737
+ if (dir === 'received' || dir === 'inbound') return h('span', { className: 'badge badge-success' }, 'Received');
1738
+ return h('span', { className: 'badge badge-neutral' }, dir);
1739
+ };
1740
+
1741
+ var priorityBadge = function(p) {
1742
+ if (p === 'urgent') return h('span', { className: 'badge badge-danger' }, 'Urgent');
1743
+ if (p === 'high') return h('span', { className: 'badge badge-warning' }, 'High');
1744
+ if (p === 'normal') return h('span', { className: 'badge badge-neutral' }, 'Normal');
1745
+ return h('span', { className: 'badge badge-neutral' }, p || 'Normal');
1746
+ };
1747
+
1748
+ // Derive topology partners list
1749
+ var partners = [];
1750
+ if (topology) {
1751
+ var edges = topology.edges || [];
1752
+ var partnerMap = {};
1753
+ edges.forEach(function(edge) {
1754
+ var partnerId = null;
1755
+ var sent = 0;
1756
+ var received = 0;
1757
+ if (edge.from === agentId) {
1758
+ partnerId = edge.to;
1759
+ sent = edge.count || edge.messageCount || 1;
1760
+ } else if (edge.to === agentId) {
1761
+ partnerId = edge.from;
1762
+ received = edge.count || edge.messageCount || 1;
1763
+ }
1764
+ if (partnerId) {
1765
+ if (!partnerMap[partnerId]) partnerMap[partnerId] = { id: partnerId, sent: 0, received: 0 };
1766
+ partnerMap[partnerId].sent += sent;
1767
+ partnerMap[partnerId].received += received;
1768
+ }
1769
+ });
1770
+ partners = Object.keys(partnerMap).map(function(k) { return partnerMap[k]; });
1771
+ }
1772
+
1773
+ return h('div', { className: 'card' },
1774
+ h('div', { className: 'card-header', style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
1775
+ h('h3', { style: { margin: 0, fontSize: 15, fontWeight: 600 } }, 'Communication'),
1776
+ h('div', { style: { display: 'flex', gap: 8 } },
1777
+ h('button', { className: 'btn btn-primary btn-sm', onClick: function() { setShowSend(true); } }, I.plus(), ' Send Message'),
1778
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: refreshCurrent }, I.refresh(), ' Refresh')
1779
+ )
1780
+ ),
1781
+ h('div', { style: { borderBottom: '1px solid var(--border)' } },
1782
+ h('div', { className: 'tabs', style: { padding: '0 16px' } },
1783
+ h('div', { className: 'tab' + (activeTab === 'all' ? ' active' : ''), onClick: function() { setActiveTab('all'); } }, 'All Messages'),
1784
+ h('div', { className: 'tab' + (activeTab === 'inbox' ? ' active' : ''), onClick: function() { setActiveTab('inbox'); } }, 'Inbox'),
1785
+ h('div', { className: 'tab' + (activeTab === 'topology' ? ' active' : ''), onClick: function() { setActiveTab('topology'); } }, 'Topology')
1786
+ )
1787
+ ),
1788
+ h('div', { className: 'card-body-flush' },
1789
+
1790
+ // All Messages Tab
1791
+ activeTab === 'all' && (
1792
+ messages.length === 0
1793
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No messages found for this agent')
1794
+ : h('table', { className: 'data-table' },
1795
+ h('thead', null,
1796
+ h('tr', null,
1797
+ h('th', null, 'Time'),
1798
+ h('th', null, 'Direction'),
1799
+ h('th', null, 'From'),
1800
+ h('th', null, 'To'),
1801
+ h('th', null, 'Subject'),
1802
+ h('th', null, 'Type'),
1803
+ h('th', null, 'Priority')
1804
+ )
1805
+ ),
1806
+ h('tbody', null,
1807
+ messages.map(function(msg, i) {
1808
+ return h('tr', { key: msg.id || i },
1809
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, new Date(msg.createdAt || msg.timestamp).toLocaleString()),
1810
+ h('td', null, directionBadge(msg)),
1811
+ h('td', null, renderAgentBadge(msg.fromAgentId, agentData)),
1812
+ h('td', null, renderAgentBadge(msg.toAgentId, agentData)),
1813
+ h('td', { style: { maxWidth: 200, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', fontSize: 13 } }, msg.subject || '-'),
1814
+ h('td', null, msg.type ? h('span', { className: 'badge badge-info' }, msg.type) : '-'),
1815
+ h('td', null, priorityBadge(msg.priority))
1816
+ );
1817
+ })
1818
+ )
1819
+ )
1820
+ ),
1821
+
1822
+ // Inbox Tab
1823
+ activeTab === 'inbox' && (
1824
+ inbox.length === 0
1825
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No inbox messages for this agent')
1826
+ : h('table', { className: 'data-table' },
1827
+ h('thead', null,
1828
+ h('tr', null,
1829
+ h('th', null, 'Time'),
1830
+ h('th', null, 'From'),
1831
+ h('th', null, 'Subject'),
1832
+ h('th', null, 'Type'),
1833
+ h('th', null, 'Priority'),
1834
+ h('th', null, 'Status'),
1835
+ h('th', null, 'Actions')
1836
+ )
1837
+ ),
1838
+ h('tbody', null,
1839
+ inbox.map(function(msg, i) {
1840
+ var isRead = msg.read || msg.status === 'read';
1841
+ return h('tr', { key: msg.id || i, style: !isRead ? { fontWeight: 500 } : {} },
1842
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, new Date(msg.createdAt || msg.timestamp).toLocaleString()),
1843
+ h('td', null, renderAgentBadge(msg.fromAgentId, agentData)),
1844
+ h('td', { style: { maxWidth: 200, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', fontSize: 13 } }, msg.subject || '-'),
1845
+ h('td', null, msg.type ? h('span', { className: 'badge badge-info' }, msg.type) : '-'),
1846
+ h('td', null, priorityBadge(msg.priority)),
1847
+ h('td', null,
1848
+ isRead
1849
+ ? h('span', { className: 'badge badge-neutral' }, 'Read')
1850
+ : h('span', { className: 'badge badge-warning' }, 'Unread')
1851
+ ),
1852
+ h('td', null,
1853
+ !isRead && h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { markRead(msg.id); } }, I.check(), ' Mark Read')
1854
+ )
1855
+ );
1856
+ })
1857
+ )
1858
+ )
1859
+ ),
1860
+
1861
+ // Topology Tab
1862
+ activeTab === 'topology' && (
1863
+ partners.length === 0
1864
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No communication data yet')
1865
+ : h('div', { style: { padding: 16 } },
1866
+ h('div', { style: { fontSize: 13, color: 'var(--text-muted)', marginBottom: 12 } }, 'Communication partners for this agent:'),
1867
+ h('div', { style: { display: 'grid', gap: 10 } },
1868
+ partners.map(function(p) {
1869
+ return h('div', { key: p.id, style: { display: 'flex', alignItems: 'center', gap: 16, padding: '12px 16px', background: 'var(--bg-tertiary)', borderRadius: 8, border: '1px solid var(--border)' } },
1870
+ h('div', { style: { flex: 1 } }, renderAgentBadge(p.id, agentData)),
1871
+ h('div', { style: { display: 'flex', gap: 16, fontSize: 12 } },
1872
+ h('div', { style: { textAlign: 'center' } },
1873
+ h('div', { style: { fontWeight: 700, fontSize: 16, color: 'var(--info)' } }, p.sent),
1874
+ h('div', { style: { color: 'var(--text-muted)' } }, 'Sent')
1875
+ ),
1876
+ h('div', { style: { textAlign: 'center' } },
1877
+ h('div', { style: { fontWeight: 700, fontSize: 16, color: 'var(--success)' } }, p.received),
1878
+ h('div', { style: { color: 'var(--text-muted)' } }, 'Received')
1879
+ )
1880
+ )
1881
+ );
1882
+ })
1883
+ )
1884
+ )
1885
+ )
1886
+ ),
1887
+
1888
+ // Send Message Modal
1889
+ showSend && h('div', { className: 'modal-overlay', onClick: function() { setShowSend(false); } },
1890
+ h('div', { className: 'modal', style: { maxWidth: 540 }, onClick: function(e) { e.stopPropagation(); } },
1891
+ h('div', { className: 'modal-header' },
1892
+ h('h2', null, 'Send Message'),
1893
+ h('button', { className: 'btn btn-ghost btn-icon', onClick: function() { setShowSend(false); } }, I.x())
1894
+ ),
1895
+ h('div', { className: 'modal-body' },
1896
+ h('div', { className: 'form-group' },
1897
+ h('label', { className: 'form-label' }, 'To Agent'),
1898
+ h('select', { className: 'input', value: form.toAgentId, onChange: function(e) { setForm(Object.assign({}, form, { toAgentId: e.target.value })); } },
1899
+ h('option', { value: '' }, '-- Select Recipient --'),
1900
+ agents.filter(function(a) { return a.id !== agentId; }).map(function(a) {
1901
+ var name = (a.config && a.config.displayName) || (a.config && a.config.name) || a.name || 'Agent';
1902
+ var email = a.config && a.config.email && a.config.email.address;
1903
+ return h('option', { key: a.id, value: a.id }, name + (email ? ' (' + email + ')' : ''));
1904
+ })
1905
+ )
1906
+ ),
1907
+ h('div', { className: 'form-group' },
1908
+ h('label', { className: 'form-label' }, 'Subject'),
1909
+ h('input', { className: 'input', placeholder: 'Message subject', value: form.subject, onChange: function(e) { setForm(Object.assign({}, form, { subject: e.target.value })); } })
1910
+ ),
1911
+ h('div', { className: 'form-group' },
1912
+ h('label', { className: 'form-label' }, 'Content'),
1913
+ h('textarea', { className: 'input', style: { minHeight: 120 }, placeholder: 'Message content...', value: form.content, onChange: function(e) { setForm(Object.assign({}, form, { content: e.target.value })); } })
1914
+ ),
1915
+ h('div', { className: 'form-group' },
1916
+ h('label', { className: 'form-label' }, 'Priority'),
1917
+ h('select', { className: 'input', value: form.priority, onChange: function(e) { setForm(Object.assign({}, form, { priority: e.target.value })); } },
1918
+ h('option', { value: 'low' }, 'Low'),
1919
+ h('option', { value: 'normal' }, 'Normal'),
1920
+ h('option', { value: 'high' }, 'High'),
1921
+ h('option', { value: 'urgent' }, 'Urgent')
1922
+ )
1923
+ )
1924
+ ),
1925
+ h('div', { className: 'modal-footer' },
1926
+ h('button', { className: 'btn btn-ghost', onClick: function() { setShowSend(false); } }, 'Cancel'),
1927
+ h('button', { className: 'btn btn-primary', onClick: sendMessage }, 'Send Message')
1928
+ )
1929
+ )
1930
+ )
1931
+ );
1932
+ }
1933
+
1934
+ // --- MemorySection --------------------------------------------------
1935
+
1936
+ function MemorySection(props) {
1937
+ var agentId = props.agentId;
1938
+ var app = useApp();
1939
+ var toast = app.toast;
1940
+
1941
+ var _memories = useState([]);
1942
+ var memories = _memories[0]; var setMemories = _memories[1];
1943
+ var _stats = useState(null);
1944
+ var memoryStats = _stats[0]; var setMemoryStats = _stats[1];
1945
+ var _search = useState('');
1946
+ var searchQuery = _search[0]; var setSearchQuery = _search[1];
1947
+ var _filterCat = useState('');
1948
+ var filterCategory = _filterCat[0]; var setFilterCategory = _filterCat[1];
1949
+ var _filterImp = useState('');
1950
+ var filterImportance = _filterImp[0]; var setFilterImportance = _filterImp[1];
1951
+ var _showCreate = useState(false);
1952
+ var showCreateModal = _showCreate[0]; var setShowCreateModal = _showCreate[1];
1953
+ var _form = useState({ title: '', content: '', category: 'org_knowledge', importance: 'normal', tags: '' });
1954
+ var createForm = _form[0]; var setCreateForm = _form[1];
1955
+
1956
+ var buildQueryParams = function() {
1957
+ var params = '?limit=50';
1958
+ if (searchQuery) params += '&search=' + encodeURIComponent(searchQuery);
1959
+ if (filterCategory) params += '&category=' + filterCategory;
1960
+ if (filterImportance) params += '&importance=' + filterImportance;
1961
+ return params;
1962
+ };
1963
+
1964
+ var loadMemories = function() {
1965
+ var params = buildQueryParams();
1966
+ engineCall('/memory/agent/' + agentId + params)
1967
+ .then(function(d) { setMemories(d.memories || []); })
1968
+ .catch(function() {});
1969
+ };
1970
+
1971
+ var loadStats = function() {
1972
+ engineCall('/memory/agent/' + agentId + '/stats')
1973
+ .then(function(d) { setMemoryStats(d); })
1974
+ .catch(function() {});
1975
+ };
1976
+
1977
+ var loadAll = function() {
1978
+ loadMemories();
1979
+ loadStats();
1980
+ };
1981
+
1982
+ useEffect(loadAll, []);
1983
+ useEffect(function() { loadMemories(); }, [filterCategory, filterImportance]);
1984
+
1985
+ var handleSearch = function() {
1986
+ loadMemories();
1987
+ };
1988
+
1989
+ var createMemory = function() {
1990
+ if (!createForm.title || !createForm.content) { toast('Title and content are required', 'error'); return; }
1991
+ var tagsArray = createForm.tags ? createForm.tags.split(',').map(function(s) { return s.trim(); }).filter(Boolean) : [];
1992
+ var body = {
1993
+ agentId: agentId,
1994
+ orgId: 'default',
1995
+ title: createForm.title,
1996
+ content: createForm.content,
1997
+ category: createForm.category,
1998
+ importance: createForm.importance,
1999
+ source: 'admin',
2000
+ tags: tagsArray
2001
+ };
2002
+ engineCall('/memory', { method: 'POST', body: JSON.stringify(body) })
2003
+ .then(function() {
2004
+ toast('Memory created', 'success');
2005
+ setShowCreateModal(false);
2006
+ setCreateForm({ title: '', content: '', category: 'org_knowledge', importance: 'normal', tags: '' });
2007
+ loadAll();
2008
+ })
2009
+ .catch(function(e) { toast(e.message, 'error'); });
2010
+ };
2011
+
2012
+ var deleteMemory = function(id) {
2013
+ showConfirm({
2014
+ title: 'Delete Memory',
2015
+ message: 'Are you sure you want to delete this memory entry? This action cannot be undone.',
2016
+ danger: true,
2017
+ confirmText: 'Delete'
2018
+ }).then(function(confirmed) {
2019
+ if (!confirmed) return;
2020
+ engineCall('/memory/' + id, { method: 'DELETE' })
2021
+ .then(function() { toast('Memory deleted', 'success'); loadAll(); })
2022
+ .catch(function(e) { toast(e.message, 'error'); });
2023
+ });
2024
+ };
2025
+
2026
+ var pruneStale = function() {
2027
+ showConfirm({
2028
+ title: 'Prune Stale Memories',
2029
+ message: 'This will remove expired and stale memory entries for this agent. This action cannot be undone.',
2030
+ warning: true,
2031
+ confirmText: 'Prune'
2032
+ }).then(function(confirmed) {
2033
+ if (!confirmed) return;
2034
+ engineCall('/memory/agent/' + agentId + '/prune', { method: 'POST' })
2035
+ .then(function(d) { toast('Pruned ' + (d.pruned || 0) + ' entries', 'success'); loadAll(); })
2036
+ .catch(function(e) { toast(e.message, 'error'); });
2037
+ });
2038
+ };
2039
+
2040
+ var runDecay = function() {
2041
+ showConfirm({
2042
+ title: 'Run Confidence Decay',
2043
+ message: 'This will reduce the confidence score of memories that have not been accessed recently. Decay rate: 10%.',
2044
+ warning: true,
2045
+ confirmText: 'Run Decay'
2046
+ }).then(function(confirmed) {
2047
+ if (!confirmed) return;
2048
+ engineCall('/memory/agent/' + agentId + '/decay', { method: 'POST', body: JSON.stringify({ decayRate: 0.1 }) })
2049
+ .then(function(d) { toast('Decayed ' + (d.affected || 0) + ' entries', 'success'); loadAll(); })
2050
+ .catch(function(e) { toast(e.message, 'error'); });
2051
+ });
2052
+ };
2053
+
2054
+ // Derive stats values
2055
+ var totalMemories = memoryStats ? (memoryStats.totalEntries || memoryStats.total || 0) : 0;
2056
+ var categoriesUsed = memoryStats && memoryStats.byCategory ? Object.keys(memoryStats.byCategory).length : 0;
2057
+ var avgConfidence = memoryStats && memoryStats.avgConfidence != null ? ((memoryStats.avgConfidence * 100).toFixed(0) + '%') : '-';
2058
+ var sourcesCount = memoryStats && memoryStats.bySource ? Object.keys(memoryStats.bySource).length : 0;
2059
+
2060
+ return h('div', { className: 'card' },
2061
+ h('div', { className: 'card-header', style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
2062
+ h('h3', { style: { margin: 0, fontSize: 15, fontWeight: 600 } }, 'Memory'),
2063
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: loadAll }, I.refresh(), ' Refresh')
2064
+ ),
2065
+ h('div', { className: 'card-body' },
2066
+
2067
+ // Stats Row
2068
+ h('div', { className: 'stat-grid', style: { marginBottom: 16 } },
2069
+ h('div', { className: 'stat-card' },
2070
+ h('div', { className: 'stat-value' }, totalMemories),
2071
+ h('div', { className: 'stat-label' }, 'Total Memories')
2072
+ ),
2073
+ h('div', { className: 'stat-card' },
2074
+ h('div', { className: 'stat-value' }, categoriesUsed),
2075
+ h('div', { className: 'stat-label' }, 'Categories Used')
2076
+ ),
2077
+ h('div', { className: 'stat-card' },
2078
+ h('div', { className: 'stat-value' }, avgConfidence),
2079
+ h('div', { className: 'stat-label' }, 'Avg Confidence')
2080
+ ),
2081
+ h('div', { className: 'stat-card' },
2082
+ h('div', { className: 'stat-value' }, sourcesCount),
2083
+ h('div', { className: 'stat-label' }, 'Sources')
2084
+ )
2085
+ ),
2086
+
2087
+ // Filter Bar
2088
+ h('div', { style: { display: 'flex', gap: 8, marginBottom: 16, flexWrap: 'wrap', alignItems: 'center' } },
2089
+ h('div', { style: { position: 'relative', flex: 1, minWidth: 180 } },
2090
+ h('input', {
2091
+ className: 'input',
2092
+ placeholder: 'Search memories...',
2093
+ value: searchQuery,
2094
+ onChange: function(e) { setSearchQuery(e.target.value); },
2095
+ onKeyDown: function(e) { if (e.key === 'Enter') handleSearch(); }
2096
+ })
2097
+ ),
2098
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: handleSearch }, I.search()),
2099
+ h('select', { className: 'input', style: { maxWidth: 170 }, value: filterCategory, onChange: function(e) { setFilterCategory(e.target.value); } },
2100
+ h('option', { value: '' }, 'All Categories'),
2101
+ MEMORY_CATEGORIES.map(function(c) { return h('option', { key: c.value, value: c.value }, c.label); })
2102
+ ),
2103
+ h('select', { className: 'input', style: { maxWidth: 150 }, value: filterImportance, onChange: function(e) { setFilterImportance(e.target.value); } },
2104
+ h('option', { value: '' }, 'All Importance'),
2105
+ h('option', { value: 'critical' }, 'Critical'),
2106
+ h('option', { value: 'high' }, 'High'),
2107
+ h('option', { value: 'normal' }, 'Normal'),
2108
+ h('option', { value: 'low' }, 'Low')
2109
+ ),
2110
+ h('div', { style: { flex: '0 0 auto' } }),
2111
+ h('button', { className: 'btn btn-primary btn-sm', onClick: function() { setShowCreateModal(true); } }, I.plus(), ' Create Memory'),
2112
+ h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--warning)' }, onClick: pruneStale }, I.trash(), ' Prune Stale'),
2113
+ h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--warning)' }, onClick: runDecay }, I.clock(), ' Run Decay')
2114
+ ),
2115
+
2116
+ // Memory Cards List
2117
+ memories.length === 0
2118
+ ? h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'No memories found for this agent')
2119
+ : h('div', { style: { display: 'grid', gap: 10 } },
2120
+ memories.map(function(m) {
2121
+ var truncatedContent = m.content && m.content.length > 200 ? m.content.substring(0, 200) + '...' : (m.content || '');
2122
+ var tags = m.tags || [];
2123
+ var confidence = m.confidence != null ? ((m.confidence * 100).toFixed(0) + '%') : '-';
2124
+ var created = m.createdAt ? new Date(m.createdAt).toLocaleDateString() : '-';
2125
+ var lastAccessed = m.lastAccessedAt ? new Date(m.lastAccessedAt).toLocaleDateString() : '-';
2126
+
2127
+ return h('div', { key: m.id, style: { padding: '14px 18px', background: 'var(--bg-tertiary)', borderRadius: 8, border: '1px solid var(--border)' } },
2128
+ // Title
2129
+ h('div', { style: { fontWeight: 600, fontSize: 14, marginBottom: 6 } }, m.title || 'Untitled'),
2130
+
2131
+ // Category + Importance + Source badges row
2132
+ h('div', { style: { display: 'flex', gap: 6, marginBottom: 8, flexWrap: 'wrap' } },
2133
+ h('span', { style: { display: 'inline-block', padding: '2px 8px', borderRadius: 4, fontSize: 11, fontWeight: 600, color: '#fff', background: memCatColor(m.category) } }, memCatLabel(m.category)),
2134
+ h('span', { style: { display: 'inline-block', padding: '2px 8px', borderRadius: 4, fontSize: 11, fontWeight: 600, color: '#fff', background: importanceBadgeColor(m.importance) } }, m.importance || 'normal'),
2135
+ m.source && h('span', { className: 'badge badge-neutral' }, m.source)
2136
+ ),
2137
+
2138
+ // Content (truncated)
2139
+ h('div', { style: { fontSize: 13, color: 'var(--text-muted)', marginBottom: 8, lineHeight: 1.5, overflow: 'hidden', textOverflow: 'ellipsis' } }, truncatedContent),
2140
+
2141
+ // Tags row
2142
+ tags.length > 0 && h('div', { style: { display: 'flex', gap: 4, marginBottom: 8, flexWrap: 'wrap' } },
2143
+ tags.map(function(tag, ti) {
2144
+ return h('span', { key: ti, className: 'badge badge-neutral', style: { fontSize: 10 } }, tag);
2145
+ })
2146
+ ),
2147
+
2148
+ // Meta row: confidence, created, last accessed, delete button
2149
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 16, fontSize: 11, color: 'var(--text-muted)' } },
2150
+ h('span', null, 'Confidence: ', h('strong', null, confidence)),
2151
+ h('span', null, 'Created: ', created),
2152
+ h('span', null, 'Last accessed: ', lastAccessed),
2153
+ h('div', { style: { flex: 1 } }),
2154
+ h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--danger)' }, onClick: function() { deleteMemory(m.id); } }, I.trash(), ' Delete')
2155
+ )
2156
+ );
2157
+ })
2158
+ )
2159
+ ),
2160
+
2161
+ // Create Memory Modal
2162
+ showCreateModal && h('div', { className: 'modal-overlay', onClick: function() { setShowCreateModal(false); } },
2163
+ h('div', { className: 'modal', style: { maxWidth: 540 }, onClick: function(e) { e.stopPropagation(); } },
2164
+ h('div', { className: 'modal-header' },
2165
+ h('h2', null, 'Create Memory'),
2166
+ h('button', { className: 'btn btn-ghost btn-icon', onClick: function() { setShowCreateModal(false); } }, I.x())
2167
+ ),
2168
+ h('div', { className: 'modal-body' },
2169
+ h('div', { className: 'form-group' },
2170
+ h('label', { className: 'form-label' }, 'Title *'),
2171
+ h('input', { className: 'input', placeholder: 'Memory title', value: createForm.title, onChange: function(e) { setCreateForm(Object.assign({}, createForm, { title: e.target.value })); } })
2172
+ ),
2173
+ h('div', { className: 'form-group' },
2174
+ h('label', { className: 'form-label' }, 'Content *'),
2175
+ h('textarea', { className: 'input', style: { minHeight: 120 }, placeholder: 'Memory content...', value: createForm.content, onChange: function(e) { setCreateForm(Object.assign({}, createForm, { content: e.target.value })); } })
2176
+ ),
2177
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
2178
+ h('div', { className: 'form-group' },
2179
+ h('label', { className: 'form-label' }, 'Category'),
2180
+ h('select', { className: 'input', value: createForm.category, onChange: function(e) { setCreateForm(Object.assign({}, createForm, { category: e.target.value })); } },
2181
+ MEMORY_CATEGORIES.map(function(c) { return h('option', { key: c.value, value: c.value }, c.label); })
2182
+ )
2183
+ ),
2184
+ h('div', { className: 'form-group' },
2185
+ h('label', { className: 'form-label' }, 'Importance'),
2186
+ h('select', { className: 'input', value: createForm.importance, onChange: function(e) { setCreateForm(Object.assign({}, createForm, { importance: e.target.value })); } },
2187
+ h('option', { value: 'critical' }, 'Critical'),
2188
+ h('option', { value: 'high' }, 'High'),
2189
+ h('option', { value: 'normal' }, 'Normal'),
2190
+ h('option', { value: 'low' }, 'Low')
2191
+ )
2192
+ )
2193
+ ),
2194
+ h('div', { className: 'form-group' },
2195
+ h('label', { className: 'form-label' }, 'Tags (comma-separated)'),
2196
+ h('input', { className: 'input', placeholder: 'tag1, tag2, tag3', value: createForm.tags, onChange: function(e) { setCreateForm(Object.assign({}, createForm, { tags: e.target.value })); } })
2197
+ )
2198
+ ),
2199
+ h('div', { className: 'modal-footer' },
2200
+ h('button', { className: 'btn btn-ghost', onClick: function() { setShowCreateModal(false); } }, 'Cancel'),
2201
+ h('button', { className: 'btn btn-primary', onClick: createMemory }, 'Create Memory')
2202
+ )
2203
+ )
2204
+ )
2205
+ );
2206
+ }
2207
+ // ════════════════════════════════════════════════════════════
2208
+ // WORKFORCE SECTION
2209
+ // ════════════════════════════════════════════════════════════
2210
+
2211
+ function WorkforceSection(props) {
2212
+ var agentId = props.agentId;
2213
+ var app = useApp();
2214
+ var toast = app.toast;
2215
+
2216
+ var _schedule = useState(null);
2217
+ var schedule = _schedule[0]; var setSchedule = _schedule[1];
2218
+ var _status = useState(null);
2219
+ var status = _status[0]; var setStatus = _status[1];
2220
+ var _tasks = useState([]);
2221
+ var tasks = _tasks[0]; var setTasks = _tasks[1];
2222
+ var _clockRecords = useState([]);
2223
+ var clockRecords = _clockRecords[0]; var setClockRecords = _clockRecords[1];
2224
+ var _loading = useState(true);
2225
+ var loading = _loading[0]; var setLoading = _loading[1];
2226
+ var _showAddTask = useState(false);
2227
+ var showAddTask = _showAddTask[0]; var setShowAddTask = _showAddTask[1];
2228
+ var _taskForm = useState({ title: '', description: '', priority: 'normal', type: 'general' });
2229
+ var taskForm = _taskForm[0]; var setTaskForm = _taskForm[1];
2230
+
2231
+ var loadAll = function() {
2232
+ setLoading(true);
2233
+ Promise.all([
2234
+ engineCall('/workforce/schedules/' + agentId).catch(function() { return null; }),
2235
+ engineCall('/workforce/status/' + agentId).catch(function() { return null; }),
2236
+ engineCall('/workforce/tasks/' + agentId).catch(function() { return []; }),
2237
+ engineCall('/workforce/clock-records/' + agentId).catch(function() { return []; })
2238
+ ]).then(function(results) {
2239
+ setSchedule(results[0]);
2240
+ setStatus(results[1]);
2241
+ setTasks(results[2]?.tasks || results[2] || []);
2242
+ setClockRecords(results[3]?.records || results[3] || []);
2243
+ setLoading(false);
2244
+ });
2245
+ };
2246
+
2247
+ useEffect(function() { loadAll(); }, [agentId]);
2248
+
2249
+ var clockIn = function() {
2250
+ engineCall('/workforce/clock-in/' + agentId, { method: 'POST' })
2251
+ .then(function() { toast('Agent clocked in', 'success'); loadAll(); })
2252
+ .catch(function(err) { toast(err.message, 'error'); });
2253
+ };
2254
+
2255
+ var clockOut = function() {
2256
+ engineCall('/workforce/clock-out/' + agentId, { method: 'POST' })
2257
+ .then(function() { toast('Agent clocked out', 'success'); loadAll(); })
2258
+ .catch(function(err) { toast(err.message, 'error'); });
2259
+ };
2260
+
2261
+ var addTask = function() {
2262
+ if (!taskForm.title) { toast('Task title is required', 'error'); return; }
2263
+ engineCall('/workforce/tasks', { method: 'POST', body: JSON.stringify({ agentId: agentId, title: taskForm.title, description: taskForm.description, priority: taskForm.priority, type: taskForm.type }) })
2264
+ .then(function() {
2265
+ toast('Task created', 'success');
2266
+ setShowAddTask(false);
2267
+ setTaskForm({ title: '', description: '', priority: 'normal', type: 'general' });
2268
+ loadAll();
2269
+ })
2270
+ .catch(function(err) { toast(err.message, 'error'); });
2271
+ };
2272
+
2273
+ var completeTask = function(id) {
2274
+ engineCall('/workforce/tasks/' + id + '/complete', { method: 'POST' })
2275
+ .then(function() { toast('Task completed', 'success'); loadAll(); })
2276
+ .catch(function(err) { toast(err.message, 'error'); });
2277
+ };
2278
+
2279
+ var cancelTask = function(id) {
2280
+ engineCall('/workforce/tasks/' + id + '/cancel', { method: 'POST' })
2281
+ .then(function() { toast('Task cancelled', 'success'); loadAll(); })
2282
+ .catch(function(err) { toast(err.message, 'error'); });
2283
+ };
2284
+
2285
+ if (loading) {
2286
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading workforce data...');
2287
+ }
2288
+
2289
+ return h(Fragment, null,
2290
+
2291
+ // ─── Status Card ────────────────────────────────────
2292
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2293
+ h('div', { className: 'card-header', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
2294
+ h('span', null, 'Clock Status'),
2295
+ status && status.clockedIn
2296
+ ? h('button', { className: 'btn btn-secondary btn-sm', onClick: clockOut }, I.clock(), ' Clock Out')
2297
+ : h('button', { className: 'btn btn-primary btn-sm', onClick: clockIn }, I.clock(), ' Clock In')
2298
+ ),
2299
+ h('div', { className: 'card-body' },
2300
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 12 } },
2301
+ status && status.clockedIn
2302
+ ? h('span', { className: 'badge badge-success' }, I.check(), ' Clocked In')
2303
+ : h('span', { className: 'badge badge-neutral' }, I.clock(), ' Clocked Out'),
2304
+ status && status.lastClockIn && h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Since: ' + new Date(status.lastClockIn).toLocaleString()),
2305
+ status && status.totalHoursToday != null && h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Hours today: ' + Number(status.totalHoursToday).toFixed(1))
2306
+ )
2307
+ )
2308
+ ),
2309
+
2310
+ // ─── Schedule Card ──────────────────────────────────
2311
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2312
+ h('div', { className: 'card-header' }, h('span', null, 'Schedule')),
2313
+ h('div', { className: 'card-body' },
2314
+ schedule
2315
+ ? h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
2316
+ h('div', null,
2317
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Schedule Type'),
2318
+ h('div', { style: { fontSize: 14, fontWeight: 600 } }, schedule.type || schedule.scheduleType || 'Standard')
2319
+ ),
2320
+ h('div', null,
2321
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Hours'),
2322
+ h('div', { style: { fontSize: 14, fontWeight: 600 } }, schedule.hours || schedule.workHours || '-')
2323
+ ),
2324
+ h('div', null,
2325
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Timezone'),
2326
+ h('div', { style: { fontSize: 14, fontWeight: 600 } }, schedule.timezone || 'UTC')
2327
+ ),
2328
+ h('div', null,
2329
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Enforcement'),
2330
+ h('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap' } },
2331
+ schedule.enforceStart != null && h('span', { className: schedule.enforceStart ? 'badge badge-success' : 'badge badge-neutral' }, schedule.enforceStart ? 'Enforce Start' : 'Flexible Start'),
2332
+ schedule.enforceEnd != null && h('span', { className: schedule.enforceEnd ? 'badge badge-success' : 'badge badge-neutral' }, schedule.enforceEnd ? 'Enforce End' : 'Flexible End'),
2333
+ schedule.enforceBreaks != null && h('span', { className: schedule.enforceBreaks ? 'badge badge-success' : 'badge badge-neutral' }, schedule.enforceBreaks ? 'Enforce Breaks' : 'Flexible Breaks')
2334
+ )
2335
+ )
2336
+ )
2337
+ : h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No schedule configured.')
2338
+ )
2339
+ ),
2340
+
2341
+ // ─── Task Queue ─────────────────────────────────────
2342
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2343
+ h('div', { className: 'card-header', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
2344
+ h('span', null, 'Task Queue'),
2345
+ h('button', { className: 'btn btn-primary btn-sm', onClick: function() { setShowAddTask(true); } }, I.plus(), ' Add Task')
2346
+ ),
2347
+ tasks.length > 0
2348
+ ? h('div', { className: 'card-body-flush' },
2349
+ h('table', { className: 'data-table' },
2350
+ h('thead', null,
2351
+ h('tr', null,
2352
+ h('th', null, 'Title'),
2353
+ h('th', null, 'Priority'),
2354
+ h('th', null, 'Type'),
2355
+ h('th', null, 'Status'),
2356
+ h('th', null, 'Actions')
2357
+ )
2358
+ ),
2359
+ h('tbody', null,
2360
+ tasks.map(function(task, i) {
2361
+ var priorityColor = task.priority === 'urgent' ? 'badge-danger' : task.priority === 'high' ? 'badge-warning' : task.priority === 'low' ? 'badge-neutral' : 'badge-info';
2362
+ var typeColor = task.type === 'email' ? 'badge-primary' : task.type === 'research' ? 'badge-info' : task.type === 'communication' ? 'badge-success' : 'badge-neutral';
2363
+ var statusColor = task.status === 'completed' ? 'badge-success' : task.status === 'cancelled' ? 'badge-neutral' : task.status === 'in_progress' ? 'badge-info' : 'badge-warning';
2364
+
2365
+ return h('tr', { key: task.id || i },
2366
+ h('td', { style: { fontWeight: 500, fontSize: 13 } }, task.title || 'Untitled'),
2367
+ h('td', null, h('span', { className: 'badge ' + priorityColor }, task.priority || 'normal')),
2368
+ h('td', null, h('span', { className: 'badge ' + typeColor }, task.type || 'general')),
2369
+ h('td', null, h('span', { className: 'badge ' + statusColor }, task.status || 'pending')),
2370
+ h('td', null,
2371
+ h('div', { style: { display: 'flex', gap: 4 } },
2372
+ task.status !== 'completed' && task.status !== 'cancelled' && h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { completeTask(task.id); } }, I.check(), ' Complete'),
2373
+ task.status !== 'completed' && task.status !== 'cancelled' && h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--danger)' }, onClick: function() { cancelTask(task.id); } }, I.x(), ' Cancel')
2374
+ )
2375
+ )
2376
+ );
2377
+ })
2378
+ )
2379
+ )
2380
+ )
2381
+ : h('div', { className: 'card-body' },
2382
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No tasks in queue.')
2383
+ )
2384
+ ),
2385
+
2386
+ // ─── Clock History ──────────────────────────────────
2387
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2388
+ h('div', { className: 'card-header' }, h('span', null, 'Clock History')),
2389
+ clockRecords.length > 0
2390
+ ? h('div', { className: 'card-body-flush' },
2391
+ h('table', { className: 'data-table' },
2392
+ h('thead', null,
2393
+ h('tr', null,
2394
+ h('th', null, 'Time'),
2395
+ h('th', null, 'Type'),
2396
+ h('th', null, 'Duration')
2397
+ )
2398
+ ),
2399
+ h('tbody', null,
2400
+ clockRecords.map(function(rec, i) {
2401
+ var recTime = rec.timestamp || rec.createdAt || rec.time;
2402
+ var recType = rec.type || rec.action || 'clock-in';
2403
+ var isClockIn = recType === 'clock-in' || recType === 'clockIn';
2404
+ return h('tr', { key: rec.id || i },
2405
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, recTime ? new Date(recTime).toLocaleString() : '-'),
2406
+ h('td', null, h('span', { className: isClockIn ? 'badge badge-success' : 'badge badge-neutral' }, isClockIn ? 'Clock In' : 'Clock Out')),
2407
+ h('td', { style: { fontSize: 12 } }, rec.duration || rec.durationMinutes ? (rec.durationMinutes || rec.duration) + ' min' : '-')
2408
+ );
2409
+ })
2410
+ )
2411
+ )
2412
+ )
2413
+ : h('div', { className: 'card-body' },
2414
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No clock records.')
2415
+ )
2416
+ ),
2417
+
2418
+ // ─── Add Task Modal ─────────────────────────────────
2419
+ showAddTask && h('div', { className: 'modal-overlay', onClick: function() { setShowAddTask(false); } },
2420
+ h('div', { className: 'modal', style: { maxWidth: 540 }, onClick: function(e) { e.stopPropagation(); } },
2421
+ h('div', { className: 'modal-header' },
2422
+ h('h2', null, 'Add Task'),
2423
+ h('button', { className: 'btn btn-ghost btn-icon', onClick: function() { setShowAddTask(false); } }, I.x())
2424
+ ),
2425
+ h('div', { className: 'modal-body' },
2426
+ h('div', { className: 'form-group' },
2427
+ h('label', { className: 'form-label' }, 'Title *'),
2428
+ h('input', { className: 'input', placeholder: 'Task title', value: taskForm.title, onChange: function(e) { setTaskForm(Object.assign({}, taskForm, { title: e.target.value })); } })
2429
+ ),
2430
+ h('div', { className: 'form-group' },
2431
+ h('label', { className: 'form-label' }, 'Description'),
2432
+ h('textarea', { className: 'input', style: { minHeight: 100 }, placeholder: 'Task description...', value: taskForm.description, onChange: function(e) { setTaskForm(Object.assign({}, taskForm, { description: e.target.value })); } })
2433
+ ),
2434
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
2435
+ h('div', { className: 'form-group' },
2436
+ h('label', { className: 'form-label' }, 'Priority'),
2437
+ h('select', { className: 'input', value: taskForm.priority, onChange: function(e) { setTaskForm(Object.assign({}, taskForm, { priority: e.target.value })); } },
2438
+ h('option', { value: 'low' }, 'Low'),
2439
+ h('option', { value: 'normal' }, 'Normal'),
2440
+ h('option', { value: 'high' }, 'High'),
2441
+ h('option', { value: 'urgent' }, 'Urgent')
2442
+ )
2443
+ ),
2444
+ h('div', { className: 'form-group' },
2445
+ h('label', { className: 'form-label' }, 'Type'),
2446
+ h('select', { className: 'input', value: taskForm.type, onChange: function(e) { setTaskForm(Object.assign({}, taskForm, { type: e.target.value })); } },
2447
+ h('option', { value: 'general' }, 'General'),
2448
+ h('option', { value: 'email' }, 'Email'),
2449
+ h('option', { value: 'research' }, 'Research'),
2450
+ h('option', { value: 'communication' }, 'Communication')
2451
+ )
2452
+ )
2453
+ )
2454
+ ),
2455
+ h('div', { className: 'modal-footer' },
2456
+ h('button', { className: 'btn btn-ghost', onClick: function() { setShowAddTask(false); } }, 'Cancel'),
2457
+ h('button', { className: 'btn btn-primary', onClick: addTask }, 'Create Task')
2458
+ )
2459
+ )
2460
+ )
2461
+ );
2462
+ }
2463
+
2464
+ // ════════════════════════════════════════════════════════════
2465
+ // GUARDRAILS SECTION
2466
+ // ════════════════════════════════════════════════════════════
2467
+
2468
+ function GuardrailsSection(props) {
2469
+ var agentId = props.agentId;
2470
+ var agents = props.agents || [];
2471
+ var app = useApp();
2472
+ var toast = app.toast;
2473
+
2474
+ var agentData = buildAgentDataMap(agents);
2475
+
2476
+ var _subTab = useState('status');
2477
+ var subTab = _subTab[0]; var setSubTab = _subTab[1];
2478
+
2479
+ var _guardrailStatus = useState(null);
2480
+ var guardrailStatus = _guardrailStatus[0]; var setGuardrailStatus = _guardrailStatus[1];
2481
+ var _interventions = useState([]);
2482
+ var interventions = _interventions[0]; var setInterventions = _interventions[1];
2483
+ var _dlpViolations = useState([]);
2484
+ var dlpViolations = _dlpViolations[0]; var setDlpViolations = _dlpViolations[1];
2485
+ var _onboardingStatus = useState(null);
2486
+ var onboardingStatus = _onboardingStatus[0]; var setOnboardingStatus = _onboardingStatus[1];
2487
+ var _onboardingProgress = useState([]);
2488
+ var onboardingProgress = _onboardingProgress[0]; var setOnboardingProgress = _onboardingProgress[1];
2489
+ var _pendingPolicies = useState([]);
2490
+ var pendingPolicies = _pendingPolicies[0]; var setPendingPolicies = _pendingPolicies[1];
2491
+ var _pendingApprovals = useState([]);
2492
+ var pendingApprovals = _pendingApprovals[0]; var setPendingApprovals = _pendingApprovals[1];
2493
+ var _approvalHistory = useState([]);
2494
+ var approvalHistory = _approvalHistory[0]; var setApprovalHistory = _approvalHistory[1];
2495
+ var _loading = useState(true);
2496
+ var loading = _loading[0]; var setLoading = _loading[1];
2497
+
2498
+ var loadAll = function() {
2499
+ setLoading(true);
2500
+ Promise.all([
2501
+ engineCall('/guardrails/status/' + agentId).catch(function() { return null; }),
2502
+ engineCall('/guardrails/interventions?agentId=' + agentId).catch(function() { return { interventions: [] }; }),
2503
+ engineCall('/dlp/violations?agentId=' + agentId).catch(function() { return { violations: [] }; }),
2504
+ engineCall('/onboarding/status/' + agentId).catch(function() { return null; }),
2505
+ engineCall('/onboarding/progress/' + agentId).catch(function() { return { progress: [] }; }),
2506
+ engineCall('/onboarding/pending/' + agentId).catch(function() { return { policies: [] }; }),
2507
+ engineCall('/approvals/pending?agentId=' + agentId).catch(function() { return { approvals: [] }; }),
2508
+ engineCall('/approvals/history?agentId=' + agentId).catch(function() { return { approvals: [] }; })
2509
+ ]).then(function(results) {
2510
+ setGuardrailStatus(results[0]);
2511
+ setInterventions(results[1]?.interventions || results[1] || []);
2512
+ setDlpViolations(results[2]?.violations || results[2] || []);
2513
+ setOnboardingStatus(results[3]);
2514
+ setOnboardingProgress(results[4]?.progress || results[4] || []);
2515
+ setPendingPolicies(results[5]?.policies || results[5] || []);
2516
+ setPendingApprovals(results[6]?.approvals || results[6] || []);
2517
+ setApprovalHistory(results[7]?.approvals || results[7] || []);
2518
+ setLoading(false);
2519
+ });
2520
+ };
2521
+
2522
+ useEffect(function() { loadAll(); }, [agentId]);
2523
+
2524
+ var pauseAgent = function() {
2525
+ engineCall('/guardrails/pause/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual pause from dashboard' }) })
2526
+ .then(function() { toast('Agent paused', 'success'); loadAll(); })
2527
+ .catch(function(err) { toast(err.message, 'error'); });
2528
+ };
2529
+
2530
+ var resumeAgent = function() {
2531
+ engineCall('/guardrails/resume/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual resume from dashboard' }) })
2532
+ .then(function() { toast('Agent resumed', 'success'); loadAll(); })
2533
+ .catch(function(err) { toast(err.message, 'error'); });
2534
+ };
2535
+
2536
+ var killAgent = function() {
2537
+ showConfirm({
2538
+ title: 'Kill Agent',
2539
+ message: 'Are you sure you want to kill this agent? This will immediately terminate all running processes.',
2540
+ warning: 'This action cannot be undone.',
2541
+ danger: true,
2542
+ confirmText: 'Kill Agent'
2543
+ }).then(function(confirmed) {
2544
+ if (!confirmed) return;
2545
+ engineCall('/guardrails/kill/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual kill from dashboard' }) })
2546
+ .then(function() { toast('Agent killed', 'success'); loadAll(); })
2547
+ .catch(function(err) { toast(err.message, 'error'); });
2548
+ });
2549
+ };
2550
+
2551
+ var initiateOnboarding = function() {
2552
+ engineCall('/onboarding/initiate/' + agentId, { method: 'POST', body: JSON.stringify({ orgId: 'default' }) })
2553
+ .then(function() { toast('Onboarding initiated', 'success'); loadAll(); })
2554
+ .catch(function(err) { toast(err.message, 'error'); });
2555
+ };
2556
+
2557
+ var forceComplete = function() {
2558
+ engineCall('/onboarding/force-complete/' + agentId, { method: 'POST' })
2559
+ .then(function() { toast('Onboarding force completed', 'success'); loadAll(); })
2560
+ .catch(function(err) { toast(err.message, 'error'); });
2561
+ };
2562
+
2563
+ var approveRequest = function(id) {
2564
+ engineCall('/approvals/' + id + '/approve', { method: 'POST', body: JSON.stringify({ decidedBy: 'dashboard-admin' }) })
2565
+ .then(function() { toast('Request approved', 'success'); loadAll(); })
2566
+ .catch(function(err) { toast(err.message, 'error'); });
2567
+ };
2568
+
2569
+ var rejectRequest = function(id) {
2570
+ engineCall('/approvals/' + id + '/reject', { method: 'POST', body: JSON.stringify({ decidedBy: 'dashboard-admin' }) })
2571
+ .then(function() { toast('Request rejected', 'success'); loadAll(); })
2572
+ .catch(function(err) { toast(err.message, 'error'); });
2573
+ };
2574
+
2575
+ if (loading) {
2576
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading guardrails data...');
2577
+ }
2578
+
2579
+ return h(Fragment, null,
2580
+
2581
+ // ─── Sub-Tab Bar ────────────────────────────────────
2582
+ h('div', { style: { borderBottom: '1px solid var(--border)', marginBottom: 20 } },
2583
+ h('div', { className: 'tabs' },
2584
+ h('div', { className: 'tab' + (subTab === 'status' ? ' active' : ''), onClick: function() { setSubTab('status'); } }, 'Status'),
2585
+ h('div', { className: 'tab' + (subTab === 'interventions' ? ' active' : ''), onClick: function() { setSubTab('interventions'); } }, 'Interventions'),
2586
+ h('div', { className: 'tab' + (subTab === 'dlp' ? ' active' : ''), onClick: function() { setSubTab('dlp'); } }, 'DLP'),
2587
+ h('div', { className: 'tab' + (subTab === 'onboarding' ? ' active' : ''), onClick: function() { setSubTab('onboarding'); } }, 'Onboarding'),
2588
+ h('div', { className: 'tab' + (subTab === 'approvals' ? ' active' : ''), onClick: function() { setSubTab('approvals'); } }, 'Approvals')
2589
+ )
2590
+ ),
2591
+
2592
+ // ─── Status Tab ─────────────────────────────────────
2593
+ subTab === 'status' && h('div', null,
2594
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2595
+ h('div', { className: 'card-header' }, h('span', null, 'Guardrail Status')),
2596
+ h('div', { className: 'card-body' },
2597
+ guardrailStatus && guardrailStatus.paused
2598
+ ? h('div', { style: { padding: '12px 16px', background: 'rgba(234, 179, 8, 0.1)', border: '1px solid var(--warning)', borderRadius: 8, marginBottom: 16 } },
2599
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
2600
+ h('span', { className: 'badge badge-warning' }, I.pause(), ' Paused'),
2601
+ guardrailStatus.pausedAt && h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Since: ' + new Date(guardrailStatus.pausedAt).toLocaleString())
2602
+ ),
2603
+ guardrailStatus.pauseReason && h('div', { style: { fontSize: 13, color: 'var(--text-secondary)', marginTop: 4 } }, 'Reason: ' + guardrailStatus.pauseReason)
2604
+ )
2605
+ : h('div', { style: { padding: '12px 16px', background: 'rgba(34, 197, 94, 0.1)', border: '1px solid var(--success)', borderRadius: 8, marginBottom: 16 } },
2606
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
2607
+ h('span', { className: 'badge badge-success' }, I.shield(), ' Active')
2608
+ )
2609
+ ),
2610
+ h('div', { style: { display: 'flex', gap: 16, marginBottom: 16, fontSize: 13 } },
2611
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Interventions: ', h('strong', null, String(guardrailStatus?.interventionCount || guardrailStatus?.interventions || 0))),
2612
+ guardrailStatus?.lastIntervention && h('span', { style: { color: 'var(--text-muted)' } }, 'Last: ' + new Date(guardrailStatus.lastIntervention).toLocaleString())
2613
+ ),
2614
+ h('div', { style: { display: 'flex', gap: 8 } },
2615
+ guardrailStatus && !guardrailStatus.paused && h('button', { className: 'btn btn-secondary btn-sm', onClick: pauseAgent }, I.pause(), ' Pause'),
2616
+ guardrailStatus && guardrailStatus.paused && h('button', { className: 'btn btn-primary btn-sm', onClick: resumeAgent }, I.play(), ' Resume'),
2617
+ h('button', { className: 'btn btn-danger btn-sm', onClick: killAgent }, I.stop(), ' Kill')
2618
+ )
2619
+ )
2620
+ )
2621
+ ),
2622
+
2623
+ // ─── Interventions Tab ──────────────────────────────
2624
+ subTab === 'interventions' && h('div', { className: 'card', style: { marginBottom: 20 } },
2625
+ h('div', { className: 'card-header' }, h('span', null, 'Interventions')),
2626
+ interventions.length > 0
2627
+ ? h('div', { className: 'card-body-flush' },
2628
+ h('table', { className: 'data-table' },
2629
+ h('thead', null,
2630
+ h('tr', null,
2631
+ h('th', null, 'Time'),
2632
+ h('th', null, 'Type'),
2633
+ h('th', null, 'Severity'),
2634
+ h('th', null, 'Description'),
2635
+ h('th', null, 'Resolution')
2636
+ )
2637
+ ),
2638
+ h('tbody', null,
2639
+ interventions.map(function(inv, i) {
2640
+ var time = inv.timestamp || inv.createdAt;
2641
+ var invType = inv.type || inv.interventionType || 'unknown';
2642
+ var severity = inv.severity || 'medium';
2643
+ var severityColor = severity === 'critical' ? 'badge-danger' : severity === 'high' ? 'badge-warning' : severity === 'medium' ? 'badge-info' : 'badge-neutral';
2644
+ var typeColor = invType === 'block' ? 'badge-danger' : invType === 'warn' ? 'badge-warning' : invType === 'audit' ? 'badge-info' : 'badge-neutral';
2645
+
2646
+ return h('tr', { key: inv.id || i },
2647
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, time ? new Date(time).toLocaleString() : '-'),
2648
+ h('td', null, h('span', { className: 'badge ' + typeColor }, invType)),
2649
+ h('td', null, h('span', { className: 'badge ' + severityColor }, severity)),
2650
+ h('td', { style: { fontSize: 13, maxWidth: 300, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, inv.description || inv.message || '-'),
2651
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, inv.resolution || inv.action || '-')
2652
+ );
2653
+ })
2654
+ )
2655
+ )
2656
+ )
2657
+ : h('div', { className: 'card-body' },
2658
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No interventions recorded.')
2659
+ )
2660
+ ),
2661
+
2662
+ // ─── DLP Tab ────────────────────────────────────────
2663
+ subTab === 'dlp' && h('div', { className: 'card', style: { marginBottom: 20 } },
2664
+ h('div', { className: 'card-header' }, h('span', null, 'DLP Violations')),
2665
+ dlpViolations.length > 0
2666
+ ? h('div', { className: 'card-body-flush' },
2667
+ h('table', { className: 'data-table' },
2668
+ h('thead', null,
2669
+ h('tr', null,
2670
+ h('th', null, 'Time'),
2671
+ h('th', null, 'Rule'),
2672
+ h('th', null, 'Severity'),
2673
+ h('th', null, 'Content'),
2674
+ h('th', null, 'Status')
2675
+ )
2676
+ ),
2677
+ h('tbody', null,
2678
+ dlpViolations.map(function(v, i) {
2679
+ var time = v.timestamp || v.createdAt || v.detectedAt;
2680
+ var rule = v.rule || v.ruleName || v.ruleId || 'Unknown';
2681
+ var severity = v.severity || 'medium';
2682
+ var severityColor = severity === 'critical' ? 'badge-danger' : severity === 'high' ? 'badge-warning' : severity === 'medium' ? 'badge-info' : 'badge-neutral';
2683
+ var content = v.content || v.matchedContent || v.snippet || '';
2684
+ var truncatedContent = content.length > 80 ? content.substring(0, 80) + '...' : content;
2685
+ var violationStatus = v.status || v.action || 'detected';
2686
+
2687
+ return h('tr', { key: v.id || i },
2688
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', whiteSpace: 'nowrap' } }, time ? new Date(time).toLocaleString() : '-'),
2689
+ h('td', null, h('span', { className: 'badge badge-info' }, rule)),
2690
+ h('td', null, h('span', { className: 'badge ' + severityColor }, severity)),
2691
+ h('td', { style: { fontSize: 12, fontFamily: 'var(--font-mono, monospace)', maxWidth: 250, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: 'var(--text-secondary)' } }, truncatedContent || '-'),
2692
+ h('td', null, h('span', { className: 'badge badge-neutral' }, violationStatus))
2693
+ );
2694
+ })
2695
+ )
2696
+ )
2697
+ )
2698
+ : h('div', { className: 'card-body' },
2699
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No DLP violations detected.')
2700
+ )
2701
+ ),
2702
+
2703
+ // ─── Onboarding Tab ─────────────────────────────────
2704
+ subTab === 'onboarding' && h('div', null,
2705
+
2706
+ // Onboarding Status Card
2707
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2708
+ h('div', { className: 'card-header', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
2709
+ h('span', null, 'Onboarding Status'),
2710
+ h('div', { style: { display: 'flex', gap: 8 } },
2711
+ !onboardingStatus?.onboarded && h('button', { className: 'btn btn-primary btn-sm', onClick: initiateOnboarding }, 'Start Onboarding'),
2712
+ onboardingStatus && onboardingStatus.status === 'in_progress' && h('button', { className: 'btn btn-secondary btn-sm', onClick: forceComplete }, 'Force Complete')
2713
+ )
2714
+ ),
2715
+ h('div', { className: 'card-body' },
2716
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 12, marginBottom: 12 } },
2717
+ onboardingStatus?.onboarded
2718
+ ? h('span', { className: 'badge badge-success' }, I.check(), ' Onboarded')
2719
+ : h('span', { className: 'badge badge-warning' }, 'Not Onboarded'),
2720
+ onboardingStatus?.status && h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Status: ' + onboardingStatus.status),
2721
+ onboardingStatus?.completedAt && h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Completed: ' + new Date(onboardingStatus.completedAt).toLocaleString())
2722
+ )
2723
+ )
2724
+ ),
2725
+
2726
+ // Progress Table
2727
+ onboardingProgress.length > 0 && h('div', { className: 'card', style: { marginBottom: 20 } },
2728
+ h('div', { className: 'card-header' }, h('span', null, 'Onboarding Progress')),
2729
+ h('div', { className: 'card-body-flush' },
2730
+ h('table', { className: 'data-table' },
2731
+ h('thead', null,
2732
+ h('tr', null,
2733
+ h('th', null, 'Policy'),
2734
+ h('th', null, 'Status'),
2735
+ h('th', null, 'Acknowledged')
2736
+ )
2737
+ ),
2738
+ h('tbody', null,
2739
+ onboardingProgress.map(function(p, i) {
2740
+ var pStatus = p.status || 'pending';
2741
+ var statusColor = pStatus === 'acknowledged' || pStatus === 'completed' ? 'badge-success' : pStatus === 'in_progress' ? 'badge-info' : 'badge-warning';
2742
+
2743
+ return h('tr', { key: p.id || i },
2744
+ h('td', { style: { fontWeight: 500, fontSize: 13 } }, p.policyName || p.name || p.policyId || '-'),
2745
+ h('td', null, h('span', { className: 'badge ' + statusColor }, pStatus)),
2746
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, p.acknowledgedAt ? new Date(p.acknowledgedAt).toLocaleString() : '-')
2747
+ );
2748
+ })
2749
+ )
2750
+ )
2751
+ )
2752
+ ),
2753
+
2754
+ // Pending Policies
2755
+ pendingPolicies.length > 0 && h('div', { className: 'card', style: { marginBottom: 20 } },
2756
+ h('div', { className: 'card-header' }, h('span', null, 'Pending Policies')),
2757
+ h('div', { className: 'card-body' },
2758
+ h('div', { style: { display: 'grid', gap: 8 } },
2759
+ pendingPolicies.map(function(p, i) {
2760
+ return h('div', { key: p.id || i, style: { display: 'flex', alignItems: 'center', gap: 12, padding: '10px 14px', background: 'var(--bg-tertiary)', borderRadius: 8, border: '1px solid var(--border)' } },
2761
+ h('span', { className: 'badge badge-warning' }, 'Pending'),
2762
+ h('span', { style: { fontSize: 13, fontWeight: 500 } }, p.name || p.policyName || p.policyId || 'Unnamed Policy'),
2763
+ p.category && h('span', { className: 'badge badge-neutral', style: { fontSize: 11 } }, p.category)
2764
+ );
2765
+ })
2766
+ )
2767
+ )
2768
+ )
2769
+ ),
2770
+
2771
+ // ─── Approvals Tab ──────────────────────────────────
2772
+ subTab === 'approvals' && h('div', null,
2773
+
2774
+ // Pending Approvals
2775
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2776
+ h('div', { className: 'card-header' }, h('span', null, 'Pending Approvals')),
2777
+ pendingApprovals.length > 0
2778
+ ? h('div', { className: 'card-body' },
2779
+ h('div', { style: { display: 'grid', gap: 12 } },
2780
+ pendingApprovals.map(function(a, i) {
2781
+ var riskLevel = a.riskLevel || a.risk || 'medium';
2782
+ return h('div', { key: a.id || i, style: { padding: '14px 18px', background: 'var(--bg-tertiary)', borderRadius: 8, border: '1px solid var(--border)' } },
2783
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 } },
2784
+ h('span', { className: 'badge badge-info' }, a.type || a.actionType || 'action'),
2785
+ h('span', { className: riskBadgeClass(riskLevel) }, riskLevel),
2786
+ a.createdAt && h('span', { style: { fontSize: 12, color: 'var(--text-muted)', marginLeft: 'auto' } }, new Date(a.createdAt).toLocaleString())
2787
+ ),
2788
+ h('div', { style: { fontSize: 13, color: 'var(--text-secondary)', marginBottom: 12 } }, a.description || a.reason || 'No description'),
2789
+ h('div', { style: { display: 'flex', gap: 8 } },
2790
+ h('button', { className: 'btn btn-primary btn-sm', onClick: function() { approveRequest(a.id); } }, I.check(), ' Approve'),
2791
+ h('button', { className: 'btn btn-danger btn-sm', onClick: function() { rejectRequest(a.id); } }, I.x(), ' Reject')
2792
+ )
2793
+ );
2794
+ })
2795
+ )
2796
+ )
2797
+ : h('div', { className: 'card-body' },
2798
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No pending approvals.')
2799
+ )
2800
+ ),
2801
+
2802
+ // Approval History
2803
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2804
+ h('div', { className: 'card-header' }, h('span', null, 'Approval History')),
2805
+ approvalHistory.length > 0
2806
+ ? h('div', { className: 'card-body-flush' },
2807
+ h('table', { className: 'data-table' },
2808
+ h('thead', null,
2809
+ h('tr', null,
2810
+ h('th', null, 'Type'),
2811
+ h('th', null, 'Decision'),
2812
+ h('th', null, 'Decided By'),
2813
+ h('th', null, 'Date')
2814
+ )
2815
+ ),
2816
+ h('tbody', null,
2817
+ approvalHistory.map(function(a, i) {
2818
+ var decision = a.decision || a.status || 'unknown';
2819
+ var decisionColor = decision === 'approved' ? 'badge-success' : decision === 'rejected' ? 'badge-danger' : 'badge-neutral';
2820
+ var decidedAt = a.decidedAt || a.updatedAt || a.createdAt;
2821
+
2822
+ return h('tr', { key: a.id || i },
2823
+ h('td', null, h('span', { className: 'badge badge-info' }, a.type || a.actionType || 'action')),
2824
+ h('td', null, h('span', { className: 'badge ' + decisionColor }, decision)),
2825
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, a.decidedBy || a.reviewer || '-'),
2826
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, decidedAt ? new Date(decidedAt).toLocaleString() : '-')
2827
+ );
2828
+ })
2829
+ )
2830
+ )
2831
+ )
2832
+ : h('div', { className: 'card-body' },
2833
+ h('div', { style: { textAlign: 'center', padding: 20, color: 'var(--text-muted)', fontSize: 13 } }, 'No approval history.')
2834
+ )
2835
+ )
2836
+ )
2837
+ );
2838
+ }
2839
+
2840
+ // ════════════════════════════════════════════════════════════
2841
+ // DEPLOYMENT SECTION
2842
+ // ════════════════════════════════════════════════════════════
2843
+
2844
+ function DeploymentSection(props) {
2845
+ var agentId = props.agentId;
2846
+ var engineAgent = props.engineAgent;
2847
+ var agent = props.agent;
2848
+ var reload = props.reload;
2849
+ var onBack = props.onBack;
2850
+
2851
+ var app = useApp();
2852
+ var toast = app.toast;
2853
+
2854
+ var _knowledgeBases = useState([]);
2855
+ var knowledgeBases = _knowledgeBases[0]; var setKnowledgeBases = _knowledgeBases[1];
2856
+ var _loading = useState(true);
2857
+ var loading = _loading[0]; var setLoading = _loading[1];
2858
+ var _showJson = useState(false);
2859
+ var showJson = _showJson[0]; var setShowJson = _showJson[1];
2860
+
2861
+ var load = function() {
2862
+ setLoading(true);
2863
+ engineCall('/knowledge-bases?agentId=' + agentId)
2864
+ .then(function(d) { setKnowledgeBases(d.knowledgeBases || d.bases || d || []); })
2865
+ .catch(function() { setKnowledgeBases([]); })
2866
+ .finally(function() { setLoading(false); });
2867
+ };
2868
+
2869
+ useEffect(function() { load(); }, [agentId]);
2870
+
2871
+ // ─── Derived Values ─────────────────────────────────────
2872
+
2873
+ var ea = engineAgent || {};
2874
+ var a = agent || {};
2875
+ var config = ea.config || {};
2876
+ var identity = config.identity || {};
2877
+ var deployment = config.deployment || {};
2878
+ var state = ea.state || a.status || 'unknown';
2879
+ var stateColor = { running: 'success', active: 'success', deploying: 'info', starting: 'info', provisioning: 'info', degraded: 'warning', error: 'danger', stopped: 'neutral', draft: 'neutral', ready: 'primary' }[state] || 'neutral';
2880
+ var healthStatus = ea.health?.status || 'unknown';
2881
+ var healthColor = healthStatus === 'healthy' ? 'success' : healthStatus === 'degraded' ? 'warning' : healthStatus === 'unhealthy' ? 'danger' : 'neutral';
2882
+ var deploymentTarget = deployment.target || config.deploymentTarget || '-';
2883
+ var modelDisplay = typeof config.model === 'string' ? config.model : (config.model ? (config.model.modelId || config.model.provider || '-') : '-');
2884
+
2885
+ // ─── Actions ────────────────────────────────────────────
2886
+
2887
+ var deploy = function() {
2888
+ engineCall('/agents/' + agentId + '/deploy', { method: 'POST', body: JSON.stringify({ deployedBy: 'dashboard' }) })
2889
+ .then(function() { toast('Deploy initiated', 'success'); reload(); })
2890
+ .catch(function(err) { toast(err.message, 'error'); });
2891
+ };
2892
+
2893
+ var stop = function() {
2894
+ engineCall('/agents/' + agentId + '/stop', { method: 'POST', body: JSON.stringify({ stoppedBy: 'dashboard', reason: 'Manual stop' }) })
2895
+ .then(function() { toast('Stop initiated', 'success'); reload(); })
2896
+ .catch(function(err) { toast(err.message, 'error'); });
2897
+ };
2898
+
2899
+ var restart = function() {
2900
+ engineCall('/agents/' + agentId + '/restart', { method: 'POST', body: JSON.stringify({ restartedBy: 'dashboard' }) })
2901
+ .then(function() { toast('Restart initiated', 'success'); reload(); })
2902
+ .catch(function(err) { toast(err.message, 'error'); });
2903
+ };
2904
+
2905
+ var deleteAgent = function() {
2906
+ showConfirm({
2907
+ title: 'Delete Agent',
2908
+ message: 'Are you sure you want to delete agent "' + (ea.name || identity.name || agentId) + '"? This will remove all associated data.',
2909
+ warning: 'This action cannot be undone.',
2910
+ danger: true,
2911
+ confirmText: 'Delete Agent'
2912
+ }).then(function(confirmed) {
2913
+ if (!confirmed) return;
2914
+ apiCall('/bridge/agents/' + agentId, { method: 'DELETE' })
2915
+ .then(function() { toast('Agent deleted', 'success'); if (onBack) onBack(); })
2916
+ .catch(function(err) { toast(err.message, 'error'); });
2917
+ });
2918
+ };
2919
+
2920
+ if (loading) {
2921
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading deployment data...');
2922
+ }
2923
+
2924
+ return h(Fragment, null,
2925
+
2926
+ // ─── Deployment Status Card ─────────────────────────
2927
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2928
+ h('div', { className: 'card-header' }, h('span', null, 'Deployment Status')),
2929
+ h('div', { className: 'card-body' },
2930
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 16, marginBottom: 16, flexWrap: 'wrap' } },
2931
+ h('span', { className: 'status-dot ' + state }),
2932
+ h('span', { className: 'badge badge-' + stateColor, style: { fontSize: 12, textTransform: 'capitalize' } }, state),
2933
+ h('span', { className: 'badge badge-' + healthColor }, 'Health: ' + healthStatus),
2934
+ ea.health?.uptime && h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Uptime: ' + formatUptime(ea.health.uptime))
2935
+ ),
2936
+ h('div', { style: { display: 'grid', gridTemplateColumns: '120px 1fr', gap: '8px 16px', fontSize: 13, marginBottom: 16 } },
2937
+ ea.deploymentUrl && h(Fragment, null,
2938
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Endpoint'),
2939
+ h('a', { href: ea.deploymentUrl, target: '_blank', style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12 } }, ea.deploymentUrl)
2940
+ ),
2941
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Target'),
2942
+ h('span', null, deploymentTarget),
2943
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Model'),
2944
+ h('span', null, modelDisplay),
2945
+ deployment.region && h(Fragment, null,
2946
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Region'),
2947
+ h('span', null, deployment.region)
2948
+ )
2949
+ ),
2950
+ h('div', { style: { display: 'flex', gap: 8 } },
2951
+ (state !== 'running' && state !== 'active' && state !== 'deploying') && h('button', { className: 'btn btn-primary btn-sm', onClick: deploy }, I.play(), ' Deploy'),
2952
+ (state === 'running' || state === 'active' || state === 'degraded') && h('button', { className: 'btn btn-danger btn-sm', onClick: stop }, I.stop(), ' Stop'),
2953
+ (state === 'running' || state === 'active' || state === 'degraded' || state === 'stopped') && h('button', { className: 'btn btn-secondary btn-sm', onClick: restart }, I.refresh(), ' Restart')
2954
+ )
2955
+ )
2956
+ ),
2957
+
2958
+ // ─── Knowledge Bases Card ───────────────────────────
2959
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2960
+ h('div', { className: 'card-header' }, h('span', null, 'Knowledge Bases')),
2961
+ knowledgeBases.length > 0
2962
+ ? h('div', { className: 'card-body-flush' },
2963
+ h('table', { className: 'data-table' },
2964
+ h('thead', null,
2965
+ h('tr', null,
2966
+ h('th', null, 'Name'),
2967
+ h('th', null, 'Description'),
2968
+ h('th', null, 'Documents')
2969
+ )
2970
+ ),
2971
+ h('tbody', null,
2972
+ knowledgeBases.map(function(kb, i) {
2973
+ return h('tr', { key: kb.id || i },
2974
+ h('td', { style: { fontWeight: 500, fontSize: 13 } }, kb.name || 'Unnamed'),
2975
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)', maxWidth: 300, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, kb.description || '-'),
2976
+ h('td', null, String(kb.documentCount || kb.documents || kb.docCount || 0))
2977
+ );
2978
+ })
2979
+ )
2980
+ )
2981
+ )
2982
+ : h('div', { className: 'card-body' },
2983
+ h(EmptyState, { icon: I.database ? I.database() : null, message: 'No knowledge bases attached to this agent.' })
2984
+ )
2985
+ ),
2986
+
2987
+ // ─── Configuration Card ─────────────────────────────
2988
+ h('div', { className: 'card', style: { marginBottom: 20 } },
2989
+ h('div', { className: 'card-header', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
2990
+ h('span', null, 'Configuration'),
2991
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { setShowJson(!showJson); } }, showJson ? 'Structured View' : 'Raw JSON')
2992
+ ),
2993
+ h('div', { className: 'card-body' },
2994
+ showJson
2995
+ ? h('pre', { style: { fontSize: 11, background: 'var(--bg-tertiary)', padding: 16, borderRadius: 'var(--radius)', overflow: 'auto', maxHeight: 500, margin: 0 } }, JSON.stringify(config, null, 2))
2996
+ : h('div', null,
2997
+
2998
+ // Identity Section
2999
+ h('div', { style: { marginBottom: 20 } },
3000
+ h('div', { style: { fontSize: 13, fontWeight: 600, marginBottom: 10, color: 'var(--text-primary)' } }, 'Identity'),
3001
+ h('div', { style: { display: 'grid', gridTemplateColumns: '140px 1fr', gap: '6px 16px', fontSize: 13 } },
3002
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Name'),
3003
+ h('span', null, identity.name || ea.name || '-'),
3004
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Display Name'),
3005
+ h('span', null, identity.displayName || identity.display_name || config.displayName || '-'),
3006
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Email'),
3007
+ h('span', { style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12 } }, identity.email || ea.email || '-'),
3008
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Role'),
3009
+ h('span', null, identity.role || config.role || '-'),
3010
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Avatar'),
3011
+ h('span', null, identity.avatar ? (identity.avatar.length > 2 ? 'Custom image' : identity.avatar) : '-'),
3012
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Gender'),
3013
+ h('span', null, identity.gender || '-'),
3014
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Date of Birth'),
3015
+ h('span', null, identity.dob || identity.dateOfBirth || identity.date_of_birth || '-'),
3016
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Language'),
3017
+ h('span', null, identity.language || config.language || '-')
3018
+ )
3019
+ ),
3020
+
3021
+ // Model Section
3022
+ h('div', { style: { marginBottom: 20 } },
3023
+ h('div', { style: { fontSize: 13, fontWeight: 600, marginBottom: 10, color: 'var(--text-primary)' } }, 'Model'),
3024
+ h('div', { style: { display: 'grid', gridTemplateColumns: '140px 1fr', gap: '6px 16px', fontSize: 13 } },
3025
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Provider'),
3026
+ h('span', null, (typeof config.model === 'object' ? config.model.provider : config.provider) || config.modelProvider || '-'),
3027
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Model ID'),
3028
+ h('span', { style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12 } }, typeof config.model === 'string' ? config.model : (config.model ? (config.model.modelId || '-') : '-'))
3029
+ )
3030
+ ),
3031
+
3032
+ // Deployment Section
3033
+ h('div', null,
3034
+ h('div', { style: { fontSize: 13, fontWeight: 600, marginBottom: 10, color: 'var(--text-primary)' } }, 'Deployment'),
3035
+ h('div', { style: { display: 'grid', gridTemplateColumns: '140px 1fr', gap: '6px 16px', fontSize: 13 } },
3036
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Target'),
3037
+ h('span', null, deployment.target || '-'),
3038
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Region'),
3039
+ h('span', null, deployment.region || '-'),
3040
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Image Tag'),
3041
+ h('span', { style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12 } }, deployment.imageTag || deployment.image_tag || '-'),
3042
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Memory'),
3043
+ h('span', null, deployment.memory || deployment.memoryMb ? (deployment.memoryMb || deployment.memory) + ' MB' : '-'),
3044
+ h('span', { style: { color: 'var(--text-muted)' } }, 'CPU'),
3045
+ h('span', null, deployment.cpu || deployment.cpuUnits ? String(deployment.cpuUnits || deployment.cpu) : '-')
3046
+ )
3047
+ )
3048
+ )
3049
+ )
3050
+ ),
3051
+
3052
+ // ─── Danger Zone ────────────────────────────────────
3053
+ h('div', { className: 'card', style: { marginBottom: 20, border: '1px solid var(--danger)' } },
3054
+ h('div', { className: 'card-header', style: { borderBottom: '1px solid var(--danger)' } }, h('span', { style: { color: 'var(--danger)', fontWeight: 600 } }, 'Danger Zone')),
3055
+ h('div', { className: 'card-body' },
3056
+ h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
3057
+ h('div', null,
3058
+ h('div', { style: { fontSize: 14, fontWeight: 600, marginBottom: 4 } }, 'Delete Agent'),
3059
+ h('div', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'Permanently delete this agent and all associated data. This action cannot be undone.')
3060
+ ),
3061
+ h('button', { className: 'btn btn-danger btn-sm', onClick: deleteAgent }, I.trash(), ' Delete Agent')
3062
+ )
3063
+ )
3064
+ )
3065
+ );
3066
+ }
3067
+
3068
+ // ════════════════════════════════════════════════════════════
3069
+ // TOOL SECURITY SECTION
3070
+ // ════════════════════════════════════════════════════════════
3071
+
3072
+ var _tsCardStyle = { border: '1px solid var(--border)', borderRadius: 'var(--radius)', padding: 20, marginBottom: 16 };
3073
+ var _tsCardTitle = { fontSize: 15, fontWeight: 600, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 8 };
3074
+ var _tsCardDesc = { fontSize: 12, color: 'var(--text-muted)', marginBottom: 16 };
3075
+ var _tsToggleRow = { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 };
3076
+ var _tsGrid = { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 };
3077
+ var _tsSectionTitle = { fontSize: 14, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 12, marginTop: 8 };
3078
+
3079
+ function TSToggle(props) {
3080
+ var checked = props.checked;
3081
+ var onChange = props.onChange;
3082
+ var label = props.label;
3083
+ var inherited = props.inherited;
3084
+ return h('div', { style: _tsToggleRow },
3085
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
3086
+ h('span', { style: { fontSize: 13, fontWeight: 500 } }, label),
3087
+ inherited && h('span', { style: { fontSize: 10, padding: '1px 6px', borderRadius: 3, background: 'var(--bg-secondary)', color: 'var(--text-muted)', fontWeight: 600 } }, 'ORG DEFAULT')
3088
+ ),
3089
+ h('label', { style: { position: 'relative', display: 'inline-block', width: 40, height: 22, cursor: 'pointer' } },
3090
+ h('input', { type: 'checkbox', checked: checked, onChange: function(e) { onChange(e.target.checked); }, style: { opacity: 0, width: 0, height: 0 } }),
3091
+ h('span', { style: {
3092
+ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,
3093
+ background: checked ? 'var(--brand-color, #6366f1)' : 'var(--bg-tertiary, #374151)',
3094
+ borderRadius: 11, transition: 'background 0.2s'
3095
+ } },
3096
+ h('span', { style: {
3097
+ position: 'absolute', top: 2, left: checked ? 20 : 2, width: 18, height: 18,
3098
+ background: '#fff', borderRadius: '50%', transition: 'left 0.2s', boxShadow: '0 1px 3px rgba(0,0,0,0.2)'
3099
+ } })
3100
+ )
3101
+ )
3102
+ );
3103
+ }
3104
+
3105
+ function TSRateLimitEditor(props) {
3106
+ var overrides = props.overrides || {};
3107
+ var onChange = props.onChange;
3108
+ var DEFAULT_LIMITS = { bash: { max: 10, rate: 10 }, browser: { max: 20, rate: 20 }, web_fetch: { max: 30, rate: 30 }, web_search: { max: 30, rate: 30 }, read: { max: 60, rate: 60 }, write: { max: 60, rate: 60 }, edit: { max: 60, rate: 60 }, glob: { max: 60, rate: 60 }, grep: { max: 60, rate: 60 }, memory: { max: 60, rate: 60 } };
3109
+ var tools = Object.keys(DEFAULT_LIMITS);
3110
+
3111
+ var setOverride = function(tool, field, value) {
3112
+ var current = overrides[tool] || { maxTokens: DEFAULT_LIMITS[tool].max, refillRate: DEFAULT_LIMITS[tool].rate };
3113
+ var next = Object.assign({}, overrides);
3114
+ next[tool] = Object.assign({}, current);
3115
+ next[tool][field] = parseInt(value) || 0;
3116
+ onChange(next);
3117
+ };
3118
+
3119
+ return h('div', { style: { fontSize: 12 } },
3120
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 80px 80px', gap: 4, marginBottom: 4 } },
3121
+ h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)' } }, 'Tool'),
3122
+ h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)', textAlign: 'center' } }, 'Max/min'),
3123
+ h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)', textAlign: 'center' } }, 'Refill/min')
3124
+ ),
3125
+ tools.map(function(tool) {
3126
+ var def = DEFAULT_LIMITS[tool];
3127
+ var ov = overrides[tool];
3128
+ return h('div', { key: tool, style: { display: 'grid', gridTemplateColumns: '1fr 80px 80px', gap: 4, marginBottom: 2 } },
3129
+ h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 11, padding: '4px 0' } }, tool),
3130
+ h('input', { className: 'input', type: 'number', min: 1, max: 1000, style: { fontSize: 11, padding: '2px 6px', textAlign: 'center' }, value: ov ? ov.maxTokens : def.max, onChange: function(e) { setOverride(tool, 'maxTokens', e.target.value); } }),
3131
+ h('input', { className: 'input', type: 'number', min: 1, max: 1000, style: { fontSize: 11, padding: '2px 6px', textAlign: 'center' }, value: ov ? ov.refillRate : def.rate, onChange: function(e) { setOverride(tool, 'refillRate', e.target.value); } })
3132
+ );
3133
+ })
3134
+ );
3135
+ }
3136
+
3137
+ function ToolSecuritySection(props) {
3138
+ var agentId = props.agentId;
3139
+
3140
+ var app = useApp();
3141
+ var toast = app.toast;
3142
+
3143
+ var _loading = useState(true);
3144
+ var loading = _loading[0]; var setLoading = _loading[1];
3145
+ var _saving = useState(false);
3146
+ var saving = _saving[0]; var setSaving = _saving[1];
3147
+ var _orgDefaults = useState({});
3148
+ var orgDefaults = _orgDefaults[0]; var setOrgDefaults = _orgDefaults[1];
3149
+ var _agentOverrides = useState({});
3150
+ var agentOverrides = _agentOverrides[0]; var setAgentOverrides = _agentOverrides[1];
3151
+ var _merged = useState({});
3152
+ var merged = _merged[0]; var setMerged = _merged[1];
3153
+ var _dirty = useState(false);
3154
+ var dirty = _dirty[0]; var setDirty = _dirty[1];
3155
+
3156
+ var load = function() {
3157
+ setLoading(true);
3158
+ engineCall('/agents/' + agentId + '/tool-security')
3159
+ .then(function(d) {
3160
+ setOrgDefaults(d.orgDefaults || {});
3161
+ setAgentOverrides(d.agentOverrides || {});
3162
+ setMerged(d.toolSecurity || {});
3163
+ setDirty(false);
3164
+ })
3165
+ .catch(function(err) { toast('Failed to load tool security: ' + err.message, 'error'); })
3166
+ .finally(function() { setLoading(false); });
3167
+ };
3168
+
3169
+ useEffect(function() { load(); }, [agentId]);
3170
+
3171
+ // Track whether a field is overridden at agent level
3172
+ var isOverridden = function(section, field) {
3173
+ var ao = agentOverrides || {};
3174
+ if (section === 'security' || section === 'middleware') {
3175
+ return ao[section] !== undefined && ao[section] !== null;
3176
+ }
3177
+ var sec = ao.security || {};
3178
+ var mw = ao.middleware || {};
3179
+ var container = (section === 'pathSandbox' || section === 'ssrf' || section === 'commandSanitizer') ? sec : mw;
3180
+ if (!container[section]) return false;
3181
+ if (field) return container[section][field] !== undefined;
3182
+ return true;
3183
+ };
3184
+
3185
+ // Update the local overrides (working copy derived from merged)
3186
+ var localConfig = dirty ? merged : merged;
3187
+ var sec = (localConfig.security || {});
3188
+ var mw = (localConfig.middleware || {});
3189
+
3190
+ var updateMerged = function(next) {
3191
+ setMerged(next);
3192
+ setDirty(true);
3193
+ };
3194
+
3195
+ var setSec = function(key, value) {
3196
+ var next = Object.assign({}, sec);
3197
+ next[key] = value;
3198
+ updateMerged({ security: next, middleware: mw });
3199
+ };
3200
+
3201
+ var setMw = function(key, value) {
3202
+ var next = Object.assign({}, mw);
3203
+ next[key] = value;
3204
+ updateMerged({ security: sec, middleware: next });
3205
+ };
3206
+
3207
+ var patchSec = function(section, field, value) {
3208
+ var current = sec[section] || {};
3209
+ var next = Object.assign({}, current);
3210
+ next[field] = value;
3211
+ setSec(section, next);
3212
+ };
3213
+
3214
+ var patchMw = function(section, field, value) {
3215
+ var current = mw[section] || {};
3216
+ var next = Object.assign({}, current);
3217
+ next[field] = value;
3218
+ setMw(section, next);
3219
+ };
3220
+
3221
+ // Compute the diff between merged and orgDefaults to get the overrides to save
3222
+ var computeOverrides = function() {
3223
+ var overrides = {};
3224
+ var orgSec = orgDefaults.security || {};
3225
+ var orgMw = orgDefaults.middleware || {};
3226
+
3227
+ // Check each security section
3228
+ ['pathSandbox', 'ssrf', 'commandSanitizer'].forEach(function(key) {
3229
+ var orgVal = orgSec[key] || {};
3230
+ var curVal = sec[key] || {};
3231
+ if (JSON.stringify(orgVal) !== JSON.stringify(curVal)) {
3232
+ if (!overrides.security) overrides.security = {};
3233
+ overrides.security[key] = curVal;
3234
+ }
3235
+ });
3236
+
3237
+ // Check each middleware section
3238
+ ['audit', 'rateLimit', 'circuitBreaker', 'telemetry'].forEach(function(key) {
3239
+ var orgVal = orgMw[key] || {};
3240
+ var curVal = mw[key] || {};
3241
+ if (JSON.stringify(orgVal) !== JSON.stringify(curVal)) {
3242
+ if (!overrides.middleware) overrides.middleware = {};
3243
+ overrides.middleware[key] = curVal;
3244
+ }
3245
+ });
3246
+
3247
+ return overrides;
3248
+ };
3249
+
3250
+ var save = function() {
3251
+ setSaving(true);
3252
+ var overrides = computeOverrides();
3253
+ engineCall('/agents/' + agentId + '/tool-security', {
3254
+ method: 'PATCH',
3255
+ body: JSON.stringify({ toolSecurity: overrides, updatedBy: 'dashboard' })
3256
+ })
3257
+ .then(function() {
3258
+ toast('Tool security saved', 'success');
3259
+ setAgentOverrides(overrides);
3260
+ setDirty(false);
3261
+ })
3262
+ .catch(function(err) { toast('Save failed: ' + err.message, 'error'); })
3263
+ .finally(function() { setSaving(false); });
3264
+ };
3265
+
3266
+ var resetAll = function() {
3267
+ showConfirm('Reset to Org Defaults', 'This will remove all agent-level tool security overrides and revert to the organization defaults. Continue?', function() {
3268
+ setSaving(true);
3269
+ engineCall('/agents/' + agentId + '/tool-security', {
3270
+ method: 'PATCH',
3271
+ body: JSON.stringify({ toolSecurity: {}, updatedBy: 'dashboard' })
3272
+ })
3273
+ .then(function() {
3274
+ toast('Reset to org defaults', 'success');
3275
+ load();
3276
+ })
3277
+ .catch(function(err) { toast('Reset failed: ' + err.message, 'error'); })
3278
+ .finally(function() { setSaving(false); });
3279
+ });
3280
+ };
3281
+
3282
+ if (loading) {
3283
+ return h('div', { style: { textAlign: 'center', padding: 40, color: 'var(--text-muted)' } }, 'Loading tool security config...');
3284
+ }
3285
+
3286
+ var ps = sec.pathSandbox || {};
3287
+ var ssrf = sec.ssrf || {};
3288
+ var cs = sec.commandSanitizer || {};
3289
+ var audit = mw.audit || {};
3290
+ var rl = mw.rateLimit || {};
3291
+ var cb = mw.circuitBreaker || {};
3292
+ var tel = mw.telemetry || {};
3293
+
3294
+ var hasOverrides = Object.keys(agentOverrides).length > 0 || dirty;
3295
+
3296
+ return h(Fragment, null,
3297
+ // Header
3298
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
3299
+ h('div', null,
3300
+ h('h3', { style: { margin: 0, fontSize: 18, fontWeight: 600 } }, 'Tool Security'),
3301
+ h('p', { style: { margin: '4px 0 0', fontSize: 13, color: 'var(--text-muted)' } },
3302
+ 'Configure tool security overrides for this agent. Unmodified settings inherit from ',
3303
+ h('strong', null, 'org defaults'),
3304
+ '.'
3305
+ )
3306
+ ),
3307
+ h('div', { style: { display: 'flex', gap: 8 } },
3308
+ hasOverrides && h('button', {
3309
+ className: 'btn btn-secondary btn-sm',
3310
+ onClick: resetAll,
3311
+ disabled: saving
3312
+ }, 'Reset to Org Defaults'),
3313
+ h('button', {
3314
+ className: 'btn btn-primary',
3315
+ disabled: saving || !dirty,
3316
+ onClick: save
3317
+ }, saving ? 'Saving...' : 'Save Overrides')
3318
+ )
3319
+ ),
3320
+
3321
+ // Overrides indicator
3322
+ !dirty && Object.keys(agentOverrides).length > 0 && h('div', {
3323
+ style: { padding: '8px 12px', borderRadius: 6, background: 'rgba(99,102,241,0.08)', border: '1px solid rgba(99,102,241,0.2)', fontSize: 12, color: 'var(--text-secondary)', marginBottom: 16, display: 'flex', alignItems: 'center', gap: 8 }
3324
+ },
3325
+ I.info(),
3326
+ 'This agent has custom overrides for: ',
3327
+ h('strong', null,
3328
+ [].concat(
3329
+ Object.keys(agentOverrides.security || {}),
3330
+ Object.keys(agentOverrides.middleware || {})
3331
+ ).join(', ') || 'none'
3332
+ )
3333
+ ),
3334
+
3335
+ // ── SECURITY SECTION ──
3336
+ h('div', { style: _tsSectionTitle }, 'Security Sandboxes'),
3337
+ h('div', { style: _tsGrid },
3338
+
3339
+ // Path Sandbox
3340
+ h('div', { style: _tsCardStyle },
3341
+ h('div', { style: _tsCardTitle }, I.folder(), ' Path Sandbox'),
3342
+ h('div', { style: _tsCardDesc }, 'Controls which directories this agent can read/write.'),
3343
+ h(TSToggle, { label: 'Enable path sandboxing', checked: ps.enabled !== false, inherited: !isOverridden('pathSandbox', 'enabled'), onChange: function(v) { patchSec('pathSandbox', 'enabled', v); } }),
3344
+ h(TagInput, { label: 'Allowed Directories', value: ps.allowedDirs || [], onChange: function(v) { patchSec('pathSandbox', 'allowedDirs', v); }, placeholder: '/path/to/allow', mono: true }),
3345
+ h(TagInput, { label: 'Blocked Patterns (regex)', value: ps.blockedPatterns || [], onChange: function(v) { patchSec('pathSandbox', 'blockedPatterns', v); }, placeholder: '\\.env$', mono: true })
3346
+ ),
3347
+
3348
+ // SSRF Guard
3349
+ h('div', { style: _tsCardStyle },
3350
+ h('div', { style: _tsCardTitle }, I.globe(), ' SSRF Protection'),
3351
+ h('div', { style: _tsCardDesc }, 'Blocks this agent from accessing internal networks and metadata endpoints.'),
3352
+ h(TSToggle, { label: 'Enable SSRF protection', checked: ssrf.enabled !== false, inherited: !isOverridden('ssrf', 'enabled'), onChange: function(v) { patchSec('ssrf', 'enabled', v); } }),
3353
+ h(TagInput, { label: 'Allowed Hosts', value: ssrf.allowedHosts || [], onChange: function(v) { patchSec('ssrf', 'allowedHosts', v); }, placeholder: 'api.example.com', mono: true }),
3354
+ h(TagInput, { label: 'Blocked CIDRs', value: ssrf.blockedCidrs || [], onChange: function(v) { patchSec('ssrf', 'blockedCidrs', v); }, placeholder: '10.0.0.0/8', mono: true })
3355
+ )
3356
+ ),
3357
+
3358
+ // Command Sanitizer (full width)
3359
+ h('div', { style: _tsCardStyle },
3360
+ h('div', { style: _tsCardTitle }, I.terminal(), ' Command Sanitizer'),
3361
+ h('div', { style: _tsCardDesc }, 'Controls which shell commands this agent can execute.'),
3362
+ h(TSToggle, { label: 'Enable command validation', checked: cs.enabled !== false, inherited: !isOverridden('commandSanitizer', 'enabled'), onChange: function(v) { patchSec('commandSanitizer', 'enabled', v); } }),
3363
+ h('div', { style: { marginBottom: 12 } },
3364
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
3365
+ h('select', { className: 'input', style: { width: 200 }, value: cs.mode || 'blocklist', onChange: function(e) { patchSec('commandSanitizer', 'mode', e.target.value); } },
3366
+ h('option', { value: 'blocklist' }, 'Blocklist (block specific patterns)'),
3367
+ h('option', { value: 'allowlist' }, 'Allowlist (only allow specific commands)')
3368
+ )
3369
+ ),
3370
+ h('div', { style: _tsGrid },
3371
+ h(TagInput, { label: 'Allowed Commands', value: cs.allowedCommands || [], onChange: function(v) { patchSec('commandSanitizer', 'allowedCommands', v); }, placeholder: 'git, npm, node', mono: true }),
3372
+ h(TagInput, { label: 'Blocked Patterns', value: cs.blockedPatterns || [], onChange: function(v) { patchSec('commandSanitizer', 'blockedPatterns', v); }, placeholder: 'curl.*\\|.*sh', mono: true })
3373
+ )
3374
+ ),
3375
+
3376
+ // ── MIDDLEWARE SECTION ──
3377
+ h('div', { style: _tsSectionTitle }, 'Middleware & Observability'),
3378
+ h('div', { style: _tsGrid },
3379
+
3380
+ // Audit Logging
3381
+ h('div', { style: _tsCardStyle },
3382
+ h('div', { style: _tsCardTitle }, I.journal(), ' Audit Logging'),
3383
+ h('div', { style: _tsCardDesc }, 'Logs every tool invocation for this agent.'),
3384
+ h(TSToggle, { label: 'Enable audit logging', checked: audit.enabled !== false, inherited: !isOverridden('audit', 'enabled'), onChange: function(v) { patchMw('audit', 'enabled', v); } }),
3385
+ h(TagInput, { label: 'Keys to Redact', value: audit.redactKeys || [], onChange: function(v) { patchMw('audit', 'redactKeys', v); }, placeholder: 'custom_secret', mono: true })
3386
+ ),
3387
+
3388
+ // Rate Limiting
3389
+ h('div', { style: _tsCardStyle },
3390
+ h('div', { style: _tsCardTitle }, I.clock(), ' Rate Limiting'),
3391
+ h('div', { style: _tsCardDesc }, 'Per-tool rate limits for this agent.'),
3392
+ h(TSToggle, { label: 'Enable rate limiting', checked: rl.enabled !== false, inherited: !isOverridden('rateLimit', 'enabled'), onChange: function(v) { patchMw('rateLimit', 'enabled', v); } }),
3393
+ h(TSRateLimitEditor, { overrides: rl.overrides || {}, onChange: function(v) { patchMw('rateLimit', 'overrides', v); } })
3394
+ ),
3395
+
3396
+ // Circuit Breaker
3397
+ h('div', { style: _tsCardStyle },
3398
+ h('div', { style: _tsCardTitle }, I.pause(), ' Circuit Breaker'),
3399
+ h('div', { style: _tsCardDesc }, 'Auto-stops calling failing tools after consecutive failures.'),
3400
+ h(TSToggle, { label: 'Enable circuit breaker', checked: cb.enabled !== false, inherited: !isOverridden('circuitBreaker', 'enabled'), onChange: function(v) { patchMw('circuitBreaker', 'enabled', v); } })
3401
+ ),
3402
+
3403
+ // Telemetry
3404
+ h('div', { style: _tsCardStyle },
3405
+ h('div', { style: _tsCardTitle }, I.chart(), ' Telemetry'),
3406
+ h('div', { style: _tsCardDesc }, 'Collects execution timing and metrics for this agent\'s tools.'),
3407
+ h(TSToggle, { label: 'Enable telemetry', checked: tel.enabled !== false, inherited: !isOverridden('telemetry', 'enabled'), onChange: function(v) { patchMw('telemetry', 'enabled', v); } })
3408
+ )
3409
+ ),
3410
+
3411
+ // Sticky save bar
3412
+ dirty && h('div', { style: { position: 'sticky', bottom: 0, padding: '12px 0', background: 'var(--bg-primary)', borderTop: '1px solid var(--border)', display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 16 } },
3413
+ h('button', { className: 'btn btn-secondary', onClick: function() { load(); } }, 'Discard Changes'),
3414
+ h('button', { className: 'btn btn-primary', disabled: saving, onClick: save }, saving ? 'Saving...' : 'Save Tool Security Overrides')
3415
+ )
3416
+ );
3417
+ }
3418
+
3419
+ // ════════════════════════════════════════════════════════════
3420
+ // AGENT DETAIL PAGE (Main Orchestrator)
3421
+ // ════════════════════════════════════════════════════════════
3422
+
3423
+ function AgentDetailPage(props) {
3424
+ var agentId = props.agentId;
3425
+ var onBack = props.onBack;
3426
+
3427
+ var app = useApp();
3428
+ var toast = app.toast;
3429
+
3430
+ var _tab = useState('overview');
3431
+ var tab = _tab[0]; var setTab = _tab[1];
3432
+ var _agent = useState(null);
3433
+ var agent = _agent[0]; var setAgent = _agent[1];
3434
+ var _engineAgent = useState(null);
3435
+ var engineAgent = _engineAgent[0]; var setEngineAgent = _engineAgent[1];
3436
+ var _profile = useState(null);
3437
+ var profile = _profile[0]; var setProfile = _profile[1];
3438
+ var _loading = useState(true);
3439
+ var loading = _loading[0]; var setLoading = _loading[1];
3440
+ var _agents = useState([]);
3441
+ var agents = _agents[0]; var setAgents = _agents[1];
3442
+
3443
+ var TABS = ['overview', 'personal', 'permissions', 'activity', 'communication', 'workforce', 'memory', 'guardrails', 'budget', 'tool-security', 'deployment'];
3444
+ var TAB_LABELS = { 'tool-security': 'Tool Security' };
3445
+
3446
+ var load = function() {
3447
+ setLoading(true);
3448
+ Promise.all([
3449
+ engineCall('/bridge/agents/' + agentId + '/full').catch(function() { return null; }),
3450
+ apiCall('/agents/' + agentId).catch(function() { return null; }),
3451
+ engineCall('/agents?orgId=default').catch(function() { return { agents: [] }; })
3452
+ ]).then(function(results) {
3453
+ var fullData = results[0];
3454
+ var adminData = results[1];
3455
+ var allAgents = results[2]?.agents || results[2] || [];
3456
+
3457
+ if (fullData) {
3458
+ setEngineAgent(fullData.agent || fullData);
3459
+ setProfile(fullData.permissions || null);
3460
+ }
3461
+ if (adminData) {
3462
+ setAgent(adminData);
3463
+ }
3464
+ setAgents(allAgents);
3465
+ setLoading(false);
3466
+ });
3467
+ };
3468
+
3469
+ useEffect(function() { load(); }, [agentId]);
3470
+
3471
+ // ─── Derived Values ─────────────────────────────────────
3472
+
3473
+ var ea = engineAgent || {};
3474
+ var a = agent || {};
3475
+ var config = ea.config || {};
3476
+ var identity = config.identity || {};
3477
+ var state = ea.state || ea.status || a.status || 'unknown';
3478
+ var stateColor = { running: 'success', active: 'success', deploying: 'info', starting: 'info', provisioning: 'info', degraded: 'warning', error: 'danger', stopped: 'neutral', draft: 'neutral', ready: 'primary' }[state] || 'neutral';
3479
+ var displayName = identity.name || config.name || config.displayName || a.name || 'Unnamed Agent';
3480
+ var displayEmail = identity.email || config.email || a.email || '';
3481
+ var avatarUrl = identity.avatar && identity.avatar.length > 2 ? identity.avatar : null;
3482
+ var avatarInitial = (displayName || '?').charAt(0).toUpperCase();
3483
+ var role = identity.role || config.role || a.role || 'agent';
3484
+ var isPaused = ea.paused || false;
3485
+
3486
+ // ─── Header Actions ─────────────────────────────────────
3487
+
3488
+ var doAction = function(action) {
3489
+ engineCall('/agents/' + agentId + '/' + action, { method: 'POST', body: JSON.stringify({ by: 'dashboard' }) })
3490
+ .then(function() { toast(action.charAt(0).toUpperCase() + action.slice(1) + ' initiated', 'success'); setTimeout(load, 1000); })
3491
+ .catch(function(err) { toast(err.message, 'error'); });
3492
+ };
3493
+
3494
+ var doPause = function() {
3495
+ engineCall('/guardrails/pause/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual pause from dashboard' }) })
3496
+ .then(function() { toast('Agent paused', 'success'); load(); })
3497
+ .catch(function(err) { toast(err.message, 'error'); });
3498
+ };
3499
+
3500
+ var doResume = function() {
3501
+ engineCall('/guardrails/resume/' + agentId, { method: 'POST', body: JSON.stringify({ reason: 'Manual resume from dashboard' }) })
3502
+ .then(function() { toast('Agent resumed', 'success'); load(); })
3503
+ .catch(function(err) { toast(err.message, 'error'); });
3504
+ };
3505
+
3506
+ if (loading && !agent && !engineAgent) {
3507
+ return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading agent...');
3508
+ }
3509
+
3510
+ return h(Fragment, null,
3511
+
3512
+ // ─── Header Bar ─────────────────────────────────────
3513
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 16, marginBottom: 24 } },
3514
+
3515
+ // Back Button
3516
+ h('button', { className: 'btn btn-ghost btn-sm', onClick: onBack, title: 'Back to agents', style: { flexShrink: 0 } },
3517
+ h('svg', { viewBox: '0 0 24 24', width: 16, height: 16, fill: 'none', stroke: 'currentColor', strokeWidth: 2 }, h('polyline', { points: '15 18 9 12 15 6' })),
3518
+ ' Agents'
3519
+ ),
3520
+
3521
+ // Avatar
3522
+ h('div', { style: {
3523
+ width: 44, height: 44, borderRadius: '50%', background: avatarUrl ? 'none' : 'var(--accent)',
3524
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
3525
+ fontSize: avatarUrl ? 22 : 18, fontWeight: 700, color: '#fff', flexShrink: 0,
3526
+ overflow: 'hidden'
3527
+ } },
3528
+ avatarUrl
3529
+ ? h('img', { src: avatarUrl, style: { width: '100%', height: '100%', objectFit: 'cover' } })
3530
+ : avatarInitial
3531
+ ),
3532
+
3533
+ // Name + Info
3534
+ h('div', { style: { flex: 1, minWidth: 0 } },
3535
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
3536
+ h('h1', { style: { fontSize: 20, fontWeight: 700, margin: 0 } }, displayName),
3537
+ h('span', { className: 'badge badge-' + stateColor, style: { textTransform: 'capitalize' } }, state)
3538
+ ),
3539
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 12, marginTop: 4 } },
3540
+ displayEmail && h('span', { style: { fontFamily: 'var(--font-mono, monospace)', fontSize: 12, color: 'var(--text-muted)' } }, displayEmail),
3541
+ h('span', { className: 'badge badge-neutral', style: { textTransform: 'capitalize' } }, role)
3542
+ )
3543
+ ),
3544
+
3545
+ // Action Buttons
3546
+ h('div', { style: { display: 'flex', gap: 6, flexShrink: 0 } },
3547
+ (state !== 'running' && state !== 'active' && state !== 'deploying') && h('button', { className: 'btn btn-primary btn-sm', onClick: function() { doAction('deploy'); } }, I.play(), ' Deploy'),
3548
+ (state === 'running' || state === 'active' || state === 'degraded' || state === 'stopped') && h('button', { className: 'btn btn-secondary btn-sm', onClick: function() { doAction('restart'); } }, I.refresh(), ' Restart'),
3549
+ (state === 'running' || state === 'active' || state === 'degraded') && h('button', { className: 'btn btn-danger btn-sm', onClick: function() { doAction('stop'); } }, I.stop(), ' Stop'),
3550
+ !isPaused && (state === 'running' || state === 'active') && h('button', { className: 'btn btn-secondary btn-sm', onClick: doPause }, I.pause(), ' Pause'),
3551
+ isPaused && h('button', { className: 'btn btn-secondary btn-sm', onClick: doResume }, I.play(), ' Resume')
3552
+ )
3553
+ ),
3554
+
3555
+ // ─── Tab Bar ────────────────────────────────────────
3556
+ h('div', { className: 'tabs', style: { marginBottom: 20 } },
3557
+ TABS.map(function(t) {
3558
+ return h('div', { key: t, className: 'tab' + (tab === t ? ' active' : ''), onClick: function() { setTab(t); } }, TAB_LABELS[t] || t.charAt(0).toUpperCase() + t.slice(1));
3559
+ })
3560
+ ),
3561
+
3562
+ // ─── Tab Content ────────────────────────────────────
3563
+ tab === 'overview' && h(OverviewSection, { agentId: agentId, agent: agent, engineAgent: engineAgent, profile: profile, reload: load, agents: agents, onBack: onBack }),
3564
+ tab === 'personal' && h(PersonalDetailsSection, { agentId: agentId, agent: agent, engineAgent: engineAgent, reload: load }),
3565
+ tab === 'permissions' && h(PermissionsSection, { agentId: agentId, profile: profile, reload: load }),
3566
+ tab === 'activity' && h(ActivitySection, { agentId: agentId }),
3567
+ tab === 'communication' && h(CommunicationSection, { agentId: agentId, agents: agents }),
3568
+ tab === 'workforce' && h(WorkforceSection, { agentId: agentId }),
3569
+ tab === 'memory' && h(MemorySection, { agentId: agentId }),
3570
+ tab === 'guardrails' && h(GuardrailsSection, { agentId: agentId, agents: agents }),
3571
+ tab === 'budget' && h(BudgetSection, { agentId: agentId }),
3572
+ tab === 'tool-security' && h(ToolSecuritySection, { agentId: agentId }),
3573
+ tab === 'deployment' && h(DeploymentSection, { agentId: agentId, engineAgent: engineAgent, agent: agent, reload: load, onBack: onBack })
3574
+ );
3575
+ }
3576
+
3577
+ export { AgentDetailPage };