@agenticmail/enterprise 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1106) 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/CLAUDE.md +40 -0
  6. package/CONTRIBUTING.md +254 -0
  7. package/DEPLOYMENT.md +1031 -0
  8. package/README.md +355 -174
  9. package/community-skills/_template/README.md +31 -0
  10. package/community-skills/_template/agenticmail-skill.json +48 -0
  11. package/community-skills/activecampaign/README.md +21 -0
  12. package/community-skills/activecampaign/agenticmail-skill.json +56 -0
  13. package/community-skills/adobe-sign/README.md +21 -0
  14. package/community-skills/adobe-sign/agenticmail-skill.json +72 -0
  15. package/community-skills/adp/README.md +21 -0
  16. package/community-skills/adp/agenticmail-skill.json +65 -0
  17. package/community-skills/airtable-bases/README.md +29 -0
  18. package/community-skills/airtable-bases/agenticmail-skill.json +69 -0
  19. package/community-skills/apollo-io/README.md +21 -0
  20. package/community-skills/apollo-io/agenticmail-skill.json +50 -0
  21. package/community-skills/asana-tasks/README.md +30 -0
  22. package/community-skills/asana-tasks/agenticmail-skill.json +70 -0
  23. package/community-skills/auth0/README.md +21 -0
  24. package/community-skills/auth0/agenticmail-skill.json +56 -0
  25. package/community-skills/aws-services/README.md +38 -0
  26. package/community-skills/aws-services/agenticmail-skill.json +70 -0
  27. package/community-skills/azure-devops/README.md +21 -0
  28. package/community-skills/azure-devops/agenticmail-skill.json +57 -0
  29. package/community-skills/bamboohr/README.md +21 -0
  30. package/community-skills/bamboohr/agenticmail-skill.json +56 -0
  31. package/community-skills/basecamp/README.md +21 -0
  32. package/community-skills/basecamp/agenticmail-skill.json +56 -0
  33. package/community-skills/bigcommerce/README.md +21 -0
  34. package/community-skills/bigcommerce/agenticmail-skill.json +55 -0
  35. package/community-skills/bitbucket-repos/README.md +29 -0
  36. package/community-skills/bitbucket-repos/agenticmail-skill.json +70 -0
  37. package/community-skills/box/README.md +21 -0
  38. package/community-skills/box/agenticmail-skill.json +48 -0
  39. package/community-skills/brex/README.md +21 -0
  40. package/community-skills/brex/agenticmail-skill.json +48 -0
  41. package/community-skills/buffer/README.md +21 -0
  42. package/community-skills/buffer/agenticmail-skill.json +50 -0
  43. package/community-skills/calendly/README.md +20 -0
  44. package/community-skills/calendly/agenticmail-skill.json +43 -0
  45. package/community-skills/canva-design/README.md +33 -0
  46. package/community-skills/canva-design/agenticmail-skill.json +60 -0
  47. package/community-skills/chargebee/README.md +21 -0
  48. package/community-skills/chargebee/agenticmail-skill.json +55 -0
  49. package/community-skills/circleci-pipelines/README.md +28 -0
  50. package/community-skills/circleci-pipelines/agenticmail-skill.json +66 -0
  51. package/community-skills/clickup/README.md +21 -0
  52. package/community-skills/clickup/agenticmail-skill.json +48 -0
  53. package/community-skills/close-crm/README.md +21 -0
  54. package/community-skills/close-crm/agenticmail-skill.json +49 -0
  55. package/community-skills/cloudflare-cdn/README.md +37 -0
  56. package/community-skills/cloudflare-cdn/agenticmail-skill.json +67 -0
  57. package/community-skills/confluence-wiki/README.md +31 -0
  58. package/community-skills/confluence-wiki/agenticmail-skill.json +74 -0
  59. package/community-skills/contentful/README.md +21 -0
  60. package/community-skills/contentful/agenticmail-skill.json +62 -0
  61. package/community-skills/copper-crm/README.md +21 -0
  62. package/community-skills/copper-crm/agenticmail-skill.json +56 -0
  63. package/community-skills/crisp/README.md +21 -0
  64. package/community-skills/crisp/agenticmail-skill.json +56 -0
  65. package/community-skills/crowdstrike/README.md +21 -0
  66. package/community-skills/crowdstrike/agenticmail-skill.json +69 -0
  67. package/community-skills/datadog-monitoring/README.md +37 -0
  68. package/community-skills/datadog-monitoring/agenticmail-skill.json +73 -0
  69. package/community-skills/digitalocean/README.md +21 -0
  70. package/community-skills/digitalocean/agenticmail-skill.json +48 -0
  71. package/community-skills/discord/README.md +45 -0
  72. package/community-skills/discord/agenticmail-skill.json +65 -0
  73. package/community-skills/docker-containers/README.md +38 -0
  74. package/community-skills/docker-containers/agenticmail-skill.json +70 -0
  75. package/community-skills/docusign-esign/README.md +35 -0
  76. package/community-skills/docusign-esign/agenticmail-skill.json +66 -0
  77. package/community-skills/drift/README.md +21 -0
  78. package/community-skills/drift/agenticmail-skill.json +50 -0
  79. package/community-skills/dropbox-storage/README.md +36 -0
  80. package/community-skills/dropbox-storage/agenticmail-skill.json +67 -0
  81. package/community-skills/figma-design/README.md +36 -0
  82. package/community-skills/figma-design/agenticmail-skill.json +66 -0
  83. package/community-skills/firebase/README.md +21 -0
  84. package/community-skills/firebase/agenticmail-skill.json +56 -0
  85. package/community-skills/flyio/README.md +21 -0
  86. package/community-skills/flyio/agenticmail-skill.json +56 -0
  87. package/community-skills/freshbooks/README.md +21 -0
  88. package/community-skills/freshbooks/agenticmail-skill.json +55 -0
  89. package/community-skills/freshdesk/README.md +21 -0
  90. package/community-skills/freshdesk/agenticmail-skill.json +57 -0
  91. package/community-skills/freshsales/README.md +21 -0
  92. package/community-skills/freshsales/agenticmail-skill.json +55 -0
  93. package/community-skills/freshservice/README.md +21 -0
  94. package/community-skills/freshservice/agenticmail-skill.json +56 -0
  95. package/community-skills/front/README.md +21 -0
  96. package/community-skills/front/agenticmail-skill.json +48 -0
  97. package/community-skills/github/README.md +49 -0
  98. package/community-skills/github/agenticmail-skill.json +73 -0
  99. package/community-skills/github-actions/README.md +29 -0
  100. package/community-skills/github-actions/agenticmail-skill.json +72 -0
  101. package/community-skills/gitlab-ci/README.md +51 -0
  102. package/community-skills/gitlab-ci/agenticmail-skill.json +66 -0
  103. package/community-skills/gong/README.md +21 -0
  104. package/community-skills/gong/agenticmail-skill.json +50 -0
  105. package/community-skills/google-ads/README.md +36 -0
  106. package/community-skills/google-ads/agenticmail-skill.json +58 -0
  107. package/community-skills/google-analytics/README.md +28 -0
  108. package/community-skills/google-analytics/agenticmail-skill.json +69 -0
  109. package/community-skills/google-cloud/README.md +33 -0
  110. package/community-skills/google-cloud/agenticmail-skill.json +59 -0
  111. package/community-skills/google-drive/README.md +36 -0
  112. package/community-skills/google-drive/agenticmail-skill.json +65 -0
  113. package/community-skills/gotomeeting/README.md +20 -0
  114. package/community-skills/gotomeeting/agenticmail-skill.json +45 -0
  115. package/community-skills/grafana/README.md +21 -0
  116. package/community-skills/grafana/agenticmail-skill.json +56 -0
  117. package/community-skills/greenhouse/README.md +21 -0
  118. package/community-skills/greenhouse/agenticmail-skill.json +49 -0
  119. package/community-skills/gusto/README.md +21 -0
  120. package/community-skills/gusto/agenticmail-skill.json +49 -0
  121. package/community-skills/hashicorp-vault/README.md +21 -0
  122. package/community-skills/hashicorp-vault/agenticmail-skill.json +58 -0
  123. package/community-skills/heroku/README.md +21 -0
  124. package/community-skills/heroku/agenticmail-skill.json +48 -0
  125. package/community-skills/hibob/README.md +21 -0
  126. package/community-skills/hibob/agenticmail-skill.json +48 -0
  127. package/community-skills/hootsuite/README.md +21 -0
  128. package/community-skills/hootsuite/agenticmail-skill.json +48 -0
  129. package/community-skills/hubspot-crm/README.md +36 -0
  130. package/community-skills/hubspot-crm/agenticmail-skill.json +70 -0
  131. package/community-skills/huggingface/README.md +21 -0
  132. package/community-skills/huggingface/agenticmail-skill.json +48 -0
  133. package/community-skills/index.json +1320 -0
  134. package/community-skills/intercom-support/README.md +36 -0
  135. package/community-skills/intercom-support/agenticmail-skill.json +64 -0
  136. package/community-skills/jira/README.md +53 -0
  137. package/community-skills/jira/agenticmail-skill.json +72 -0
  138. package/community-skills/klaviyo/README.md +21 -0
  139. package/community-skills/klaviyo/agenticmail-skill.json +48 -0
  140. package/community-skills/kubernetes-cluster/README.md +36 -0
  141. package/community-skills/kubernetes-cluster/agenticmail-skill.json +72 -0
  142. package/community-skills/lattice/README.md +21 -0
  143. package/community-skills/lattice/agenticmail-skill.json +49 -0
  144. package/community-skills/launchdarkly/README.md +21 -0
  145. package/community-skills/launchdarkly/agenticmail-skill.json +48 -0
  146. package/community-skills/lever/README.md +21 -0
  147. package/community-skills/lever/agenticmail-skill.json +49 -0
  148. package/community-skills/linear/README.md +29 -0
  149. package/community-skills/linear/agenticmail-skill.json +81 -0
  150. package/community-skills/linkedin/README.md +21 -0
  151. package/community-skills/linkedin/agenticmail-skill.json +48 -0
  152. package/community-skills/livechat/README.md +20 -0
  153. package/community-skills/livechat/agenticmail-skill.json +43 -0
  154. package/community-skills/loom-video/README.md +20 -0
  155. package/community-skills/loom-video/agenticmail-skill.json +44 -0
  156. package/community-skills/mailchimp-campaigns/README.md +37 -0
  157. package/community-skills/mailchimp-campaigns/agenticmail-skill.json +69 -0
  158. package/community-skills/mailgun/README.md +21 -0
  159. package/community-skills/mailgun/agenticmail-skill.json +71 -0
  160. package/community-skills/microsoft-teams/README.md +51 -0
  161. package/community-skills/microsoft-teams/agenticmail-skill.json +66 -0
  162. package/community-skills/miro-boards/README.md +20 -0
  163. package/community-skills/miro-boards/agenticmail-skill.json +44 -0
  164. package/community-skills/mixpanel-analytics/README.md +34 -0
  165. package/community-skills/mixpanel-analytics/agenticmail-skill.json +64 -0
  166. package/community-skills/monday-boards/README.md +28 -0
  167. package/community-skills/monday-boards/agenticmail-skill.json +68 -0
  168. package/community-skills/mongodb-atlas/README.md +21 -0
  169. package/community-skills/mongodb-atlas/agenticmail-skill.json +58 -0
  170. package/community-skills/neon/README.md +21 -0
  171. package/community-skills/neon/agenticmail-skill.json +50 -0
  172. package/community-skills/netlify/README.md +21 -0
  173. package/community-skills/netlify/agenticmail-skill.json +48 -0
  174. package/community-skills/netsuite/README.md +21 -0
  175. package/community-skills/netsuite/agenticmail-skill.json +57 -0
  176. package/community-skills/newrelic/README.md +21 -0
  177. package/community-skills/newrelic/agenticmail-skill.json +58 -0
  178. package/community-skills/notion/README.md +49 -0
  179. package/community-skills/notion/agenticmail-skill.json +72 -0
  180. package/community-skills/okta/README.md +21 -0
  181. package/community-skills/okta/agenticmail-skill.json +57 -0
  182. package/community-skills/openai/README.md +21 -0
  183. package/community-skills/openai/agenticmail-skill.json +48 -0
  184. package/community-skills/opsgenie/README.md +21 -0
  185. package/community-skills/opsgenie/agenticmail-skill.json +48 -0
  186. package/community-skills/outreach/README.md +21 -0
  187. package/community-skills/outreach/agenticmail-skill.json +50 -0
  188. package/community-skills/paddle/README.md +21 -0
  189. package/community-skills/paddle/agenticmail-skill.json +55 -0
  190. package/community-skills/pagerduty/README.md +21 -0
  191. package/community-skills/pagerduty/agenticmail-skill.json +48 -0
  192. package/community-skills/pandadoc/README.md +21 -0
  193. package/community-skills/pandadoc/agenticmail-skill.json +48 -0
  194. package/community-skills/paypal/README.md +21 -0
  195. package/community-skills/paypal/agenticmail-skill.json +55 -0
  196. package/community-skills/personio/README.md +21 -0
  197. package/community-skills/personio/agenticmail-skill.json +48 -0
  198. package/community-skills/pinecone/README.md +21 -0
  199. package/community-skills/pinecone/agenticmail-skill.json +48 -0
  200. package/community-skills/pipedrive-deals/README.md +33 -0
  201. package/community-skills/pipedrive-deals/agenticmail-skill.json +60 -0
  202. package/community-skills/plaid/README.md +21 -0
  203. package/community-skills/plaid/agenticmail-skill.json +65 -0
  204. package/community-skills/postmark/README.md +21 -0
  205. package/community-skills/postmark/agenticmail-skill.json +48 -0
  206. package/community-skills/power-automate/README.md +21 -0
  207. package/community-skills/power-automate/agenticmail-skill.json +59 -0
  208. package/community-skills/quickbooks-accounting/README.md +38 -0
  209. package/community-skills/quickbooks-accounting/agenticmail-skill.json +70 -0
  210. package/community-skills/recurly/README.md +21 -0
  211. package/community-skills/recurly/agenticmail-skill.json +48 -0
  212. package/community-skills/reddit/README.md +21 -0
  213. package/community-skills/reddit/agenticmail-skill.json +48 -0
  214. package/community-skills/render/README.md +21 -0
  215. package/community-skills/render/agenticmail-skill.json +48 -0
  216. package/community-skills/ringcentral/README.md +20 -0
  217. package/community-skills/ringcentral/agenticmail-skill.json +43 -0
  218. package/community-skills/rippling/README.md +21 -0
  219. package/community-skills/rippling/agenticmail-skill.json +48 -0
  220. package/community-skills/salesforce/README.md +53 -0
  221. package/community-skills/salesforce/agenticmail-skill.json +73 -0
  222. package/community-skills/salesloft/README.md +21 -0
  223. package/community-skills/salesloft/agenticmail-skill.json +48 -0
  224. package/community-skills/sanity/README.md +21 -0
  225. package/community-skills/sanity/agenticmail-skill.json +62 -0
  226. package/community-skills/sap/README.md +21 -0
  227. package/community-skills/sap/agenticmail-skill.json +63 -0
  228. package/community-skills/segment-cdp/README.md +37 -0
  229. package/community-skills/segment-cdp/agenticmail-skill.json +66 -0
  230. package/community-skills/sendgrid-email/README.md +51 -0
  231. package/community-skills/sendgrid-email/agenticmail-skill.json +71 -0
  232. package/community-skills/sentry/README.md +21 -0
  233. package/community-skills/sentry/agenticmail-skill.json +58 -0
  234. package/community-skills/servicenow/README.md +21 -0
  235. package/community-skills/servicenow/agenticmail-skill.json +56 -0
  236. package/community-skills/shopify/README.md +21 -0
  237. package/community-skills/shopify/agenticmail-skill.json +56 -0
  238. package/community-skills/shortcut/README.md +21 -0
  239. package/community-skills/shortcut/agenticmail-skill.json +48 -0
  240. package/community-skills/slack/README.md +45 -0
  241. package/community-skills/slack/agenticmail-skill.json +73 -0
  242. package/community-skills/smartsheet/README.md +21 -0
  243. package/community-skills/smartsheet/agenticmail-skill.json +48 -0
  244. package/community-skills/snowflake-warehouse/README.md +37 -0
  245. package/community-skills/snowflake-warehouse/agenticmail-skill.json +71 -0
  246. package/community-skills/snyk/README.md +21 -0
  247. package/community-skills/snyk/agenticmail-skill.json +48 -0
  248. package/community-skills/splunk/README.md +21 -0
  249. package/community-skills/splunk/agenticmail-skill.json +56 -0
  250. package/community-skills/square/README.md +21 -0
  251. package/community-skills/square/agenticmail-skill.json +55 -0
  252. package/community-skills/statuspage/README.md +21 -0
  253. package/community-skills/statuspage/agenticmail-skill.json +56 -0
  254. package/community-skills/stripe/README.md +45 -0
  255. package/community-skills/stripe/agenticmail-skill.json +66 -0
  256. package/community-skills/supabase/README.md +21 -0
  257. package/community-skills/supabase/agenticmail-skill.json +56 -0
  258. package/community-skills/teamwork/README.md +21 -0
  259. package/community-skills/teamwork/agenticmail-skill.json +56 -0
  260. package/community-skills/telegram-bot/README.md +20 -0
  261. package/community-skills/telegram-bot/agenticmail-skill.json +52 -0
  262. package/community-skills/terraform-iac/README.md +34 -0
  263. package/community-skills/terraform-iac/agenticmail-skill.json +66 -0
  264. package/community-skills/todoist-tasks/README.md +29 -0
  265. package/community-skills/todoist-tasks/agenticmail-skill.json +72 -0
  266. package/community-skills/trello-cards/README.md +30 -0
  267. package/community-skills/trello-cards/agenticmail-skill.json +72 -0
  268. package/community-skills/twilio-sms/README.md +47 -0
  269. package/community-skills/twilio-sms/agenticmail-skill.json +63 -0
  270. package/community-skills/twitter/README.md +21 -0
  271. package/community-skills/twitter/agenticmail-skill.json +48 -0
  272. package/community-skills/vercel-deployments/README.md +29 -0
  273. package/community-skills/vercel-deployments/agenticmail-skill.json +70 -0
  274. package/community-skills/weaviate/README.md +21 -0
  275. package/community-skills/weaviate/agenticmail-skill.json +56 -0
  276. package/community-skills/webex/README.md +20 -0
  277. package/community-skills/webex/agenticmail-skill.json +43 -0
  278. package/community-skills/webflow/README.md +21 -0
  279. package/community-skills/webflow/agenticmail-skill.json +48 -0
  280. package/community-skills/whatsapp-business/README.md +20 -0
  281. package/community-skills/whatsapp-business/agenticmail-skill.json +52 -0
  282. package/community-skills/whereby/README.md +20 -0
  283. package/community-skills/whereby/agenticmail-skill.json +43 -0
  284. package/community-skills/woocommerce/README.md +21 -0
  285. package/community-skills/woocommerce/agenticmail-skill.json +55 -0
  286. package/community-skills/wordpress/README.md +21 -0
  287. package/community-skills/wordpress/agenticmail-skill.json +56 -0
  288. package/community-skills/workday/README.md +21 -0
  289. package/community-skills/workday/agenticmail-skill.json +56 -0
  290. package/community-skills/wrike/README.md +21 -0
  291. package/community-skills/wrike/agenticmail-skill.json +48 -0
  292. package/community-skills/xero/README.md +21 -0
  293. package/community-skills/xero/agenticmail-skill.json +56 -0
  294. package/community-skills/youtube/README.md +21 -0
  295. package/community-skills/youtube/agenticmail-skill.json +52 -0
  296. package/community-skills/zendesk-tickets/README.md +37 -0
  297. package/community-skills/zendesk-tickets/agenticmail-skill.json +65 -0
  298. package/community-skills/zoho-crm/README.md +21 -0
  299. package/community-skills/zoho-crm/agenticmail-skill.json +74 -0
  300. package/community-skills/zoom-meetings/README.md +51 -0
  301. package/community-skills/zoom-meetings/agenticmail-skill.json +66 -0
  302. package/community-skills/zuora/README.md +21 -0
  303. package/community-skills/zuora/agenticmail-skill.json +55 -0
  304. package/dashboards/README.md +81 -70
  305. package/dashboards/django/app.py +117 -0
  306. package/dashboards/django/static/styles.css +284 -0
  307. package/dashboards/django/templates/agent_detail.html +501 -0
  308. package/dashboards/django/templates/agents.html +217 -0
  309. package/dashboards/django/templates/api_keys.html +41 -0
  310. package/dashboards/django/templates/audit.html +26 -0
  311. package/dashboards/django/templates/compliance.html +33 -0
  312. package/dashboards/django/templates/components/modal.html +6 -0
  313. package/dashboards/django/templates/components/pagination.html +9 -0
  314. package/dashboards/django/templates/components/stats.html +8 -0
  315. package/dashboards/django/templates/dashboard.html +24 -0
  316. package/dashboards/django/templates/dlp.html +70 -0
  317. package/dashboards/django/templates/guardrails.html +78 -0
  318. package/dashboards/django/templates/journal.html +39 -0
  319. package/dashboards/django/templates/layout.html +52 -0
  320. package/dashboards/django/templates/login.html +30 -0
  321. package/dashboards/django/templates/messages.html +38 -0
  322. package/dashboards/django/templates/settings.html +472 -0
  323. package/dashboards/django/templates/skills.html +66 -0
  324. package/dashboards/django/templates/users.html +34 -0
  325. package/dashboards/django/templates/vault.html +46 -0
  326. package/dashboards/django/utils/__init__.py +0 -0
  327. package/dashboards/django/utils/api.py +20 -0
  328. package/dashboards/django/utils/helpers.py +39 -0
  329. package/dashboards/django/views/__init__.py +38 -0
  330. package/dashboards/django/views/agents.py +343 -0
  331. package/dashboards/django/views/api_keys.py +47 -0
  332. package/dashboards/django/views/audit.py +35 -0
  333. package/dashboards/django/views/auth.py +34 -0
  334. package/dashboards/django/views/compliance.py +37 -0
  335. package/dashboards/django/views/dashboard.py +27 -0
  336. package/dashboards/django/views/dlp.py +53 -0
  337. package/dashboards/django/views/guardrails.py +61 -0
  338. package/dashboards/django/views/journal.py +41 -0
  339. package/dashboards/django/views/messages.py +65 -0
  340. package/dashboards/django/views/settings_view.py +335 -0
  341. package/dashboards/django/views/skills.py +50 -0
  342. package/dashboards/django/views/users.py +42 -0
  343. package/dashboards/django/views/vault.py +50 -0
  344. package/dashboards/dotnet/AgenticMailDashboard.csproj +10 -0
  345. package/dashboards/dotnet/Program.cs +53 -233
  346. package/dashboards/dotnet/Routes/AgentRoutes.cs +771 -0
  347. package/dashboards/dotnet/Routes/ApiKeyRoutes.cs +185 -0
  348. package/dashboards/dotnet/Routes/AuditRoutes.cs +86 -0
  349. package/dashboards/dotnet/Routes/AuthRoutes.cs +50 -0
  350. package/dashboards/dotnet/Routes/ComplianceRoutes.cs +143 -0
  351. package/dashboards/dotnet/Routes/DashboardRoutes.cs +81 -0
  352. package/dashboards/dotnet/Routes/DlpRoutes.cs +230 -0
  353. package/dashboards/dotnet/Routes/GuardrailRoutes.cs +285 -0
  354. package/dashboards/dotnet/Routes/JournalRoutes.cs +118 -0
  355. package/dashboards/dotnet/Routes/MessageRoutes.cs +167 -0
  356. package/dashboards/dotnet/Routes/SettingRoutes.cs +907 -0
  357. package/dashboards/dotnet/Routes/SkillRoutes.cs +198 -0
  358. package/dashboards/dotnet/Routes/UserRoutes.cs +111 -0
  359. package/dashboards/dotnet/Routes/VaultRoutes.cs +162 -0
  360. package/dashboards/dotnet/Services/ApiClient.cs +103 -0
  361. package/dashboards/dotnet/Services/HtmlBuilder.cs +249 -0
  362. package/dashboards/dotnet/wwwroot/styles.css +284 -0
  363. package/dashboards/express/app.js +37 -126
  364. package/dashboards/express/middleware/auth.js +10 -0
  365. package/dashboards/express/package-lock.json +922 -0
  366. package/dashboards/express/package.json +17 -0
  367. package/dashboards/express/public/styles.css +284 -0
  368. package/dashboards/express/routes/agents.js +771 -0
  369. package/dashboards/express/routes/apiKeys.js +107 -0
  370. package/dashboards/express/routes/audit.js +75 -0
  371. package/dashboards/express/routes/auth.js +38 -0
  372. package/dashboards/express/routes/compliance.js +93 -0
  373. package/dashboards/express/routes/dashboard.js +65 -0
  374. package/dashboards/express/routes/dlp.js +165 -0
  375. package/dashboards/express/routes/guardrails.js +195 -0
  376. package/dashboards/express/routes/journal.js +95 -0
  377. package/dashboards/express/routes/messages.js +97 -0
  378. package/dashboards/express/routes/settings.js +830 -0
  379. package/dashboards/express/routes/skills.js +141 -0
  380. package/dashboards/express/routes/users.js +69 -0
  381. package/dashboards/express/routes/vault.js +141 -0
  382. package/dashboards/express/utils/api.js +44 -0
  383. package/dashboards/express/utils/helpers.js +46 -0
  384. package/dashboards/express/views/components/modal.js +255 -0
  385. package/dashboards/express/views/components/stats.js +22 -0
  386. package/dashboards/express/views/components/table.js +31 -0
  387. package/dashboards/express/views/layout.js +73 -0
  388. package/dashboards/express/views/login.js +45 -0
  389. package/dashboards/go/go.mod +3 -0
  390. package/dashboards/go/handlers/agents.go +790 -0
  391. package/dashboards/go/handlers/apikeys.go +38 -0
  392. package/dashboards/go/handlers/audit.go +52 -0
  393. package/dashboards/go/handlers/auth.go +39 -0
  394. package/dashboards/go/handlers/compliance.go +58 -0
  395. package/dashboards/go/handlers/dashboard.go +43 -0
  396. package/dashboards/go/handlers/dlp.go +78 -0
  397. package/dashboards/go/handlers/guardrails.go +89 -0
  398. package/dashboards/go/handlers/journal.go +60 -0
  399. package/dashboards/go/handlers/messages.go +59 -0
  400. package/dashboards/go/handlers/settings.go +951 -0
  401. package/dashboards/go/handlers/skills.go +129 -0
  402. package/dashboards/go/handlers/users.go +54 -0
  403. package/dashboards/go/handlers/vault.go +85 -0
  404. package/dashboards/go/main.go +35 -485
  405. package/dashboards/go/middleware/auth.go +17 -0
  406. package/dashboards/go/services/api.go +38 -0
  407. package/dashboards/go/services/session.go +52 -0
  408. package/dashboards/go/static/styles.css +284 -0
  409. package/dashboards/go/templates/components.go +45 -0
  410. package/dashboards/go/templates/helpers.go +35 -0
  411. package/dashboards/go/templates/layout.go +59 -0
  412. package/dashboards/html/index.html +203 -450
  413. package/dashboards/html/package.json +11 -0
  414. package/dashboards/html/public/styles.css +149 -0
  415. package/dashboards/html/src/api.js +36 -0
  416. package/dashboards/html/src/components/badge.js +13 -0
  417. package/dashboards/html/src/components/layout.js +11 -0
  418. package/dashboards/html/src/components/modal.js +9 -0
  419. package/dashboards/html/src/components/pagination.js +12 -0
  420. package/dashboards/html/src/components/stat-card.js +14 -0
  421. package/dashboards/html/src/components/table.js +6 -0
  422. package/dashboards/html/src/main.js +83 -0
  423. package/dashboards/html/src/pages/agents.js +831 -0
  424. package/dashboards/html/src/pages/api-keys.js +80 -0
  425. package/dashboards/html/src/pages/audit.js +50 -0
  426. package/dashboards/html/src/pages/compliance.js +69 -0
  427. package/dashboards/html/src/pages/dashboard.js +25 -0
  428. package/dashboards/html/src/pages/dlp.js +112 -0
  429. package/dashboards/html/src/pages/guardrails.js +127 -0
  430. package/dashboards/html/src/pages/journal.js +54 -0
  431. package/dashboards/html/src/pages/login.js +84 -0
  432. package/dashboards/html/src/pages/messages.js +90 -0
  433. package/dashboards/html/src/pages/settings.js +656 -0
  434. package/dashboards/html/src/pages/skills.js +114 -0
  435. package/dashboards/html/src/pages/users.js +62 -0
  436. package/dashboards/html/src/pages/vault.js +105 -0
  437. package/dashboards/html/src/router.js +40 -0
  438. package/dashboards/html/src/utils/escape.js +7 -0
  439. package/dashboards/html/src/utils/time.js +16 -0
  440. package/dashboards/html/src/utils/toast.js +10 -0
  441. package/dashboards/java/AgenticMailDashboard.java +123 -346
  442. package/dashboards/java/handlers/AgentsHandler.java +807 -0
  443. package/dashboards/java/handlers/ApiKeysHandler.java +201 -0
  444. package/dashboards/java/handlers/AuditHandler.java +95 -0
  445. package/dashboards/java/handlers/AuthHandler.java +71 -0
  446. package/dashboards/java/handlers/ComplianceHandler.java +192 -0
  447. package/dashboards/java/handlers/DashboardHandler.java +98 -0
  448. package/dashboards/java/handlers/DlpHandler.java +230 -0
  449. package/dashboards/java/handlers/GuardrailsHandler.java +272 -0
  450. package/dashboards/java/handlers/JournalHandler.java +130 -0
  451. package/dashboards/java/handlers/MessagesHandler.java +168 -0
  452. package/dashboards/java/handlers/SettingsHandler.java +1017 -0
  453. package/dashboards/java/handlers/SkillsHandler.java +198 -0
  454. package/dashboards/java/handlers/UsersHandler.java +118 -0
  455. package/dashboards/java/handlers/VaultHandler.java +168 -0
  456. package/dashboards/java/services/ApiClient.java +233 -0
  457. package/dashboards/java/services/SessionManager.java +138 -0
  458. package/dashboards/java/static/styles.css +288 -0
  459. package/dashboards/java/templates/Components.java +142 -0
  460. package/dashboards/java/templates/Helpers.java +106 -0
  461. package/dashboards/java/templates/Layout.java +98 -0
  462. package/dashboards/laravel/controllers/AgentController.php +250 -0
  463. package/dashboards/laravel/controllers/ApiKeyController.php +73 -0
  464. package/dashboards/laravel/controllers/AuditController.php +31 -0
  465. package/dashboards/laravel/controllers/AuthController.php +44 -0
  466. package/dashboards/laravel/controllers/ComplianceController.php +55 -0
  467. package/dashboards/laravel/controllers/DashboardController.php +28 -0
  468. package/dashboards/laravel/controllers/DlpController.php +88 -0
  469. package/dashboards/laravel/controllers/GuardrailController.php +110 -0
  470. package/dashboards/laravel/controllers/JournalController.php +44 -0
  471. package/dashboards/laravel/controllers/MessageController.php +47 -0
  472. package/dashboards/laravel/controllers/SettingController.php +258 -0
  473. package/dashboards/laravel/controllers/SkillController.php +74 -0
  474. package/dashboards/laravel/controllers/UserController.php +47 -0
  475. package/dashboards/laravel/controllers/VaultController.php +94 -0
  476. package/dashboards/laravel/index.php +319 -0
  477. package/dashboards/laravel/lib/Api.php +73 -0
  478. package/dashboards/laravel/lib/Helpers.php +123 -0
  479. package/dashboards/laravel/public/styles.css +291 -0
  480. package/dashboards/laravel/views/agent-detail.php +534 -0
  481. package/dashboards/laravel/views/agents.php +204 -0
  482. package/dashboards/laravel/views/api-keys.php +55 -0
  483. package/dashboards/laravel/views/audit.php +30 -0
  484. package/dashboards/laravel/views/compliance.php +48 -0
  485. package/dashboards/laravel/views/components/modal.php +59 -0
  486. package/dashboards/laravel/views/components/stats.php +21 -0
  487. package/dashboards/laravel/views/components/table.php +35 -0
  488. package/dashboards/laravel/views/dashboard.php +31 -0
  489. package/dashboards/laravel/views/dlp.php +87 -0
  490. package/dashboards/laravel/views/guardrails.php +95 -0
  491. package/dashboards/laravel/views/journal.php +50 -0
  492. package/dashboards/laravel/views/layout.php +82 -0
  493. package/dashboards/laravel/views/login.php +45 -0
  494. package/dashboards/laravel/views/messages.php +60 -0
  495. package/dashboards/laravel/views/settings.php +622 -0
  496. package/dashboards/laravel/views/skills.php +74 -0
  497. package/dashboards/laravel/views/users.php +42 -0
  498. package/dashboards/laravel/views/vault.php +80 -0
  499. package/dashboards/php/components/layout.php +80 -0
  500. package/dashboards/php/components/modal.php +22 -0
  501. package/dashboards/php/components/stats.php +20 -0
  502. package/dashboards/php/components/table.php +33 -0
  503. package/dashboards/php/index.php +663 -381
  504. package/dashboards/php/lib/api.php +37 -0
  505. package/dashboards/php/lib/auth.php +47 -0
  506. package/dashboards/php/lib/helpers.php +69 -0
  507. package/dashboards/php/pages/agent-detail.php +552 -0
  508. package/dashboards/php/pages/agents.php +185 -0
  509. package/dashboards/php/pages/api-keys.php +34 -0
  510. package/dashboards/php/pages/audit.php +31 -0
  511. package/dashboards/php/pages/compliance.php +38 -0
  512. package/dashboards/php/pages/dashboard.php +29 -0
  513. package/dashboards/php/pages/dlp.php +65 -0
  514. package/dashboards/php/pages/guardrails.php +70 -0
  515. package/dashboards/php/pages/journal.php +53 -0
  516. package/dashboards/php/pages/login.php +34 -0
  517. package/dashboards/php/pages/messages.php +53 -0
  518. package/dashboards/php/pages/settings.php +687 -0
  519. package/dashboards/php/pages/skills.php +70 -0
  520. package/dashboards/php/pages/users.php +37 -0
  521. package/dashboards/php/pages/vault.php +70 -0
  522. package/dashboards/php/public/styles.css +81 -0
  523. package/dashboards/python/app.py +61 -259
  524. package/dashboards/python/routes/__init__.py +0 -0
  525. package/dashboards/python/routes/agents.py +296 -0
  526. package/dashboards/python/routes/api_keys.py +49 -0
  527. package/dashboards/python/routes/audit.py +33 -0
  528. package/dashboards/python/routes/auth.py +30 -0
  529. package/dashboards/python/routes/compliance.py +50 -0
  530. package/dashboards/python/routes/dashboard.py +32 -0
  531. package/dashboards/python/routes/dlp.py +64 -0
  532. package/dashboards/python/routes/guardrails.py +79 -0
  533. package/dashboards/python/routes/journal.py +40 -0
  534. package/dashboards/python/routes/messages.py +46 -0
  535. package/dashboards/python/routes/settings.py +260 -0
  536. package/dashboards/python/routes/skills.py +59 -0
  537. package/dashboards/python/routes/users.py +43 -0
  538. package/dashboards/python/routes/vault.py +59 -0
  539. package/dashboards/python/static/styles.css +288 -0
  540. package/dashboards/python/templates/agent_detail.html +552 -0
  541. package/dashboards/python/templates/agents.html +246 -0
  542. package/dashboards/python/templates/api_keys.html +64 -0
  543. package/dashboards/python/templates/audit.html +50 -0
  544. package/dashboards/python/templates/compliance.html +74 -0
  545. package/dashboards/python/templates/components/modal.html +43 -0
  546. package/dashboards/python/templates/components/stats.html +26 -0
  547. package/dashboards/python/templates/components/table.html +43 -0
  548. package/dashboards/python/templates/dashboard.html +34 -0
  549. package/dashboards/python/templates/dlp.html +159 -0
  550. package/dashboards/python/templates/guardrails.html +131 -0
  551. package/dashboards/python/templates/journal.html +66 -0
  552. package/dashboards/python/templates/layout.html +86 -0
  553. package/dashboards/python/templates/login.html +36 -0
  554. package/dashboards/python/templates/messages.html +90 -0
  555. package/dashboards/python/templates/settings.html +624 -0
  556. package/dashboards/python/templates/skills.html +89 -0
  557. package/dashboards/python/templates/users.html +70 -0
  558. package/dashboards/python/templates/vault.html +73 -0
  559. package/dashboards/python/utils/__init__.py +0 -0
  560. package/dashboards/python/utils/api.py +35 -0
  561. package/dashboards/python/utils/helpers.py +90 -0
  562. package/dashboards/rails/app.rb +56 -0
  563. package/dashboards/rails/helpers/api.rb +39 -0
  564. package/dashboards/rails/helpers/auth.rb +11 -0
  565. package/dashboards/rails/helpers/view.rb +95 -0
  566. package/dashboards/rails/public/styles.css +299 -0
  567. package/dashboards/rails/routes/agents.rb +173 -0
  568. package/dashboards/rails/routes/api_keys.rb +30 -0
  569. package/dashboards/rails/routes/audit.rb +15 -0
  570. package/dashboards/rails/routes/auth.rb +29 -0
  571. package/dashboards/rails/routes/compliance.rb +25 -0
  572. package/dashboards/rails/routes/dashboard.rb +13 -0
  573. package/dashboards/rails/routes/dlp.rb +40 -0
  574. package/dashboards/rails/routes/guardrails.rb +51 -0
  575. package/dashboards/rails/routes/journal.rb +24 -0
  576. package/dashboards/rails/routes/messages.rb +22 -0
  577. package/dashboards/rails/routes/settings.rb +196 -0
  578. package/dashboards/rails/routes/skills.rb +38 -0
  579. package/dashboards/rails/routes/users.rb +18 -0
  580. package/dashboards/rails/routes/vault.rb +37 -0
  581. package/dashboards/rails/views/agent_detail.erb +550 -0
  582. package/dashboards/rails/views/agents.erb +214 -0
  583. package/dashboards/rails/views/api_keys.erb +52 -0
  584. package/dashboards/rails/views/audit.erb +38 -0
  585. package/dashboards/rails/views/compliance.erb +69 -0
  586. package/dashboards/rails/views/dashboard.erb +46 -0
  587. package/dashboards/rails/views/dlp.erb +104 -0
  588. package/dashboards/rails/views/guardrails.erb +107 -0
  589. package/dashboards/rails/views/journal.erb +65 -0
  590. package/dashboards/rails/views/layout.erb +53 -0
  591. package/dashboards/rails/views/login.erb +47 -0
  592. package/dashboards/rails/views/messages.erb +62 -0
  593. package/dashboards/rails/views/settings.erb +578 -0
  594. package/dashboards/rails/views/skills.erb +66 -0
  595. package/dashboards/rails/views/users.erb +53 -0
  596. package/dashboards/rails/views/vault.erb +66 -0
  597. package/dashboards/ruby/app.rb +53 -182
  598. package/dashboards/ruby/helpers/api.rb +63 -0
  599. package/dashboards/ruby/helpers/auth.rb +20 -0
  600. package/dashboards/ruby/helpers/view.rb +91 -0
  601. package/dashboards/ruby/public/styles.css +294 -0
  602. package/dashboards/ruby/routes/agents.rb +197 -0
  603. package/dashboards/ruby/routes/api_keys.rb +43 -0
  604. package/dashboards/ruby/routes/audit.rb +15 -0
  605. package/dashboards/ruby/routes/auth.rb +29 -0
  606. package/dashboards/ruby/routes/compliance.rb +28 -0
  607. package/dashboards/ruby/routes/dashboard.rb +13 -0
  608. package/dashboards/ruby/routes/dlp.rb +55 -0
  609. package/dashboards/ruby/routes/guardrails.rb +77 -0
  610. package/dashboards/ruby/routes/journal.rb +24 -0
  611. package/dashboards/ruby/routes/messages.rb +27 -0
  612. package/dashboards/ruby/routes/settings.rb +214 -0
  613. package/dashboards/ruby/routes/skills.rb +50 -0
  614. package/dashboards/ruby/routes/users.rb +26 -0
  615. package/dashboards/ruby/routes/vault.rb +49 -0
  616. package/dashboards/ruby/views/agent_detail.erb +550 -0
  617. package/dashboards/ruby/views/agents.erb +214 -0
  618. package/dashboards/ruby/views/api_keys.erb +59 -0
  619. package/dashboards/ruby/views/audit.erb +38 -0
  620. package/dashboards/ruby/views/compliance.erb +45 -0
  621. package/dashboards/ruby/views/dashboard.erb +46 -0
  622. package/dashboards/ruby/views/dlp.erb +88 -0
  623. package/dashboards/ruby/views/guardrails.erb +103 -0
  624. package/dashboards/ruby/views/journal.erb +53 -0
  625. package/dashboards/ruby/views/layout.erb +52 -0
  626. package/dashboards/ruby/views/login.erb +31 -0
  627. package/dashboards/ruby/views/messages.erb +51 -0
  628. package/dashboards/ruby/views/settings.erb +579 -0
  629. package/dashboards/ruby/views/skills.erb +66 -0
  630. package/dashboards/ruby/views/users.erb +53 -0
  631. package/dashboards/ruby/views/vault.erb +66 -0
  632. package/dashboards/shared/styles.css +322 -0
  633. package/dist/{chunk-TVF23PUW.js → chunk-7FVRYOP4.js} +22 -7
  634. package/dist/chunk-DRXMYYKN.js +79 -0
  635. package/dist/chunk-E23VJ3QX.js +9427 -0
  636. package/dist/chunk-EOBN6RCA.js +12652 -0
  637. package/dist/chunk-FLRYMSKY.js +23 -0
  638. package/dist/chunk-HAUHDCUB.js +764 -0
  639. package/dist/chunk-HSF6OJ5Z.js +154 -0
  640. package/dist/{chunk-PNKVD2UK.js → chunk-KFQGP6VL.js} +7 -0
  641. package/dist/chunk-LKAFZ343.js +591 -0
  642. package/dist/{chunk-GXIEEA2T.js → chunk-NTVN3JHS.js} +10 -10
  643. package/dist/chunk-RO537U6H.js +70 -0
  644. package/dist/chunk-SGBTJHEF.js +2287 -0
  645. package/dist/chunk-SMUXH6FM.js +1943 -0
  646. package/dist/chunk-TY7NVD4U.js +275 -0
  647. package/dist/chunk-X6UVWFHW.js +3455 -0
  648. package/dist/{chunk-7RGCCHIT.js → chunk-XMDE2NGH.js} +2 -1
  649. package/dist/chunk-ZNR5DDTA.js +239 -0
  650. package/dist/cidr-LISVZSM2.js +17 -0
  651. package/dist/cli-build-skill-XOYECCLE.js +235 -0
  652. package/dist/cli-recover-SSGGSKZJ.js +97 -0
  653. package/dist/cli-submit-skill-RSBLF5XN.js +162 -0
  654. package/dist/cli-validate-WJBUOEGW.js +148 -0
  655. package/dist/cli-verify-V3GPFMWU.js +98 -0
  656. package/dist/cli.js +50 -376
  657. package/dist/config-store-CRMKWBON.js +58 -0
  658. package/dist/dashboard/app.js +246 -0
  659. package/dist/dashboard/assets/logo.png +0 -0
  660. package/dist/dashboard/components/error-boundary.js +21 -0
  661. package/dist/dashboard/components/help-button.js +34 -0
  662. package/dist/dashboard/components/icons.js +53 -0
  663. package/dist/dashboard/components/modal.js +124 -0
  664. package/dist/dashboard/components/persona-fields.js +271 -0
  665. package/dist/dashboard/components/settings-help.js +191 -0
  666. package/dist/dashboard/components/tag-input.js +96 -0
  667. package/dist/dashboard/components/utils.js +148 -0
  668. package/dist/dashboard/index.html +407 -874
  669. package/dist/dashboard/pages/activity.js +62 -0
  670. package/dist/dashboard/pages/agent-detail.js +3577 -0
  671. package/dist/dashboard/pages/agents.js +1072 -0
  672. package/dist/dashboard/pages/approvals.js +81 -0
  673. package/dist/dashboard/pages/audit.js +133 -0
  674. package/dist/dashboard/pages/community-skills.js +665 -0
  675. package/dist/dashboard/pages/compliance.js +81 -0
  676. package/dist/dashboard/pages/dashboard.js +150 -0
  677. package/dist/dashboard/pages/dlp.js +107 -0
  678. package/dist/dashboard/pages/domain-status.js +123 -0
  679. package/dist/dashboard/pages/guardrails.js +995 -0
  680. package/dist/dashboard/pages/journal.js +51 -0
  681. package/dist/dashboard/pages/knowledge-contributions.js +763 -0
  682. package/dist/dashboard/pages/knowledge.js +46 -0
  683. package/dist/dashboard/pages/login.js +491 -0
  684. package/dist/dashboard/pages/messages.js +274 -0
  685. package/dist/dashboard/pages/settings.js +1554 -0
  686. package/dist/dashboard/pages/skill-connections.js +452 -0
  687. package/dist/dashboard/pages/skills.js +433 -0
  688. package/dist/dashboard/pages/users.js +49 -0
  689. package/dist/dashboard/pages/vault.js +538 -0
  690. package/dist/dashboard/pages/workforce.js +569 -0
  691. package/dist/dashboard/vendor/react-dom.production.min.js +267 -0
  692. package/dist/dashboard/vendor/react.production.min.js +31 -0
  693. package/dist/db-adapter-5PWMLY67.js +7 -0
  694. package/dist/domain-lock-URIFILHB.js +7 -0
  695. package/dist/{dynamodb-CCGL2E77.js → dynamodb-CD3LREWD.js} +4 -4
  696. package/dist/{factory-HINWFYZ3.js → factory-FVJH5RRY.js} +2 -2
  697. package/dist/firewall-AHIRE6UB.js +10 -0
  698. package/dist/index.js +133 -448
  699. package/dist/{managed-RZITNPXG.js → managed-QVTONZ7E.js} +4 -2
  700. package/dist/{mongodb-ODTXIVPV.js → mongodb-73MGW7LD.js} +4 -4
  701. package/dist/{mysql-RM3S2FV5.js → mysql-A2RYNBQG.js} +59 -6
  702. package/dist/{postgres-LN7A6MGQ.js → postgres-OE23X46P.js} +63 -6
  703. package/dist/registry/cli.js +411 -0
  704. package/dist/routes-NJK5OI5N.js +5673 -0
  705. package/dist/runtime-SMA6JUMP.js +46 -0
  706. package/dist/server-ZT5NWHT4.js +11 -0
  707. package/dist/setup-RCYNX5NA.js +20 -0
  708. package/dist/skills-QNR3CCHA.js +14 -0
  709. package/dist/soul-templates.json +1525 -0
  710. package/dist/{sqlite-VLKVAJA4.js → sqlite-SFVNZPHX.js} +56 -8
  711. package/dist/{turso-LDWODSDI.js → turso-L6WQAY7U.js} +59 -6
  712. package/live-test.mjs +1 -1
  713. package/package.json +11 -10
  714. package/schemas/agenticmail-skill.v1.schema.json +180 -0
  715. package/serve.mjs +12 -2
  716. package/src/admin/routes.ts +536 -5
  717. package/src/agent-tools/common.ts +232 -0
  718. package/src/agent-tools/index.ts +246 -0
  719. package/src/agent-tools/merge.ts +62 -0
  720. package/src/agent-tools/middleware.ts +436 -0
  721. package/src/agent-tools/security.ts +352 -0
  722. package/src/agent-tools/tools/bash.ts +154 -0
  723. package/src/agent-tools/tools/browser.ts +236 -0
  724. package/src/agent-tools/tools/edit.ts +100 -0
  725. package/src/agent-tools/tools/enterprise-calendar.ts +561 -0
  726. package/src/agent-tools/tools/enterprise-code-sandbox.ts +395 -0
  727. package/src/agent-tools/tools/enterprise-database.ts +377 -0
  728. package/src/agent-tools/tools/enterprise-diff.ts +580 -0
  729. package/src/agent-tools/tools/enterprise-documents.ts +896 -0
  730. package/src/agent-tools/tools/enterprise-finance.ts +484 -0
  731. package/src/agent-tools/tools/enterprise-http.ts +477 -0
  732. package/src/agent-tools/tools/enterprise-knowledge-search.ts +369 -0
  733. package/src/agent-tools/tools/enterprise-logs.ts +479 -0
  734. package/src/agent-tools/tools/enterprise-notifications.ts +532 -0
  735. package/src/agent-tools/tools/enterprise-security-scan.ts +528 -0
  736. package/src/agent-tools/tools/enterprise-spreadsheet.ts +825 -0
  737. package/src/agent-tools/tools/enterprise-translation.ts +530 -0
  738. package/src/agent-tools/tools/enterprise-vision.ts +348 -0
  739. package/src/agent-tools/tools/enterprise-web-research.ts +422 -0
  740. package/src/agent-tools/tools/enterprise-workflow.ts +308 -0
  741. package/src/agent-tools/tools/glob.ts +129 -0
  742. package/src/agent-tools/tools/grep.ts +178 -0
  743. package/src/agent-tools/tools/memory.ts +194 -0
  744. package/src/agent-tools/tools/read.ts +160 -0
  745. package/src/agent-tools/tools/web-fetch-utils.ts +202 -0
  746. package/src/agent-tools/tools/web-fetch.ts +456 -0
  747. package/src/agent-tools/tools/web-search.ts +480 -0
  748. package/src/agent-tools/tools/web-shared.ts +232 -0
  749. package/src/agent-tools/tools/write.ts +68 -0
  750. package/src/agent-tools/types.ts +193 -0
  751. package/src/auth/routes.ts +916 -51
  752. package/src/cli.ts +74 -14
  753. package/src/dashboard/app.js +246 -0
  754. package/src/dashboard/assets/logo.png +0 -0
  755. package/src/dashboard/components/error-boundary.js +21 -0
  756. package/src/dashboard/components/help-button.js +34 -0
  757. package/src/dashboard/components/icons.js +53 -0
  758. package/src/dashboard/components/modal.js +124 -0
  759. package/src/dashboard/components/persona-fields.js +271 -0
  760. package/src/dashboard/components/settings-help.js +191 -0
  761. package/src/dashboard/components/tag-input.js +96 -0
  762. package/src/dashboard/components/utils.js +148 -0
  763. package/src/dashboard/index.html +407 -874
  764. package/src/dashboard/pages/activity.js +62 -0
  765. package/src/dashboard/pages/agent-detail.js +3577 -0
  766. package/src/dashboard/pages/agents.js +1072 -0
  767. package/src/dashboard/pages/approvals.js +81 -0
  768. package/src/dashboard/pages/audit.js +133 -0
  769. package/src/dashboard/pages/community-skills.js +665 -0
  770. package/src/dashboard/pages/compliance.js +81 -0
  771. package/src/dashboard/pages/dashboard.js +150 -0
  772. package/src/dashboard/pages/dlp.js +107 -0
  773. package/src/dashboard/pages/domain-status.js +123 -0
  774. package/src/dashboard/pages/guardrails.js +995 -0
  775. package/src/dashboard/pages/journal.js +51 -0
  776. package/src/dashboard/pages/knowledge-contributions.js +763 -0
  777. package/src/dashboard/pages/knowledge.js +46 -0
  778. package/src/dashboard/pages/login.js +491 -0
  779. package/src/dashboard/pages/messages.js +274 -0
  780. package/src/dashboard/pages/settings.js +1554 -0
  781. package/src/dashboard/pages/skill-connections.js +452 -0
  782. package/src/dashboard/pages/skills.js +433 -0
  783. package/src/dashboard/pages/users.js +49 -0
  784. package/src/dashboard/pages/vault.js +538 -0
  785. package/src/dashboard/pages/workforce.js +569 -0
  786. package/src/dashboard/vendor/react-dom.production.min.js +267 -0
  787. package/src/dashboard/vendor/react.production.min.js +31 -0
  788. package/src/db/adapter.ts +134 -1
  789. package/src/db/dynamodb.ts +2 -2
  790. package/src/db/mongodb.ts +2 -2
  791. package/src/db/mysql.ts +55 -1
  792. package/src/db/postgres.ts +59 -1
  793. package/src/db/proxy.ts +39 -0
  794. package/src/db/sql-schema.ts +2 -1
  795. package/src/db/sqlite.ts +51 -3
  796. package/src/db/turso.ts +55 -1
  797. package/src/deploy/fly.ts +2 -2
  798. package/src/deploy/managed.ts +32 -11
  799. package/src/domain-lock/cli-recover.ts +124 -0
  800. package/src/domain-lock/cli-verify.ts +122 -0
  801. package/src/domain-lock/index.ts +220 -0
  802. package/src/engine/activity-routes.ts +116 -0
  803. package/src/engine/activity.ts +62 -2
  804. package/src/engine/agent-config.ts +190 -24
  805. package/src/engine/agent-memory.ts +1062 -0
  806. package/src/engine/agent-routes.ts +379 -0
  807. package/src/engine/approvals.ts +309 -2
  808. package/src/engine/catalog-routes.ts +155 -0
  809. package/src/engine/cli-build-skill.ts +285 -0
  810. package/src/engine/cli-submit-skill.ts +200 -0
  811. package/src/engine/cli-validate.ts +188 -0
  812. package/src/engine/communication-routes.ts +139 -0
  813. package/src/engine/communication.ts +759 -0
  814. package/src/engine/community-registry.ts +1509 -0
  815. package/src/engine/community-routes.ts +233 -0
  816. package/src/engine/compliance-routes.ts +93 -0
  817. package/src/engine/compliance.ts +325 -0
  818. package/src/engine/db-adapter.ts +349 -1
  819. package/src/engine/db-schema.ts +971 -23
  820. package/src/engine/deploy-schema-routes.ts +176 -0
  821. package/src/engine/deployer.ts +6 -6
  822. package/src/engine/dlp-routes.ts +59 -0
  823. package/src/engine/dlp.ts +231 -0
  824. package/src/engine/guardrail-routes.ts +125 -0
  825. package/src/engine/guardrails.ts +403 -0
  826. package/src/engine/index.ts +131 -10
  827. package/src/engine/journal-routes.ts +56 -0
  828. package/src/engine/journal.ts +249 -0
  829. package/src/engine/knowledge-contribution-routes.ts +385 -0
  830. package/src/engine/knowledge-contribution.ts +1319 -0
  831. package/src/engine/knowledge-routes.ts +68 -0
  832. package/src/engine/knowledge.ts +73 -1
  833. package/src/engine/lifecycle.ts +487 -31
  834. package/src/engine/memory-routes.ts +142 -0
  835. package/src/engine/oauth-connect-routes.ts +366 -0
  836. package/src/engine/oauth-connect.ts +304 -0
  837. package/src/engine/onboarding-routes.ts +140 -0
  838. package/src/engine/onboarding.ts +574 -0
  839. package/src/engine/org-approval-routes.ts +146 -0
  840. package/src/engine/org-policies.ts +497 -0
  841. package/src/engine/policy-import-routes.ts +125 -0
  842. package/src/engine/policy-import.ts +1186 -0
  843. package/src/engine/policy-routes.ts +163 -0
  844. package/src/engine/routes.ts +239 -482
  845. package/src/engine/skill-updater-routes.ts +132 -0
  846. package/src/engine/skill-updater.ts +480 -0
  847. package/src/engine/skill-validator.ts +331 -0
  848. package/src/engine/skills/enterprise-calendar.ts +142 -0
  849. package/src/engine/skills/enterprise-code-sandbox.ts +112 -0
  850. package/src/engine/skills/enterprise-database.ts +122 -0
  851. package/src/engine/skills/enterprise-diff.ts +94 -0
  852. package/src/engine/skills/enterprise-documents.ts +161 -0
  853. package/src/engine/skills/enterprise-finance.ts +109 -0
  854. package/src/engine/skills/enterprise-http.ts +98 -0
  855. package/src/engine/skills/enterprise-knowledge-search.ts +106 -0
  856. package/src/engine/skills/enterprise-logs.ts +115 -0
  857. package/src/engine/skills/enterprise-notifications.ts +119 -0
  858. package/src/engine/skills/enterprise-security-scan.ts +124 -0
  859. package/src/engine/skills/enterprise-spreadsheet.ts +170 -0
  860. package/src/engine/skills/enterprise-translation.ts +111 -0
  861. package/src/engine/skills/enterprise-vision.ts +107 -0
  862. package/src/engine/skills/enterprise-web-research.ts +114 -0
  863. package/src/engine/skills/enterprise-workflow.ts +109 -0
  864. package/src/engine/skills/gws-admin.ts +17 -0
  865. package/src/engine/skills/gws-calendar.ts +19 -0
  866. package/src/engine/skills/gws-chat.ts +16 -0
  867. package/src/engine/skills/gws-docs.ts +17 -0
  868. package/src/engine/skills/gws-drive.ts +20 -0
  869. package/src/engine/skills/gws-forms.ts +16 -0
  870. package/src/engine/skills/gws-gmail.ts +20 -0
  871. package/src/engine/skills/gws-groups.ts +16 -0
  872. package/src/engine/skills/gws-keep.ts +16 -0
  873. package/src/engine/skills/gws-meet.ts +16 -0
  874. package/src/engine/skills/gws-sheets.ts +18 -0
  875. package/src/engine/skills/gws-sites.ts +15 -0
  876. package/src/engine/skills/gws-slides.ts +16 -0
  877. package/src/engine/skills/gws-vault.ts +16 -0
  878. package/src/engine/skills/index.ts +121 -0
  879. package/src/engine/skills/m365-admin.ts +17 -0
  880. package/src/engine/skills/m365-bookings.ts +16 -0
  881. package/src/engine/skills/m365-copilot.ts +16 -0
  882. package/src/engine/skills/m365-excel.ts +59 -0
  883. package/src/engine/skills/m365-forms.ts +16 -0
  884. package/src/engine/skills/m365-onedrive.ts +59 -0
  885. package/src/engine/skills/m365-onenote.ts +16 -0
  886. package/src/engine/skills/m365-outlook.ts +26 -0
  887. package/src/engine/skills/m365-planner.ts +17 -0
  888. package/src/engine/skills/m365-power-automate.ts +17 -0
  889. package/src/engine/skills/m365-power-bi.ts +18 -0
  890. package/src/engine/skills/m365-powerpoint.ts +32 -0
  891. package/src/engine/skills/m365-sharepoint.ts +19 -0
  892. package/src/engine/skills/m365-teams.ts +20 -0
  893. package/src/engine/skills/m365-todo.ts +16 -0
  894. package/src/engine/skills/m365-whiteboard.ts +15 -0
  895. package/src/engine/skills/m365-word.ts +41 -0
  896. package/src/engine/skills.ts +353 -17
  897. package/src/engine/soul-library.ts +142 -0
  898. package/src/engine/soul-templates.json +1525 -0
  899. package/src/engine/storage-manager.ts +252 -0
  900. package/src/engine/storage-routes.ts +113 -0
  901. package/src/engine/storage.ts +528 -0
  902. package/src/engine/tenant.ts +69 -5
  903. package/src/engine/tool-catalog.ts +177 -13
  904. package/src/engine/vault-routes.ts +130 -0
  905. package/src/engine/vault.ts +544 -0
  906. package/src/engine/workforce-routes.ts +282 -0
  907. package/src/engine/workforce.ts +957 -0
  908. package/src/index.ts +9 -1
  909. package/src/lib/cidr.ts +122 -0
  910. package/src/lib/config-store.ts +86 -0
  911. package/src/mcp/adapters/activecampaign.adapter.ts +391 -0
  912. package/src/mcp/adapters/adobe-sign.adapter.ts +469 -0
  913. package/src/mcp/adapters/adp.adapter.ts +358 -0
  914. package/src/mcp/adapters/airtable.adapter.ts +273 -0
  915. package/src/mcp/adapters/apollo.adapter.ts +420 -0
  916. package/src/mcp/adapters/asana.adapter.ts +315 -0
  917. package/src/mcp/adapters/auth0.adapter.ts +386 -0
  918. package/src/mcp/adapters/aws.adapter.ts +345 -0
  919. package/src/mcp/adapters/azure-devops.adapter.ts +389 -0
  920. package/src/mcp/adapters/bamboohr.adapter.ts +376 -0
  921. package/src/mcp/adapters/basecamp.adapter.ts +366 -0
  922. package/src/mcp/adapters/bigcommerce.adapter.ts +429 -0
  923. package/src/mcp/adapters/bitbucket.adapter.ts +260 -0
  924. package/src/mcp/adapters/box.adapter.ts +350 -0
  925. package/src/mcp/adapters/brex.adapter.ts +367 -0
  926. package/src/mcp/adapters/buffer.adapter.ts +303 -0
  927. package/src/mcp/adapters/calendly.adapter.ts +262 -0
  928. package/src/mcp/adapters/canva.adapter.ts +256 -0
  929. package/src/mcp/adapters/chargebee.adapter.ts +448 -0
  930. package/src/mcp/adapters/circleci.adapter.ts +216 -0
  931. package/src/mcp/adapters/clickup.adapter.ts +335 -0
  932. package/src/mcp/adapters/close.adapter.ts +390 -0
  933. package/src/mcp/adapters/cloudflare.adapter.ts +377 -0
  934. package/src/mcp/adapters/confluence.adapter.ts +301 -0
  935. package/src/mcp/adapters/contentful.adapter.ts +355 -0
  936. package/src/mcp/adapters/copper.adapter.ts +468 -0
  937. package/src/mcp/adapters/crisp.adapter.ts +415 -0
  938. package/src/mcp/adapters/crowdstrike.adapter.ts +413 -0
  939. package/src/mcp/adapters/datadog.adapter.ts +373 -0
  940. package/src/mcp/adapters/digitalocean.adapter.ts +336 -0
  941. package/src/mcp/adapters/discord.adapter.ts +248 -0
  942. package/src/mcp/adapters/docker.adapter.ts +238 -0
  943. package/src/mcp/adapters/docusign.adapter.ts +431 -0
  944. package/src/mcp/adapters/drift.adapter.ts +386 -0
  945. package/src/mcp/adapters/dropbox.adapter.ts +315 -0
  946. package/src/mcp/adapters/figma.adapter.ts +302 -0
  947. package/src/mcp/adapters/firebase.adapter.ts +446 -0
  948. package/src/mcp/adapters/flyio.adapter.ts +302 -0
  949. package/src/mcp/adapters/freshbooks.adapter.ts +474 -0
  950. package/src/mcp/adapters/freshdesk.adapter.ts +441 -0
  951. package/src/mcp/adapters/freshsales.adapter.ts +457 -0
  952. package/src/mcp/adapters/freshservice.adapter.ts +481 -0
  953. package/src/mcp/adapters/front.adapter.ts +357 -0
  954. package/src/mcp/adapters/github-actions.adapter.ts +329 -0
  955. package/src/mcp/adapters/github.adapter.ts +387 -0
  956. package/src/mcp/adapters/gitlab.adapter.ts +368 -0
  957. package/src/mcp/adapters/gong.adapter.ts +386 -0
  958. package/src/mcp/adapters/google-ads.adapter.ts +363 -0
  959. package/src/mcp/adapters/google-analytics.adapter.ts +316 -0
  960. package/src/mcp/adapters/google-cloud.adapter.ts +312 -0
  961. package/src/mcp/adapters/google-drive.adapter.ts +387 -0
  962. package/src/mcp/adapters/gotomeeting.adapter.ts +255 -0
  963. package/src/mcp/adapters/grafana.adapter.ts +361 -0
  964. package/src/mcp/adapters/greenhouse.adapter.ts +354 -0
  965. package/src/mcp/adapters/gusto.adapter.ts +329 -0
  966. package/src/mcp/adapters/hashicorp-vault.adapter.ts +355 -0
  967. package/src/mcp/adapters/heroku.adapter.ts +291 -0
  968. package/src/mcp/adapters/hibob.adapter.ts +334 -0
  969. package/src/mcp/adapters/hootsuite.adapter.ts +322 -0
  970. package/src/mcp/adapters/hubspot.adapter.ts +400 -0
  971. package/src/mcp/adapters/huggingface.adapter.ts +349 -0
  972. package/src/mcp/adapters/index.ts +530 -0
  973. package/src/mcp/adapters/intercom.adapter.ts +269 -0
  974. package/src/mcp/adapters/jira.adapter.ts +482 -0
  975. package/src/mcp/adapters/klaviyo.adapter.ts +353 -0
  976. package/src/mcp/adapters/kubernetes.adapter.ts +431 -0
  977. package/src/mcp/adapters/lattice.adapter.ts +339 -0
  978. package/src/mcp/adapters/launchdarkly.adapter.ts +368 -0
  979. package/src/mcp/adapters/lever.adapter.ts +347 -0
  980. package/src/mcp/adapters/linear.adapter.ts +300 -0
  981. package/src/mcp/adapters/linkedin.adapter.ts +331 -0
  982. package/src/mcp/adapters/livechat.adapter.ts +259 -0
  983. package/src/mcp/adapters/loom.adapter.ts +230 -0
  984. package/src/mcp/adapters/mailchimp.adapter.ts +394 -0
  985. package/src/mcp/adapters/mailgun.adapter.ts +425 -0
  986. package/src/mcp/adapters/microsoft-teams.adapter.ts +251 -0
  987. package/src/mcp/adapters/miro.adapter.ts +274 -0
  988. package/src/mcp/adapters/mixpanel.adapter.ts +324 -0
  989. package/src/mcp/adapters/monday.adapter.ts +308 -0
  990. package/src/mcp/adapters/mongodb-atlas.adapter.ts +345 -0
  991. package/src/mcp/adapters/neon.adapter.ts +312 -0
  992. package/src/mcp/adapters/netlify.adapter.ts +324 -0
  993. package/src/mcp/adapters/netsuite.adapter.ts +411 -0
  994. package/src/mcp/adapters/newrelic.adapter.ts +339 -0
  995. package/src/mcp/adapters/notion.adapter.ts +338 -0
  996. package/src/mcp/adapters/okta.adapter.ts +394 -0
  997. package/src/mcp/adapters/openai.adapter.ts +315 -0
  998. package/src/mcp/adapters/opsgenie.adapter.ts +375 -0
  999. package/src/mcp/adapters/outreach.adapter.ts +372 -0
  1000. package/src/mcp/adapters/paddle.adapter.ts +467 -0
  1001. package/src/mcp/adapters/pagerduty.adapter.ts +412 -0
  1002. package/src/mcp/adapters/pandadoc.adapter.ts +389 -0
  1003. package/src/mcp/adapters/paypal.adapter.ts +465 -0
  1004. package/src/mcp/adapters/personio.adapter.ts +401 -0
  1005. package/src/mcp/adapters/pinecone.adapter.ts +340 -0
  1006. package/src/mcp/adapters/pipedrive.adapter.ts +324 -0
  1007. package/src/mcp/adapters/plaid.adapter.ts +444 -0
  1008. package/src/mcp/adapters/postmark.adapter.ts +387 -0
  1009. package/src/mcp/adapters/power-automate.adapter.ts +388 -0
  1010. package/src/mcp/adapters/quickbooks.adapter.ts +431 -0
  1011. package/src/mcp/adapters/recurly.adapter.ts +433 -0
  1012. package/src/mcp/adapters/reddit.adapter.ts +371 -0
  1013. package/src/mcp/adapters/render.adapter.ts +332 -0
  1014. package/src/mcp/adapters/ringcentral.adapter.ts +281 -0
  1015. package/src/mcp/adapters/rippling.adapter.ts +287 -0
  1016. package/src/mcp/adapters/salesforce.adapter.ts +321 -0
  1017. package/src/mcp/adapters/salesloft.adapter.ts +413 -0
  1018. package/src/mcp/adapters/sanity.adapter.ts +363 -0
  1019. package/src/mcp/adapters/sap.adapter.ts +483 -0
  1020. package/src/mcp/adapters/segment.adapter.ts +260 -0
  1021. package/src/mcp/adapters/sendgrid.adapter.ts +265 -0
  1022. package/src/mcp/adapters/sentry.adapter.ts +331 -0
  1023. package/src/mcp/adapters/servicenow.adapter.ts +468 -0
  1024. package/src/mcp/adapters/shopify.adapter.ts +451 -0
  1025. package/src/mcp/adapters/shortcut.adapter.ts +290 -0
  1026. package/src/mcp/adapters/slack.adapter.ts +380 -0
  1027. package/src/mcp/adapters/smartsheet.adapter.ts +326 -0
  1028. package/src/mcp/adapters/snowflake.adapter.ts +347 -0
  1029. package/src/mcp/adapters/snyk.adapter.ts +394 -0
  1030. package/src/mcp/adapters/splunk.adapter.ts +403 -0
  1031. package/src/mcp/adapters/square.adapter.ts +467 -0
  1032. package/src/mcp/adapters/statuspage.adapter.ts +401 -0
  1033. package/src/mcp/adapters/stripe.adapter.ts +380 -0
  1034. package/src/mcp/adapters/supabase.adapter.ts +334 -0
  1035. package/src/mcp/adapters/teamwork.adapter.ts +404 -0
  1036. package/src/mcp/adapters/telegram.adapter.ts +299 -0
  1037. package/src/mcp/adapters/terraform.adapter.ts +300 -0
  1038. package/src/mcp/adapters/todoist.adapter.ts +239 -0
  1039. package/src/mcp/adapters/trello.adapter.ts +316 -0
  1040. package/src/mcp/adapters/twilio.adapter.ts +233 -0
  1041. package/src/mcp/adapters/twitter.adapter.ts +348 -0
  1042. package/src/mcp/adapters/vercel.adapter.ts +219 -0
  1043. package/src/mcp/adapters/weaviate.adapter.ts +371 -0
  1044. package/src/mcp/adapters/webex.adapter.ts +237 -0
  1045. package/src/mcp/adapters/webflow.adapter.ts +287 -0
  1046. package/src/mcp/adapters/whatsapp.adapter.ts +273 -0
  1047. package/src/mcp/adapters/whereby.adapter.ts +240 -0
  1048. package/src/mcp/adapters/woocommerce.adapter.ts +454 -0
  1049. package/src/mcp/adapters/wordpress.adapter.ts +455 -0
  1050. package/src/mcp/adapters/workday.adapter.ts +354 -0
  1051. package/src/mcp/adapters/wrike.adapter.ts +349 -0
  1052. package/src/mcp/adapters/xero.adapter.ts +472 -0
  1053. package/src/mcp/adapters/youtube.adapter.ts +401 -0
  1054. package/src/mcp/adapters/zendesk.adapter.ts +399 -0
  1055. package/src/mcp/adapters/zoho-crm.adapter.ts +410 -0
  1056. package/src/mcp/adapters/zoom.adapter.ts +241 -0
  1057. package/src/mcp/adapters/zuora.adapter.ts +476 -0
  1058. package/src/mcp/framework/api-executor.ts +192 -0
  1059. package/src/mcp/framework/aws-sigv4.ts +216 -0
  1060. package/src/mcp/framework/credential-resolver.ts +128 -0
  1061. package/src/mcp/framework/skill-mcp-framework.ts +226 -0
  1062. package/src/mcp/framework/types.ts +130 -0
  1063. package/src/mcp/index.ts +124 -0
  1064. package/src/middleware/egress-filter.ts +81 -0
  1065. package/src/middleware/firewall.ts +121 -0
  1066. package/src/middleware/index.ts +33 -0
  1067. package/src/registry/cli.ts +63 -0
  1068. package/src/registry/server.ts +504 -0
  1069. package/src/runtime/agent-loop.ts +504 -0
  1070. package/src/runtime/email-channel.ts +120 -0
  1071. package/src/runtime/followup.ts +211 -0
  1072. package/src/runtime/gateway.ts +260 -0
  1073. package/src/runtime/hooks.ts +472 -0
  1074. package/src/runtime/index.ts +679 -0
  1075. package/src/runtime/llm-client.ts +1019 -0
  1076. package/src/runtime/providers.ts +231 -0
  1077. package/src/runtime/session-manager.ts +340 -0
  1078. package/src/runtime/subagent.ts +154 -0
  1079. package/src/runtime/tool-executor.ts +202 -0
  1080. package/src/runtime/types.ts +215 -0
  1081. package/src/server.ts +157 -45
  1082. package/src/setup/company.ts +127 -8
  1083. package/src/setup/database.ts +2 -1
  1084. package/src/setup/domain.ts +33 -4
  1085. package/src/setup/index.ts +19 -7
  1086. package/src/setup/provision.ts +128 -8
  1087. package/src/setup/registration.ts +227 -0
  1088. package/src/types/hono-env.ts +14 -0
  1089. package/src/types/optional-deps.d.ts +10 -0
  1090. package/start-live.mjs +12 -3
  1091. package/test-integration.mjs +628 -257
  1092. package/dist/chunk-77IDQJL3.js +0 -7
  1093. package/dist/chunk-BE7MXVLA.js +0 -757
  1094. package/dist/chunk-BS2WCSHO.js +0 -48
  1095. package/dist/chunk-FL3VQBGL.js +0 -757
  1096. package/dist/chunk-IQWA44WT.js +0 -970
  1097. package/dist/chunk-N2JVTNNJ.js +0 -2553
  1098. package/dist/chunk-YFDSE4BW.js +0 -1355
  1099. package/dist/db-adapter-DEWEFNIV.js +0 -7
  1100. package/dist/factory-V37IG5AT.js +0 -9
  1101. package/dist/routes-2JEPIIKC.js +0 -441
  1102. package/dist/server-32YYCI3A.js +0 -8
  1103. package/dist/server-H3C6WUOS.js +0 -8
  1104. package/dist/sqlite-3K5YOZ4K.js +0 -439
  1105. package/src/engine/agenticmail-bridge.ts +0 -296
  1106. package/src/engine/openclaw-hook.ts +0 -371
@@ -0,0 +1,1554 @@
1
+ import { h, useState, useEffect, useCallback, Fragment, useApp, apiCall, engineCall, applyBrandColor, showConfirm } from '../components/utils.js';
2
+ import { I } from '../components/icons.js';
3
+ import { Modal } from '../components/modal.js';
4
+ import { TagInput } from '../components/tag-input.js';
5
+ import { HelpButton } from '../components/help-button.js';
6
+ import { SETTINGS_HELP } from '../components/settings-help.js';
7
+
8
+ export function SettingsPage() {
9
+ const { toast } = useApp();
10
+ const [tab, setTab] = useState('general');
11
+ const [settings, setSettings] = useState({});
12
+ const [apiKeys, setApiKeys] = useState([]);
13
+ const [keyName, setKeyName] = useState('');
14
+ const [newKeyPlaintext, setNewKeyPlaintext] = useState(null);
15
+ const [keyCopied, setKeyCopied] = useState(false);
16
+ const [ssoConfig, setSsoConfig] = useState({});
17
+ const [deployCreds, setDeployCreds] = useState([]);
18
+ const [showDeployModal, setShowDeployModal] = useState(false);
19
+ const [deployForm, setDeployForm] = useState({ name: '', targetType: 'docker', config: {} });
20
+ const [toolSec, setToolSec] = useState({ security: {}, middleware: {} });
21
+ const [toolSecDirty, setToolSecDirty] = useState(false);
22
+ const [toolSecSaving, setToolSecSaving] = useState(false);
23
+ var _fw = useState({});
24
+ var fw = _fw[0]; var setFw = _fw[1];
25
+ var _fwDirty = useState(false);
26
+ var fwDirty = _fwDirty[0]; var setFwDirty = _fwDirty[1];
27
+ var _fwSaving = useState(false);
28
+ var fwSaving = _fwSaving[0]; var setFwSaving = _fwSaving[1];
29
+ var _fwTestIp = useState('');
30
+ var fwTestIp = _fwTestIp[0]; var setFwTestIp = _fwTestIp[1];
31
+ var _fwTestResult = useState(null);
32
+ var fwTestResult = _fwTestResult[0]; var setFwTestResult = _fwTestResult[1];
33
+ var _pricing = useState({ models: [], currency: 'USD' });
34
+ var pricing = _pricing[0]; var setPricing = _pricing[1];
35
+ var _pricingDirty = useState(false);
36
+ var pricingDirty = _pricingDirty[0]; var setPricingDirty = _pricingDirty[1];
37
+ var _pricingSaving = useState(false);
38
+ var pricingSaving = _pricingSaving[0]; var setPricingSaving = _pricingSaving[1];
39
+ var _showAddModel = useState(false);
40
+ var showAddModel = _showAddModel[0]; var setShowAddModel = _showAddModel[1];
41
+ var _newModel = useState({ provider: 'anthropic', modelId: '', displayName: '', inputCostPerMillion: 0, outputCostPerMillion: 0, contextWindow: 0 });
42
+ var newModel = _newModel[0]; var setNewModel = _newModel[1];
43
+ var _providers = useState([]);
44
+ var providers = _providers[0]; var setProviders = _providers[1];
45
+ var _showAddProvider = useState(false);
46
+ var showAddProvider = _showAddProvider[0]; var setShowAddProvider = _showAddProvider[1];
47
+ var _newProvider = useState({ id: '', name: '', baseUrl: '', apiType: 'openai-compatible', apiKeyEnvVar: '', customHeaders: '' });
48
+ var newProvider = _newProvider[0]; var setNewProvider = _newProvider[1];
49
+ var _discoverResults = useState({});
50
+ var discoverResults = _discoverResults[0]; var setDiscoverResults = _discoverResults[1];
51
+
52
+ useEffect(() => {
53
+ apiCall('/settings').then(d => { const s = d.settings || d || {}; setSettings(s); if (s.primaryColor) applyBrandColor(s.primaryColor); }).catch(() => {});
54
+ apiCall('/api-keys').then(d => setApiKeys(d.keys || [])).catch(() => {});
55
+ apiCall('/settings/sso').then(d => {
56
+ const sso = d.ssoConfig || {};
57
+ setSsoConfig(sso);
58
+ setSettings(s => ({
59
+ ...s,
60
+ samlEntityId: sso.saml?.entityId || '', samlSsoUrl: sso.saml?.ssoUrl || '', samlCertificate: sso.saml?.certificate || '',
61
+ oidcClientId: sso.oidc?.clientId || '', oidcClientSecret: sso.oidc?.clientSecret || '', oidcDiscoveryUrl: sso.oidc?.discoveryUrl || '',
62
+ }));
63
+ }).catch(() => {});
64
+ engineCall('/deploy-credentials?orgId=default').then(d => setDeployCreds(d.credentials || [])).catch(() => {});
65
+ apiCall('/settings/tool-security').then(d => {
66
+ var cfg = d.toolSecurityConfig || {};
67
+ setToolSec({
68
+ security: cfg.security || { pathSandbox: { enabled: true, allowedDirs: [], blockedPatterns: [] }, ssrf: { enabled: true, allowedHosts: [], blockedCidrs: [] }, commandSanitizer: { enabled: true, mode: 'blocklist', allowedCommands: [], blockedPatterns: [] } },
69
+ middleware: cfg.middleware || { audit: { enabled: true, redactKeys: [] }, rateLimit: { enabled: true, overrides: {} }, circuitBreaker: { enabled: true }, telemetry: { enabled: true } }
70
+ });
71
+ }).catch(() => {});
72
+ apiCall('/settings/firewall').then(function(d) {
73
+ setFw(d.firewallConfig || {});
74
+ }).catch(function() {});
75
+ apiCall('/settings/model-pricing').then(function(d) {
76
+ setPricing(d.modelPricingConfig || { models: [], currency: 'USD' });
77
+ }).catch(function() {});
78
+ apiCall('/providers').then(function(d) {
79
+ setProviders(d.providers || d || []);
80
+ }).catch(function() {});
81
+ }, []);
82
+
83
+ const createKey = async () => {
84
+ try {
85
+ const d = await apiCall('/api-keys', { method: 'POST', body: JSON.stringify({ name: keyName || 'New Key', scopes: ['read', 'write', 'admin'] }) });
86
+ if (d.plaintext) { setNewKeyPlaintext(d.plaintext); setKeyCopied(false); }
87
+ else toast('API Key created', 'success');
88
+ setKeyName('');
89
+ apiCall('/api-keys').then(d => setApiKeys(d.keys || [])).catch(() => {});
90
+ } catch (e) { toast(e.message, 'error'); }
91
+ };
92
+
93
+ const copyKey = () => {
94
+ if (newKeyPlaintext) { navigator.clipboard.writeText(newKeyPlaintext).then(() => { setKeyCopied(true); toast('Copied to clipboard', 'success'); }).catch(() => toast('Copy failed', 'error')); }
95
+ };
96
+
97
+ const revokeKey = async (id) => {
98
+ const ok = await showConfirm({ title: 'Revoke API Key', message: 'Are you sure you want to revoke this API key? Any applications using this key will immediately lose access.', warning: 'This action cannot be undone. You will need to create a new key.', danger: true, confirmText: 'Revoke Key' });
99
+ if (!ok) return;
100
+ try { await apiCall('/api-keys/' + id, { method: 'DELETE' }); toast('Key revoked', 'success'); apiCall('/api-keys').then(d => setApiKeys(d.keys || [])); } catch (e) { toast(e.message, 'error'); }
101
+ };
102
+
103
+ const saveSetting = async (key, value) => {
104
+ try { await apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ [key]: value }) }); toast('Settings saved', 'success'); } catch (e) { toast(e.message, 'error'); }
105
+ };
106
+
107
+ const saveSaml = async () => {
108
+ try {
109
+ await apiCall('/settings/sso/saml', { method: 'PUT', body: JSON.stringify({ entityId: settings.samlEntityId, ssoUrl: settings.samlSsoUrl, certificate: settings.samlCertificate }) });
110
+ toast('SAML configuration saved', 'success');
111
+ } catch (e) { toast(e.message, 'error'); }
112
+ };
113
+
114
+ const saveOidc = async () => {
115
+ try {
116
+ await apiCall('/settings/sso/oidc', { method: 'PUT', body: JSON.stringify({ clientId: settings.oidcClientId, clientSecret: settings.oidcClientSecret, discoveryUrl: settings.oidcDiscoveryUrl }) });
117
+ toast('OIDC configuration saved', 'success');
118
+ } catch (e) { toast(e.message, 'error'); }
119
+ };
120
+
121
+ const testOidc = async () => {
122
+ if (!settings.oidcDiscoveryUrl) { toast('Enter a Discovery URL first', 'error'); return; }
123
+ try {
124
+ const d = await apiCall('/settings/sso/oidc/test', { method: 'POST', body: JSON.stringify({ discoveryUrl: settings.oidcDiscoveryUrl }) });
125
+ if (d.ok) toast('OIDC discovery OK — Issuer: ' + d.issuer, 'success');
126
+ else toast('OIDC test failed: ' + (d.error || 'Unknown error'), 'error');
127
+ } catch (e) { toast(e.message, 'error'); }
128
+ };
129
+
130
+ const removeSso = async (provider) => {
131
+ const ok = await showConfirm({ title: 'Remove ' + provider.toUpperCase() + ' SSO', message: 'Are you sure? Users who sign in via ' + provider.toUpperCase() + ' will lose access.', danger: true, confirmText: 'Remove' });
132
+ if (!ok) return;
133
+ try {
134
+ await apiCall('/settings/sso/' + provider, { method: 'DELETE' });
135
+ toast(provider.toUpperCase() + ' configuration removed', 'success');
136
+ setSsoConfig(c => { const n = { ...c }; delete n[provider]; return n; });
137
+ if (provider === 'saml') setSettings(s => ({ ...s, samlEntityId: '', samlSsoUrl: '', samlCertificate: '' }));
138
+ if (provider === 'oidc') setSettings(s => ({ ...s, oidcClientId: '', oidcClientSecret: '', oidcDiscoveryUrl: '' }));
139
+ } catch (e) { toast(e.message, 'error'); }
140
+ };
141
+
142
+ const prefillOidc = (providerName, discoveryUrl) => {
143
+ setSettings(s => ({ ...s, oidcDiscoveryUrl: discoveryUrl }));
144
+ toast('Pre-filled ' + providerName + ' discovery URL. Enter your Client ID and Secret to complete setup.', 'info');
145
+ };
146
+
147
+ const createDeployCred = async () => {
148
+ try {
149
+ await engineCall('/deploy-credentials', { method: 'POST', body: JSON.stringify({ orgId: 'default', name: deployForm.name, targetType: deployForm.targetType, config: deployForm.config }) });
150
+ toast('Credential created', 'success');
151
+ setShowDeployModal(false);
152
+ setDeployForm({ name: '', targetType: 'docker', config: {} });
153
+ engineCall('/deploy-credentials?orgId=default').then(d => setDeployCreds(d.credentials || [])).catch(() => {});
154
+ } catch (e) { toast(e.message, 'error'); }
155
+ };
156
+
157
+ const deleteDeployCred = async (id) => {
158
+ const ok = await showConfirm({ title: 'Delete Credential', message: 'This will permanently delete the credential. Any deployments using it will fail.', danger: true, confirmText: 'Delete' });
159
+ if (!ok) return;
160
+ try {
161
+ await engineCall('/deploy-credentials/' + id, { method: 'DELETE' });
162
+ toast('Credential deleted', 'success');
163
+ setDeployCreds(c => c.filter(x => x.id !== id));
164
+ } catch (e) { toast(e.message, 'error'); }
165
+ };
166
+
167
+ return h(Fragment, null,
168
+ h('div', { style: { marginBottom: 20, display: 'flex', alignItems: 'center', gap: 8 } },
169
+ h('h1', { style: { fontSize: 20, fontWeight: 700, margin: 0 } }, 'Settings'),
170
+ SETTINGS_HELP[tab] && h(HelpButton, { label: SETTINGS_HELP[tab].label }, SETTINGS_HELP[tab].content())
171
+ ),
172
+ h('div', { className: 'tabs' },
173
+ ['general', 'api-keys', 'authentication', 'email', 'deployments', 'security', 'network', 'pricing', 'integrations'].map(t =>
174
+ h('div', { key: t, className: 'tab' + (tab === t ? ' active' : ''), onClick: () => setTab(t) }, { general: 'General', 'api-keys': 'API Keys', authentication: 'Authentication', email: 'Email & Domain', deployments: 'Deployments', security: 'Tool Security', network: 'Network & Firewall', pricing: 'Model Pricing', integrations: 'Integrations' }[t])
175
+ )
176
+ ),
177
+
178
+ tab === 'general' && h('div', null,
179
+ h('div', { className: 'card', style: { marginBottom: 16 } },
180
+ h('div', { className: 'card-header' }, h('h3', null, 'Organization')),
181
+ h('div', { className: 'card-body' },
182
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
183
+ h('div', { className: 'form-group' },
184
+ h('label', { className: 'form-label' }, 'Company Name'),
185
+ h('input', { className: 'input', value: settings.name || '', onChange: e => setSettings(s => ({ ...s, name: e.target.value })) })
186
+ ),
187
+ h('div', { className: 'form-group' },
188
+ h('label', { className: 'form-label' }, 'Domain'),
189
+ h('input', { className: 'input', value: settings.domain || '', onChange: e => setSettings(s => ({ ...s, domain: e.target.value })) })
190
+ ),
191
+ h('div', { className: 'form-group' },
192
+ h('label', { className: 'form-label' }, 'Subdomain'),
193
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
194
+ h('input', { className: 'input', value: settings.subdomain || '', onChange: e => setSettings(s => ({ ...s, subdomain: e.target.value })), style: { maxWidth: 200 } }),
195
+ h('span', { style: { color: 'var(--text-muted)', fontSize: 13 } }, '.agenticmail.io')
196
+ )
197
+ ),
198
+ h('div', { className: 'form-group' },
199
+ h('label', { className: 'form-label' }, 'Plan'),
200
+ h('select', { className: 'input', value: settings.plan || 'self-hosted', onChange: e => setSettings(s => ({ ...s, plan: e.target.value })) },
201
+ h('option', { value: 'self-hosted' }, 'Self-Hosted (Unlimited)'),
202
+ h('option', { value: 'team' }, 'Team (25 agents)'),
203
+ h('option', { value: 'enterprise' }, 'Enterprise (Unlimited + Support)'),
204
+ h('option', { value: 'free' }, 'Free (3 agents)')
205
+ ),
206
+ h('p', { className: 'form-help' }, 'Self-hosted installations have no restrictions. Choose a plan tier to enforce agent limits.')
207
+ )
208
+ ),
209
+ h('div', { className: 'form-group' },
210
+ h('label', { className: 'form-label' }, 'Logo URL'),
211
+ h('input', { className: 'input', value: settings.logoUrl || '', onChange: e => setSettings(s => ({ ...s, logoUrl: e.target.value })), placeholder: 'https://yourcompany.com/logo.png' })
212
+ ),
213
+ h('div', { className: 'form-group' },
214
+ h('label', { className: 'form-label' }, 'Primary Brand Color'),
215
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 10 } },
216
+ h('input', { type: 'color', value: settings.primaryColor || '#6366f1', onChange: e => { setSettings(s => ({ ...s, primaryColor: e.target.value })); applyBrandColor(e.target.value); }, style: { width: 40, height: 32, padding: 0, border: '1px solid var(--border)', borderRadius: 'var(--radius)', cursor: 'pointer' } }),
217
+ h('input', { className: 'input', value: settings.primaryColor || '', onChange: e => { setSettings(s => ({ ...s, primaryColor: e.target.value })); if (/^#[0-9a-fA-F]{6}$/.test(e.target.value)) applyBrandColor(e.target.value); }, style: { maxWidth: 120, fontFamily: 'var(--font-mono)', fontSize: 12 } })
218
+ )
219
+ ),
220
+ h('button', { className: 'btn btn-primary', onClick: () => apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ name: settings.name, domain: settings.domain, subdomain: settings.subdomain, logoUrl: settings.logoUrl, primaryColor: settings.primaryColor, plan: settings.plan }) }).then(d => { setSettings(d); toast('Settings saved', 'success'); }).catch(e => toast(e.message, 'error')) }, 'Save Changes')
221
+ )
222
+ ),
223
+ h('div', { className: 'card' },
224
+ h('div', { className: 'card-header' }, h('h3', null, 'SMTP Configuration')),
225
+ h('div', { className: 'card-body' },
226
+ h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 16 } }, 'Configure outbound email delivery. Leave blank to use the default AgenticMail relay.'),
227
+ h('div', { style: { display: 'grid', gridTemplateColumns: '2fr 1fr', gap: 16 } },
228
+ h('div', { className: 'form-group' },
229
+ h('label', { className: 'form-label' }, 'SMTP Host'),
230
+ h('input', { className: 'input', value: settings.smtpHost || '', onChange: e => setSettings(s => ({ ...s, smtpHost: e.target.value })), placeholder: 'smtp.gmail.com' })
231
+ ),
232
+ h('div', { className: 'form-group' },
233
+ h('label', { className: 'form-label' }, 'SMTP Port'),
234
+ h('input', { className: 'input', type: 'number', value: settings.smtpPort || '', onChange: e => setSettings(s => ({ ...s, smtpPort: e.target.value })), placeholder: '587' })
235
+ )
236
+ ),
237
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
238
+ h('div', { className: 'form-group' },
239
+ h('label', { className: 'form-label' }, 'SMTP Username'),
240
+ h('input', { className: 'input', value: settings.smtpUser || '', onChange: e => setSettings(s => ({ ...s, smtpUser: e.target.value })), placeholder: 'you@gmail.com' })
241
+ ),
242
+ h('div', { className: 'form-group' },
243
+ h('label', { className: 'form-label' }, 'SMTP Password'),
244
+ h('input', { className: 'input', type: 'password', value: settings.smtpPass || '', onChange: e => setSettings(s => ({ ...s, smtpPass: e.target.value })), placeholder: 'App password' })
245
+ )
246
+ ),
247
+ h('div', { className: 'form-group' },
248
+ h('label', { className: 'form-label' }, 'DKIM Private Key'),
249
+ h('textarea', { className: 'input', value: settings.dkimPrivateKey || '', onChange: e => setSettings(s => ({ ...s, dkimPrivateKey: e.target.value })), placeholder: '-----BEGIN RSA PRIVATE KEY-----', rows: 3, style: { fontFamily: 'var(--font-mono)', fontSize: 11 } }),
250
+ h('p', { className: 'form-help' }, 'Optional. Used for email authentication (DKIM signing).')
251
+ ),
252
+ h('button', { className: 'btn btn-primary', onClick: () => apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ smtpHost: settings.smtpHost || null, smtpPort: settings.smtpPort ? Number(settings.smtpPort) : null, smtpUser: settings.smtpUser || null, smtpPass: settings.smtpPass || null, dkimPrivateKey: settings.dkimPrivateKey || null }) }).then(d => { setSettings(d); toast('SMTP settings saved', 'success'); }).catch(e => toast(e.message, 'error')) }, 'Save SMTP Settings')
253
+ )
254
+ ),
255
+ h('div', { className: 'card', style: { marginTop: 16 } },
256
+ h('div', { className: 'card-header' }, h('h3', null, 'Info')),
257
+ h('div', { className: 'card-body' },
258
+ h('div', { style: { display: 'grid', gridTemplateColumns: '140px 1fr', gap: '6px 16px', fontSize: 13 } },
259
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Organization ID'), h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 12 } }, settings.id || '-'),
260
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Created'), h('span', null, settings.createdAt ? new Date(settings.createdAt).toLocaleString() : '-'),
261
+ h('span', { style: { color: 'var(--text-muted)' } }, 'Last Updated'), h('span', null, settings.updatedAt ? new Date(settings.updatedAt).toLocaleString() : '-')
262
+ )
263
+ )
264
+ )
265
+ ),
266
+
267
+ tab === 'api-keys' && h(Fragment, null,
268
+ newKeyPlaintext && h(Modal, { title: 'API Key Created', onClose: () => setNewKeyPlaintext(null) },
269
+ h('div', { style: { marginBottom: 16 } },
270
+ h('div', { style: { padding: 16, background: 'var(--warning-soft)', borderRadius: 'var(--radius)', fontSize: 13, color: 'var(--warning)', marginBottom: 16 } }, 'Copy this key now. It will not be shown again.'),
271
+ h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
272
+ h('input', { className: 'input', value: newKeyPlaintext, readOnly: true, style: { fontFamily: 'var(--font-mono)', fontSize: 12, flex: 1 }, onClick: e => e.target.select() }),
273
+ h('button', { className: 'btn ' + (keyCopied ? 'btn-secondary' : 'btn-primary'), onClick: copyKey }, keyCopied ? [I.check(), ' Copied'] : [I.copy(), ' Copy'])
274
+ )
275
+ ),
276
+ h('div', { style: { textAlign: 'right' } },
277
+ h('button', { className: 'btn btn-secondary', onClick: () => setNewKeyPlaintext(null) }, 'Done')
278
+ )
279
+ ),
280
+ h('div', { className: 'card', style: { marginBottom: 16 } },
281
+ h('div', { className: 'card-body' },
282
+ h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
283
+ h('input', { className: 'input', value: keyName, onChange: e => setKeyName(e.target.value), placeholder: 'Key name (e.g., production)', style: { maxWidth: 300 } }),
284
+ h('button', { className: 'btn btn-primary', onClick: createKey }, I.plus(), ' Create Key')
285
+ )
286
+ )
287
+ ),
288
+ h('div', { className: 'card' },
289
+ h('div', { className: 'card-body-flush' },
290
+ apiKeys.length === 0 ? h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } }, 'No API keys')
291
+ : h('table', null,
292
+ h('thead', null, h('tr', null, h('th', null, 'Name'), h('th', null, 'Key Prefix'), h('th', null, 'Scopes'), h('th', null, 'Created'), h('th', null, 'Actions'))),
293
+ h('tbody', null, apiKeys.map(k =>
294
+ h('tr', { key: k.id },
295
+ h('td', null, h('strong', null, k.name)),
296
+ h('td', null, h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 12 } }, (k.keyPrefix || '???') + '...')),
297
+ h('td', null, (k.scopes || []).map(s => h('span', { key: s, className: 'badge badge-neutral', style: { marginRight: 4 } }, s))),
298
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, k.createdAt ? new Date(k.createdAt).toLocaleDateString() : '-'),
299
+ h('td', null, h('button', { className: 'btn btn-danger btn-sm', onClick: () => revokeKey(k.id) }, 'Revoke'))
300
+ )
301
+ ))
302
+ )
303
+ )
304
+ )
305
+ ),
306
+
307
+ tab === 'authentication' && h('div', null,
308
+ h('div', { className: 'card', style: { marginBottom: 16 } },
309
+ h('div', { className: 'card-header' }, h('h3', null, 'Single Sign-On (SSO)')),
310
+ h('div', { className: 'card-body' },
311
+ h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 16 } }, 'Configure SAML 2.0 or OIDC to let team members sign in with their corporate identity provider.'),
312
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
313
+ h('div', { className: 'preset-card', style: { cursor: 'default' } },
314
+ h('h4', null, 'SAML 2.0'),
315
+ h('p', null, 'Works with Okta, OneLogin, Azure AD, and any SAML 2.0 IdP.'),
316
+ h('div', { className: 'form-group', style: { marginTop: 12 } },
317
+ h('label', { className: 'form-label' }, 'Entity ID / Issuer'),
318
+ h('input', { className: 'input', value: settings.samlEntityId || '', onChange: e => setSettings(s => ({ ...s, samlEntityId: e.target.value })), placeholder: 'https://your-idp.com/entity-id' })
319
+ ),
320
+ h('div', { className: 'form-group' },
321
+ h('label', { className: 'form-label' }, 'SSO URL'),
322
+ h('input', { className: 'input', value: settings.samlSsoUrl || '', onChange: e => setSettings(s => ({ ...s, samlSsoUrl: e.target.value })), placeholder: 'https://your-idp.com/sso' })
323
+ ),
324
+ h('div', { className: 'form-group' },
325
+ h('label', { className: 'form-label' }, 'Certificate (PEM)'),
326
+ h('textarea', { className: 'input', rows: 3, value: settings.samlCertificate || '', onChange: e => setSettings(s => ({ ...s, samlCertificate: e.target.value })), placeholder: '-----BEGIN CERTIFICATE-----' })
327
+ ),
328
+ h('div', { style: { display: 'flex', gap: 8 } },
329
+ h('button', { className: 'btn btn-primary btn-sm', onClick: saveSaml }, 'Save SAML Config'),
330
+ ssoConfig.saml && h('button', { className: 'btn btn-sm', style: { color: 'var(--danger)' }, onClick: () => removeSso('saml') }, 'Remove')
331
+ )
332
+ ),
333
+ h('div', { className: 'preset-card', style: { cursor: 'default' } },
334
+ h('h4', null, 'OpenID Connect (OIDC)'),
335
+ h('p', null, 'Works with Google Workspace, Microsoft Entra, Auth0, and any OIDC provider.'),
336
+ h('div', { className: 'form-group', style: { marginTop: 12 } },
337
+ h('label', { className: 'form-label' }, 'Client ID'),
338
+ h('input', { className: 'input', value: settings.oidcClientId || '', onChange: e => setSettings(s => ({ ...s, oidcClientId: e.target.value })), placeholder: 'your-client-id' })
339
+ ),
340
+ h('div', { className: 'form-group' },
341
+ h('label', { className: 'form-label' }, 'Client Secret'),
342
+ h('input', { className: 'input', type: 'password', value: settings.oidcClientSecret || '', onChange: e => setSettings(s => ({ ...s, oidcClientSecret: e.target.value })), placeholder: 'your-client-secret' })
343
+ ),
344
+ h('div', { className: 'form-group' },
345
+ h('label', { className: 'form-label' }, 'Discovery URL'),
346
+ h('input', { className: 'input', value: settings.oidcDiscoveryUrl || '', onChange: e => setSettings(s => ({ ...s, oidcDiscoveryUrl: e.target.value })), placeholder: 'https://accounts.google.com/.well-known/openid-configuration' })
347
+ ),
348
+ h('div', { style: { display: 'flex', gap: 8 } },
349
+ h('button', { className: 'btn btn-primary btn-sm', onClick: saveOidc }, 'Save OIDC Config'),
350
+ h('button', { className: 'btn btn-secondary btn-sm', onClick: testOidc }, 'Test Discovery'),
351
+ ssoConfig.oidc && h('button', { className: 'btn btn-sm', style: { color: 'var(--danger)' }, onClick: () => removeSso('oidc') }, 'Remove')
352
+ )
353
+ )
354
+ )
355
+ )
356
+ ),
357
+ h('div', { className: 'card' },
358
+ h('div', { className: 'card-header' }, h('h3', null, 'Quick Setup — OAuth Providers')),
359
+ h('div', { className: 'card-body' },
360
+ h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 16 } }, 'Click a provider to pre-fill the OIDC Discovery URL above. You still need to create an OAuth app in the provider\'s console and enter your Client ID and Secret.'),
361
+ h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 12 } },
362
+ [
363
+ { name: 'Google', desc: 'Google Workspace / Gmail', discovery: 'https://accounts.google.com/.well-known/openid-configuration', svg: h('svg', { viewBox: '0 0 24 24', width: 28, height: 28 }, h('path', { d: 'M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z', fill: '#4285F4' }), h('path', { d: 'M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z', fill: '#34A853' }), h('path', { d: 'M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 001 12c0 1.77.42 3.45 1.18 4.93l3.66-2.84z', fill: '#FBBC05' }), h('path', { d: 'M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z', fill: '#EA4335' })) },
364
+ { name: 'Microsoft', desc: 'Azure AD / Microsoft 365', discovery: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration', svg: h('svg', { viewBox: '0 0 24 24', width: 28, height: 28 }, h('rect', { x: 1, y: 1, width: 10.5, height: 10.5, fill: '#F25022' }), h('rect', { x: 12.5, y: 1, width: 10.5, height: 10.5, fill: '#7FBA00' }), h('rect', { x: 1, y: 12.5, width: 10.5, height: 10.5, fill: '#00A4EF' }), h('rect', { x: 12.5, y: 12.5, width: 10.5, height: 10.5, fill: '#FFB900' })) },
365
+ { name: 'GitHub', desc: 'GitHub OAuth (no OIDC discovery)', discovery: null, svg: h('svg', { viewBox: '0 0 24 24', width: 28, height: 28, fill: 'currentColor' }, h('path', { d: 'M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z' })) },
366
+ { name: 'Okta', desc: 'Okta / Auth0', discovery: 'https://your-org.okta.com/.well-known/openid-configuration', svg: h('svg', { viewBox: '0 0 24 24', width: 28, height: 28 }, h('circle', { cx: 12, cy: 12, r: 10, fill: 'none', stroke: '#007DC1', strokeWidth: 2.5 }), h('circle', { cx: 12, cy: 12, r: 4, fill: '#007DC1' })) },
367
+ { name: 'Slack', desc: 'Sign in with Slack', discovery: 'https://slack.com/.well-known/openid-configuration', svg: h('svg', { viewBox: '0 0 24 24', width: 28, height: 28 }, h('path', { d: 'M5.042 15.165a2.528 2.528 0 01-2.52 2.523A2.528 2.528 0 010 15.165a2.527 2.527 0 012.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 012.521-2.52 2.527 2.527 0 012.521 2.52v6.313A2.528 2.528 0 018.834 24a2.528 2.528 0 01-2.521-2.522v-6.313z', fill: '#E01E5A' }), h('path', { d: 'M8.834 5.042a2.528 2.528 0 01-2.521-2.52A2.528 2.528 0 018.834 0a2.528 2.528 0 012.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 012.521 2.521 2.528 2.528 0 01-2.521 2.521H2.522A2.528 2.528 0 010 8.834a2.528 2.528 0 012.522-2.521h6.312z', fill: '#36C5F0' }), h('path', { d: 'M18.956 8.834a2.528 2.528 0 012.522-2.521A2.528 2.528 0 0124 8.834a2.528 2.528 0 01-2.522 2.521h-2.522V8.834zm-1.27 0a2.528 2.528 0 01-2.523 2.521 2.527 2.527 0 01-2.52-2.521V2.522A2.527 2.527 0 0115.163 0a2.528 2.528 0 012.523 2.522v6.312z', fill: '#2EB67D' }), h('path', { d: 'M15.163 18.956a2.528 2.528 0 012.523 2.522A2.528 2.528 0 0115.163 24a2.527 2.527 0 01-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 01-2.52-2.523 2.527 2.527 0 012.52-2.52h6.315A2.528 2.528 0 0124 15.163a2.528 2.528 0 01-2.522 2.523h-6.315z', fill: '#ECB22E' })) },
368
+ { name: 'LDAP', desc: 'Active Directory / LDAP', discovery: null, disabled: true, svg: h('svg', { viewBox: '0 0 24 24', width: 28, height: 28, fill: 'none', stroke: 'currentColor', strokeWidth: 1.5 }, h('path', { d: 'M12 2L3 7v10l9 5 9-5V7l-9-5z' }), h('path', { d: 'M12 22V12' }), h('path', { d: 'M3 7l9 5 9-5' })) }
369
+ ].map(p =>
370
+ h('div', { key: p.name, style: { padding: 16, border: '1px solid var(--border)', borderRadius: 'var(--radius)', textAlign: 'center', opacity: p.disabled ? 0.5 : 1 } },
371
+ h('div', { style: { marginBottom: 8, display: 'flex', justifyContent: 'center' } }, p.svg),
372
+ h('div', { style: { fontWeight: 600, fontSize: 13, marginBottom: 4 } }, p.name),
373
+ h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 12 } }, p.desc),
374
+ h('button', { className: 'btn btn-secondary btn-sm', style: { width: '100%', justifyContent: 'center' }, disabled: p.disabled, onClick: p.discovery ? () => prefillOidc(p.name, p.discovery) : p.disabled ? undefined : () => toast('GitHub uses OAuth, not OIDC. Configure Client ID and Secret manually in the OIDC form above.', 'info') }, p.disabled ? 'Coming Soon' : 'Use ' + p.name)
375
+ )
376
+ )
377
+ )
378
+ )
379
+ )
380
+ ),
381
+
382
+ tab === 'email' && h('div', { className: 'card' },
383
+ h('div', { className: 'card-header' }, h('h3', null, 'Email & Domain Configuration')),
384
+ h('div', { className: 'card-body' },
385
+ h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 20 } }, 'Configure how agents send and receive email. Choose between a relay (Gmail/Outlook forwarding) or a custom domain with full DKIM/SPF/DMARC.'),
386
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
387
+ h('div', { className: 'preset-card', style: { cursor: 'default' } },
388
+ h('h4', null, 'Gmail / Outlook Relay'),
389
+ h('p', { style: { marginBottom: 12 } }, 'Easy setup. Agents send from yourname+agent@gmail.com. Best for getting started.'),
390
+ h('div', { className: 'form-group' },
391
+ h('label', { className: 'form-label' }, 'Email Address'),
392
+ h('input', { className: 'input', value: settings.relayEmail || '', onChange: e => setSettings(s => ({ ...s, relayEmail: e.target.value })), placeholder: 'you@gmail.com' })
393
+ ),
394
+ h('div', { className: 'form-group' },
395
+ h('label', { className: 'form-label' }, 'App Password'),
396
+ h('input', { className: 'input', type: 'password', value: settings.relayPassword || '', onChange: e => setSettings(s => ({ ...s, relayPassword: e.target.value })), placeholder: 'xxxx xxxx xxxx xxxx' }),
397
+ h('p', { className: 'form-help' }, h('a', { href: 'https://myaccount.google.com/apppasswords', target: '_blank' }, 'Get app password from Google'))
398
+ ),
399
+ h('button', { className: 'btn btn-primary btn-sm', onClick: () => apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ smtpHost: 'smtp.gmail.com', smtpPort: 587, smtpUser: settings.relayEmail || null, smtpPass: settings.relayPassword || null }) }).then(d => { setSettings(s => ({ ...s, ...d })); toast('Relay config saved', 'success'); }).catch(e => toast(e.message, 'error')) }, 'Save Relay Config')
400
+ ),
401
+ h('div', { className: 'preset-card', style: { cursor: 'default' } },
402
+ h('h4', null, 'Custom Domain'),
403
+ h('p', { style: { marginBottom: 12 } }, 'Professional setup. Agents send from agent@yourdomain.com with full email authentication.'),
404
+ h('div', { className: 'form-group' },
405
+ h('label', { className: 'form-label' }, 'Domain'),
406
+ h('input', { className: 'input', value: settings.emailDomain || '', onChange: e => setSettings(s => ({ ...s, emailDomain: e.target.value })), placeholder: 'yourdomain.com' })
407
+ ),
408
+ h('div', { className: 'form-group' },
409
+ h('label', { className: 'form-label' }, 'Cloudflare API Token'),
410
+ h('input', { className: 'input', type: 'password', value: settings.cfApiToken || '', onChange: e => setSettings(s => ({ ...s, cfApiToken: e.target.value })), placeholder: 'Your Cloudflare API token' })
411
+ ),
412
+ h('div', { className: 'form-group' },
413
+ h('label', { className: 'form-label' }, 'Cloudflare Account ID'),
414
+ h('input', { className: 'input', value: settings.cfAccountId || '', onChange: e => setSettings(s => ({ ...s, cfAccountId: e.target.value })), placeholder: 'Account ID' })
415
+ ),
416
+ h('button', { className: 'btn btn-primary btn-sm', onClick: () => apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ domain: settings.emailDomain || null, cfApiToken: settings.cfApiToken || null, cfAccountId: settings.cfAccountId || null }) }).then(d => { setSettings(s => ({ ...s, ...d })); toast('Domain config saved', 'success'); }).catch(e => toast(e.message, 'error')) }, 'Save Domain Config')
417
+ )
418
+ )
419
+ )
420
+ ),
421
+
422
+ tab === 'deployments' && h('div', null,
423
+ h('div', { className: 'card', style: { marginBottom: 16 } },
424
+ h('div', { className: 'card-header' },
425
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
426
+ h('h3', null, 'Deploy Credentials'),
427
+ h('button', { className: 'btn btn-primary btn-sm', onClick: () => { setDeployForm({ name: '', targetType: 'docker', config: {} }); setShowDeployModal(true); } }, I.plus(), ' Add Credential')
428
+ )
429
+ ),
430
+ h('div', { className: 'card-body-flush' },
431
+ deployCreds.length === 0 ? h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } }, 'No deploy credentials configured. Add one to enable agent deployment.')
432
+ : h('table', null,
433
+ h('thead', null, h('tr', null, h('th', null, 'Name'), h('th', null, 'Target'), h('th', null, 'Created'), h('th', null, 'Actions'))),
434
+ h('tbody', null, deployCreds.map(c =>
435
+ h('tr', { key: c.id },
436
+ h('td', null, h('strong', null, c.name)),
437
+ h('td', null, h('span', { className: 'badge badge-neutral' }, c.targetType)),
438
+ h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, c.createdAt ? new Date(c.createdAt).toLocaleDateString() : '-'),
439
+ h('td', null, h('button', { className: 'btn btn-danger btn-sm', onClick: () => deleteDeployCred(c.id) }, 'Delete'))
440
+ )
441
+ ))
442
+ )
443
+ )
444
+ ),
445
+ showDeployModal && h('div', { className: 'modal-overlay', onClick: e => { if (e.target === e.currentTarget) setShowDeployModal(false); } },
446
+ h('div', { className: 'modal', style: { maxWidth: 500 } },
447
+ h('div', { className: 'modal-header' },
448
+ h('h3', null, 'Add Deploy Credential'),
449
+ h('button', { className: 'modal-close', onClick: () => setShowDeployModal(false) }, '\u00D7')
450
+ ),
451
+ h('div', { className: 'modal-body' },
452
+ h('div', { className: 'form-group' },
453
+ h('label', { className: 'form-label' }, 'Name'),
454
+ h('input', { className: 'input', value: deployForm.name, onChange: e => setDeployForm(f => ({ ...f, name: e.target.value })), placeholder: 'e.g., Production Docker Registry' })
455
+ ),
456
+ h('div', { className: 'form-group' },
457
+ h('label', { className: 'form-label' }, 'Target Type'),
458
+ h('select', { className: 'input', value: deployForm.targetType, onChange: e => setDeployForm(f => ({ ...f, targetType: e.target.value, config: {} })) },
459
+ h('option', { value: 'docker' }, 'Docker Registry'),
460
+ h('option', { value: 'ssh' }, 'SSH / VPS'),
461
+ h('option', { value: 'fly' }, 'Fly.io'),
462
+ h('option', { value: 'railway' }, 'Railway'),
463
+ h('option', { value: 'vps' }, 'VPS (Generic)')
464
+ )
465
+ ),
466
+ deployForm.targetType === 'docker' && h(Fragment, null,
467
+ h('div', { className: 'form-group' },
468
+ h('label', { className: 'form-label' }, 'Registry URL'),
469
+ h('input', { className: 'input', value: deployForm.config.registryUrl || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, registryUrl: e.target.value } })), placeholder: 'registry.example.com' })
470
+ ),
471
+ h('div', { className: 'form-group' },
472
+ h('label', { className: 'form-label' }, 'Username'),
473
+ h('input', { className: 'input', value: deployForm.config.username || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, username: e.target.value } })) })
474
+ ),
475
+ h('div', { className: 'form-group' },
476
+ h('label', { className: 'form-label' }, 'Password / Token'),
477
+ h('input', { className: 'input', type: 'password', value: deployForm.config.password || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, password: e.target.value } })) })
478
+ )
479
+ ),
480
+ (deployForm.targetType === 'ssh' || deployForm.targetType === 'vps') && h(Fragment, null,
481
+ h('div', { className: 'form-group' },
482
+ h('label', { className: 'form-label' }, 'Host'),
483
+ h('input', { className: 'input', value: deployForm.config.host || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, host: e.target.value } })), placeholder: '192.168.1.100' })
484
+ ),
485
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
486
+ h('div', { className: 'form-group' },
487
+ h('label', { className: 'form-label' }, 'Port'),
488
+ h('input', { className: 'input', type: 'number', value: deployForm.config.port || 22, onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, port: parseInt(e.target.value) || 22 } })) })
489
+ ),
490
+ h('div', { className: 'form-group' },
491
+ h('label', { className: 'form-label' }, 'Username'),
492
+ h('input', { className: 'input', value: deployForm.config.username || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, username: e.target.value } })), placeholder: 'root' })
493
+ )
494
+ ),
495
+ h('div', { className: 'form-group' },
496
+ h('label', { className: 'form-label' }, 'SSH Private Key'),
497
+ h('textarea', { className: 'input', rows: 4, value: deployForm.config.sshKey || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, sshKey: e.target.value } })), placeholder: '-----BEGIN OPENSSH PRIVATE KEY-----' })
498
+ )
499
+ ),
500
+ deployForm.targetType === 'fly' && h('div', { className: 'form-group' },
501
+ h('label', { className: 'form-label' }, 'Fly.io API Token'),
502
+ h('input', { className: 'input', type: 'password', value: deployForm.config.apiToken || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, apiToken: e.target.value } })), placeholder: 'FlyV1 ...' })
503
+ ),
504
+ deployForm.targetType === 'railway' && h(Fragment, null,
505
+ h('div', { className: 'form-group' },
506
+ h('label', { className: 'form-label' }, 'Railway API Token'),
507
+ h('input', { className: 'input', type: 'password', value: deployForm.config.apiToken || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, apiToken: e.target.value } })), placeholder: 'Railway token' })
508
+ ),
509
+ h('div', { className: 'form-group' },
510
+ h('label', { className: 'form-label' }, 'Project ID'),
511
+ h('input', { className: 'input', value: deployForm.config.projectId || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, projectId: e.target.value } })) })
512
+ )
513
+ )
514
+ ),
515
+ h('div', { className: 'modal-footer' },
516
+ h('button', { className: 'btn btn-secondary', onClick: () => setShowDeployModal(false) }, 'Cancel'),
517
+ h('button', { className: 'btn btn-primary', onClick: createDeployCred, disabled: !deployForm.name }, 'Create Credential')
518
+ )
519
+ )
520
+ )
521
+ ),
522
+
523
+ tab === 'security' && h(ToolSecurityTab, { toolSec: toolSec, setToolSec: function(v) { setToolSec(v); setToolSecDirty(true); }, saving: toolSecSaving, dirty: toolSecDirty, onSave: function() {
524
+ setToolSecSaving(true);
525
+ apiCall('/settings/tool-security', { method: 'PUT', body: JSON.stringify(toolSec) })
526
+ .then(function(d) { setToolSec({ security: (d.toolSecurityConfig || {}).security || toolSec.security, middleware: (d.toolSecurityConfig || {}).middleware || toolSec.middleware }); setToolSecDirty(false); toast('Tool security settings saved', 'success'); })
527
+ .catch(function(e) { toast(e.message, 'error'); })
528
+ .finally(function() { setToolSecSaving(false); });
529
+ } }),
530
+
531
+ tab === 'network' && h(NetworkFirewallTab, { fw: fw, setFw: function(v) { setFw(v); setFwDirty(true); }, saving: fwSaving, dirty: fwDirty, testIp: fwTestIp, setTestIp: setFwTestIp, testResult: fwTestResult, setTestResult: setFwTestResult, onSave: function() {
532
+ setFwSaving(true);
533
+ apiCall('/settings/firewall', { method: 'PUT', body: JSON.stringify(fw) })
534
+ .then(function(d) { setFw(d.firewallConfig || fw); setFwDirty(false); toast('Network & firewall settings saved', 'success'); })
535
+ .catch(function(e) { toast(e.message, 'error'); })
536
+ .finally(function() { setFwSaving(false); });
537
+ }, onTestIp: function() {
538
+ if (!fwTestIp.trim()) return;
539
+ apiCall('/settings/firewall/test-ip', { method: 'POST', body: JSON.stringify({ ip: fwTestIp.trim() }) })
540
+ .then(function(d) { setFwTestResult(d); })
541
+ .catch(function(e) { setFwTestResult({ error: e.message }); });
542
+ } }),
543
+
544
+ tab === 'pricing' && h(ModelPricingTab, {
545
+ pricing: pricing,
546
+ setPricing: function(v) { setPricing(v); setPricingDirty(true); },
547
+ saving: pricingSaving,
548
+ dirty: pricingDirty,
549
+ showAddModel: showAddModel,
550
+ setShowAddModel: setShowAddModel,
551
+ newModel: newModel,
552
+ setNewModel: setNewModel,
553
+ providers: providers,
554
+ setProviders: setProviders,
555
+ showAddProvider: showAddProvider,
556
+ setShowAddProvider: setShowAddProvider,
557
+ newProvider: newProvider,
558
+ setNewProvider: setNewProvider,
559
+ discoverResults: discoverResults,
560
+ setDiscoverResults: setDiscoverResults,
561
+ onSave: function() {
562
+ setPricingSaving(true);
563
+ apiCall('/settings/model-pricing', { method: 'PUT', body: JSON.stringify(pricing) }).then(function(d) {
564
+ setPricing(d.modelPricingConfig || pricing);
565
+ setPricingDirty(false);
566
+ toast('Model pricing saved');
567
+ }).catch(function(e) { toast(e.message, 'error'); }).finally(function() { setPricingSaving(false); });
568
+ },
569
+ onAddModel: function() {
570
+ if (!newModel.modelId || !newModel.provider) { toast('Provider and Model ID are required', 'error'); return; }
571
+ var updated = { ...pricing, models: [...(pricing.models || []), { ...newModel }] };
572
+ setPricing(updated);
573
+ setPricingDirty(true);
574
+ setShowAddModel(false);
575
+ setNewModel({ provider: 'anthropic', modelId: '', displayName: '', inputCostPerMillion: 0, outputCostPerMillion: 0, contextWindow: 0 });
576
+ },
577
+ onRemoveModel: function(idx) {
578
+ var models = [...(pricing.models || [])];
579
+ models.splice(idx, 1);
580
+ setPricing({ ...pricing, models: models });
581
+ setPricingDirty(true);
582
+ },
583
+ onUpdateModel: function(idx, field, value) {
584
+ var models = [...(pricing.models || [])];
585
+ models[idx] = { ...models[idx], [field]: value };
586
+ setPricing({ ...pricing, models: models });
587
+ setPricingDirty(true);
588
+ },
589
+ toast: toast,
590
+ }),
591
+
592
+ tab === 'integrations' && h(IntegrationsTab, { toast: toast })
593
+ );
594
+ }
595
+
596
+ // ═══════════════════════════════════════════════════════════
597
+ // INTEGRATIONS TAB
598
+ // ═══════════════════════════════════════════════════════════
599
+
600
+ var INTEGRATIONS = [
601
+ { skillId: 'slack-notifications', name: 'Slack', desc: 'Send and receive messages in Slack workspaces', authType: 'oauth', provider: 'slack' },
602
+ { skillId: 'github-repos', name: 'GitHub', desc: 'PR reviews, issue management, CI/CD automation', authType: 'oauth', provider: 'github' },
603
+ { skillId: 'discord-communication', name: 'Discord', desc: 'Bot integration for Discord servers', authType: 'token', tokenLabel: 'Bot Token' },
604
+ { skillId: 'microsoft-teams', name: 'Microsoft Teams', desc: 'Chat and collaboration via Microsoft 365', authType: 'oauth', provider: 'microsoft' },
605
+ { skillId: 'jira-project-management', name: 'Jira', desc: 'Issue tracking and project management', authType: 'oauth', provider: 'atlassian' },
606
+ { skillId: 'notion', name: 'Notion', desc: 'Knowledge base and documentation', authType: 'oauth', provider: 'notion' },
607
+ { skillId: 'salesforce-crm', name: 'Salesforce', desc: 'CRM integration for sales and support agents', authType: 'oauth', provider: 'salesforce' },
608
+ { skillId: 'google-drive', name: 'Google Drive', desc: 'File storage and document collaboration', authType: 'oauth', provider: 'google' },
609
+ { skillId: 'hubspot-crm', name: 'HubSpot', desc: 'Marketing, sales, and CRM platform', authType: 'oauth', provider: 'hubspot' },
610
+ { skillId: 'zoom-meetings', name: 'Zoom', desc: 'Video meetings and webinars', authType: 'oauth', provider: 'zoom' },
611
+ { skillId: 'dropbox-storage', name: 'Dropbox', desc: 'Cloud file storage and sharing', authType: 'oauth', provider: 'dropbox' },
612
+ { skillId: 'figma-design', name: 'Figma', desc: 'Collaborative design and prototyping', authType: 'oauth', provider: 'figma' },
613
+ { skillId: 'linear-issues', name: 'Linear', desc: 'Issue tracking for engineering teams', authType: 'token', tokenLabel: 'API Key' },
614
+ { skillId: 'asana-tasks', name: 'Asana', desc: 'Task and project management', authType: 'oauth', provider: 'asana' },
615
+ { skillId: 'confluence-wiki', name: 'Confluence', desc: 'Team wiki and documentation', authType: 'oauth', provider: 'atlassian' },
616
+ { skillId: 'airtable-databases', name: 'Airtable', desc: 'Spreadsheet-database for structured data', authType: 'token', tokenLabel: 'API Key' },
617
+ ];
618
+
619
+ function IntegrationsTab(props) {
620
+ var toast = props.toast;
621
+ var _statuses = useState({});
622
+ var statuses = _statuses[0]; var setStatuses = _statuses[1];
623
+ var _loading = useState(true);
624
+ var loading = _loading[0]; var setLoading = _loading[1];
625
+ var _tokenModal = useState(null);
626
+ var tokenModal = _tokenModal[0]; var setTokenModal = _tokenModal[1];
627
+ var _tokenValue = useState('');
628
+ var tokenValue = _tokenValue[0]; var setTokenValue = _tokenValue[1];
629
+ var _actionLoading = useState(null);
630
+ var actionLoading = _actionLoading[0]; var setActionLoading = _actionLoading[1];
631
+
632
+ var loadStatuses = useCallback(function() {
633
+ var promises = INTEGRATIONS.map(function(int) {
634
+ return engineCall('/oauth/status/' + int.skillId + '?orgId=default')
635
+ .then(function(d) { return { skillId: int.skillId, connected: d.connected, expiresAt: d.expiresAt }; })
636
+ .catch(function() { return { skillId: int.skillId, connected: false }; });
637
+ });
638
+ Promise.all(promises).then(function(results) {
639
+ var map = {};
640
+ results.forEach(function(r) { map[r.skillId] = r; });
641
+ setStatuses(map);
642
+ setLoading(false);
643
+ });
644
+ }, []);
645
+
646
+ useEffect(function() { loadStatuses(); }, [loadStatuses]);
647
+
648
+ var handleConnect = function(int) {
649
+ if (int.authType === 'token') {
650
+ setTokenModal(int);
651
+ setTokenValue('');
652
+ return;
653
+ }
654
+ setActionLoading(int.skillId);
655
+ engineCall('/oauth/authorize/' + int.skillId + '?orgId=default')
656
+ .then(function(d) {
657
+ if (d.authorizationUrl) {
658
+ var popup = window.open(d.authorizationUrl, 'oauth_connect', 'width=600,height=700,popup=yes');
659
+ var checkInterval = setInterval(function() {
660
+ if (popup && popup.closed) {
661
+ clearInterval(checkInterval);
662
+ setActionLoading(null);
663
+ loadStatuses();
664
+ }
665
+ }, 500);
666
+ setTimeout(function() { clearInterval(checkInterval); setActionLoading(null); }, 120000);
667
+ } else {
668
+ setActionLoading(null);
669
+ toast('OAuth flow could not be started', 'error');
670
+ }
671
+ })
672
+ .catch(function(e) {
673
+ setActionLoading(null);
674
+ toast('Connection failed: ' + e.message, 'error');
675
+ });
676
+ };
677
+
678
+ var handleDisconnect = function(int) {
679
+ showConfirm({ title: 'Disconnect ' + int.name, message: 'This will remove stored credentials for ' + int.name + '. Agents using this integration will lose access.', danger: true, confirmText: 'Disconnect' })
680
+ .then(function(ok) {
681
+ if (!ok) return;
682
+ setActionLoading(int.skillId);
683
+ engineCall('/oauth/disconnect/' + int.skillId + '?orgId=default', { method: 'DELETE' })
684
+ .then(function() { toast(int.name + ' disconnected', 'success'); loadStatuses(); })
685
+ .catch(function(e) { toast('Failed: ' + e.message, 'error'); })
686
+ .finally(function() { setActionLoading(null); });
687
+ });
688
+ };
689
+
690
+ var handleSaveToken = function() {
691
+ if (!tokenModal || !tokenValue.trim()) return;
692
+ setActionLoading(tokenModal.skillId);
693
+ engineCall('/oauth/authorize/' + tokenModal.skillId + '?orgId=default', {
694
+ method: 'POST',
695
+ body: JSON.stringify({ token: tokenValue.trim() })
696
+ })
697
+ .then(function() { toast(tokenModal.name + ' connected', 'success'); setTokenModal(null); loadStatuses(); })
698
+ .catch(function(e) { toast('Failed: ' + e.message, 'error'); })
699
+ .finally(function() { setActionLoading(null); });
700
+ };
701
+
702
+ return h('div', null,
703
+ h('div', { className: 'card' },
704
+ h('div', { className: 'card-header' }, h('h3', { style: { display: 'inline-flex', alignItems: 'center' } }, 'Integrations', h(HelpButton, { label: SETTINGS_HELP.integrations.label }, SETTINGS_HELP.integrations.content()))),
705
+ h('div', { className: 'card-body' },
706
+ h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 20 } }, 'Connect external services to extend agent capabilities. OAuth integrations open a popup for authorization. Token-based integrations require you to paste an API key or bot token.'),
707
+ loading
708
+ ? h('div', { style: { textAlign: 'center', padding: 40, color: 'var(--text-muted)' } }, 'Loading integrations...')
709
+ : h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))', gap: 12 } },
710
+ INTEGRATIONS.map(function(int) {
711
+ var status = statuses[int.skillId] || {};
712
+ var connected = status.connected === true;
713
+ var isLoading = actionLoading === int.skillId;
714
+ return h('div', { key: int.skillId, style: {
715
+ padding: 16, border: '1px solid ' + (connected ? 'var(--brand-color, #6366f1)' : 'var(--border)'),
716
+ borderRadius: 'var(--radius)', background: connected ? 'var(--bg-secondary)' : 'transparent',
717
+ opacity: isLoading ? 0.6 : 1, transition: 'border-color 0.2s, background 0.2s'
718
+ } },
719
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 } },
720
+ h('strong', { style: { fontSize: 14 } }, int.name),
721
+ h('span', { className: 'badge badge-' + (connected ? 'success' : 'neutral') }, connected ? 'Connected' : (int.authType === 'oauth' ? 'OAuth' : 'Token'))
722
+ ),
723
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 12, minHeight: 32 } }, int.desc),
724
+ connected
725
+ ? h('button', {
726
+ className: 'btn btn-secondary btn-sm',
727
+ disabled: isLoading,
728
+ onClick: function() { handleDisconnect(int); }
729
+ }, isLoading ? 'Disconnecting...' : 'Disconnect')
730
+ : h('button', {
731
+ className: 'btn btn-primary btn-sm',
732
+ disabled: isLoading,
733
+ onClick: function() { handleConnect(int); }
734
+ }, isLoading ? 'Connecting...' : 'Connect')
735
+ );
736
+ })
737
+ )
738
+ )
739
+ ),
740
+
741
+ tokenModal && h(Modal, { title: 'Connect ' + tokenModal.name, onClose: function() { setTokenModal(null); } },
742
+ h('div', { style: { padding: 20 } },
743
+ h('p', { style: { fontSize: 13, color: 'var(--text-secondary)', marginBottom: 16 } },
744
+ 'Enter your ', h('strong', null, tokenModal.tokenLabel || 'API Token'), ' for ', tokenModal.name, '. This will be stored securely in the vault.'
745
+ ),
746
+ h('div', { className: 'form-group' },
747
+ h('label', null, tokenModal.tokenLabel || 'API Token'),
748
+ h('input', {
749
+ className: 'input', type: 'password',
750
+ value: tokenValue,
751
+ onChange: function(e) { setTokenValue(e.target.value); },
752
+ placeholder: 'Paste your token here...',
753
+ autoFocus: true
754
+ })
755
+ ),
756
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 16 } },
757
+ h('button', { className: 'btn btn-secondary', onClick: function() { setTokenModal(null); } }, 'Cancel'),
758
+ h('button', {
759
+ className: 'btn btn-primary',
760
+ disabled: !tokenValue.trim() || actionLoading === tokenModal.skillId,
761
+ onClick: handleSaveToken
762
+ }, actionLoading === tokenModal.skillId ? 'Saving...' : 'Save & Connect')
763
+ )
764
+ )
765
+ )
766
+ );
767
+ }
768
+
769
+ // ═══════════════════════════════════════════════════════════
770
+ // TOOL SECURITY TAB
771
+ // ═══════════════════════════════════════════════════════════
772
+
773
+ var _cardStyle = { border: '1px solid var(--border)', borderRadius: 'var(--radius)', padding: 20, marginBottom: 16 };
774
+ var _cardTitleStyle = { fontSize: 15, fontWeight: 600, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 8 };
775
+ var _cardDescStyle = { fontSize: 12, color: 'var(--text-muted)', marginBottom: 16 };
776
+ var _toggleRowStyle = { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 };
777
+ var _gridStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 };
778
+ var _sectionTitleStyle = { fontSize: 14, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 12, marginTop: 8 };
779
+
780
+ function ToggleSwitch(props) {
781
+ var checked = props.checked;
782
+ var onChange = props.onChange;
783
+ var label = props.label;
784
+ return h('div', { style: _toggleRowStyle },
785
+ h('span', { style: { fontSize: 13, fontWeight: 500 } }, label),
786
+ h('label', { style: { position: 'relative', display: 'inline-block', width: 40, height: 22, cursor: 'pointer' } },
787
+ h('input', { type: 'checkbox', checked: checked, onChange: function(e) { onChange(e.target.checked); }, style: { opacity: 0, width: 0, height: 0 } }),
788
+ h('span', { style: {
789
+ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,
790
+ background: checked ? 'var(--brand-color, #6366f1)' : 'var(--bg-tertiary, #374151)',
791
+ borderRadius: 11, transition: 'background 0.2s'
792
+ } },
793
+ h('span', { style: {
794
+ position: 'absolute', top: 2, left: checked ? 20 : 2, width: 18, height: 18,
795
+ background: '#fff', borderRadius: '50%', transition: 'left 0.2s', boxShadow: '0 1px 3px rgba(0,0,0,0.2)'
796
+ } })
797
+ )
798
+ )
799
+ );
800
+ }
801
+
802
+ function RateLimitEditor(props) {
803
+ var overrides = props.overrides || {};
804
+ var onChange = props.onChange;
805
+ 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 } };
806
+ var tools = Object.keys(DEFAULT_LIMITS);
807
+
808
+ var setOverride = function(tool, field, value) {
809
+ var current = overrides[tool] || { maxTokens: DEFAULT_LIMITS[tool].max, refillRate: DEFAULT_LIMITS[tool].rate };
810
+ var next = Object.assign({}, overrides);
811
+ next[tool] = Object.assign({}, current);
812
+ next[tool][field] = parseInt(value) || 0;
813
+ onChange(next);
814
+ };
815
+
816
+ return h('div', { style: { fontSize: 12 } },
817
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 80px 80px', gap: 4, marginBottom: 4 } },
818
+ h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)' } }, 'Tool'),
819
+ h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)', textAlign: 'center' } }, 'Max/min'),
820
+ h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)', textAlign: 'center' } }, 'Refill/min')
821
+ ),
822
+ tools.map(function(tool) {
823
+ var def = DEFAULT_LIMITS[tool];
824
+ var ov = overrides[tool];
825
+ return h('div', { key: tool, style: { display: 'grid', gridTemplateColumns: '1fr 80px 80px', gap: 4, marginBottom: 2 } },
826
+ h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 11, padding: '4px 0' } }, tool),
827
+ 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); } }),
828
+ 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); } })
829
+ );
830
+ })
831
+ );
832
+ }
833
+
834
+ function ToolSecurityTab(props) {
835
+ var toolSec = props.toolSec;
836
+ var setToolSec = props.setToolSec;
837
+ var saving = props.saving;
838
+ var dirty = props.dirty;
839
+
840
+ var sec = toolSec.security || {};
841
+ var mw = toolSec.middleware || {};
842
+
843
+ var setSec = function(key, value) {
844
+ var next = Object.assign({}, sec);
845
+ next[key] = value;
846
+ setToolSec({ security: next, middleware: mw });
847
+ };
848
+
849
+ var setMw = function(key, value) {
850
+ var next = Object.assign({}, mw);
851
+ next[key] = value;
852
+ setToolSec({ security: sec, middleware: next });
853
+ };
854
+
855
+ var patchSec = function(section, field, value) {
856
+ var current = sec[section] || {};
857
+ var next = Object.assign({}, current);
858
+ next[field] = value;
859
+ setSec(section, next);
860
+ };
861
+
862
+ var patchMw = function(section, field, value) {
863
+ var current = mw[section] || {};
864
+ var next = Object.assign({}, current);
865
+ next[field] = value;
866
+ setMw(section, next);
867
+ };
868
+
869
+ var ps = sec.pathSandbox || {};
870
+ var ssrf = sec.ssrf || {};
871
+ var cs = sec.commandSanitizer || {};
872
+ var audit = mw.audit || {};
873
+ var rl = mw.rateLimit || {};
874
+ var cb = mw.circuitBreaker || {};
875
+ var tel = mw.telemetry || {};
876
+
877
+ return h(Fragment, null,
878
+ // Header
879
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
880
+ h('div', null,
881
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 0 } },
882
+ h('h3', { style: { margin: 0, fontSize: 18, fontWeight: 600 } }, 'Agent Tool Security'),
883
+ h(HelpButton, { label: SETTINGS_HELP.security.label }, SETTINGS_HELP.security.content())
884
+ ),
885
+ h('p', { style: { margin: '4px 0 0', fontSize: 13, color: 'var(--text-muted)' } }, 'Organization-wide defaults for all agent tools. Individual agents can override these settings.')
886
+ ),
887
+ h('button', {
888
+ className: 'btn btn-primary',
889
+ disabled: saving || !dirty,
890
+ onClick: props.onSave
891
+ }, saving ? 'Saving...' : 'Save Settings')
892
+ ),
893
+
894
+ // ── SECURITY SECTION ──
895
+ h('div', { style: _sectionTitleStyle }, 'Security Sandboxes'),
896
+ h('div', { style: _gridStyle },
897
+
898
+ // Path Sandbox
899
+ h('div', { style: _cardStyle },
900
+ h('div', { style: _cardTitleStyle }, I.folder(), ' Path Sandbox'),
901
+ h('div', { style: _cardDescStyle }, 'Controls which directories agents can read/write. Blocks path traversal and sensitive files.'),
902
+ h(ToggleSwitch, { label: 'Enable path sandboxing', checked: ps.enabled !== false, onChange: function(v) { patchSec('pathSandbox', 'enabled', v); } }),
903
+ h(TagInput, { label: 'Additional Allowed Directories', value: ps.allowedDirs || [], onChange: function(v) { patchSec('pathSandbox', 'allowedDirs', v); }, placeholder: '/path/to/allow', mono: true }),
904
+ h(TagInput, { label: 'Blocked File Patterns (regex)', value: ps.blockedPatterns || [], onChange: function(v) { patchSec('pathSandbox', 'blockedPatterns', v); }, placeholder: '\\.env$', mono: true })
905
+ ),
906
+
907
+ // SSRF Guard
908
+ h('div', { style: _cardStyle },
909
+ h('div', { style: _cardTitleStyle }, I.globe(), ' SSRF Protection'),
910
+ h('div', { style: _cardDescStyle }, 'Blocks agents from accessing internal networks, cloud metadata endpoints, and private IPs.'),
911
+ h(ToggleSwitch, { label: 'Enable SSRF protection', checked: ssrf.enabled !== false, onChange: function(v) { patchSec('ssrf', 'enabled', v); } }),
912
+ h(TagInput, { label: 'Allowed Hosts (bypass SSRF check)', value: ssrf.allowedHosts || [], onChange: function(v) { patchSec('ssrf', 'allowedHosts', v); }, placeholder: 'api.example.com', mono: true }),
913
+ h(TagInput, { label: 'Additional Blocked CIDRs', value: ssrf.blockedCidrs || [], onChange: function(v) { patchSec('ssrf', 'blockedCidrs', v); }, placeholder: '10.0.0.0/8', mono: true })
914
+ )
915
+ ),
916
+
917
+ // Command Sanitizer (full width)
918
+ h('div', { style: _cardStyle },
919
+ h('div', { style: _cardTitleStyle }, I.terminal(), ' Command Sanitizer'),
920
+ h('div', { style: _cardDescStyle }, 'Controls which shell commands agents can execute. Blocks dangerous patterns like rm -rf /, fork bombs, and shell injection.'),
921
+ h(ToggleSwitch, { label: 'Enable command validation', checked: cs.enabled !== false, onChange: function(v) { patchSec('commandSanitizer', 'enabled', v); } }),
922
+ h('div', { style: { marginBottom: 12 } },
923
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
924
+ h('select', { className: 'input', style: { width: 200 }, value: cs.mode || 'blocklist', onChange: function(e) { patchSec('commandSanitizer', 'mode', e.target.value); } },
925
+ h('option', { value: 'blocklist' }, 'Blocklist (block specific patterns)'),
926
+ h('option', { value: 'allowlist' }, 'Allowlist (only allow specific commands)')
927
+ )
928
+ ),
929
+ h('div', { style: _gridStyle },
930
+ h(TagInput, { label: 'Allowed Commands (allowlist mode)', value: cs.allowedCommands || [], onChange: function(v) { patchSec('commandSanitizer', 'allowedCommands', v); }, placeholder: 'git, npm, node', mono: true }),
931
+ h(TagInput, { label: 'Additional Blocked Patterns', value: cs.blockedPatterns || [], onChange: function(v) { patchSec('commandSanitizer', 'blockedPatterns', v); }, placeholder: 'curl.*\\|.*sh', mono: true })
932
+ )
933
+ ),
934
+
935
+ // ── MIDDLEWARE SECTION ──
936
+ h('div', { style: _sectionTitleStyle }, 'Middleware & Observability'),
937
+ h('div', { style: _gridStyle },
938
+
939
+ // Audit Logging
940
+ h('div', { style: _cardStyle },
941
+ h('div', { style: _cardTitleStyle }, I.journal(), ' Audit Logging'),
942
+ h('div', { style: _cardDescStyle }, 'Logs every tool invocation with agent ID, parameters (redacted), timing, and success/failure status.'),
943
+ h(ToggleSwitch, { label: 'Enable audit logging', checked: audit.enabled !== false, onChange: function(v) { patchMw('audit', 'enabled', v); } }),
944
+ h(TagInput, { label: 'Additional Keys to Redact', value: audit.redactKeys || [], onChange: function(v) { patchMw('audit', 'redactKeys', v); }, placeholder: 'custom_secret', mono: true })
945
+ ),
946
+
947
+ // Rate Limiting
948
+ h('div', { style: _cardStyle },
949
+ h('div', { style: _cardTitleStyle }, I.clock(), ' Rate Limiting'),
950
+ h('div', { style: _cardDescStyle }, 'Per-agent, per-tool rate limits using token bucket algorithm. Prevents runaway agents from overwhelming resources.'),
951
+ h(ToggleSwitch, { label: 'Enable rate limiting', checked: rl.enabled !== false, onChange: function(v) { patchMw('rateLimit', 'enabled', v); } }),
952
+ h(RateLimitEditor, { overrides: rl.overrides || {}, onChange: function(v) { patchMw('rateLimit', 'overrides', v); } })
953
+ ),
954
+
955
+ // Circuit Breaker
956
+ h('div', { style: _cardStyle },
957
+ h('div', { style: _cardTitleStyle }, I.pause(), ' Circuit Breaker'),
958
+ h('div', { style: _cardDescStyle }, 'Automatically stops calling failing tools after 5 consecutive failures. Opens for 30 seconds then retries. Applies to web and browser tools.'),
959
+ h(ToggleSwitch, { label: 'Enable circuit breaker', checked: cb.enabled !== false, onChange: function(v) { patchMw('circuitBreaker', 'enabled', v); } })
960
+ ),
961
+
962
+ // Telemetry
963
+ h('div', { style: _cardStyle },
964
+ h('div', { style: _cardTitleStyle }, I.chart(), ' Telemetry'),
965
+ h('div', { style: _cardDescStyle }, 'Collects execution timing, success/failure counters, and output size metrics for all tool invocations.'),
966
+ h(ToggleSwitch, { label: 'Enable telemetry collection', checked: tel.enabled !== false, onChange: function(v) { patchMw('telemetry', 'enabled', v); } })
967
+ )
968
+ ),
969
+
970
+ // Bottom save bar
971
+ 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 } },
972
+ h('button', { className: 'btn btn-primary', disabled: saving, onClick: props.onSave }, saving ? 'Saving...' : 'Save Tool Security Settings')
973
+ )
974
+ );
975
+ }
976
+
977
+ // ═══════════════════════════════════════════════════════════
978
+ // NETWORK & FIREWALL TAB
979
+ // ═══════════════════════════════════════════════════════════
980
+
981
+ function NetworkFirewallTab(props) {
982
+ var fw = props.fw || {};
983
+ var setFw = props.setFw;
984
+ var saving = props.saving;
985
+ var dirty = props.dirty;
986
+
987
+ var ipAccess = fw.ipAccess || {};
988
+ var egress = fw.egress || {};
989
+ var proxy = fw.proxy || {};
990
+ var tp = fw.trustedProxies || {};
991
+ var net = fw.network || {};
992
+ var rl = net.rateLimit || {};
993
+ var https = net.httpsEnforcement || {};
994
+ var sh = net.securityHeaders || {};
995
+
996
+ var patchFw = function(section, value) {
997
+ var next = Object.assign({}, fw);
998
+ next[section] = value;
999
+ setFw(next);
1000
+ };
1001
+
1002
+ var patchIp = function(field, value) {
1003
+ var next = Object.assign({}, ipAccess);
1004
+ next[field] = value;
1005
+ patchFw('ipAccess', next);
1006
+ };
1007
+
1008
+ var patchEgress = function(field, value) {
1009
+ var next = Object.assign({}, egress);
1010
+ next[field] = value;
1011
+ patchFw('egress', next);
1012
+ };
1013
+
1014
+ var patchProxy = function(field, value) {
1015
+ var next = Object.assign({}, proxy);
1016
+ next[field] = value;
1017
+ patchFw('proxy', next);
1018
+ };
1019
+
1020
+ var patchTp = function(field, value) {
1021
+ var next = Object.assign({}, tp);
1022
+ next[field] = value;
1023
+ patchFw('trustedProxies', next);
1024
+ };
1025
+
1026
+ var patchNet = function(field, value) {
1027
+ var next = Object.assign({}, net);
1028
+ next[field] = value;
1029
+ patchFw('network', next);
1030
+ };
1031
+
1032
+ var patchRl = function(field, value) {
1033
+ var next = Object.assign({}, rl);
1034
+ next[field] = value;
1035
+ patchNet('rateLimit', next);
1036
+ };
1037
+
1038
+ var patchHttps = function(field, value) {
1039
+ var next = Object.assign({}, https);
1040
+ next[field] = value;
1041
+ patchNet('httpsEnforcement', next);
1042
+ };
1043
+
1044
+ var patchSh = function(field, value) {
1045
+ var next = Object.assign({}, sh);
1046
+ next[field] = value;
1047
+ patchNet('securityHeaders', next);
1048
+ };
1049
+
1050
+ return h(Fragment, null,
1051
+ // Header
1052
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
1053
+ h('div', null,
1054
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 0 } },
1055
+ h('h3', { style: { margin: 0, fontSize: 18, fontWeight: 600 } }, 'Network & Firewall'),
1056
+ h(HelpButton, { label: SETTINGS_HELP.network.label }, SETTINGS_HELP.network.content())
1057
+ ),
1058
+ h('p', { style: { margin: '4px 0 0', fontSize: 13, color: 'var(--text-muted)' } }, 'Control network access, egress rules, proxy settings, and deployment security for your enterprise instance.')
1059
+ ),
1060
+ h('button', {
1061
+ className: 'btn btn-primary',
1062
+ disabled: saving || !dirty,
1063
+ onClick: props.onSave
1064
+ }, saving ? 'Saving...' : 'Save Settings')
1065
+ ),
1066
+
1067
+ // ── IP ACCESS CONTROL ──
1068
+ h('div', { style: _sectionTitleStyle }, 'IP Access Control'),
1069
+ h('div', { style: _cardStyle },
1070
+ h('div', { style: _cardTitleStyle }, I.shield(), ' Inbound IP Filtering'),
1071
+ h('div', { style: _cardDescStyle }, 'Restrict which IP addresses can access the dashboard, APIs, and engine endpoints. Supports individual IPs and CIDR ranges.'),
1072
+ h(ToggleSwitch, { label: 'Enable IP access control', checked: ipAccess.enabled === true, onChange: function(v) { patchIp('enabled', v); } }),
1073
+ ipAccess.enabled && h(Fragment, null,
1074
+ h('div', { style: { marginBottom: 12 } },
1075
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
1076
+ h('select', { className: 'input', style: { width: 280 }, value: ipAccess.mode || 'allowlist', onChange: function(e) { patchIp('mode', e.target.value); } },
1077
+ h('option', { value: 'allowlist' }, 'Allowlist — only listed IPs can access'),
1078
+ h('option', { value: 'blocklist' }, 'Blocklist — listed IPs are blocked')
1079
+ )
1080
+ ),
1081
+ h('div', { style: _gridStyle },
1082
+ h(TagInput, { label: 'Allowed IPs / CIDRs', value: ipAccess.allowlist || [], onChange: function(v) { patchIp('allowlist', v); }, placeholder: '10.0.0.0/8', mono: true }),
1083
+ h(TagInput, { label: 'Blocked IPs / CIDRs', value: ipAccess.blocklist || [], onChange: function(v) { patchIp('blocklist', v); }, placeholder: '0.0.0.0/0', mono: true })
1084
+ ),
1085
+ h(TagInput, { label: 'Bypass Paths (always allowed)', value: ipAccess.bypassPaths || ['/health', '/ready'], onChange: function(v) { patchIp('bypassPaths', v); }, placeholder: '/health', mono: true }),
1086
+ // Test IP tool
1087
+ h('div', { style: { marginTop: 12, padding: 12, background: 'var(--bg-secondary)', borderRadius: 6 } },
1088
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Test an IP Address'),
1089
+ h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
1090
+ h('input', { className: 'input', style: { width: 200, fontSize: 13 }, value: props.testIp, onChange: function(e) { props.setTestIp(e.target.value); }, placeholder: '192.168.1.1' }),
1091
+ h('button', { className: 'btn btn-secondary btn-sm', onClick: props.onTestIp, disabled: !props.testIp }, 'Test'),
1092
+ props.testResult && !props.testResult.error && h('span', { style: { fontSize: 12, fontWeight: 600, color: props.testResult.allowed ? 'var(--success)' : 'var(--danger)' } }, props.testResult.allowed ? 'ALLOWED' : 'BLOCKED', ' — ', props.testResult.reason),
1093
+ props.testResult && props.testResult.error && h('span', { style: { fontSize: 12, color: 'var(--danger)' } }, props.testResult.error)
1094
+ )
1095
+ )
1096
+ )
1097
+ ),
1098
+
1099
+ // ── OUTBOUND EGRESS ──
1100
+ h('div', { style: _sectionTitleStyle }, 'Outbound Egress Rules'),
1101
+ h('div', { style: _cardStyle },
1102
+ h('div', { style: _cardTitleStyle }, I.globe(), ' Egress Filtering'),
1103
+ h('div', { style: _cardDescStyle }, 'Control which external hosts and ports agents can reach when using web fetch, browser, and other network tools.'),
1104
+ h(ToggleSwitch, { label: 'Enable egress filtering', checked: egress.enabled === true, onChange: function(v) { patchEgress('enabled', v); } }),
1105
+ egress.enabled && h(Fragment, null,
1106
+ h('div', { style: { marginBottom: 12 } },
1107
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
1108
+ h('select', { className: 'input', style: { width: 280 }, value: egress.mode || 'blocklist', onChange: function(e) { patchEgress('mode', e.target.value); } },
1109
+ h('option', { value: 'allowlist' }, 'Allowlist — only listed hosts are reachable'),
1110
+ h('option', { value: 'blocklist' }, 'Blocklist — listed hosts are blocked')
1111
+ )
1112
+ ),
1113
+ h('div', { style: _gridStyle },
1114
+ h(TagInput, { label: 'Allowed Hosts', value: egress.allowedHosts || [], onChange: function(v) { patchEgress('allowedHosts', v); }, placeholder: '*.googleapis.com', mono: true }),
1115
+ h(TagInput, { label: 'Blocked Hosts', value: egress.blockedHosts || [], onChange: function(v) { patchEgress('blockedHosts', v); }, placeholder: 'evil.example.com', mono: true })
1116
+ ),
1117
+ h('div', { style: _gridStyle },
1118
+ h(TagInput, { label: 'Allowed Ports', value: (egress.allowedPorts || []).map(String), onChange: function(v) { patchEgress('allowedPorts', v.map(Number).filter(function(n) { return !isNaN(n); })); }, placeholder: '443' }),
1119
+ h(TagInput, { label: 'Blocked Ports', value: (egress.blockedPorts || []).map(String), onChange: function(v) { patchEgress('blockedPorts', v.map(Number).filter(function(n) { return !isNaN(n); })); }, placeholder: '25' })
1120
+ )
1121
+ )
1122
+ ),
1123
+
1124
+ // ── PROXY & TRUSTED PROXIES ──
1125
+ h('div', { style: _sectionTitleStyle }, 'Proxy & Trusted Proxies'),
1126
+ h('div', { style: _gridStyle },
1127
+
1128
+ // Proxy config
1129
+ h('div', { style: _cardStyle },
1130
+ h('div', { style: _cardTitleStyle }, I.link(), ' Proxy Configuration'),
1131
+ h('div', { style: _cardDescStyle }, 'Configure HTTP/HTTPS proxies for agent outbound traffic in air-gapped or restricted environments.'),
1132
+ h('div', { className: 'form-group', style: { marginBottom: 12 } },
1133
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'HTTP Proxy'),
1134
+ h('input', { className: 'input', style: { fontSize: 13 }, value: proxy.httpProxy || '', onChange: function(e) { patchProxy('httpProxy', e.target.value); }, placeholder: 'http://proxy.corp.internal:8080' })
1135
+ ),
1136
+ h('div', { className: 'form-group', style: { marginBottom: 12 } },
1137
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'HTTPS Proxy'),
1138
+ h('input', { className: 'input', style: { fontSize: 13 }, value: proxy.httpsProxy || '', onChange: function(e) { patchProxy('httpsProxy', e.target.value); }, placeholder: 'http://proxy.corp.internal:8080' })
1139
+ ),
1140
+ h(TagInput, { label: 'No-Proxy Hosts', value: proxy.noProxy || ['localhost', '127.0.0.1'], onChange: function(v) { patchProxy('noProxy', v); }, placeholder: '*.internal', mono: true })
1141
+ ),
1142
+
1143
+ // Trusted proxies
1144
+ h('div', { style: _cardStyle },
1145
+ h('div', { style: _cardTitleStyle }, I.shield(), ' Trusted Proxies'),
1146
+ h('div', { style: _cardDescStyle }, 'Specify which reverse proxies are trusted for X-Forwarded-For header extraction. Required for accurate IP-based access control behind load balancers.'),
1147
+ h(ToggleSwitch, { label: 'Enable trusted proxy validation', checked: tp.enabled === true, onChange: function(v) { patchTp('enabled', v); } }),
1148
+ tp.enabled && h(TagInput, { label: 'Trusted Proxy IPs / CIDRs', value: tp.ips || [], onChange: function(v) { patchTp('ips', v); }, placeholder: '10.0.0.0/8', mono: true })
1149
+ )
1150
+ ),
1151
+
1152
+ // ── NETWORK SETTINGS ──
1153
+ h('div', { style: _sectionTitleStyle }, 'Network & Deployment Settings'),
1154
+ h('div', { style: _gridStyle },
1155
+
1156
+ // CORS
1157
+ h('div', { style: _cardStyle },
1158
+ h('div', { style: _cardTitleStyle }, I.globe(), ' CORS Origins'),
1159
+ h('div', { style: _cardDescStyle }, 'Allowed origins for cross-origin requests. Leave empty to allow all origins (*).'),
1160
+ h(TagInput, { label: 'Allowed Origins', value: net.corsOrigins || [], onChange: function(v) { patchNet('corsOrigins', v); }, placeholder: 'https://dashboard.example.com', mono: true })
1161
+ ),
1162
+
1163
+ // Rate Limiting
1164
+ h('div', { style: _cardStyle },
1165
+ h('div', { style: _cardTitleStyle }, I.clock(), ' Rate Limiting'),
1166
+ h('div', { style: _cardDescStyle }, 'Per-IP rate limiting using token bucket algorithm. Protects against abuse and DDoS.'),
1167
+ h(ToggleSwitch, { label: 'Enable rate limiting', checked: rl.enabled !== false, onChange: function(v) { patchRl('enabled', v); } }),
1168
+ h('div', { className: 'form-group', style: { marginBottom: 12 } },
1169
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Requests per Minute'),
1170
+ h('input', { className: 'input', type: 'number', min: 1, max: 10000, style: { width: 120, fontSize: 13 }, value: rl.requestsPerMinute || 120, onChange: function(e) { patchRl('requestsPerMinute', parseInt(e.target.value) || 120); } })
1171
+ ),
1172
+ h(TagInput, { label: 'Skip Paths', value: rl.skipPaths || ['/health', '/ready'], onChange: function(v) { patchRl('skipPaths', v); }, placeholder: '/health', mono: true })
1173
+ ),
1174
+
1175
+ // HTTPS Enforcement
1176
+ h('div', { style: _cardStyle },
1177
+ h('div', { style: _cardTitleStyle }, I.key(), ' HTTPS Enforcement'),
1178
+ h('div', { style: _cardDescStyle }, 'Require HTTPS for all requests in production. Checks X-Forwarded-Proto header for reverse proxy setups.'),
1179
+ h(ToggleSwitch, { label: 'Enforce HTTPS', checked: https.enabled === true, onChange: function(v) { patchHttps('enabled', v); } }),
1180
+ https.enabled && h(TagInput, { label: 'Exclude Paths', value: https.excludePaths || [], onChange: function(v) { patchHttps('excludePaths', v); }, placeholder: '/health', mono: true })
1181
+ ),
1182
+
1183
+ // Security Headers
1184
+ h('div', { style: _cardStyle },
1185
+ h('div', { style: _cardTitleStyle }, I.shield(), ' Security Headers'),
1186
+ h('div', { style: _cardDescStyle }, 'HTTP security headers applied to all responses. Protects against clickjacking, MIME sniffing, and other browser-level attacks.'),
1187
+ h(ToggleSwitch, { label: 'Strict-Transport-Security (HSTS)', checked: sh.hsts !== false, onChange: function(v) { patchSh('hsts', v); } }),
1188
+ sh.hsts !== false && h('div', { className: 'form-group', style: { marginBottom: 12 } },
1189
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'HSTS Max-Age (seconds)'),
1190
+ h('input', { className: 'input', type: 'number', min: 0, style: { width: 160, fontSize: 13 }, value: sh.hstsMaxAge || 31536000, onChange: function(e) { patchSh('hstsMaxAge', parseInt(e.target.value) || 31536000); } })
1191
+ ),
1192
+ h(ToggleSwitch, { label: 'X-Content-Type-Options: nosniff', checked: sh.xContentTypeOptions !== false, onChange: function(v) { patchSh('xContentTypeOptions', v); } }),
1193
+ h('div', { style: { marginBottom: 12 } },
1194
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'X-Frame-Options'),
1195
+ h('select', { className: 'input', style: { width: 200 }, value: sh.xFrameOptions || 'DENY', onChange: function(e) { patchSh('xFrameOptions', e.target.value); } },
1196
+ h('option', { value: 'DENY' }, 'DENY (recommended)'),
1197
+ h('option', { value: 'SAMEORIGIN' }, 'SAMEORIGIN'),
1198
+ h('option', { value: 'ALLOW' }, 'ALLOW (not recommended)')
1199
+ )
1200
+ ),
1201
+ h('div', { style: { marginBottom: 12 } },
1202
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Referrer-Policy'),
1203
+ h('select', { className: 'input', style: { width: 280 }, value: sh.referrerPolicy || 'strict-origin-when-cross-origin', onChange: function(e) { patchSh('referrerPolicy', e.target.value); } },
1204
+ h('option', { value: 'strict-origin-when-cross-origin' }, 'strict-origin-when-cross-origin'),
1205
+ h('option', { value: 'no-referrer' }, 'no-referrer'),
1206
+ h('option', { value: 'origin' }, 'origin'),
1207
+ h('option', { value: 'same-origin' }, 'same-origin')
1208
+ )
1209
+ ),
1210
+ h('div', { className: 'form-group' },
1211
+ h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Permissions-Policy'),
1212
+ h('input', { className: 'input', style: { fontSize: 13 }, value: sh.permissionsPolicy || 'camera=(), microphone=(), geolocation=()', onChange: function(e) { patchSh('permissionsPolicy', e.target.value); } })
1213
+ )
1214
+ )
1215
+ ),
1216
+
1217
+ // Bottom save bar
1218
+ 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 } },
1219
+ h('button', { className: 'btn btn-primary', disabled: saving, onClick: props.onSave }, saving ? 'Saving...' : 'Save Network & Firewall Settings')
1220
+ )
1221
+ );
1222
+ }
1223
+
1224
+ // ═══════════════════════════════════════════════════════════
1225
+ // PROVIDERS SECTION
1226
+ // ═══════════════════════════════════════════════════════════
1227
+
1228
+ function ProvidersSection(props) {
1229
+ var providers = props.providers || [];
1230
+ var toast = props.toast;
1231
+ var discoverResults = props.discoverResults || {};
1232
+ var _discovering = useState({});
1233
+ var discovering = _discovering[0]; var setDiscovering = _discovering[1];
1234
+
1235
+ var handleAddProvider = function() {
1236
+ var np = props.newProvider;
1237
+ if (!np.id || !np.name || !np.baseUrl) {
1238
+ toast('ID, Name, and Base URL are required', 'error');
1239
+ return;
1240
+ }
1241
+ var body = {
1242
+ id: np.id.toLowerCase().replace(/[^a-z0-9-]/g, '-'),
1243
+ name: np.name,
1244
+ baseUrl: np.baseUrl,
1245
+ apiType: np.apiType || 'openai-compatible',
1246
+ apiKeyEnvVar: np.apiKeyEnvVar || undefined,
1247
+ customHeaders: undefined,
1248
+ };
1249
+ if (np.customHeaders) {
1250
+ try { body.customHeaders = JSON.parse(np.customHeaders); }
1251
+ catch (e) { toast('Invalid JSON in Custom Headers', 'error'); return; }
1252
+ }
1253
+ apiCall('/providers', { method: 'POST', body: JSON.stringify(body) }).then(function() {
1254
+ toast('Provider added', 'success');
1255
+ props.setShowAddProvider(false);
1256
+ props.setNewProvider({ id: '', name: '', baseUrl: '', apiType: 'openai-compatible', apiKeyEnvVar: '', customHeaders: '' });
1257
+ apiCall('/providers').then(function(d) { props.setProviders(d.providers || d || []); }).catch(function() {});
1258
+ }).catch(function(e) { toast(e.message, 'error'); });
1259
+ };
1260
+
1261
+ var handleDeleteProvider = function(id) {
1262
+ showConfirm({ title: 'Delete Provider', message: 'Are you sure you want to delete this custom provider?', danger: true, confirmText: 'Delete' }).then(function(ok) {
1263
+ if (!ok) return;
1264
+ apiCall('/providers/' + id, { method: 'DELETE' }).then(function() {
1265
+ toast('Provider deleted', 'success');
1266
+ apiCall('/providers').then(function(d) { props.setProviders(d.providers || d || []); }).catch(function() {});
1267
+ }).catch(function(e) { toast(e.message, 'error'); });
1268
+ });
1269
+ };
1270
+
1271
+ var handleDiscover = function(id) {
1272
+ setDiscovering(Object.assign({}, discovering, { [id]: true }));
1273
+ apiCall('/providers/' + id + '/models').then(function(d) {
1274
+ var results = Object.assign({}, discoverResults);
1275
+ results[id] = d.models || d || [];
1276
+ props.setDiscoverResults(results);
1277
+ }).catch(function(e) { toast(e.message, 'error'); }).finally(function() {
1278
+ setDiscovering(Object.assign({}, discovering, { [id]: false }));
1279
+ });
1280
+ };
1281
+
1282
+ return h(Fragment, null,
1283
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 } },
1284
+ h('div', null,
1285
+ h('h3', { style: { fontSize: 15, fontWeight: 700, margin: '0 0 4px 0' } }, 'LLM Providers'),
1286
+ h('p', { style: { color: '#6b7280', fontSize: 13, margin: 0 } }, 'Manage connected LLM providers. Add custom providers to use self-hosted or third-party models.')
1287
+ ),
1288
+ h('button', { className: 'btn', onClick: function() { props.setShowAddProvider(true); } }, '+ Add Custom Provider')
1289
+ ),
1290
+
1291
+ // Provider cards grid
1292
+ h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))', gap: 12, marginBottom: 24 } },
1293
+ providers.map(function(p) {
1294
+ var isConfigured = p.configured || p.isConfigured;
1295
+ var isLocal = p.isLocal || false;
1296
+ var discovered = discoverResults[p.id];
1297
+ return h('div', { key: p.id, className: 'card', style: { padding: 16 } },
1298
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 8 } },
1299
+ h('div', null,
1300
+ h('h4', { style: { fontSize: 14, fontWeight: 600, margin: 0 } }, p.name || p.id),
1301
+ p.apiType && h('span', { style: { fontSize: 11, color: '#9ca3af', background: 'var(--bg-secondary)', padding: '1px 6px', borderRadius: 4, marginTop: 4, display: 'inline-block' } }, p.apiType)
1302
+ ),
1303
+ h('span', {
1304
+ className: 'badge',
1305
+ style: {
1306
+ background: isConfigured ? 'var(--success-soft, #dcfce7)' : 'var(--bg-secondary)',
1307
+ color: isConfigured ? 'var(--success, #16a34a)' : '#9ca3af',
1308
+ fontSize: 11,
1309
+ }
1310
+ }, isConfigured ? 'Connected' : 'Not Configured')
1311
+ ),
1312
+ isLocal && p.baseUrl && h('div', { style: { fontSize: 12, color: '#6b7280', marginBottom: 8, wordBreak: 'break-all' } }, p.baseUrl),
1313
+ h('div', { style: { display: 'flex', gap: 6, marginTop: 8 } },
1314
+ isLocal && h('button', {
1315
+ className: 'btn btn-sm',
1316
+ disabled: discovering[p.id],
1317
+ onClick: function() { handleDiscover(p.id); },
1318
+ }, discovering[p.id] ? 'Discovering...' : 'Discover Models'),
1319
+ p.isCustom && h('button', {
1320
+ className: 'btn btn-sm btn-danger',
1321
+ style: { padding: '2px 8px', fontSize: 12 },
1322
+ onClick: function() { handleDeleteProvider(p.id); },
1323
+ }, I.trash())
1324
+ ),
1325
+ discovered && discovered.length > 0 && h('div', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary)', borderRadius: 'var(--radius)', fontSize: 12 } },
1326
+ h('div', { style: { fontWeight: 600, marginBottom: 4 } }, 'Discovered Models (' + discovered.length + ')'),
1327
+ h('div', { style: { maxHeight: 120, overflow: 'auto' } },
1328
+ discovered.map(function(m) {
1329
+ var modelName = typeof m === 'string' ? m : (m.id || m.name || m.model);
1330
+ return h('div', { key: modelName, style: { padding: '2px 0', color: '#6b7280' } }, modelName);
1331
+ })
1332
+ )
1333
+ )
1334
+ );
1335
+ })
1336
+ ),
1337
+
1338
+ // Add Custom Provider Modal
1339
+ props.showAddProvider && h(Modal, {
1340
+ title: 'Add Custom Provider',
1341
+ onClose: function() { props.setShowAddProvider(false); },
1342
+ },
1343
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
1344
+ h('div', { className: 'form-group' },
1345
+ h('label', { className: 'form-label' }, 'ID'),
1346
+ h('input', { className: 'input', placeholder: 'e.g. internal-llm', value: props.newProvider.id, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { id: e.target.value })); } }),
1347
+ h('p', { className: 'form-help' }, 'Lowercase slug, used as identifier')
1348
+ ),
1349
+ h('div', { className: 'form-group' },
1350
+ h('label', { className: 'form-label' }, 'Display Name'),
1351
+ h('input', { className: 'input', placeholder: 'e.g. Internal LLM', value: props.newProvider.name, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { name: e.target.value })); } })
1352
+ ),
1353
+ h('div', { className: 'form-group', style: { gridColumn: '1 / -1' } },
1354
+ h('label', { className: 'form-label' }, 'Base URL'),
1355
+ h('input', { className: 'input', placeholder: 'e.g. http://internal-llm:8080/v1', value: props.newProvider.baseUrl, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { baseUrl: e.target.value })); } })
1356
+ ),
1357
+ h('div', { className: 'form-group' },
1358
+ h('label', { className: 'form-label' }, 'API Type'),
1359
+ h('select', { className: 'input', value: props.newProvider.apiType, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { apiType: e.target.value })); } },
1360
+ h('option', { value: 'openai-compatible' }, 'OpenAI Compatible'),
1361
+ h('option', { value: 'anthropic' }, 'Anthropic'),
1362
+ h('option', { value: 'google' }, 'Google'),
1363
+ h('option', { value: 'ollama' }, 'Ollama')
1364
+ )
1365
+ ),
1366
+ h('div', { className: 'form-group' },
1367
+ h('label', { className: 'form-label' }, 'API Key Env Var'),
1368
+ h('input', { className: 'input', placeholder: 'e.g. INTERNAL_LLM_KEY', value: props.newProvider.apiKeyEnvVar, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { apiKeyEnvVar: e.target.value })); } }),
1369
+ h('p', { className: 'form-help' }, 'Environment variable name for the API key')
1370
+ ),
1371
+ h('div', { className: 'form-group', style: { gridColumn: '1 / -1' } },
1372
+ h('label', { className: 'form-label' }, 'Custom Headers (JSON)'),
1373
+ h('textarea', { className: 'input', rows: 3, placeholder: '{"X-Custom-Header": "value"}', value: props.newProvider.customHeaders, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { customHeaders: e.target.value })); } })
1374
+ )
1375
+ ),
1376
+ h('div', { style: { display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 16 } },
1377
+ h('button', { className: 'btn', onClick: function() { props.setShowAddProvider(false); } }, 'Cancel'),
1378
+ h('button', { className: 'btn btn-primary', onClick: handleAddProvider }, 'Add Provider')
1379
+ )
1380
+ )
1381
+ );
1382
+ }
1383
+
1384
+ // ═══════════════════════════════════════════════════════════
1385
+ // MODEL PRICING TAB
1386
+ // ═══════════════════════════════════════════════════════════
1387
+
1388
+ function ModelPricingTab(props) {
1389
+ var pricing = props.pricing;
1390
+ var models = pricing.models || [];
1391
+ var providerGroups = {};
1392
+ models.forEach(function(m) {
1393
+ if (!providerGroups[m.provider]) providerGroups[m.provider] = [];
1394
+ providerGroups[m.provider].push(m);
1395
+ });
1396
+
1397
+ var allProviders = props.providers || [];
1398
+ var providerNames = {};
1399
+ allProviders.forEach(function(p) { providerNames[p.id] = p.name; });
1400
+
1401
+ return h(Fragment, null,
1402
+ // Providers section
1403
+ h(ProvidersSection, {
1404
+ providers: allProviders,
1405
+ setProviders: props.setProviders,
1406
+ showAddProvider: props.showAddProvider,
1407
+ setShowAddProvider: props.setShowAddProvider,
1408
+ newProvider: props.newProvider,
1409
+ setNewProvider: props.setNewProvider,
1410
+ discoverResults: props.discoverResults,
1411
+ setDiscoverResults: props.setDiscoverResults,
1412
+ toast: props.toast,
1413
+ }),
1414
+
1415
+ // Divider
1416
+ h('hr', { style: { border: 'none', borderTop: '1px solid var(--border)', margin: '8px 0 20px 0' } }),
1417
+
1418
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 } },
1419
+ h('div', null,
1420
+ h('h3', { style: { fontSize: 15, fontWeight: 700, margin: '0 0 4px 0' } }, 'Model Pricing'),
1421
+ h('p', { style: { color: '#6b7280', fontSize: 13, margin: 0 } }, 'Configure token costs per model for accurate budget tracking and cost reporting. Costs are in USD per 1 million tokens.')
1422
+ ),
1423
+ h('div', { style: { display: 'flex', gap: 8 } },
1424
+ props.dirty && h('button', {
1425
+ className: 'btn btn-primary',
1426
+ disabled: props.saving,
1427
+ onClick: props.onSave,
1428
+ }, props.saving ? 'Saving...' : 'Save Changes'),
1429
+ h('button', { className: 'btn', onClick: function() { props.setShowAddModel(true); } }, '+ Add Model')
1430
+ )
1431
+ ),
1432
+
1433
+ // Add Model Modal
1434
+ props.showAddModel && h(Modal, {
1435
+ title: 'Add Model Pricing',
1436
+ onClose: function() { props.setShowAddModel(false); },
1437
+ },
1438
+ h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
1439
+ h('div', { className: 'form-group' },
1440
+ h('label', { className: 'form-label' }, 'Provider'),
1441
+ h('select', { className: 'input', value: props.newModel.provider, onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { provider: e.target.value })); } },
1442
+ allProviders.map(function(p) {
1443
+ return h('option', { key: p.id, value: p.id }, p.name);
1444
+ })
1445
+ )
1446
+ ),
1447
+ h('div', { className: 'form-group' },
1448
+ h('label', { className: 'form-label' }, 'Model ID'),
1449
+ h('input', { className: 'input', placeholder: 'e.g. claude-sonnet-4-5-20250929', value: props.newModel.modelId, onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { modelId: e.target.value })); } })
1450
+ ),
1451
+ h('div', { className: 'form-group' },
1452
+ h('label', { className: 'form-label' }, 'Display Name'),
1453
+ h('input', { className: 'input', placeholder: 'e.g. Claude Sonnet 4.5', value: props.newModel.displayName, onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { displayName: e.target.value })); } })
1454
+ ),
1455
+ h('div', { className: 'form-group' },
1456
+ h('label', { className: 'form-label' }, 'Context Window'),
1457
+ h('input', { className: 'input', type: 'number', value: props.newModel.contextWindow || '', onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { contextWindow: parseInt(e.target.value) || 0 })); } })
1458
+ ),
1459
+ h('div', { className: 'form-group' },
1460
+ h('label', { className: 'form-label' }, 'Input Cost (per 1M tokens)'),
1461
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
1462
+ h('span', { style: { color: '#6b7280' } }, '$'),
1463
+ h('input', { className: 'input', type: 'number', step: '0.01', value: props.newModel.inputCostPerMillion || '', onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { inputCostPerMillion: parseFloat(e.target.value) || 0 })); } })
1464
+ )
1465
+ ),
1466
+ h('div', { className: 'form-group' },
1467
+ h('label', { className: 'form-label' }, 'Output Cost (per 1M tokens)'),
1468
+ h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
1469
+ h('span', { style: { color: '#6b7280' } }, '$'),
1470
+ h('input', { className: 'input', type: 'number', step: '0.01', value: props.newModel.outputCostPerMillion || '', onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { outputCostPerMillion: parseFloat(e.target.value) || 0 })); } })
1471
+ )
1472
+ )
1473
+ ),
1474
+ h('div', { style: { display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 16 } },
1475
+ h('button', { className: 'btn', onClick: function() { props.setShowAddModel(false); } }, 'Cancel'),
1476
+ h('button', { className: 'btn btn-primary', onClick: props.onAddModel }, 'Add Model')
1477
+ )
1478
+ ),
1479
+
1480
+ // Model pricing table grouped by provider
1481
+ Object.keys(providerGroups).length === 0
1482
+ ? h('div', { className: 'card', style: { padding: 32, textAlign: 'center' } },
1483
+ h('p', { style: { color: '#6b7280' } }, 'No model pricing configured. Default pricing will be used for cost tracking.'),
1484
+ h('button', { className: 'btn btn-primary', onClick: function() { props.setShowAddModel(true); } }, 'Add First Model')
1485
+ )
1486
+ : Object.keys(providerGroups).sort().map(function(provider) {
1487
+ var providerModels = providerGroups[provider];
1488
+ var providerLabel = providerNames[provider] || provider;
1489
+ return h('div', { key: provider, className: 'card', style: { marginBottom: 16 } },
1490
+ h('div', { className: 'card-header' }, h('h3', null, providerLabel)),
1491
+ h('div', { className: 'card-body', style: { padding: 0 } },
1492
+ h('table', { className: 'table', style: { width: '100%' } },
1493
+ h('thead', null,
1494
+ h('tr', null,
1495
+ h('th', { style: { padding: '8px 12px' } }, 'Model'),
1496
+ h('th', { style: { padding: '8px 12px', textAlign: 'right' } }, 'Input $/1M'),
1497
+ h('th', { style: { padding: '8px 12px', textAlign: 'right' } }, 'Output $/1M'),
1498
+ h('th', { style: { padding: '8px 12px', textAlign: 'right' } }, 'Context'),
1499
+ h('th', { style: { padding: '8px 12px', width: 60 } }, '')
1500
+ )
1501
+ ),
1502
+ h('tbody', null,
1503
+ providerModels.map(function(m) {
1504
+ var globalIdx = models.indexOf(m);
1505
+ return h('tr', { key: m.modelId },
1506
+ h('td', { style: { padding: '8px 12px' } },
1507
+ h('div', null, h('strong', null, m.displayName || m.modelId)),
1508
+ h('div', { style: { fontSize: 12, color: '#6b7280' } }, m.modelId)
1509
+ ),
1510
+ h('td', { style: { padding: '8px 12px', textAlign: 'right' } },
1511
+ h('input', {
1512
+ className: 'input',
1513
+ type: 'number',
1514
+ step: '0.01',
1515
+ style: { width: 90, textAlign: 'right' },
1516
+ value: m.inputCostPerMillion,
1517
+ onChange: function(e) { props.onUpdateModel(globalIdx, 'inputCostPerMillion', parseFloat(e.target.value) || 0); }
1518
+ })
1519
+ ),
1520
+ h('td', { style: { padding: '8px 12px', textAlign: 'right' } },
1521
+ h('input', {
1522
+ className: 'input',
1523
+ type: 'number',
1524
+ step: '0.01',
1525
+ style: { width: 90, textAlign: 'right' },
1526
+ value: m.outputCostPerMillion,
1527
+ onChange: function(e) { props.onUpdateModel(globalIdx, 'outputCostPerMillion', parseFloat(e.target.value) || 0); }
1528
+ })
1529
+ ),
1530
+ h('td', { style: { padding: '8px 12px', textAlign: 'right', fontSize: 13, color: '#6b7280' } },
1531
+ m.contextWindow ? (m.contextWindow >= 1000000 ? (m.contextWindow / 1000000) + 'M' : Math.round(m.contextWindow / 1000) + 'K') : '\u2014'
1532
+ ),
1533
+ h('td', { style: { padding: '8px 12px', textAlign: 'center' } },
1534
+ h('button', {
1535
+ className: 'btn btn-sm btn-danger',
1536
+ style: { padding: '2px 8px', fontSize: 12 },
1537
+ onClick: function() { props.onRemoveModel(globalIdx); }
1538
+ }, I.trash())
1539
+ )
1540
+ );
1541
+ })
1542
+ )
1543
+ )
1544
+ )
1545
+ );
1546
+ }),
1547
+
1548
+ // Summary footer
1549
+ models.length > 0 && h('div', { style: { fontSize: 13, color: '#6b7280', marginTop: 8 } },
1550
+ models.length + ' model(s) configured across ' + Object.keys(providerGroups).length + ' provider(s)',
1551
+ pricing.updatedAt && h('span', null, ' \u2014 Last updated: ' + new Date(pricing.updatedAt).toLocaleString())
1552
+ )
1553
+ );
1554
+ }