@agenticmail/enterprise 0.5.327 → 0.5.328
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/dashboard/app.js +1 -1
- package/logs/cloudflared-error.log +6 -0
- package/logs/enterprise-out.log +1 -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/HELP-TOOLTIPS-GUIDE.md +0 -45
- 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/engine/deployer.ts
DELETED
|
@@ -1,957 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deployment Engine
|
|
3
|
-
*
|
|
4
|
-
* Handles provisioning and deploying agents to any target:
|
|
5
|
-
* Docker containers, VPS via SSH, Fly.io, Railway, etc.
|
|
6
|
-
*
|
|
7
|
-
* The admin clicks "Deploy" in the dashboard → this engine does the rest.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { AgentConfig, DeploymentTarget, DeploymentStatus } from './agent-config.js';
|
|
11
|
-
import { AgentConfigGenerator } from './agent-config.js';
|
|
12
|
-
import { execSync } from 'child_process';
|
|
13
|
-
import { resolve } from 'path';
|
|
14
|
-
import { existsSync } from 'fs';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Derive PM2 process name from agent config.
|
|
18
|
-
* Uses config.deployment.config.local?.pm2Name if set,
|
|
19
|
-
* otherwise derives from agent name: "Fola Olatunji" → "fola-agent"
|
|
20
|
-
*/
|
|
21
|
-
function getPm2Name(config: AgentConfig): string {
|
|
22
|
-
const local = (config.deployment?.config as any)?.local;
|
|
23
|
-
if (local?.pm2Name) return local.pm2Name;
|
|
24
|
-
// Derive: first word of name, lowercased, + "-agent"
|
|
25
|
-
const slug = config.name.split(/\s+/)[0].toLowerCase().replace(/[^a-z0-9-]/g, '');
|
|
26
|
-
return `${slug}-agent`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ─── Types ──────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
export interface DeploymentEvent {
|
|
32
|
-
timestamp: string;
|
|
33
|
-
phase: DeploymentPhase;
|
|
34
|
-
status: 'started' | 'completed' | 'failed';
|
|
35
|
-
message: string;
|
|
36
|
-
details?: any;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type DeploymentPhase =
|
|
40
|
-
| 'validate'
|
|
41
|
-
| 'provision'
|
|
42
|
-
| 'configure'
|
|
43
|
-
| 'upload'
|
|
44
|
-
| 'install'
|
|
45
|
-
| 'start'
|
|
46
|
-
| 'healthcheck'
|
|
47
|
-
| 'complete';
|
|
48
|
-
|
|
49
|
-
export interface DeploymentResult {
|
|
50
|
-
success: boolean;
|
|
51
|
-
url?: string; // Agent's accessible URL
|
|
52
|
-
sshCommand?: string; // For VPS: how to SSH in
|
|
53
|
-
containerId?: string; // For Docker
|
|
54
|
-
appId?: string; // For cloud platforms
|
|
55
|
-
events: DeploymentEvent[];
|
|
56
|
-
error?: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface LiveAgentStatus {
|
|
60
|
-
agentId: string;
|
|
61
|
-
name: string;
|
|
62
|
-
status: DeploymentStatus;
|
|
63
|
-
uptime?: number; // Seconds
|
|
64
|
-
lastHealthCheck?: string;
|
|
65
|
-
healthStatus?: 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
|
|
66
|
-
metrics?: {
|
|
67
|
-
cpuPercent: number;
|
|
68
|
-
memoryMb: number;
|
|
69
|
-
toolCallsToday: number;
|
|
70
|
-
activeSessionCount: number;
|
|
71
|
-
errorRate: number; // Last hour
|
|
72
|
-
};
|
|
73
|
-
endpoint?: string;
|
|
74
|
-
version?: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// ─── Deployment Engine ──────────────────────────────────
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Ensure PM2 is installed globally. Auto-installs if missing.
|
|
81
|
-
* Returns { installed: boolean, version?: string, error?: string }
|
|
82
|
-
*/
|
|
83
|
-
export async function ensurePm2(): Promise<{ installed: boolean; version?: string; error?: string }> {
|
|
84
|
-
try {
|
|
85
|
-
const version = execSync('pm2 -v', { stdio: 'pipe', encoding: 'utf-8' }).trim();
|
|
86
|
-
return { installed: true, version };
|
|
87
|
-
} catch {
|
|
88
|
-
// Not installed — try to install
|
|
89
|
-
console.log('[deployer] PM2 not found — auto-installing...');
|
|
90
|
-
try {
|
|
91
|
-
execSync('npm install -g pm2', { stdio: 'pipe', timeout: 120_000 });
|
|
92
|
-
const version = execSync('pm2 -v', { stdio: 'pipe', encoding: 'utf-8' }).trim();
|
|
93
|
-
console.log(`[deployer] PM2 ${version} installed successfully`);
|
|
94
|
-
return { installed: true, version };
|
|
95
|
-
} catch (e: any) {
|
|
96
|
-
console.error(`[deployer] PM2 auto-install failed: ${e.message}`);
|
|
97
|
-
return { installed: false, error: e.message };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Generate a PM2 ecosystem config for an agent.
|
|
104
|
-
* Writes ecosystem.config.cjs if it doesn't exist or is outdated.
|
|
105
|
-
*/
|
|
106
|
-
function generateEcosystemConfig(config: AgentConfig): { script: string; args: string; name: string; cwd: string; envFile?: string } {
|
|
107
|
-
const pm2Name = getPm2Name(config);
|
|
108
|
-
const local = (config.deployment?.config as any)?.local;
|
|
109
|
-
const cwd = local?.workDir || process.cwd();
|
|
110
|
-
const script = resolve(cwd, 'dist/cli.js');
|
|
111
|
-
|
|
112
|
-
// Derive env file: .env.{slug} for agents, .env for enterprise
|
|
113
|
-
const slug = config.name.split(/\s+/)[0].toLowerCase().replace(/[^a-z0-9-]/g, '');
|
|
114
|
-
const envFile = resolve(cwd, `.env.${slug}`);
|
|
115
|
-
const hasEnvFile = existsSync(envFile);
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
script,
|
|
119
|
-
args: 'agent',
|
|
120
|
-
name: pm2Name,
|
|
121
|
-
cwd,
|
|
122
|
-
envFile: hasEnvFile ? envFile : undefined,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export class DeploymentEngine {
|
|
127
|
-
private configGen = new AgentConfigGenerator();
|
|
128
|
-
private deployments = new Map<string, DeploymentResult>();
|
|
129
|
-
private _liveStatus = new Map<string, LiveAgentStatus>();
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Deploy an agent to its configured target
|
|
133
|
-
*/
|
|
134
|
-
async deploy(config: AgentConfig, onEvent?: (event: DeploymentEvent) => void): Promise<DeploymentResult> {
|
|
135
|
-
const events: DeploymentEvent[] = [];
|
|
136
|
-
const emit = (phase: DeploymentPhase, status: DeploymentEvent['status'], message: string, details?: any) => {
|
|
137
|
-
const event: DeploymentEvent = { timestamp: new Date().toISOString(), phase, status, message, details };
|
|
138
|
-
events.push(event);
|
|
139
|
-
onEvent?.(event);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
// 1. Validate
|
|
144
|
-
emit('validate', 'started', 'Validating agent configuration...');
|
|
145
|
-
this.validateConfig(config);
|
|
146
|
-
emit('validate', 'completed', 'Configuration valid');
|
|
147
|
-
|
|
148
|
-
// 2. Route to target-specific deployer
|
|
149
|
-
let result: DeploymentResult;
|
|
150
|
-
switch (config.deployment.target) {
|
|
151
|
-
case 'docker':
|
|
152
|
-
result = await this.deployDocker(config, emit);
|
|
153
|
-
break;
|
|
154
|
-
case 'vps':
|
|
155
|
-
result = await this.deployVPS(config, emit);
|
|
156
|
-
break;
|
|
157
|
-
case 'fly':
|
|
158
|
-
result = await this.deployFly(config, emit);
|
|
159
|
-
break;
|
|
160
|
-
case 'railway':
|
|
161
|
-
result = await this.deployRailway(config, emit);
|
|
162
|
-
break;
|
|
163
|
-
case 'local':
|
|
164
|
-
result = await this.deployLocal(config, emit);
|
|
165
|
-
break;
|
|
166
|
-
default:
|
|
167
|
-
throw new Error(`Unsupported deployment target: ${config.deployment.target}`);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
result.events = events;
|
|
171
|
-
this.deployments.set(config.id, result);
|
|
172
|
-
return result;
|
|
173
|
-
|
|
174
|
-
} catch (error: any) {
|
|
175
|
-
emit('complete', 'failed', `Deployment failed: ${error.message}`);
|
|
176
|
-
const result: DeploymentResult = { success: false, events, error: error.message };
|
|
177
|
-
this.deployments.set(config.id, result);
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Stop a running agent
|
|
184
|
-
*/
|
|
185
|
-
async stop(config: AgentConfig): Promise<{ success: boolean; message: string }> {
|
|
186
|
-
switch (config.deployment.target) {
|
|
187
|
-
case 'docker':
|
|
188
|
-
return this.execCommand(`docker stop agenticmail-${config.name} && docker rm agenticmail-${config.name}`);
|
|
189
|
-
case 'vps':
|
|
190
|
-
return this.execSSH(config, `sudo systemctl stop agenticmail-${config.name}`);
|
|
191
|
-
case 'fly':
|
|
192
|
-
return this.flyMachineAction(config, 'stop');
|
|
193
|
-
case 'local': {
|
|
194
|
-
const pm2ok = await ensurePm2();
|
|
195
|
-
if (!pm2ok.installed) return { success: false, message: `PM2 not available: ${pm2ok.error}` };
|
|
196
|
-
return this.execCommand(`pm2 stop ${getPm2Name(config)}`);
|
|
197
|
-
}
|
|
198
|
-
default:
|
|
199
|
-
return { success: false, message: `Cannot stop: unsupported target ${config.deployment.target}` };
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Restart a running agent
|
|
205
|
-
*/
|
|
206
|
-
async restart(config: AgentConfig): Promise<{ success: boolean; message: string }> {
|
|
207
|
-
switch (config.deployment.target) {
|
|
208
|
-
case 'docker':
|
|
209
|
-
return this.execCommand(`docker restart agenticmail-${config.name}`);
|
|
210
|
-
case 'vps':
|
|
211
|
-
return this.execSSH(config, `sudo systemctl restart agenticmail-${config.name}`);
|
|
212
|
-
case 'fly':
|
|
213
|
-
return this.flyMachineAction(config, 'restart');
|
|
214
|
-
case 'local': {
|
|
215
|
-
const pm2ok = await ensurePm2();
|
|
216
|
-
if (!pm2ok.installed) return { success: false, message: `PM2 not available: ${pm2ok.error}` };
|
|
217
|
-
return this.execCommand(`pm2 restart ${getPm2Name(config)}`);
|
|
218
|
-
}
|
|
219
|
-
default:
|
|
220
|
-
return { success: false, message: `Cannot restart: unsupported target ${config.deployment.target}` };
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Get live status of a deployed agent
|
|
226
|
-
*/
|
|
227
|
-
async getStatus(config: AgentConfig): Promise<LiveAgentStatus> {
|
|
228
|
-
const base: LiveAgentStatus = {
|
|
229
|
-
agentId: config.id,
|
|
230
|
-
name: config.displayName,
|
|
231
|
-
status: 'not-deployed',
|
|
232
|
-
healthStatus: 'unknown',
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
try {
|
|
236
|
-
switch (config.deployment.target) {
|
|
237
|
-
case 'docker':
|
|
238
|
-
return await this.getDockerStatus(config, base);
|
|
239
|
-
case 'vps':
|
|
240
|
-
return await this.getVPSStatus(config, base);
|
|
241
|
-
case 'fly':
|
|
242
|
-
return await this.getCloudStatus(config, base);
|
|
243
|
-
case 'local':
|
|
244
|
-
return await this.getPm2Status(config, base);
|
|
245
|
-
default:
|
|
246
|
-
return base;
|
|
247
|
-
}
|
|
248
|
-
} catch {
|
|
249
|
-
return { ...base, status: 'error', healthStatus: 'unhealthy' };
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Stream logs from a deployed agent
|
|
255
|
-
*/
|
|
256
|
-
async getLogs(config: AgentConfig, lines: number = 100): Promise<string> {
|
|
257
|
-
switch (config.deployment.target) {
|
|
258
|
-
case 'docker':
|
|
259
|
-
return (await this.execCommand(`docker logs --tail ${lines} agenticmail-${config.name}`)).message;
|
|
260
|
-
case 'vps':
|
|
261
|
-
return (await this.execSSH(config, `journalctl -u agenticmail-${config.name} --no-pager -n ${lines}`)).message;
|
|
262
|
-
case 'fly':
|
|
263
|
-
return `Logs available at: https://fly.io/apps/${config.deployment.config.cloud?.appName || 'unknown'}/monitoring`;
|
|
264
|
-
case 'local':
|
|
265
|
-
return (await this.execCommand(`pm2 logs ${getPm2Name(config)} --lines ${lines} --nostream 2>&1`)).message;
|
|
266
|
-
default:
|
|
267
|
-
return 'Log streaming not supported for this target';
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Update a deployed agent's configuration without full redeployment
|
|
273
|
-
*/
|
|
274
|
-
async updateConfig(config: AgentConfig): Promise<{ success: boolean; message: string }> {
|
|
275
|
-
const workspace = this.configGen.generateWorkspace(config);
|
|
276
|
-
const _gatewayConfig = this.configGen.generateGatewayConfig(config);
|
|
277
|
-
|
|
278
|
-
switch (config.deployment.target) {
|
|
279
|
-
case 'docker': {
|
|
280
|
-
// Write config files into the container
|
|
281
|
-
for (const [file, content] of Object.entries(workspace)) {
|
|
282
|
-
const _escaped = content.replace(/'/g, "'\\''");
|
|
283
|
-
await this.execCommand(`docker exec agenticmail-${config.name} sh -c 'echo "${Buffer.from(content).toString('base64')}" | base64 -d > /workspace/${file}'`);
|
|
284
|
-
}
|
|
285
|
-
// Restart gateway inside container
|
|
286
|
-
await this.execCommand(`docker exec agenticmail-${config.name} agenticmail-enterprise restart`);
|
|
287
|
-
return { success: true, message: 'Configuration updated and gateway restarted' };
|
|
288
|
-
}
|
|
289
|
-
case 'vps': {
|
|
290
|
-
const vps = config.deployment.config.vps!;
|
|
291
|
-
for (const [file, content] of Object.entries(workspace)) {
|
|
292
|
-
await this.execSSH(config, `cat > ${vps.installPath}/workspace/${file} << 'EOF'\n${content}\nEOF`);
|
|
293
|
-
}
|
|
294
|
-
await this.execSSH(config, `sudo systemctl restart agenticmail-${config.name}`);
|
|
295
|
-
return { success: true, message: 'Configuration updated and service restarted' };
|
|
296
|
-
}
|
|
297
|
-
default:
|
|
298
|
-
return { success: false, message: 'Hot config update not supported for this target' };
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// ─── Docker Deployment ────────────────────────────────
|
|
303
|
-
|
|
304
|
-
private async deployDocker(config: AgentConfig, emit: Function): Promise<DeploymentResult> {
|
|
305
|
-
const dc = config.deployment.config.docker;
|
|
306
|
-
if (!dc) throw new Error('Docker config missing');
|
|
307
|
-
|
|
308
|
-
// Generate docker-compose
|
|
309
|
-
emit('provision', 'started', 'Generating Docker configuration...');
|
|
310
|
-
const _compose = this.configGen.generateDockerCompose(config);
|
|
311
|
-
emit('provision', 'completed', 'Docker Compose generated');
|
|
312
|
-
|
|
313
|
-
// Generate workspace files
|
|
314
|
-
emit('configure', 'started', 'Generating agent workspace...');
|
|
315
|
-
const workspace = this.configGen.generateWorkspace(config);
|
|
316
|
-
emit('configure', 'completed', `Generated ${Object.keys(workspace).length} workspace files`);
|
|
317
|
-
|
|
318
|
-
// Pull image
|
|
319
|
-
emit('install', 'started', `Pulling image ${dc.image}:${dc.tag}...`);
|
|
320
|
-
await this.execCommand(`docker pull ${dc.image}:${dc.tag}`);
|
|
321
|
-
emit('install', 'completed', 'Image pulled');
|
|
322
|
-
|
|
323
|
-
// Start container
|
|
324
|
-
emit('start', 'started', 'Starting container...');
|
|
325
|
-
|
|
326
|
-
// Build env args
|
|
327
|
-
const envArgs = Object.entries(dc.env).map(([k, v]) => `-e ${k}="${v}"`).join(' ');
|
|
328
|
-
const volumeArgs = dc.volumes.map(v => `-v ${v}`).join(' ');
|
|
329
|
-
const portArgs = dc.ports.map(p => `-p ${p}:${p}`).join(' ');
|
|
330
|
-
|
|
331
|
-
const runCmd = `docker run -d --name agenticmail-${config.name} --restart ${dc.restart} ${portArgs} ${volumeArgs} ${envArgs} ${dc.resources ? `--cpus="${dc.resources.cpuLimit}" --memory="${dc.resources.memoryLimit}"` : ''} ${dc.image}:${dc.tag}`;
|
|
332
|
-
const runResult = await this.execCommand(runCmd);
|
|
333
|
-
|
|
334
|
-
if (!runResult.success) {
|
|
335
|
-
throw new Error(`Container failed to start: ${runResult.message}`);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
const containerId = runResult.message.trim().substring(0, 12);
|
|
339
|
-
emit('start', 'completed', `Container ${containerId} running`);
|
|
340
|
-
|
|
341
|
-
// Write workspace files into container
|
|
342
|
-
emit('upload', 'started', 'Writing workspace files...');
|
|
343
|
-
for (const [file, content] of Object.entries(workspace)) {
|
|
344
|
-
await this.execCommand(`docker exec agenticmail-${config.name} sh -c 'echo "${Buffer.from(content).toString('base64')}" | base64 -d > /workspace/${file}'`);
|
|
345
|
-
}
|
|
346
|
-
emit('upload', 'completed', 'Workspace configured');
|
|
347
|
-
|
|
348
|
-
// Health check
|
|
349
|
-
emit('healthcheck', 'started', 'Checking agent health...');
|
|
350
|
-
let healthy = false;
|
|
351
|
-
for (let i = 0; i < 10; i++) {
|
|
352
|
-
await new Promise(r => setTimeout(r, 3000));
|
|
353
|
-
const check = await this.execCommand(`docker exec agenticmail-${config.name} agenticmail-enterprise status 2>/dev/null || echo "not ready"`);
|
|
354
|
-
if (check.success && !check.message.includes('not ready')) {
|
|
355
|
-
healthy = true;
|
|
356
|
-
break;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
if (healthy) {
|
|
361
|
-
emit('healthcheck', 'completed', 'Agent is healthy');
|
|
362
|
-
emit('complete', 'completed', `Agent "${config.displayName}" deployed successfully`);
|
|
363
|
-
} else {
|
|
364
|
-
emit('healthcheck', 'failed', 'Agent did not become healthy within 30s');
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return {
|
|
368
|
-
success: healthy,
|
|
369
|
-
containerId,
|
|
370
|
-
url: `http://localhost:${dc.ports[0]}`,
|
|
371
|
-
events: [],
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// ─── VPS Deployment ───────────────────────────────────
|
|
376
|
-
|
|
377
|
-
private async deployVPS(config: AgentConfig, emit: Function): Promise<DeploymentResult> {
|
|
378
|
-
const vps = config.deployment.config.vps;
|
|
379
|
-
if (!vps) throw new Error('VPS config missing');
|
|
380
|
-
|
|
381
|
-
// Generate deploy script
|
|
382
|
-
emit('provision', 'started', `Connecting to ${vps.host}...`);
|
|
383
|
-
const script = this.configGen.generateVPSDeployScript(config);
|
|
384
|
-
emit('provision', 'completed', 'Deploy script generated');
|
|
385
|
-
|
|
386
|
-
// Test SSH connection
|
|
387
|
-
emit('configure', 'started', 'Testing SSH connection...');
|
|
388
|
-
const sshTest = await this.execSSH(config, 'echo "ok"');
|
|
389
|
-
if (!sshTest.success) {
|
|
390
|
-
throw new Error(`SSH connection failed: ${sshTest.message}`);
|
|
391
|
-
}
|
|
392
|
-
emit('configure', 'completed', 'SSH connection verified');
|
|
393
|
-
|
|
394
|
-
// Upload and run deploy script
|
|
395
|
-
emit('upload', 'started', 'Uploading deployment script...');
|
|
396
|
-
const scriptB64 = Buffer.from(script).toString('base64');
|
|
397
|
-
await this.execSSH(config, `echo "${scriptB64}" | base64 -d > /tmp/deploy-agenticmail.sh && chmod +x /tmp/deploy-agenticmail.sh`);
|
|
398
|
-
emit('upload', 'completed', 'Script uploaded');
|
|
399
|
-
|
|
400
|
-
emit('install', 'started', 'Running deployment (this may take a few minutes)...');
|
|
401
|
-
const deployResult = await this.execSSH(config, 'bash /tmp/deploy-agenticmail.sh');
|
|
402
|
-
if (!deployResult.success) {
|
|
403
|
-
throw new Error(`Deployment script failed: ${deployResult.message}`);
|
|
404
|
-
}
|
|
405
|
-
emit('install', 'completed', 'Installation complete');
|
|
406
|
-
|
|
407
|
-
// Verify service is running
|
|
408
|
-
emit('healthcheck', 'started', 'Verifying service status...');
|
|
409
|
-
await new Promise(r => setTimeout(r, 5000));
|
|
410
|
-
const statusCheck = await this.execSSH(config, `systemctl is-active agenticmail-${config.name}`);
|
|
411
|
-
const isActive = statusCheck.success && statusCheck.message.trim() === 'active';
|
|
412
|
-
|
|
413
|
-
if (isActive) {
|
|
414
|
-
emit('healthcheck', 'completed', 'Service is active');
|
|
415
|
-
emit('complete', 'completed', `Agent deployed to ${vps.host}`);
|
|
416
|
-
} else {
|
|
417
|
-
emit('healthcheck', 'failed', 'Service not active');
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return {
|
|
421
|
-
success: isActive,
|
|
422
|
-
sshCommand: `ssh ${vps.user}@${vps.host}${vps.port !== 22 ? ` -p ${vps.port}` : ''}`,
|
|
423
|
-
events: [],
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// ─── Fly.io Deployment ────────────────────────────────
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Local deployment — agent runs as a PM2 process on the same machine.
|
|
431
|
-
* Restarts the PM2 process (or starts it if stopped).
|
|
432
|
-
*/
|
|
433
|
-
private async deployLocal(config: AgentConfig, emit: (phase: DeploymentPhase, status: DeploymentEvent['status'], msg: string, details?: any) => void): Promise<DeploymentResult> {
|
|
434
|
-
const pm2Name = getPm2Name(config);
|
|
435
|
-
|
|
436
|
-
// 1. Ensure PM2 is installed
|
|
437
|
-
emit('install', 'started', 'Checking PM2 installation...');
|
|
438
|
-
const pm2Status = await ensurePm2();
|
|
439
|
-
if (!pm2Status.installed) {
|
|
440
|
-
emit('install', 'failed', `PM2 installation failed: ${pm2Status.error}. Try manually: npm install -g pm2`);
|
|
441
|
-
return { success: false, events: [], error: `PM2 not available: ${pm2Status.error}` };
|
|
442
|
-
}
|
|
443
|
-
emit('install', 'completed', `PM2 v${pm2Status.version} ready`);
|
|
444
|
-
|
|
445
|
-
// 2. Check if PM2 process exists
|
|
446
|
-
emit('provision', 'started', `Checking PM2 process "${pm2Name}"...`);
|
|
447
|
-
const list = await this.execCommand(`pm2 jlist 2>/dev/null`);
|
|
448
|
-
let processExists = false;
|
|
449
|
-
if (list.success) {
|
|
450
|
-
try {
|
|
451
|
-
const procs = JSON.parse(list.message);
|
|
452
|
-
processExists = procs.some((p: any) => p.name === pm2Name);
|
|
453
|
-
} catch {}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// 3. Auto-create PM2 process if it doesn't exist
|
|
457
|
-
if (!processExists) {
|
|
458
|
-
emit('provision', 'started', `Creating PM2 process "${pm2Name}"...`);
|
|
459
|
-
const eco = generateEcosystemConfig(config);
|
|
460
|
-
|
|
461
|
-
if (!existsSync(eco.script)) {
|
|
462
|
-
emit('provision', 'failed', `Script not found: ${eco.script}. Run "npm run build" first.`);
|
|
463
|
-
return { success: false, events: [], error: `Script not found: ${eco.script}` };
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// Build pm2 start command with proper flags
|
|
467
|
-
const interpreterArgs = eco.envFile ? `--env-file=${eco.envFile}` : '';
|
|
468
|
-
const startCmd = [
|
|
469
|
-
'pm2', 'start', eco.script,
|
|
470
|
-
'--name', pm2Name,
|
|
471
|
-
'--cwd', eco.cwd,
|
|
472
|
-
'--', eco.args,
|
|
473
|
-
];
|
|
474
|
-
if (interpreterArgs) {
|
|
475
|
-
// Insert interpreter args before the script
|
|
476
|
-
startCmd.splice(2, 0, '--interpreter-args', `"${interpreterArgs}"`);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
const createResult = await this.execCommand(startCmd.join(' '));
|
|
480
|
-
if (!createResult.success) {
|
|
481
|
-
emit('provision', 'failed', `Failed to create PM2 process: ${createResult.message}`);
|
|
482
|
-
return { success: false, events: [], error: createResult.message };
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// Save PM2 process list so it survives system restarts
|
|
486
|
-
await this.execCommand('pm2 save');
|
|
487
|
-
emit('provision', 'completed', `PM2 process "${pm2Name}" created and saved`);
|
|
488
|
-
} else {
|
|
489
|
-
emit('provision', 'completed', `PM2 process "${pm2Name}" found`);
|
|
490
|
-
|
|
491
|
-
// Restart existing process
|
|
492
|
-
emit('start', 'started', `Restarting ${pm2Name}...`);
|
|
493
|
-
const result = await this.execCommand(`pm2 restart ${pm2Name}`);
|
|
494
|
-
if (!result.success) {
|
|
495
|
-
emit('start', 'failed', `PM2 restart failed: ${result.message}`);
|
|
496
|
-
return { success: false, events: [], error: result.message };
|
|
497
|
-
}
|
|
498
|
-
emit('start', 'completed', `${pm2Name} restarted`);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// 4. Health check: wait for process to be "online"
|
|
502
|
-
emit('healthcheck', 'started', 'Checking process health...');
|
|
503
|
-
await new Promise(r => setTimeout(r, 3000));
|
|
504
|
-
const status = await this.execCommand(`pm2 jlist 2>/dev/null`);
|
|
505
|
-
let healthy = false;
|
|
506
|
-
if (status.success) {
|
|
507
|
-
try {
|
|
508
|
-
const procs = JSON.parse(status.message);
|
|
509
|
-
const proc = procs.find((p: any) => p.name === pm2Name);
|
|
510
|
-
healthy = proc?.pm2_env?.status === 'online';
|
|
511
|
-
} catch {}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
if (healthy) {
|
|
515
|
-
emit('healthcheck', 'completed', 'Process is online');
|
|
516
|
-
emit('complete', 'completed', `${pm2Name} deployed successfully`);
|
|
517
|
-
} else {
|
|
518
|
-
emit('healthcheck', 'failed', 'Process not online after restart');
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
return { success: healthy, events: [] };
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Deploy agent to Fly.io using the Machines API (HTTP).
|
|
526
|
-
* No flyctl CLI needed — works from inside containers.
|
|
527
|
-
*
|
|
528
|
-
* Flow:
|
|
529
|
-
* 1. Create app (if it doesn't exist)
|
|
530
|
-
* 2. Create a Machine with the @agenticmail/enterprise Docker image
|
|
531
|
-
* 3. Set secrets (API keys, DB URL, etc.)
|
|
532
|
-
* 4. Wait for machine to start
|
|
533
|
-
*/
|
|
534
|
-
private async deployFly(config: AgentConfig, emit: Function): Promise<DeploymentResult> {
|
|
535
|
-
const cloud = config.deployment.config.cloud;
|
|
536
|
-
if (!cloud) throw new Error('Fly.io config missing');
|
|
537
|
-
|
|
538
|
-
const apiToken = cloud.apiToken;
|
|
539
|
-
if (!apiToken) throw new Error('Fly.io API token is required');
|
|
540
|
-
|
|
541
|
-
// Reuse previously stored app/machine IDs for redeploy
|
|
542
|
-
const appName = cloud.appName || (config.deployment.config as any).flyAppName || `am-agent-${config.name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30)}`;
|
|
543
|
-
const region = cloud.region || 'iad';
|
|
544
|
-
const size = cloud.size || 'shared-cpu-1x';
|
|
545
|
-
const FLY_API = 'https://api.machines.dev/v1';
|
|
546
|
-
|
|
547
|
-
// Fly.io tokens: FlyV1 tokens use their own prefix, others use Bearer
|
|
548
|
-
const authHeader = apiToken.startsWith('FlyV1 ') || apiToken.startsWith('fm2_') ? apiToken.startsWith('FlyV1 ') ? apiToken : `FlyV1 ${apiToken}` : `Bearer ${apiToken}`;
|
|
549
|
-
|
|
550
|
-
const flyFetch = async (path: string, method: string = 'GET', body?: any): Promise<any> => {
|
|
551
|
-
const res = await fetch(`${FLY_API}${path}`, {
|
|
552
|
-
method,
|
|
553
|
-
headers: {
|
|
554
|
-
'Authorization': authHeader,
|
|
555
|
-
'Content-Type': 'application/json',
|
|
556
|
-
},
|
|
557
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
558
|
-
});
|
|
559
|
-
const text = await res.text();
|
|
560
|
-
let data;
|
|
561
|
-
try { data = JSON.parse(text); } catch { data = { raw: text }; }
|
|
562
|
-
if (!res.ok) throw new Error(`Fly API ${method} ${path}: ${res.status} — ${data.error || text}`);
|
|
563
|
-
return data;
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
// 1. Create app (ignore "already exists" errors)
|
|
567
|
-
emit('provision', 'started', `Creating Fly.io app "${appName}"...`);
|
|
568
|
-
try {
|
|
569
|
-
// Fly.io org_slug must be a Fly org slug (e.g. 'personal', 'ope-olatunji'), not an internal org ID
|
|
570
|
-
// If no valid org slug provided, auto-detect from token by listing apps
|
|
571
|
-
let flyOrg = (cloud.org && cloud.org.length < 40 && /^[a-z0-9-]+$/.test(cloud.org)) ? cloud.org : '';
|
|
572
|
-
if (!flyOrg) {
|
|
573
|
-
try {
|
|
574
|
-
const orgsRes = await flyFetch('/apps?org_slug=personal');
|
|
575
|
-
if (orgsRes?.apps?.length > 0 && orgsRes.apps[0].organization?.slug) {
|
|
576
|
-
flyOrg = orgsRes.apps[0].organization.slug;
|
|
577
|
-
}
|
|
578
|
-
} catch {}
|
|
579
|
-
if (!flyOrg) flyOrg = 'personal';
|
|
580
|
-
}
|
|
581
|
-
await flyFetch('/apps', 'POST', {
|
|
582
|
-
app_name: appName,
|
|
583
|
-
org_slug: flyOrg,
|
|
584
|
-
});
|
|
585
|
-
emit('provision', 'completed', `App "${appName}" created`);
|
|
586
|
-
} catch (e: any) {
|
|
587
|
-
if (e.message.includes('already exists') || e.message.includes('already been taken')) {
|
|
588
|
-
emit('provision', 'completed', `App "${appName}" already exists, reusing`);
|
|
589
|
-
} else {
|
|
590
|
-
throw e;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// 2. Build environment variables — agent reads config from shared DB
|
|
595
|
-
emit('configure', 'started', 'Preparing agent configuration...');
|
|
596
|
-
const env: Record<string, string> = {
|
|
597
|
-
NODE_ENV: 'production',
|
|
598
|
-
AGENTICMAIL_AGENT_ID: config.id,
|
|
599
|
-
AGENTICMAIL_AGENT_NAME: config.displayName || config.name,
|
|
600
|
-
AGENTICMAIL_MODEL: `${config.model?.provider || 'anthropic'}/${config.model?.modelId || 'claude-sonnet-4-20250514'}`,
|
|
601
|
-
PORT: '3000',
|
|
602
|
-
};
|
|
603
|
-
if (config.model?.thinkingLevel) env.AGENTICMAIL_THINKING = config.model.thinkingLevel;
|
|
604
|
-
// Pass shared DB credentials so agent connects to the same enterprise DB
|
|
605
|
-
if (process.env.DATABASE_URL) env.DATABASE_URL = process.env.DATABASE_URL;
|
|
606
|
-
if (process.env.JWT_SECRET) env.JWT_SECRET = process.env.JWT_SECRET;
|
|
607
|
-
emit('configure', 'completed', 'Configuration ready');
|
|
608
|
-
|
|
609
|
-
// 3. Check for existing machines — update if found, create if not
|
|
610
|
-
emit('install', 'started', 'Deploying machine...');
|
|
611
|
-
const existingMachines = await flyFetch(`/apps/${appName}/machines`);
|
|
612
|
-
const machineConfig = {
|
|
613
|
-
image: 'node:22-slim',
|
|
614
|
-
env,
|
|
615
|
-
services: [{
|
|
616
|
-
ports: [
|
|
617
|
-
{ port: 443, handlers: ['tls', 'http'] },
|
|
618
|
-
{ port: 80, handlers: ['http'], force_https: true },
|
|
619
|
-
],
|
|
620
|
-
protocol: 'tcp',
|
|
621
|
-
internal_port: 3000,
|
|
622
|
-
}],
|
|
623
|
-
guest: {
|
|
624
|
-
cpu_kind: size.includes('performance') ? 'performance' : 'shared',
|
|
625
|
-
cpus: size.includes('2x') ? 2 : 1,
|
|
626
|
-
memory_mb: size.includes('2x') ? 1024 : 512,
|
|
627
|
-
},
|
|
628
|
-
init: {
|
|
629
|
-
cmd: ['sh', '-c', 'rm -rf /root/.npm && mkdir -p /tmp/agent && cd /tmp/agent && npm init -y > /dev/null 2>&1 && npm install --no-save @agenticmail/enterprise openai pg && npx @agenticmail/enterprise agent'],
|
|
630
|
-
},
|
|
631
|
-
auto_destroy: false,
|
|
632
|
-
restart: { policy: 'always' },
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
let machineId: string;
|
|
636
|
-
// Filter to only non-destroyed machines
|
|
637
|
-
const liveMachines = (existingMachines || []).filter((m: any) => m.state !== 'destroyed');
|
|
638
|
-
if (liveMachines.length > 0) {
|
|
639
|
-
// Reuse existing machine — stop it first if running, then update
|
|
640
|
-
const existing = liveMachines[0];
|
|
641
|
-
machineId = existing.id;
|
|
642
|
-
emit('install', 'started', `Reusing existing machine ${machineId} (state: ${existing.state})...`);
|
|
643
|
-
if (existing.state === 'started' || existing.state === 'running') {
|
|
644
|
-
try {
|
|
645
|
-
await flyFetch(`/apps/${appName}/machines/${machineId}/stop`, 'POST');
|
|
646
|
-
await flyFetch(`/apps/${appName}/machines/${machineId}/wait?state=stopped&timeout=30`);
|
|
647
|
-
} catch { /* may already be stopped */ }
|
|
648
|
-
}
|
|
649
|
-
await flyFetch(`/apps/${appName}/machines/${machineId}`, 'POST', {
|
|
650
|
-
config: machineConfig,
|
|
651
|
-
region,
|
|
652
|
-
});
|
|
653
|
-
emit('install', 'completed', `Machine ${machineId} updated and restarting`);
|
|
654
|
-
} else {
|
|
655
|
-
// Create new machine
|
|
656
|
-
const machine = await flyFetch(`/apps/${appName}/machines`, 'POST', {
|
|
657
|
-
name: `agent-${config.name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 20)}`,
|
|
658
|
-
region,
|
|
659
|
-
config: machineConfig,
|
|
660
|
-
});
|
|
661
|
-
machineId = machine.id;
|
|
662
|
-
emit('install', 'completed', `Machine ${machineId} created in ${region}`);
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
// 4. Wait for machine to start
|
|
666
|
-
emit('start', 'started', 'Waiting for machine to start...');
|
|
667
|
-
try {
|
|
668
|
-
await flyFetch(`/apps/${appName}/machines/${machineId}/wait?state=started&timeout=60`);
|
|
669
|
-
emit('start', 'completed', 'Machine is running');
|
|
670
|
-
} catch {
|
|
671
|
-
emit('start', 'completed', 'Machine starting (health check pending)');
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
// Store deployment metadata — persists app/machine IDs for redeployment
|
|
675
|
-
config.deployment.config.cloud = {
|
|
676
|
-
...cloud,
|
|
677
|
-
provider: 'fly',
|
|
678
|
-
appName,
|
|
679
|
-
region,
|
|
680
|
-
size,
|
|
681
|
-
};
|
|
682
|
-
(config.deployment.config as any).flyAppName = appName;
|
|
683
|
-
(config.deployment.config as any).flyMachineId = machineId;
|
|
684
|
-
(config.deployment.config as any).deployedAt = new Date().toISOString();
|
|
685
|
-
|
|
686
|
-
const url = cloud.customDomain || `https://${appName}.fly.dev`;
|
|
687
|
-
emit('complete', 'completed', `Agent live at ${url}`);
|
|
688
|
-
|
|
689
|
-
return {
|
|
690
|
-
success: true,
|
|
691
|
-
url,
|
|
692
|
-
appId: appName,
|
|
693
|
-
events: [],
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
// ─── Railway Deployment ───────────────────────────────
|
|
698
|
-
|
|
699
|
-
private async deployRailway(config: AgentConfig, emit: Function): Promise<DeploymentResult> {
|
|
700
|
-
const cloud = config.deployment.config.cloud;
|
|
701
|
-
if (!cloud || cloud.provider !== 'railway') throw new Error('Railway config missing');
|
|
702
|
-
|
|
703
|
-
emit('provision', 'started', 'Creating Railway project...');
|
|
704
|
-
// Railway CLI deployment
|
|
705
|
-
const appName = cloud.appName || `agenticmail-${config.name}`;
|
|
706
|
-
const result = await this.execCommand(`railway init --name ${appName}`, { RAILWAY_TOKEN: cloud.apiToken });
|
|
707
|
-
emit('provision', result.success ? 'completed' : 'failed', result.message);
|
|
708
|
-
|
|
709
|
-
return {
|
|
710
|
-
success: result.success,
|
|
711
|
-
url: `https://${appName}.up.railway.app`,
|
|
712
|
-
appId: appName,
|
|
713
|
-
events: [],
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
// ─── Status Checkers ──────────────────────────────────
|
|
718
|
-
|
|
719
|
-
private async getDockerStatus(config: AgentConfig, base: LiveAgentStatus): Promise<LiveAgentStatus> {
|
|
720
|
-
const inspect = await this.execCommand(`docker inspect agenticmail-${config.name} --format '{{.State.Status}} {{.State.StartedAt}}'`);
|
|
721
|
-
if (!inspect.success) return { ...base, status: 'not-deployed' };
|
|
722
|
-
|
|
723
|
-
const [status, startedAt] = inspect.message.trim().split(' ');
|
|
724
|
-
const running = status === 'running';
|
|
725
|
-
const uptime = running ? Math.floor((Date.now() - new Date(startedAt).getTime()) / 1000) : 0;
|
|
726
|
-
|
|
727
|
-
// Get resource usage
|
|
728
|
-
let metrics: LiveAgentStatus['metrics'] = undefined;
|
|
729
|
-
if (running) {
|
|
730
|
-
const stats = await this.execCommand(`docker stats agenticmail-${config.name} --no-stream --format '{{.CPUPerc}} {{.MemUsage}}'`);
|
|
731
|
-
if (stats.success) {
|
|
732
|
-
const parts = stats.message.trim().split(' ');
|
|
733
|
-
metrics = {
|
|
734
|
-
cpuPercent: parseFloat(parts[0]) || 0,
|
|
735
|
-
memoryMb: parseFloat(parts[1]) || 0,
|
|
736
|
-
toolCallsToday: 0,
|
|
737
|
-
activeSessionCount: 0,
|
|
738
|
-
errorRate: 0,
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
return {
|
|
744
|
-
...base,
|
|
745
|
-
status: running ? 'running' : 'stopped',
|
|
746
|
-
uptime,
|
|
747
|
-
healthStatus: running ? 'healthy' : 'unhealthy',
|
|
748
|
-
lastHealthCheck: new Date().toISOString(),
|
|
749
|
-
metrics,
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
private async getVPSStatus(config: AgentConfig, base: LiveAgentStatus): Promise<LiveAgentStatus> {
|
|
754
|
-
const result = await this.execSSH(config, `systemctl is-active agenticmail-${config.name}`);
|
|
755
|
-
const active = result.success && result.message.trim() === 'active';
|
|
756
|
-
|
|
757
|
-
let uptime = 0;
|
|
758
|
-
if (active) {
|
|
759
|
-
const uptimeResult = await this.execSSH(config, `systemctl show agenticmail-${config.name} --property=ActiveEnterTimestamp --value`);
|
|
760
|
-
if (uptimeResult.success) {
|
|
761
|
-
uptime = Math.floor((Date.now() - new Date(uptimeResult.message.trim()).getTime()) / 1000);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
return {
|
|
766
|
-
...base,
|
|
767
|
-
status: active ? 'running' : 'stopped',
|
|
768
|
-
uptime,
|
|
769
|
-
healthStatus: active ? 'healthy' : 'unhealthy',
|
|
770
|
-
lastHealthCheck: new Date().toISOString(),
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
private async getCloudStatus(config: AgentConfig, base: LiveAgentStatus): Promise<LiveAgentStatus> {
|
|
775
|
-
const cloud = config.deployment.config.cloud;
|
|
776
|
-
if (!cloud || !cloud.apiToken) return base;
|
|
777
|
-
|
|
778
|
-
const appName = cloud.appName || `am-agent-${config.name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30)}`;
|
|
779
|
-
const FLY_API = 'https://api.machines.dev/v1';
|
|
780
|
-
const t = cloud.apiToken;
|
|
781
|
-
const auth = t.startsWith('FlyV1 ') ? t : t.startsWith('fm2_') ? `FlyV1 ${t}` : `Bearer ${t}`;
|
|
782
|
-
|
|
783
|
-
try {
|
|
784
|
-
const res = await fetch(`${FLY_API}/apps/${appName}/machines`, {
|
|
785
|
-
headers: { 'Authorization': auth },
|
|
786
|
-
});
|
|
787
|
-
if (!res.ok) return { ...base, status: 'error', healthStatus: 'unhealthy' };
|
|
788
|
-
|
|
789
|
-
const machines = await res.json() as any[];
|
|
790
|
-
if (machines.length === 0) return { ...base, status: 'stopped' };
|
|
791
|
-
|
|
792
|
-
const machine = machines[0];
|
|
793
|
-
const state = machine.state;
|
|
794
|
-
const isRunning = state === 'started' || state === 'replacing';
|
|
795
|
-
|
|
796
|
-
return {
|
|
797
|
-
...base,
|
|
798
|
-
status: isRunning ? 'running' : state === 'stopped' ? 'stopped' : 'error',
|
|
799
|
-
healthStatus: isRunning ? 'healthy' : 'unhealthy',
|
|
800
|
-
endpoint: `https://${appName}.fly.dev`,
|
|
801
|
-
version: machine.image_ref?.tag,
|
|
802
|
-
uptime: machine.created_at ? Math.floor((Date.now() - new Date(machine.created_at).getTime()) / 1000) : undefined,
|
|
803
|
-
};
|
|
804
|
-
} catch {
|
|
805
|
-
return { ...base, status: 'error', healthStatus: 'unhealthy' };
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
private async getPm2Status(config: AgentConfig, base: LiveAgentStatus): Promise<LiveAgentStatus> {
|
|
810
|
-
const pm2Name = getPm2Name(config);
|
|
811
|
-
const result = await this.execCommand(`pm2 jlist 2>/dev/null`);
|
|
812
|
-
if (!result.success) return { ...base, status: 'error', healthStatus: 'unhealthy' };
|
|
813
|
-
|
|
814
|
-
try {
|
|
815
|
-
const procs = JSON.parse(result.message);
|
|
816
|
-
const proc = procs.find((p: any) => p.name === pm2Name);
|
|
817
|
-
if (!proc) return { ...base, status: 'not-deployed', healthStatus: 'unknown' };
|
|
818
|
-
|
|
819
|
-
const status = proc.pm2_env?.status;
|
|
820
|
-
const isOnline = status === 'online';
|
|
821
|
-
const uptime = isOnline && proc.pm2_env?.pm_uptime
|
|
822
|
-
? Math.floor((Date.now() - proc.pm2_env.pm_uptime) / 1000)
|
|
823
|
-
: 0;
|
|
824
|
-
|
|
825
|
-
return {
|
|
826
|
-
...base,
|
|
827
|
-
status: isOnline ? 'running' : status === 'stopped' ? 'stopped' : 'error',
|
|
828
|
-
healthStatus: isOnline ? 'healthy' : 'unhealthy',
|
|
829
|
-
uptime,
|
|
830
|
-
lastHealthCheck: new Date().toISOString(),
|
|
831
|
-
metrics: {
|
|
832
|
-
cpuPercent: proc.monit?.cpu || 0,
|
|
833
|
-
memoryMb: Math.round((proc.monit?.memory || 0) / 1024 / 1024),
|
|
834
|
-
toolCallsToday: 0,
|
|
835
|
-
activeSessionCount: 0,
|
|
836
|
-
errorRate: 0,
|
|
837
|
-
},
|
|
838
|
-
version: proc.pm2_env?.version || undefined,
|
|
839
|
-
};
|
|
840
|
-
} catch {
|
|
841
|
-
return { ...base, status: 'error', healthStatus: 'unhealthy' };
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
// ─── Helpers ──────────────────────────────────────────
|
|
846
|
-
|
|
847
|
-
/** Stop or restart a Fly.io machine via the Machines API */
|
|
848
|
-
private async flyMachineAction(config: AgentConfig, action: 'stop' | 'restart'): Promise<{ success: boolean; message: string }> {
|
|
849
|
-
const cloud = config.deployment.config.cloud;
|
|
850
|
-
if (!cloud || !cloud.apiToken) return { success: false, message: 'Fly.io config missing' };
|
|
851
|
-
|
|
852
|
-
const appName = cloud.appName || `am-agent-${config.name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30)}`;
|
|
853
|
-
const FLY_API = 'https://api.machines.dev/v1';
|
|
854
|
-
const t = cloud.apiToken;
|
|
855
|
-
const auth = t.startsWith('FlyV1 ') ? t : t.startsWith('fm2_') ? `FlyV1 ${t}` : `Bearer ${t}`;
|
|
856
|
-
|
|
857
|
-
try {
|
|
858
|
-
const res = await fetch(`${FLY_API}/apps/${appName}/machines`, {
|
|
859
|
-
headers: { 'Authorization': auth },
|
|
860
|
-
});
|
|
861
|
-
if (!res.ok) return { success: false, message: `Failed to list machines: ${res.status}` };
|
|
862
|
-
const machines = await res.json() as any[];
|
|
863
|
-
if (machines.length === 0) return { success: false, message: 'No machines found' };
|
|
864
|
-
|
|
865
|
-
const machineId = machines[0].id;
|
|
866
|
-
const actionRes = await fetch(`${FLY_API}/apps/${appName}/machines/${machineId}/${action}`, {
|
|
867
|
-
method: 'POST',
|
|
868
|
-
headers: { 'Authorization': auth },
|
|
869
|
-
});
|
|
870
|
-
if (!actionRes.ok) {
|
|
871
|
-
const err = await actionRes.text();
|
|
872
|
-
return { success: false, message: `${action} failed: ${err}` };
|
|
873
|
-
}
|
|
874
|
-
return { success: true, message: `Machine ${machineId} ${action}ed` };
|
|
875
|
-
} catch (e: any) {
|
|
876
|
-
return { success: false, message: e.message };
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
private validateConfig(config: AgentConfig) {
|
|
881
|
-
if (!config.name) throw new Error('Agent name is required');
|
|
882
|
-
if (!config.identity.role) throw new Error('Agent role is required');
|
|
883
|
-
if (!config.model.modelId) throw new Error('Model ID is required');
|
|
884
|
-
if (!config.deployment.target) throw new Error('Deployment target is required');
|
|
885
|
-
|
|
886
|
-
switch (config.deployment.target) {
|
|
887
|
-
case 'docker':
|
|
888
|
-
if (!config.deployment.config.docker) throw new Error('Docker configuration missing');
|
|
889
|
-
break;
|
|
890
|
-
case 'vps':
|
|
891
|
-
if (!config.deployment.config.vps?.host) throw new Error('VPS host is required');
|
|
892
|
-
break;
|
|
893
|
-
case 'fly':
|
|
894
|
-
case 'railway':
|
|
895
|
-
if (!config.deployment.config.cloud?.apiToken) throw new Error('Cloud API token is required');
|
|
896
|
-
break;
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
private _generateDockerfile(config: AgentConfig): string {
|
|
901
|
-
return `FROM node:22-slim
|
|
902
|
-
|
|
903
|
-
WORKDIR /app
|
|
904
|
-
|
|
905
|
-
RUN npm install -g @agenticmail/enterprise @agenticmail/core agenticmail
|
|
906
|
-
|
|
907
|
-
COPY workspace/ /workspace/
|
|
908
|
-
|
|
909
|
-
ENV NODE_ENV=production
|
|
910
|
-
ENV AGENTICMAIL_MODEL=${config.model.provider}/${config.model.modelId}
|
|
911
|
-
ENV AGENTICMAIL_THINKING=${config.model.thinkingLevel}
|
|
912
|
-
|
|
913
|
-
EXPOSE 3000
|
|
914
|
-
|
|
915
|
-
CMD ["agenticmail-enterprise", "start"]
|
|
916
|
-
`;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
private async execCommand(cmd: string, env?: Record<string, string>): Promise<{ success: boolean; message: string }> {
|
|
920
|
-
const { exec } = await import('child_process');
|
|
921
|
-
const { promisify } = await import('util');
|
|
922
|
-
const execAsync = promisify(exec);
|
|
923
|
-
|
|
924
|
-
try {
|
|
925
|
-
const { stdout, stderr } = await execAsync(cmd, {
|
|
926
|
-
timeout: 300_000, // 5 min max
|
|
927
|
-
env: { ...process.env, ...env },
|
|
928
|
-
});
|
|
929
|
-
return { success: true, message: stdout || stderr };
|
|
930
|
-
} catch (error: any) {
|
|
931
|
-
return { success: false, message: error.stderr || error.message };
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
private async execSSH(config: AgentConfig, command: string): Promise<{ success: boolean; message: string }> {
|
|
936
|
-
const vps = config.deployment.config.vps;
|
|
937
|
-
if (!vps) return { success: false, message: 'No VPS config' };
|
|
938
|
-
|
|
939
|
-
const sshArgs = [
|
|
940
|
-
'-o StrictHostKeyChecking=no',
|
|
941
|
-
`-p ${vps.port || 22}`,
|
|
942
|
-
vps.sshKeyPath ? `-i ${vps.sshKeyPath}` : '',
|
|
943
|
-
`${vps.user}@${vps.host}`,
|
|
944
|
-
`"${command.replace(/"/g, '\\"')}"`,
|
|
945
|
-
].filter(Boolean).join(' ');
|
|
946
|
-
|
|
947
|
-
return this.execCommand(`ssh ${sshArgs}`);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
private async _writeFile(path: string, content: string): Promise<void> {
|
|
951
|
-
const { writeFile } = await import('fs/promises');
|
|
952
|
-
const { dirname } = await import('path');
|
|
953
|
-
const { mkdir } = await import('fs/promises');
|
|
954
|
-
await mkdir(dirname(path), { recursive: true });
|
|
955
|
-
await writeFile(path, content, 'utf-8');
|
|
956
|
-
}
|
|
957
|
-
}
|