@agenticmail/enterprise 0.5.327 → 0.5.329
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.
- package/dist/agent-tools-F3CYENMK.js +13949 -0
- package/dist/browser-tool-P57PLVW2.js +4002 -0
- package/dist/chunk-3RI3AIJN.js +1519 -0
- package/dist/chunk-AD4DFKHR.js +4928 -0
- package/dist/chunk-UQXPVWXG.js +5101 -0
- package/dist/cli-agent-K6UFZRXC.js +2473 -0
- package/dist/cli-serve-4MT7RDEL.js +260 -0
- package/dist/cli.js +3 -3
- package/dist/dashboard/app.js +1 -1
- package/dist/dashboard/components/transport-encryption.js +0 -62
- package/dist/dashboard/pages/agent-detail/index.js +5 -2
- package/dist/dashboard/pages/agent-detail/manager.js +1 -1
- package/dist/dashboard/pages/agent-detail/overview.js +4 -2
- package/dist/dashboard/pages/agent-detail/tool-security.js +1 -1
- package/dist/dashboard/pages/domain-status.js +3 -6
- package/dist/dashboard/pages/memory-transfer.js +1 -1
- package/dist/dashboard/pages/messages.js +0 -1
- package/dist/dashboard/pages/roles.js +0 -2
- package/dist/dashboard/pages/workforce.js +0 -1
- package/dist/index.js +3 -3
- package/dist/runtime-L5ADJORP.js +45 -0
- package/dist/server-KSN56EZQ.js +28 -0
- package/dist/setup-UUNBBOQH.js +20 -0
- package/logs/cloudflared-error.log +42 -0
- package/logs/enterprise-out.log +6 -0
- package/package.json +1 -1
- package/src/admin/page-registry.ts +0 -290
- package/src/admin/routes.ts +0 -2968
- package/src/agent-tools/common.ts +0 -260
- package/src/agent-tools/index.ts +0 -542
- package/src/agent-tools/merge.ts +0 -62
- package/src/agent-tools/middleware.ts +0 -436
- package/src/agent-tools/schema/typebox.ts +0 -25
- package/src/agent-tools/security.ts +0 -352
- package/src/agent-tools/tool-resolver.ts +0 -1018
- package/src/agent-tools/tools/agenticmail.ts +0 -1017
- package/src/agent-tools/tools/bash.ts +0 -179
- package/src/agent-tools/tools/browser-tool.schema.ts +0 -112
- package/src/agent-tools/tools/browser-tool.ts +0 -388
- package/src/agent-tools/tools/browser.ts +0 -764
- package/src/agent-tools/tools/edit.ts +0 -100
- package/src/agent-tools/tools/enterprise-code-sandbox.ts +0 -395
- package/src/agent-tools/tools/enterprise-database.ts +0 -377
- package/src/agent-tools/tools/enterprise-diff.ts +0 -580
- package/src/agent-tools/tools/enterprise-documents.ts +0 -896
- package/src/agent-tools/tools/enterprise-http.ts +0 -485
- package/src/agent-tools/tools/enterprise-security-scan.ts +0 -528
- package/src/agent-tools/tools/enterprise-spreadsheet.ts +0 -825
- package/src/agent-tools/tools/glob.ts +0 -129
- package/src/agent-tools/tools/google/calendar.ts +0 -230
- package/src/agent-tools/tools/google/chat.ts +0 -725
- package/src/agent-tools/tools/google/contacts.ts +0 -209
- package/src/agent-tools/tools/google/docs.ts +0 -162
- package/src/agent-tools/tools/google/drive.ts +0 -392
- package/src/agent-tools/tools/google/forms.ts +0 -367
- package/src/agent-tools/tools/google/gmail.ts +0 -897
- package/src/agent-tools/tools/google/index.ts +0 -86
- package/src/agent-tools/tools/google/maps.ts +0 -543
- package/src/agent-tools/tools/google/meeting-voice.ts +0 -885
- package/src/agent-tools/tools/google/meetings.ts +0 -1094
- package/src/agent-tools/tools/google/sheets.ts +0 -215
- package/src/agent-tools/tools/google/slides.ts +0 -559
- package/src/agent-tools/tools/google/tasks.ts +0 -200
- package/src/agent-tools/tools/grep.ts +0 -178
- package/src/agent-tools/tools/integrations/_factory.ts +0 -102
- package/src/agent-tools/tools/integrations/activecampaign.ts +0 -14
- package/src/agent-tools/tools/integrations/adobe-sign.ts +0 -14
- package/src/agent-tools/tools/integrations/adp.ts +0 -14
- package/src/agent-tools/tools/integrations/airtable.ts +0 -14
- package/src/agent-tools/tools/integrations/apollo.ts +0 -14
- package/src/agent-tools/tools/integrations/asana.ts +0 -14
- package/src/agent-tools/tools/integrations/auth0.ts +0 -14
- package/src/agent-tools/tools/integrations/aws.ts +0 -14
- package/src/agent-tools/tools/integrations/azure-devops.ts +0 -14
- package/src/agent-tools/tools/integrations/bamboohr.ts +0 -14
- package/src/agent-tools/tools/integrations/basecamp.ts +0 -14
- package/src/agent-tools/tools/integrations/bigcommerce.ts +0 -14
- package/src/agent-tools/tools/integrations/bitbucket.ts +0 -14
- package/src/agent-tools/tools/integrations/box.ts +0 -14
- package/src/agent-tools/tools/integrations/brex.ts +0 -14
- package/src/agent-tools/tools/integrations/buffer.ts +0 -14
- package/src/agent-tools/tools/integrations/calendly.ts +0 -14
- package/src/agent-tools/tools/integrations/canva.ts +0 -14
- package/src/agent-tools/tools/integrations/chargebee.ts +0 -14
- package/src/agent-tools/tools/integrations/circleci.ts +0 -14
- package/src/agent-tools/tools/integrations/clickup.ts +0 -14
- package/src/agent-tools/tools/integrations/close.ts +0 -14
- package/src/agent-tools/tools/integrations/cloudflare.ts +0 -14
- package/src/agent-tools/tools/integrations/confluence.ts +0 -14
- package/src/agent-tools/tools/integrations/contentful.ts +0 -14
- package/src/agent-tools/tools/integrations/copper.ts +0 -14
- package/src/agent-tools/tools/integrations/crisp.ts +0 -14
- package/src/agent-tools/tools/integrations/crowdstrike.ts +0 -14
- package/src/agent-tools/tools/integrations/datadog.ts +0 -14
- package/src/agent-tools/tools/integrations/digitalocean.ts +0 -14
- package/src/agent-tools/tools/integrations/discord.ts +0 -14
- package/src/agent-tools/tools/integrations/docker.ts +0 -14
- package/src/agent-tools/tools/integrations/docusign.ts +0 -14
- package/src/agent-tools/tools/integrations/drift.ts +0 -14
- package/src/agent-tools/tools/integrations/dropbox.ts +0 -14
- package/src/agent-tools/tools/integrations/figma.ts +0 -14
- package/src/agent-tools/tools/integrations/firebase.ts +0 -14
- package/src/agent-tools/tools/integrations/flyio.ts +0 -14
- package/src/agent-tools/tools/integrations/freshbooks.ts +0 -14
- package/src/agent-tools/tools/integrations/freshdesk.ts +0 -14
- package/src/agent-tools/tools/integrations/freshsales.ts +0 -14
- package/src/agent-tools/tools/integrations/freshservice.ts +0 -14
- package/src/agent-tools/tools/integrations/front.ts +0 -14
- package/src/agent-tools/tools/integrations/github-actions.ts +0 -14
- package/src/agent-tools/tools/integrations/github.ts +0 -14
- package/src/agent-tools/tools/integrations/gitlab.ts +0 -14
- package/src/agent-tools/tools/integrations/gong.ts +0 -14
- package/src/agent-tools/tools/integrations/google-ads.ts +0 -14
- package/src/agent-tools/tools/integrations/google-analytics.ts +0 -14
- package/src/agent-tools/tools/integrations/google-cloud.ts +0 -14
- package/src/agent-tools/tools/integrations/gotomeeting.ts +0 -14
- package/src/agent-tools/tools/integrations/grafana.ts +0 -14
- package/src/agent-tools/tools/integrations/greenhouse.ts +0 -14
- package/src/agent-tools/tools/integrations/gusto.ts +0 -14
- package/src/agent-tools/tools/integrations/hashicorp-vault.ts +0 -14
- package/src/agent-tools/tools/integrations/heroku.ts +0 -14
- package/src/agent-tools/tools/integrations/hibob.ts +0 -14
- package/src/agent-tools/tools/integrations/hootsuite.ts +0 -14
- package/src/agent-tools/tools/integrations/hubspot.ts +0 -14
- package/src/agent-tools/tools/integrations/huggingface.ts +0 -14
- package/src/agent-tools/tools/integrations/index.ts +0 -474
- package/src/agent-tools/tools/integrations/intercom.ts +0 -14
- package/src/agent-tools/tools/integrations/jira.ts +0 -14
- package/src/agent-tools/tools/integrations/klaviyo.ts +0 -14
- package/src/agent-tools/tools/integrations/kubernetes.ts +0 -14
- package/src/agent-tools/tools/integrations/lattice.ts +0 -14
- package/src/agent-tools/tools/integrations/launchdarkly.ts +0 -14
- package/src/agent-tools/tools/integrations/lever.ts +0 -14
- package/src/agent-tools/tools/integrations/linear.ts +0 -14
- package/src/agent-tools/tools/integrations/linkedin.ts +0 -14
- package/src/agent-tools/tools/integrations/livechat.ts +0 -14
- package/src/agent-tools/tools/integrations/loom.ts +0 -14
- package/src/agent-tools/tools/integrations/mailchimp.ts +0 -14
- package/src/agent-tools/tools/integrations/mailgun.ts +0 -14
- package/src/agent-tools/tools/integrations/miro.ts +0 -14
- package/src/agent-tools/tools/integrations/mixpanel.ts +0 -14
- package/src/agent-tools/tools/integrations/monday.ts +0 -14
- package/src/agent-tools/tools/integrations/mongodb-atlas.ts +0 -14
- package/src/agent-tools/tools/integrations/neon.ts +0 -14
- package/src/agent-tools/tools/integrations/netlify.ts +0 -14
- package/src/agent-tools/tools/integrations/netsuite.ts +0 -14
- package/src/agent-tools/tools/integrations/newrelic.ts +0 -14
- package/src/agent-tools/tools/integrations/notion.ts +0 -14
- package/src/agent-tools/tools/integrations/okta.ts +0 -14
- package/src/agent-tools/tools/integrations/openai.ts +0 -14
- package/src/agent-tools/tools/integrations/opsgenie.ts +0 -14
- package/src/agent-tools/tools/integrations/outreach.ts +0 -14
- package/src/agent-tools/tools/integrations/paddle.ts +0 -14
- package/src/agent-tools/tools/integrations/pagerduty.ts +0 -14
- package/src/agent-tools/tools/integrations/pandadoc.ts +0 -14
- package/src/agent-tools/tools/integrations/paypal.ts +0 -14
- package/src/agent-tools/tools/integrations/personio.ts +0 -14
- package/src/agent-tools/tools/integrations/pinecone.ts +0 -14
- package/src/agent-tools/tools/integrations/pipedrive.ts +0 -14
- package/src/agent-tools/tools/integrations/plaid.ts +0 -14
- package/src/agent-tools/tools/integrations/postmark.ts +0 -14
- package/src/agent-tools/tools/integrations/power-automate.ts +0 -14
- package/src/agent-tools/tools/integrations/quickbooks.ts +0 -14
- package/src/agent-tools/tools/integrations/recurly.ts +0 -14
- package/src/agent-tools/tools/integrations/reddit.ts +0 -14
- package/src/agent-tools/tools/integrations/render.ts +0 -14
- package/src/agent-tools/tools/integrations/ringcentral.ts +0 -14
- package/src/agent-tools/tools/integrations/rippling.ts +0 -14
- package/src/agent-tools/tools/integrations/salesforce.ts +0 -14
- package/src/agent-tools/tools/integrations/salesloft.ts +0 -14
- package/src/agent-tools/tools/integrations/sanity.ts +0 -14
- package/src/agent-tools/tools/integrations/sap.ts +0 -14
- package/src/agent-tools/tools/integrations/segment.ts +0 -14
- package/src/agent-tools/tools/integrations/sendgrid.ts +0 -14
- package/src/agent-tools/tools/integrations/sentry.ts +0 -14
- package/src/agent-tools/tools/integrations/servicenow.ts +0 -14
- package/src/agent-tools/tools/integrations/shopify.ts +0 -14
- package/src/agent-tools/tools/integrations/shortcut.ts +0 -14
- package/src/agent-tools/tools/integrations/slack.ts +0 -14
- package/src/agent-tools/tools/integrations/smartsheet.ts +0 -14
- package/src/agent-tools/tools/integrations/snowflake.ts +0 -14
- package/src/agent-tools/tools/integrations/snyk.ts +0 -14
- package/src/agent-tools/tools/integrations/splunk.ts +0 -14
- package/src/agent-tools/tools/integrations/square.ts +0 -14
- package/src/agent-tools/tools/integrations/statuspage.ts +0 -14
- package/src/agent-tools/tools/integrations/stripe.ts +0 -14
- package/src/agent-tools/tools/integrations/supabase.ts +0 -14
- package/src/agent-tools/tools/integrations/teamwork.ts +0 -14
- package/src/agent-tools/tools/integrations/telegram.ts +0 -14
- package/src/agent-tools/tools/integrations/terraform.ts +0 -14
- package/src/agent-tools/tools/integrations/todoist.ts +0 -14
- package/src/agent-tools/tools/integrations/trello.ts +0 -14
- package/src/agent-tools/tools/integrations/twilio.ts +0 -14
- package/src/agent-tools/tools/integrations/twitter.ts +0 -14
- package/src/agent-tools/tools/integrations/vercel.ts +0 -14
- package/src/agent-tools/tools/integrations/weaviate.ts +0 -14
- package/src/agent-tools/tools/integrations/webex.ts +0 -14
- package/src/agent-tools/tools/integrations/webflow.ts +0 -14
- package/src/agent-tools/tools/integrations/whatsapp.ts +0 -14
- package/src/agent-tools/tools/integrations/whereby.ts +0 -14
- package/src/agent-tools/tools/integrations/woocommerce.ts +0 -14
- package/src/agent-tools/tools/integrations/wordpress.ts +0 -14
- package/src/agent-tools/tools/integrations/workday.ts +0 -14
- package/src/agent-tools/tools/integrations/wrike.ts +0 -14
- package/src/agent-tools/tools/integrations/xero.ts +0 -14
- package/src/agent-tools/tools/integrations/youtube.ts +0 -14
- package/src/agent-tools/tools/integrations/zendesk.ts +0 -14
- package/src/agent-tools/tools/integrations/zoho-crm.ts +0 -14
- package/src/agent-tools/tools/integrations/zoom.ts +0 -14
- package/src/agent-tools/tools/integrations/zuora.ts +0 -14
- package/src/agent-tools/tools/knowledge-search.ts +0 -318
- package/src/agent-tools/tools/local/coding.ts +0 -626
- package/src/agent-tools/tools/local/dependency-manager.ts +0 -647
- package/src/agent-tools/tools/local/file-edit.ts +0 -31
- package/src/agent-tools/tools/local/file-list.ts +0 -39
- package/src/agent-tools/tools/local/file-ops.ts +0 -48
- package/src/agent-tools/tools/local/file-read.ts +0 -39
- package/src/agent-tools/tools/local/file-search.ts +0 -46
- package/src/agent-tools/tools/local/file-write.ts +0 -28
- package/src/agent-tools/tools/local/filesystem.ts +0 -5
- package/src/agent-tools/tools/local/index.ts +0 -55
- package/src/agent-tools/tools/local/resolve-path.ts +0 -18
- package/src/agent-tools/tools/local/shell.ts +0 -277
- package/src/agent-tools/tools/local/system-info.ts +0 -29
- package/src/agent-tools/tools/management.ts +0 -425
- package/src/agent-tools/tools/mcp-bridge.ts +0 -142
- package/src/agent-tools/tools/mcp-server-tools.ts +0 -91
- package/src/agent-tools/tools/meeting-lifecycle.ts +0 -438
- package/src/agent-tools/tools/memory.ts +0 -509
- package/src/agent-tools/tools/messaging/index.ts +0 -6
- package/src/agent-tools/tools/messaging/telegram.ts +0 -167
- package/src/agent-tools/tools/messaging/whatsapp.ts +0 -651
- package/src/agent-tools/tools/microsoft/contacts.ts +0 -176
- package/src/agent-tools/tools/microsoft/excel-vba.ts +0 -331
- package/src/agent-tools/tools/microsoft/excel.ts +0 -261
- package/src/agent-tools/tools/microsoft/graph-api.ts +0 -161
- package/src/agent-tools/tools/microsoft/index.ts +0 -95
- package/src/agent-tools/tools/microsoft/onedrive.ts +0 -429
- package/src/agent-tools/tools/microsoft/onenote.ts +0 -186
- package/src/agent-tools/tools/microsoft/outlook-calendar.ts +0 -286
- package/src/agent-tools/tools/microsoft/outlook-mail.ts +0 -723
- package/src/agent-tools/tools/microsoft/planner.ts +0 -200
- package/src/agent-tools/tools/microsoft/powerbi.ts +0 -266
- package/src/agent-tools/tools/microsoft/powerpoint.ts +0 -186
- package/src/agent-tools/tools/microsoft/sharepoint.ts +0 -328
- package/src/agent-tools/tools/microsoft/teams.ts +0 -463
- package/src/agent-tools/tools/microsoft/todo.ts +0 -181
- package/src/agent-tools/tools/oauth-token-provider.ts +0 -101
- package/src/agent-tools/tools/read.ts +0 -160
- package/src/agent-tools/tools/visual-memory/capture.ts +0 -217
- package/src/agent-tools/tools/visual-memory/diff.ts +0 -283
- package/src/agent-tools/tools/visual-memory/index.ts +0 -698
- package/src/agent-tools/tools/visual-memory/phash.ts +0 -120
- package/src/agent-tools/tools/visual-memory/similarity.ts +0 -354
- package/src/agent-tools/tools/visual-memory/storage.ts +0 -534
- package/src/agent-tools/tools/visual-memory/types.ts +0 -100
- package/src/agent-tools/tools/web-fetch-utils.ts +0 -202
- package/src/agent-tools/tools/web-fetch.ts +0 -464
- package/src/agent-tools/tools/web-search.ts +0 -480
- package/src/agent-tools/tools/web-shared.ts +0 -232
- package/src/agent-tools/tools/write.ts +0 -68
- package/src/agent-tools/types.ts +0 -214
- package/src/agenticmail/index.ts +0 -34
- package/src/agenticmail/manager.ts +0 -253
- package/src/agenticmail/providers/google.ts +0 -391
- package/src/agenticmail/providers/imap.ts +0 -454
- package/src/agenticmail/providers/index.ts +0 -28
- package/src/agenticmail/providers/microsoft.ts +0 -260
- package/src/agenticmail/types.ts +0 -173
- package/src/auth/routes.ts +0 -1589
- package/src/browser/bridge-auth-registry.ts +0 -34
- package/src/browser/bridge-server.ts +0 -93
- package/src/browser/cdp.helpers.ts +0 -180
- package/src/browser/cdp.ts +0 -466
- package/src/browser/chrome.executables.ts +0 -625
- package/src/browser/chrome.profile-decoration.ts +0 -198
- package/src/browser/chrome.ts +0 -349
- package/src/browser/client-actions-core.ts +0 -259
- package/src/browser/client-actions-observe.ts +0 -184
- package/src/browser/client-actions-state.ts +0 -284
- package/src/browser/client-actions-types.ts +0 -16
- package/src/browser/client-actions-url.ts +0 -11
- package/src/browser/client-actions.ts +0 -4
- package/src/browser/client-fetch.ts +0 -253
- package/src/browser/client.ts +0 -337
- package/src/browser/config.ts +0 -301
- package/src/browser/constants.ts +0 -8
- package/src/browser/control-auth.ts +0 -94
- package/src/browser/control-service.ts +0 -81
- package/src/browser/csrf.ts +0 -87
- package/src/browser/enterprise-compat.ts +0 -562
- package/src/browser/extension-relay.ts +0 -834
- package/src/browser/http-auth.ts +0 -63
- package/src/browser/navigation-guard.ts +0 -50
- package/src/browser/paths.ts +0 -49
- package/src/browser/playwright.d.ts +0 -12
- package/src/browser/profiles-service.ts +0 -187
- package/src/browser/profiles.ts +0 -114
- package/src/browser/proxy-files.ts +0 -41
- package/src/browser/pw-ai-module.ts +0 -52
- package/src/browser/pw-ai-state.ts +0 -9
- package/src/browser/pw-ai.ts +0 -65
- package/src/browser/pw-role-snapshot.ts +0 -434
- package/src/browser/pw-session.ts +0 -810
- package/src/browser/pw-tools-core.activity.ts +0 -68
- package/src/browser/pw-tools-core.downloads.ts +0 -281
- package/src/browser/pw-tools-core.interactions.ts +0 -646
- package/src/browser/pw-tools-core.responses.ts +0 -124
- package/src/browser/pw-tools-core.shared.ts +0 -70
- package/src/browser/pw-tools-core.snapshot.ts +0 -213
- package/src/browser/pw-tools-core.state.ts +0 -209
- package/src/browser/pw-tools-core.storage.ts +0 -128
- package/src/browser/pw-tools-core.trace.ts +0 -37
- package/src/browser/pw-tools-core.ts +0 -8
- package/src/browser/resolved-config-refresh.ts +0 -59
- package/src/browser/routes/agent.act.shared.ts +0 -52
- package/src/browser/routes/agent.act.ts +0 -575
- package/src/browser/routes/agent.debug.ts +0 -149
- package/src/browser/routes/agent.shared.ts +0 -143
- package/src/browser/routes/agent.snapshot.ts +0 -333
- package/src/browser/routes/agent.storage.ts +0 -451
- package/src/browser/routes/agent.ts +0 -13
- package/src/browser/routes/basic.ts +0 -202
- package/src/browser/routes/dispatcher.ts +0 -126
- package/src/browser/routes/index.ts +0 -11
- package/src/browser/routes/path-output.ts +0 -1
- package/src/browser/routes/tabs.ts +0 -217
- package/src/browser/routes/types.ts +0 -26
- package/src/browser/routes/utils.ts +0 -73
- package/src/browser/screenshot.ts +0 -54
- package/src/browser/server-context.ts +0 -688
- package/src/browser/server-context.types.ts +0 -65
- package/src/browser/server-lifecycle.ts +0 -48
- package/src/browser/server-middleware.ts +0 -37
- package/src/browser/server.ts +0 -110
- package/src/browser/target-id.ts +0 -30
- package/src/browser/trash.ts +0 -21
- package/src/cli-agent.ts +0 -2452
- package/src/cli-reset-password.ts +0 -138
- package/src/cli-serve.ts +0 -314
- package/src/cli.ts +0 -103
- package/src/dashboard/app.js +0 -579
- package/src/dashboard/assets/brand-logos.js +0 -350
- package/src/dashboard/assets/icons/emoji-icons.js +0 -893
- package/src/dashboard/assets/logo.png +0 -0
- package/src/dashboard/assets/provider-logos.js +0 -139
- package/src/dashboard/components/error-boundary.js +0 -21
- package/src/dashboard/components/help-button.js +0 -65
- package/src/dashboard/components/icons.js +0 -64
- package/src/dashboard/components/knowledge-link.js +0 -79
- package/src/dashboard/components/modal.js +0 -125
- package/src/dashboard/components/org-switcher.js +0 -156
- package/src/dashboard/components/persona-fields.js +0 -460
- package/src/dashboard/components/settings-help.js +0 -193
- package/src/dashboard/components/tag-input.js +0 -96
- package/src/dashboard/components/timezones.js +0 -352
- package/src/dashboard/components/transport-encryption.js +0 -288
- package/src/dashboard/components/utils.js +0 -205
- package/src/dashboard/data/countries.js +0 -255
- package/src/dashboard/docs/activity.html +0 -253
- package/src/dashboard/docs/agent-activity.html +0 -199
- package/src/dashboard/docs/agent-autonomy.html +0 -161
- package/src/dashboard/docs/agent-budget.html +0 -190
- package/src/dashboard/docs/agent-channels.html +0 -189
- package/src/dashboard/docs/agent-communication.html +0 -171
- package/src/dashboard/docs/agent-configuration.html +0 -194
- package/src/dashboard/docs/agent-deployment.html +0 -323
- package/src/dashboard/docs/agent-email.html +0 -184
- package/src/dashboard/docs/agent-guardrails.html +0 -206
- package/src/dashboard/docs/agent-manager.html +0 -226
- package/src/dashboard/docs/agent-memory.html +0 -215
- package/src/dashboard/docs/agent-overview.html +0 -226
- package/src/dashboard/docs/agent-permissions.html +0 -305
- package/src/dashboard/docs/agent-personal.html +0 -155
- package/src/dashboard/docs/agent-security.html +0 -188
- package/src/dashboard/docs/agent-skills.html +0 -224
- package/src/dashboard/docs/agent-tool-security.html +0 -205
- package/src/dashboard/docs/agent-tools.html +0 -238
- package/src/dashboard/docs/agent-whatsapp.html +0 -210
- package/src/dashboard/docs/agent-workforce.html +0 -199
- package/src/dashboard/docs/agents.html +0 -258
- package/src/dashboard/docs/approvals.html +0 -200
- package/src/dashboard/docs/audit.html +0 -206
- package/src/dashboard/docs/browser-providers.html +0 -313
- package/src/dashboard/docs/cluster.html +0 -285
- package/src/dashboard/docs/community-skills.html +0 -253
- package/src/dashboard/docs/compliance.html +0 -221
- package/src/dashboard/docs/dashboard.html +0 -84
- package/src/dashboard/docs/database-access.html +0 -322
- package/src/dashboard/docs/dlp.html +0 -268
- package/src/dashboard/docs/docs-style.css +0 -26
- package/src/dashboard/docs/domain-status.html +0 -294
- package/src/dashboard/docs/guardrails.html +0 -265
- package/src/dashboard/docs/journal.html +0 -197
- package/src/dashboard/docs/knowledge-contributions.html +0 -286
- package/src/dashboard/docs/knowledge.html +0 -268
- package/src/dashboard/docs/memory-transfer.html +0 -311
- package/src/dashboard/docs/messages.html +0 -217
- package/src/dashboard/docs/multi-tenant.html +0 -311
- package/src/dashboard/docs/org-chart.html +0 -239
- package/src/dashboard/docs/organizations.html +0 -182
- package/src/dashboard/docs/roles.html +0 -195
- package/src/dashboard/docs/settings-network.html +0 -321
- package/src/dashboard/docs/settings-security.html +0 -347
- package/src/dashboard/docs/settings-tool-security.html +0 -176
- package/src/dashboard/docs/settings.html +0 -280
- package/src/dashboard/docs/skill-connections.html +0 -270
- package/src/dashboard/docs/skills.html +0 -206
- package/src/dashboard/docs/task-pipeline.html +0 -261
- package/src/dashboard/docs/transport-encryption.html +0 -359
- package/src/dashboard/docs/users.html +0 -225
- package/src/dashboard/docs/vault.html +0 -260
- package/src/dashboard/docs/workforce.html +0 -245
- package/src/dashboard/index.html +0 -444
- package/src/dashboard/pages/activity.js +0 -379
- package/src/dashboard/pages/agent-detail/activity.js +0 -277
- package/src/dashboard/pages/agent-detail/autonomy.js +0 -244
- package/src/dashboard/pages/agent-detail/budget.js +0 -269
- package/src/dashboard/pages/agent-detail/channels.js +0 -494
- package/src/dashboard/pages/agent-detail/communication.js +0 -296
- package/src/dashboard/pages/agent-detail/configuration.js +0 -882
- package/src/dashboard/pages/agent-detail/deployment.js +0 -958
- package/src/dashboard/pages/agent-detail/email.js +0 -674
- package/src/dashboard/pages/agent-detail/guardrails.js +0 -521
- package/src/dashboard/pages/agent-detail/index.js +0 -261
- package/src/dashboard/pages/agent-detail/manager.js +0 -357
- package/src/dashboard/pages/agent-detail/meeting-browser.js +0 -933
- package/src/dashboard/pages/agent-detail/memory.js +0 -368
- package/src/dashboard/pages/agent-detail/overview.js +0 -844
- package/src/dashboard/pages/agent-detail/permissions.js +0 -1163
- package/src/dashboard/pages/agent-detail/personal-details.js +0 -404
- package/src/dashboard/pages/agent-detail/security.js +0 -409
- package/src/dashboard/pages/agent-detail/shared.js +0 -85
- package/src/dashboard/pages/agent-detail/skills-section.js +0 -183
- package/src/dashboard/pages/agent-detail/tool-security.js +0 -380
- package/src/dashboard/pages/agent-detail/tools.js +0 -322
- package/src/dashboard/pages/agent-detail/whatsapp.js +0 -824
- package/src/dashboard/pages/agent-detail/workforce.js +0 -683
- package/src/dashboard/pages/agents.js +0 -1242
- package/src/dashboard/pages/approvals.js +0 -100
- package/src/dashboard/pages/audit.js +0 -198
- package/src/dashboard/pages/cluster.js +0 -512
- package/src/dashboard/pages/community-skills.js +0 -1219
- package/src/dashboard/pages/compliance.js +0 -475
- package/src/dashboard/pages/dashboard.js +0 -180
- package/src/dashboard/pages/database-access.js +0 -812
- package/src/dashboard/pages/dlp.js +0 -293
- package/src/dashboard/pages/domain-status.js +0 -951
- package/src/dashboard/pages/guardrails.js +0 -1035
- package/src/dashboard/pages/journal.js +0 -172
- package/src/dashboard/pages/knowledge-contributions.js +0 -1682
- package/src/dashboard/pages/knowledge-import.js +0 -455
- package/src/dashboard/pages/knowledge.js +0 -582
- package/src/dashboard/pages/login.js +0 -1056
- package/src/dashboard/pages/memory-transfer.js +0 -631
- package/src/dashboard/pages/messages.js +0 -303
- package/src/dashboard/pages/org-chart.js +0 -349
- package/src/dashboard/pages/organizations.js +0 -1081
- package/src/dashboard/pages/roles.js +0 -780
- package/src/dashboard/pages/settings.js +0 -3790
- package/src/dashboard/pages/skill-connections.js +0 -982
- package/src/dashboard/pages/skills.js +0 -879
- package/src/dashboard/pages/task-pipeline.js +0 -684
- package/src/dashboard/pages/users.js +0 -867
- package/src/dashboard/pages/vault.js +0 -791
- package/src/dashboard/pages/workforce.js +0 -851
- package/src/dashboard/vendor/react-dom.development.js +0 -29924
- package/src/dashboard/vendor/react-dom.production.min.js +0 -267
- package/src/dashboard/vendor/react.development.js +0 -3343
- package/src/dashboard/vendor/react.production.min.js +0 -31
- package/src/database-access/agent-tools.ts +0 -193
- package/src/database-access/connection-manager.ts +0 -1341
- package/src/database-access/index.ts +0 -21
- package/src/database-access/query-sanitizer.ts +0 -220
- package/src/database-access/routes.ts +0 -226
- package/src/database-access/types.ts +0 -226
- package/src/db/adapter.ts +0 -510
- package/src/db/dynamodb.ts +0 -454
- package/src/db/factory.ts +0 -129
- package/src/db/mongodb.ts +0 -360
- package/src/db/mysql.ts +0 -531
- package/src/db/postgres.ts +0 -863
- package/src/db/proxy.ts +0 -39
- package/src/db/resolve-driver.ts +0 -29
- package/src/db/sql-schema.ts +0 -124
- package/src/db/sqlite.ts +0 -493
- package/src/db/turso.ts +0 -470
- package/src/deploy/fly.ts +0 -368
- package/src/deploy/managed.ts +0 -235
- package/src/domain-lock/cli-recover.ts +0 -591
- package/src/domain-lock/cli-verify.ts +0 -190
- package/src/domain-lock/index.ts +0 -220
- package/src/engine/activity-routes.ts +0 -154
- package/src/engine/activity.ts +0 -568
- package/src/engine/agent-autonomy.ts +0 -974
- package/src/engine/agent-config.ts +0 -646
- package/src/engine/agent-heartbeat.ts +0 -720
- package/src/engine/agent-hierarchy.ts +0 -1064
- package/src/engine/agent-memory.ts +0 -806
- package/src/engine/agent-notify.ts +0 -50
- package/src/engine/agent-routes.ts +0 -2583
- package/src/engine/agent-status.ts +0 -311
- package/src/engine/ambient-memory.ts +0 -401
- package/src/engine/approvals.ts +0 -615
- package/src/engine/assets/thinking-hum.mp3 +0 -0
- package/src/engine/catalog-routes.ts +0 -232
- package/src/engine/chat-poller.ts +0 -913
- package/src/engine/chat-webhook-routes.ts +0 -304
- package/src/engine/cli-build-skill.ts +0 -285
- package/src/engine/cli-submit-skill.ts +0 -200
- package/src/engine/cli-validate.ts +0 -188
- package/src/engine/cluster.ts +0 -278
- package/src/engine/communication-routes.ts +0 -139
- package/src/engine/communication.ts +0 -765
- package/src/engine/community-registry.ts +0 -1529
- package/src/engine/community-routes.ts +0 -260
- package/src/engine/compliance-routes.ts +0 -133
- package/src/engine/compliance.ts +0 -1679
- package/src/engine/config-bus.ts +0 -103
- package/src/engine/db-adapter.ts +0 -1156
- package/src/engine/db-schema.ts +0 -1945
- package/src/engine/deploy-schema-routes.ts +0 -176
- package/src/engine/deployer.ts +0 -957
- package/src/engine/dlp-routes.ts +0 -101
- package/src/engine/dlp.ts +0 -410
- package/src/engine/email-poller.ts +0 -855
- package/src/engine/emoji.ts +0 -106
- package/src/engine/guardrail-routes.ts +0 -125
- package/src/engine/guardrails.ts +0 -465
- package/src/engine/index.ts +0 -255
- package/src/engine/journal-routes.ts +0 -56
- package/src/engine/journal.ts +0 -249
- package/src/engine/knowledge-contribution-routes.ts +0 -633
- package/src/engine/knowledge-contribution.ts +0 -1386
- package/src/engine/knowledge-import/chunker.ts +0 -241
- package/src/engine/knowledge-import/import-manager.ts +0 -416
- package/src/engine/knowledge-import/index.ts +0 -27
- package/src/engine/knowledge-import/processors/clean.ts +0 -149
- package/src/engine/knowledge-import/processors/extract-gdrive.ts +0 -102
- package/src/engine/knowledge-import/processors/extract-github.ts +0 -74
- package/src/engine/knowledge-import/processors/extract-sharepoint.ts +0 -69
- package/src/engine/knowledge-import/processors/extract-web.ts +0 -275
- package/src/engine/knowledge-import/processors/index.ts +0 -18
- package/src/engine/knowledge-import/processors/pipeline.ts +0 -171
- package/src/engine/knowledge-import/processors/types.ts +0 -78
- package/src/engine/knowledge-import/processors/validate.ts +0 -150
- package/src/engine/knowledge-import/provider-file-upload.ts +0 -95
- package/src/engine/knowledge-import/provider-github.ts +0 -144
- package/src/engine/knowledge-import/provider-google-sites.ts +0 -323
- package/src/engine/knowledge-import/provider-sharepoint.ts +0 -276
- package/src/engine/knowledge-import/provider-url.ts +0 -218
- package/src/engine/knowledge-import/routes.ts +0 -94
- package/src/engine/knowledge-import/types.ts +0 -92
- package/src/engine/knowledge-routes.ts +0 -231
- package/src/engine/knowledge.ts +0 -587
- package/src/engine/lifecycle.ts +0 -1420
- package/src/engine/mcp-process-manager.ts +0 -573
- package/src/engine/meeting-monitor.ts +0 -483
- package/src/engine/meeting-voice-intelligence.ts +0 -340
- package/src/engine/memory-routes.ts +0 -142
- package/src/engine/memory-transfer-routes.ts +0 -339
- package/src/engine/messaging-history.ts +0 -177
- package/src/engine/messaging-poller.ts +0 -786
- package/src/engine/model-fallback.ts +0 -141
- package/src/engine/oauth-connect-routes.ts +0 -603
- package/src/engine/oauth-connect.ts +0 -304
- package/src/engine/onboarding-routes.ts +0 -148
- package/src/engine/onboarding.ts +0 -574
- package/src/engine/org-approval-routes.ts +0 -146
- package/src/engine/org-integration-routes.ts +0 -399
- package/src/engine/org-integrations.ts +0 -608
- package/src/engine/org-policies.ts +0 -502
- package/src/engine/policy-import-routes.ts +0 -125
- package/src/engine/policy-import.ts +0 -1186
- package/src/engine/policy-routes.ts +0 -163
- package/src/engine/routes.ts +0 -1236
- package/src/engine/screen-unlock.ts +0 -136
- package/src/engine/session-router.ts +0 -212
- package/src/engine/skill-updater-routes.ts +0 -132
- package/src/engine/skill-updater.ts +0 -480
- package/src/engine/skill-validator.ts +0 -331
- package/src/engine/skills/agent-management.ts +0 -119
- package/src/engine/skills/agent-memory.ts +0 -19
- package/src/engine/skills/agenticmail.ts +0 -116
- package/src/engine/skills/core-tools.ts +0 -25
- package/src/engine/skills/database-access.ts +0 -78
- package/src/engine/skills/enterprise-code-sandbox.ts +0 -113
- package/src/engine/skills/enterprise-database.ts +0 -123
- package/src/engine/skills/enterprise-diff.ts +0 -95
- package/src/engine/skills/enterprise-documents.ts +0 -162
- package/src/engine/skills/enterprise-http.ts +0 -99
- package/src/engine/skills/enterprise-security-scan.ts +0 -125
- package/src/engine/skills/enterprise-spreadsheet.ts +0 -171
- package/src/engine/skills/gws-admin.ts +0 -18
- package/src/engine/skills/gws-calendar.ts +0 -21
- package/src/engine/skills/gws-chat.ts +0 -29
- package/src/engine/skills/gws-contacts.ts +0 -20
- package/src/engine/skills/gws-docs.ts +0 -18
- package/src/engine/skills/gws-drive.ts +0 -23
- package/src/engine/skills/gws-forms.ts +0 -23
- package/src/engine/skills/gws-gmail.ts +0 -30
- package/src/engine/skills/gws-groups.ts +0 -17
- package/src/engine/skills/gws-keep.ts +0 -17
- package/src/engine/skills/gws-maps.ts +0 -25
- package/src/engine/skills/gws-meet.ts +0 -23
- package/src/engine/skills/gws-sheets.ts +0 -22
- package/src/engine/skills/gws-sites.ts +0 -16
- package/src/engine/skills/gws-slides.ts +0 -27
- package/src/engine/skills/gws-tasks.ts +0 -22
- package/src/engine/skills/gws-vault.ts +0 -17
- package/src/engine/skills/index.ts +0 -159
- package/src/engine/skills/knowledge-search.ts +0 -18
- package/src/engine/skills/local-system.ts +0 -61
- package/src/engine/skills/m365-admin.ts +0 -18
- package/src/engine/skills/m365-bookings.ts +0 -17
- package/src/engine/skills/m365-copilot.ts +0 -17
- package/src/engine/skills/m365-excel.ts +0 -60
- package/src/engine/skills/m365-forms.ts +0 -17
- package/src/engine/skills/m365-onedrive.ts +0 -60
- package/src/engine/skills/m365-onenote.ts +0 -17
- package/src/engine/skills/m365-outlook.ts +0 -27
- package/src/engine/skills/m365-planner.ts +0 -18
- package/src/engine/skills/m365-power-automate.ts +0 -18
- package/src/engine/skills/m365-power-bi.ts +0 -19
- package/src/engine/skills/m365-powerpoint.ts +0 -33
- package/src/engine/skills/m365-sharepoint.ts +0 -20
- package/src/engine/skills/m365-teams.ts +0 -21
- package/src/engine/skills/m365-todo.ts +0 -17
- package/src/engine/skills/m365-whiteboard.ts +0 -16
- package/src/engine/skills/m365-word.ts +0 -42
- package/src/engine/skills/mcp-bridge.ts +0 -45
- package/src/engine/skills/meeting-lifecycle.ts +0 -20
- package/src/engine/skills/messaging.ts +0 -46
- package/src/engine/skills/visual-memory.ts +0 -25
- package/src/engine/skills.ts +0 -688
- package/src/engine/soul-library.ts +0 -142
- package/src/engine/soul-templates.json +0 -1525
- package/src/engine/storage-manager.ts +0 -252
- package/src/engine/storage-routes.ts +0 -113
- package/src/engine/storage.ts +0 -528
- package/src/engine/task-poller.ts +0 -394
- package/src/engine/task-queue-after-spawn.ts +0 -66
- package/src/engine/task-queue-before-spawn.ts +0 -113
- package/src/engine/task-queue-routes.ts +0 -161
- package/src/engine/task-queue.ts +0 -664
- package/src/engine/tenant.ts +0 -409
- package/src/engine/tool-catalog.ts +0 -354
- package/src/engine/vault-routes.ts +0 -134
- package/src/engine/vault.ts +0 -601
- package/src/engine/workforce-routes.ts +0 -331
- package/src/engine/workforce.ts +0 -1161
- package/src/index.ts +0 -77
- package/src/lib/cidr.ts +0 -122
- package/src/lib/config-store.ts +0 -86
- package/src/lib/resilience.ts +0 -326
- package/src/lib/text-search.ts +0 -358
- package/src/mcp/adapters/activecampaign.adapter.ts +0 -391
- package/src/mcp/adapters/adobe-sign.adapter.ts +0 -469
- package/src/mcp/adapters/adp.adapter.ts +0 -358
- package/src/mcp/adapters/airtable.adapter.ts +0 -273
- package/src/mcp/adapters/apollo.adapter.ts +0 -420
- package/src/mcp/adapters/asana.adapter.ts +0 -315
- package/src/mcp/adapters/auth0.adapter.ts +0 -386
- package/src/mcp/adapters/aws.adapter.ts +0 -345
- package/src/mcp/adapters/azure-devops.adapter.ts +0 -389
- package/src/mcp/adapters/bamboohr.adapter.ts +0 -376
- package/src/mcp/adapters/basecamp.adapter.ts +0 -366
- package/src/mcp/adapters/bigcommerce.adapter.ts +0 -429
- package/src/mcp/adapters/bitbucket.adapter.ts +0 -260
- package/src/mcp/adapters/box.adapter.ts +0 -350
- package/src/mcp/adapters/brex.adapter.ts +0 -367
- package/src/mcp/adapters/buffer.adapter.ts +0 -303
- package/src/mcp/adapters/calendly.adapter.ts +0 -262
- package/src/mcp/adapters/canva.adapter.ts +0 -256
- package/src/mcp/adapters/chargebee.adapter.ts +0 -448
- package/src/mcp/adapters/circleci.adapter.ts +0 -216
- package/src/mcp/adapters/clickup.adapter.ts +0 -335
- package/src/mcp/adapters/close.adapter.ts +0 -390
- package/src/mcp/adapters/cloudflare.adapter.ts +0 -378
- package/src/mcp/adapters/confluence.adapter.ts +0 -301
- package/src/mcp/adapters/contentful.adapter.ts +0 -355
- package/src/mcp/adapters/copper.adapter.ts +0 -468
- package/src/mcp/adapters/crisp.adapter.ts +0 -415
- package/src/mcp/adapters/crowdstrike.adapter.ts +0 -413
- package/src/mcp/adapters/datadog.adapter.ts +0 -373
- package/src/mcp/adapters/digitalocean.adapter.ts +0 -336
- package/src/mcp/adapters/discord.adapter.ts +0 -248
- package/src/mcp/adapters/docker.adapter.ts +0 -238
- package/src/mcp/adapters/docusign.adapter.ts +0 -431
- package/src/mcp/adapters/drift.adapter.ts +0 -386
- package/src/mcp/adapters/dropbox.adapter.ts +0 -315
- package/src/mcp/adapters/figma.adapter.ts +0 -302
- package/src/mcp/adapters/firebase.adapter.ts +0 -446
- package/src/mcp/adapters/flyio.adapter.ts +0 -302
- package/src/mcp/adapters/freshbooks.adapter.ts +0 -474
- package/src/mcp/adapters/freshdesk.adapter.ts +0 -441
- package/src/mcp/adapters/freshsales.adapter.ts +0 -457
- package/src/mcp/adapters/freshservice.adapter.ts +0 -481
- package/src/mcp/adapters/front.adapter.ts +0 -357
- package/src/mcp/adapters/github-actions.adapter.ts +0 -329
- package/src/mcp/adapters/github.adapter.ts +0 -387
- package/src/mcp/adapters/gitlab.adapter.ts +0 -368
- package/src/mcp/adapters/gong.adapter.ts +0 -386
- package/src/mcp/adapters/google-ads.adapter.ts +0 -363
- package/src/mcp/adapters/google-analytics.adapter.ts +0 -316
- package/src/mcp/adapters/google-cloud.adapter.ts +0 -312
- package/src/mcp/adapters/gotomeeting.adapter.ts +0 -255
- package/src/mcp/adapters/grafana.adapter.ts +0 -361
- package/src/mcp/adapters/greenhouse.adapter.ts +0 -354
- package/src/mcp/adapters/gusto.adapter.ts +0 -329
- package/src/mcp/adapters/hashicorp-vault.adapter.ts +0 -355
- package/src/mcp/adapters/heroku.adapter.ts +0 -291
- package/src/mcp/adapters/hibob.adapter.ts +0 -334
- package/src/mcp/adapters/hootsuite.adapter.ts +0 -322
- package/src/mcp/adapters/hubspot.adapter.ts +0 -400
- package/src/mcp/adapters/huggingface.adapter.ts +0 -349
- package/src/mcp/adapters/index.ts +0 -524
- package/src/mcp/adapters/intercom.adapter.ts +0 -269
- package/src/mcp/adapters/jira.adapter.ts +0 -482
- package/src/mcp/adapters/klaviyo.adapter.ts +0 -353
- package/src/mcp/adapters/kubernetes.adapter.ts +0 -431
- package/src/mcp/adapters/lattice.adapter.ts +0 -339
- package/src/mcp/adapters/launchdarkly.adapter.ts +0 -368
- package/src/mcp/adapters/lever.adapter.ts +0 -347
- package/src/mcp/adapters/linear.adapter.ts +0 -300
- package/src/mcp/adapters/linkedin.adapter.ts +0 -331
- package/src/mcp/adapters/livechat.adapter.ts +0 -259
- package/src/mcp/adapters/loom.adapter.ts +0 -230
- package/src/mcp/adapters/mailchimp.adapter.ts +0 -394
- package/src/mcp/adapters/mailgun.adapter.ts +0 -425
- package/src/mcp/adapters/miro.adapter.ts +0 -274
- package/src/mcp/adapters/mixpanel.adapter.ts +0 -324
- package/src/mcp/adapters/monday.adapter.ts +0 -308
- package/src/mcp/adapters/mongodb-atlas.adapter.ts +0 -345
- package/src/mcp/adapters/neon.adapter.ts +0 -312
- package/src/mcp/adapters/netlify.adapter.ts +0 -324
- package/src/mcp/adapters/netsuite.adapter.ts +0 -411
- package/src/mcp/adapters/newrelic.adapter.ts +0 -339
- package/src/mcp/adapters/notion.adapter.ts +0 -338
- package/src/mcp/adapters/okta.adapter.ts +0 -394
- package/src/mcp/adapters/openai.adapter.ts +0 -315
- package/src/mcp/adapters/opsgenie.adapter.ts +0 -375
- package/src/mcp/adapters/outreach.adapter.ts +0 -372
- package/src/mcp/adapters/paddle.adapter.ts +0 -467
- package/src/mcp/adapters/pagerduty.adapter.ts +0 -412
- package/src/mcp/adapters/pandadoc.adapter.ts +0 -389
- package/src/mcp/adapters/paypal.adapter.ts +0 -465
- package/src/mcp/adapters/personio.adapter.ts +0 -401
- package/src/mcp/adapters/pinecone.adapter.ts +0 -340
- package/src/mcp/adapters/pipedrive.adapter.ts +0 -324
- package/src/mcp/adapters/plaid.adapter.ts +0 -444
- package/src/mcp/adapters/postmark.adapter.ts +0 -387
- package/src/mcp/adapters/power-automate.adapter.ts +0 -388
- package/src/mcp/adapters/quickbooks.adapter.ts +0 -431
- package/src/mcp/adapters/recurly.adapter.ts +0 -433
- package/src/mcp/adapters/reddit.adapter.ts +0 -371
- package/src/mcp/adapters/render.adapter.ts +0 -332
- package/src/mcp/adapters/ringcentral.adapter.ts +0 -281
- package/src/mcp/adapters/rippling.adapter.ts +0 -287
- package/src/mcp/adapters/salesforce.adapter.ts +0 -321
- package/src/mcp/adapters/salesloft.adapter.ts +0 -413
- package/src/mcp/adapters/sanity.adapter.ts +0 -363
- package/src/mcp/adapters/sap.adapter.ts +0 -483
- package/src/mcp/adapters/segment.adapter.ts +0 -260
- package/src/mcp/adapters/sendgrid.adapter.ts +0 -265
- package/src/mcp/adapters/sentry.adapter.ts +0 -331
- package/src/mcp/adapters/servicenow.adapter.ts +0 -468
- package/src/mcp/adapters/shopify.adapter.ts +0 -451
- package/src/mcp/adapters/shortcut.adapter.ts +0 -290
- package/src/mcp/adapters/slack.adapter.ts +0 -380
- package/src/mcp/adapters/smartsheet.adapter.ts +0 -326
- package/src/mcp/adapters/snowflake.adapter.ts +0 -347
- package/src/mcp/adapters/snyk.adapter.ts +0 -394
- package/src/mcp/adapters/splunk.adapter.ts +0 -403
- package/src/mcp/adapters/square.adapter.ts +0 -467
- package/src/mcp/adapters/statuspage.adapter.ts +0 -401
- package/src/mcp/adapters/stripe.adapter.ts +0 -380
- package/src/mcp/adapters/supabase.adapter.ts +0 -334
- package/src/mcp/adapters/teamwork.adapter.ts +0 -404
- package/src/mcp/adapters/telegram.adapter.ts +0 -299
- package/src/mcp/adapters/terraform.adapter.ts +0 -300
- package/src/mcp/adapters/todoist.adapter.ts +0 -239
- package/src/mcp/adapters/trello.adapter.ts +0 -316
- package/src/mcp/adapters/twilio.adapter.ts +0 -233
- package/src/mcp/adapters/twitter.adapter.ts +0 -348
- package/src/mcp/adapters/vercel.adapter.ts +0 -219
- package/src/mcp/adapters/weaviate.adapter.ts +0 -371
- package/src/mcp/adapters/webex.adapter.ts +0 -237
- package/src/mcp/adapters/webflow.adapter.ts +0 -287
- package/src/mcp/adapters/whatsapp.adapter.ts +0 -273
- package/src/mcp/adapters/whereby.adapter.ts +0 -240
- package/src/mcp/adapters/woocommerce.adapter.ts +0 -454
- package/src/mcp/adapters/wordpress.adapter.ts +0 -455
- package/src/mcp/adapters/workday.adapter.ts +0 -354
- package/src/mcp/adapters/wrike.adapter.ts +0 -349
- package/src/mcp/adapters/xero.adapter.ts +0 -472
- package/src/mcp/adapters/youtube.adapter.ts +0 -401
- package/src/mcp/adapters/zendesk.adapter.ts +0 -399
- package/src/mcp/adapters/zoho-crm.adapter.ts +0 -410
- package/src/mcp/adapters/zoom.adapter.ts +0 -241
- package/src/mcp/adapters/zuora.adapter.ts +0 -476
- package/src/mcp/framework/api-executor.ts +0 -192
- package/src/mcp/framework/aws-sigv4.ts +0 -216
- package/src/mcp/framework/credential-resolver.ts +0 -128
- package/src/mcp/framework/oauth-token-manager.ts +0 -22
- package/src/mcp/framework/skill-mcp-framework.ts +0 -226
- package/src/mcp/framework/types.ts +0 -130
- package/src/mcp/index.ts +0 -124
- package/src/mcp/integration-catalog.ts +0 -178
- package/src/middleware/dns-rebinding.ts +0 -44
- package/src/middleware/egress-filter.ts +0 -104
- package/src/middleware/firewall.ts +0 -192
- package/src/middleware/geo-ip.ts +0 -156
- package/src/middleware/index.ts +0 -390
- package/src/middleware/network-config.ts +0 -90
- package/src/middleware/proxy-config.ts +0 -71
- package/src/middleware/request-limits.ts +0 -59
- package/src/middleware/transport-encryption.ts +0 -398
- package/src/registry/cli.ts +0 -63
- package/src/registry/server.ts +0 -504
- package/src/runtime/agent-loop.ts +0 -779
- package/src/runtime/compaction.ts +0 -638
- package/src/runtime/email-channel.ts +0 -120
- package/src/runtime/environment.ts +0 -300
- package/src/runtime/followup.ts +0 -211
- package/src/runtime/gateway.ts +0 -260
- package/src/runtime/hooks.ts +0 -564
- package/src/runtime/index.ts +0 -1110
- package/src/runtime/llm-client.ts +0 -1056
- package/src/runtime/model-router.ts +0 -97
- package/src/runtime/providers.ts +0 -228
- package/src/runtime/session-manager.ts +0 -345
- package/src/runtime/subagent.ts +0 -153
- package/src/runtime/tool-executor.ts +0 -208
- package/src/runtime/types.ts +0 -255
- package/src/security/brute-force.ts +0 -423
- package/src/security/config.ts +0 -159
- package/src/security/csp.ts +0 -407
- package/src/security/external-content.ts +0 -299
- package/src/security/index.ts +0 -557
- package/src/security/input-sanitizer.ts +0 -452
- package/src/security/output-filter.ts +0 -575
- package/src/security/port-scanner.ts +0 -342
- package/src/security/prompt-guard.ts +0 -387
- package/src/security/sql-guard.ts +0 -338
- package/src/security/threat-logger.ts +0 -484
- package/src/server.ts +0 -828
- package/src/setup/company.ts +0 -183
- package/src/setup/database.ts +0 -153
- package/src/setup/deployment.ts +0 -561
- package/src/setup/domain.ts +0 -112
- package/src/setup/index.ts +0 -171
- package/src/setup/provision.ts +0 -532
- package/src/setup/registration.ts +0 -302
- package/src/system-prompts/catchup.ts +0 -48
- package/src/system-prompts/google/calendar.ts +0 -37
- package/src/system-prompts/google/chat.ts +0 -92
- package/src/system-prompts/google/contacts.ts +0 -25
- package/src/system-prompts/google/docs.ts +0 -29
- package/src/system-prompts/google/drive.ts +0 -34
- package/src/system-prompts/google/forms.ts +0 -25
- package/src/system-prompts/google/gmail.ts +0 -50
- package/src/system-prompts/google/index.ts +0 -23
- package/src/system-prompts/google/maps.ts +0 -20
- package/src/system-prompts/google/meet.ts +0 -130
- package/src/system-prompts/google/sheets.ts +0 -32
- package/src/system-prompts/google/slides.ts +0 -26
- package/src/system-prompts/google/tasks.ts +0 -27
- package/src/system-prompts/index.ts +0 -88
- package/src/system-prompts/microsoft/contacts.ts +0 -34
- package/src/system-prompts/microsoft/excel.ts +0 -52
- package/src/system-prompts/microsoft/index.ts +0 -31
- package/src/system-prompts/microsoft/onedrive.ts +0 -41
- package/src/system-prompts/microsoft/onenote.ts +0 -36
- package/src/system-prompts/microsoft/outlook-calendar.ts +0 -37
- package/src/system-prompts/microsoft/outlook-mail.ts +0 -46
- package/src/system-prompts/microsoft/planner.ts +0 -37
- package/src/system-prompts/microsoft/powerbi.ts +0 -38
- package/src/system-prompts/microsoft/powerpoint.ts +0 -35
- package/src/system-prompts/microsoft/sharepoint.ts +0 -44
- package/src/system-prompts/microsoft/teams.ts +0 -49
- package/src/system-prompts/microsoft/todo.ts +0 -37
- package/src/system-prompts/shared-blocks.ts +0 -87
- package/src/system-prompts/task.ts +0 -21
- package/src/system-prompts/triage.ts +0 -34
- package/src/types/hono-env.ts +0 -18
- package/src/types/optional-deps.d.ts +0 -10
- /package/{src → dist}/dashboard/HELP-TOOLTIPS-GUIDE.md +0 -0
|
@@ -1,3790 +0,0 @@
|
|
|
1
|
-
import { h, useState, useEffect, useCallback, useRef, Fragment, useApp, apiCall, engineCall, applyBrandColor, showConfirm, setOrgId, getOrgId } from '../components/utils.js';
|
|
2
|
-
import { I } from '../components/icons.js';
|
|
3
|
-
import { E } from '../assets/icons/emoji-icons.js';
|
|
4
|
-
import { Modal } from '../components/modal.js';
|
|
5
|
-
import { TagInput } from '../components/tag-input.js';
|
|
6
|
-
import { COUNTRIES } from '../data/countries.js?v=6';
|
|
7
|
-
import { HelpButton } from '../components/help-button.js';
|
|
8
|
-
import { SETTINGS_HELP } from '../components/settings-help.js';
|
|
9
|
-
import { KnowledgeLink, SETTINGS_TAB_DOCS } from '../components/knowledge-link.js';
|
|
10
|
-
import { ProviderLogo } from '../assets/provider-logos.js';
|
|
11
|
-
import { useOrgContext } from '../components/org-switcher.js';
|
|
12
|
-
|
|
13
|
-
export function SettingsPage() {
|
|
14
|
-
const { toast, setCompanyName } = useApp();
|
|
15
|
-
var orgCtx = useOrgContext();
|
|
16
|
-
var effectiveOrgId = orgCtx.selectedOrgId || '';
|
|
17
|
-
const [tab, setTab] = useState('general');
|
|
18
|
-
const [settings, setSettings] = useState({});
|
|
19
|
-
const [apiKeys, setApiKeys] = useState([]);
|
|
20
|
-
const [keyName, setKeyName] = useState('');
|
|
21
|
-
const [newKeyPlaintext, setNewKeyPlaintext] = useState(null);
|
|
22
|
-
const [keyCopied, setKeyCopied] = useState(false);
|
|
23
|
-
const [ssoConfig, setSsoConfig] = useState({});
|
|
24
|
-
const [deployCreds, setDeployCreds] = useState([]);
|
|
25
|
-
const [showDeployModal, setShowDeployModal] = useState(false);
|
|
26
|
-
const [deployForm, setDeployForm] = useState({ name: '', targetType: 'docker', config: {} });
|
|
27
|
-
const [toolSec, setToolSec] = useState({ security: {}, middleware: {} });
|
|
28
|
-
const [toolSecDirty, setToolSecDirty] = useState(false);
|
|
29
|
-
const [toolSecSaving, setToolSecSaving] = useState(false);
|
|
30
|
-
var _fw = useState({});
|
|
31
|
-
var fw = _fw[0]; var setFw = _fw[1];
|
|
32
|
-
var _fwDirty = useState(false);
|
|
33
|
-
var fwDirty = _fwDirty[0]; var setFwDirty = _fwDirty[1];
|
|
34
|
-
var _fwSaving = useState(false);
|
|
35
|
-
var fwSaving = _fwSaving[0]; var setFwSaving = _fwSaving[1];
|
|
36
|
-
var _fwTestIp = useState('');
|
|
37
|
-
var fwTestIp = _fwTestIp[0]; var setFwTestIp = _fwTestIp[1];
|
|
38
|
-
var _fwTestResult = useState(null);
|
|
39
|
-
var fwTestResult = _fwTestResult[0]; var setFwTestResult = _fwTestResult[1];
|
|
40
|
-
var _pricing = useState({ models: [], currency: 'USD' });
|
|
41
|
-
var pricing = _pricing[0]; var setPricing = _pricing[1];
|
|
42
|
-
var _pricingDirty = useState(false);
|
|
43
|
-
var pricingDirty = _pricingDirty[0]; var setPricingDirty = _pricingDirty[1];
|
|
44
|
-
var _pricingSaving = useState(false);
|
|
45
|
-
var pricingSaving = _pricingSaving[0]; var setPricingSaving = _pricingSaving[1];
|
|
46
|
-
var _showAddModel = useState(false);
|
|
47
|
-
var showAddModel = _showAddModel[0]; var setShowAddModel = _showAddModel[1];
|
|
48
|
-
var _newModel = useState({ provider: 'anthropic', modelId: '', displayName: '', inputCostPerMillion: 0, outputCostPerMillion: 0, contextWindow: 0 });
|
|
49
|
-
var newModel = _newModel[0]; var setNewModel = _newModel[1];
|
|
50
|
-
var _providers = useState([]);
|
|
51
|
-
var providers = _providers[0]; var setProviders = _providers[1];
|
|
52
|
-
var _showAddProvider = useState(false);
|
|
53
|
-
var showAddProvider = _showAddProvider[0]; var setShowAddProvider = _showAddProvider[1];
|
|
54
|
-
var _newProvider = useState({ id: '', name: '', baseUrl: '', apiType: 'openai-compatible', apiKeyEnvVar: '', customHeaders: '' });
|
|
55
|
-
var newProvider = _newProvider[0]; var setNewProvider = _newProvider[1];
|
|
56
|
-
var _discoverResults = useState({});
|
|
57
|
-
var discoverResults = _discoverResults[0]; var setDiscoverResults = _discoverResults[1];
|
|
58
|
-
var _apiKeyModal = useState(null); // { providerId, providerName, isUpdate }
|
|
59
|
-
var apiKeyModal = _apiKeyModal[0]; var setApiKeyModal = _apiKeyModal[1];
|
|
60
|
-
var _apiKeyInput = useState('');
|
|
61
|
-
var apiKeyInput = _apiKeyInput[0]; var setApiKeyInput = _apiKeyInput[1];
|
|
62
|
-
|
|
63
|
-
// Org Email Config
|
|
64
|
-
var _orgEmail = useState({ configured: false, provider: '', oauthClientId: '', oauthClientSecret: '', oauthTenantId: 'common', label: '' });
|
|
65
|
-
var orgEmail = _orgEmail[0]; var setOrgEmail = _orgEmail[1];
|
|
66
|
-
var _orgEmailSaving = useState(false);
|
|
67
|
-
var orgEmailSaving = _orgEmailSaving[0]; var setOrgEmailSaving = _orgEmailSaving[1];
|
|
68
|
-
|
|
69
|
-
// Security System Config
|
|
70
|
-
var _securityConfig = useState({});
|
|
71
|
-
var securityConfig = _securityConfig[0]; var setSecurityConfig = _securityConfig[1];
|
|
72
|
-
var _securityDirty = useState(false);
|
|
73
|
-
var securityDirty = _securityDirty[0]; var setSecurityDirty = _securityDirty[1];
|
|
74
|
-
var _securitySaving = useState(false);
|
|
75
|
-
var securitySaving = _securitySaving[0]; var setSecuritySaving = _securitySaving[1];
|
|
76
|
-
var _securityEvents = useState([]);
|
|
77
|
-
var securityEvents = _securityEvents[0]; var setSecurityEvents = _securityEvents[1];
|
|
78
|
-
var _portScanResult = useState(null);
|
|
79
|
-
var portScanResult = _portScanResult[0]; var setPortScanResult = _portScanResult[1];
|
|
80
|
-
|
|
81
|
-
// Org integrations state (for org-scoped view)
|
|
82
|
-
var _orgIntegrations = useState([]);
|
|
83
|
-
var orgIntegrations = _orgIntegrations[0]; var setOrgIntegrations = _orgIntegrations[1];
|
|
84
|
-
var _orgIntLoading = useState(false);
|
|
85
|
-
var orgIntLoading = _orgIntLoading[0]; var setOrgIntLoading = _orgIntLoading[1];
|
|
86
|
-
var _showAddIntegration = useState(false);
|
|
87
|
-
var showAddIntegration = _showAddIntegration[0]; var setShowAddIntegration = _showAddIntegration[1];
|
|
88
|
-
var _orgIntForm = useState({ type: 'google', name: '' });
|
|
89
|
-
var orgIntForm = _orgIntForm[0]; var setOrgIntForm = _orgIntForm[1];
|
|
90
|
-
|
|
91
|
-
// Org-scoped tabs vs system tabs
|
|
92
|
-
var ORG_TABS = ['models', 'email', 'integrations', 'authentication'];
|
|
93
|
-
var SYSTEM_TABS = ['general', 'models', 'api-keys', 'authentication', 'platform', 'email', 'deployments', 'security-system', 'tool-security', 'network'];
|
|
94
|
-
var TAB_LABELS = { general: 'General', models: 'Models & API Keys', 'api-keys': 'API Keys', authentication: 'Authentication', platform: 'Platform', email: 'Email & Domain', deployments: 'Deployments', 'security-system': 'Security', 'tool-security': 'Tool Security', network: 'Network & Firewall', integrations: 'Integrations' };
|
|
95
|
-
var TAB_ICONS = { general: I.settings, models: I.key, 'api-keys': I.key, authentication: I.shield, platform: I.globe, email: I.messages, deployments: I.upload, 'security-system': I.lock, 'tool-security': I.guardrails, network: I.globe, integrations: I.link };
|
|
96
|
-
var activeTabs = effectiveOrgId ? ORG_TABS : SYSTEM_TABS;
|
|
97
|
-
|
|
98
|
-
// Reset tab when switching between org/system view
|
|
99
|
-
useEffect(function() {
|
|
100
|
-
if (effectiveOrgId && activeTabs.indexOf(tab) === -1) setTab('models');
|
|
101
|
-
if (!effectiveOrgId && tab === 'integrations') setTab('general');
|
|
102
|
-
}, [effectiveOrgId]);
|
|
103
|
-
|
|
104
|
-
// Load org integrations when org changes
|
|
105
|
-
useEffect(function() {
|
|
106
|
-
if (!effectiveOrgId) { setOrgIntegrations([]); return; }
|
|
107
|
-
setOrgIntLoading(true);
|
|
108
|
-
engineCall('/org-integrations?orgId=' + effectiveOrgId)
|
|
109
|
-
.then(function(d) { setOrgIntegrations(d.integrations || []); })
|
|
110
|
-
.catch(function() { setOrgIntegrations([]); })
|
|
111
|
-
.finally(function() { setOrgIntLoading(false); });
|
|
112
|
-
}, [effectiveOrgId]);
|
|
113
|
-
|
|
114
|
-
var loadOrgIntegrations = function() {
|
|
115
|
-
if (!effectiveOrgId) return;
|
|
116
|
-
engineCall('/org-integrations?orgId=' + effectiveOrgId)
|
|
117
|
-
.then(function(d) { setOrgIntegrations(d.integrations || []); })
|
|
118
|
-
.catch(function() {});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
apiCall('/settings').then(d => { const s = d.settings || d || {}; setSettings(s); if (s.primaryColor) applyBrandColor(s.primaryColor); if (s.orgId) setOrgId(s.orgId); }).catch(() => {});
|
|
123
|
-
apiCall('/api-keys').then(d => setApiKeys(d.keys || [])).catch(() => {});
|
|
124
|
-
apiCall('/settings/sso').then(d => {
|
|
125
|
-
const sso = d.ssoConfig || {};
|
|
126
|
-
setSsoConfig(sso);
|
|
127
|
-
setSettings(s => ({
|
|
128
|
-
...s,
|
|
129
|
-
samlEntityId: sso.saml?.entityId || '', samlSsoUrl: sso.saml?.ssoUrl || '', samlCertificate: sso.saml?.certificate || '',
|
|
130
|
-
oidcClientId: sso.oidc?.clientId || '', oidcClientSecret: sso.oidc?.clientSecret || '', oidcDiscoveryUrl: sso.oidc?.discoveryUrl || '',
|
|
131
|
-
}));
|
|
132
|
-
}).catch(() => {});
|
|
133
|
-
engineCall('/deploy-credentials?orgId=' + getOrgId()).then(d => setDeployCreds(d.credentials || [])).catch(() => {});
|
|
134
|
-
apiCall('/settings/org-email').then(d => {
|
|
135
|
-
if (d.configured) setOrgEmail({ configured: true, provider: d.provider, oauthClientId: d.oauthClientId || '', oauthClientSecret: '', oauthTenantId: d.oauthTenantId || 'common', label: d.label || '' });
|
|
136
|
-
}).catch(() => {});
|
|
137
|
-
apiCall('/settings/tool-security').then(d => {
|
|
138
|
-
var cfg = d.toolSecurityConfig || {};
|
|
139
|
-
setToolSec({
|
|
140
|
-
security: cfg.security || { pathSandbox: { enabled: true, allowedDirs: [], blockedPatterns: [] }, ssrf: { enabled: true, allowedHosts: [], blockedCidrs: [] }, commandSanitizer: { enabled: true, mode: 'blocklist', allowedCommands: [], blockedPatterns: [] } },
|
|
141
|
-
middleware: cfg.middleware || { audit: { enabled: true, redactKeys: [] }, rateLimit: { enabled: true, overrides: {} }, circuitBreaker: { enabled: true }, telemetry: { enabled: true } }
|
|
142
|
-
});
|
|
143
|
-
}).catch(() => {});
|
|
144
|
-
apiCall('/settings/firewall').then(function(d) {
|
|
145
|
-
setFw(d.firewallConfig || {});
|
|
146
|
-
}).catch(function() {});
|
|
147
|
-
apiCall('/settings/model-pricing').then(function(d) {
|
|
148
|
-
setPricing(d.modelPricingConfig || { models: [], currency: 'USD' });
|
|
149
|
-
}).catch(function() {});
|
|
150
|
-
apiCall('/providers').then(function(d) {
|
|
151
|
-
setProviders(d.providers || d || []);
|
|
152
|
-
}).catch(function() {});
|
|
153
|
-
apiCall('/settings/security').then(function(d) {
|
|
154
|
-
setSecurityConfig(d.securityConfig || {});
|
|
155
|
-
}).catch(function() {});
|
|
156
|
-
}, []);
|
|
157
|
-
|
|
158
|
-
const createKey = async () => {
|
|
159
|
-
try {
|
|
160
|
-
const d = await apiCall('/api-keys', { method: 'POST', body: JSON.stringify({ name: keyName || 'New Key', scopes: ['read', 'write', 'admin'] }) });
|
|
161
|
-
if (d.plaintext) { setNewKeyPlaintext(d.plaintext); setKeyCopied(false); }
|
|
162
|
-
else toast('API Key created', 'success');
|
|
163
|
-
setKeyName('');
|
|
164
|
-
apiCall('/api-keys').then(d => setApiKeys(d.keys || [])).catch(() => {});
|
|
165
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const copyKey = () => {
|
|
169
|
-
if (newKeyPlaintext) { navigator.clipboard.writeText(newKeyPlaintext).then(() => { setKeyCopied(true); toast('Copied to clipboard', 'success'); }).catch(() => toast('Copy failed', 'error')); }
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const revokeKey = async (id) => {
|
|
173
|
-
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' });
|
|
174
|
-
if (!ok) return;
|
|
175
|
-
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'); }
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const saveSetting = async (key, value) => {
|
|
179
|
-
try { await apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ [key]: value }) }); toast('Settings saved', 'success'); } catch (e) { toast(e.message, 'error'); }
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const saveOrgEmail = async () => {
|
|
183
|
-
if (!orgEmail.provider) { toast('Select a provider', 'error'); return; }
|
|
184
|
-
if (!orgEmail.oauthClientId) { toast('Enter Client ID', 'error'); return; }
|
|
185
|
-
if (!orgEmail.oauthClientSecret) { toast('Enter Client Secret', 'error'); return; }
|
|
186
|
-
setOrgEmailSaving(true);
|
|
187
|
-
try {
|
|
188
|
-
var result = await apiCall('/settings/org-email', { method: 'PUT', body: JSON.stringify({ provider: orgEmail.provider, oauthClientId: orgEmail.oauthClientId, oauthClientSecret: orgEmail.oauthClientSecret, oauthTenantId: orgEmail.oauthTenantId }) });
|
|
189
|
-
setOrgEmail(function(prev) { return Object.assign({}, prev, { configured: true, label: result.orgEmailConfig?.label || prev.label, oauthClientSecret: '' }); });
|
|
190
|
-
toast('Organization email configuration saved', 'success');
|
|
191
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
192
|
-
setOrgEmailSaving(false);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const removeOrgEmail = async () => {
|
|
196
|
-
var ok = await showConfirm({ title: 'Remove Organization Email', message: 'Agents using this org-level config will need to be individually configured.', danger: true, confirmText: 'Remove' });
|
|
197
|
-
if (!ok) return;
|
|
198
|
-
try {
|
|
199
|
-
await apiCall('/settings/org-email', { method: 'DELETE' });
|
|
200
|
-
setOrgEmail({ configured: false, provider: '', oauthClientId: '', oauthClientSecret: '', oauthTenantId: 'common', label: '' });
|
|
201
|
-
toast('Organization email configuration removed', 'success');
|
|
202
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const saveSaml = async () => {
|
|
206
|
-
try {
|
|
207
|
-
await apiCall('/settings/sso/saml', { method: 'PUT', body: JSON.stringify({ entityId: settings.samlEntityId, ssoUrl: settings.samlSsoUrl, certificate: settings.samlCertificate }) });
|
|
208
|
-
toast('SAML configuration saved', 'success');
|
|
209
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
const saveOidc = async () => {
|
|
213
|
-
try {
|
|
214
|
-
await apiCall('/settings/sso/oidc', { method: 'PUT', body: JSON.stringify({ clientId: settings.oidcClientId, clientSecret: settings.oidcClientSecret, discoveryUrl: settings.oidcDiscoveryUrl }) });
|
|
215
|
-
toast('OIDC configuration saved', 'success');
|
|
216
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const testOidc = async () => {
|
|
220
|
-
if (!settings.oidcDiscoveryUrl) { toast('Enter a Discovery URL first', 'error'); return; }
|
|
221
|
-
try {
|
|
222
|
-
const d = await apiCall('/settings/sso/oidc/test', { method: 'POST', body: JSON.stringify({ discoveryUrl: settings.oidcDiscoveryUrl }) });
|
|
223
|
-
if (d.ok) toast('OIDC discovery OK — Issuer: ' + d.issuer, 'success');
|
|
224
|
-
else toast('OIDC test failed: ' + (d.error || 'Unknown error'), 'error');
|
|
225
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const removeSso = async (provider) => {
|
|
229
|
-
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' });
|
|
230
|
-
if (!ok) return;
|
|
231
|
-
try {
|
|
232
|
-
await apiCall('/settings/sso/' + provider, { method: 'DELETE' });
|
|
233
|
-
toast(provider.toUpperCase() + ' configuration removed', 'success');
|
|
234
|
-
setSsoConfig(c => { const n = { ...c }; delete n[provider]; return n; });
|
|
235
|
-
if (provider === 'saml') setSettings(s => ({ ...s, samlEntityId: '', samlSsoUrl: '', samlCertificate: '' }));
|
|
236
|
-
if (provider === 'oidc') setSettings(s => ({ ...s, oidcClientId: '', oidcClientSecret: '', oidcDiscoveryUrl: '' }));
|
|
237
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const prefillOidc = (providerName, discoveryUrl) => {
|
|
241
|
-
setSettings(s => ({ ...s, oidcDiscoveryUrl: discoveryUrl }));
|
|
242
|
-
toast('Pre-filled ' + providerName + ' discovery URL. Enter your Client ID and Secret to complete setup.', 'info');
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
const createDeployCred = async () => {
|
|
246
|
-
try {
|
|
247
|
-
await engineCall('/deploy-credentials', { method: 'POST', body: JSON.stringify({ orgId: getOrgId(), name: deployForm.name, targetType: deployForm.targetType, config: deployForm.config }) });
|
|
248
|
-
toast('Credential created', 'success');
|
|
249
|
-
setShowDeployModal(false);
|
|
250
|
-
setDeployForm({ name: '', targetType: 'docker', config: {} });
|
|
251
|
-
engineCall('/deploy-credentials?orgId=' + getOrgId()).then(d => setDeployCreds(d.credentials || [])).catch(() => {});
|
|
252
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const deleteDeployCred = async (id) => {
|
|
256
|
-
const ok = await showConfirm({ title: 'Delete Credential', message: 'This will permanently delete the credential. Any deployments using it will fail.', danger: true, confirmText: 'Delete' });
|
|
257
|
-
if (!ok) return;
|
|
258
|
-
try {
|
|
259
|
-
await engineCall('/deploy-credentials/' + id, { method: 'DELETE' });
|
|
260
|
-
toast('Credential deleted', 'success');
|
|
261
|
-
setDeployCreds(c => c.filter(x => x.id !== id));
|
|
262
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
return h(Fragment, null,
|
|
266
|
-
h('div', { style: { marginBottom: 20, display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
|
|
267
|
-
h('h1', { style: { fontSize: 20, fontWeight: 700, margin: 0 } }, 'Settings'),
|
|
268
|
-
h(orgCtx.Switcher, { style: { marginLeft: 8 } }),
|
|
269
|
-
h(KnowledgeLink, { page: 'settings' }),
|
|
270
|
-
SETTINGS_HELP[tab] && h(HelpButton, { label: SETTINGS_HELP[tab].label }, SETTINGS_HELP[tab].content())
|
|
271
|
-
),
|
|
272
|
-
effectiveOrgId && h('div', { style: { padding: '10px 14px', background: 'var(--bg-tertiary)', border: '1px solid var(--border)', borderRadius: 'var(--radius)', marginBottom: 16, fontSize: 13, color: 'var(--text-secondary)', display: 'flex', alignItems: 'center', gap: 8 } },
|
|
273
|
-
I.building(),
|
|
274
|
-
h('span', null, 'Viewing organization-scoped settings. Only credentials, models, and integrations relevant to this client organization are shown.'),
|
|
275
|
-
h('button', { className: 'btn btn-secondary btn-sm', style: { marginLeft: 'auto' }, onClick: function() { orgCtx.onOrgChange('', null); } }, 'View System Settings')
|
|
276
|
-
),
|
|
277
|
-
h('div', { className: 'tabs' },
|
|
278
|
-
activeTabs.map(function(t) {
|
|
279
|
-
var tabIcon = TAB_ICONS[t]; return h('div', { key: t, className: 'tab' + (tab === t ? ' active' : ''), onClick: function() { setTab(t); }, style: { display: 'flex', alignItems: 'center', gap: 6, cursor: 'pointer' } }, tabIcon ? tabIcon() : null, TAB_LABELS[t] || t);
|
|
280
|
-
})
|
|
281
|
-
),
|
|
282
|
-
|
|
283
|
-
// ─── Knowledge Link for current tab ─────────────────
|
|
284
|
-
SETTINGS_TAB_DOCS[tab] && h('div', { style: { display: 'flex', justifyContent: 'flex-end', marginBottom: 8 } },
|
|
285
|
-
h(KnowledgeLink, { page: SETTINGS_TAB_DOCS[tab], label: (TAB_LABELS[tab] || tab) + ' Docs' })
|
|
286
|
-
),
|
|
287
|
-
|
|
288
|
-
tab === 'general' && h('div', null,
|
|
289
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
290
|
-
h('div', { className: 'card-header' }, h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Organization', h(HelpButton, { label: 'Organization Settings' },
|
|
291
|
-
h('p', null, 'Core settings for your AgenticMail Enterprise instance — company name, domain, branding, and plan tier.'),
|
|
292
|
-
h('p', null, h('strong', null, 'Plan: '), 'Self-hosted installations have no restrictions. Set a plan tier to enforce agent limits if needed.'),
|
|
293
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary, #1e293b)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Your brand color and logo are used throughout the dashboard and in agent-facing UIs.')
|
|
294
|
-
))),
|
|
295
|
-
h('div', { className: 'card-body' },
|
|
296
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
|
|
297
|
-
h('div', { className: 'form-group' },
|
|
298
|
-
h('label', { className: 'form-label' }, 'Company Name'),
|
|
299
|
-
h('input', { className: 'input', value: settings.name || '', onChange: e => setSettings(s => ({ ...s, name: e.target.value })) })
|
|
300
|
-
),
|
|
301
|
-
h('div', { className: 'form-group' },
|
|
302
|
-
h('label', { className: 'form-label' }, 'Domain'),
|
|
303
|
-
h('input', { className: 'input', value: settings.domain || '', onChange: e => setSettings(s => ({ ...s, domain: e.target.value })) })
|
|
304
|
-
),
|
|
305
|
-
h('div', { className: 'form-group' },
|
|
306
|
-
h('label', { className: 'form-label' }, 'Subdomain'),
|
|
307
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
308
|
-
h('input', { className: 'input', value: settings.subdomain || '', onChange: e => setSettings(s => ({ ...s, subdomain: e.target.value })), style: { maxWidth: 200 } }),
|
|
309
|
-
h('span', { style: { color: 'var(--text-muted)', fontSize: 13 } }, '.agenticmail.io')
|
|
310
|
-
)
|
|
311
|
-
),
|
|
312
|
-
h('div', { className: 'form-group' },
|
|
313
|
-
h('label', { className: 'form-label' }, 'Plan'),
|
|
314
|
-
h('select', { className: 'input', value: settings.plan || 'self-hosted', onChange: e => setSettings(s => ({ ...s, plan: e.target.value })) },
|
|
315
|
-
h('option', { value: 'self-hosted' }, 'Self-Hosted (Unlimited)'),
|
|
316
|
-
h('option', { value: 'team' }, 'Team (25 agents)'),
|
|
317
|
-
h('option', { value: 'enterprise' }, 'Enterprise (Unlimited + Support)'),
|
|
318
|
-
h('option', { value: 'free' }, 'Free (3 agents)')
|
|
319
|
-
),
|
|
320
|
-
h('p', { className: 'form-help' }, 'Self-hosted installations have no restrictions. Choose a plan tier to enforce agent limits.')
|
|
321
|
-
)
|
|
322
|
-
),
|
|
323
|
-
h('div', { className: 'form-group' },
|
|
324
|
-
h('label', { className: 'form-label' }, 'Logo URL'),
|
|
325
|
-
h('input', { className: 'input', value: settings.logoUrl || '', onChange: e => setSettings(s => ({ ...s, logoUrl: e.target.value })), placeholder: 'https://yourcompany.com/logo.png' })
|
|
326
|
-
),
|
|
327
|
-
h('div', { className: 'form-group' },
|
|
328
|
-
h('label', { className: 'form-label' }, 'Primary Brand Color'),
|
|
329
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 10 } },
|
|
330
|
-
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' } }),
|
|
331
|
-
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 } })
|
|
332
|
-
)
|
|
333
|
-
),
|
|
334
|
-
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); if (d.name && setCompanyName) setCompanyName(d.name); toast('Settings saved', 'success'); }).catch(e => toast(e.message, 'error')) }, 'Save Changes')
|
|
335
|
-
)
|
|
336
|
-
),
|
|
337
|
-
|
|
338
|
-
// ─── Branding & Assets ──────────────────────────────
|
|
339
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
340
|
-
h('div', { className: 'card-header' }, h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Branding & Assets', h(HelpButton, { label: 'Branding & Assets' },
|
|
341
|
-
h('p', null, 'Upload your company logo, favicon, and login page assets. The system automatically generates all required icon sizes (16px, 32px, 48px, 180px, 192px, 512px) and favicon from your logo.'),
|
|
342
|
-
h('p', { style: { marginTop: 8 } }, h('strong', null, 'Supported formats: '), 'PNG, JPG, SVG, WebP, GIF'),
|
|
343
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Upload a square PNG logo (512x512 or larger) for best results. The system auto-converts it to favicon.ico and all app icon sizes.')
|
|
344
|
-
))),
|
|
345
|
-
h('div', { className: 'card-body' },
|
|
346
|
-
// Page Title
|
|
347
|
-
h('div', { className: 'form-group', style: { marginBottom: 16 } },
|
|
348
|
-
h('label', { className: 'form-label' }, 'Page Title'),
|
|
349
|
-
h('p', { className: 'form-help', style: { marginBottom: 8 } }, 'Displayed in browser tab. Your name will be appended with "by AgenticMail".'),
|
|
350
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
|
|
351
|
-
h('input', { className: 'input', value: (settings.branding && settings.branding.pageTitle) || '', onChange: function(e) { setSettings(function(s) { var b = Object.assign({}, s.branding || {}); b.pageTitle = e.target.value; return Object.assign({}, s, { branding: b }); }); }, placeholder: settings.name || 'Your Company Name', style: { maxWidth: 300 } }),
|
|
352
|
-
h('span', { style: { color: 'var(--text-muted)', fontSize: 12 } }, 'by AgenticMail'),
|
|
353
|
-
h('button', { className: 'btn btn-primary btn-sm', style: { marginLeft: 8 }, onClick: function() { apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ branding: settings.branding }) }).then(function() { toast('Page title saved! Refresh to see changes.', 'success'); }).catch(function(e) { toast(e.message, 'error'); }); } }, 'Save')
|
|
354
|
-
)
|
|
355
|
-
),
|
|
356
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
|
|
357
|
-
// Company Logo
|
|
358
|
-
h('div', { className: 'form-group' },
|
|
359
|
-
h('label', { className: 'form-label' }, 'Company Logo'),
|
|
360
|
-
h('p', { className: 'form-help', style: { marginBottom: 8 } }, 'Used in dashboard sidebar, emails, and auto-generates favicon + app icons'),
|
|
361
|
-
(settings.branding && settings.branding.logo) && h('div', { style: { marginBottom: 8, padding: 8, background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', display: 'inline-flex', alignItems: 'center', gap: 8 } },
|
|
362
|
-
h('img', { src: settings.branding.logo, style: { maxWidth: 120, maxHeight: 60, objectFit: 'contain' } }),
|
|
363
|
-
h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--danger)', fontSize: 11 }, onClick: function() { apiCall('/settings/branding/logo', { method: 'DELETE' }).then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Logo removed', 'success'); }).catch(function(e) { toast(e.message, 'error'); }); } }, '\u00D7 Remove')
|
|
364
|
-
),
|
|
365
|
-
h('input', { type: 'file', accept: 'image/*', style: { fontSize: 12 }, onChange: function(e) {
|
|
366
|
-
var file = e.target.files && e.target.files[0];
|
|
367
|
-
if (!file) return;
|
|
368
|
-
if (file.size > 5 * 1024 * 1024) { toast('File too large (max 5MB)', 'error'); return; }
|
|
369
|
-
var reader = new FileReader();
|
|
370
|
-
reader.onload = function() {
|
|
371
|
-
apiCall('/settings/branding', { method: 'POST', body: JSON.stringify({ type: 'logo', data: reader.result, filename: file.name }) })
|
|
372
|
-
.then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Logo uploaded! Favicon and icons auto-generated. Refresh to see changes.', 'success'); })
|
|
373
|
-
.catch(function(err) { toast(err.message, 'error'); });
|
|
374
|
-
};
|
|
375
|
-
reader.readAsDataURL(file);
|
|
376
|
-
} })
|
|
377
|
-
),
|
|
378
|
-
// Login Page Logo (separate from main logo)
|
|
379
|
-
h('div', { className: 'form-group' },
|
|
380
|
-
h('label', { className: 'form-label' }, 'Login Page Logo'),
|
|
381
|
-
h('p', { className: 'form-help', style: { marginBottom: 8 } }, 'Shown on the login page. Falls back to company logo if not set.'),
|
|
382
|
-
(settings.branding && settings.branding.login_logo) && h('div', { style: { marginBottom: 8, padding: 8, background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', display: 'inline-flex', alignItems: 'center', gap: 8 } },
|
|
383
|
-
h('img', { src: settings.branding.login_logo, style: { maxWidth: 120, maxHeight: 60, objectFit: 'contain' } }),
|
|
384
|
-
h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--danger)', fontSize: 11 }, onClick: function() { apiCall('/settings/branding/login_logo', { method: 'DELETE' }).then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Login logo removed', 'success'); }).catch(function(e) { toast(e.message, 'error'); }); } }, '\u00D7 Remove')
|
|
385
|
-
),
|
|
386
|
-
h('input', { type: 'file', accept: 'image/*', style: { fontSize: 12 }, onChange: function(e) {
|
|
387
|
-
var file = e.target.files && e.target.files[0];
|
|
388
|
-
if (!file) return;
|
|
389
|
-
if (file.size > 5 * 1024 * 1024) { toast('File too large (max 5MB)', 'error'); return; }
|
|
390
|
-
var reader = new FileReader();
|
|
391
|
-
reader.onload = function() {
|
|
392
|
-
apiCall('/settings/branding', { method: 'POST', body: JSON.stringify({ type: 'login_logo', data: reader.result, filename: file.name }) })
|
|
393
|
-
.then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Login logo saved!', 'success'); })
|
|
394
|
-
.catch(function(err) { toast(err.message, 'error'); });
|
|
395
|
-
};
|
|
396
|
-
reader.readAsDataURL(file);
|
|
397
|
-
} })
|
|
398
|
-
),
|
|
399
|
-
// Login Background
|
|
400
|
-
h('div', { className: 'form-group' },
|
|
401
|
-
h('label', { className: 'form-label' }, 'Login Page Background'),
|
|
402
|
-
h('p', { className: 'form-help', style: { marginBottom: 8 } }, 'Background image for the login page'),
|
|
403
|
-
(settings.branding && settings.branding.login_bg) && h('div', { style: { marginBottom: 8, padding: 4, background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', display: 'inline-flex', alignItems: 'center', gap: 8 } },
|
|
404
|
-
h('img', { src: settings.branding.login_bg, style: { maxWidth: 160, maxHeight: 80, objectFit: 'cover', borderRadius: 'var(--radius)' } }),
|
|
405
|
-
h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--danger)', fontSize: 11 }, onClick: function() { apiCall('/settings/branding/login_bg', { method: 'DELETE' }).then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Background removed', 'success'); }).catch(function(e) { toast(e.message, 'error'); }); } }, '\u00D7 Remove')
|
|
406
|
-
),
|
|
407
|
-
h('input', { type: 'file', accept: 'image/*', style: { fontSize: 12 }, onChange: function(e) {
|
|
408
|
-
var file = e.target.files && e.target.files[0];
|
|
409
|
-
if (!file) return;
|
|
410
|
-
if (file.size > 10 * 1024 * 1024) { toast('File too large (max 10MB)', 'error'); return; }
|
|
411
|
-
var reader = new FileReader();
|
|
412
|
-
reader.onload = function() {
|
|
413
|
-
apiCall('/settings/branding', { method: 'POST', body: JSON.stringify({ type: 'login_bg', data: reader.result, filename: file.name }) })
|
|
414
|
-
.then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Login background saved!', 'success'); })
|
|
415
|
-
.catch(function(err) { toast(err.message, 'error'); });
|
|
416
|
-
};
|
|
417
|
-
reader.readAsDataURL(file);
|
|
418
|
-
} })
|
|
419
|
-
),
|
|
420
|
-
// Favicon (manual override)
|
|
421
|
-
h('div', { className: 'form-group' },
|
|
422
|
-
h('label', { className: 'form-label' }, 'Custom Favicon'),
|
|
423
|
-
h('p', { className: 'form-help', style: { marginBottom: 8 } }, 'Override the auto-generated favicon. Upload .ico or .png'),
|
|
424
|
-
(settings.branding && settings.branding.favicon) && h('div', { style: { marginBottom: 8, display: 'inline-flex', alignItems: 'center', gap: 8 } },
|
|
425
|
-
h('img', { src: settings.branding.favicon, style: { width: 32, height: 32, objectFit: 'contain' } }),
|
|
426
|
-
h('span', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Current favicon'),
|
|
427
|
-
h('button', { className: 'btn btn-ghost btn-sm', style: { color: 'var(--danger)', fontSize: 11 }, onClick: function() { apiCall('/settings/branding/favicon', { method: 'DELETE' }).then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Favicon removed', 'success'); }).catch(function(e) { toast(e.message, 'error'); }); } }, '\u00D7 Remove')
|
|
428
|
-
),
|
|
429
|
-
h('input', { type: 'file', accept: '.ico,.png,.svg', style: { fontSize: 12 }, onChange: function(e) {
|
|
430
|
-
var file = e.target.files && e.target.files[0];
|
|
431
|
-
if (!file) return;
|
|
432
|
-
var reader = new FileReader();
|
|
433
|
-
reader.onload = function() {
|
|
434
|
-
apiCall('/settings/branding', { method: 'POST', body: JSON.stringify({ type: 'favicon', data: reader.result, filename: file.name }) })
|
|
435
|
-
.then(function(r) { setSettings(function(s) { return Object.assign({}, s, { branding: r.branding }); }); toast('Favicon saved! Refresh to see changes.', 'success'); })
|
|
436
|
-
.catch(function(err) { toast(err.message, 'error'); });
|
|
437
|
-
};
|
|
438
|
-
reader.readAsDataURL(file);
|
|
439
|
-
} })
|
|
440
|
-
)
|
|
441
|
-
),
|
|
442
|
-
// Current branding status
|
|
443
|
-
(settings.branding && Object.keys(settings.branding).length > 0) && h('div', { style: { marginTop: 12, padding: 10, background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', fontSize: 12 } },
|
|
444
|
-
h('strong', null, 'Active branding: '),
|
|
445
|
-
Object.keys(settings.branding).filter(function(k) { return settings.branding[k]; }).map(function(k) {
|
|
446
|
-
return h('span', { key: k, style: { display: 'inline-block', padding: '2px 8px', margin: '2px 4px', background: 'var(--success-soft)', color: 'var(--success)', borderRadius: 4, fontSize: 11 } }, k.replace(/_/g, ' '));
|
|
447
|
-
})
|
|
448
|
-
)
|
|
449
|
-
)
|
|
450
|
-
),
|
|
451
|
-
|
|
452
|
-
// ─── Email Signature Template ─────────────────────
|
|
453
|
-
h('div', { className: 'card' },
|
|
454
|
-
h('div', { className: 'card-header' },
|
|
455
|
-
h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Email Signature Template', h(HelpButton, { label: 'Email Signature Template' },
|
|
456
|
-
h('p', null, 'Define a shared HTML signature that all agents use in their outgoing emails. Use template variables like {{name}}, {{role}}, {{email}} to personalize per agent.'),
|
|
457
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary, #1e293b)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Test your signature by previewing it below the editor. The preview uses sample data to show how it will look.')
|
|
458
|
-
)),
|
|
459
|
-
h('span', { style: { fontSize: 12, color: 'var(--text-muted)', marginLeft: 8 } }, 'Applied to all agents')
|
|
460
|
-
),
|
|
461
|
-
h('div', { className: 'card-body' },
|
|
462
|
-
h('p', { style: { fontSize: 13, color: 'var(--text-muted)', marginBottom: 16 } }, 'Define an HTML signature template that agents will use in their Gmail accounts. Use {{name}}, {{role}}, {{email}}, {{phone}}, {{company}} as placeholders.'),
|
|
463
|
-
h('div', { className: 'form-group' },
|
|
464
|
-
h('label', { className: 'form-label' }, 'Signature HTML Template'),
|
|
465
|
-
h('textarea', {
|
|
466
|
-
className: 'input',
|
|
467
|
-
value: settings.signatureTemplate || '',
|
|
468
|
-
onChange: function(e) { setSettings(function(s) { return Object.assign({}, s, { signatureTemplate: e.target.value }); }); },
|
|
469
|
-
placeholder: '<table cellpadding="0" cellspacing="0" style="font-family: Arial, sans-serif; font-size: 13px; color: #333;">\n <tr>\n <td style="padding-right: 15px; border-right: 2px solid #6366f1;">\n <img src="{{logo}}" width="60" alt="{{company}}">\n </td>\n <td style="padding-left: 15px;">\n <b style="font-size: 14px;">{{name}}</b><br>\n <span style="color: #6366f1;">{{role}}</span><br>\n <span style="color: #888;">{{email}}</span><br>\n <span style="color: #888;">{{company}}</span>\n </td>\n </tr>\n</table>',
|
|
470
|
-
rows: 12,
|
|
471
|
-
style: { fontFamily: 'var(--font-mono)', fontSize: 12, resize: 'vertical' }
|
|
472
|
-
})
|
|
473
|
-
),
|
|
474
|
-
h('div', { style: { display: 'flex', gap: 8, flexWrap: 'wrap', marginBottom: 12 } },
|
|
475
|
-
h('span', { className: 'badge', style: { fontSize: 11 } }, '{{name}}'),
|
|
476
|
-
h('span', { className: 'badge', style: { fontSize: 11 } }, '{{role}}'),
|
|
477
|
-
h('span', { className: 'badge', style: { fontSize: 11 } }, '{{email}}'),
|
|
478
|
-
h('span', { className: 'badge', style: { fontSize: 11 } }, '{{phone}}'),
|
|
479
|
-
h('span', { className: 'badge', style: { fontSize: 11 } }, '{{company}}'),
|
|
480
|
-
h('span', { className: 'badge', style: { fontSize: 11 } }, '{{logo}}')
|
|
481
|
-
),
|
|
482
|
-
settings.signatureTemplate && h('div', { style: { marginBottom: 16 } },
|
|
483
|
-
h('label', { className: 'form-label' }, 'Preview'),
|
|
484
|
-
h('div', {
|
|
485
|
-
style: { background: 'white', padding: 16, borderRadius: 'var(--radius)', border: '1px solid var(--border)', color: '#333' },
|
|
486
|
-
dangerouslySetInnerHTML: {
|
|
487
|
-
__html: (settings.signatureTemplate || '')
|
|
488
|
-
.replace(/\{\{name\}\}/g, 'Jane Smith')
|
|
489
|
-
.replace(/\{\{role\}\}/g, 'Customer Support Lead')
|
|
490
|
-
.replace(/\{\{email\}\}/g, 'jane@company.com')
|
|
491
|
-
.replace(/\{\{phone\}\}/g, '+1 (555) 123-4567')
|
|
492
|
-
.replace(/\{\{company\}\}/g, settings.name || 'Your Company')
|
|
493
|
-
.replace(/\{\{logo\}\}/g, settings.logoUrl || 'https://placehold.co/60x60?text=Logo')
|
|
494
|
-
}
|
|
495
|
-
})
|
|
496
|
-
),
|
|
497
|
-
h('button', {
|
|
498
|
-
className: 'btn btn-primary',
|
|
499
|
-
onClick: function() {
|
|
500
|
-
apiCall('/settings', {
|
|
501
|
-
method: 'PATCH',
|
|
502
|
-
body: JSON.stringify({ signatureTemplate: settings.signatureTemplate })
|
|
503
|
-
}).then(function() { toast('Signature template saved', 'success'); }).catch(function(e) { toast(e.message, 'error'); });
|
|
504
|
-
}
|
|
505
|
-
}, 'Save Signature Template')
|
|
506
|
-
)
|
|
507
|
-
),
|
|
508
|
-
|
|
509
|
-
h('div', { className: 'card' },
|
|
510
|
-
h('div', { className: 'card-header' },
|
|
511
|
-
h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Organization Email', h(HelpButton, { label: 'Organization Email' },
|
|
512
|
-
h('p', null, 'Set up a shared OAuth application (Google or Microsoft) that all agents use for email access. Each agent still authorizes individually, but they share the same Client ID and Secret.'),
|
|
513
|
-
h('p', null, h('strong', null, 'Why: '), 'Without this, each agent would need its own OAuth app registration. This centralizes the setup.'),
|
|
514
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary, #1e293b)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Follow the setup instructions carefully — you\'ll need to create an OAuth app in the provider\'s developer console and add the correct redirect URI.')
|
|
515
|
-
)),
|
|
516
|
-
orgEmail.configured && h('span', { className: 'badge badge-success', style: { marginLeft: 8 } }, orgEmail.label || 'Configured')
|
|
517
|
-
),
|
|
518
|
-
h('div', { className: 'card-body' },
|
|
519
|
-
h('p', { style: { fontSize: 13, color: 'var(--text-muted)', marginBottom: 16 } }, 'Set up a shared OAuth application for all agents. Each agent will still authorize individually with their own account, but they\'ll use the same Client ID and Secret.'),
|
|
520
|
-
|
|
521
|
-
// Provider selector
|
|
522
|
-
h('div', { style: { display: 'flex', gap: 12, marginBottom: 16 } },
|
|
523
|
-
h('div', {
|
|
524
|
-
onClick: function() { setOrgEmail(function(p) { return Object.assign({}, p, { provider: 'google' }); }); },
|
|
525
|
-
style: { flex: 1, padding: '16px 12px', border: '2px solid ' + (orgEmail.provider === 'google' ? 'var(--accent)' : 'var(--border)'), borderRadius: 'var(--radius)', cursor: 'pointer', textAlign: 'center', background: orgEmail.provider === 'google' ? 'var(--accent-soft)' : 'var(--bg-primary)' }
|
|
526
|
-
},
|
|
527
|
-
h('div', { style: { marginBottom: 4, display: 'flex', justifyContent: 'center' } }, ProviderLogo.google(24)),
|
|
528
|
-
h('div', { style: { fontSize: 13, fontWeight: 600 } }, 'Google Workspace'),
|
|
529
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Gmail API OAuth')
|
|
530
|
-
),
|
|
531
|
-
h('div', {
|
|
532
|
-
onClick: function() { setOrgEmail(function(p) { return Object.assign({}, p, { provider: 'microsoft' }); }); },
|
|
533
|
-
style: { flex: 1, padding: '16px 12px', border: '2px solid ' + (orgEmail.provider === 'microsoft' ? 'var(--accent)' : 'var(--border)'), borderRadius: 'var(--radius)', cursor: 'pointer', textAlign: 'center', background: orgEmail.provider === 'microsoft' ? 'var(--accent-soft)' : 'var(--bg-primary)' }
|
|
534
|
-
},
|
|
535
|
-
h('div', { style: { marginBottom: 4, display: 'flex', justifyContent: 'center' } }, ProviderLogo.microsoft(24)),
|
|
536
|
-
h('div', { style: { fontSize: 13, fontWeight: 600 } }, 'Microsoft 365'),
|
|
537
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Azure AD / Entra ID')
|
|
538
|
-
)
|
|
539
|
-
),
|
|
540
|
-
|
|
541
|
-
// Setup instructions
|
|
542
|
-
orgEmail.provider && h('div', { style: { padding: '12px 16px', background: 'var(--info-soft)', borderRadius: 'var(--radius)', marginBottom: 16, fontSize: 12, color: 'var(--text-secondary)' } },
|
|
543
|
-
h('strong', { style: { color: 'var(--accent)' } }, 'Setup Instructions:'), h('br'),
|
|
544
|
-
orgEmail.provider === 'google'
|
|
545
|
-
? h(Fragment, null,
|
|
546
|
-
'1. Go to ', h('a', { href: 'https://console.cloud.google.com/apis/credentials', target: '_blank', style: { color: 'var(--accent)' } }, 'Google Cloud Console \u2192 Credentials'), h('br'),
|
|
547
|
-
'2. Create an OAuth 2.0 Client ID (Web application) \u2192 add redirect URI: ', h('code', { style: { background: 'var(--bg-tertiary)', padding: '1px 4px', borderRadius: 3, fontSize: 11 } }, window.location.origin + '/api/engine/oauth/callback'), h('br'),
|
|
548
|
-
'3. Enable the Gmail API in your project', h('br'),
|
|
549
|
-
'4. Copy the Client ID and Client Secret below'
|
|
550
|
-
)
|
|
551
|
-
: h(Fragment, null,
|
|
552
|
-
'1. Go to ', h('a', { href: 'https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade', target: '_blank', style: { color: 'var(--accent)' } }, 'Azure Portal \u2192 App Registrations'), h('br'),
|
|
553
|
-
'2. Click "New Registration" \u2192 set redirect URI to: ', h('code', { style: { background: 'var(--bg-tertiary)', padding: '1px 4px', borderRadius: 3, fontSize: 11 } }, window.location.origin + '/api/engine/oauth/callback'), h('br'),
|
|
554
|
-
'3. Copy the Client ID and create a Client Secret below'
|
|
555
|
-
)
|
|
556
|
-
),
|
|
557
|
-
|
|
558
|
-
// Credentials form
|
|
559
|
-
orgEmail.provider && h(Fragment, null,
|
|
560
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12, marginBottom: 12 } },
|
|
561
|
-
h('div', null,
|
|
562
|
-
h('label', { className: 'form-label' }, 'OAuth Client ID *'),
|
|
563
|
-
h('input', { className: 'input', value: orgEmail.oauthClientId, placeholder: orgEmail.provider === 'google' ? 'xxxx.apps.googleusercontent.com' : 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', onChange: function(e) { setOrgEmail(function(p) { return Object.assign({}, p, { oauthClientId: e.target.value }); }); } })
|
|
564
|
-
),
|
|
565
|
-
h('div', null,
|
|
566
|
-
h('label', { className: 'form-label' }, 'Client Secret *'),
|
|
567
|
-
h('input', { className: 'input', type: 'password', value: orgEmail.oauthClientSecret, placeholder: orgEmail.configured ? '\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 (saved)' : 'Enter client secret', onChange: function(e) { setOrgEmail(function(p) { return Object.assign({}, p, { oauthClientSecret: e.target.value }); }); } })
|
|
568
|
-
)
|
|
569
|
-
),
|
|
570
|
-
orgEmail.provider === 'microsoft' && h('div', { style: { marginBottom: 12 } },
|
|
571
|
-
h('label', { className: 'form-label' }, 'Tenant ID'),
|
|
572
|
-
h('input', { className: 'input', style: { maxWidth: 400 }, value: orgEmail.oauthTenantId, placeholder: 'common', onChange: function(e) { setOrgEmail(function(p) { return Object.assign({}, p, { oauthTenantId: e.target.value }); }); } }),
|
|
573
|
-
h('p', { className: 'form-help' }, 'Use "common" for multi-tenant or your specific tenant ID')
|
|
574
|
-
),
|
|
575
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
576
|
-
h('button', { className: 'btn btn-primary', disabled: orgEmailSaving, onClick: saveOrgEmail }, orgEmailSaving ? 'Saving...' : (orgEmail.configured ? 'Update Configuration' : 'Save Configuration')),
|
|
577
|
-
orgEmail.configured && h('button', { className: 'btn btn-danger', onClick: removeOrgEmail }, 'Remove')
|
|
578
|
-
)
|
|
579
|
-
),
|
|
580
|
-
|
|
581
|
-
// Info about per-agent auth
|
|
582
|
-
orgEmail.configured && h('div', { style: { marginTop: 16, padding: '12px 16px', background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', fontSize: 12, color: 'var(--text-muted)' } },
|
|
583
|
-
'Each agent still needs to individually authorize via their Email tab. This org config provides the shared OAuth app credentials so agents don\'t need to enter Client ID/Secret individually.'
|
|
584
|
-
)
|
|
585
|
-
)
|
|
586
|
-
),
|
|
587
|
-
h('div', { className: 'card', style: { marginTop: 16 } },
|
|
588
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Info')),
|
|
589
|
-
h('div', { className: 'card-body' },
|
|
590
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '140px 1fr', gap: '6px 16px', fontSize: 13 } },
|
|
591
|
-
h('span', { style: { color: 'var(--text-muted)' } }, 'Organization ID'), h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 12 } }, settings.orgId || settings.id || '-'),
|
|
592
|
-
h('span', { style: { color: 'var(--text-muted)' } }, 'Version'), h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 12 } }, window.__ENTERPRISE_VERSION__ || settings.version || '-'),
|
|
593
|
-
h('span', { style: { color: 'var(--text-muted)' } }, 'Created'), h('span', null, settings.createdAt ? new Date(settings.createdAt).toLocaleString() : '-'),
|
|
594
|
-
h('span', { style: { color: 'var(--text-muted)' } }, 'Last Updated'), h('span', null, settings.updatedAt ? new Date(settings.updatedAt).toLocaleString() : '-')
|
|
595
|
-
)
|
|
596
|
-
)
|
|
597
|
-
)
|
|
598
|
-
),
|
|
599
|
-
|
|
600
|
-
tab === 'models' && effectiveOrgId && h(Fragment, null,
|
|
601
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
602
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Organization Model API Keys')),
|
|
603
|
-
h('div', { className: 'card-body' },
|
|
604
|
-
h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 16 } }, 'Configure LLM provider API keys for this client organization. Agents in this org will use these keys instead of the system-wide defaults.'),
|
|
605
|
-
h(OrgLLMKeysSection, { orgId: effectiveOrgId, toast: toast })
|
|
606
|
-
)
|
|
607
|
-
)
|
|
608
|
-
),
|
|
609
|
-
|
|
610
|
-
tab === 'models' && !effectiveOrgId && h(Fragment, null,
|
|
611
|
-
h(LLMProvidersTab, { toast: toast }),
|
|
612
|
-
h('hr', { style: { border: 'none', borderTop: '1px solid var(--border)', margin: '20px 0' } }),
|
|
613
|
-
h(ModelPricingTab, {
|
|
614
|
-
pricing: pricing,
|
|
615
|
-
setPricing: function(v) { setPricing(v); setPricingDirty(true); },
|
|
616
|
-
saving: pricingSaving,
|
|
617
|
-
dirty: pricingDirty,
|
|
618
|
-
showAddModel: showAddModel,
|
|
619
|
-
setShowAddModel: setShowAddModel,
|
|
620
|
-
newModel: newModel,
|
|
621
|
-
setNewModel: setNewModel,
|
|
622
|
-
providers: providers,
|
|
623
|
-
setProviders: setProviders,
|
|
624
|
-
showAddProvider: showAddProvider,
|
|
625
|
-
setShowAddProvider: setShowAddProvider,
|
|
626
|
-
newProvider: newProvider,
|
|
627
|
-
setNewProvider: setNewProvider,
|
|
628
|
-
discoverResults: discoverResults,
|
|
629
|
-
setDiscoverResults: setDiscoverResults,
|
|
630
|
-
apiKeyModal: apiKeyModal,
|
|
631
|
-
setApiKeyModal: setApiKeyModal,
|
|
632
|
-
apiKeyInput: apiKeyInput,
|
|
633
|
-
setApiKeyInput: setApiKeyInput,
|
|
634
|
-
onSave: function() {
|
|
635
|
-
setPricingSaving(true);
|
|
636
|
-
apiCall('/settings/model-pricing', { method: 'PUT', body: JSON.stringify(pricing) }).then(function(d) {
|
|
637
|
-
setPricing(d.modelPricingConfig || pricing);
|
|
638
|
-
setPricingDirty(false);
|
|
639
|
-
toast('Model pricing saved');
|
|
640
|
-
}).catch(function(e) { toast(e.message, 'error'); }).finally(function() { setPricingSaving(false); });
|
|
641
|
-
},
|
|
642
|
-
onAddModel: function() {
|
|
643
|
-
if (!newModel.modelId || !newModel.provider) { toast('Provider and Model ID are required', 'error'); return; }
|
|
644
|
-
var updated = { ...pricing, models: [...(pricing.models || []), { ...newModel }] };
|
|
645
|
-
setPricing(updated);
|
|
646
|
-
setPricingDirty(true);
|
|
647
|
-
setShowAddModel(false);
|
|
648
|
-
setNewModel({ provider: 'anthropic', modelId: '', displayName: '', inputCostPerMillion: 0, outputCostPerMillion: 0, contextWindow: 0 });
|
|
649
|
-
},
|
|
650
|
-
onRemoveModel: function(idx) {
|
|
651
|
-
var models = [...(pricing.models || [])];
|
|
652
|
-
models.splice(idx, 1);
|
|
653
|
-
setPricing({ ...pricing, models: models });
|
|
654
|
-
setPricingDirty(true);
|
|
655
|
-
},
|
|
656
|
-
onUpdateModel: function(idx, field, value) {
|
|
657
|
-
var models = [...(pricing.models || [])];
|
|
658
|
-
models[idx] = { ...models[idx], [field]: value };
|
|
659
|
-
setPricing({ ...pricing, models: models });
|
|
660
|
-
setPricingDirty(true);
|
|
661
|
-
},
|
|
662
|
-
toast: toast,
|
|
663
|
-
})
|
|
664
|
-
),
|
|
665
|
-
|
|
666
|
-
tab === 'api-keys' && h(Fragment, null,
|
|
667
|
-
newKeyPlaintext && h(Modal, { title: 'API Key Created', onClose: () => setNewKeyPlaintext(null) },
|
|
668
|
-
h('div', { style: { marginBottom: 16 } },
|
|
669
|
-
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.'),
|
|
670
|
-
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
671
|
-
h('input', { className: 'input', value: newKeyPlaintext, readOnly: true, style: { fontFamily: 'var(--font-mono)', fontSize: 12, flex: 1 }, onClick: e => e.target.select() }),
|
|
672
|
-
h('button', { className: 'btn ' + (keyCopied ? 'btn-secondary' : 'btn-primary'), onClick: copyKey }, keyCopied ? [I.check(), ' Copied'] : [I.copy(), ' Copy'])
|
|
673
|
-
)
|
|
674
|
-
),
|
|
675
|
-
h('div', { style: { textAlign: 'right' } },
|
|
676
|
-
h('button', { className: 'btn btn-secondary', onClick: () => setNewKeyPlaintext(null) }, 'Done')
|
|
677
|
-
)
|
|
678
|
-
),
|
|
679
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
680
|
-
h('div', { className: 'card-body' },
|
|
681
|
-
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
682
|
-
h('input', { className: 'input', value: keyName, onChange: e => setKeyName(e.target.value), placeholder: 'Key name (e.g., production)', style: { maxWidth: 300 } }),
|
|
683
|
-
h('button', { className: 'btn btn-primary', onClick: createKey }, I.plus(), ' Create Key')
|
|
684
|
-
)
|
|
685
|
-
)
|
|
686
|
-
),
|
|
687
|
-
h('div', { className: 'card' },
|
|
688
|
-
h('div', { className: 'card-body-flush' },
|
|
689
|
-
apiKeys.length === 0 ? h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } }, 'No API keys')
|
|
690
|
-
: h('table', null,
|
|
691
|
-
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'))),
|
|
692
|
-
h('tbody', null, apiKeys.map(k =>
|
|
693
|
-
h('tr', { key: k.id },
|
|
694
|
-
h('td', null, h('strong', null, k.name)),
|
|
695
|
-
h('td', null, h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 12 } }, (k.keyPrefix || '???') + '...')),
|
|
696
|
-
h('td', null, (k.scopes || []).map(s => h('span', { key: s, className: 'badge badge-neutral', style: { marginRight: 4 } }, s))),
|
|
697
|
-
h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, k.createdAt ? new Date(k.createdAt).toLocaleDateString() : '-'),
|
|
698
|
-
h('td', null, h('button', { className: 'btn btn-danger btn-sm', onClick: () => revokeKey(k.id) }, 'Revoke'))
|
|
699
|
-
)
|
|
700
|
-
))
|
|
701
|
-
)
|
|
702
|
-
)
|
|
703
|
-
)
|
|
704
|
-
),
|
|
705
|
-
|
|
706
|
-
tab === 'authentication' && h('div', null,
|
|
707
|
-
h(TwoFactorCard, { toast: toast }),
|
|
708
|
-
!effectiveOrgId && h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
709
|
-
h('div', { className: 'card-header' }, h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Single Sign-On (SSO)', h(HelpButton, { label: 'Single Sign-On (SSO)' },
|
|
710
|
-
h('p', null, 'Let your team sign into AgenticMail using their existing corporate identity provider (Okta, Google Workspace, Azure AD, etc.).'),
|
|
711
|
-
h('p', null, h('strong', null, 'SAML 2.0'), ' — Enterprise standard, works with Okta, OneLogin, Azure AD.'),
|
|
712
|
-
h('p', null, h('strong', null, 'OIDC'), ' — Modern alternative, works with Google, Microsoft, Auth0.'),
|
|
713
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary, #1e293b)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Use the Quick Setup section below to pre-fill provider discovery URLs. You still need to create an OAuth app in the provider\'s console.')
|
|
714
|
-
))),
|
|
715
|
-
h('div', { className: 'card-body' },
|
|
716
|
-
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.'),
|
|
717
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
|
|
718
|
-
h('div', { className: 'preset-card', style: { cursor: 'default' } },
|
|
719
|
-
h('h4', null, 'SAML 2.0'),
|
|
720
|
-
h('p', null, 'Works with Okta, OneLogin, Azure AD, and any SAML 2.0 IdP.'),
|
|
721
|
-
h('div', { className: 'form-group', style: { marginTop: 12 } },
|
|
722
|
-
h('label', { className: 'form-label' }, 'Entity ID / Issuer'),
|
|
723
|
-
h('input', { className: 'input', value: settings.samlEntityId || '', onChange: e => setSettings(s => ({ ...s, samlEntityId: e.target.value })), placeholder: 'https://your-idp.com/entity-id' })
|
|
724
|
-
),
|
|
725
|
-
h('div', { className: 'form-group' },
|
|
726
|
-
h('label', { className: 'form-label' }, 'SSO URL'),
|
|
727
|
-
h('input', { className: 'input', value: settings.samlSsoUrl || '', onChange: e => setSettings(s => ({ ...s, samlSsoUrl: e.target.value })), placeholder: 'https://your-idp.com/sso' })
|
|
728
|
-
),
|
|
729
|
-
h('div', { className: 'form-group' },
|
|
730
|
-
h('label', { className: 'form-label' }, 'Certificate (PEM)'),
|
|
731
|
-
h('textarea', { className: 'input', rows: 3, value: settings.samlCertificate || '', onChange: e => setSettings(s => ({ ...s, samlCertificate: e.target.value })), placeholder: '-----BEGIN CERTIFICATE-----' })
|
|
732
|
-
),
|
|
733
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
734
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: saveSaml }, 'Save SAML Config'),
|
|
735
|
-
ssoConfig.saml && h('button', { className: 'btn btn-sm', style: { color: 'var(--danger)' }, onClick: () => removeSso('saml') }, 'Remove')
|
|
736
|
-
)
|
|
737
|
-
),
|
|
738
|
-
h('div', { className: 'preset-card', style: { cursor: 'default' } },
|
|
739
|
-
h('h4', null, 'OpenID Connect (OIDC)'),
|
|
740
|
-
h('p', null, 'Works with Google Workspace, Microsoft Entra, Auth0, and any OIDC provider.'),
|
|
741
|
-
h('div', { className: 'form-group', style: { marginTop: 12 } },
|
|
742
|
-
h('label', { className: 'form-label' }, 'Client ID'),
|
|
743
|
-
h('input', { className: 'input', value: settings.oidcClientId || '', onChange: e => setSettings(s => ({ ...s, oidcClientId: e.target.value })), placeholder: 'your-client-id' })
|
|
744
|
-
),
|
|
745
|
-
h('div', { className: 'form-group' },
|
|
746
|
-
h('label', { className: 'form-label' }, 'Client Secret'),
|
|
747
|
-
h('input', { className: 'input', type: 'password', value: settings.oidcClientSecret || '', onChange: e => setSettings(s => ({ ...s, oidcClientSecret: e.target.value })), placeholder: 'your-client-secret' })
|
|
748
|
-
),
|
|
749
|
-
h('div', { className: 'form-group' },
|
|
750
|
-
h('label', { className: 'form-label' }, 'Discovery URL'),
|
|
751
|
-
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' })
|
|
752
|
-
),
|
|
753
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
754
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: saveOidc }, 'Save OIDC Config'),
|
|
755
|
-
h('button', { className: 'btn btn-secondary btn-sm', onClick: testOidc }, 'Test Discovery'),
|
|
756
|
-
ssoConfig.oidc && h('button', { className: 'btn btn-sm', style: { color: 'var(--danger)' }, onClick: () => removeSso('oidc') }, 'Remove')
|
|
757
|
-
)
|
|
758
|
-
)
|
|
759
|
-
)
|
|
760
|
-
)
|
|
761
|
-
),
|
|
762
|
-
!effectiveOrgId && h('div', { className: 'card' },
|
|
763
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Quick Setup — OAuth Providers')),
|
|
764
|
-
h('div', { className: 'card-body' },
|
|
765
|
-
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.'),
|
|
766
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 12 } },
|
|
767
|
-
[
|
|
768
|
-
{ name: 'Google', desc: 'Google Workspace / Gmail', discovery: 'https://accounts.google.com/.well-known/openid-configuration', svg: ProviderLogo.google(28) },
|
|
769
|
-
{ name: 'Microsoft', desc: 'Azure AD / Microsoft 365', discovery: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration', svg: ProviderLogo.microsoft(28) },
|
|
770
|
-
{ 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' })) },
|
|
771
|
-
{ 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' })) },
|
|
772
|
-
{ 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' })) },
|
|
773
|
-
{ 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' })) }
|
|
774
|
-
].map(p => {
|
|
775
|
-
var isConfigured = ssoConfig.oidc && p.discovery && ssoConfig.oidc.discoveryUrl && ssoConfig.oidc.discoveryUrl.indexOf(new URL(p.discovery).hostname.split('.').slice(-2).join('.')) !== -1;
|
|
776
|
-
return h('div', { key: p.name, style: { padding: 16, border: '1px solid ' + (isConfigured ? 'var(--success)' : 'var(--border)'), borderRadius: 'var(--radius)', textAlign: 'center', opacity: p.disabled ? 0.5 : 1, background: isConfigured ? 'rgba(34,197,94,0.06)' : 'transparent', position: 'relative' } },
|
|
777
|
-
isConfigured && h('div', { style: { position: 'absolute', top: 8, right: 8, width: 20, height: 20, borderRadius: '50%', background: 'var(--success)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff', fontSize: 12, fontWeight: 700 } }, '\u2713'),
|
|
778
|
-
h('div', { style: { marginBottom: 8, display: 'flex', justifyContent: 'center' } }, p.svg),
|
|
779
|
-
h('div', { style: { fontWeight: 600, fontSize: 13, marginBottom: 4 } }, p.name),
|
|
780
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginBottom: 12 } }, p.desc),
|
|
781
|
-
isConfigured
|
|
782
|
-
? h('div', { style: { fontSize: 12, color: 'var(--success)', fontWeight: 600 } }, 'Configured')
|
|
783
|
-
: 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)
|
|
784
|
-
);
|
|
785
|
-
})
|
|
786
|
-
)
|
|
787
|
-
)
|
|
788
|
-
)
|
|
789
|
-
),
|
|
790
|
-
|
|
791
|
-
tab === 'platform' && h(PlatformCapabilitiesTab, { toast: toast }),
|
|
792
|
-
|
|
793
|
-
tab === 'email' && effectiveOrgId && h('div', null,
|
|
794
|
-
h('div', { className: 'card' },
|
|
795
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Organization Email Configuration')),
|
|
796
|
-
h('div', { className: 'card-body' },
|
|
797
|
-
h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 16 } }, 'Email credentials for agents in this organization. Configure via the Integrations tab, or set up a relay/SMTP integration for this org.'),
|
|
798
|
-
(function() {
|
|
799
|
-
var emailInteg = orgIntegrations.filter(function(i) { return i.type === 'google' || i.type === 'microsoft' || i.type === 'smtp'; });
|
|
800
|
-
if (emailInteg.length === 0) return h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } },
|
|
801
|
-
'No email integration configured for this organization. ',
|
|
802
|
-
h('button', { className: 'btn btn-primary btn-sm', style: { marginLeft: 8 }, onClick: function() { setTab('integrations'); } }, 'Add Integration')
|
|
803
|
-
);
|
|
804
|
-
return h('div', { style: { display: 'flex', flexDirection: 'column', gap: 12 } },
|
|
805
|
-
emailInteg.map(function(integ) {
|
|
806
|
-
var typeLabel = integ.type === 'google' ? 'Google Workspace' : integ.type === 'microsoft' ? 'Microsoft 365' : 'SMTP / IMAP';
|
|
807
|
-
return h('div', { key: integ.id, style: { padding: 12, background: 'var(--bg-success, rgba(34,197,94,0.08))', borderRadius: 'var(--radius)', border: '1px solid var(--border)' } },
|
|
808
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
|
|
809
|
-
h('span', { style: { color: '#15803d', fontSize: 18 } }, '\u2713'),
|
|
810
|
-
h('strong', null, integ.name || typeLabel)
|
|
811
|
-
),
|
|
812
|
-
h('div', { style: { fontSize: 13, color: 'var(--text-secondary)' } },
|
|
813
|
-
'Type: ', typeLabel, ' \u2022 Status: ', integ.status || 'unknown'
|
|
814
|
-
)
|
|
815
|
-
);
|
|
816
|
-
})
|
|
817
|
-
);
|
|
818
|
-
})()
|
|
819
|
-
)
|
|
820
|
-
)
|
|
821
|
-
),
|
|
822
|
-
|
|
823
|
-
tab === 'email' && !effectiveOrgId && h('div', null,
|
|
824
|
-
// Saved configurations summary
|
|
825
|
-
(settings.smtpUser || settings.cfApiToken) && h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
826
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Active Email Configuration')),
|
|
827
|
-
h('div', { className: 'card-body' },
|
|
828
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
|
|
829
|
-
settings.smtpUser && h('div', { style: { padding: 12, background: 'var(--bg-success, rgba(34,197,94,0.08))', borderRadius: 'var(--radius)', border: '1px solid var(--border)' } },
|
|
830
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 } },
|
|
831
|
-
h('span', { style: { color: '#15803d', fontSize: 18 } }, '\u2713'),
|
|
832
|
-
h('strong', null, 'Relay Configured')
|
|
833
|
-
),
|
|
834
|
-
h('div', { style: { fontSize: 13, color: 'var(--text-secondary)' } },
|
|
835
|
-
h('div', null, 'Host: ', h('code', null, settings.smtpHost || 'smtp.gmail.com')),
|
|
836
|
-
h('div', null, 'User: ', h('code', null, settings.smtpUser)),
|
|
837
|
-
h('div', null, 'Password: ', h('code', null, '\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022'))
|
|
838
|
-
)
|
|
839
|
-
),
|
|
840
|
-
settings.cfApiToken && h('div', { style: { padding: 12, background: 'var(--bg-success, rgba(34,197,94,0.08))', borderRadius: 'var(--radius)', border: '1px solid var(--border)' } },
|
|
841
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 } },
|
|
842
|
-
h('span', { style: { color: '#15803d', fontSize: 18 } }, '\u2713'),
|
|
843
|
-
h('strong', null, 'Custom Domain Configured')
|
|
844
|
-
),
|
|
845
|
-
h('div', { style: { fontSize: 13, color: 'var(--text-secondary)' } },
|
|
846
|
-
h('div', null, 'Domain: ', h('code', null, settings.domain || 'Not set')),
|
|
847
|
-
h('div', null, 'CF Token: ', h('code', null, (settings.cfApiToken || '').slice(0, 8) + '\u2022\u2022\u2022\u2022')),
|
|
848
|
-
h('div', null, 'CF Account: ', h('code', null, settings.cfAccountId || 'Not set'))
|
|
849
|
-
)
|
|
850
|
-
)
|
|
851
|
-
)
|
|
852
|
-
)
|
|
853
|
-
),
|
|
854
|
-
h('div', { className: 'card' },
|
|
855
|
-
h('div', { className: 'card-header' }, h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Email & Domain Configuration', h(HelpButton, { label: 'Email & Domain Configuration' },
|
|
856
|
-
h('p', null, 'Configure how your agents send and receive email. Choose between a simple Gmail/Outlook relay or a professional custom domain setup.'),
|
|
857
|
-
h('p', null, h('strong', null, 'Relay'), ' — Easy, agents send from yourname+agent@gmail.com. Great for getting started.'),
|
|
858
|
-
h('p', null, h('strong', null, 'Custom Domain'), ' — Professional, agents send from agent@yourdomain.com with DKIM/SPF/DMARC.'),
|
|
859
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary, #1e293b)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Start with relay for quick setup. Upgrade to a custom domain when you need professional email branding.')
|
|
860
|
-
))),
|
|
861
|
-
h('div', { className: 'card-body' },
|
|
862
|
-
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.'),
|
|
863
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
|
|
864
|
-
h('div', { className: 'preset-card', style: { cursor: 'default' } },
|
|
865
|
-
h('h4', null, 'Gmail / Outlook Relay'),
|
|
866
|
-
h('p', { style: { marginBottom: 12 } }, 'Easy setup. Agents send from yourname+agent@gmail.com. Best for getting started.'),
|
|
867
|
-
h('div', { className: 'form-group' },
|
|
868
|
-
h('label', { className: 'form-label' }, 'Email Address'),
|
|
869
|
-
h('input', { className: 'input', value: settings.smtpUser || '', onChange: e => setSettings(s => ({ ...s, smtpUser: e.target.value })), placeholder: 'you@gmail.com' })
|
|
870
|
-
),
|
|
871
|
-
h('div', { className: 'form-group' },
|
|
872
|
-
h('label', { className: 'form-label' }, 'App Password'),
|
|
873
|
-
h('input', { className: 'input', type: 'password', value: settings.smtpPass || '', onChange: e => setSettings(s => ({ ...s, smtpPass: e.target.value })), placeholder: 'xxxx xxxx xxxx xxxx' }),
|
|
874
|
-
h('p', { className: 'form-help' }, h('a', { href: 'https://myaccount.google.com/apppasswords', target: '_blank' }, 'Get app password from Google'))
|
|
875
|
-
),
|
|
876
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: () => apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ smtpHost: 'smtp.gmail.com', smtpPort: 587, smtpUser: settings.smtpUser || null, smtpPass: settings.smtpPass || null }) }).then(d => { setSettings(s => ({ ...s, ...d })); toast('Relay config saved', 'success'); }).catch(e => toast(e.message, 'error')) }, 'Save Relay Config')
|
|
877
|
-
),
|
|
878
|
-
h('div', { className: 'preset-card', style: { cursor: 'default' } },
|
|
879
|
-
h('h4', null, 'Custom Domain'),
|
|
880
|
-
h('p', { style: { marginBottom: 12 } }, 'Professional setup. Agents send from agent@yourdomain.com with full email authentication.'),
|
|
881
|
-
h('div', { className: 'form-group' },
|
|
882
|
-
h('label', { className: 'form-label' }, 'Domain'),
|
|
883
|
-
h('input', { className: 'input', value: settings.domain || '', onChange: e => setSettings(s => ({ ...s, domain: e.target.value })), placeholder: 'yourdomain.com' })
|
|
884
|
-
),
|
|
885
|
-
h('div', { className: 'form-group' },
|
|
886
|
-
h('label', { className: 'form-label' }, 'Cloudflare API Token'),
|
|
887
|
-
h('input', { className: 'input', type: 'password', value: settings.cfApiToken || '', onChange: e => setSettings(s => ({ ...s, cfApiToken: e.target.value })), placeholder: 'Your Cloudflare API token' })
|
|
888
|
-
),
|
|
889
|
-
h('div', { className: 'form-group' },
|
|
890
|
-
h('label', { className: 'form-label' }, 'Cloudflare Account ID'),
|
|
891
|
-
h('input', { className: 'input', value: settings.cfAccountId || '', onChange: e => setSettings(s => ({ ...s, cfAccountId: e.target.value })), placeholder: 'Account ID' })
|
|
892
|
-
),
|
|
893
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: () => apiCall('/settings', { method: 'PATCH', body: JSON.stringify({ domain: settings.domain || 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')
|
|
894
|
-
)
|
|
895
|
-
)
|
|
896
|
-
)
|
|
897
|
-
)
|
|
898
|
-
),
|
|
899
|
-
|
|
900
|
-
tab === 'deployments' && h('div', null,
|
|
901
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
902
|
-
h('div', { className: 'card-header' },
|
|
903
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
904
|
-
h('h3', { style: { display: 'flex', alignItems: 'center' } }, 'Deploy Credentials', h(HelpButton, { label: 'Deploy Credentials' },
|
|
905
|
-
h('p', null, 'Store credentials for deploying agents to external platforms (Docker registries, cloud providers, etc.). These are encrypted at rest with AES-256-GCM.'),
|
|
906
|
-
h('p', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary, #1e293b)', borderRadius: 6, fontSize: 13 } }, h('strong', null, 'Tip: '), 'Add credentials here before using the agent deployment feature. Each credential is tied to a specific target type (Docker, Kubernetes, etc.).')
|
|
907
|
-
)),
|
|
908
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: () => { setDeployForm({ name: '', targetType: 'docker', config: {} }); setShowDeployModal(true); } }, I.plus(), ' Add Credential')
|
|
909
|
-
)
|
|
910
|
-
),
|
|
911
|
-
h('div', { className: 'card-body-flush' },
|
|
912
|
-
deployCreds.length === 0 ? h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } }, 'No deploy credentials configured. Add one to enable agent deployment.')
|
|
913
|
-
: h('table', null,
|
|
914
|
-
h('thead', null, h('tr', null, h('th', null, 'Name'), h('th', null, 'Target'), h('th', null, 'Created'), h('th', null, 'Actions'))),
|
|
915
|
-
h('tbody', null, deployCreds.map(c =>
|
|
916
|
-
h('tr', { key: c.id },
|
|
917
|
-
h('td', null, h('strong', null, c.name)),
|
|
918
|
-
h('td', null, h('span', { className: 'badge badge-neutral' }, c.targetType)),
|
|
919
|
-
h('td', { style: { fontSize: 12, color: 'var(--text-muted)' } }, c.createdAt ? new Date(c.createdAt).toLocaleDateString() : '-'),
|
|
920
|
-
h('td', null, h('button', { className: 'btn btn-danger btn-sm', onClick: () => deleteDeployCred(c.id) }, 'Delete'))
|
|
921
|
-
)
|
|
922
|
-
))
|
|
923
|
-
)
|
|
924
|
-
)
|
|
925
|
-
),
|
|
926
|
-
showDeployModal && h('div', { className: 'modal-overlay', onClick: e => { if (e.target === e.currentTarget) setShowDeployModal(false); } },
|
|
927
|
-
h('div', { className: 'modal', style: { maxWidth: 500 } },
|
|
928
|
-
h('div', { className: 'modal-header' },
|
|
929
|
-
h('h3', null, 'Add Deploy Credential'),
|
|
930
|
-
h('button', { className: 'modal-close', onClick: () => setShowDeployModal(false) }, '\u00D7')
|
|
931
|
-
),
|
|
932
|
-
h('div', { className: 'modal-body' },
|
|
933
|
-
h('div', { className: 'form-group' },
|
|
934
|
-
h('label', { className: 'form-label' }, 'Name'),
|
|
935
|
-
h('input', { className: 'input', value: deployForm.name, onChange: e => setDeployForm(f => ({ ...f, name: e.target.value })), placeholder: 'e.g., Production Docker Registry' })
|
|
936
|
-
),
|
|
937
|
-
h('div', { className: 'form-group' },
|
|
938
|
-
h('label', { className: 'form-label' }, 'Target Type'),
|
|
939
|
-
h('select', { className: 'input', value: deployForm.targetType, onChange: e => setDeployForm(f => ({ ...f, targetType: e.target.value, config: {} })) },
|
|
940
|
-
h('option', { value: 'docker' }, 'Docker Registry'),
|
|
941
|
-
h('option', { value: 'ssh' }, 'SSH / VPS'),
|
|
942
|
-
h('option', { value: 'fly' }, 'Fly.io'),
|
|
943
|
-
h('option', { value: 'railway' }, 'Railway'),
|
|
944
|
-
h('option', { value: 'vps' }, 'VPS (Generic)')
|
|
945
|
-
)
|
|
946
|
-
),
|
|
947
|
-
deployForm.targetType === 'docker' && h(Fragment, null,
|
|
948
|
-
h('div', { className: 'form-group' },
|
|
949
|
-
h('label', { className: 'form-label' }, 'Registry URL'),
|
|
950
|
-
h('input', { className: 'input', value: deployForm.config.registryUrl || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, registryUrl: e.target.value } })), placeholder: 'registry.example.com' })
|
|
951
|
-
),
|
|
952
|
-
h('div', { className: 'form-group' },
|
|
953
|
-
h('label', { className: 'form-label' }, 'Username'),
|
|
954
|
-
h('input', { className: 'input', value: deployForm.config.username || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, username: e.target.value } })) })
|
|
955
|
-
),
|
|
956
|
-
h('div', { className: 'form-group' },
|
|
957
|
-
h('label', { className: 'form-label' }, 'Password / Token'),
|
|
958
|
-
h('input', { className: 'input', type: 'password', value: deployForm.config.password || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, password: e.target.value } })) })
|
|
959
|
-
)
|
|
960
|
-
),
|
|
961
|
-
(deployForm.targetType === 'ssh' || deployForm.targetType === 'vps') && h(Fragment, null,
|
|
962
|
-
h('div', { className: 'form-group' },
|
|
963
|
-
h('label', { className: 'form-label' }, 'Host'),
|
|
964
|
-
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' })
|
|
965
|
-
),
|
|
966
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
|
|
967
|
-
h('div', { className: 'form-group' },
|
|
968
|
-
h('label', { className: 'form-label' }, 'Port'),
|
|
969
|
-
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 } })) })
|
|
970
|
-
),
|
|
971
|
-
h('div', { className: 'form-group' },
|
|
972
|
-
h('label', { className: 'form-label' }, 'Username'),
|
|
973
|
-
h('input', { className: 'input', value: deployForm.config.username || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, username: e.target.value } })), placeholder: 'root' })
|
|
974
|
-
)
|
|
975
|
-
),
|
|
976
|
-
h('div', { className: 'form-group' },
|
|
977
|
-
h('label', { className: 'form-label' }, 'SSH Private Key'),
|
|
978
|
-
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-----' })
|
|
979
|
-
)
|
|
980
|
-
),
|
|
981
|
-
deployForm.targetType === 'fly' && h('div', { className: 'form-group' },
|
|
982
|
-
h('label', { className: 'form-label' }, 'Fly.io API Token'),
|
|
983
|
-
h('input', { className: 'input', type: 'password', value: deployForm.config.apiToken || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, apiToken: e.target.value } })), placeholder: 'FlyV1 ...' })
|
|
984
|
-
),
|
|
985
|
-
deployForm.targetType === 'railway' && h(Fragment, null,
|
|
986
|
-
h('div', { className: 'form-group' },
|
|
987
|
-
h('label', { className: 'form-label' }, 'Railway API Token'),
|
|
988
|
-
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' })
|
|
989
|
-
),
|
|
990
|
-
h('div', { className: 'form-group' },
|
|
991
|
-
h('label', { className: 'form-label' }, 'Project ID'),
|
|
992
|
-
h('input', { className: 'input', value: deployForm.config.projectId || '', onChange: e => setDeployForm(f => ({ ...f, config: { ...f.config, projectId: e.target.value } })) })
|
|
993
|
-
)
|
|
994
|
-
)
|
|
995
|
-
),
|
|
996
|
-
h('div', { className: 'modal-footer' },
|
|
997
|
-
h('button', { className: 'btn btn-secondary', onClick: () => setShowDeployModal(false) }, 'Cancel'),
|
|
998
|
-
h('button', { className: 'btn btn-primary', onClick: createDeployCred, disabled: !deployForm.name }, 'Create Credential')
|
|
999
|
-
)
|
|
1000
|
-
)
|
|
1001
|
-
)
|
|
1002
|
-
),
|
|
1003
|
-
|
|
1004
|
-
tab === 'security-system' && h(ComprehensiveSecurityTab, { securityConfig: securityConfig, setSecurityConfig: function(v) { setSecurityConfig(v); setSecurityDirty(true); }, saving: securitySaving, dirty: securityDirty, events: securityEvents, setEvents: setSecurityEvents, portScanResult: portScanResult, setPortScanResult: setPortScanResult, onSave: function() {
|
|
1005
|
-
setSecuritySaving(true);
|
|
1006
|
-
apiCall('/settings/security', { method: 'PUT', body: JSON.stringify({ securityConfig: securityConfig }) }).then(() => {
|
|
1007
|
-
toast('Security settings updated', 'success');
|
|
1008
|
-
setSecurityDirty(false);
|
|
1009
|
-
}).catch(err => {
|
|
1010
|
-
toast('Failed to save: ' + err.message, 'error');
|
|
1011
|
-
}).finally(() => { setSecuritySaving(false); });
|
|
1012
|
-
} }),
|
|
1013
|
-
|
|
1014
|
-
tab === 'tool-security' && h(ToolSecurityTab, { toolSec: toolSec, setToolSec: function(v) { setToolSec(v); setToolSecDirty(true); }, saving: toolSecSaving, dirty: toolSecDirty, onSave: function() {
|
|
1015
|
-
setToolSecSaving(true);
|
|
1016
|
-
apiCall('/settings/tool-security', { method: 'PUT', body: JSON.stringify(toolSec) })
|
|
1017
|
-
.then(function(d) { setToolSec({ security: (d.toolSecurityConfig || {}).security || toolSec.security, middleware: (d.toolSecurityConfig || {}).middleware || toolSec.middleware }); setToolSecDirty(false); toast('Tool security settings saved', 'success'); })
|
|
1018
|
-
.catch(function(e) { toast(e.message, 'error'); })
|
|
1019
|
-
.finally(function() { setToolSecSaving(false); });
|
|
1020
|
-
} }),
|
|
1021
|
-
|
|
1022
|
-
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() {
|
|
1023
|
-
setFwSaving(true);
|
|
1024
|
-
apiCall('/settings/firewall', { method: 'PUT', body: JSON.stringify(fw) })
|
|
1025
|
-
.then(function(d) { setFw(d.firewallConfig || fw); setFwDirty(false); toast('Network & firewall settings saved and applied (hot-reloaded)', 'success'); })
|
|
1026
|
-
.catch(function(e) { toast(e.message, 'error'); })
|
|
1027
|
-
.finally(function() { setFwSaving(false); });
|
|
1028
|
-
}, onTestIp: function() {
|
|
1029
|
-
if (!fwTestIp.trim()) return;
|
|
1030
|
-
apiCall('/settings/firewall/test-ip', { method: 'POST', body: JSON.stringify({ ip: fwTestIp.trim() }) })
|
|
1031
|
-
.then(function(d) { setFwTestResult(d); })
|
|
1032
|
-
.catch(function(e) { setFwTestResult({ error: e.message }); });
|
|
1033
|
-
} }),
|
|
1034
|
-
|
|
1035
|
-
// ── Org-Scoped Integrations Tab ──────────────────────
|
|
1036
|
-
tab === 'integrations' && effectiveOrgId && h(OrgIntegrationsTab, {
|
|
1037
|
-
orgId: effectiveOrgId,
|
|
1038
|
-
integrations: orgIntegrations,
|
|
1039
|
-
loading: orgIntLoading,
|
|
1040
|
-
showAdd: showAddIntegration,
|
|
1041
|
-
setShowAdd: setShowAddIntegration,
|
|
1042
|
-
form: orgIntForm,
|
|
1043
|
-
setForm: setOrgIntForm,
|
|
1044
|
-
onReload: loadOrgIntegrations,
|
|
1045
|
-
toast: toast
|
|
1046
|
-
})
|
|
1047
|
-
);
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
// ═══════════════════════════════════════════════════════════
|
|
1051
|
-
// INTEGRATIONS TAB
|
|
1052
|
-
// ═══════════════════════════════════════════════════════════
|
|
1053
|
-
|
|
1054
|
-
// Category display names and order
|
|
1055
|
-
var CATEGORY_LABELS = {
|
|
1056
|
-
communication: 'Communication', crm: 'CRM & Sales', productivity: 'Productivity',
|
|
1057
|
-
devops: 'DevOps & CI/CD', infrastructure: 'Cloud & Infrastructure', 'data-ai': 'Database & AI/ML',
|
|
1058
|
-
monitoring: 'Analytics & Monitoring', security: 'Security & Identity', marketing: 'Marketing & Content',
|
|
1059
|
-
design: 'Design & Documents', finance: 'Finance & Payments', hr: 'HR & Recruiting',
|
|
1060
|
-
social: 'Social Media', ecommerce: 'E-commerce', cms: 'CMS', enterprise: 'Enterprise',
|
|
1061
|
-
general: 'Other'
|
|
1062
|
-
};
|
|
1063
|
-
|
|
1064
|
-
// Auth type display labels
|
|
1065
|
-
var AUTH_LABELS = { oauth2: 'OAuth', api_key: 'API Key', token: 'Token', credentials: 'Credentials' };
|
|
1066
|
-
|
|
1067
|
-
function IntegrationsTab(props) {
|
|
1068
|
-
var toast = props.toast;
|
|
1069
|
-
var _catalog = useState([]);
|
|
1070
|
-
var catalog = _catalog[0]; var setCatalog = _catalog[1];
|
|
1071
|
-
var _categories = useState([]);
|
|
1072
|
-
var categories = _categories[0]; var setCategories = _categories[1];
|
|
1073
|
-
var _loading = useState(true);
|
|
1074
|
-
var loading = _loading[0]; var setLoading = _loading[1];
|
|
1075
|
-
var _search = useState('');
|
|
1076
|
-
var search = _search[0]; var setSearch = _search[1];
|
|
1077
|
-
var _activeCategory = useState('all');
|
|
1078
|
-
var activeCategory = _activeCategory[0]; var setActiveCategory = _activeCategory[1];
|
|
1079
|
-
var _tokenModal = useState(null);
|
|
1080
|
-
var tokenModal = _tokenModal[0]; var setTokenModal = _tokenModal[1];
|
|
1081
|
-
var _tokenValue = useState('');
|
|
1082
|
-
var tokenValue = _tokenValue[0]; var setTokenValue = _tokenValue[1];
|
|
1083
|
-
var _actionLoading = useState(null);
|
|
1084
|
-
var actionLoading = _actionLoading[0]; var setActionLoading = _actionLoading[1];
|
|
1085
|
-
|
|
1086
|
-
var loadCatalog = useCallback(function() {
|
|
1087
|
-
engineCall('/integrations/catalog?orgId=' + getOrgId())
|
|
1088
|
-
.then(function(d) {
|
|
1089
|
-
setCatalog(d.catalog || []);
|
|
1090
|
-
setCategories(d.categories || []);
|
|
1091
|
-
setLoading(false);
|
|
1092
|
-
})
|
|
1093
|
-
.catch(function(e) {
|
|
1094
|
-
console.error('Failed to load integration catalog:', e);
|
|
1095
|
-
setLoading(false);
|
|
1096
|
-
});
|
|
1097
|
-
}, []);
|
|
1098
|
-
|
|
1099
|
-
useEffect(function() { loadCatalog(); }, [loadCatalog]);
|
|
1100
|
-
|
|
1101
|
-
// Filter integrations
|
|
1102
|
-
var filtered = catalog.filter(function(int) {
|
|
1103
|
-
var matchesCategory = activeCategory === 'all' || int.category === activeCategory;
|
|
1104
|
-
var matchesSearch = !search || int.name.toLowerCase().indexOf(search.toLowerCase()) !== -1 || int.skillId.toLowerCase().indexOf(search.toLowerCase()) !== -1;
|
|
1105
|
-
return matchesCategory && matchesSearch;
|
|
1106
|
-
});
|
|
1107
|
-
|
|
1108
|
-
// Sort: connected first, then alphabetically
|
|
1109
|
-
filtered.sort(function(a, b) {
|
|
1110
|
-
if (a.connected !== b.connected) return a.connected ? -1 : 1;
|
|
1111
|
-
return a.name.localeCompare(b.name);
|
|
1112
|
-
});
|
|
1113
|
-
|
|
1114
|
-
var connectedCount = catalog.filter(function(i) { return i.connected; }).length;
|
|
1115
|
-
|
|
1116
|
-
var handleConnect = function(int) {
|
|
1117
|
-
if (int.authType === 'api_key' || int.authType === 'token') {
|
|
1118
|
-
setTokenModal(int);
|
|
1119
|
-
setTokenValue('');
|
|
1120
|
-
return;
|
|
1121
|
-
}
|
|
1122
|
-
if (int.authType === 'credentials') {
|
|
1123
|
-
toast(int.name + ' requires multi-field credentials. Configure via CLI or API.', 'info');
|
|
1124
|
-
return;
|
|
1125
|
-
}
|
|
1126
|
-
setActionLoading(int.skillId);
|
|
1127
|
-
engineCall('/oauth/authorize/' + int.skillId + '?orgId=' + getOrgId())
|
|
1128
|
-
.then(function(d) {
|
|
1129
|
-
if (d.authorizationUrl || d.authUrl) {
|
|
1130
|
-
var popup = window.open(d.authorizationUrl || d.authUrl, 'oauth_connect', 'width=600,height=700,popup=yes');
|
|
1131
|
-
var checkInterval = setInterval(function() {
|
|
1132
|
-
if (popup && popup.closed) {
|
|
1133
|
-
clearInterval(checkInterval);
|
|
1134
|
-
setActionLoading(null);
|
|
1135
|
-
loadCatalog();
|
|
1136
|
-
}
|
|
1137
|
-
}, 500);
|
|
1138
|
-
setTimeout(function() { clearInterval(checkInterval); setActionLoading(null); }, 120000);
|
|
1139
|
-
} else {
|
|
1140
|
-
setActionLoading(null);
|
|
1141
|
-
toast('OAuth flow could not be started', 'error');
|
|
1142
|
-
}
|
|
1143
|
-
})
|
|
1144
|
-
.catch(function(e) {
|
|
1145
|
-
setActionLoading(null);
|
|
1146
|
-
toast('Connection failed: ' + e.message, 'error');
|
|
1147
|
-
});
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
var handleDisconnect = function(int) {
|
|
1151
|
-
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' })
|
|
1152
|
-
.then(function(ok) {
|
|
1153
|
-
if (!ok) return;
|
|
1154
|
-
setActionLoading(int.skillId);
|
|
1155
|
-
engineCall('/oauth/disconnect/' + int.skillId + '?orgId=' + getOrgId(), { method: 'DELETE' })
|
|
1156
|
-
.then(function() { toast(int.name + ' disconnected', 'success'); loadCatalog(); })
|
|
1157
|
-
.catch(function(e) { toast('Failed: ' + e.message, 'error'); })
|
|
1158
|
-
.finally(function() { setActionLoading(null); });
|
|
1159
|
-
});
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
|
-
var handleSaveToken = function() {
|
|
1163
|
-
if (!tokenModal || !tokenValue.trim()) return;
|
|
1164
|
-
setActionLoading(tokenModal.skillId);
|
|
1165
|
-
engineCall('/oauth/authorize/' + tokenModal.skillId + '?orgId=' + getOrgId(), {
|
|
1166
|
-
method: 'POST',
|
|
1167
|
-
body: JSON.stringify({ token: tokenValue.trim() })
|
|
1168
|
-
})
|
|
1169
|
-
.then(function() { toast(tokenModal.name + ' connected', 'success'); setTokenModal(null); loadCatalog(); })
|
|
1170
|
-
.catch(function(e) { toast('Failed: ' + e.message, 'error'); })
|
|
1171
|
-
.finally(function() { setActionLoading(null); });
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
return h('div', null,
|
|
1175
|
-
h('div', { className: 'card' },
|
|
1176
|
-
h('div', { className: 'card-header' },
|
|
1177
|
-
h('h3', { style: { display: 'inline-flex', alignItems: 'center' } }, 'Integrations',
|
|
1178
|
-
h('span', { className: 'badge badge-neutral', style: { marginLeft: 8, fontSize: 11 } }, catalog.length + ' available'),
|
|
1179
|
-
connectedCount > 0 && h('span', { className: 'badge badge-success', style: { marginLeft: 6, fontSize: 11 } }, connectedCount + ' connected'),
|
|
1180
|
-
h(HelpButton, { label: SETTINGS_HELP.integrations.label }, SETTINGS_HELP.integrations.content())
|
|
1181
|
-
)
|
|
1182
|
-
),
|
|
1183
|
-
h('div', { className: 'card-body' },
|
|
1184
|
-
h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, marginBottom: 16 } },
|
|
1185
|
-
'Connect external services to extend agent capabilities. 144 integrations available — agents automatically get tools for connected services.'
|
|
1186
|
-
),
|
|
1187
|
-
|
|
1188
|
-
// Search + category filter bar
|
|
1189
|
-
h('div', { style: { display: 'flex', gap: 12, marginBottom: 16, flexWrap: 'wrap', alignItems: 'center' } },
|
|
1190
|
-
h('input', {
|
|
1191
|
-
type: 'text', placeholder: 'Search integrations...', value: search,
|
|
1192
|
-
onInput: function(e) { setSearch(e.target.value); },
|
|
1193
|
-
style: { flex: '1 1 200px', minWidth: 150, padding: '8px 12px', border: '1px solid var(--border)', borderRadius: 'var(--radius)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', fontSize: 13 }
|
|
1194
|
-
}),
|
|
1195
|
-
h('select', {
|
|
1196
|
-
value: activeCategory,
|
|
1197
|
-
onChange: function(e) { setActiveCategory(e.target.value); },
|
|
1198
|
-
style: { padding: '8px 12px', border: '1px solid var(--border)', borderRadius: 'var(--radius)', background: 'var(--bg-secondary)', color: 'var(--text-primary)', fontSize: 13 }
|
|
1199
|
-
},
|
|
1200
|
-
h('option', { value: 'all' }, 'All Categories (' + catalog.length + ')'),
|
|
1201
|
-
categories.map(function(cat) {
|
|
1202
|
-
var count = catalog.filter(function(i) { return i.category === cat; }).length;
|
|
1203
|
-
return h('option', { key: cat, value: cat }, (CATEGORY_LABELS[cat] || cat) + ' (' + count + ')');
|
|
1204
|
-
})
|
|
1205
|
-
)
|
|
1206
|
-
),
|
|
1207
|
-
|
|
1208
|
-
loading
|
|
1209
|
-
? h('div', { style: { textAlign: 'center', padding: 40, color: 'var(--text-muted)' } }, 'Loading integrations...')
|
|
1210
|
-
: filtered.length === 0
|
|
1211
|
-
? h('div', { style: { textAlign: 'center', padding: 40, color: 'var(--text-muted)' } }, 'No integrations match your search.')
|
|
1212
|
-
: h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(260px, 1fr))', gap: 12 } },
|
|
1213
|
-
filtered.map(function(int) {
|
|
1214
|
-
var connected = int.connected === true;
|
|
1215
|
-
var isLoading = actionLoading === int.skillId;
|
|
1216
|
-
var authLabel = AUTH_LABELS[int.authType] || int.authType;
|
|
1217
|
-
return h('div', { key: int.skillId, style: {
|
|
1218
|
-
padding: 14, border: '1px solid ' + (connected ? 'var(--brand-color, #6366f1)' : 'var(--border)'),
|
|
1219
|
-
borderRadius: 'var(--radius)', background: connected ? 'var(--bg-secondary)' : 'transparent',
|
|
1220
|
-
opacity: isLoading ? 0.6 : 1, transition: 'border-color 0.2s, background 0.2s'
|
|
1221
|
-
} },
|
|
1222
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 6 } },
|
|
1223
|
-
h('strong', { style: { fontSize: 13 } }, int.name),
|
|
1224
|
-
h('span', { className: 'badge badge-' + (connected ? 'success' : 'neutral'), style: { fontSize: 10 } },
|
|
1225
|
-
connected ? 'Connected' : authLabel)
|
|
1226
|
-
),
|
|
1227
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 } },
|
|
1228
|
-
h('span', { style: { fontSize: 11, color: 'var(--text-muted)' } },
|
|
1229
|
-
(CATEGORY_LABELS[int.category] || int.category) + ' \u00B7 ' + int.toolCount + ' tool' + (int.toolCount !== 1 ? 's' : '')
|
|
1230
|
-
)
|
|
1231
|
-
),
|
|
1232
|
-
connected
|
|
1233
|
-
? h('button', {
|
|
1234
|
-
className: 'btn btn-secondary btn-sm',
|
|
1235
|
-
disabled: isLoading,
|
|
1236
|
-
onClick: function() { handleDisconnect(int); }
|
|
1237
|
-
}, isLoading ? 'Disconnecting...' : 'Disconnect')
|
|
1238
|
-
: h('button', {
|
|
1239
|
-
className: 'btn btn-primary btn-sm',
|
|
1240
|
-
disabled: isLoading,
|
|
1241
|
-
onClick: function() { handleConnect(int); }
|
|
1242
|
-
}, isLoading ? 'Connecting...' : 'Connect')
|
|
1243
|
-
);
|
|
1244
|
-
})
|
|
1245
|
-
)
|
|
1246
|
-
)
|
|
1247
|
-
),
|
|
1248
|
-
|
|
1249
|
-
tokenModal && h(Modal, { title: 'Connect ' + tokenModal.name, onClose: function() { setTokenModal(null); } },
|
|
1250
|
-
h('div', { style: { padding: 20 } },
|
|
1251
|
-
h('p', { style: { fontSize: 13, color: 'var(--text-secondary)', marginBottom: 16 } },
|
|
1252
|
-
'Enter your ', h('strong', null, AUTH_LABELS[tokenModal.authType] || 'API Token'), ' for ', tokenModal.name, '. This will be stored securely in the vault.'
|
|
1253
|
-
),
|
|
1254
|
-
h('div', { className: 'form-group' },
|
|
1255
|
-
h('label', null, AUTH_LABELS[tokenModal.authType] || 'API Token'),
|
|
1256
|
-
h('input', {
|
|
1257
|
-
className: 'input', type: 'password',
|
|
1258
|
-
value: tokenValue,
|
|
1259
|
-
onChange: function(e) { setTokenValue(e.target.value); },
|
|
1260
|
-
placeholder: 'Paste your token here...',
|
|
1261
|
-
autoFocus: true
|
|
1262
|
-
})
|
|
1263
|
-
),
|
|
1264
|
-
h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 16 } },
|
|
1265
|
-
h('button', { className: 'btn btn-secondary', onClick: function() { setTokenModal(null); } }, 'Cancel'),
|
|
1266
|
-
h('button', {
|
|
1267
|
-
className: 'btn btn-primary',
|
|
1268
|
-
disabled: !tokenValue.trim() || actionLoading === tokenModal.skillId,
|
|
1269
|
-
onClick: handleSaveToken
|
|
1270
|
-
}, actionLoading === tokenModal.skillId ? 'Saving...' : 'Save & Connect')
|
|
1271
|
-
)
|
|
1272
|
-
)
|
|
1273
|
-
)
|
|
1274
|
-
);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
// ═══════════════════════════════════════════════════════════
|
|
1278
|
-
// TOOL SECURITY TAB
|
|
1279
|
-
// ═══════════════════════════════════════════════════════════
|
|
1280
|
-
|
|
1281
|
-
var _cardStyle = { border: '1px solid var(--border)', borderRadius: 'var(--radius)', padding: 20, marginBottom: 16 };
|
|
1282
|
-
var _cardTitleStyle = { fontSize: 15, fontWeight: 600, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 8 };
|
|
1283
|
-
var _cardDescStyle = { fontSize: 12, color: 'var(--text-muted)', marginBottom: 16 };
|
|
1284
|
-
var _toggleRowStyle = { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 };
|
|
1285
|
-
var _gridStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 };
|
|
1286
|
-
var _sectionTitleStyle = { fontSize: 14, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 12, marginTop: 8 };
|
|
1287
|
-
|
|
1288
|
-
function ToggleSwitch(props) {
|
|
1289
|
-
var checked = props.checked;
|
|
1290
|
-
var onChange = props.onChange;
|
|
1291
|
-
var label = props.label;
|
|
1292
|
-
return h('div', { style: _toggleRowStyle },
|
|
1293
|
-
h('span', { style: { fontSize: 13, fontWeight: 500 } }, label),
|
|
1294
|
-
h('label', { style: { position: 'relative', display: 'inline-block', width: 40, height: 22, cursor: 'pointer' } },
|
|
1295
|
-
h('input', { type: 'checkbox', checked: checked, onChange: function(e) { onChange(e.target.checked); }, style: { opacity: 0, width: 0, height: 0 } }),
|
|
1296
|
-
h('span', { style: {
|
|
1297
|
-
position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,
|
|
1298
|
-
background: checked ? 'var(--brand-color, #6366f1)' : 'var(--bg-tertiary, #374151)',
|
|
1299
|
-
borderRadius: 11, transition: 'background 0.2s'
|
|
1300
|
-
} },
|
|
1301
|
-
h('span', { style: {
|
|
1302
|
-
position: 'absolute', top: 2, left: checked ? 20 : 2, width: 18, height: 18,
|
|
1303
|
-
background: '#fff', borderRadius: '50%', transition: 'left 0.2s', boxShadow: '0 1px 3px rgba(0,0,0,0.2)'
|
|
1304
|
-
} })
|
|
1305
|
-
)
|
|
1306
|
-
)
|
|
1307
|
-
);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
function RateLimitEditor(props) {
|
|
1311
|
-
var overrides = props.overrides || {};
|
|
1312
|
-
var onChange = props.onChange;
|
|
1313
|
-
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 } };
|
|
1314
|
-
var tools = Object.keys(DEFAULT_LIMITS);
|
|
1315
|
-
|
|
1316
|
-
var setOverride = function(tool, field, value) {
|
|
1317
|
-
var current = overrides[tool] || { maxTokens: DEFAULT_LIMITS[tool].max, refillRate: DEFAULT_LIMITS[tool].rate };
|
|
1318
|
-
var next = Object.assign({}, overrides);
|
|
1319
|
-
next[tool] = Object.assign({}, current);
|
|
1320
|
-
next[tool][field] = parseInt(value) || 0;
|
|
1321
|
-
onChange(next);
|
|
1322
|
-
};
|
|
1323
|
-
|
|
1324
|
-
return h('div', { style: { fontSize: 12 } },
|
|
1325
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 80px 80px', gap: 4, marginBottom: 4 } },
|
|
1326
|
-
h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)' } }, 'Tool'),
|
|
1327
|
-
h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)', textAlign: 'center' } }, 'Max/min'),
|
|
1328
|
-
h('span', { style: { fontWeight: 600, color: 'var(--text-secondary)', textAlign: 'center' } }, 'Refill/min')
|
|
1329
|
-
),
|
|
1330
|
-
tools.map(function(tool) {
|
|
1331
|
-
var def = DEFAULT_LIMITS[tool];
|
|
1332
|
-
var ov = overrides[tool];
|
|
1333
|
-
return h('div', { key: tool, style: { display: 'grid', gridTemplateColumns: '1fr 80px 80px', gap: 4, marginBottom: 2 } },
|
|
1334
|
-
h('span', { style: { fontFamily: 'var(--font-mono)', fontSize: 11, padding: '4px 0' } }, tool),
|
|
1335
|
-
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); } }),
|
|
1336
|
-
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); } })
|
|
1337
|
-
);
|
|
1338
|
-
})
|
|
1339
|
-
);
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
function ToolSecurityTab(props) {
|
|
1343
|
-
var toolSec = props.toolSec;
|
|
1344
|
-
var setToolSec = props.setToolSec;
|
|
1345
|
-
var saving = props.saving;
|
|
1346
|
-
var dirty = props.dirty;
|
|
1347
|
-
|
|
1348
|
-
var sec = toolSec.security || {};
|
|
1349
|
-
var mw = toolSec.middleware || {};
|
|
1350
|
-
|
|
1351
|
-
var setSec = function(key, value) {
|
|
1352
|
-
var next = Object.assign({}, sec);
|
|
1353
|
-
next[key] = value;
|
|
1354
|
-
setToolSec({ security: next, middleware: mw });
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
var setMw = function(key, value) {
|
|
1358
|
-
var next = Object.assign({}, mw);
|
|
1359
|
-
next[key] = value;
|
|
1360
|
-
setToolSec({ security: sec, middleware: next });
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
|
-
var patchSec = function(section, field, value) {
|
|
1364
|
-
var current = sec[section] || {};
|
|
1365
|
-
var next = Object.assign({}, current);
|
|
1366
|
-
next[field] = value;
|
|
1367
|
-
setSec(section, next);
|
|
1368
|
-
};
|
|
1369
|
-
|
|
1370
|
-
var patchMw = function(section, field, value) {
|
|
1371
|
-
var current = mw[section] || {};
|
|
1372
|
-
var next = Object.assign({}, current);
|
|
1373
|
-
next[field] = value;
|
|
1374
|
-
setMw(section, next);
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
|
-
var ps = sec.pathSandbox || {};
|
|
1378
|
-
var ssrf = sec.ssrf || {};
|
|
1379
|
-
var cs = sec.commandSanitizer || {};
|
|
1380
|
-
var audit = mw.audit || {};
|
|
1381
|
-
var rl = mw.rateLimit || {};
|
|
1382
|
-
var cb = mw.circuitBreaker || {};
|
|
1383
|
-
var tel = mw.telemetry || {};
|
|
1384
|
-
|
|
1385
|
-
return h(Fragment, null,
|
|
1386
|
-
// Header
|
|
1387
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
|
|
1388
|
-
h('div', null,
|
|
1389
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 0 } },
|
|
1390
|
-
h('h3', { style: { margin: 0, fontSize: 18, fontWeight: 600 } }, 'Agent Tool Security'),
|
|
1391
|
-
h(HelpButton, { label: SETTINGS_HELP.security.label }, SETTINGS_HELP.security.content())
|
|
1392
|
-
),
|
|
1393
|
-
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.')
|
|
1394
|
-
),
|
|
1395
|
-
h('button', {
|
|
1396
|
-
className: 'btn btn-primary',
|
|
1397
|
-
disabled: saving || !dirty,
|
|
1398
|
-
onClick: props.onSave
|
|
1399
|
-
}, saving ? 'Saving...' : 'Save Settings')
|
|
1400
|
-
),
|
|
1401
|
-
|
|
1402
|
-
// ── SECURITY SECTION ──
|
|
1403
|
-
h('div', { style: _sectionTitleStyle }, 'Security Sandboxes'),
|
|
1404
|
-
h('div', { style: _gridStyle },
|
|
1405
|
-
|
|
1406
|
-
// Path Sandbox
|
|
1407
|
-
h('div', { style: _cardStyle },
|
|
1408
|
-
h('div', { style: _cardTitleStyle }, I.folder(), ' Path Sandbox'),
|
|
1409
|
-
h('div', { style: _cardDescStyle }, 'Controls which directories agents can read/write. Blocks path traversal and sensitive files.'),
|
|
1410
|
-
h(ToggleSwitch, { label: 'Enable path sandboxing', checked: ps.enabled !== false, onChange: function(v) { patchSec('pathSandbox', 'enabled', v); } }),
|
|
1411
|
-
h(TagInput, { label: 'Additional Allowed Directories', value: ps.allowedDirs || [], onChange: function(v) { patchSec('pathSandbox', 'allowedDirs', v); }, placeholder: '/path/to/allow', mono: true }),
|
|
1412
|
-
h(TagInput, { label: 'Blocked File Patterns (regex)', value: ps.blockedPatterns || [], onChange: function(v) { patchSec('pathSandbox', 'blockedPatterns', v); }, placeholder: '\\.env$', mono: true })
|
|
1413
|
-
),
|
|
1414
|
-
|
|
1415
|
-
// SSRF Guard
|
|
1416
|
-
h('div', { style: _cardStyle },
|
|
1417
|
-
h('div', { style: _cardTitleStyle }, I.globe(), ' SSRF Protection'),
|
|
1418
|
-
h('div', { style: _cardDescStyle }, 'Blocks agents from accessing internal networks, cloud metadata endpoints, and private IPs.'),
|
|
1419
|
-
h(ToggleSwitch, { label: 'Enable SSRF protection', checked: ssrf.enabled !== false, onChange: function(v) { patchSec('ssrf', 'enabled', v); } }),
|
|
1420
|
-
h(TagInput, { label: 'Allowed Hosts (bypass SSRF check)', value: ssrf.allowedHosts || [], onChange: function(v) { patchSec('ssrf', 'allowedHosts', v); }, placeholder: 'api.example.com', mono: true }),
|
|
1421
|
-
h(TagInput, { label: 'Additional Blocked CIDRs', value: ssrf.blockedCidrs || [], onChange: function(v) { patchSec('ssrf', 'blockedCidrs', v); }, placeholder: '10.0.0.0/8', mono: true })
|
|
1422
|
-
)
|
|
1423
|
-
),
|
|
1424
|
-
|
|
1425
|
-
// Command Sanitizer (full width)
|
|
1426
|
-
h('div', { style: _cardStyle },
|
|
1427
|
-
h('div', { style: _cardTitleStyle }, I.terminal(), ' Command Sanitizer'),
|
|
1428
|
-
h('div', { style: _cardDescStyle }, 'Controls which shell commands agents can execute. Blocks dangerous patterns like rm -rf /, fork bombs, and shell injection.'),
|
|
1429
|
-
h(ToggleSwitch, { label: 'Enable command validation', checked: cs.enabled !== false, onChange: function(v) { patchSec('commandSanitizer', 'enabled', v); } }),
|
|
1430
|
-
h('div', { style: { marginBottom: 12 } },
|
|
1431
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
|
|
1432
|
-
h('select', { className: 'input', style: { width: 200 }, value: cs.mode || 'blocklist', onChange: function(e) { patchSec('commandSanitizer', 'mode', e.target.value); } },
|
|
1433
|
-
h('option', { value: 'blocklist' }, 'Blocklist (block specific patterns)'),
|
|
1434
|
-
h('option', { value: 'allowlist' }, 'Allowlist (only allow specific commands)')
|
|
1435
|
-
)
|
|
1436
|
-
),
|
|
1437
|
-
h('div', { style: _gridStyle },
|
|
1438
|
-
h(TagInput, { label: 'Allowed Commands (allowlist mode)', value: cs.allowedCommands || [], onChange: function(v) { patchSec('commandSanitizer', 'allowedCommands', v); }, placeholder: 'git, npm, node', mono: true }),
|
|
1439
|
-
h(TagInput, { label: 'Additional Blocked Patterns', value: cs.blockedPatterns || [], onChange: function(v) { patchSec('commandSanitizer', 'blockedPatterns', v); }, placeholder: 'curl.*\\|.*sh', mono: true })
|
|
1440
|
-
)
|
|
1441
|
-
),
|
|
1442
|
-
|
|
1443
|
-
// ── MIDDLEWARE SECTION ──
|
|
1444
|
-
h('div', { style: _sectionTitleStyle }, 'Middleware & Observability'),
|
|
1445
|
-
h('div', { style: _gridStyle },
|
|
1446
|
-
|
|
1447
|
-
// Audit Logging
|
|
1448
|
-
h('div', { style: _cardStyle },
|
|
1449
|
-
h('div', { style: _cardTitleStyle }, I.journal(), ' Audit Logging'),
|
|
1450
|
-
h('div', { style: _cardDescStyle }, 'Logs every tool invocation with agent ID, parameters (redacted), timing, and success/failure status.'),
|
|
1451
|
-
h(ToggleSwitch, { label: 'Enable audit logging', checked: audit.enabled !== false, onChange: function(v) { patchMw('audit', 'enabled', v); } }),
|
|
1452
|
-
h(TagInput, { label: 'Additional Keys to Redact', value: audit.redactKeys || [], onChange: function(v) { patchMw('audit', 'redactKeys', v); }, placeholder: 'custom_secret', mono: true })
|
|
1453
|
-
),
|
|
1454
|
-
|
|
1455
|
-
// Rate Limiting
|
|
1456
|
-
h('div', { style: _cardStyle },
|
|
1457
|
-
h('div', { style: _cardTitleStyle }, I.clock(), ' Rate Limiting'),
|
|
1458
|
-
h('div', { style: _cardDescStyle }, 'Per-agent, per-tool rate limits using token bucket algorithm. Prevents runaway agents from overwhelming resources.'),
|
|
1459
|
-
h(ToggleSwitch, { label: 'Enable rate limiting', checked: rl.enabled !== false, onChange: function(v) { patchMw('rateLimit', 'enabled', v); } }),
|
|
1460
|
-
h(RateLimitEditor, { overrides: rl.overrides || {}, onChange: function(v) { patchMw('rateLimit', 'overrides', v); } })
|
|
1461
|
-
),
|
|
1462
|
-
|
|
1463
|
-
// Circuit Breaker
|
|
1464
|
-
h('div', { style: _cardStyle },
|
|
1465
|
-
h('div', { style: _cardTitleStyle }, I.pause(), ' Circuit Breaker'),
|
|
1466
|
-
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.'),
|
|
1467
|
-
h(ToggleSwitch, { label: 'Enable circuit breaker', checked: cb.enabled !== false, onChange: function(v) { patchMw('circuitBreaker', 'enabled', v); } })
|
|
1468
|
-
),
|
|
1469
|
-
|
|
1470
|
-
// Telemetry
|
|
1471
|
-
h('div', { style: _cardStyle },
|
|
1472
|
-
h('div', { style: _cardTitleStyle }, I.chart(), ' Telemetry'),
|
|
1473
|
-
h('div', { style: _cardDescStyle }, 'Collects execution timing, success/failure counters, and output size metrics for all tool invocations.'),
|
|
1474
|
-
h(ToggleSwitch, { label: 'Enable telemetry collection', checked: tel.enabled !== false, onChange: function(v) { patchMw('telemetry', 'enabled', v); } })
|
|
1475
|
-
)
|
|
1476
|
-
),
|
|
1477
|
-
|
|
1478
|
-
// Bottom save bar
|
|
1479
|
-
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 } },
|
|
1480
|
-
h('button', { className: 'btn btn-primary', disabled: saving, onClick: props.onSave }, saving ? 'Saving...' : 'Save Tool Security Settings')
|
|
1481
|
-
)
|
|
1482
|
-
);
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
// ═══════════════════════════════════════════════════════════
|
|
1486
|
-
// NETWORK & FIREWALL TAB
|
|
1487
|
-
// ═══════════════════════════════════════════════════════════
|
|
1488
|
-
|
|
1489
|
-
// ─── Country Picker Component ────────────────────────────
|
|
1490
|
-
|
|
1491
|
-
function CountryPicker(props) {
|
|
1492
|
-
var selected = props.selected || [];
|
|
1493
|
-
var onChange = props.onChange;
|
|
1494
|
-
var _search = useState('');
|
|
1495
|
-
var search = _search[0]; var setSearch = _search[1];
|
|
1496
|
-
var _open = useState(false);
|
|
1497
|
-
var open = _open[0]; var setOpen = _open[1];
|
|
1498
|
-
|
|
1499
|
-
var selectedSet = new Set(selected);
|
|
1500
|
-
var filtered = search
|
|
1501
|
-
? COUNTRIES.filter(function(c) {
|
|
1502
|
-
var q = search.toLowerCase();
|
|
1503
|
-
return c.name.toLowerCase().indexOf(q) !== -1 || c.code.toLowerCase().indexOf(q) !== -1;
|
|
1504
|
-
})
|
|
1505
|
-
: COUNTRIES;
|
|
1506
|
-
|
|
1507
|
-
var toggle = function(code) {
|
|
1508
|
-
if (selectedSet.has(code)) {
|
|
1509
|
-
onChange(selected.filter(function(c) { return c !== code; }));
|
|
1510
|
-
} else {
|
|
1511
|
-
onChange(selected.concat([code]));
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
|
|
1515
|
-
var removeCountry = function(code) {
|
|
1516
|
-
onChange(selected.filter(function(c) { return c !== code; }));
|
|
1517
|
-
};
|
|
1518
|
-
|
|
1519
|
-
return h('div', { style: { position: 'relative' } },
|
|
1520
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Countries'),
|
|
1521
|
-
|
|
1522
|
-
// Selected chips
|
|
1523
|
-
selected.length > 0 && h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 4, marginBottom: 8 } },
|
|
1524
|
-
selected.map(function(code) {
|
|
1525
|
-
var c = COUNTRIES.find(function(x) { return x.code === code; });
|
|
1526
|
-
var label = c ? c.name + ' (' + code + ')' : code;
|
|
1527
|
-
return h('span', { key: code, style: { display: 'inline-flex', alignItems: 'center', gap: 4, padding: '2px 8px', borderRadius: 12, fontSize: 12, background: 'var(--bg-tertiary)', color: 'var(--text-primary)', border: '1px solid var(--border)' } },
|
|
1528
|
-
label,
|
|
1529
|
-
h('span', { style: { cursor: 'pointer', fontWeight: 700, fontSize: 14, lineHeight: 1, marginLeft: 2, color: 'var(--text-muted)' }, onClick: function() { removeCountry(code); } }, '\u00d7')
|
|
1530
|
-
);
|
|
1531
|
-
})
|
|
1532
|
-
),
|
|
1533
|
-
|
|
1534
|
-
// Add button
|
|
1535
|
-
h('button', { className: 'btn btn-secondary', style: { fontSize: 12, padding: '4px 12px' }, onClick: function() { setOpen(!open); setSearch(''); } },
|
|
1536
|
-
open ? 'Close' : '+ Add Country'
|
|
1537
|
-
),
|
|
1538
|
-
|
|
1539
|
-
// Dropdown
|
|
1540
|
-
open && h('div', { style: { position: 'absolute', zIndex: 100, top: '100%', left: 0, marginTop: 4, width: 320, maxHeight: 300, background: 'var(--bg-secondary)', border: '1px solid var(--border)', borderRadius: 8, boxShadow: '0 4px 12px rgba(0,0,0,0.3)', overflow: 'hidden' } },
|
|
1541
|
-
h('input', { className: 'input', style: { width: '100%', borderRadius: 0, borderBottom: '1px solid var(--border)', fontSize: 13, padding: '8px 12px', boxSizing: 'border-box' }, placeholder: 'Search countries...', value: search, onInput: function(e) { setSearch(e.target.value); }, autoFocus: true }),
|
|
1542
|
-
h('div', { style: { maxHeight: 250, overflowY: 'auto' } },
|
|
1543
|
-
filtered.length === 0
|
|
1544
|
-
? h('div', { style: { padding: 12, fontSize: 13, color: 'var(--text-muted)', textAlign: 'center' } }, 'No countries found')
|
|
1545
|
-
: filtered.map(function(c) {
|
|
1546
|
-
var isSelected = selectedSet.has(c.code);
|
|
1547
|
-
return h('div', {
|
|
1548
|
-
key: c.code,
|
|
1549
|
-
style: { display: 'flex', alignItems: 'center', gap: 8, padding: '6px 12px', cursor: 'pointer', fontSize: 13, background: isSelected ? 'var(--bg-tertiary)' : 'transparent', borderBottom: '1px solid var(--border-light, rgba(255,255,255,0.05))' },
|
|
1550
|
-
onClick: function() { toggle(c.code); }
|
|
1551
|
-
},
|
|
1552
|
-
h('input', { type: 'checkbox', checked: isSelected, readOnly: true, style: { margin: 0, accentColor: 'var(--accent)' } }),
|
|
1553
|
-
h('span', { style: { fontFamily: 'monospace', fontWeight: 600, minWidth: 28 } }, c.code),
|
|
1554
|
-
h('span', null, c.name)
|
|
1555
|
-
);
|
|
1556
|
-
})
|
|
1557
|
-
)
|
|
1558
|
-
)
|
|
1559
|
-
);
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
function ComprehensiveSecurityTab(props) {
|
|
1563
|
-
var securityConfig = props.securityConfig || {};
|
|
1564
|
-
var setSecurityConfig = props.setSecurityConfig;
|
|
1565
|
-
var saving = props.saving;
|
|
1566
|
-
var dirty = props.dirty;
|
|
1567
|
-
var onSave = props.onSave;
|
|
1568
|
-
var events = props.events || [];
|
|
1569
|
-
var setEvents = props.setEvents;
|
|
1570
|
-
var portScanResult = props.portScanResult;
|
|
1571
|
-
var setPortScanResult = props.setPortScanResult;
|
|
1572
|
-
|
|
1573
|
-
// Default values
|
|
1574
|
-
var promptInjection = securityConfig.promptInjection || { enabled: true, mode: 'sanitize', sensitivity: 'medium', customPatterns: [], allowedOverrideAgents: [], logDetections: true, blockResponse: '' };
|
|
1575
|
-
var sqlInjection = securityConfig.sqlInjection || { enabled: true, mode: 'block', scanToolInputs: true, scanApiInputs: true, logDetections: true };
|
|
1576
|
-
var inputValidation = securityConfig.inputValidation || { enabled: true, maxInputLength: 100000, maxJsonDepth: 20, stripHtml: false, blockScripts: true, sanitizeUnicode: true };
|
|
1577
|
-
var outputFiltering = securityConfig.outputFiltering || { enabled: true, scanForSecrets: true, scanForPii: true, mode: 'redact', customRedactPatterns: [], logDetections: true };
|
|
1578
|
-
var portSecurity = securityConfig.portSecurity || { enabled: false, monitorOpenPorts: false, allowedPorts: [22, 80, 443, 3000, 8080], scanIntervalMinutes: 60, alertOnNewPort: true };
|
|
1579
|
-
var bruteForce = securityConfig.bruteForce || { enabled: true, maxLoginAttempts: 5, lockoutDurationMinutes: 15, maxApiKeyAttempts: 10, trackFailedAttempts: true };
|
|
1580
|
-
var contentSecurity = securityConfig.contentSecurity || { enabled: true, cspPolicy: '', frameAncestors: ['self'], scriptSrc: ['self', 'unsafe-inline'], connectSrc: ['self'] };
|
|
1581
|
-
var secretScanning = securityConfig.secretScanning || { enabled: true, scanAgentOutputs: true, scanToolResults: true, patterns: 'default', customPatterns: [], alertOnDetection: true };
|
|
1582
|
-
var auditSecurity = securityConfig.auditSecurity || { enabled: true, logAllToolCalls: false, logPromptInjectionAttempts: true, logApiAccess: false, retentionDays: 90 };
|
|
1583
|
-
|
|
1584
|
-
var _cardStyle = { border: '1px solid var(--border)', borderRadius: 'var(--radius)', padding: 20, marginBottom: 16 };
|
|
1585
|
-
var _cardTitleStyle = { fontSize: 16, fontWeight: 600, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 8 };
|
|
1586
|
-
var _cardDescStyle = { fontSize: 13, color: 'var(--text-muted)', marginBottom: 16 };
|
|
1587
|
-
var _sectionTitleStyle = { fontSize: 14, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 12, marginTop: 8 };
|
|
1588
|
-
|
|
1589
|
-
function updateSection(section, updates) {
|
|
1590
|
-
setSecurityConfig(function(prev) {
|
|
1591
|
-
return Object.assign({}, prev, { [section]: Object.assign({}, prev[section] || {}, updates) });
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
function ToggleSwitch(props) {
|
|
1596
|
-
return h('label', { style: { position: 'relative', display: 'inline-block', width: 40, height: 22, cursor: 'pointer' } },
|
|
1597
|
-
h('input', { type: 'checkbox', checked: props.checked, onChange: function(e) { props.onChange(e.target.checked); }, style: { opacity: 0, width: 0, height: 0 } }),
|
|
1598
|
-
h('span', { style: {
|
|
1599
|
-
position: 'absolute', top: 0, left: 0, right: 0, bottom: 0,
|
|
1600
|
-
background: props.checked ? 'var(--brand-color, #6366f1)' : 'var(--bg-tertiary, #374151)',
|
|
1601
|
-
borderRadius: 11, transition: 'background 0.2s'
|
|
1602
|
-
} },
|
|
1603
|
-
h('span', { style: {
|
|
1604
|
-
position: 'absolute', top: 2, left: props.checked ? 20 : 2, width: 18, height: 18,
|
|
1605
|
-
background: '#fff', borderRadius: '50%', transition: 'left 0.2s', boxShadow: '0 1px 3px rgba(0,0,0,0.2)'
|
|
1606
|
-
} })
|
|
1607
|
-
)
|
|
1608
|
-
);
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
// ── Per-section editing ──
|
|
1612
|
-
var _editState = useState(null); // which section key is being edited
|
|
1613
|
-
var editingSection = _editState[0]; var setEditingSection = _editState[1];
|
|
1614
|
-
var _snapshot = useRef(null); // snapshot of securityConfig before editing
|
|
1615
|
-
|
|
1616
|
-
function startEdit(section) {
|
|
1617
|
-
_snapshot.current = JSON.parse(JSON.stringify(securityConfig));
|
|
1618
|
-
setEditingSection(section);
|
|
1619
|
-
}
|
|
1620
|
-
function cancelEdit() {
|
|
1621
|
-
if (_snapshot.current) setSecurityConfig(_snapshot.current);
|
|
1622
|
-
_snapshot.current = null;
|
|
1623
|
-
setEditingSection(null);
|
|
1624
|
-
}
|
|
1625
|
-
function saveSection() {
|
|
1626
|
-
onSave();
|
|
1627
|
-
// onSave triggers async save; clear edit state optimistically
|
|
1628
|
-
setTimeout(function() {
|
|
1629
|
-
_snapshot.current = null;
|
|
1630
|
-
setEditingSection(null);
|
|
1631
|
-
}, 500);
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
function sectionHeader(icon, title, sectionKey) {
|
|
1635
|
-
var isEditing = editingSection === sectionKey;
|
|
1636
|
-
return h('div', { style: Object.assign({}, _cardTitleStyle, { justifyContent: 'space-between' }) },
|
|
1637
|
-
h('span', { style: { display: 'flex', alignItems: 'center', gap: 8 } }, icon, title),
|
|
1638
|
-
isEditing
|
|
1639
|
-
? h('div', { style: { display: 'flex', gap: 6 } },
|
|
1640
|
-
h('button', { className: 'btn btn-primary btn-sm', disabled: saving, onClick: saveSection }, saving ? 'Saving...' : 'Save'),
|
|
1641
|
-
h('button', { className: 'btn btn-ghost btn-sm', onClick: cancelEdit }, 'Cancel')
|
|
1642
|
-
)
|
|
1643
|
-
: h('button', { className: 'btn btn-ghost btn-sm', onClick: function() { startEdit(sectionKey); }, style: { fontSize: 12 } }, I.journal(), ' Edit')
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
// Helper: section content wrapper — dims + disables when not editing
|
|
1648
|
-
function sectionBody(sectionKey, content) {
|
|
1649
|
-
var isEditing = editingSection === sectionKey;
|
|
1650
|
-
return h('div', { style: isEditing ? {} : { opacity: 0.7, pointerEvents: 'none' } }, content);
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
return h('div', null,
|
|
1654
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 24 } },
|
|
1655
|
-
h('div', null,
|
|
1656
|
-
h('h2', { style: { fontSize: 18, fontWeight: 700, margin: 0 } }, 'Security System'),
|
|
1657
|
-
h('p', { style: { fontSize: 14, color: 'var(--text-muted)', margin: '4px 0 0' } }, 'Comprehensive security configuration for your AgenticMail deployment')
|
|
1658
|
-
)
|
|
1659
|
-
),
|
|
1660
|
-
|
|
1661
|
-
// Prompt Injection Defense
|
|
1662
|
-
h('div', { style: _cardStyle },
|
|
1663
|
-
sectionHeader(I.shield(), 'Prompt Injection Defense', 'promptInjection'),
|
|
1664
|
-
h('p', { style: _cardDescStyle }, 'Multi-layer detection and prevention of prompt injection attacks'),
|
|
1665
|
-
sectionBody('promptInjection', h(Fragment, null,
|
|
1666
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 } },
|
|
1667
|
-
h('span', { style: { fontWeight: 500 } }, 'Enable Protection'),
|
|
1668
|
-
h(ToggleSwitch, { checked: promptInjection.enabled, onChange: function(v) { updateSection('promptInjection', { enabled: v }); } })
|
|
1669
|
-
),
|
|
1670
|
-
promptInjection.enabled && h('div', null,
|
|
1671
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 12 } },
|
|
1672
|
-
h('div', null,
|
|
1673
|
-
h('label', { className: 'form-label' }, 'Detection Mode'),
|
|
1674
|
-
h('select', {
|
|
1675
|
-
className: 'input',
|
|
1676
|
-
value: promptInjection.mode,
|
|
1677
|
-
onChange: function(e) { updateSection('promptInjection', { mode: e.target.value }); }
|
|
1678
|
-
},
|
|
1679
|
-
h('option', { value: 'monitor' }, 'Monitor Only'),
|
|
1680
|
-
h('option', { value: 'sanitize' }, 'Sanitize Content'),
|
|
1681
|
-
h('option', { value: 'block' }, 'Block Request')
|
|
1682
|
-
)
|
|
1683
|
-
),
|
|
1684
|
-
h('div', null,
|
|
1685
|
-
h('label', { className: 'form-label' }, 'Sensitivity Level'),
|
|
1686
|
-
h('select', {
|
|
1687
|
-
className: 'input',
|
|
1688
|
-
value: promptInjection.sensitivity,
|
|
1689
|
-
onChange: function(e) { updateSection('promptInjection', { sensitivity: e.target.value }); }
|
|
1690
|
-
},
|
|
1691
|
-
h('option', { value: 'low' }, 'Low'),
|
|
1692
|
-
h('option', { value: 'medium' }, 'Medium'),
|
|
1693
|
-
h('option', { value: 'high' }, 'High'),
|
|
1694
|
-
h('option', { value: 'maximum' }, 'Maximum')
|
|
1695
|
-
)
|
|
1696
|
-
)
|
|
1697
|
-
),
|
|
1698
|
-
h('div', { style: { display: 'flex', alignItems: 'center', marginBottom: 12 } },
|
|
1699
|
-
h('input', {
|
|
1700
|
-
type: 'checkbox',
|
|
1701
|
-
checked: promptInjection.logDetections,
|
|
1702
|
-
onChange: function(e) { updateSection('promptInjection', { logDetections: e.target.checked }); },
|
|
1703
|
-
style: { marginRight: 8 }
|
|
1704
|
-
}),
|
|
1705
|
-
h('span', null, 'Log detection events')
|
|
1706
|
-
),
|
|
1707
|
-
promptInjection.mode === 'block' && h('div', null,
|
|
1708
|
-
h('label', { className: 'form-label' }, 'Block Response Message'),
|
|
1709
|
-
h('textarea', {
|
|
1710
|
-
className: 'input',
|
|
1711
|
-
value: promptInjection.blockResponse || '',
|
|
1712
|
-
onChange: function(e) { updateSection('promptInjection', { blockResponse: e.target.value }); },
|
|
1713
|
-
placeholder: 'Custom message when content is blocked...',
|
|
1714
|
-
rows: 2
|
|
1715
|
-
})
|
|
1716
|
-
)
|
|
1717
|
-
)))
|
|
1718
|
-
),
|
|
1719
|
-
|
|
1720
|
-
// SQL Injection Prevention
|
|
1721
|
-
h('div', { style: _cardStyle },
|
|
1722
|
-
sectionHeader(I.shield(), 'SQL Injection Prevention', 'sqlInjection'),
|
|
1723
|
-
h('p', { style: _cardDescStyle }, 'Detect and block SQL injection attempts in tool inputs and API requests'),
|
|
1724
|
-
sectionBody('sqlInjection', h(Fragment, null,
|
|
1725
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 } },
|
|
1726
|
-
h('span', { style: { fontWeight: 500 } }, 'Enable Protection'),
|
|
1727
|
-
h(ToggleSwitch, { checked: sqlInjection.enabled, onChange: function(v) { updateSection('sqlInjection', { enabled: v }); } })
|
|
1728
|
-
),
|
|
1729
|
-
sqlInjection.enabled && h('div', null,
|
|
1730
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 12 } },
|
|
1731
|
-
h('div', null,
|
|
1732
|
-
h('label', { className: 'form-label' }, 'Detection Mode'),
|
|
1733
|
-
h('select', {
|
|
1734
|
-
className: 'input',
|
|
1735
|
-
value: sqlInjection.mode,
|
|
1736
|
-
onChange: function(e) { updateSection('sqlInjection', { mode: e.target.value }); }
|
|
1737
|
-
},
|
|
1738
|
-
h('option', { value: 'monitor' }, 'Monitor Only'),
|
|
1739
|
-
h('option', { value: 'block' }, 'Block Request')
|
|
1740
|
-
)
|
|
1741
|
-
),
|
|
1742
|
-
h('div', null,
|
|
1743
|
-
h('div', { style: { display: 'flex', alignItems: 'center', marginBottom: 8 } },
|
|
1744
|
-
h('input', {
|
|
1745
|
-
type: 'checkbox',
|
|
1746
|
-
checked: sqlInjection.scanToolInputs,
|
|
1747
|
-
onChange: function(e) { updateSection('sqlInjection', { scanToolInputs: e.target.checked }); },
|
|
1748
|
-
style: { marginRight: 8 }
|
|
1749
|
-
}),
|
|
1750
|
-
h('span', null, 'Scan tool arguments')
|
|
1751
|
-
),
|
|
1752
|
-
h('div', { style: { display: 'flex', alignItems: 'center' } },
|
|
1753
|
-
h('input', {
|
|
1754
|
-
type: 'checkbox',
|
|
1755
|
-
checked: sqlInjection.scanApiInputs,
|
|
1756
|
-
onChange: function(e) { updateSection('sqlInjection', { scanApiInputs: e.target.checked }); },
|
|
1757
|
-
style: { marginRight: 8 }
|
|
1758
|
-
}),
|
|
1759
|
-
h('span', null, 'Scan API request bodies')
|
|
1760
|
-
)
|
|
1761
|
-
)
|
|
1762
|
-
)
|
|
1763
|
-
)))
|
|
1764
|
-
),
|
|
1765
|
-
|
|
1766
|
-
// Input Validation
|
|
1767
|
-
h('div', { style: _cardStyle },
|
|
1768
|
-
sectionHeader(I.shield(), 'Input Validation', 'inputValidation'),
|
|
1769
|
-
h('p', { style: _cardDescStyle }, 'Sanitize and validate all input data'),
|
|
1770
|
-
sectionBody('inputValidation', h(Fragment, null,
|
|
1771
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 } },
|
|
1772
|
-
h('span', { style: { fontWeight: 500 } }, 'Enable Validation'),
|
|
1773
|
-
h(ToggleSwitch, { checked: inputValidation.enabled, onChange: function(v) { updateSection('inputValidation', { enabled: v }); } })
|
|
1774
|
-
),
|
|
1775
|
-
inputValidation.enabled && h('div', null,
|
|
1776
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 12 } },
|
|
1777
|
-
h('div', null,
|
|
1778
|
-
h('label', { className: 'form-label' }, 'Max Input Length'),
|
|
1779
|
-
h('input', {
|
|
1780
|
-
className: 'input',
|
|
1781
|
-
type: 'number',
|
|
1782
|
-
value: inputValidation.maxInputLength,
|
|
1783
|
-
onChange: function(e) { updateSection('inputValidation', { maxInputLength: parseInt(e.target.value) || 100000 }); },
|
|
1784
|
-
min: 1000,
|
|
1785
|
-
max: 1000000
|
|
1786
|
-
})
|
|
1787
|
-
),
|
|
1788
|
-
h('div', null,
|
|
1789
|
-
h('label', { className: 'form-label' }, 'Max JSON Depth'),
|
|
1790
|
-
h('input', {
|
|
1791
|
-
className: 'input',
|
|
1792
|
-
type: 'number',
|
|
1793
|
-
value: inputValidation.maxJsonDepth,
|
|
1794
|
-
onChange: function(e) { updateSection('inputValidation', { maxJsonDepth: parseInt(e.target.value) || 20 }); },
|
|
1795
|
-
min: 5,
|
|
1796
|
-
max: 100
|
|
1797
|
-
})
|
|
1798
|
-
)
|
|
1799
|
-
),
|
|
1800
|
-
h('div', { style: { display: 'flex', gap: 16, marginBottom: 12 } },
|
|
1801
|
-
h('div', { style: { display: 'flex', alignItems: 'center' } },
|
|
1802
|
-
h('input', {
|
|
1803
|
-
type: 'checkbox',
|
|
1804
|
-
checked: inputValidation.stripHtml,
|
|
1805
|
-
onChange: function(e) { updateSection('inputValidation', { stripHtml: e.target.checked }); },
|
|
1806
|
-
style: { marginRight: 8 }
|
|
1807
|
-
}),
|
|
1808
|
-
h('span', null, 'Strip HTML tags')
|
|
1809
|
-
),
|
|
1810
|
-
h('div', { style: { display: 'flex', alignItems: 'center' } },
|
|
1811
|
-
h('input', {
|
|
1812
|
-
type: 'checkbox',
|
|
1813
|
-
checked: inputValidation.blockScripts,
|
|
1814
|
-
onChange: function(e) { updateSection('inputValidation', { blockScripts: e.target.checked }); },
|
|
1815
|
-
style: { marginRight: 8 }
|
|
1816
|
-
}),
|
|
1817
|
-
h('span', null, 'Block script tags')
|
|
1818
|
-
),
|
|
1819
|
-
h('div', { style: { display: 'flex', alignItems: 'center' } },
|
|
1820
|
-
h('input', {
|
|
1821
|
-
type: 'checkbox',
|
|
1822
|
-
checked: inputValidation.sanitizeUnicode,
|
|
1823
|
-
onChange: function(e) { updateSection('inputValidation', { sanitizeUnicode: e.target.checked }); },
|
|
1824
|
-
style: { marginRight: 8 }
|
|
1825
|
-
}),
|
|
1826
|
-
h('span', null, 'Sanitize Unicode')
|
|
1827
|
-
)
|
|
1828
|
-
)
|
|
1829
|
-
)))
|
|
1830
|
-
),
|
|
1831
|
-
|
|
1832
|
-
// Output Filtering
|
|
1833
|
-
h('div', { style: _cardStyle },
|
|
1834
|
-
sectionHeader(I.shield(), 'Output Filtering', 'outputFiltering'),
|
|
1835
|
-
h('p', { style: _cardDescStyle }, 'Scan agent outputs for secrets and personal information'),
|
|
1836
|
-
sectionBody('outputFiltering', h(Fragment, null,
|
|
1837
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 } },
|
|
1838
|
-
h('span', { style: { fontWeight: 500 } }, 'Enable Filtering'),
|
|
1839
|
-
h(ToggleSwitch, { checked: outputFiltering.enabled, onChange: function(v) { updateSection('outputFiltering', { enabled: v }); } })
|
|
1840
|
-
),
|
|
1841
|
-
outputFiltering.enabled && h('div', null,
|
|
1842
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 12 } },
|
|
1843
|
-
h('div', null,
|
|
1844
|
-
h('label', { className: 'form-label' }, 'Filter Mode'),
|
|
1845
|
-
h('select', {
|
|
1846
|
-
className: 'input',
|
|
1847
|
-
value: outputFiltering.mode,
|
|
1848
|
-
onChange: function(e) { updateSection('outputFiltering', { mode: e.target.value }); }
|
|
1849
|
-
},
|
|
1850
|
-
h('option', { value: 'monitor' }, 'Monitor Only'),
|
|
1851
|
-
h('option', { value: 'redact' }, 'Redact Secrets'),
|
|
1852
|
-
h('option', { value: 'block' }, 'Block Output')
|
|
1853
|
-
)
|
|
1854
|
-
),
|
|
1855
|
-
h('div', null,
|
|
1856
|
-
h('div', { style: { display: 'flex', alignItems: 'center', marginBottom: 8 } },
|
|
1857
|
-
h('input', {
|
|
1858
|
-
type: 'checkbox',
|
|
1859
|
-
checked: outputFiltering.scanForSecrets,
|
|
1860
|
-
onChange: function(e) { updateSection('outputFiltering', { scanForSecrets: e.target.checked }); },
|
|
1861
|
-
style: { marginRight: 8 }
|
|
1862
|
-
}),
|
|
1863
|
-
h('span', null, 'Scan for secrets')
|
|
1864
|
-
),
|
|
1865
|
-
h('div', { style: { display: 'flex', alignItems: 'center' } },
|
|
1866
|
-
h('input', {
|
|
1867
|
-
type: 'checkbox',
|
|
1868
|
-
checked: outputFiltering.scanForPii,
|
|
1869
|
-
onChange: function(e) { updateSection('outputFiltering', { scanForPii: e.target.checked }); },
|
|
1870
|
-
style: { marginRight: 8 }
|
|
1871
|
-
}),
|
|
1872
|
-
h('span', null, 'Scan for PII')
|
|
1873
|
-
)
|
|
1874
|
-
)
|
|
1875
|
-
)
|
|
1876
|
-
)))
|
|
1877
|
-
),
|
|
1878
|
-
|
|
1879
|
-
// Transport Encryption
|
|
1880
|
-
(function() {
|
|
1881
|
-
var te = securityConfig.transportEncryption || { enabled: false, mode: 'selective', maxAgeMs: 300000, debugLog: false, encryptAll: false, enabledGroups: {}, customEndpoints: [] };
|
|
1882
|
-
var updateTE = function(patch) {
|
|
1883
|
-
var merged = Object.assign({}, te, patch);
|
|
1884
|
-
updateSection('transportEncryption', merged);
|
|
1885
|
-
};
|
|
1886
|
-
|
|
1887
|
-
// Endpoint groups — each maps to a set of API path patterns
|
|
1888
|
-
var ENDPOINT_GROUPS = [
|
|
1889
|
-
{ id: 'settings', label: 'Settings & Configuration', desc: 'System settings, platform config, general preferences', icon: 'settings', paths: ['/api/settings', '/api/settings/*'] },
|
|
1890
|
-
{ id: 'models', label: 'Models & API Keys', desc: 'LLM provider API keys (Anthropic, OpenAI, Google, etc.)', icon: 'key', sensitive: true, paths: ['/api/settings/models', '/api/llm-keys', '/api/llm-keys/*'] },
|
|
1891
|
-
{ id: 'auth', label: 'Authentication', desc: 'Login, sessions, tokens, 2FA, SSO configuration', icon: 'shield', sensitive: true, paths: ['/api/auth/*', '/api/login', '/api/users', '/api/users/*'] },
|
|
1892
|
-
{ id: 'agents', label: 'Agent Configuration', desc: 'Agent configs, identity, tools, permissions, browser settings', icon: 'agents', paths: ['/bridge/agents/*'] },
|
|
1893
|
-
{ id: 'email', label: 'Email & SMTP', desc: 'Email configuration, SMTP credentials, domain settings', icon: 'mail', sensitive: true, paths: ['/bridge/agents/*/email-config', '/api/settings/email', '/api/email/*'] },
|
|
1894
|
-
{ id: 'database', label: 'Database Connections', desc: 'Database URLs, credentials, connection strings', icon: 'database', sensitive: true, paths: ['/api/database-access', '/api/database-access/*', '/api/database/connections', '/api/database/connections/*'] },
|
|
1895
|
-
{ id: 'vault', label: 'Vault & Secrets', desc: 'Encrypted secret storage, vault operations', icon: 'lock', sensitive: true, paths: ['/api/vault', '/api/vault/*'] },
|
|
1896
|
-
{ id: 'integrations', label: 'Organization Integrations', desc: 'OAuth tokens, Google/Microsoft integrations, org credentials', icon: 'link', sensitive: true, paths: ['/api/org-integrations', '/api/org-integrations/*', '/api/organizations/*/integrations'] },
|
|
1897
|
-
{ id: 'skills', label: 'Skills & Credentials', desc: 'Skill API tokens, community skill credentials', icon: 'puzzle', paths: ['/api/skills/*', '/community/*'] },
|
|
1898
|
-
{ id: 'organizations', label: 'Organizations', desc: 'Org management, member data, org settings', icon: 'building', paths: ['/api/organizations', '/api/organizations/*'] },
|
|
1899
|
-
{ id: 'knowledge', label: 'Knowledge Bases', desc: 'Knowledge base content, documents, embeddings', icon: 'book', paths: ['/api/knowledge-bases', '/api/knowledge-bases/*', '/knowledge/*'] },
|
|
1900
|
-
{ id: 'tasks', label: 'Task Pipeline', desc: 'Task queue, task results, task delegation', icon: 'list', paths: ['/api/tasks', '/api/tasks/*', '/task-pipeline/*'] },
|
|
1901
|
-
{ id: 'workforce', label: 'Workforce & Schedules', desc: 'Agent schedules, clock records, budgets', icon: 'clock', paths: ['/api/workforce', '/api/workforce/*'] },
|
|
1902
|
-
{ id: 'messages', label: 'Messages & Channels', desc: 'WhatsApp, Telegram, messaging channel configs', icon: 'chat', paths: ['/api/messages', '/api/messages/*', '/bridge/agents/*/whatsapp', '/bridge/agents/*/telegram'] },
|
|
1903
|
-
{ id: 'guardrails', label: 'Guardrails & DLP', desc: 'Guardrail rules, DLP policies, intervention logs', icon: 'shield', paths: ['/guardrails/*', '/dlp/*'] },
|
|
1904
|
-
{ id: 'journal', label: 'Activity Journal', desc: 'Agent activity logs, event history', icon: 'journal', paths: ['/activity/*', '/api/journal/*'] },
|
|
1905
|
-
{ id: 'approvals', label: 'Approvals', desc: 'Approval requests, approval decisions', icon: 'check', paths: ['/approvals/*'] },
|
|
1906
|
-
{ id: 'compliance', label: 'Compliance & Audit', desc: 'Compliance reports, audit logs, regulatory data', icon: 'clipboard', paths: ['/api/compliance/*', '/api/audit/*', '/api/events/*'] },
|
|
1907
|
-
{ id: 'domain', label: 'Domain & DNS', desc: 'Domain configuration, DNS records, SSL certificates', icon: 'globe', paths: ['/api/domain/*'] },
|
|
1908
|
-
{ id: 'roles', label: 'Roles & Permissions', desc: 'Role templates, permission profiles', icon: 'agents', paths: ['/api/roles', '/api/roles/*', '/profiles/*'] },
|
|
1909
|
-
{ id: 'memory', label: 'Memory & Transfer', desc: 'Agent memories, memory transfer, memory schedules', icon: 'brain', sensitive: true, paths: ['/api/memory/*', '/api/memory-transfer/*'] },
|
|
1910
|
-
{ id: 'dashboard', label: 'Dashboard & Overview', desc: 'Dashboard stats, overview data, agent summaries', icon: 'layout', paths: ['/api/dashboard/*', '/api/overview/*'] },
|
|
1911
|
-
];
|
|
1912
|
-
|
|
1913
|
-
var enabledGroups = te.enabledGroups || {};
|
|
1914
|
-
var customEndpoints = te.customEndpoints || [];
|
|
1915
|
-
|
|
1916
|
-
var toggleGroup = function(groupId) {
|
|
1917
|
-
var updated = Object.assign({}, enabledGroups);
|
|
1918
|
-
updated[groupId] = !updated[groupId];
|
|
1919
|
-
updateTE({ enabledGroups: updated });
|
|
1920
|
-
};
|
|
1921
|
-
|
|
1922
|
-
var enableAllGroups = function() {
|
|
1923
|
-
var all = {};
|
|
1924
|
-
ENDPOINT_GROUPS.forEach(function(g) { all[g.id] = true; });
|
|
1925
|
-
updateTE({ encryptAll: true, enabledGroups: all });
|
|
1926
|
-
};
|
|
1927
|
-
|
|
1928
|
-
var disableAllGroups = function() {
|
|
1929
|
-
updateTE({ encryptAll: false, enabledGroups: {} });
|
|
1930
|
-
};
|
|
1931
|
-
|
|
1932
|
-
var enableSensitiveOnly = function() {
|
|
1933
|
-
var sens = {};
|
|
1934
|
-
ENDPOINT_GROUPS.forEach(function(g) { if (g.sensitive) sens[g.id] = true; });
|
|
1935
|
-
updateTE({ encryptAll: false, enabledGroups: sens });
|
|
1936
|
-
};
|
|
1937
|
-
|
|
1938
|
-
var addCustomEndpoint = function() {
|
|
1939
|
-
var input = document.getElementById('_te_custom_input');
|
|
1940
|
-
var val = input && input.value.trim();
|
|
1941
|
-
if (!val) return;
|
|
1942
|
-
if (customEndpoints.indexOf(val) === -1) {
|
|
1943
|
-
updateTE({ customEndpoints: customEndpoints.concat([val]) });
|
|
1944
|
-
}
|
|
1945
|
-
if (input) input.value = '';
|
|
1946
|
-
};
|
|
1947
|
-
|
|
1948
|
-
var removeCustomEndpoint = function(ep) {
|
|
1949
|
-
updateTE({ customEndpoints: customEndpoints.filter(function(e) { return e !== ep; }) });
|
|
1950
|
-
};
|
|
1951
|
-
|
|
1952
|
-
var groupCount = Object.keys(enabledGroups).filter(function(k) { return enabledGroups[k]; }).length;
|
|
1953
|
-
|
|
1954
|
-
return h('div', { style: _cardStyle },
|
|
1955
|
-
sectionHeader(I.lock(), 'Transport Encryption', 'transportEncryption'),
|
|
1956
|
-
h('p', { style: _cardDescStyle }, 'Encrypt API data in transit between the dashboard and server using AES-256-CBC with HMAC verification. Protects against network sniffing, MITM attacks, and compromised TLS proxies. Choose to encrypt all API calls or select specific endpoint groups.'),
|
|
1957
|
-
sectionBody('transportEncryption', h(Fragment, null,
|
|
1958
|
-
|
|
1959
|
-
// Master toggle
|
|
1960
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 } },
|
|
1961
|
-
h('span', { style: { fontWeight: 600, fontSize: 14 } }, 'Enable Transport Encryption'),
|
|
1962
|
-
h(ToggleSwitch, { checked: te.enabled, onChange: function(v) { updateTE({ enabled: v }); } })
|
|
1963
|
-
),
|
|
1964
|
-
|
|
1965
|
-
te.enabled && h(Fragment, null,
|
|
1966
|
-
// Mode selector — Encrypt All vs Selective
|
|
1967
|
-
h('div', { style: { display: 'flex', gap: 8, marginBottom: 16 } },
|
|
1968
|
-
h('button', {
|
|
1969
|
-
className: 'btn btn-sm ' + (te.encryptAll ? 'btn-primary' : 'btn-ghost'),
|
|
1970
|
-
onClick: enableAllGroups
|
|
1971
|
-
}, I.shield(), ' Encrypt All API Calls'),
|
|
1972
|
-
h('button', {
|
|
1973
|
-
className: 'btn btn-sm ' + (!te.encryptAll && groupCount > 0 ? 'btn-primary' : 'btn-ghost'),
|
|
1974
|
-
onClick: enableSensitiveOnly
|
|
1975
|
-
}, I.key(), ' Sensitive Only'),
|
|
1976
|
-
h('button', {
|
|
1977
|
-
className: 'btn btn-sm btn-ghost',
|
|
1978
|
-
onClick: disableAllGroups
|
|
1979
|
-
}, 'Clear All')
|
|
1980
|
-
),
|
|
1981
|
-
|
|
1982
|
-
te.encryptAll && h('div', { style: { padding: '10px 12px', background: 'var(--success-bg, rgba(34,197,94,0.1))', border: '1px solid var(--success-border, rgba(34,197,94,0.3))', borderRadius: 8, marginBottom: 16, fontSize: 13, color: 'var(--success-text, #22c55e)' } },
|
|
1983
|
-
I.check(), ' All API calls between dashboard and server are encrypted. ', groupCount, ' of ', ENDPOINT_GROUPS.length, ' endpoint groups active.'
|
|
1984
|
-
),
|
|
1985
|
-
|
|
1986
|
-
// Endpoint group toggles
|
|
1987
|
-
h('div', { style: { marginBottom: 16 } },
|
|
1988
|
-
h('div', { style: { fontWeight: 600, fontSize: 13, marginBottom: 8, display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
1989
|
-
h('span', null, 'Endpoint Groups (' + groupCount + '/' + ENDPOINT_GROUPS.length + ' enabled)'),
|
|
1990
|
-
h('span', { style: { fontSize: 12, color: 'var(--text-muted)', fontWeight: 400 } }, 'Toggle which API endpoints to encrypt')
|
|
1991
|
-
),
|
|
1992
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 6 } },
|
|
1993
|
-
ENDPOINT_GROUPS.map(function(g) {
|
|
1994
|
-
var isOn = te.encryptAll || enabledGroups[g.id];
|
|
1995
|
-
return h('div', {
|
|
1996
|
-
key: g.id,
|
|
1997
|
-
style: { display: 'flex', alignItems: 'center', gap: 8, padding: '8px 10px', background: isOn ? 'var(--accent-soft)' : 'var(--bg-tertiary)', borderRadius: 6, cursor: 'pointer', border: '1px solid ' + (isOn ? 'var(--accent)' : 'var(--border)'), transition: 'all 0.15s', opacity: te.encryptAll ? 0.7 : 1 },
|
|
1998
|
-
onClick: function() { if (!te.encryptAll) toggleGroup(g.id); },
|
|
1999
|
-
title: g.desc + '\n\nPaths: ' + g.paths.join(', ')
|
|
2000
|
-
},
|
|
2001
|
-
h('div', { style: { width: 16, height: 16, borderRadius: 4, border: '2px solid ' + (isOn ? 'var(--accent)' : 'var(--border)'), background: isOn ? 'var(--accent)' : 'transparent', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 } },
|
|
2002
|
-
isOn && h('svg', { width: 10, height: 10, viewBox: '0 0 24 24', fill: 'none', stroke: '#fff', strokeWidth: 3, strokeLinecap: 'round', strokeLinejoin: 'round' }, h('polyline', { points: '20 6 9 17 4 12' }))
|
|
2003
|
-
),
|
|
2004
|
-
h('div', { style: { minWidth: 0 } },
|
|
2005
|
-
h('div', { style: { fontSize: 12, fontWeight: 600, display: 'flex', alignItems: 'center', gap: 4 } },
|
|
2006
|
-
g.label,
|
|
2007
|
-
g.sensitive && h('span', { style: { fontSize: 9, padding: '1px 4px', background: 'var(--danger-bg, rgba(239,68,68,0.15))', color: 'var(--danger, #ef4444)', borderRadius: 3, fontWeight: 700, letterSpacing: 0.5 } }, 'SENSITIVE')
|
|
2008
|
-
),
|
|
2009
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, g.desc)
|
|
2010
|
-
)
|
|
2011
|
-
);
|
|
2012
|
-
})
|
|
2013
|
-
)
|
|
2014
|
-
),
|
|
2015
|
-
|
|
2016
|
-
// Custom endpoints
|
|
2017
|
-
h('div', { style: { marginBottom: 16 } },
|
|
2018
|
-
h('div', { style: { fontWeight: 600, fontSize: 13, marginBottom: 8 } }, 'Custom Endpoint Patterns'),
|
|
2019
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 8 } }, 'Add custom API path patterns to encrypt. Use * as wildcard for path segments (e.g. /api/custom/*/data).'),
|
|
2020
|
-
h('div', { style: { display: 'flex', gap: 6, marginBottom: 8 } },
|
|
2021
|
-
h('input', { id: '_te_custom_input', className: 'input', style: { flex: 1 }, placeholder: '/api/my-endpoint/*', onKeyDown: function(e) { if (e.key === 'Enter') addCustomEndpoint(); } }),
|
|
2022
|
-
h('button', { className: 'btn btn-sm btn-primary', onClick: addCustomEndpoint }, 'Add')
|
|
2023
|
-
),
|
|
2024
|
-
customEndpoints.length > 0 && h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 4 } },
|
|
2025
|
-
customEndpoints.map(function(ep) {
|
|
2026
|
-
return h('span', { key: ep, style: { display: 'inline-flex', alignItems: 'center', gap: 4, padding: '2px 8px', background: 'var(--bg-tertiary)', borderRadius: 4, fontSize: 12, fontFamily: 'monospace' } },
|
|
2027
|
-
ep,
|
|
2028
|
-
h('button', { style: { background: 'none', border: 'none', cursor: 'pointer', padding: 0, color: 'var(--text-muted)', fontSize: 14, lineHeight: 1 }, onClick: function() { removeCustomEndpoint(ep); } }, '\u00d7')
|
|
2029
|
-
);
|
|
2030
|
-
})
|
|
2031
|
-
)
|
|
2032
|
-
),
|
|
2033
|
-
|
|
2034
|
-
// Advanced settings
|
|
2035
|
-
h('details', { style: { marginBottom: 16 } },
|
|
2036
|
-
h('summary', { style: { cursor: 'pointer', fontWeight: 600, fontSize: 13, marginBottom: 8 } }, 'Advanced Settings'),
|
|
2037
|
-
h('div', { style: { paddingLeft: 8, display: 'flex', flexDirection: 'column', gap: 10, marginTop: 8 } },
|
|
2038
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
|
|
2039
|
-
h('div', null,
|
|
2040
|
-
h('div', { style: { fontWeight: 500, fontSize: 13 } }, 'Payload Max Age'),
|
|
2041
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Reject payloads older than this (replay protection)')
|
|
2042
|
-
),
|
|
2043
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
2044
|
-
h('input', { className: 'input', type: 'number', style: { width: 80 }, value: Math.round((te.maxAgeMs || 300000) / 1000), onChange: function(e) { updateTE({ maxAgeMs: (parseInt(e.target.value) || 300) * 1000 }); } }),
|
|
2045
|
-
h('span', { style: { fontSize: 12, color: 'var(--text-muted)' } }, 'seconds')
|
|
2046
|
-
)
|
|
2047
|
-
),
|
|
2048
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
|
|
2049
|
-
h('div', null,
|
|
2050
|
-
h('div', { style: { fontWeight: 500, fontSize: 13 } }, 'Debug Logging'),
|
|
2051
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Log encryption/decryption operations to console (never in production)')
|
|
2052
|
-
),
|
|
2053
|
-
h(ToggleSwitch, { checked: te.debugLog || false, onChange: function(v) { updateTE({ debugLog: v }); } })
|
|
2054
|
-
)
|
|
2055
|
-
)
|
|
2056
|
-
),
|
|
2057
|
-
|
|
2058
|
-
// Info box
|
|
2059
|
-
h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8, fontSize: 13 } },
|
|
2060
|
-
h('strong', null, 'How it works:'),
|
|
2061
|
-
h('ul', { style: { margin: '4px 0 0', paddingLeft: 16, lineHeight: 1.7 } },
|
|
2062
|
-
h('li', null, 'Each request/response is encrypted with AES-256-CBC using a unique random IV'),
|
|
2063
|
-
h('li', null, 'HMAC-SHA256 signature prevents tampering'),
|
|
2064
|
-
h('li', null, 'SHA-256 checksum verifies data integrity'),
|
|
2065
|
-
h('li', null, 'Timestamp prevents replay attacks'),
|
|
2066
|
-
h('li', null, 'Keys are derived server-side and exchanged over the authenticated session')
|
|
2067
|
-
),
|
|
2068
|
-
h('p', { style: { marginTop: 8, color: 'var(--text-muted)' } }, 'HTTPS already encrypts all traffic at the transport layer. This adds application-layer encryption for defense-in-depth, protecting against compromised TLS proxies, corporate SSL inspection, or man-in-the-middle attacks.')
|
|
2069
|
-
)
|
|
2070
|
-
)))
|
|
2071
|
-
);
|
|
2072
|
-
})(),
|
|
2073
|
-
|
|
2074
|
-
// ── Dependency & Package Management ──
|
|
2075
|
-
(function() {
|
|
2076
|
-
var depDefaults = securityConfig.dependencyDefaults || { mode: 'auto', allowGlobalInstalls: false, allowElevated: false, allowedManagers: ['npm', 'pip'], blockedPackages: [], autoCleanup: true };
|
|
2077
|
-
var ALL_MANAGERS = ['brew', 'apt', 'dnf', 'pacman', 'snap', 'choco', 'winget', 'scoop', 'npm', 'pip'];
|
|
2078
|
-
|
|
2079
|
-
function updateDep(updates) {
|
|
2080
|
-
updateSection('dependencyDefaults', Object.assign({}, depDefaults, updates));
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
return h('div', { style: _cardStyle },
|
|
2084
|
-
sectionHeader(I.settings(), 'Dependency & Package Management', 'dependencyDefaults'),
|
|
2085
|
-
h('p', { style: _cardDescStyle }, 'Organization-wide defaults for agent package installation. Individual agents can override these in their Permissions tab.'),
|
|
2086
|
-
sectionBody('dependencyDefaults', h(Fragment, null,
|
|
2087
|
-
|
|
2088
|
-
// Mode
|
|
2089
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 16 } },
|
|
2090
|
-
h('div', null,
|
|
2091
|
-
h('label', { className: 'form-label' }, 'Default Install Policy'),
|
|
2092
|
-
h('select', { className: 'input', value: depDefaults.mode, onChange: function(e) { updateDep({ mode: e.target.value }); } },
|
|
2093
|
-
h('option', { value: 'auto' }, 'Auto — agents install what they need'),
|
|
2094
|
-
h('option', { value: 'ask_manager' }, 'Ask Manager — require human approval'),
|
|
2095
|
-
h('option', { value: 'deny' }, 'Deny — no package installation allowed')
|
|
2096
|
-
)
|
|
2097
|
-
),
|
|
2098
|
-
h('div', null,
|
|
2099
|
-
h('label', { className: 'form-label' }, 'Auto-Cleanup'),
|
|
2100
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 4 } },
|
|
2101
|
-
h(ToggleSwitch, { checked: depDefaults.autoCleanup !== false, onChange: function(v) { updateDep({ autoCleanup: v }); } }),
|
|
2102
|
-
h('span', { style: { fontSize: 13, color: 'var(--text-muted)' } }, 'Remove agent-installed packages on session end')
|
|
2103
|
-
)
|
|
2104
|
-
)
|
|
2105
|
-
),
|
|
2106
|
-
|
|
2107
|
-
// Global installs + Elevated
|
|
2108
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 16 } },
|
|
2109
|
-
h('div', null,
|
|
2110
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
|
|
2111
|
-
h(ToggleSwitch, { checked: depDefaults.allowGlobalInstalls === true, onChange: function(v) { updateDep({ allowGlobalInstalls: v }); } }),
|
|
2112
|
-
h('span', { style: { fontWeight: 500 } }, 'Allow Global Installs')
|
|
2113
|
-
),
|
|
2114
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', margin: 0 } }, 'System-level packages via brew, apt, choco, etc. When off, only local npm/pip installs are allowed.')
|
|
2115
|
-
),
|
|
2116
|
-
h('div', null,
|
|
2117
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
|
|
2118
|
-
h(ToggleSwitch, { checked: depDefaults.allowElevated === true, onChange: function(v) { updateDep({ allowElevated: v }); } }),
|
|
2119
|
-
h('span', { style: { fontWeight: 500 } }, 'Allow Elevated (sudo/admin)')
|
|
2120
|
-
),
|
|
2121
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', margin: 0 } }, 'Permit agents to use sudo (Linux/macOS) or admin privileges (Windows) for system packages.')
|
|
2122
|
-
)
|
|
2123
|
-
),
|
|
2124
|
-
|
|
2125
|
-
// Allowed package managers
|
|
2126
|
-
h('div', { style: { marginBottom: 16 } },
|
|
2127
|
-
h('label', { className: 'form-label' }, 'Allowed Package Managers'),
|
|
2128
|
-
h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8 } },
|
|
2129
|
-
ALL_MANAGERS.map(function(mgr) {
|
|
2130
|
-
var isActive = (depDefaults.allowedManagers || []).indexOf(mgr) >= 0;
|
|
2131
|
-
return h('label', { key: mgr, style: { display: 'flex', alignItems: 'center', gap: 4, padding: '4px 10px', borderRadius: 6, border: '1px solid ' + (isActive ? 'var(--brand-color, #6366f1)' : 'var(--border)'), background: isActive ? 'var(--brand-color-alpha, rgba(99,102,241,0.1))' : 'transparent', cursor: 'pointer', fontSize: 13 } },
|
|
2132
|
-
h('input', { type: 'checkbox', checked: isActive, onChange: function() {
|
|
2133
|
-
var current = (depDefaults.allowedManagers || []).slice();
|
|
2134
|
-
if (isActive) { current = current.filter(function(m) { return m !== mgr; }); }
|
|
2135
|
-
else { current.push(mgr); }
|
|
2136
|
-
updateDep({ allowedManagers: current });
|
|
2137
|
-
}, style: { marginRight: 2 } }),
|
|
2138
|
-
mgr
|
|
2139
|
-
);
|
|
2140
|
-
})
|
|
2141
|
-
)
|
|
2142
|
-
),
|
|
2143
|
-
|
|
2144
|
-
// Blocked packages
|
|
2145
|
-
h('div', { style: { marginBottom: 8 } },
|
|
2146
|
-
h('label', { className: 'form-label' }, 'Blocked Packages'),
|
|
2147
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', margin: '0 0 6px' } }, 'Package names that agents can never install, regardless of other settings.'),
|
|
2148
|
-
h(TagInput, { value: depDefaults.blockedPackages || [], onChange: function(v) { updateDep({ blockedPackages: v }); }, placeholder: 'e.g. nmap, metasploit', mono: true })
|
|
2149
|
-
)))
|
|
2150
|
-
);
|
|
2151
|
-
})(),
|
|
2152
|
-
|
|
2153
|
-
// ── Screen Unlock & Machine Access ──
|
|
2154
|
-
(function() {
|
|
2155
|
-
var screenAccess = securityConfig.screenAccess || { enabled: false, systemPassword: '', autoUnlock: false, preventSleep: false };
|
|
2156
|
-
function updateScreen(updates) {
|
|
2157
|
-
updateSection('screenAccess', Object.assign({}, screenAccess, updates));
|
|
2158
|
-
}
|
|
2159
|
-
var _screenStatus = useState(null);
|
|
2160
|
-
var screenStatus = _screenStatus[0]; var setScreenStatus = _screenStatus[1];
|
|
2161
|
-
var _unlocking = useState(false);
|
|
2162
|
-
var unlocking = _unlocking[0]; var setUnlocking = _unlocking[1];
|
|
2163
|
-
|
|
2164
|
-
return h('div', { style: _cardStyle },
|
|
2165
|
-
sectionHeader(I.lock(), 'Screen Unlock & Machine Access', 'screenAccess'),
|
|
2166
|
-
h('p', { style: _cardDescStyle }, 'Allow the system to automatically unlock the screen when agents need to work. Without this, agents cannot operate when the machine is locked.'),
|
|
2167
|
-
sectionBody('screenAccess', h(Fragment, null,
|
|
2168
|
-
|
|
2169
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 } },
|
|
2170
|
-
h('div', null,
|
|
2171
|
-
h('span', { style: { fontWeight: 600, fontSize: 14 } }, 'Enable Screen Auto-Unlock'),
|
|
2172
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', margin: '2px 0 0' } }, 'When enabled, the system will automatically unlock the screen when agents need access (e.g., during heartbeat checks, browser automation, or scheduled tasks)')
|
|
2173
|
-
),
|
|
2174
|
-
h(ToggleSwitch, { checked: screenAccess.enabled, onChange: function(v) { updateScreen({ enabled: v }); } })
|
|
2175
|
-
),
|
|
2176
|
-
|
|
2177
|
-
screenAccess.enabled && h(Fragment, null,
|
|
2178
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 16 } },
|
|
2179
|
-
h('div', null,
|
|
2180
|
-
h('label', { className: 'form-label' }, 'System / Computer Password'),
|
|
2181
|
-
h('input', { className: 'input', type: 'password', value: screenAccess.systemPassword || '', onChange: function(e) { updateScreen({ systemPassword: e.target.value }); }, placeholder: 'Your macOS/Linux login password' }),
|
|
2182
|
-
h('p', { style: { fontSize: 11, color: 'var(--text-muted)', marginTop: 4 } }, 'Stored encrypted. Used to unlock the screen when agents need to work. This is the password you use to log into your computer.')
|
|
2183
|
-
),
|
|
2184
|
-
h('div', null,
|
|
2185
|
-
h('label', { className: 'form-label' }, 'Screen Status'),
|
|
2186
|
-
h('div', { style: { marginTop: 4 } },
|
|
2187
|
-
h('button', { className: 'btn btn-secondary btn-sm', style: { marginBottom: 8 }, onClick: function() {
|
|
2188
|
-
engineCall('/system/screen-status').then(function(d) { setScreenStatus(d); }).catch(function(e) { setScreenStatus({ error: e.message }); });
|
|
2189
|
-
} }, 'Check Screen Status'),
|
|
2190
|
-
screenStatus && h('div', { style: { fontSize: 12, marginTop: 4 } },
|
|
2191
|
-
screenStatus.error ? h('span', { style: { color: 'var(--danger)' } }, screenStatus.error) :
|
|
2192
|
-
h('span', { style: { color: screenStatus.locked ? 'var(--warning-text, #b45309)' : 'var(--success)' } },
|
|
2193
|
-
screenStatus.locked ? 'Screen is LOCKED' + (screenStatus.displayAsleep ? ' (display asleep)' : '') : 'Screen is unlocked',
|
|
2194
|
-
' \u2014 ', screenStatus.platform
|
|
2195
|
-
)
|
|
2196
|
-
)
|
|
2197
|
-
),
|
|
2198
|
-
screenStatus && screenStatus.locked && h('button', { className: 'btn btn-primary btn-sm', style: { marginTop: 8 }, disabled: unlocking || !screenAccess.systemPassword, onClick: function() {
|
|
2199
|
-
setUnlocking(true);
|
|
2200
|
-
engineCall('/system/unlock-screen', { method: 'POST', body: JSON.stringify({ password: screenAccess.systemPassword }) })
|
|
2201
|
-
.then(function(d) {
|
|
2202
|
-
if (d.success) { toast(d.message, 'success'); setScreenStatus(null); }
|
|
2203
|
-
else { toast(d.error || 'Unlock failed', 'error'); }
|
|
2204
|
-
})
|
|
2205
|
-
.catch(function(e) { toast(e.message, 'error'); })
|
|
2206
|
-
.finally(function() { setUnlocking(false); });
|
|
2207
|
-
} }, unlocking ? 'Unlocking...' : 'Unlock Now')
|
|
2208
|
-
)
|
|
2209
|
-
),
|
|
2210
|
-
|
|
2211
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 } },
|
|
2212
|
-
h('div', null,
|
|
2213
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
|
|
2214
|
-
h(ToggleSwitch, { checked: screenAccess.autoUnlock === true, onChange: function(v) { updateScreen({ autoUnlock: v }); } }),
|
|
2215
|
-
h('span', { style: { fontWeight: 500 } }, 'Auto-Unlock on Agent Activity')
|
|
2216
|
-
),
|
|
2217
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', margin: 0 } }, 'Automatically unlock the screen when an agent needs to use the browser, run desktop automation, or start a scheduled task.')
|
|
2218
|
-
),
|
|
2219
|
-
h('div', null,
|
|
2220
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
|
|
2221
|
-
h(ToggleSwitch, { checked: screenAccess.preventSleep === true, onChange: function(v) { updateScreen({ preventSleep: v }); } }),
|
|
2222
|
-
h('span', { style: { fontWeight: 500 } }, 'Prevent System Sleep')
|
|
2223
|
-
),
|
|
2224
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-muted)', margin: 0 } }, 'Keep the system awake using caffeinate (macOS) or systemd-inhibit (Linux). Prevents the machine from sleeping while agents are active.')
|
|
2225
|
-
)
|
|
2226
|
-
),
|
|
2227
|
-
|
|
2228
|
-
h('div', { style: { marginTop: 16, padding: 12, background: 'var(--bg-tertiary)', borderRadius: 8, fontSize: 12, color: 'var(--text-muted)', border: '1px solid var(--border)' } },
|
|
2229
|
-
h('strong', null, 'How it works: '),
|
|
2230
|
-
'When an agent needs to interact with the system (browser automation, desktop tools, etc.) and detects the screen is locked, it will automatically: ',
|
|
2231
|
-
h('br'), '1. Wake the display if asleep',
|
|
2232
|
-
h('br'), '2. Type your password to unlock the screen',
|
|
2233
|
-
h('br'), '3. Perform the required action',
|
|
2234
|
-
h('br'), h('br'),
|
|
2235
|
-
h('strong', null, 'Security note: '),
|
|
2236
|
-
'The password is stored in the server\'s encrypted security config. Only the server process has access to it \u2014 agents never see the raw password.'
|
|
2237
|
-
)
|
|
2238
|
-
)))
|
|
2239
|
-
);
|
|
2240
|
-
})(),
|
|
2241
|
-
|
|
2242
|
-
// Security Audit Log
|
|
2243
|
-
h('div', { style: _cardStyle },
|
|
2244
|
-
sectionHeader(I.journal(), 'Security Audit Log', 'auditSecurity'),
|
|
2245
|
-
h('p', { style: _cardDescStyle }, 'Log and monitor security events'),
|
|
2246
|
-
sectionBody('auditSecurity', h(Fragment, null,
|
|
2247
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 } },
|
|
2248
|
-
h('span', { style: { fontWeight: 500 } }, 'Enable Audit Logging'),
|
|
2249
|
-
h(ToggleSwitch, { checked: auditSecurity.enabled, onChange: function(v) { updateSection('auditSecurity', { enabled: v }); } })
|
|
2250
|
-
),
|
|
2251
|
-
auditSecurity.enabled && h('div', null,
|
|
2252
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 12 } },
|
|
2253
|
-
h('div', null,
|
|
2254
|
-
h('label', { className: 'form-label' }, 'Retention (days)'),
|
|
2255
|
-
h('input', {
|
|
2256
|
-
className: 'input',
|
|
2257
|
-
type: 'number',
|
|
2258
|
-
value: auditSecurity.retentionDays,
|
|
2259
|
-
onChange: function(e) { updateSection('auditSecurity', { retentionDays: parseInt(e.target.value) || 90 }); },
|
|
2260
|
-
min: 1,
|
|
2261
|
-
max: 365
|
|
2262
|
-
})
|
|
2263
|
-
),
|
|
2264
|
-
h('div', null,
|
|
2265
|
-
h('div', { style: { display: 'flex', alignItems: 'center', marginBottom: 8 } },
|
|
2266
|
-
h('input', {
|
|
2267
|
-
type: 'checkbox',
|
|
2268
|
-
checked: auditSecurity.logPromptInjectionAttempts,
|
|
2269
|
-
onChange: function(e) { updateSection('auditSecurity', { logPromptInjectionAttempts: e.target.checked }); },
|
|
2270
|
-
style: { marginRight: 8 }
|
|
2271
|
-
}),
|
|
2272
|
-
h('span', null, 'Log prompt injection attempts')
|
|
2273
|
-
),
|
|
2274
|
-
h('div', { style: { display: 'flex', alignItems: 'center' } },
|
|
2275
|
-
h('input', {
|
|
2276
|
-
type: 'checkbox',
|
|
2277
|
-
checked: auditSecurity.logApiAccess,
|
|
2278
|
-
onChange: function(e) { updateSection('auditSecurity', { logApiAccess: e.target.checked }); },
|
|
2279
|
-
style: { marginRight: 8 }
|
|
2280
|
-
}),
|
|
2281
|
-
h('span', null, 'Log API access')
|
|
2282
|
-
)
|
|
2283
|
-
)
|
|
2284
|
-
),
|
|
2285
|
-
h('div', { style: { marginTop: 16 } },
|
|
2286
|
-
h('button', {
|
|
2287
|
-
className: 'btn btn-secondary btn-sm',
|
|
2288
|
-
onClick: function() {
|
|
2289
|
-
apiCall('/settings/security/events').then(function(d) {
|
|
2290
|
-
setEvents(d.events || []);
|
|
2291
|
-
});
|
|
2292
|
-
}
|
|
2293
|
-
}, 'Load Recent Events'),
|
|
2294
|
-
events.length > 0 && h('div', { style: { marginTop: 12, maxHeight: 200, overflow: 'auto', border: '1px solid var(--border)', borderRadius: 4 } },
|
|
2295
|
-
h('table', { style: { width: '100%', fontSize: 12 } },
|
|
2296
|
-
h('thead', null,
|
|
2297
|
-
h('tr', { style: { background: 'var(--bg-secondary)' } },
|
|
2298
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'left' } }, 'Type'),
|
|
2299
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'left' } }, 'Severity'),
|
|
2300
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'left' } }, 'Time'),
|
|
2301
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'left' } }, 'Source IP')
|
|
2302
|
-
)
|
|
2303
|
-
),
|
|
2304
|
-
h('tbody', null,
|
|
2305
|
-
events.slice(0, 10).map(function(event, i) {
|
|
2306
|
-
return h('tr', { key: i },
|
|
2307
|
-
h('td', { style: { padding: '6px 12px' } }, event.eventType),
|
|
2308
|
-
h('td', { style: { padding: '6px 12px' } },
|
|
2309
|
-
h('span', {
|
|
2310
|
-
className: 'badge badge-' + (event.severity === 'critical' ? 'danger' : event.severity === 'high' ? 'warning' : event.severity === 'medium' ? 'info' : 'secondary')
|
|
2311
|
-
}, event.severity)
|
|
2312
|
-
),
|
|
2313
|
-
h('td', { style: { padding: '6px 12px' } }, new Date(event.timestamp).toLocaleString()),
|
|
2314
|
-
h('td', { style: { padding: '6px 12px' } }, event.sourceIp || '-')
|
|
2315
|
-
);
|
|
2316
|
-
})
|
|
2317
|
-
)
|
|
2318
|
-
)
|
|
2319
|
-
)
|
|
2320
|
-
)
|
|
2321
|
-
)))
|
|
2322
|
-
)
|
|
2323
|
-
);
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
function NetworkFirewallTab(props) {
|
|
2327
|
-
var fw = props.fw || {};
|
|
2328
|
-
var setFw = props.setFw;
|
|
2329
|
-
var saving = props.saving;
|
|
2330
|
-
var dirty = props.dirty;
|
|
2331
|
-
|
|
2332
|
-
var ipAccess = fw.ipAccess || {};
|
|
2333
|
-
var egress = fw.egress || {};
|
|
2334
|
-
var proxy = fw.proxy || {};
|
|
2335
|
-
var tp = fw.trustedProxies || {};
|
|
2336
|
-
var net = fw.network || {};
|
|
2337
|
-
var rl = net.rateLimit || {};
|
|
2338
|
-
var https = net.httpsEnforcement || {};
|
|
2339
|
-
var sh = net.securityHeaders || {};
|
|
2340
|
-
var dnsReb = fw.dnsRebinding || {};
|
|
2341
|
-
var geoIp = fw.geoIp || {};
|
|
2342
|
-
var webhookSec = fw.webhookSecurity || {};
|
|
2343
|
-
|
|
2344
|
-
var patchFw = function(section, value) {
|
|
2345
|
-
var next = Object.assign({}, fw);
|
|
2346
|
-
next[section] = value;
|
|
2347
|
-
setFw(next);
|
|
2348
|
-
};
|
|
2349
|
-
|
|
2350
|
-
var patchIp = function(field, value) {
|
|
2351
|
-
var next = Object.assign({}, ipAccess);
|
|
2352
|
-
next[field] = value;
|
|
2353
|
-
patchFw('ipAccess', next);
|
|
2354
|
-
};
|
|
2355
|
-
|
|
2356
|
-
var patchEgress = function(field, value) {
|
|
2357
|
-
var next = Object.assign({}, egress);
|
|
2358
|
-
next[field] = value;
|
|
2359
|
-
patchFw('egress', next);
|
|
2360
|
-
};
|
|
2361
|
-
|
|
2362
|
-
var patchProxy = function(field, value) {
|
|
2363
|
-
var next = Object.assign({}, proxy);
|
|
2364
|
-
next[field] = value;
|
|
2365
|
-
patchFw('proxy', next);
|
|
2366
|
-
};
|
|
2367
|
-
|
|
2368
|
-
var patchTp = function(field, value) {
|
|
2369
|
-
var next = Object.assign({}, tp);
|
|
2370
|
-
next[field] = value;
|
|
2371
|
-
patchFw('trustedProxies', next);
|
|
2372
|
-
};
|
|
2373
|
-
|
|
2374
|
-
var patchNet = function(field, value) {
|
|
2375
|
-
var next = Object.assign({}, net);
|
|
2376
|
-
next[field] = value;
|
|
2377
|
-
patchFw('network', next);
|
|
2378
|
-
};
|
|
2379
|
-
|
|
2380
|
-
var patchRl = function(field, value) {
|
|
2381
|
-
var next = Object.assign({}, rl);
|
|
2382
|
-
next[field] = value;
|
|
2383
|
-
patchNet('rateLimit', next);
|
|
2384
|
-
};
|
|
2385
|
-
|
|
2386
|
-
var patchHttps = function(field, value) {
|
|
2387
|
-
var next = Object.assign({}, https);
|
|
2388
|
-
next[field] = value;
|
|
2389
|
-
patchNet('httpsEnforcement', next);
|
|
2390
|
-
};
|
|
2391
|
-
|
|
2392
|
-
var patchSh = function(field, value) {
|
|
2393
|
-
var next = Object.assign({}, sh);
|
|
2394
|
-
next[field] = value;
|
|
2395
|
-
patchNet('securityHeaders', next);
|
|
2396
|
-
};
|
|
2397
|
-
|
|
2398
|
-
return h(Fragment, null,
|
|
2399
|
-
// Header
|
|
2400
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
|
|
2401
|
-
h('div', null,
|
|
2402
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 0 } },
|
|
2403
|
-
h('h3', { style: { margin: 0, fontSize: 18, fontWeight: 600 } }, 'Network & Firewall'),
|
|
2404
|
-
h(HelpButton, { label: SETTINGS_HELP.network.label }, SETTINGS_HELP.network.content())
|
|
2405
|
-
),
|
|
2406
|
-
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.')
|
|
2407
|
-
),
|
|
2408
|
-
h('button', {
|
|
2409
|
-
className: 'btn btn-primary',
|
|
2410
|
-
disabled: saving || !dirty,
|
|
2411
|
-
onClick: props.onSave
|
|
2412
|
-
}, saving ? 'Saving...' : 'Save Settings')
|
|
2413
|
-
),
|
|
2414
|
-
|
|
2415
|
-
// ── IP ACCESS CONTROL ──
|
|
2416
|
-
h('div', { style: _sectionTitleStyle }, 'IP Access Control'),
|
|
2417
|
-
h('div', { style: _cardStyle },
|
|
2418
|
-
h('div', { style: _cardTitleStyle }, I.shield(), ' Inbound IP Filtering', h(HelpButton, { label: 'Inbound IP Filtering' }, h('div', null, h('p', null, 'Controls which IP addresses can reach your dashboard and API endpoints.'), h('p', null, h('strong', null, 'Allowlist mode:'), ' Only listed IPs can access. Everything else is blocked.'), h('p', null, h('strong', null, 'Blocklist mode:'), ' All IPs allowed except listed ones.'), h('p', null, 'Supports CIDR notation (e.g. 10.0.0.0/8). Bypass paths like /health are always accessible.')))),
|
|
2419
|
-
h('div', { style: _cardDescStyle }, 'Restrict which IP addresses can access the dashboard, APIs, and engine endpoints. Supports individual IPs and CIDR ranges.'),
|
|
2420
|
-
h(ToggleSwitch, { label: 'Enable IP access control', checked: ipAccess.enabled === true, onChange: function(v) { var next = Object.assign({}, ipAccess, { enabled: v }); if (!next.mode) next.mode = 'allowlist'; patchFw('ipAccess', next); } }),
|
|
2421
|
-
ipAccess.enabled && h(Fragment, null,
|
|
2422
|
-
h('div', { style: { marginBottom: 12 } },
|
|
2423
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
|
|
2424
|
-
h('select', { className: 'input', style: { width: 280 }, value: ipAccess.mode || 'allowlist', onChange: function(e) { patchIp('mode', e.target.value); } },
|
|
2425
|
-
h('option', { value: 'allowlist' }, 'Allowlist — only listed IPs can access'),
|
|
2426
|
-
h('option', { value: 'blocklist' }, 'Blocklist — listed IPs are blocked')
|
|
2427
|
-
)
|
|
2428
|
-
),
|
|
2429
|
-
h('div', { style: _gridStyle },
|
|
2430
|
-
h(TagInput, { label: 'Allowed IPs / CIDRs', value: ipAccess.allowlist || [], onChange: function(v) { patchIp('allowlist', v); }, placeholder: '10.0.0.0/8', mono: true }),
|
|
2431
|
-
h(TagInput, { label: 'Blocked IPs / CIDRs', value: ipAccess.blocklist || [], onChange: function(v) { patchIp('blocklist', v); }, placeholder: '0.0.0.0/0', mono: true })
|
|
2432
|
-
),
|
|
2433
|
-
h(TagInput, { label: 'Bypass Paths (always allowed)', value: ipAccess.bypassPaths || ['/health', '/ready'], onChange: function(v) { patchIp('bypassPaths', v); }, placeholder: '/health', mono: true }),
|
|
2434
|
-
// Test IP tool
|
|
2435
|
-
h('div', { style: { marginTop: 12, padding: 12, background: 'var(--bg-secondary)', borderRadius: 6 } },
|
|
2436
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Test an IP Address'),
|
|
2437
|
-
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
2438
|
-
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' }),
|
|
2439
|
-
h('button', { className: 'btn btn-secondary btn-sm', onClick: props.onTestIp, disabled: !props.testIp }, 'Test'),
|
|
2440
|
-
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),
|
|
2441
|
-
props.testResult && props.testResult.error && h('span', { style: { fontSize: 12, color: 'var(--danger)' } }, props.testResult.error)
|
|
2442
|
-
)
|
|
2443
|
-
)
|
|
2444
|
-
)
|
|
2445
|
-
),
|
|
2446
|
-
|
|
2447
|
-
// ── OUTBOUND EGRESS ──
|
|
2448
|
-
h('div', { style: _sectionTitleStyle }, 'Outbound Egress Rules'),
|
|
2449
|
-
h('div', { style: _cardStyle },
|
|
2450
|
-
h('div', { style: _cardTitleStyle }, I.globe(), ' Egress Filtering', h(HelpButton, { label: 'Egress Filtering' }, h('div', null, h('p', null, 'Controls outbound network access for agents. Prevents agents from reaching unauthorized external services.'), h('p', null, h('strong', null, 'Allowlist:'), ' Agents can only connect to listed hosts/ports.'), h('p', null, h('strong', null, 'Blocklist:'), ' Agents can connect anywhere except listed hosts/ports.'), h('p', null, 'Wildcards supported (e.g. *.googleapis.com). Applies to web fetch, browser automation, and HTTP tools.')))),
|
|
2451
|
-
h('div', { style: _cardDescStyle }, 'Control which external hosts and ports agents can reach when using web fetch, browser, and other network tools.'),
|
|
2452
|
-
h(ToggleSwitch, { label: 'Enable egress filtering', checked: egress.enabled === true, onChange: function(v) { var next = Object.assign({}, egress, { enabled: v }); if (!next.mode) next.mode = 'blocklist'; patchFw('egress', next); } }),
|
|
2453
|
-
egress.enabled && h(Fragment, null,
|
|
2454
|
-
h('div', { style: { marginBottom: 12 } },
|
|
2455
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
|
|
2456
|
-
h('select', { className: 'input', style: { width: 280 }, value: egress.mode || 'blocklist', onChange: function(e) { patchEgress('mode', e.target.value); } },
|
|
2457
|
-
h('option', { value: 'allowlist' }, 'Allowlist — only listed hosts are reachable'),
|
|
2458
|
-
h('option', { value: 'blocklist' }, 'Blocklist — listed hosts are blocked')
|
|
2459
|
-
)
|
|
2460
|
-
),
|
|
2461
|
-
h('div', { style: _gridStyle },
|
|
2462
|
-
h(TagInput, { label: 'Allowed Hosts', value: egress.allowedHosts || [], onChange: function(v) { patchEgress('allowedHosts', v); }, placeholder: '*.googleapis.com', mono: true }),
|
|
2463
|
-
h(TagInput, { label: 'Blocked Hosts', value: egress.blockedHosts || [], onChange: function(v) { patchEgress('blockedHosts', v); }, placeholder: 'evil.example.com', mono: true })
|
|
2464
|
-
),
|
|
2465
|
-
h('div', { style: _gridStyle },
|
|
2466
|
-
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' }),
|
|
2467
|
-
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' })
|
|
2468
|
-
)
|
|
2469
|
-
)
|
|
2470
|
-
),
|
|
2471
|
-
|
|
2472
|
-
// ── PROXY & TRUSTED PROXIES ──
|
|
2473
|
-
h('div', { style: _sectionTitleStyle }, 'Proxy & Trusted Proxies'),
|
|
2474
|
-
h('div', { style: _gridStyle },
|
|
2475
|
-
|
|
2476
|
-
// Proxy config
|
|
2477
|
-
h('div', { style: _cardStyle },
|
|
2478
|
-
h('div', { style: _cardTitleStyle }, I.link(), ' Proxy Configuration', h(HelpButton, { label: 'Proxy Configuration' }, h('div', null, h('p', null, 'Route agent outbound traffic through a corporate proxy. Required in air-gapped or restricted network environments.'), h('p', null, 'Set HTTP and HTTPS proxy URLs. Use No-Proxy to bypass the proxy for internal hosts (e.g. *.internal, localhost).')))),
|
|
2479
|
-
h('div', { style: _cardDescStyle }, 'Configure HTTP/HTTPS proxies for agent outbound traffic in air-gapped or restricted environments.'),
|
|
2480
|
-
h('div', { className: 'form-group', style: { marginBottom: 12 } },
|
|
2481
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'HTTP Proxy'),
|
|
2482
|
-
h('input', { className: 'input', style: { fontSize: 13 }, value: proxy.httpProxy || '', onChange: function(e) { patchProxy('httpProxy', e.target.value); }, placeholder: 'http://proxy.corp.internal:8080' })
|
|
2483
|
-
),
|
|
2484
|
-
h('div', { className: 'form-group', style: { marginBottom: 12 } },
|
|
2485
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'HTTPS Proxy'),
|
|
2486
|
-
h('input', { className: 'input', style: { fontSize: 13 }, value: proxy.httpsProxy || '', onChange: function(e) { patchProxy('httpsProxy', e.target.value); }, placeholder: 'http://proxy.corp.internal:8080' })
|
|
2487
|
-
),
|
|
2488
|
-
h(TagInput, { label: 'No-Proxy Hosts', value: proxy.noProxy || ['localhost', '127.0.0.1'], onChange: function(v) { patchProxy('noProxy', v); }, placeholder: '*.internal', mono: true })
|
|
2489
|
-
),
|
|
2490
|
-
|
|
2491
|
-
// Trusted proxies
|
|
2492
|
-
h('div', { style: _cardStyle },
|
|
2493
|
-
h('div', { style: _cardTitleStyle }, I.shield(), ' Trusted Proxies', h(HelpButton, { label: 'Trusted Proxies' }, h('div', null, h('p', null, 'When behind a load balancer or reverse proxy (e.g. Cloudflare, nginx), the real client IP comes from X-Forwarded-For headers.'), h('p', null, 'List your proxy IPs/CIDRs here so the system extracts the correct client IP for IP access control and rate limiting.')))),
|
|
2494
|
-
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.'),
|
|
2495
|
-
h(ToggleSwitch, { label: 'Enable trusted proxy validation', checked: tp.enabled === true, onChange: function(v) { patchTp('enabled', v); } }),
|
|
2496
|
-
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 })
|
|
2497
|
-
)
|
|
2498
|
-
),
|
|
2499
|
-
|
|
2500
|
-
// ── NETWORK SETTINGS ──
|
|
2501
|
-
h('div', { style: _sectionTitleStyle }, 'Network & Deployment Settings'),
|
|
2502
|
-
h('div', { style: _gridStyle },
|
|
2503
|
-
|
|
2504
|
-
// CORS
|
|
2505
|
-
h('div', { style: _cardStyle },
|
|
2506
|
-
h('div', { style: _cardTitleStyle }, I.globe(), ' CORS Origins', h(HelpButton, { label: 'CORS Origins' }, h('div', null, h('p', null, 'Cross-Origin Resource Sharing (CORS) controls which domains can make API requests to your server from a browser.'), h('p', null, 'Add your dashboard URL and any custom frontend domains. Leave empty to allow all origins (not recommended for production).')))),
|
|
2507
|
-
h('div', { style: _cardDescStyle }, 'Allowed origins for cross-origin requests. Leave empty to allow all origins (*).'),
|
|
2508
|
-
h(TagInput, { label: 'Allowed Origins', value: net.corsOrigins || [], onChange: function(v) { patchNet('corsOrigins', v); }, placeholder: 'https://dashboard.example.com', mono: true })
|
|
2509
|
-
),
|
|
2510
|
-
|
|
2511
|
-
// Rate Limiting
|
|
2512
|
-
h('div', { style: _cardStyle },
|
|
2513
|
-
h('div', { style: _cardTitleStyle }, I.clock(), ' Rate Limiting', h(HelpButton, { label: 'Rate Limiting' }, h('div', null, h('p', null, 'Limits API requests per IP address using a token bucket algorithm. Prevents brute-force attacks and API abuse.'), h('p', null, 'Skip paths (like /health) are excluded from rate limiting. Adjust requests per minute based on your expected traffic.')))),
|
|
2514
|
-
h('div', { style: _cardDescStyle }, 'Per-IP rate limiting using token bucket algorithm. Protects against abuse and DDoS.'),
|
|
2515
|
-
h(ToggleSwitch, { label: 'Enable rate limiting', checked: rl.enabled !== false, onChange: function(v) { patchRl('enabled', v); } }),
|
|
2516
|
-
h('div', { className: 'form-group', style: { marginBottom: 12 } },
|
|
2517
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Requests per Minute'),
|
|
2518
|
-
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); } })
|
|
2519
|
-
),
|
|
2520
|
-
h(TagInput, { label: 'Skip Paths', value: rl.skipPaths || ['/health', '/ready'], onChange: function(v) { patchRl('skipPaths', v); }, placeholder: '/health', mono: true })
|
|
2521
|
-
),
|
|
2522
|
-
|
|
2523
|
-
// HTTPS Enforcement
|
|
2524
|
-
h('div', { style: _cardStyle },
|
|
2525
|
-
h('div', { style: _cardTitleStyle }, I.key(), ' HTTPS Enforcement', h(HelpButton, { label: 'HTTPS Enforcement' }, h('div', null, h('p', null, 'Redirects all HTTP requests to HTTPS in production. Essential for protecting data in transit.'), h('p', null, 'Uses X-Forwarded-Proto header detection for reverse proxy setups (Cloudflare, nginx, etc.). Exclude specific paths like health checks if needed.')))),
|
|
2526
|
-
h('div', { style: _cardDescStyle }, 'Require HTTPS for all requests in production. Checks X-Forwarded-Proto header for reverse proxy setups.'),
|
|
2527
|
-
h(ToggleSwitch, { label: 'Enforce HTTPS', checked: https.enabled === true, onChange: function(v) { patchHttps('enabled', v); } }),
|
|
2528
|
-
https.enabled && h(TagInput, { label: 'Exclude Paths', value: https.excludePaths || [], onChange: function(v) { patchHttps('excludePaths', v); }, placeholder: '/health', mono: true })
|
|
2529
|
-
),
|
|
2530
|
-
|
|
2531
|
-
// Security Headers
|
|
2532
|
-
h('div', { style: _cardStyle },
|
|
2533
|
-
h('div', { style: _cardTitleStyle }, I.shield(), ' Security Headers', h(HelpButton, { label: 'Security Headers' }, h('div', null, h('p', null, 'HTTP headers added to every response for defense-in-depth browser security.'), h('p', null, h('strong', null, 'HSTS:'), ' Forces browsers to use HTTPS for future visits.'), h('p', null, h('strong', null, 'X-Frame-Options:'), ' Prevents clickjacking by controlling iframe embedding.'), h('p', null, h('strong', null, 'Referrer-Policy:'), ' Controls how much referrer info is sent with requests.'), h('p', null, h('strong', null, 'Permissions-Policy:'), ' Disables browser features like camera/microphone access.')))),
|
|
2534
|
-
h('div', { style: _cardDescStyle }, 'HTTP security headers applied to all responses. Protects against clickjacking, MIME sniffing, and other browser-level attacks.'),
|
|
2535
|
-
h(ToggleSwitch, { label: 'Strict-Transport-Security (HSTS)', checked: sh.hsts !== false, onChange: function(v) { patchSh('hsts', v); } }),
|
|
2536
|
-
sh.hsts !== false && h('div', { className: 'form-group', style: { marginBottom: 12 } },
|
|
2537
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'HSTS Max-Age (seconds)'),
|
|
2538
|
-
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); } })
|
|
2539
|
-
),
|
|
2540
|
-
h(ToggleSwitch, { label: 'X-Content-Type-Options: nosniff', checked: sh.xContentTypeOptions !== false, onChange: function(v) { patchSh('xContentTypeOptions', v); } }),
|
|
2541
|
-
h('div', { style: { marginBottom: 12 } },
|
|
2542
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'X-Frame-Options'),
|
|
2543
|
-
h('select', { className: 'input', style: { width: 200 }, value: sh.xFrameOptions || 'DENY', onChange: function(e) { patchSh('xFrameOptions', e.target.value); } },
|
|
2544
|
-
h('option', { value: 'DENY' }, 'DENY (recommended)'),
|
|
2545
|
-
h('option', { value: 'SAMEORIGIN' }, 'SAMEORIGIN'),
|
|
2546
|
-
h('option', { value: 'ALLOW' }, 'ALLOW (not recommended)')
|
|
2547
|
-
)
|
|
2548
|
-
),
|
|
2549
|
-
h('div', { style: { marginBottom: 12 } },
|
|
2550
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Referrer-Policy'),
|
|
2551
|
-
h('select', { className: 'input', style: { width: 280 }, value: sh.referrerPolicy || 'strict-origin-when-cross-origin', onChange: function(e) { patchSh('referrerPolicy', e.target.value); } },
|
|
2552
|
-
h('option', { value: 'strict-origin-when-cross-origin' }, 'strict-origin-when-cross-origin'),
|
|
2553
|
-
h('option', { value: 'no-referrer' }, 'no-referrer'),
|
|
2554
|
-
h('option', { value: 'origin' }, 'origin'),
|
|
2555
|
-
h('option', { value: 'same-origin' }, 'same-origin')
|
|
2556
|
-
)
|
|
2557
|
-
),
|
|
2558
|
-
h('div', { className: 'form-group' },
|
|
2559
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Permissions-Policy'),
|
|
2560
|
-
h('input', { className: 'input', style: { fontSize: 13 }, value: sh.permissionsPolicy || 'camera=(), microphone=(), geolocation=()', onChange: function(e) { patchSh('permissionsPolicy', e.target.value); } })
|
|
2561
|
-
)
|
|
2562
|
-
)
|
|
2563
|
-
),
|
|
2564
|
-
|
|
2565
|
-
// ── Advanced Security ──────────────────────────────
|
|
2566
|
-
h('div', { style: _sectionTitleStyle }, 'Advanced Security'),
|
|
2567
|
-
h('div', { style: { display: 'grid', gap: 16 } },
|
|
2568
|
-
|
|
2569
|
-
// DNS Rebinding Protection
|
|
2570
|
-
h('div', { style: _cardStyle },
|
|
2571
|
-
h('div', { style: _cardTitleStyle }, I.shield(), ' DNS Rebinding Protection', h(HelpButton, { label: 'DNS Rebinding Protection' }, h('div', null, h('p', null, 'Prevents DNS rebinding attacks where a malicious website resolves its domain to your internal server IP.'), h('p', null, 'When enabled, requests with a Host header not in the allowlist are rejected. Add your domain(s) to the allowed hosts list.')))),
|
|
2572
|
-
h('div', { style: _cardDescStyle }, 'Validates the Host header against an allowlist to prevent DNS rebinding attacks targeting internal services.'),
|
|
2573
|
-
h(ToggleSwitch, { label: 'Enable DNS rebinding protection', checked: dnsReb.enabled === true, onChange: function(v) { patchFw('dnsRebinding', Object.assign({}, dnsReb, { enabled: v })); } }),
|
|
2574
|
-
dnsReb.enabled && h(TagInput, { label: 'Allowed Hosts', value: dnsReb.allowedHosts || [], onChange: function(v) { patchFw('dnsRebinding', Object.assign({}, dnsReb, { allowedHosts: v })); }, placeholder: 'enterprise.example.com', mono: true })
|
|
2575
|
-
),
|
|
2576
|
-
|
|
2577
|
-
// Request Body Size Limit
|
|
2578
|
-
h('div', { style: _cardStyle },
|
|
2579
|
-
h('div', { style: _cardTitleStyle }, I.shield(), ' Request Body Limits', h(HelpButton, { label: 'Request Body Limits' }, h('div', null, h('p', null, 'Limits the maximum size of incoming request bodies to prevent denial-of-service via oversized payloads.'), h('p', null, 'Default is 10 MB. Increase if agents need to upload large files. Decrease for tighter security in exposed environments.')))),
|
|
2580
|
-
h('div', { style: _cardDescStyle }, 'Maximum request body size for API endpoints. Prevents excessively large payloads from consuming server resources.'),
|
|
2581
|
-
h('div', { className: 'form-group', style: { marginBottom: 12 } },
|
|
2582
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Max Body Size (KB)'),
|
|
2583
|
-
h('input', { className: 'input', type: 'number', min: 64, max: 102400, style: { width: 150, fontSize: 13 }, value: net.maxBodySizeKb || 10240, onChange: function(e) { patchNet('maxBodySizeKb', parseInt(e.target.value) || 10240); } })
|
|
2584
|
-
),
|
|
2585
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)' } }, 'Default: 10240 KB (10 MB). Set higher for file upload APIs.')
|
|
2586
|
-
),
|
|
2587
|
-
|
|
2588
|
-
// Geo-IP Restrictions
|
|
2589
|
-
h('div', { style: _cardStyle },
|
|
2590
|
-
h('div', { style: _cardTitleStyle }, I.globe(), ' Geo-IP Restrictions', h(HelpButton, { label: 'Geo-IP Restrictions' }, h('div', null, h('p', null, 'Restricts access based on the geographic location of the client IP address.'), h('p', null, h('strong', null, 'Allowlist:'), ' Only selected countries can access.'), h('p', null, h('strong', null, 'Blocklist:'), ' Selected countries are blocked, everyone else allowed.'), h('p', null, 'Uses built-in IP geolocation — works without Cloudflare or any reverse proxy.')))),
|
|
2591
|
-
h('div', { style: _cardDescStyle }, 'Restrict access by country using built-in IP geolocation. Works with any setup — no reverse proxy headers required.'),
|
|
2592
|
-
h(ToggleSwitch, { label: 'Enable geo-IP filtering', checked: geoIp.enabled === true, onChange: function(v) { patchFw('geoIp', Object.assign({}, geoIp, { enabled: v, mode: geoIp.mode || 'blocklist' })); } }),
|
|
2593
|
-
geoIp.enabled && h(Fragment, null,
|
|
2594
|
-
h('div', { style: { marginBottom: 8 } },
|
|
2595
|
-
h('label', { style: { display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 4 } }, 'Mode'),
|
|
2596
|
-
h('select', { className: 'input', style: { width: 200 }, value: geoIp.mode || 'blocklist', onChange: function(e) { patchFw('geoIp', Object.assign({}, geoIp, { mode: e.target.value })); } },
|
|
2597
|
-
h('option', { value: 'allowlist' }, 'Only allow these countries'),
|
|
2598
|
-
h('option', { value: 'blocklist' }, 'Block these countries')
|
|
2599
|
-
)
|
|
2600
|
-
),
|
|
2601
|
-
h(CountryPicker, {
|
|
2602
|
-
selected: geoIp.countries || [],
|
|
2603
|
-
onChange: function(v) { patchFw('geoIp', Object.assign({}, geoIp, { countries: v })); }
|
|
2604
|
-
})
|
|
2605
|
-
)
|
|
2606
|
-
),
|
|
2607
|
-
|
|
2608
|
-
// Webhook Security
|
|
2609
|
-
h('div', { style: _cardStyle },
|
|
2610
|
-
h('div', { style: _cardTitleStyle }, I.key(), ' Webhook Security', h(HelpButton, { label: 'Webhook Security' }, h('div', null, h('p', null, 'Secures inbound webhook endpoints used by Slack, Google Chat, and other integrations.'), h('p', null, h('strong', null, 'HMAC validation:'), ' Requires incoming webhooks to include a valid signature, preventing spoofed requests.'), h('p', null, h('strong', null, 'Source IP filtering:'), ' Only accept webhooks from known provider IP ranges (e.g. Google, Slack).')))),
|
|
2611
|
-
h('div', { style: _cardDescStyle }, 'Security controls for inbound webhook endpoints (Google Chat, Slack, third-party integrations).'),
|
|
2612
|
-
h(ToggleSwitch, { label: 'Enable webhook security', checked: webhookSec.enabled === true, onChange: function(v) { patchFw('webhookSecurity', Object.assign({}, webhookSec, { enabled: v })); } }),
|
|
2613
|
-
webhookSec.enabled && h(Fragment, null,
|
|
2614
|
-
h(ToggleSwitch, { label: 'Require HMAC signature validation', checked: webhookSec.requireSignature === true, onChange: function(v) { patchFw('webhookSecurity', Object.assign({}, webhookSec, { requireSignature: v })); } }),
|
|
2615
|
-
h(TagInput, { label: 'Allowed Webhook Source IPs', value: webhookSec.allowedSourceIps || [], onChange: function(v) { patchFw('webhookSecurity', Object.assign({}, webhookSec, { allowedSourceIps: v })); }, placeholder: '35.0.0.0/8', mono: true })
|
|
2616
|
-
)
|
|
2617
|
-
)
|
|
2618
|
-
),
|
|
2619
|
-
|
|
2620
|
-
// Bottom save bar
|
|
2621
|
-
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 } },
|
|
2622
|
-
h('span', { style: { fontSize: 12, color: 'var(--text-muted)', alignSelf: 'center' } }, 'Changes take effect immediately — no restart required.'),
|
|
2623
|
-
h('button', { className: 'btn btn-primary', disabled: saving, onClick: props.onSave }, saving ? 'Saving...' : 'Save Network & Firewall Settings')
|
|
2624
|
-
)
|
|
2625
|
-
);
|
|
2626
|
-
}
|
|
2627
|
-
|
|
2628
|
-
// ═══════════════════════════════════════════════════════════
|
|
2629
|
-
// PROVIDERS SECTION
|
|
2630
|
-
// ═══════════════════════════════════════════════════════════
|
|
2631
|
-
|
|
2632
|
-
function LLMProvidersTab(props) {
|
|
2633
|
-
var toast = props.toast;
|
|
2634
|
-
var _providers = useState([]);
|
|
2635
|
-
var providers = _providers[0]; var setProviders = _providers[1];
|
|
2636
|
-
var _apiKeyInputs = useState({});
|
|
2637
|
-
var apiKeyInputs = _apiKeyInputs[0]; var setApiKeyInputs = _apiKeyInputs[1];
|
|
2638
|
-
var _saving = useState({});
|
|
2639
|
-
var saving = _saving[0]; var setSaving = _saving[1];
|
|
2640
|
-
|
|
2641
|
-
useEffect(function() {
|
|
2642
|
-
apiCall('/providers').then(function(d) { setProviders(d.providers || []); }).catch(function() {});
|
|
2643
|
-
}, []);
|
|
2644
|
-
|
|
2645
|
-
var _savingMsg = useState({});
|
|
2646
|
-
var savingMsg = _savingMsg[0]; var setSavingMsg = _savingMsg[1];
|
|
2647
|
-
|
|
2648
|
-
var saveKey = async function(providerId, providerName) {
|
|
2649
|
-
var key = (apiKeyInputs[providerId] || '').trim();
|
|
2650
|
-
if (!key || key.length < 5) { toast('API key too short', 'error'); return; }
|
|
2651
|
-
setSaving(function(s) { return Object.assign({}, s, { [providerId]: true }); });
|
|
2652
|
-
setSavingMsg(function(s) { return Object.assign({}, s, { [providerId]: 'Validating...' }); });
|
|
2653
|
-
try {
|
|
2654
|
-
await apiCall('/providers/' + providerId + '/api-key', { method: 'POST', body: JSON.stringify({ apiKey: key }) });
|
|
2655
|
-
toast(providerName + ' API key validated and saved', 'success');
|
|
2656
|
-
setApiKeyInputs(function(s) { return Object.assign({}, s, { [providerId]: '' }); });
|
|
2657
|
-
apiCall('/providers').then(function(d) { setProviders(d.providers || []); }).catch(function() {});
|
|
2658
|
-
} catch (err) {
|
|
2659
|
-
var msg = err.message || 'Save failed';
|
|
2660
|
-
if (msg.indexOf('validation failed') !== -1) {
|
|
2661
|
-
toast(providerName + ': ' + msg, 'error');
|
|
2662
|
-
} else {
|
|
2663
|
-
toast('Failed: ' + msg, 'error');
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
setSaving(function(s) { return Object.assign({}, s, { [providerId]: false }); });
|
|
2667
|
-
setSavingMsg(function(s) { return Object.assign({}, s, { [providerId]: '' }); });
|
|
2668
|
-
};
|
|
2669
|
-
|
|
2670
|
-
var builtIn = providers.filter(function(p) { return p.source === 'built-in'; });
|
|
2671
|
-
var custom = providers.filter(function(p) { return p.source === 'custom'; });
|
|
2672
|
-
var configured = builtIn.filter(function(p) { return p.configured; });
|
|
2673
|
-
var notConfigured = builtIn.filter(function(p) { return !p.configured && p.requiresApiKey; });
|
|
2674
|
-
|
|
2675
|
-
var providerMeta = {
|
|
2676
|
-
anthropic: { desc: 'Claude Opus 4, Sonnet 4, Haiku — best for agentic tasks, tool use, extended thinking', placeholder: 'sk-ant-api03-...' },
|
|
2677
|
-
openai: { desc: 'GPT-4o, o1, o3 — strong general-purpose, vision, function calling', placeholder: 'sk-proj-...' },
|
|
2678
|
-
xai: { desc: 'Grok-4, Grok-3 — fast, strong reasoning', placeholder: 'xai-...' },
|
|
2679
|
-
google: { desc: 'Gemini 2.5 Pro, Flash — multimodal, large context window', placeholder: 'AI...' },
|
|
2680
|
-
deepseek: { desc: 'DeepSeek V3/R1 — cost-effective reasoning', placeholder: 'sk-...' },
|
|
2681
|
-
mistral: { desc: 'Mistral Large, Codestral — fast European models', placeholder: '' },
|
|
2682
|
-
groq: { desc: 'Ultra-fast inference — Llama, Mixtral, Gemma', placeholder: 'gsk_...' },
|
|
2683
|
-
together: { desc: 'Open-source model hosting — Llama, Qwen, Mixtral', placeholder: '' },
|
|
2684
|
-
openrouter: { desc: 'Multi-provider router — access 100+ models via one API key', placeholder: 'sk-or-...' },
|
|
2685
|
-
};
|
|
2686
|
-
|
|
2687
|
-
return h(Fragment, null,
|
|
2688
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
2689
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Connected Providers')),
|
|
2690
|
-
h('div', { className: 'card-body' },
|
|
2691
|
-
configured.length === 0
|
|
2692
|
-
? h('div', { style: { padding: 24, textAlign: 'center', color: 'var(--text-muted)' } }, 'No providers connected yet. Add an API key below to get started.')
|
|
2693
|
-
: configured.map(function(p) {
|
|
2694
|
-
var meta = providerMeta[p.id] || {};
|
|
2695
|
-
return h('div', { key: p.id, style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '12px 0', borderBottom: '1px solid var(--border)' } },
|
|
2696
|
-
h('div', null,
|
|
2697
|
-
h('span', { style: { fontWeight: 600, fontSize: 14 } }, p.name),
|
|
2698
|
-
h('span', { style: { marginLeft: 8, color: 'var(--success, #15803d)', fontSize: 12 } }, '\u2713 Connected'),
|
|
2699
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 2 } }, meta.desc || '')
|
|
2700
|
-
),
|
|
2701
|
-
h('button', {
|
|
2702
|
-
className: 'btn btn-ghost btn-sm',
|
|
2703
|
-
onClick: function() { setApiKeyInputs(function(s) { return Object.assign({}, s, { [p.id]: s[p.id] === null ? '' : null }); }); }
|
|
2704
|
-
}, apiKeyInputs[p.id] === null ? 'Cancel' : 'Update Key'),
|
|
2705
|
-
typeof apiKeyInputs[p.id] === 'string' && apiKeyInputs[p.id] !== null && h('div', { style: { display: 'flex', gap: 8, marginLeft: 8 } },
|
|
2706
|
-
h('input', { className: 'input', type: 'password', value: apiKeyInputs[p.id], onChange: function(e) { setApiKeyInputs(function(s) { return Object.assign({}, s, { [p.id]: e.target.value }); }); }, placeholder: meta.placeholder || 'New API key', style: { width: 240, fontSize: 13 } }),
|
|
2707
|
-
h('button', { className: 'btn btn-primary btn-sm', disabled: saving[p.id], onClick: function() { saveKey(p.id, p.name); } }, saving[p.id] ? (savingMsg[p.id] || 'Saving...') : 'Save')
|
|
2708
|
-
)
|
|
2709
|
-
);
|
|
2710
|
-
})
|
|
2711
|
-
)
|
|
2712
|
-
),
|
|
2713
|
-
|
|
2714
|
-
h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
2715
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Add Provider')),
|
|
2716
|
-
h('div', { className: 'card-body' },
|
|
2717
|
-
notConfigured.length === 0
|
|
2718
|
-
? h('div', { style: { padding: 16, textAlign: 'center', color: 'var(--text-muted)' } }, 'All built-in providers are configured.')
|
|
2719
|
-
: notConfigured.map(function(p) {
|
|
2720
|
-
var meta = providerMeta[p.id] || {};
|
|
2721
|
-
return h('div', { key: p.id, style: { padding: '12px 0', borderBottom: '1px solid var(--border)' } },
|
|
2722
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 } },
|
|
2723
|
-
h('div', null,
|
|
2724
|
-
h('span', { style: { fontWeight: 600, fontSize: 14 } }, p.name),
|
|
2725
|
-
p.isLocal && h('span', { className: 'badge badge-neutral', style: { marginLeft: 8, fontSize: 11 } }, 'Local'),
|
|
2726
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 2 } }, meta.desc || '')
|
|
2727
|
-
)
|
|
2728
|
-
),
|
|
2729
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
2730
|
-
h('input', { className: 'input', type: 'password', value: apiKeyInputs[p.id] || '', onChange: function(e) { setApiKeyInputs(function(s) { return Object.assign({}, s, { [p.id]: e.target.value }); }); }, placeholder: meta.placeholder || 'Paste API key', style: { flex: 1, fontSize: 13 } }),
|
|
2731
|
-
h('button', { className: 'btn btn-primary btn-sm', disabled: saving[p.id] || !(apiKeyInputs[p.id] || '').trim(), onClick: function() { saveKey(p.id, p.name); } }, saving[p.id] ? (savingMsg[p.id] || 'Saving...') : 'Connect')
|
|
2732
|
-
)
|
|
2733
|
-
);
|
|
2734
|
-
})
|
|
2735
|
-
)
|
|
2736
|
-
),
|
|
2737
|
-
|
|
2738
|
-
// Local providers (no key needed)
|
|
2739
|
-
builtIn.filter(function(p) { return !p.requiresApiKey; }).length > 0 && h('div', { className: 'card' },
|
|
2740
|
-
h('div', { className: 'card-header' }, h('h3', null, 'Local Providers (No API Key)')),
|
|
2741
|
-
h('div', { className: 'card-body' },
|
|
2742
|
-
builtIn.filter(function(p) { return !p.requiresApiKey; }).map(function(p) {
|
|
2743
|
-
return h('div', { key: p.id, style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '8px 0' } },
|
|
2744
|
-
h('div', null,
|
|
2745
|
-
h('span', { style: { fontWeight: 600, fontSize: 14 } }, p.name),
|
|
2746
|
-
h('span', { className: 'badge badge-success', style: { marginLeft: 8, fontSize: 11 } }, 'Ready'),
|
|
2747
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 2 } }, p.baseUrl)
|
|
2748
|
-
)
|
|
2749
|
-
);
|
|
2750
|
-
})
|
|
2751
|
-
)
|
|
2752
|
-
),
|
|
2753
|
-
|
|
2754
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 12 } },
|
|
2755
|
-
'API keys are stored encrypted in your database. They are loaded into memory at agent startup. ',
|
|
2756
|
-
'For custom or self-hosted providers, use the Model Pricing tab to add custom endpoints.'
|
|
2757
|
-
)
|
|
2758
|
-
);
|
|
2759
|
-
}
|
|
2760
|
-
|
|
2761
|
-
function ProvidersSection(props) {
|
|
2762
|
-
var providers = props.providers || [];
|
|
2763
|
-
var toast = props.toast;
|
|
2764
|
-
var discoverResults = props.discoverResults || {};
|
|
2765
|
-
var _discovering = useState({});
|
|
2766
|
-
var discovering = _discovering[0]; var setDiscovering = _discovering[1];
|
|
2767
|
-
|
|
2768
|
-
var handleAddProvider = function() {
|
|
2769
|
-
var np = props.newProvider;
|
|
2770
|
-
if (!np.id || !np.name || !np.baseUrl) {
|
|
2771
|
-
toast('ID, Name, and Base URL are required', 'error');
|
|
2772
|
-
return;
|
|
2773
|
-
}
|
|
2774
|
-
var body = {
|
|
2775
|
-
id: np.id.toLowerCase().replace(/[^a-z0-9-]/g, '-'),
|
|
2776
|
-
name: np.name,
|
|
2777
|
-
baseUrl: np.baseUrl,
|
|
2778
|
-
apiType: np.apiType || 'openai-compatible',
|
|
2779
|
-
apiKeyEnvVar: np.apiKeyEnvVar || undefined,
|
|
2780
|
-
customHeaders: undefined,
|
|
2781
|
-
};
|
|
2782
|
-
if (np.customHeaders) {
|
|
2783
|
-
try { body.customHeaders = JSON.parse(np.customHeaders); }
|
|
2784
|
-
catch (e) { toast('Invalid JSON in Custom Headers', 'error'); return; }
|
|
2785
|
-
}
|
|
2786
|
-
apiCall('/providers', { method: 'POST', body: JSON.stringify(body) }).then(function() {
|
|
2787
|
-
toast('Provider added', 'success');
|
|
2788
|
-
props.setShowAddProvider(false);
|
|
2789
|
-
props.setNewProvider({ id: '', name: '', baseUrl: '', apiType: 'openai-compatible', apiKeyEnvVar: '', customHeaders: '' });
|
|
2790
|
-
apiCall('/providers').then(function(d) { props.setProviders(d.providers || d || []); }).catch(function() {});
|
|
2791
|
-
}).catch(function(e) { toast(e.message, 'error'); });
|
|
2792
|
-
};
|
|
2793
|
-
|
|
2794
|
-
var handleDeleteProvider = function(id) {
|
|
2795
|
-
showConfirm({ title: 'Delete Provider', message: 'Are you sure you want to delete this custom provider?', danger: true, confirmText: 'Delete' }).then(function(ok) {
|
|
2796
|
-
if (!ok) return;
|
|
2797
|
-
apiCall('/providers/' + id, { method: 'DELETE' }).then(function() {
|
|
2798
|
-
toast('Provider deleted', 'success');
|
|
2799
|
-
apiCall('/providers').then(function(d) { props.setProviders(d.providers || d || []); }).catch(function() {});
|
|
2800
|
-
}).catch(function(e) { toast(e.message, 'error'); });
|
|
2801
|
-
});
|
|
2802
|
-
};
|
|
2803
|
-
|
|
2804
|
-
var handleDiscover = function(id) {
|
|
2805
|
-
setDiscovering(Object.assign({}, discovering, { [id]: true }));
|
|
2806
|
-
apiCall('/providers/' + id + '/models').then(function(d) {
|
|
2807
|
-
var results = Object.assign({}, discoverResults);
|
|
2808
|
-
results[id] = d.models || d || [];
|
|
2809
|
-
props.setDiscoverResults(results);
|
|
2810
|
-
}).catch(function(e) { toast(e.message, 'error'); }).finally(function() {
|
|
2811
|
-
setDiscovering(Object.assign({}, discovering, { [id]: false }));
|
|
2812
|
-
});
|
|
2813
|
-
};
|
|
2814
|
-
|
|
2815
|
-
return h(Fragment, null,
|
|
2816
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 } },
|
|
2817
|
-
h('div', null,
|
|
2818
|
-
h('h3', { style: { fontSize: 15, fontWeight: 700, margin: '0 0 4px 0' } }, 'LLM Providers'),
|
|
2819
|
-
h('p', { style: { color: '#6b7280', fontSize: 13, margin: 0 } }, 'Manage connected LLM providers. Add custom providers to use self-hosted or third-party models.')
|
|
2820
|
-
),
|
|
2821
|
-
h('button', { className: 'btn', onClick: function() { props.setShowAddProvider(true); } }, '+ Add Custom Provider')
|
|
2822
|
-
),
|
|
2823
|
-
|
|
2824
|
-
// Provider cards grid
|
|
2825
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))', gap: 12, marginBottom: 24 } },
|
|
2826
|
-
providers.map(function(p) {
|
|
2827
|
-
var isConfigured = p.configured || p.isConfigured;
|
|
2828
|
-
var isLocal = p.isLocal || false;
|
|
2829
|
-
var discovered = discoverResults[p.id];
|
|
2830
|
-
return h('div', { key: p.id, className: 'card', style: { padding: 16 } },
|
|
2831
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 8 } },
|
|
2832
|
-
h('div', null,
|
|
2833
|
-
h('h4', { style: { fontSize: 14, fontWeight: 600, margin: 0 } }, p.name || p.id),
|
|
2834
|
-
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)
|
|
2835
|
-
),
|
|
2836
|
-
h('span', {
|
|
2837
|
-
className: 'badge',
|
|
2838
|
-
style: {
|
|
2839
|
-
background: isConfigured ? 'var(--success-soft, #dcfce7)' : 'var(--bg-secondary)',
|
|
2840
|
-
color: isConfigured ? 'var(--success, #16a34a)' : '#9ca3af',
|
|
2841
|
-
fontSize: 11,
|
|
2842
|
-
}
|
|
2843
|
-
}, isConfigured ? 'Connected' : 'Not Configured')
|
|
2844
|
-
),
|
|
2845
|
-
isLocal && p.baseUrl && h('div', { style: { fontSize: 12, color: '#6b7280', marginBottom: 8, wordBreak: 'break-all' } }, p.baseUrl),
|
|
2846
|
-
!isLocal && !p.isCustom && p.requiresApiKey && h('div', { style: { marginTop: 8 } },
|
|
2847
|
-
isConfigured
|
|
2848
|
-
? h('div', { style: { display: 'flex', alignItems: 'center', gap: 6, fontSize: 12 } },
|
|
2849
|
-
h('span', { style: { color: 'var(--success, #16a34a)', display: 'inline-flex', alignItems: 'center', gap: 6 } }, E.checkCircle(16), ' API key configured via environment'),
|
|
2850
|
-
h('button', { className: 'btn btn-sm btn-ghost', style: { padding: '2px 8px', fontSize: 11 }, onClick: function() {
|
|
2851
|
-
props.setApiKeyInput('');
|
|
2852
|
-
props.setApiKeyModal({ providerId: p.id, providerName: p.name, isUpdate: true });
|
|
2853
|
-
}}, 'Update Key')
|
|
2854
|
-
)
|
|
2855
|
-
: h('div', null,
|
|
2856
|
-
h('button', { className: 'btn btn-sm btn-primary', onClick: function() {
|
|
2857
|
-
props.setApiKeyInput('');
|
|
2858
|
-
props.setApiKeyModal({ providerId: p.id, providerName: p.name, isUpdate: false });
|
|
2859
|
-
}}, E.key(16), ' Add API Key')
|
|
2860
|
-
)
|
|
2861
|
-
),
|
|
2862
|
-
h('div', { style: { display: 'flex', gap: 6, marginTop: 8 } },
|
|
2863
|
-
(isLocal || isConfigured) && h('button', {
|
|
2864
|
-
className: 'btn btn-sm',
|
|
2865
|
-
disabled: discovering[p.id],
|
|
2866
|
-
onClick: function() { handleDiscover(p.id); },
|
|
2867
|
-
}, discovering[p.id] ? 'Discovering...' : (isLocal ? 'Discover Models' : 'List Models')),
|
|
2868
|
-
p.isCustom && h('button', {
|
|
2869
|
-
className: 'btn btn-sm btn-danger',
|
|
2870
|
-
style: { padding: '2px 8px', fontSize: 12 },
|
|
2871
|
-
onClick: function() { handleDeleteProvider(p.id); },
|
|
2872
|
-
}, I.trash())
|
|
2873
|
-
),
|
|
2874
|
-
// Show default models for cloud providers that have them
|
|
2875
|
-
!discovered && p.defaultModels && p.defaultModels.length > 0 && h('div', { style: { marginTop: 8, fontSize: 12 } },
|
|
2876
|
-
h('div', { style: { fontWeight: 600, marginBottom: 4, color: 'var(--text-secondary)' } }, 'Available Models (' + p.defaultModels.length + ')'),
|
|
2877
|
-
h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 4 } },
|
|
2878
|
-
p.defaultModels.map(function(mid) {
|
|
2879
|
-
return h('span', { key: mid, className: 'badge badge-neutral', style: { fontSize: 11 } }, mid);
|
|
2880
|
-
})
|
|
2881
|
-
)
|
|
2882
|
-
),
|
|
2883
|
-
discovered && discovered.length > 0 && h('div', { style: { marginTop: 8, padding: 8, background: 'var(--bg-secondary)', borderRadius: 'var(--radius)', fontSize: 12 } },
|
|
2884
|
-
h('div', { style: { fontWeight: 600, marginBottom: 4 } }, 'Models (' + discovered.length + ')'),
|
|
2885
|
-
h('div', { style: { maxHeight: 120, overflow: 'auto' } },
|
|
2886
|
-
discovered.map(function(m) {
|
|
2887
|
-
var modelName = typeof m === 'string' ? m : (m.id || m.name || m.model);
|
|
2888
|
-
return h('div', { key: modelName, style: { padding: '2px 0', color: '#6b7280' } }, modelName);
|
|
2889
|
-
})
|
|
2890
|
-
)
|
|
2891
|
-
)
|
|
2892
|
-
);
|
|
2893
|
-
})
|
|
2894
|
-
),
|
|
2895
|
-
|
|
2896
|
-
// Add Custom Provider Modal
|
|
2897
|
-
props.showAddProvider && h(Modal, {
|
|
2898
|
-
title: 'Add Custom Provider',
|
|
2899
|
-
onClose: function() { props.setShowAddProvider(false); },
|
|
2900
|
-
},
|
|
2901
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
|
|
2902
|
-
h('div', { className: 'form-group' },
|
|
2903
|
-
h('label', { className: 'form-label' }, 'ID'),
|
|
2904
|
-
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 })); } }),
|
|
2905
|
-
h('p', { className: 'form-help' }, 'Lowercase slug, used as identifier')
|
|
2906
|
-
),
|
|
2907
|
-
h('div', { className: 'form-group' },
|
|
2908
|
-
h('label', { className: 'form-label' }, 'Display Name'),
|
|
2909
|
-
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 })); } })
|
|
2910
|
-
),
|
|
2911
|
-
h('div', { className: 'form-group', style: { gridColumn: '1 / -1' } },
|
|
2912
|
-
h('label', { className: 'form-label' }, 'Base URL'),
|
|
2913
|
-
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 })); } })
|
|
2914
|
-
),
|
|
2915
|
-
h('div', { className: 'form-group' },
|
|
2916
|
-
h('label', { className: 'form-label' }, 'API Type'),
|
|
2917
|
-
h('select', { className: 'input', value: props.newProvider.apiType, onChange: function(e) { props.setNewProvider(Object.assign({}, props.newProvider, { apiType: e.target.value })); } },
|
|
2918
|
-
h('option', { value: 'openai-compatible' }, 'OpenAI Compatible'),
|
|
2919
|
-
h('option', { value: 'anthropic' }, 'Anthropic'),
|
|
2920
|
-
h('option', { value: 'google' }, 'Google'),
|
|
2921
|
-
h('option', { value: 'ollama' }, 'Ollama')
|
|
2922
|
-
)
|
|
2923
|
-
),
|
|
2924
|
-
h('div', { className: 'form-group' },
|
|
2925
|
-
h('label', { className: 'form-label' }, 'API Key Env Var'),
|
|
2926
|
-
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 })); } }),
|
|
2927
|
-
h('p', { className: 'form-help' }, 'Environment variable name for the API key')
|
|
2928
|
-
),
|
|
2929
|
-
h('div', { className: 'form-group', style: { gridColumn: '1 / -1' } },
|
|
2930
|
-
h('label', { className: 'form-label' }, 'Custom Headers (JSON)'),
|
|
2931
|
-
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 })); } })
|
|
2932
|
-
)
|
|
2933
|
-
),
|
|
2934
|
-
h('div', { style: { display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 16 } },
|
|
2935
|
-
h('button', { className: 'btn', onClick: function() { props.setShowAddProvider(false); } }, 'Cancel'),
|
|
2936
|
-
h('button', { className: 'btn btn-primary', onClick: handleAddProvider }, 'Add Provider')
|
|
2937
|
-
)
|
|
2938
|
-
),
|
|
2939
|
-
|
|
2940
|
-
// API Key Modal
|
|
2941
|
-
props.apiKeyModal && h(Modal, {
|
|
2942
|
-
title: (props.apiKeyModal.isUpdate ? 'Update' : 'Add') + ' API Key — ' + props.apiKeyModal.providerName,
|
|
2943
|
-
onClose: function() { props.setApiKeyModal(null); props.setApiKeyInput(''); },
|
|
2944
|
-
},
|
|
2945
|
-
h('div', { style: { marginBottom: 16 } },
|
|
2946
|
-
h('p', { style: { color: 'var(--text-secondary)', fontSize: 13, margin: '0 0 16px 0', lineHeight: 1.5 } },
|
|
2947
|
-
props.apiKeyModal.isUpdate
|
|
2948
|
-
? 'Enter a new API key to replace the current one for ' + props.apiKeyModal.providerName + '.'
|
|
2949
|
-
: 'Enter your ' + props.apiKeyModal.providerName + ' API key to enable this provider.'
|
|
2950
|
-
),
|
|
2951
|
-
h('label', { className: 'form-label' }, 'API Key'),
|
|
2952
|
-
h('input', {
|
|
2953
|
-
className: 'input',
|
|
2954
|
-
type: 'password',
|
|
2955
|
-
placeholder: 'sk-...',
|
|
2956
|
-
value: props.apiKeyInput,
|
|
2957
|
-
autoFocus: true,
|
|
2958
|
-
onChange: function(e) { props.setApiKeyInput(e.target.value); },
|
|
2959
|
-
onKeyDown: function(e) {
|
|
2960
|
-
if (e.key === 'Enter' && props.apiKeyInput.trim()) {
|
|
2961
|
-
var m = props.apiKeyModal;
|
|
2962
|
-
apiCall('/providers/' + m.providerId + '/api-key', { method: 'POST', body: JSON.stringify({ apiKey: props.apiKeyInput.trim() }) })
|
|
2963
|
-
.then(function() { toast((m.isUpdate ? 'API key updated' : 'API key saved') + ' for ' + m.providerName + '!', 'success'); props.setApiKeyModal(null); props.setApiKeyInput(''); window.location.reload(); })
|
|
2964
|
-
.catch(function(e) { toast(e.message || 'Failed to save', 'error'); });
|
|
2965
|
-
}
|
|
2966
|
-
},
|
|
2967
|
-
style: { fontSize: 14, fontFamily: 'var(--font-mono, monospace)' },
|
|
2968
|
-
}),
|
|
2969
|
-
h('p', { className: 'form-help', style: { marginTop: 6 } }, 'Your key is stored encrypted and never exposed in the dashboard.')
|
|
2970
|
-
),
|
|
2971
|
-
h('div', { style: { display: 'flex', justifyContent: 'flex-end', gap: 8 } },
|
|
2972
|
-
h('button', { className: 'btn', onClick: function() { props.setApiKeyModal(null); props.setApiKeyInput(''); } }, 'Cancel'),
|
|
2973
|
-
h('button', {
|
|
2974
|
-
className: 'btn btn-primary',
|
|
2975
|
-
disabled: !props.apiKeyInput.trim(),
|
|
2976
|
-
onClick: function() {
|
|
2977
|
-
var m = props.apiKeyModal;
|
|
2978
|
-
apiCall('/providers/' + m.providerId + '/api-key', { method: 'POST', body: JSON.stringify({ apiKey: props.apiKeyInput.trim() }) })
|
|
2979
|
-
.then(function() { toast((m.isUpdate ? 'API key updated' : 'API key saved') + ' for ' + m.providerName + '!', 'success'); props.setApiKeyModal(null); props.setApiKeyInput(''); window.location.reload(); })
|
|
2980
|
-
.catch(function(e) { toast(e.message || 'Failed to save', 'error'); });
|
|
2981
|
-
}
|
|
2982
|
-
}, props.apiKeyModal.isUpdate ? 'Update Key' : 'Save Key')
|
|
2983
|
-
)
|
|
2984
|
-
)
|
|
2985
|
-
);
|
|
2986
|
-
}
|
|
2987
|
-
|
|
2988
|
-
// ═══════════════════════════════════════════════════════════
|
|
2989
|
-
// MODEL PRICING TAB
|
|
2990
|
-
// ═══════════════════════════════════════════════════════════
|
|
2991
|
-
|
|
2992
|
-
function ModelPricingTab(props) {
|
|
2993
|
-
var pricing = props.pricing;
|
|
2994
|
-
var models = pricing.models || [];
|
|
2995
|
-
var providerGroups = {};
|
|
2996
|
-
models.forEach(function(m) {
|
|
2997
|
-
if (!providerGroups[m.provider]) providerGroups[m.provider] = [];
|
|
2998
|
-
providerGroups[m.provider].push(m);
|
|
2999
|
-
});
|
|
3000
|
-
|
|
3001
|
-
var allProviders = props.providers || [];
|
|
3002
|
-
var providerNames = {};
|
|
3003
|
-
allProviders.forEach(function(p) { providerNames[p.id] = p.name; });
|
|
3004
|
-
|
|
3005
|
-
return h(Fragment, null,
|
|
3006
|
-
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 } },
|
|
3007
|
-
h('div', null,
|
|
3008
|
-
h('h3', { style: { fontSize: 15, fontWeight: 700, margin: '0 0 4px 0' } }, 'Model Pricing'),
|
|
3009
|
-
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.')
|
|
3010
|
-
),
|
|
3011
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
3012
|
-
props.dirty && h('button', {
|
|
3013
|
-
className: 'btn btn-primary',
|
|
3014
|
-
disabled: props.saving,
|
|
3015
|
-
onClick: props.onSave,
|
|
3016
|
-
}, props.saving ? 'Saving...' : 'Save Changes'),
|
|
3017
|
-
h('button', { className: 'btn', onClick: function() { props.setShowAddModel(true); } }, '+ Add Model')
|
|
3018
|
-
)
|
|
3019
|
-
),
|
|
3020
|
-
|
|
3021
|
-
// Add Model Modal
|
|
3022
|
-
props.showAddModel && h(Modal, {
|
|
3023
|
-
title: 'Add Model Pricing',
|
|
3024
|
-
onClose: function() { props.setShowAddModel(false); },
|
|
3025
|
-
},
|
|
3026
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
|
|
3027
|
-
h('div', { className: 'form-group' },
|
|
3028
|
-
h('label', { className: 'form-label' }, 'Provider'),
|
|
3029
|
-
h('select', { className: 'input', value: props.newModel.provider, onChange: function(e) { props.setNewModel(Object.assign({}, props.newModel, { provider: e.target.value })); } },
|
|
3030
|
-
allProviders.map(function(p) {
|
|
3031
|
-
return h('option', { key: p.id, value: p.id }, p.name);
|
|
3032
|
-
})
|
|
3033
|
-
)
|
|
3034
|
-
),
|
|
3035
|
-
h('div', { className: 'form-group' },
|
|
3036
|
-
h('label', { className: 'form-label' }, 'Model ID'),
|
|
3037
|
-
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 })); } })
|
|
3038
|
-
),
|
|
3039
|
-
h('div', { className: 'form-group' },
|
|
3040
|
-
h('label', { className: 'form-label' }, 'Display Name'),
|
|
3041
|
-
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 })); } })
|
|
3042
|
-
),
|
|
3043
|
-
h('div', { className: 'form-group' },
|
|
3044
|
-
h('label', { className: 'form-label' }, 'Context Window'),
|
|
3045
|
-
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 })); } })
|
|
3046
|
-
),
|
|
3047
|
-
h('div', { className: 'form-group' },
|
|
3048
|
-
h('label', { className: 'form-label' }, 'Input Cost (per 1M tokens)'),
|
|
3049
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
3050
|
-
h('span', { style: { color: '#6b7280' } }, '$'),
|
|
3051
|
-
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 })); } })
|
|
3052
|
-
)
|
|
3053
|
-
),
|
|
3054
|
-
h('div', { className: 'form-group' },
|
|
3055
|
-
h('label', { className: 'form-label' }, 'Output Cost (per 1M tokens)'),
|
|
3056
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
3057
|
-
h('span', { style: { color: '#6b7280' } }, '$'),
|
|
3058
|
-
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 })); } })
|
|
3059
|
-
)
|
|
3060
|
-
)
|
|
3061
|
-
),
|
|
3062
|
-
h('div', { style: { display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 16 } },
|
|
3063
|
-
h('button', { className: 'btn', onClick: function() { props.setShowAddModel(false); } }, 'Cancel'),
|
|
3064
|
-
h('button', { className: 'btn btn-primary', onClick: props.onAddModel }, 'Add Model')
|
|
3065
|
-
)
|
|
3066
|
-
),
|
|
3067
|
-
|
|
3068
|
-
// Model pricing table grouped by provider
|
|
3069
|
-
Object.keys(providerGroups).length === 0
|
|
3070
|
-
? h('div', { className: 'card', style: { padding: 32, textAlign: 'center' } },
|
|
3071
|
-
h('p', { style: { color: '#6b7280' } }, 'No model pricing configured. Default pricing will be used for cost tracking.'),
|
|
3072
|
-
h('button', { className: 'btn btn-primary', onClick: function() { props.setShowAddModel(true); } }, 'Add First Model')
|
|
3073
|
-
)
|
|
3074
|
-
: Object.keys(providerGroups).sort().map(function(provider) {
|
|
3075
|
-
var providerModels = providerGroups[provider];
|
|
3076
|
-
var providerLabel = providerNames[provider] || provider;
|
|
3077
|
-
return h('div', { key: provider, className: 'card', style: { marginBottom: 16 } },
|
|
3078
|
-
h('div', { className: 'card-header' }, h('h3', null, providerLabel)),
|
|
3079
|
-
h('div', { className: 'card-body', style: { padding: 0 } },
|
|
3080
|
-
h('table', { className: 'table', style: { width: '100%' } },
|
|
3081
|
-
h('thead', null,
|
|
3082
|
-
h('tr', null,
|
|
3083
|
-
h('th', { style: { padding: '8px 12px' } }, 'Model'),
|
|
3084
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'right' } }, 'Input $/1M'),
|
|
3085
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'right' } }, 'Output $/1M'),
|
|
3086
|
-
h('th', { style: { padding: '8px 12px', textAlign: 'right' } }, 'Context'),
|
|
3087
|
-
h('th', { style: { padding: '8px 12px', width: 60 } }, '')
|
|
3088
|
-
)
|
|
3089
|
-
),
|
|
3090
|
-
h('tbody', null,
|
|
3091
|
-
providerModels.map(function(m) {
|
|
3092
|
-
var globalIdx = models.indexOf(m);
|
|
3093
|
-
return h('tr', { key: m.modelId },
|
|
3094
|
-
h('td', { style: { padding: '8px 12px' } },
|
|
3095
|
-
h('div', null, h('strong', null, m.displayName || m.modelId)),
|
|
3096
|
-
h('div', { style: { fontSize: 12, color: '#6b7280' } }, m.modelId)
|
|
3097
|
-
),
|
|
3098
|
-
h('td', { style: { padding: '8px 12px', textAlign: 'right' } },
|
|
3099
|
-
h('input', {
|
|
3100
|
-
className: 'input',
|
|
3101
|
-
type: 'number',
|
|
3102
|
-
step: '0.01',
|
|
3103
|
-
style: { width: 90, textAlign: 'right' },
|
|
3104
|
-
value: m.inputCostPerMillion,
|
|
3105
|
-
onChange: function(e) { props.onUpdateModel(globalIdx, 'inputCostPerMillion', parseFloat(e.target.value) || 0); }
|
|
3106
|
-
})
|
|
3107
|
-
),
|
|
3108
|
-
h('td', { style: { padding: '8px 12px', textAlign: 'right' } },
|
|
3109
|
-
h('input', {
|
|
3110
|
-
className: 'input',
|
|
3111
|
-
type: 'number',
|
|
3112
|
-
step: '0.01',
|
|
3113
|
-
style: { width: 90, textAlign: 'right' },
|
|
3114
|
-
value: m.outputCostPerMillion,
|
|
3115
|
-
onChange: function(e) { props.onUpdateModel(globalIdx, 'outputCostPerMillion', parseFloat(e.target.value) || 0); }
|
|
3116
|
-
})
|
|
3117
|
-
),
|
|
3118
|
-
h('td', { style: { padding: '8px 12px', textAlign: 'right', fontSize: 13, color: '#6b7280' } },
|
|
3119
|
-
m.contextWindow ? (m.contextWindow >= 1000000 ? (m.contextWindow / 1000000) + 'M' : Math.round(m.contextWindow / 1000) + 'K') : '\u2014'
|
|
3120
|
-
),
|
|
3121
|
-
h('td', { style: { padding: '8px 12px', textAlign: 'center' } },
|
|
3122
|
-
h('button', {
|
|
3123
|
-
className: 'btn btn-sm btn-danger',
|
|
3124
|
-
style: { padding: '2px 8px', fontSize: 12 },
|
|
3125
|
-
onClick: function() { props.onRemoveModel(globalIdx); }
|
|
3126
|
-
}, I.trash())
|
|
3127
|
-
)
|
|
3128
|
-
);
|
|
3129
|
-
})
|
|
3130
|
-
)
|
|
3131
|
-
)
|
|
3132
|
-
)
|
|
3133
|
-
);
|
|
3134
|
-
}),
|
|
3135
|
-
|
|
3136
|
-
// Summary footer
|
|
3137
|
-
models.length > 0 && h('div', { style: { fontSize: 13, color: '#6b7280', marginTop: 8 } },
|
|
3138
|
-
models.length + ' model(s) configured across ' + Object.keys(providerGroups).length + ' provider(s)',
|
|
3139
|
-
pricing.updatedAt && h('span', null, ' \u2014 Last updated: ' + new Date(pricing.updatedAt).toLocaleString())
|
|
3140
|
-
)
|
|
3141
|
-
);
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
|
-
// ─── Two-Factor Authentication Card ─────────────────────
|
|
3145
|
-
|
|
3146
|
-
function TwoFactorCard({ toast }) {
|
|
3147
|
-
var [status, setStatus] = useState(null); // null=loading, true=enabled, false=disabled
|
|
3148
|
-
var [setupData, setSetupData] = useState(null); // { secret, otpauthUrl }
|
|
3149
|
-
var [verifyCode, setVerifyCode] = useState('');
|
|
3150
|
-
var [backupCodes, setBackupCodes] = useState(null);
|
|
3151
|
-
var [disablePassword, setDisablePassword] = useState('');
|
|
3152
|
-
var [showDisable, setShowDisable] = useState(false);
|
|
3153
|
-
var [loading, setLoading] = useState(false);
|
|
3154
|
-
var [error, setError] = useState('');
|
|
3155
|
-
|
|
3156
|
-
useEffect(function() {
|
|
3157
|
-
fetch('/auth/2fa/status', { credentials: 'same-origin' }).then(function(r) { return r.ok ? r.json() : null; }).then(function(d) {
|
|
3158
|
-
if (d) setStatus(d.enabled);
|
|
3159
|
-
}).catch(function() { setStatus(false); });
|
|
3160
|
-
}, []);
|
|
3161
|
-
|
|
3162
|
-
var startSetup = async function() {
|
|
3163
|
-
setError(''); setLoading(true);
|
|
3164
|
-
try {
|
|
3165
|
-
var r = await fetch('/auth/2fa/setup', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' } });
|
|
3166
|
-
var d = await r.json();
|
|
3167
|
-
if (!r.ok) throw new Error(d.error || 'Setup failed');
|
|
3168
|
-
setSetupData(d);
|
|
3169
|
-
} catch (err) { setError(err.message); }
|
|
3170
|
-
setLoading(false);
|
|
3171
|
-
};
|
|
3172
|
-
|
|
3173
|
-
var confirmSetup = async function() {
|
|
3174
|
-
setError(''); setLoading(true);
|
|
3175
|
-
try {
|
|
3176
|
-
var r = await fetch('/auth/2fa/confirm', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ code: verifyCode }) });
|
|
3177
|
-
var d = await r.json();
|
|
3178
|
-
if (!r.ok) throw new Error(d.error || 'Verification failed');
|
|
3179
|
-
setBackupCodes(d.backupCodes);
|
|
3180
|
-
setStatus(true);
|
|
3181
|
-
setSetupData(null);
|
|
3182
|
-
toast('Two-factor authentication enabled', 'success');
|
|
3183
|
-
} catch (err) { setError(err.message); }
|
|
3184
|
-
setLoading(false);
|
|
3185
|
-
};
|
|
3186
|
-
|
|
3187
|
-
var disable2fa = async function() {
|
|
3188
|
-
setError(''); setLoading(true);
|
|
3189
|
-
try {
|
|
3190
|
-
var r = await fetch('/auth/2fa/disable', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ password: disablePassword }) });
|
|
3191
|
-
var d = await r.json();
|
|
3192
|
-
if (!r.ok) throw new Error(d.error || 'Failed to disable');
|
|
3193
|
-
setStatus(false);
|
|
3194
|
-
setShowDisable(false);
|
|
3195
|
-
setDisablePassword('');
|
|
3196
|
-
toast('Two-factor authentication disabled', 'success');
|
|
3197
|
-
} catch (err) { setError(err.message); }
|
|
3198
|
-
setLoading(false);
|
|
3199
|
-
};
|
|
3200
|
-
|
|
3201
|
-
return h('div', { className: 'card', style: { marginBottom: 16 } },
|
|
3202
|
-
h('div', { className: 'card-header' }, h('h3', null, I.shield(), ' Two-Factor Authentication (2FA)')),
|
|
3203
|
-
h('div', { className: 'card-body' },
|
|
3204
|
-
|
|
3205
|
-
// Loading state
|
|
3206
|
-
status === null && h('div', { style: { color: 'var(--text-muted)', fontSize: 13 } }, 'Checking 2FA status...'),
|
|
3207
|
-
|
|
3208
|
-
// Enabled state
|
|
3209
|
-
status === true && !backupCodes && h('div', null,
|
|
3210
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 } },
|
|
3211
|
-
h('span', { className: 'badge badge-success' }, 'Enabled'),
|
|
3212
|
-
h('span', { style: { fontSize: 13, color: 'var(--text-secondary)' } }, 'Your account is protected with two-factor authentication.')
|
|
3213
|
-
),
|
|
3214
|
-
!showDisable && h('button', { className: 'btn btn-danger btn-sm', onClick: function() { setShowDisable(true); } }, 'Disable 2FA'),
|
|
3215
|
-
showDisable && h('div', { style: { marginTop: 12, padding: 16, background: 'var(--danger-soft)', borderRadius: 'var(--radius)', border: '1px solid var(--danger)' } },
|
|
3216
|
-
h('div', { style: { fontWeight: 600, marginBottom: 8, color: 'var(--danger)' } }, 'Confirm disable'),
|
|
3217
|
-
h('div', { className: 'form-group' },
|
|
3218
|
-
h('label', { className: 'form-label' }, 'Enter your password to disable 2FA'),
|
|
3219
|
-
h('input', { className: 'input', type: 'password', value: disablePassword, onChange: function(e) { setDisablePassword(e.target.value); }, placeholder: 'Your password' })
|
|
3220
|
-
),
|
|
3221
|
-
error && h('div', { style: { color: 'var(--danger)', fontSize: 12, marginBottom: 8 } }, error),
|
|
3222
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
3223
|
-
h('button', { className: 'btn btn-danger btn-sm', disabled: loading || !disablePassword, onClick: disable2fa }, loading ? 'Disabling...' : 'Disable 2FA'),
|
|
3224
|
-
h('button', { className: 'btn btn-secondary btn-sm', onClick: function() { setShowDisable(false); setError(''); } }, 'Cancel')
|
|
3225
|
-
)
|
|
3226
|
-
)
|
|
3227
|
-
),
|
|
3228
|
-
|
|
3229
|
-
// Backup codes display (shown once after enabling)
|
|
3230
|
-
backupCodes && h('div', null,
|
|
3231
|
-
h('div', { style: { background: 'var(--warning-soft)', border: '1px solid var(--warning)', borderRadius: 'var(--radius)', padding: 16, marginBottom: 16 } },
|
|
3232
|
-
h('div', { style: { fontWeight: 600, marginBottom: 8, color: 'var(--warning)' } }, 'Save Your Backup Codes'),
|
|
3233
|
-
h('div', { style: { fontSize: 12, marginBottom: 12, color: 'var(--text-secondary)' } }, 'These codes can be used if you lose access to your authenticator app. Each code can only be used once. Store them securely.'),
|
|
3234
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 8 } },
|
|
3235
|
-
backupCodes.map(function(code) {
|
|
3236
|
-
return h('code', { key: code, style: { padding: '6px 8px', background: 'var(--bg-tertiary)', borderRadius: 4, textAlign: 'center', fontSize: 13, fontFamily: 'var(--font-mono)', letterSpacing: '0.05em' } }, code);
|
|
3237
|
-
})
|
|
3238
|
-
)
|
|
3239
|
-
),
|
|
3240
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: function() { setBackupCodes(null); } }, 'I have saved my backup codes')
|
|
3241
|
-
),
|
|
3242
|
-
|
|
3243
|
-
// Disabled state — setup flow
|
|
3244
|
-
status === false && !setupData && h('div', null,
|
|
3245
|
-
h('p', { style: { fontSize: 13, color: 'var(--text-secondary)', marginBottom: 12 } }, 'Add an extra layer of security to your account. You will need an authenticator app like Google Authenticator, Authy, or 1Password.'),
|
|
3246
|
-
h('button', { className: 'btn btn-primary btn-sm', disabled: loading, onClick: startSetup }, loading ? 'Setting up...' : 'Enable 2FA'),
|
|
3247
|
-
error && h('div', { style: { color: 'var(--danger)', fontSize: 12, marginTop: 8 } }, error)
|
|
3248
|
-
),
|
|
3249
|
-
|
|
3250
|
-
// Setup flow — show secret + verify
|
|
3251
|
-
setupData && h('div', null,
|
|
3252
|
-
h('div', { style: { marginBottom: 16 } },
|
|
3253
|
-
h('div', { style: { fontWeight: 600, marginBottom: 8 } }, 'Step 1: Scan QR Code'),
|
|
3254
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-secondary)', marginBottom: 12 } }, 'Scan this code with your authenticator app. If you cannot scan, enter the secret key manually.'),
|
|
3255
|
-
// QR code as a simple image from a public API
|
|
3256
|
-
h('div', { style: { display: 'flex', gap: 16, alignItems: 'flex-start' } },
|
|
3257
|
-
h('img', { src: 'https://api.qrserver.com/v1/create-qr-code/?size=160x160&data=' + encodeURIComponent(setupData.otpauthUrl), alt: 'QR Code', style: { width: 160, height: 160, borderRadius: 8, border: '1px solid var(--border)' } }),
|
|
3258
|
-
h('div', null,
|
|
3259
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'Secret Key (manual entry):'),
|
|
3260
|
-
h('code', { style: { display: 'block', padding: '8px 12px', background: 'var(--bg-tertiary)', borderRadius: 6, fontSize: 14, fontFamily: 'var(--font-mono)', letterSpacing: '0.1em', wordBreak: 'break-all', cursor: 'pointer' }, onClick: function() { navigator.clipboard?.writeText(setupData.secret); toast('Secret copied', 'info'); } }, setupData.secret),
|
|
3261
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginTop: 4 } }, 'Click to copy')
|
|
3262
|
-
)
|
|
3263
|
-
)
|
|
3264
|
-
),
|
|
3265
|
-
h('div', null,
|
|
3266
|
-
h('div', { style: { fontWeight: 600, marginBottom: 8 } }, 'Step 2: Verify Code'),
|
|
3267
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-secondary)', marginBottom: 8 } }, 'Enter the 6-digit code from your authenticator app to confirm setup.'),
|
|
3268
|
-
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
3269
|
-
h('input', {
|
|
3270
|
-
className: 'input', type: 'text', inputMode: 'numeric', autoComplete: 'one-time-code',
|
|
3271
|
-
value: verifyCode, onChange: function(e) { setVerifyCode(e.target.value.replace(/[^0-9]/g, '').slice(0, 6)); },
|
|
3272
|
-
placeholder: '000000', maxLength: 6,
|
|
3273
|
-
style: { width: 160, textAlign: 'center', fontSize: 20, letterSpacing: '0.3em', fontFamily: 'var(--font-mono)' }
|
|
3274
|
-
}),
|
|
3275
|
-
h('button', { className: 'btn btn-primary btn-sm', disabled: loading || verifyCode.length !== 6, onClick: confirmSetup }, loading ? 'Verifying...' : 'Verify & Enable'),
|
|
3276
|
-
h('button', { className: 'btn btn-secondary btn-sm', onClick: function() { setSetupData(null); setVerifyCode(''); setError(''); } }, 'Cancel')
|
|
3277
|
-
),
|
|
3278
|
-
error && h('div', { style: { color: 'var(--danger)', fontSize: 12, marginTop: 8 } }, error)
|
|
3279
|
-
)
|
|
3280
|
-
)
|
|
3281
|
-
)
|
|
3282
|
-
);
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
// ─── Platform Capabilities Tab ──────────────────────────
|
|
3286
|
-
|
|
3287
|
-
function PlatformCapabilitiesTab({ toast }) {
|
|
3288
|
-
var [caps, setCaps] = useState(null);
|
|
3289
|
-
var [serverOS, setServerOS] = useState(null);
|
|
3290
|
-
var [loading, setLoading] = useState(true);
|
|
3291
|
-
var [saving, setSaving] = useState(false);
|
|
3292
|
-
|
|
3293
|
-
// Triple confirm state
|
|
3294
|
-
var [confirmTarget, setConfirmTarget] = useState(null); // { key, label }
|
|
3295
|
-
var [confirmStep, setConfirmStep] = useState(0);
|
|
3296
|
-
var [confirmTyped, setConfirmTyped] = useState('');
|
|
3297
|
-
|
|
3298
|
-
useEffect(function() {
|
|
3299
|
-
apiCall('/platform-capabilities').then(function(d) {
|
|
3300
|
-
setCaps(d.capabilities || {});
|
|
3301
|
-
if (d.serverOS) setServerOS(d.serverOS);
|
|
3302
|
-
}).catch(function() { setCaps({}); }).finally(function() { setLoading(false); });
|
|
3303
|
-
}, []);
|
|
3304
|
-
|
|
3305
|
-
var startToggle = function(key, label, currentValue) {
|
|
3306
|
-
if (currentValue) {
|
|
3307
|
-
saveCap(key, false);
|
|
3308
|
-
} else {
|
|
3309
|
-
setConfirmTarget({ key: key, label: label });
|
|
3310
|
-
setConfirmStep(1);
|
|
3311
|
-
setConfirmTyped('');
|
|
3312
|
-
}
|
|
3313
|
-
};
|
|
3314
|
-
|
|
3315
|
-
var advanceConfirm = function() {
|
|
3316
|
-
if (confirmStep < 3) { setConfirmStep(confirmStep + 1); return; }
|
|
3317
|
-
if (confirmStep === 3) {
|
|
3318
|
-
if (confirmTyped.trim().toUpperCase() !== 'ENABLE') { toast('Type ENABLE to confirm', 'error'); return; }
|
|
3319
|
-
saveCap(confirmTarget.key, true);
|
|
3320
|
-
setConfirmStep(0); setConfirmTarget(null); setConfirmTyped('');
|
|
3321
|
-
}
|
|
3322
|
-
};
|
|
3323
|
-
|
|
3324
|
-
var cancelConfirm = function() { setConfirmStep(0); setConfirmTarget(null); setConfirmTyped(''); };
|
|
3325
|
-
|
|
3326
|
-
var saveCap = async function(key, value) {
|
|
3327
|
-
var next = Object.assign({}, caps, { [key]: value });
|
|
3328
|
-
setCaps(next); setSaving(true);
|
|
3329
|
-
try {
|
|
3330
|
-
await apiCall('/platform-capabilities', { method: 'PUT', body: JSON.stringify(next) });
|
|
3331
|
-
toast((value ? 'Enabled! Go to agent > Channels tab to configure.' : 'Disabled successfully'), 'success');
|
|
3332
|
-
} catch (e) { toast(e.message, 'error'); }
|
|
3333
|
-
setSaving(false);
|
|
3334
|
-
};
|
|
3335
|
-
|
|
3336
|
-
if (loading) return h('div', { style: { padding: 40, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading...');
|
|
3337
|
-
|
|
3338
|
-
var CAPS = [
|
|
3339
|
-
{ key: 'localSystemAccess', label: 'Local System Access', desc: 'Full access to host filesystem (read/write/delete) and shell (execute commands, sudo, install packages). Equivalent to terminal access.', icon: E.terminal, danger: 'Agents can read, modify, and delete ANY file on this machine, execute arbitrary shell commands, and install software with sudo. Only enable if you trust the agents completely.', nextSteps: 'Tools are now available to all agents. No further config needed — agents can use shell_exec, file_read, shell_sudo, shell_install, etc.' },
|
|
3340
|
-
{ key: 'telegram', label: 'Telegram', desc: 'Send and receive Telegram messages via Bot API. Webhook preferred, long-polling fallback.', icon: E.telegram, danger: 'Agents will send messages through the configured Telegram bot. Webhook preferred (auto-detected), long-polling fallback.', nextSteps: 'Step 1: Open Telegram, search @BotFather, send /newbot, follow the steps to get a bot token. Step 2: Go to any agent > Channels tab > Telegram card, paste the bot token. Step 3: Add your Telegram user ID to Trusted Chat IDs (get it from @userinfobot).' },
|
|
3341
|
-
{ key: 'whatsapp', label: 'WhatsApp', desc: 'Connect via QR code scan — agents link as a device on a WhatsApp account. No Business API needed.', icon: E.whatsapp, danger: 'Agents will appear as a linked device on the WhatsApp account and can send/receive messages, voice notes, media, and manage groups as that phone number.', nextSteps: 'Go to any agent > Channels tab > WhatsApp card. Click "Connect WhatsApp" to generate a QR code. Open WhatsApp on your phone > Settings > Linked Devices > Link a Device > Scan the QR code.' },
|
|
3342
|
-
];
|
|
3343
|
-
|
|
3344
|
-
return h(Fragment, null,
|
|
3345
|
-
h('div', { style: { marginBottom: 16 } },
|
|
3346
|
-
h('p', { style: { color: 'var(--text-secondary)', fontSize: 13 } }, 'Control platform-level capabilities for agents. These are powerful features that operate outside the normal API sandbox. Each requires triple confirmation to enable.')
|
|
3347
|
-
),
|
|
3348
|
-
|
|
3349
|
-
CAPS.map(function(cap) {
|
|
3350
|
-
var enabled = !!caps[cap.key];
|
|
3351
|
-
var osUnavailable = cap.requiresOS && serverOS && serverOS !== cap.requiresOS;
|
|
3352
|
-
return h('div', { key: cap.key, className: 'card', style: { marginBottom: 12, borderColor: osUnavailable ? 'var(--border)' : enabled ? 'var(--success)' : 'var(--border)', opacity: osUnavailable ? 0.7 : 1 } },
|
|
3353
|
-
h('div', { className: 'card-body' },
|
|
3354
|
-
h('div', { style: { display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 16 } },
|
|
3355
|
-
h('div', { style: { flex: 1 } },
|
|
3356
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 } },
|
|
3357
|
-
cap.icon(),
|
|
3358
|
-
h('span', { style: { fontWeight: 600, fontSize: 14 } }, cap.label),
|
|
3359
|
-
osUnavailable
|
|
3360
|
-
? h('span', { className: 'badge badge-neutral', style: { marginLeft: 8, background: '#dc354520', color: '#dc3545' } }, 'Unavailable')
|
|
3361
|
-
: h('span', { className: 'badge badge-' + (enabled ? 'success' : 'neutral'), style: { marginLeft: 8 } }, enabled ? 'Enabled' : 'Disabled')
|
|
3362
|
-
),
|
|
3363
|
-
osUnavailable
|
|
3364
|
-
? h('div', { style: { marginTop: 6, padding: '10px 12px', background: '#dc354508', borderRadius: 8, fontSize: 12, border: '1px solid #dc354520', color: 'var(--text-secondary)' } },
|
|
3365
|
-
E.warning(14), ' ', cap.unavailableMsg
|
|
3366
|
-
)
|
|
3367
|
-
: h(Fragment, null,
|
|
3368
|
-
h('p', { style: { fontSize: 12, color: 'var(--text-secondary)', marginBottom: 0 } }, cap.desc),
|
|
3369
|
-
enabled && cap.nextSteps && h('div', { style: { marginTop: 10, padding: '10px 12px', background: 'var(--bg-tertiary)', borderRadius: 8, fontSize: 12, border: '1px solid var(--border)' } },
|
|
3370
|
-
h('strong', null, 'Next: '), cap.nextSteps
|
|
3371
|
-
)
|
|
3372
|
-
)
|
|
3373
|
-
),
|
|
3374
|
-
!osUnavailable && h('button', {
|
|
3375
|
-
className: 'btn btn-sm ' + (enabled ? 'btn-danger' : 'btn-primary'),
|
|
3376
|
-
disabled: saving,
|
|
3377
|
-
onClick: function() { startToggle(cap.key, cap.label, enabled); }
|
|
3378
|
-
}, enabled ? 'Disable' : 'Enable')
|
|
3379
|
-
)
|
|
3380
|
-
)
|
|
3381
|
-
);
|
|
3382
|
-
}),
|
|
3383
|
-
|
|
3384
|
-
// Triple confirmation modal
|
|
3385
|
-
confirmStep >= 1 && confirmTarget && h('div', { className: 'modal-overlay', onClick: cancelConfirm },
|
|
3386
|
-
h('div', { className: 'modal', onClick: function(e) { e.stopPropagation(); }, style: { width: 480 } },
|
|
3387
|
-
h('div', { className: 'modal-header' },
|
|
3388
|
-
h('h2', { style: { color: 'var(--danger)' } },
|
|
3389
|
-
confirmStep === 1 ? 'Enable ' + confirmTarget.label + '?' :
|
|
3390
|
-
confirmStep === 2 ? 'Security Warning' :
|
|
3391
|
-
'Final Confirmation'
|
|
3392
|
-
),
|
|
3393
|
-
h('button', { className: 'btn btn-ghost btn-icon', onClick: cancelConfirm }, '\u00D7')
|
|
3394
|
-
),
|
|
3395
|
-
h('div', { className: 'modal-body', style: { padding: 20 } },
|
|
3396
|
-
|
|
3397
|
-
confirmStep === 1 && h(Fragment, null,
|
|
3398
|
-
h('p', { style: { marginBottom: 12 } }, 'You are about to enable ', h('strong', null, confirmTarget.label), ' for all agents in your organization.'),
|
|
3399
|
-
h('p', { style: { fontSize: 13, color: 'var(--text-secondary)', marginBottom: 16 } }, 'This gives agents access to powerful system-level features outside the normal API sandbox.'),
|
|
3400
|
-
h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
|
|
3401
|
-
h('button', { className: 'btn btn-secondary', onClick: cancelConfirm }, 'Cancel'),
|
|
3402
|
-
h('button', { className: 'btn btn-danger', onClick: advanceConfirm }, 'I understand, continue')
|
|
3403
|
-
)
|
|
3404
|
-
),
|
|
3405
|
-
|
|
3406
|
-
confirmStep === 2 && h(Fragment, null,
|
|
3407
|
-
h('div', { style: { background: 'var(--danger-soft)', border: '1px solid var(--danger)', borderRadius: 'var(--radius)', padding: 12, marginBottom: 16 } },
|
|
3408
|
-
h('strong', { style: { color: 'var(--danger)', display: 'block', marginBottom: 4 } }, 'SECURITY WARNING'),
|
|
3409
|
-
h('p', { style: { fontSize: 12, margin: 0 } }, CAPS.find(function(c) { return c.key === confirmTarget.key; })?.danger)
|
|
3410
|
-
),
|
|
3411
|
-
h('ul', { style: { fontSize: 12, color: 'var(--text-secondary)', paddingLeft: 20, marginBottom: 16 } },
|
|
3412
|
-
h('li', null, 'This action is logged in the audit trail'),
|
|
3413
|
-
h('li', null, 'Only organization owners can enable this'),
|
|
3414
|
-
h('li', null, 'Takes effect immediately for ALL agents'),
|
|
3415
|
-
h('li', null, 'Can be disabled at any time')
|
|
3416
|
-
),
|
|
3417
|
-
h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
|
|
3418
|
-
h('button', { className: 'btn btn-secondary', onClick: cancelConfirm }, 'Cancel'),
|
|
3419
|
-
h('button', { className: 'btn btn-danger', onClick: advanceConfirm }, 'I accept the risks')
|
|
3420
|
-
)
|
|
3421
|
-
),
|
|
3422
|
-
|
|
3423
|
-
confirmStep === 3 && h(Fragment, null,
|
|
3424
|
-
h('p', { style: { marginBottom: 12 } }, 'Type ', h('strong', { style: { fontFamily: 'var(--font-mono)', background: 'var(--bg-tertiary)', padding: '2px 6px', borderRadius: 4 } }, 'ENABLE'), ' to confirm:'),
|
|
3425
|
-
h('input', {
|
|
3426
|
-
type: 'text', className: 'form-control', placeholder: 'Type ENABLE...',
|
|
3427
|
-
value: confirmTyped, autoFocus: true,
|
|
3428
|
-
onInput: function(e) { setConfirmTyped(e.target.value); },
|
|
3429
|
-
onKeyDown: function(e) { if (e.key === 'Enter') advanceConfirm(); },
|
|
3430
|
-
style: { marginBottom: 16, textAlign: 'center', fontSize: 18, letterSpacing: '0.1em', fontFamily: 'var(--font-mono)', borderColor: confirmTyped.trim().toUpperCase() === 'ENABLE' ? 'var(--danger)' : 'var(--border)' }
|
|
3431
|
-
}),
|
|
3432
|
-
h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
|
|
3433
|
-
h('button', { className: 'btn btn-secondary', onClick: cancelConfirm }, 'Cancel'),
|
|
3434
|
-
h('button', {
|
|
3435
|
-
className: 'btn btn-danger',
|
|
3436
|
-
disabled: confirmTyped.trim().toUpperCase() !== 'ENABLE',
|
|
3437
|
-
onClick: advanceConfirm
|
|
3438
|
-
}, 'Enable ' + confirmTarget.label)
|
|
3439
|
-
)
|
|
3440
|
-
)
|
|
3441
|
-
)
|
|
3442
|
-
)
|
|
3443
|
-
)
|
|
3444
|
-
);
|
|
3445
|
-
}
|
|
3446
|
-
|
|
3447
|
-
// ── Org-Scoped Integrations Tab ──────────────────────
|
|
3448
|
-
function OrgIntegrationsTab(props) {
|
|
3449
|
-
var orgId = props.orgId;
|
|
3450
|
-
var integrations = props.integrations;
|
|
3451
|
-
var loading = props.loading;
|
|
3452
|
-
var toast = props.toast;
|
|
3453
|
-
var onReload = props.onReload;
|
|
3454
|
-
var _showAdd = useState(false);
|
|
3455
|
-
var showAdd = _showAdd[0]; var setShowAdd = _showAdd[1];
|
|
3456
|
-
var _form = useState({ type: 'google', name: '', config: {} });
|
|
3457
|
-
var form = _form[0]; var setForm = _form[1];
|
|
3458
|
-
var _saving = useState(false);
|
|
3459
|
-
var saving = _saving[0]; var setSaving = _saving[1];
|
|
3460
|
-
|
|
3461
|
-
var addIntegration = function() {
|
|
3462
|
-
if (!form.name.trim()) { toast('Name is required', 'error'); return; }
|
|
3463
|
-
setSaving(true);
|
|
3464
|
-
var payload = { orgId: orgId, type: form.type, name: form.name.trim(), config: form.config || {}, credentials: {} };
|
|
3465
|
-
|
|
3466
|
-
// For SMTP manual type, move smtp fields to credentials
|
|
3467
|
-
if (form.type === 'smtp') {
|
|
3468
|
-
payload.credentials = {
|
|
3469
|
-
smtpHost: form.config.smtpHost || 'smtp.gmail.com',
|
|
3470
|
-
smtpPort: parseInt(form.config.smtpPort) || 587,
|
|
3471
|
-
smtpUser: form.config.smtpUser || '',
|
|
3472
|
-
smtpPass: form.config.smtpPass || '',
|
|
3473
|
-
imapHost: form.config.imapHost || 'imap.gmail.com',
|
|
3474
|
-
imapPort: parseInt(form.config.imapPort) || 993,
|
|
3475
|
-
imapUser: form.config.imapUser || form.config.smtpUser || '',
|
|
3476
|
-
imapPass: form.config.imapPass || form.config.smtpPass || ''
|
|
3477
|
-
};
|
|
3478
|
-
payload.config = { provider: 'smtp' };
|
|
3479
|
-
}
|
|
3480
|
-
|
|
3481
|
-
engineCall('/org-integrations', { method: 'POST', body: JSON.stringify(payload) })
|
|
3482
|
-
.then(function() { toast('Integration added', 'success'); setShowAdd(false); setForm({ type: 'google', name: '', config: {} }); onReload(); })
|
|
3483
|
-
.catch(function(e) { toast(e.message, 'error'); })
|
|
3484
|
-
.finally(function() { setSaving(false); });
|
|
3485
|
-
};
|
|
3486
|
-
|
|
3487
|
-
var testIntegration = function(id) {
|
|
3488
|
-
engineCall('/org-integrations/' + id + '/test', { method: 'POST' })
|
|
3489
|
-
.then(function(d) { toast(d.status === 'ok' ? 'Connection successful' : 'Test failed: ' + (d.error || 'Unknown error'), d.status === 'ok' ? 'success' : 'error'); })
|
|
3490
|
-
.catch(function(e) { toast('Test failed: ' + e.message, 'error'); });
|
|
3491
|
-
};
|
|
3492
|
-
|
|
3493
|
-
var deleteIntegration = function(id) {
|
|
3494
|
-
if (!confirm('Delete this integration? Agents using it will lose access.')) return;
|
|
3495
|
-
engineCall('/org-integrations/' + id, { method: 'DELETE' })
|
|
3496
|
-
.then(function() { toast('Integration deleted', 'success'); onReload(); })
|
|
3497
|
-
.catch(function(e) { toast(e.message, 'error'); });
|
|
3498
|
-
};
|
|
3499
|
-
|
|
3500
|
-
var startOAuth = function(provider) {
|
|
3501
|
-
var authUrl = '/api/engine/org-integrations/oauth/authorize';
|
|
3502
|
-
engineCall('/org-integrations/oauth/authorize', {
|
|
3503
|
-
method: 'POST',
|
|
3504
|
-
body: JSON.stringify({
|
|
3505
|
-
orgId: orgId,
|
|
3506
|
-
provider: provider,
|
|
3507
|
-
name: form.name.trim() || (provider === 'google' ? 'Google Workspace' : 'Microsoft 365'),
|
|
3508
|
-
clientId: form.config.clientId || '',
|
|
3509
|
-
clientSecret: form.config.clientSecret || '',
|
|
3510
|
-
tenantId: form.config.tenantId || 'common',
|
|
3511
|
-
redirectUri: window.location.origin + '/api/engine/org-integrations/oauth/callback',
|
|
3512
|
-
scopes: provider === 'google'
|
|
3513
|
-
? ['https://mail.google.com/', 'https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/drive']
|
|
3514
|
-
: ['https://graph.microsoft.com/Mail.ReadWrite', 'https://graph.microsoft.com/Calendars.ReadWrite', 'offline_access']
|
|
3515
|
-
})
|
|
3516
|
-
}).then(function(d) {
|
|
3517
|
-
if (d.authUrl) {
|
|
3518
|
-
var popup = window.open(d.authUrl, 'oauth', 'width=600,height=700');
|
|
3519
|
-
var handler = function(e) {
|
|
3520
|
-
if (e.data && e.data.type === 'oauth-callback') {
|
|
3521
|
-
window.removeEventListener('message', handler);
|
|
3522
|
-
if (popup) popup.close();
|
|
3523
|
-
toast('OAuth connected successfully', 'success');
|
|
3524
|
-
setShowAdd(false);
|
|
3525
|
-
setForm({ type: 'google', name: '', config: {} });
|
|
3526
|
-
onReload();
|
|
3527
|
-
}
|
|
3528
|
-
};
|
|
3529
|
-
window.addEventListener('message', handler);
|
|
3530
|
-
}
|
|
3531
|
-
}).catch(function(e) { toast('OAuth error: ' + e.message, 'error'); });
|
|
3532
|
-
};
|
|
3533
|
-
|
|
3534
|
-
return h(Fragment, null,
|
|
3535
|
-
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 } },
|
|
3536
|
-
h('div', null,
|
|
3537
|
-
h('div', { style: { fontSize: 14, fontWeight: 700 } }, 'Organization Integrations'),
|
|
3538
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 2 } }, 'Google Workspace, Microsoft 365, and SMTP/IMAP credentials shared across agents in this organization')
|
|
3539
|
-
),
|
|
3540
|
-
h('button', { className: 'btn btn-primary btn-sm', onClick: function() { setShowAdd(true); } }, I.plus(), ' Add Integration')
|
|
3541
|
-
),
|
|
3542
|
-
|
|
3543
|
-
loading && h('div', { style: { padding: 32, textAlign: 'center', color: 'var(--text-muted)' } }, 'Loading...'),
|
|
3544
|
-
|
|
3545
|
-
!loading && integrations.length === 0 && h('div', { style: { padding: 32, textAlign: 'center', background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)' } },
|
|
3546
|
-
h('div', { style: { marginBottom: 8 } }, E.link(32)),
|
|
3547
|
-
h('div', { style: { fontWeight: 600, marginBottom: 4 } }, 'No integrations configured'),
|
|
3548
|
-
h('div', { style: { fontSize: 13, color: 'var(--text-muted)' } }, 'Add Google Workspace, Microsoft 365, or SMTP credentials for this organization.')
|
|
3549
|
-
),
|
|
3550
|
-
|
|
3551
|
-
!loading && integrations.length > 0 && h('div', { style: { display: 'flex', flexDirection: 'column', gap: 12 } },
|
|
3552
|
-
integrations.map(function(integ) {
|
|
3553
|
-
var typeLabel = integ.type === 'google' ? 'Google Workspace' : integ.type === 'microsoft' ? 'Microsoft 365' : integ.type === 'smtp' ? 'SMTP / IMAP' : integ.type;
|
|
3554
|
-
var statusColor = integ.status === 'active' ? 'var(--success)' : integ.status === 'expired' ? 'var(--warning)' : 'var(--text-muted)';
|
|
3555
|
-
return h('div', { key: integ.id, className: 'card', style: { marginBottom: 0 } },
|
|
3556
|
-
h('div', { className: 'card-body', style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between' } },
|
|
3557
|
-
h('div', null,
|
|
3558
|
-
h('div', { style: { fontWeight: 600 } }, integ.name || typeLabel),
|
|
3559
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 2 } },
|
|
3560
|
-
h('span', { className: 'badge', style: { background: statusColor + '22', color: statusColor, marginRight: 8 } }, integ.status || 'unknown'),
|
|
3561
|
-
typeLabel,
|
|
3562
|
-
integ.updatedAt ? ' \u2022 Updated ' + new Date(integ.updatedAt).toLocaleDateString() : ''
|
|
3563
|
-
)
|
|
3564
|
-
),
|
|
3565
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
3566
|
-
h('button', { className: 'btn btn-secondary btn-sm', onClick: function() { testIntegration(integ.id); } }, 'Test'),
|
|
3567
|
-
h('button', { className: 'btn btn-danger btn-sm', onClick: function() { deleteIntegration(integ.id); } }, 'Delete')
|
|
3568
|
-
)
|
|
3569
|
-
)
|
|
3570
|
-
);
|
|
3571
|
-
})
|
|
3572
|
-
),
|
|
3573
|
-
|
|
3574
|
-
// Add Integration Modal
|
|
3575
|
-
showAdd && h(Modal, { title: 'Add Integration', onClose: function() { setShowAdd(false); } },
|
|
3576
|
-
h('div', { className: 'form-group' },
|
|
3577
|
-
h('label', { className: 'form-label' }, 'Integration Type'),
|
|
3578
|
-
h('select', { className: 'input', value: form.type, onChange: function(e) { setForm({ type: e.target.value, name: form.name, config: {} }); } },
|
|
3579
|
-
h('option', { value: 'google' }, 'Google Workspace (OAuth)'),
|
|
3580
|
-
h('option', { value: 'microsoft' }, 'Microsoft 365 (OAuth)'),
|
|
3581
|
-
h('option', { value: 'smtp' }, 'SMTP / IMAP (Manual)')
|
|
3582
|
-
)
|
|
3583
|
-
),
|
|
3584
|
-
h('div', { className: 'form-group' },
|
|
3585
|
-
h('label', { className: 'form-label' }, 'Name'),
|
|
3586
|
-
h('input', { className: 'input', value: form.name, onChange: function(e) { setForm(Object.assign({}, form, { name: e.target.value })); }, placeholder: form.type === 'google' ? 'Google Workspace' : form.type === 'microsoft' ? 'Microsoft 365' : 'Email SMTP' })
|
|
3587
|
-
),
|
|
3588
|
-
|
|
3589
|
-
// OAuth types
|
|
3590
|
-
(form.type === 'google' || form.type === 'microsoft') && h(Fragment, null,
|
|
3591
|
-
h('div', { style: { padding: 12, background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', marginBottom: 16, fontSize: 13 } },
|
|
3592
|
-
form.type === 'google' ?
|
|
3593
|
-
h(Fragment, null, h('strong', null, 'Setup: '), '1. Go to Google Cloud Console \u2192 APIs & Services \u2192 Credentials', h('br'),
|
|
3594
|
-
'2. Create OAuth 2.0 Client ID (Web application)', h('br'),
|
|
3595
|
-
'3. Add redirect URI: ', h('code', { style: { fontSize: 11 } }, window.location.origin + '/api/engine/org-integrations/oauth/callback'))
|
|
3596
|
-
:
|
|
3597
|
-
h(Fragment, null, h('strong', null, 'Setup: '), '1. Go to Azure Portal \u2192 App registrations', h('br'),
|
|
3598
|
-
'2. Create new registration (Web, single tenant or multi-tenant)', h('br'),
|
|
3599
|
-
'3. Add redirect URI: ', h('code', { style: { fontSize: 11 } }, window.location.origin + '/api/engine/org-integrations/oauth/callback'))
|
|
3600
|
-
),
|
|
3601
|
-
h('div', { className: 'form-group' },
|
|
3602
|
-
h('label', { className: 'form-label' }, 'Client ID'),
|
|
3603
|
-
h('input', { className: 'input', value: form.config.clientId || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { clientId: e.target.value }) })); } })
|
|
3604
|
-
),
|
|
3605
|
-
h('div', { className: 'form-group' },
|
|
3606
|
-
h('label', { className: 'form-label' }, 'Client Secret'),
|
|
3607
|
-
h('input', { className: 'input', type: 'password', value: form.config.clientSecret || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { clientSecret: e.target.value }) })); } })
|
|
3608
|
-
),
|
|
3609
|
-
form.type === 'microsoft' && h('div', { className: 'form-group' },
|
|
3610
|
-
h('label', { className: 'form-label' }, 'Tenant ID'),
|
|
3611
|
-
h('input', { className: 'input', value: form.config.tenantId || 'common', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { tenantId: e.target.value }) })); }, placeholder: 'common' })
|
|
3612
|
-
),
|
|
3613
|
-
h('div', { style: { textAlign: 'right' } },
|
|
3614
|
-
h('button', { className: 'btn btn-primary', disabled: !form.config.clientId || !form.config.clientSecret || saving, onClick: function() { startOAuth(form.type); } }, saving ? 'Connecting...' : 'Connect with ' + (form.type === 'google' ? 'Google' : 'Microsoft'))
|
|
3615
|
-
)
|
|
3616
|
-
),
|
|
3617
|
-
|
|
3618
|
-
// SMTP manual type
|
|
3619
|
-
form.type === 'smtp' && h(Fragment, null,
|
|
3620
|
-
h('div', { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
|
|
3621
|
-
h('div', null,
|
|
3622
|
-
h('h4', { style: { fontSize: 13, fontWeight: 600, marginBottom: 8 } }, 'SMTP (Outgoing)'),
|
|
3623
|
-
h('div', { className: 'form-group' },
|
|
3624
|
-
h('label', { className: 'form-label' }, 'Host'),
|
|
3625
|
-
h('input', { className: 'input', value: form.config.smtpHost || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { smtpHost: e.target.value }) })); }, placeholder: 'smtp.gmail.com' })
|
|
3626
|
-
),
|
|
3627
|
-
h('div', { className: 'form-group' },
|
|
3628
|
-
h('label', { className: 'form-label' }, 'Port'),
|
|
3629
|
-
h('input', { className: 'input', type: 'number', value: form.config.smtpPort || 587, onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { smtpPort: e.target.value }) })); } })
|
|
3630
|
-
),
|
|
3631
|
-
h('div', { className: 'form-group' },
|
|
3632
|
-
h('label', { className: 'form-label' }, 'User'),
|
|
3633
|
-
h('input', { className: 'input', value: form.config.smtpUser || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { smtpUser: e.target.value }) })); }, placeholder: 'you@gmail.com' })
|
|
3634
|
-
),
|
|
3635
|
-
h('div', { className: 'form-group' },
|
|
3636
|
-
h('label', { className: 'form-label' }, 'Password'),
|
|
3637
|
-
h('input', { className: 'input', type: 'password', value: form.config.smtpPass || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { smtpPass: e.target.value }) })); } })
|
|
3638
|
-
)
|
|
3639
|
-
),
|
|
3640
|
-
h('div', null,
|
|
3641
|
-
h('h4', { style: { fontSize: 13, fontWeight: 600, marginBottom: 8 } }, 'IMAP (Incoming)'),
|
|
3642
|
-
h('div', { className: 'form-group' },
|
|
3643
|
-
h('label', { className: 'form-label' }, 'Host'),
|
|
3644
|
-
h('input', { className: 'input', value: form.config.imapHost || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { imapHost: e.target.value }) })); }, placeholder: 'imap.gmail.com' })
|
|
3645
|
-
),
|
|
3646
|
-
h('div', { className: 'form-group' },
|
|
3647
|
-
h('label', { className: 'form-label' }, 'Port'),
|
|
3648
|
-
h('input', { className: 'input', type: 'number', value: form.config.imapPort || 993, onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { imapPort: e.target.value }) })); } })
|
|
3649
|
-
),
|
|
3650
|
-
h('div', { className: 'form-group' },
|
|
3651
|
-
h('label', { className: 'form-label' }, 'User (if different)'),
|
|
3652
|
-
h('input', { className: 'input', value: form.config.imapUser || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { imapUser: e.target.value }) })); }, placeholder: 'Same as SMTP user' })
|
|
3653
|
-
),
|
|
3654
|
-
h('div', { className: 'form-group' },
|
|
3655
|
-
h('label', { className: 'form-label' }, 'Password (if different)'),
|
|
3656
|
-
h('input', { className: 'input', type: 'password', value: form.config.imapPass || '', onChange: function(e) { setForm(Object.assign({}, form, { config: Object.assign({}, form.config, { imapPass: e.target.value }) })); } })
|
|
3657
|
-
)
|
|
3658
|
-
)
|
|
3659
|
-
),
|
|
3660
|
-
h('div', { style: { textAlign: 'right', marginTop: 12 } },
|
|
3661
|
-
h('button', { className: 'btn btn-primary', disabled: saving, onClick: addIntegration }, saving ? 'Saving...' : 'Save Integration')
|
|
3662
|
-
)
|
|
3663
|
-
)
|
|
3664
|
-
)
|
|
3665
|
-
);
|
|
3666
|
-
}
|
|
3667
|
-
|
|
3668
|
-
// ── Org-Scoped LLM API Keys Section ──────────────────────
|
|
3669
|
-
function OrgLLMKeysSection(props) {
|
|
3670
|
-
var orgId = props.orgId;
|
|
3671
|
-
var toast = props.toast;
|
|
3672
|
-
var _keys = useState([]);
|
|
3673
|
-
var keys = _keys[0]; var setKeys = _keys[1];
|
|
3674
|
-
var _loading = useState(true);
|
|
3675
|
-
var loading = _loading[0]; var setLoading = _loading[1];
|
|
3676
|
-
var _showAdd = useState(false);
|
|
3677
|
-
var showAdd = _showAdd[0]; var setShowAdd = _showAdd[1];
|
|
3678
|
-
var _form = useState({ provider: 'anthropic', apiKey: '', name: '' });
|
|
3679
|
-
var form = _form[0]; var setForm = _form[1];
|
|
3680
|
-
var _saving = useState(false);
|
|
3681
|
-
var saving = _saving[0]; var setSaving = _saving[1];
|
|
3682
|
-
|
|
3683
|
-
var LLM_PROVIDERS = [
|
|
3684
|
-
{ id: 'anthropic', name: 'Anthropic', desc: 'Claude Opus, Sonnet, Haiku', placeholder: 'sk-ant-api03-...' },
|
|
3685
|
-
{ id: 'openai', name: 'OpenAI', desc: 'GPT-4o, o1, o3', placeholder: 'sk-proj-...' },
|
|
3686
|
-
{ id: 'google', name: 'Google AI', desc: 'Gemini 2.5 Pro, Flash', placeholder: 'AI...' },
|
|
3687
|
-
{ id: 'xai', name: 'xAI', desc: 'Grok-4, Grok-3', placeholder: 'xai-...' },
|
|
3688
|
-
{ id: 'deepseek', name: 'DeepSeek', desc: 'DeepSeek V3, R1', placeholder: 'sk-...' },
|
|
3689
|
-
{ id: 'mistral', name: 'Mistral', desc: 'Mistral Large, Codestral', placeholder: '' },
|
|
3690
|
-
{ id: 'openrouter', name: 'OpenRouter', desc: 'Multi-provider routing', placeholder: 'sk-or-...' },
|
|
3691
|
-
{ id: 'groq', name: 'Groq', desc: 'LLaMA, Mixtral (fast inference)', placeholder: 'gsk_...' }
|
|
3692
|
-
];
|
|
3693
|
-
|
|
3694
|
-
var load = function() {
|
|
3695
|
-
setLoading(true);
|
|
3696
|
-
engineCall('/org-integrations?orgId=' + orgId)
|
|
3697
|
-
.then(function(d) {
|
|
3698
|
-
var llmKeys = (d.integrations || []).filter(function(i) { return (i.provider || '').indexOf('llm_') === 0; });
|
|
3699
|
-
setKeys(llmKeys);
|
|
3700
|
-
})
|
|
3701
|
-
.catch(function() { setKeys([]); })
|
|
3702
|
-
.finally(function() { setLoading(false); });
|
|
3703
|
-
};
|
|
3704
|
-
|
|
3705
|
-
useEffect(load, [orgId]);
|
|
3706
|
-
|
|
3707
|
-
var saveKey = function() {
|
|
3708
|
-
if (!form.apiKey.trim()) { toast('API key is required', 'error'); return; }
|
|
3709
|
-
setSaving(true);
|
|
3710
|
-
var providerMeta = LLM_PROVIDERS.find(function(p) { return p.id === form.provider; }) || {};
|
|
3711
|
-
engineCall('/org-integrations', {
|
|
3712
|
-
method: 'POST',
|
|
3713
|
-
body: JSON.stringify({
|
|
3714
|
-
orgId: orgId,
|
|
3715
|
-
provider: 'llm_' + form.provider,
|
|
3716
|
-
providerType: 'api_key',
|
|
3717
|
-
displayName: form.name.trim() || (providerMeta.name + ' API Key'),
|
|
3718
|
-
config: { llmProvider: form.provider, providerName: providerMeta.name },
|
|
3719
|
-
credentials: { apiKey: form.apiKey.trim() }
|
|
3720
|
-
})
|
|
3721
|
-
})
|
|
3722
|
-
.then(function() { toast(providerMeta.name + ' API key saved', 'success'); setShowAdd(false); setForm({ provider: 'anthropic', apiKey: '', name: '' }); load(); })
|
|
3723
|
-
.catch(function(e) { toast(e.message, 'error'); })
|
|
3724
|
-
.finally(function() { setSaving(false); });
|
|
3725
|
-
};
|
|
3726
|
-
|
|
3727
|
-
var deleteKey = function(id, name) {
|
|
3728
|
-
if (!confirm('Remove ' + name + '? Agents in this org will fall back to system-wide keys.')) return;
|
|
3729
|
-
engineCall('/org-integrations/' + id, { method: 'DELETE' })
|
|
3730
|
-
.then(function() { toast('API key removed', 'success'); load(); })
|
|
3731
|
-
.catch(function(e) { toast(e.message, 'error'); });
|
|
3732
|
-
};
|
|
3733
|
-
|
|
3734
|
-
if (loading) return h('div', { style: { color: 'var(--text-muted)', padding: 16 } }, 'Loading...');
|
|
3735
|
-
|
|
3736
|
-
var configuredProviders = keys.map(function(k) { return (k.provider || '').replace('llm_', ''); });
|
|
3737
|
-
|
|
3738
|
-
return h(Fragment, null,
|
|
3739
|
-
keys.length === 0 && !showAdd && h('div', { style: { textAlign: 'center', padding: 24, color: 'var(--text-muted)' } },
|
|
3740
|
-
h('div', { style: { marginBottom: 8 } }, E.key(28)),
|
|
3741
|
-
h('div', { style: { marginBottom: 8 } }, 'No org-specific LLM API keys configured.'),
|
|
3742
|
-
h('div', { style: { fontSize: 12 } }, 'Agents will use system-wide API keys by default.'),
|
|
3743
|
-
h('button', { className: 'btn btn-primary btn-sm', style: { marginTop: 12 }, onClick: function() { setShowAdd(true); } }, I.plus(), ' Add API Key')
|
|
3744
|
-
),
|
|
3745
|
-
|
|
3746
|
-
keys.length > 0 && h(Fragment, null,
|
|
3747
|
-
h('div', { style: { display: 'flex', flexDirection: 'column', gap: 8, marginBottom: 12 } },
|
|
3748
|
-
keys.map(function(k) {
|
|
3749
|
-
var pid = (k.provider || '').replace('llm_', '');
|
|
3750
|
-
var meta = LLM_PROVIDERS.find(function(p) { return p.id === pid; }) || {};
|
|
3751
|
-
return h('div', { key: k.id, style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 14px', background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', border: '1px solid var(--border)' } },
|
|
3752
|
-
h('div', null,
|
|
3753
|
-
h('div', { style: { fontWeight: 600, fontSize: 14 } }, k.displayName || meta.name || pid),
|
|
3754
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)' } }, meta.desc || '', k.status ? ' \u2022 ' + k.status : '', k.updatedAt ? ' \u2022 Updated ' + new Date(k.updatedAt).toLocaleDateString() : '')
|
|
3755
|
-
),
|
|
3756
|
-
h('div', { style: { display: 'flex', gap: 8 } },
|
|
3757
|
-
h('button', { className: 'btn btn-danger btn-sm', onClick: function() { deleteKey(k.id, k.displayName || meta.name); } }, 'Remove')
|
|
3758
|
-
)
|
|
3759
|
-
);
|
|
3760
|
-
})
|
|
3761
|
-
),
|
|
3762
|
-
h('button', { className: 'btn btn-secondary btn-sm', onClick: function() { setShowAdd(true); } }, I.plus(), ' Add Another Key')
|
|
3763
|
-
),
|
|
3764
|
-
|
|
3765
|
-
showAdd && h('div', { style: { padding: 16, background: 'var(--bg-tertiary)', borderRadius: 'var(--radius)', border: '1px solid var(--border)', marginTop: 12 } },
|
|
3766
|
-
h('div', { style: { fontWeight: 600, marginBottom: 12 } }, 'Add LLM API Key'),
|
|
3767
|
-
h('div', { className: 'form-group' },
|
|
3768
|
-
h('label', { className: 'form-label' }, 'Provider'),
|
|
3769
|
-
h('select', { className: 'input', value: form.provider, onChange: function(e) { setForm(Object.assign({}, form, { provider: e.target.value })); } },
|
|
3770
|
-
LLM_PROVIDERS.filter(function(p) { return configuredProviders.indexOf(p.id) === -1; }).map(function(p) {
|
|
3771
|
-
return h('option', { key: p.id, value: p.id }, p.name + ' — ' + p.desc);
|
|
3772
|
-
})
|
|
3773
|
-
)
|
|
3774
|
-
),
|
|
3775
|
-
h('div', { className: 'form-group' },
|
|
3776
|
-
h('label', { className: 'form-label' }, 'API Key'),
|
|
3777
|
-
h('input', { className: 'input', type: 'password', value: form.apiKey, onChange: function(e) { setForm(Object.assign({}, form, { apiKey: e.target.value })); }, placeholder: (LLM_PROVIDERS.find(function(p) { return p.id === form.provider; }) || {}).placeholder || 'API key' })
|
|
3778
|
-
),
|
|
3779
|
-
h('div', { className: 'form-group' },
|
|
3780
|
-
h('label', { className: 'form-label' }, 'Display Name (optional)'),
|
|
3781
|
-
h('input', { className: 'input', value: form.name, onChange: function(e) { setForm(Object.assign({}, form, { name: e.target.value })); }, placeholder: (LLM_PROVIDERS.find(function(p) { return p.id === form.provider; }) || {}).name + ' API Key' })
|
|
3782
|
-
),
|
|
3783
|
-
h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
|
|
3784
|
-
h('button', { className: 'btn btn-secondary', onClick: function() { setShowAdd(false); } }, 'Cancel'),
|
|
3785
|
-
h('button', { className: 'btn btn-primary', disabled: saving || !form.apiKey.trim(), onClick: saveKey }, saving ? 'Saving...' : 'Save Key')
|
|
3786
|
-
),
|
|
3787
|
-
h('div', { style: { fontSize: 12, color: 'var(--text-muted)', marginTop: 8 } }, 'API keys are encrypted in the vault. Agents in this org will use these keys instead of system-wide defaults.')
|
|
3788
|
-
)
|
|
3789
|
-
);
|
|
3790
|
-
}
|