@agenticmail/enterprise 0.5.326 → 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/dist/dashboard/pages/cluster.js +1 -1
- package/logs/cloudflared-error.log +6 -0
- package/logs/enterprise-out.log +2 -0
- package/package.json +1 -1
- package/god_is_great.html +0 -35
- 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
|
@@ -1,896 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AgenticMail Agent Tools — Enterprise Documents
|
|
3
|
-
*
|
|
4
|
-
* Document generation, parsing, and conversion tools for AI agents.
|
|
5
|
-
* Generates valid PDFs and DOCX files using raw format construction,
|
|
6
|
-
* extracts invoice data with regex patterns, and converts between formats.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from 'node:fs/promises';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
import { execFile } from 'node:child_process';
|
|
12
|
-
import zlib from 'node:zlib';
|
|
13
|
-
import { promisify } from 'node:util';
|
|
14
|
-
import type { AnyAgentTool, ToolCreationOptions } from '../types.js';
|
|
15
|
-
import { readStringParam, jsonResult, textResult, errorResult } from '../common.js';
|
|
16
|
-
|
|
17
|
-
var deflateRaw = promisify(zlib.deflateRaw);
|
|
18
|
-
|
|
19
|
-
// --- Minimal PDF Writer ---
|
|
20
|
-
|
|
21
|
-
function buildPdf(textLines: string[], title?: string): Buffer {
|
|
22
|
-
var offsets: number[] = [];
|
|
23
|
-
var body = '';
|
|
24
|
-
var objNum = 0;
|
|
25
|
-
|
|
26
|
-
function addObj(content: string): number {
|
|
27
|
-
objNum++;
|
|
28
|
-
offsets.push(Buffer.byteLength(body, 'binary'));
|
|
29
|
-
body += objNum + ' 0 obj\n' + content + '\nendobj\n';
|
|
30
|
-
return objNum;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Catalog (obj 1)
|
|
34
|
-
addObj('<< /Type /Catalog /Pages 2 0 R >>');
|
|
35
|
-
|
|
36
|
-
// Pages (obj 2)
|
|
37
|
-
addObj('<< /Type /Pages /Kids [3 0 R] /Count 1 >>');
|
|
38
|
-
|
|
39
|
-
// Build text stream
|
|
40
|
-
var fontSize = 12;
|
|
41
|
-
var leading = 14;
|
|
42
|
-
var margin = 72;
|
|
43
|
-
var pageWidth = 612;
|
|
44
|
-
var pageHeight = 792;
|
|
45
|
-
var usableWidth = pageWidth - 2 * margin;
|
|
46
|
-
|
|
47
|
-
var stream = 'BT\n/F1 ' + fontSize + ' Tf\n' + margin + ' ' + (pageHeight - margin) + ' Td\n' + leading + ' TL\n';
|
|
48
|
-
if (title) {
|
|
49
|
-
stream += '/F1 16 Tf\n(' + escapePdfString(title) + ') Tj\nT*\n/F1 ' + fontSize + ' Tf\nT*\n';
|
|
50
|
-
}
|
|
51
|
-
for (var line of textLines) {
|
|
52
|
-
// Wrap long lines
|
|
53
|
-
var wrapped = wrapText(line, usableWidth, fontSize * 0.6);
|
|
54
|
-
for (var wl of wrapped) {
|
|
55
|
-
stream += '(' + escapePdfString(wl) + ') Tj\nT*\n';
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
stream += 'ET';
|
|
59
|
-
|
|
60
|
-
// Content stream (obj 4)
|
|
61
|
-
addObj('<< /Length ' + stream.length + ' >>\nstream\n' + stream + '\nendstream');
|
|
62
|
-
|
|
63
|
-
// Page (obj 3) — inserted before stream in numbering, but we adjust
|
|
64
|
-
// Re-do: we need page=3 and stream=4
|
|
65
|
-
// Actually we already added catalog=1, pages=2, and streamObj got 3
|
|
66
|
-
// Let's restructure: add page after stream
|
|
67
|
-
|
|
68
|
-
// Reset and rebuild properly
|
|
69
|
-
body = '';
|
|
70
|
-
offsets = [];
|
|
71
|
-
objNum = 0;
|
|
72
|
-
|
|
73
|
-
// 1: Catalog
|
|
74
|
-
addObj('<< /Type /Catalog /Pages 2 0 R >>');
|
|
75
|
-
// 2: Pages
|
|
76
|
-
addObj('<< /Type /Pages /Kids [3 0 R] /Count 1 >>');
|
|
77
|
-
// 3: Page
|
|
78
|
-
addObj('<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ' + pageWidth + ' ' + pageHeight + '] /Contents 5 0 R /Resources << /Font << /F1 4 0 R >> >> >>');
|
|
79
|
-
// 4: Font
|
|
80
|
-
addObj('<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>');
|
|
81
|
-
// 5: Content stream
|
|
82
|
-
addObj('<< /Length ' + stream.length + ' >>\nstream\n' + stream + '\nendstream');
|
|
83
|
-
|
|
84
|
-
// Build PDF
|
|
85
|
-
var header = '%PDF-1.4\n%\xE2\xE3\xCF\xD3\n';
|
|
86
|
-
var xrefOffset = Buffer.byteLength(header, 'binary') + Buffer.byteLength(body, 'binary');
|
|
87
|
-
|
|
88
|
-
var xref = 'xref\n0 ' + (objNum + 1) + '\n0000000000 65535 f \n';
|
|
89
|
-
for (var i = 0; i < offsets.length; i++) {
|
|
90
|
-
var off = Buffer.byteLength(header, 'binary') + offsets[i];
|
|
91
|
-
xref += String(off).padStart(10, '0') + ' 00000 n \n';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var trailer = 'trailer\n<< /Size ' + (objNum + 1) + ' /Root 1 0 R >>\nstartxref\n' + xrefOffset + '\n%%EOF\n';
|
|
95
|
-
|
|
96
|
-
return Buffer.from(header + body + xref + trailer, 'binary');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function escapePdfString(str: string): string {
|
|
100
|
-
return str
|
|
101
|
-
.replace(/\\/g, '\\\\')
|
|
102
|
-
.replace(/\(/g, '\\(')
|
|
103
|
-
.replace(/\)/g, '\\)')
|
|
104
|
-
.replace(/\r/g, '\\r');
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function wrapText(text: string, maxWidth: number, charWidth: number): string[] {
|
|
108
|
-
var maxChars = Math.floor(maxWidth / charWidth);
|
|
109
|
-
if (text.length <= maxChars) return [text];
|
|
110
|
-
var lines: string[] = [];
|
|
111
|
-
var remaining = text;
|
|
112
|
-
while (remaining.length > 0) {
|
|
113
|
-
if (remaining.length <= maxChars) {
|
|
114
|
-
lines.push(remaining);
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
var breakAt = remaining.lastIndexOf(' ', maxChars);
|
|
118
|
-
if (breakAt <= 0) breakAt = maxChars;
|
|
119
|
-
lines.push(remaining.slice(0, breakAt));
|
|
120
|
-
remaining = remaining.slice(breakAt).replace(/^\s+/, '');
|
|
121
|
-
}
|
|
122
|
-
return lines;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// --- Minimal DOCX Builder ---
|
|
126
|
-
|
|
127
|
-
async function buildDocx(paragraphs: string[], title?: string): Promise<Buffer> {
|
|
128
|
-
// DOCX is a ZIP of XML files. We build a minimal one using raw ZIP construction.
|
|
129
|
-
var contentXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
|
130
|
-
+ '<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"'
|
|
131
|
-
+ ' xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'
|
|
132
|
-
+ '<w:body>';
|
|
133
|
-
|
|
134
|
-
if (title) {
|
|
135
|
-
contentXml += '<w:p><w:pPr><w:pStyle w:val="Heading1"/></w:pPr>'
|
|
136
|
-
+ '<w:r><w:rPr><w:b/><w:sz w:val="32"/></w:rPr>'
|
|
137
|
-
+ '<w:t>' + escapeXml(title) + '</w:t></w:r></w:p>';
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
for (var para of paragraphs) {
|
|
141
|
-
contentXml += '<w:p><w:r><w:t xml:space="preserve">' + escapeXml(para) + '</w:t></w:r></w:p>';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
contentXml += '</w:body></w:document>';
|
|
145
|
-
|
|
146
|
-
var contentTypesXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
|
147
|
-
+ '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">'
|
|
148
|
-
+ '<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'
|
|
149
|
-
+ '<Default Extension="xml" ContentType="application/xml"/>'
|
|
150
|
-
+ '<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>'
|
|
151
|
-
+ '</Types>';
|
|
152
|
-
|
|
153
|
-
var relsXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
|
154
|
-
+ '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'
|
|
155
|
-
+ '<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>'
|
|
156
|
-
+ '</Relationships>';
|
|
157
|
-
|
|
158
|
-
var wordRelsXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
|
159
|
-
+ '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'
|
|
160
|
-
+ '</Relationships>';
|
|
161
|
-
|
|
162
|
-
var files: Array<{ name: string; content: Buffer }> = [
|
|
163
|
-
{ name: '[Content_Types].xml', content: Buffer.from(contentTypesXml, 'utf-8') },
|
|
164
|
-
{ name: '_rels/.rels', content: Buffer.from(relsXml, 'utf-8') },
|
|
165
|
-
{ name: 'word/document.xml', content: Buffer.from(contentXml, 'utf-8') },
|
|
166
|
-
{ name: 'word/_rels/document.xml.rels', content: Buffer.from(wordRelsXml, 'utf-8') },
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
return buildZip(files);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function escapeXml(str: string): string {
|
|
173
|
-
return str
|
|
174
|
-
.replace(/&/g, '&')
|
|
175
|
-
.replace(/</g, '<')
|
|
176
|
-
.replace(/>/g, '>')
|
|
177
|
-
.replace(/"/g, '"')
|
|
178
|
-
.replace(/'/g, ''');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
async function buildZip(files: Array<{ name: string; content: Buffer }>): Promise<Buffer> {
|
|
182
|
-
var localHeaders: Buffer[] = [];
|
|
183
|
-
var centralHeaders: Buffer[] = [];
|
|
184
|
-
var offset = 0;
|
|
185
|
-
|
|
186
|
-
for (var file of files) {
|
|
187
|
-
var nameBuffer = Buffer.from(file.name, 'utf-8');
|
|
188
|
-
var compressed = await deflateRaw(file.content);
|
|
189
|
-
var crc = crc32(file.content);
|
|
190
|
-
|
|
191
|
-
// Local file header
|
|
192
|
-
var local = Buffer.alloc(30 + nameBuffer.length);
|
|
193
|
-
local.writeUInt32LE(0x04034b50, 0); // signature
|
|
194
|
-
local.writeUInt16LE(20, 4); // version needed
|
|
195
|
-
local.writeUInt16LE(0, 6); // flags
|
|
196
|
-
local.writeUInt16LE(8, 8); // compression: deflate
|
|
197
|
-
local.writeUInt16LE(0, 10); // mod time
|
|
198
|
-
local.writeUInt16LE(0, 12); // mod date
|
|
199
|
-
local.writeUInt32LE(crc, 14); // CRC-32
|
|
200
|
-
local.writeUInt32LE(compressed.length, 18); // compressed size
|
|
201
|
-
local.writeUInt32LE(file.content.length, 22); // uncompressed size
|
|
202
|
-
local.writeUInt16LE(nameBuffer.length, 26); // name length
|
|
203
|
-
local.writeUInt16LE(0, 28); // extra field length
|
|
204
|
-
nameBuffer.copy(local, 30);
|
|
205
|
-
|
|
206
|
-
localHeaders.push(Buffer.concat([local, compressed]));
|
|
207
|
-
|
|
208
|
-
// Central directory header
|
|
209
|
-
var central = Buffer.alloc(46 + nameBuffer.length);
|
|
210
|
-
central.writeUInt32LE(0x02014b50, 0); // signature
|
|
211
|
-
central.writeUInt16LE(20, 4); // version made by
|
|
212
|
-
central.writeUInt16LE(20, 6); // version needed
|
|
213
|
-
central.writeUInt16LE(0, 8); // flags
|
|
214
|
-
central.writeUInt16LE(8, 10); // compression
|
|
215
|
-
central.writeUInt16LE(0, 12); // mod time
|
|
216
|
-
central.writeUInt16LE(0, 14); // mod date
|
|
217
|
-
central.writeUInt32LE(crc, 16);
|
|
218
|
-
central.writeUInt32LE(compressed.length, 20);
|
|
219
|
-
central.writeUInt32LE(file.content.length, 24);
|
|
220
|
-
central.writeUInt16LE(nameBuffer.length, 28);
|
|
221
|
-
central.writeUInt16LE(0, 30); // extra field length
|
|
222
|
-
central.writeUInt16LE(0, 32); // comment length
|
|
223
|
-
central.writeUInt16LE(0, 34); // disk number
|
|
224
|
-
central.writeUInt16LE(0, 36); // internal attributes
|
|
225
|
-
central.writeUInt32LE(0, 38); // external attributes
|
|
226
|
-
central.writeUInt32LE(offset, 42); // local header offset
|
|
227
|
-
nameBuffer.copy(central, 46);
|
|
228
|
-
|
|
229
|
-
centralHeaders.push(central);
|
|
230
|
-
offset += local.length + compressed.length;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
var centralOffset = offset;
|
|
234
|
-
var centralSize = centralHeaders.reduce(function(sum, b) { return sum + b.length; }, 0);
|
|
235
|
-
|
|
236
|
-
// End of central directory
|
|
237
|
-
var eocd = Buffer.alloc(22);
|
|
238
|
-
eocd.writeUInt32LE(0x06054b50, 0);
|
|
239
|
-
eocd.writeUInt16LE(0, 4); // disk number
|
|
240
|
-
eocd.writeUInt16LE(0, 6); // central dir disk
|
|
241
|
-
eocd.writeUInt16LE(files.length, 8); // entries on disk
|
|
242
|
-
eocd.writeUInt16LE(files.length, 10); // total entries
|
|
243
|
-
eocd.writeUInt32LE(centralSize, 12);
|
|
244
|
-
eocd.writeUInt32LE(centralOffset, 16);
|
|
245
|
-
eocd.writeUInt16LE(0, 20); // comment length
|
|
246
|
-
|
|
247
|
-
return Buffer.concat([...localHeaders, ...centralHeaders, eocd]);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function crc32(buf: Buffer): number {
|
|
251
|
-
var table: number[] = [];
|
|
252
|
-
for (var n = 0; n < 256; n++) {
|
|
253
|
-
var c = n;
|
|
254
|
-
for (var k = 0; k < 8; k++) {
|
|
255
|
-
if (c & 1) c = 0xEDB88320 ^ (c >>> 1);
|
|
256
|
-
else c = c >>> 1;
|
|
257
|
-
}
|
|
258
|
-
table[n] = c;
|
|
259
|
-
}
|
|
260
|
-
var crc = 0xFFFFFFFF;
|
|
261
|
-
for (var i = 0; i < buf.length; i++) {
|
|
262
|
-
crc = table[(crc ^ buf[i]) & 0xFF] ^ (crc >>> 8);
|
|
263
|
-
}
|
|
264
|
-
return (crc ^ 0xFFFFFFFF) >>> 0;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export function createDocumentTools(options?: ToolCreationOptions): AnyAgentTool[] {
|
|
268
|
-
|
|
269
|
-
var entDocGeneratePdf: AnyAgentTool = {
|
|
270
|
-
name: 'ent_doc_generate_pdf',
|
|
271
|
-
label: 'Generate PDF',
|
|
272
|
-
description: 'Generate a PDF document from plain text content.',
|
|
273
|
-
category: 'file',
|
|
274
|
-
risk: 'medium',
|
|
275
|
-
parameters: {
|
|
276
|
-
type: 'object',
|
|
277
|
-
properties: {
|
|
278
|
-
output_path: { type: 'string', description: 'Path to write the PDF file.' },
|
|
279
|
-
content: { type: 'string', description: 'Text content for the PDF body (one paragraph per line).' },
|
|
280
|
-
title: { type: 'string', description: 'Optional document title.' },
|
|
281
|
-
},
|
|
282
|
-
required: ['output_path', 'content'],
|
|
283
|
-
},
|
|
284
|
-
execute: async function(_toolCallId, args) {
|
|
285
|
-
var params = args as Record<string, unknown>;
|
|
286
|
-
var outputPath = readStringParam(params, 'output_path', { required: true });
|
|
287
|
-
var content = readStringParam(params, 'content', { required: true, trim: false });
|
|
288
|
-
var title = readStringParam(params, 'title');
|
|
289
|
-
|
|
290
|
-
if (!path.isAbsolute(outputPath) && options?.workspaceDir) {
|
|
291
|
-
outputPath = path.resolve(options.workspaceDir, outputPath);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
try {
|
|
295
|
-
var lines = content.split('\n');
|
|
296
|
-
var pdfBuffer = buildPdf(lines, title);
|
|
297
|
-
var dir = path.dirname(outputPath);
|
|
298
|
-
await fs.mkdir(dir, { recursive: true });
|
|
299
|
-
await fs.writeFile(outputPath, pdfBuffer);
|
|
300
|
-
return textResult('Generated PDF: ' + outputPath + ' (' + pdfBuffer.length + ' bytes, ' + lines.length + ' lines)');
|
|
301
|
-
} catch (err: any) {
|
|
302
|
-
return errorResult('PDF generation failed: ' + (err.message || String(err)));
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
var entDocGenerateDocx: AnyAgentTool = {
|
|
308
|
-
name: 'ent_doc_generate_docx',
|
|
309
|
-
label: 'Generate DOCX',
|
|
310
|
-
description: 'Generate a Microsoft Word DOCX document from plain text content.',
|
|
311
|
-
category: 'file',
|
|
312
|
-
risk: 'medium',
|
|
313
|
-
parameters: {
|
|
314
|
-
type: 'object',
|
|
315
|
-
properties: {
|
|
316
|
-
output_path: { type: 'string', description: 'Path to write the DOCX file.' },
|
|
317
|
-
content: { type: 'string', description: 'Text content (one paragraph per line).' },
|
|
318
|
-
title: { type: 'string', description: 'Optional document title.' },
|
|
319
|
-
},
|
|
320
|
-
required: ['output_path', 'content'],
|
|
321
|
-
},
|
|
322
|
-
execute: async function(_toolCallId, args) {
|
|
323
|
-
var params = args as Record<string, unknown>;
|
|
324
|
-
var outputPath = readStringParam(params, 'output_path', { required: true });
|
|
325
|
-
var content = readStringParam(params, 'content', { required: true, trim: false });
|
|
326
|
-
var title = readStringParam(params, 'title');
|
|
327
|
-
|
|
328
|
-
if (!path.isAbsolute(outputPath) && options?.workspaceDir) {
|
|
329
|
-
outputPath = path.resolve(options.workspaceDir, outputPath);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
try {
|
|
333
|
-
var paragraphs = content.split('\n');
|
|
334
|
-
var docxBuffer = await buildDocx(paragraphs, title);
|
|
335
|
-
var dir = path.dirname(outputPath);
|
|
336
|
-
await fs.mkdir(dir, { recursive: true });
|
|
337
|
-
await fs.writeFile(outputPath, docxBuffer);
|
|
338
|
-
return textResult('Generated DOCX: ' + outputPath + ' (' + docxBuffer.length + ' bytes, ' + paragraphs.length + ' paragraphs)');
|
|
339
|
-
} catch (err: any) {
|
|
340
|
-
return errorResult('DOCX generation failed: ' + (err.message || String(err)));
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
var entDocOcr: AnyAgentTool = {
|
|
346
|
-
name: 'ent_doc_ocr',
|
|
347
|
-
label: 'OCR Image',
|
|
348
|
-
description: 'Extract text from an image file using OCR.',
|
|
349
|
-
category: 'utility',
|
|
350
|
-
risk: 'low',
|
|
351
|
-
parameters: {
|
|
352
|
-
type: 'object',
|
|
353
|
-
properties: {
|
|
354
|
-
file_path: { type: 'string', description: 'Path to the image file (PNG, JPG, TIFF, BMP).' },
|
|
355
|
-
language: { type: 'string', description: 'OCR language code (default "eng").' },
|
|
356
|
-
},
|
|
357
|
-
required: ['file_path'],
|
|
358
|
-
},
|
|
359
|
-
execute: async function(_toolCallId, args) {
|
|
360
|
-
var params = args as Record<string, unknown>;
|
|
361
|
-
var filePath = readStringParam(params, 'file_path', { required: true });
|
|
362
|
-
var language = readStringParam(params, 'language') || 'eng';
|
|
363
|
-
|
|
364
|
-
if (!path.isAbsolute(filePath) && options?.workspaceDir) {
|
|
365
|
-
filePath = path.resolve(options.workspaceDir, filePath);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
try {
|
|
369
|
-
await fs.access(filePath);
|
|
370
|
-
} catch {
|
|
371
|
-
return errorResult('File not found: ' + filePath);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// Try tesseract CLI
|
|
375
|
-
try {
|
|
376
|
-
var result = await new Promise<string>(function(resolve, reject) {
|
|
377
|
-
execFile('tesseract', [filePath, 'stdout', '-l', language], { timeout: 30000 }, function(err, stdout, _stderr) {
|
|
378
|
-
if (err) reject(err);
|
|
379
|
-
else resolve(stdout);
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
var text = result.trim();
|
|
383
|
-
if (!text) return textResult('OCR completed but no text was detected in the image.');
|
|
384
|
-
return jsonResult({ file: filePath, extractedText: text, charCount: text.length, lineCount: text.split('\n').length });
|
|
385
|
-
} catch {
|
|
386
|
-
// Tesseract not available — return metadata and suggestion
|
|
387
|
-
var stat = await fs.stat(filePath);
|
|
388
|
-
var ext = path.extname(filePath).toLowerCase();
|
|
389
|
-
return jsonResult({
|
|
390
|
-
file: filePath,
|
|
391
|
-
size: stat.size,
|
|
392
|
-
format: ext,
|
|
393
|
-
message: 'Tesseract OCR is not installed. Install it with: brew install tesseract (macOS) or apt-get install tesseract-ocr (Linux). Alternatively, use the vision/read tool to view the image directly.',
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
var entDocParseInvoice: AnyAgentTool = {
|
|
400
|
-
name: 'ent_doc_parse_invoice',
|
|
401
|
-
label: 'Parse Invoice',
|
|
402
|
-
description: 'Parse structured text to extract invoice fields: invoice number, date, vendor...',
|
|
403
|
-
category: 'utility',
|
|
404
|
-
risk: 'low',
|
|
405
|
-
parameters: {
|
|
406
|
-
type: 'object',
|
|
407
|
-
properties: {
|
|
408
|
-
file_path: { type: 'string', description: 'Path to a text file containing invoice content.' },
|
|
409
|
-
content: { type: 'string', description: 'Alternatively, provide invoice text content directly.' },
|
|
410
|
-
},
|
|
411
|
-
},
|
|
412
|
-
execute: async function(_toolCallId, args) {
|
|
413
|
-
var params = args as Record<string, unknown>;
|
|
414
|
-
var filePath = readStringParam(params, 'file_path');
|
|
415
|
-
var content = readStringParam(params, 'content', { trim: false });
|
|
416
|
-
|
|
417
|
-
if (!content && filePath) {
|
|
418
|
-
var resolved = filePath;
|
|
419
|
-
if (!path.isAbsolute(resolved) && options?.workspaceDir) {
|
|
420
|
-
resolved = path.resolve(options.workspaceDir, resolved);
|
|
421
|
-
}
|
|
422
|
-
try {
|
|
423
|
-
content = await fs.readFile(resolved, 'utf-8');
|
|
424
|
-
} catch (err: any) {
|
|
425
|
-
return errorResult('Failed to read file: ' + (err.message || String(err)));
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
if (!content) {
|
|
430
|
-
return errorResult('Provide either file_path or content parameter.');
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// Extract invoice fields using regex patterns
|
|
434
|
-
var invoice: Record<string, any> = {};
|
|
435
|
-
|
|
436
|
-
// Invoice number
|
|
437
|
-
var invNumMatch = content.match(/(?:invoice|inv)[\s#:]*([A-Z0-9\-]+)/i);
|
|
438
|
-
if (invNumMatch) invoice.invoiceNumber = invNumMatch[1];
|
|
439
|
-
|
|
440
|
-
// Date patterns
|
|
441
|
-
var dateMatch = content.match(/(?:date|issued|invoice date)[:\s]*(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}|\w+ \d{1,2},?\s*\d{4}|\d{4}-\d{2}-\d{2})/i);
|
|
442
|
-
if (dateMatch) invoice.date = dateMatch[1].trim();
|
|
443
|
-
|
|
444
|
-
// Due date
|
|
445
|
-
var dueDateMatch = content.match(/(?:due date|payment due|due)[:\s]*(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}|\w+ \d{1,2},?\s*\d{4}|\d{4}-\d{2}-\d{2})/i);
|
|
446
|
-
if (dueDateMatch) invoice.dueDate = dueDateMatch[1].trim();
|
|
447
|
-
|
|
448
|
-
// Vendor / From
|
|
449
|
-
var vendorMatch = content.match(/(?:from|vendor|seller|billed by|company)[:\s]*([^\n]+)/i);
|
|
450
|
-
if (vendorMatch) invoice.vendor = vendorMatch[1].trim();
|
|
451
|
-
|
|
452
|
-
// Bill to / Customer
|
|
453
|
-
var customerMatch = content.match(/(?:to|bill to|customer|client|billed to)[:\s]*([^\n]+)/i);
|
|
454
|
-
if (customerMatch) invoice.customer = customerMatch[1].trim();
|
|
455
|
-
|
|
456
|
-
// Total
|
|
457
|
-
var totalMatch = content.match(/(?:total|amount due|balance due|grand total)[:\s]*([\$\u00A3\u20AC]?\s?[\d,]+\.?\d{0,2})/i);
|
|
458
|
-
if (totalMatch) invoice.total = totalMatch[1].trim();
|
|
459
|
-
|
|
460
|
-
// Subtotal
|
|
461
|
-
var subtotalMatch = content.match(/(?:subtotal|sub-total|sub total)[:\s]*([\$\u00A3\u20AC]?\s?[\d,]+\.?\d{0,2})/i);
|
|
462
|
-
if (subtotalMatch) invoice.subtotal = subtotalMatch[1].trim();
|
|
463
|
-
|
|
464
|
-
// Tax
|
|
465
|
-
var taxMatch = content.match(/(?:tax|vat|gst|hst)[:\s]*([\$\u00A3\u20AC]?\s?[\d,]+\.?\d{0,2})/i);
|
|
466
|
-
if (taxMatch) invoice.tax = taxMatch[1].trim();
|
|
467
|
-
|
|
468
|
-
// Line items: look for lines with description + amount pattern
|
|
469
|
-
var lineItems: Array<{ description: string; amount: string }> = [];
|
|
470
|
-
var lines = content.split('\n');
|
|
471
|
-
for (var line of lines) {
|
|
472
|
-
var lineMatch = line.match(/^(.+?)\s+([\$\u00A3\u20AC]?\s?[\d,]+\.\d{2})\s*$/);
|
|
473
|
-
if (lineMatch) {
|
|
474
|
-
var desc = lineMatch[1].trim();
|
|
475
|
-
// Skip header/total lines
|
|
476
|
-
if (!/^(subtotal|total|tax|vat|amount|balance|due|date|invoice)/i.test(desc)) {
|
|
477
|
-
lineItems.push({ description: desc, amount: lineMatch[2].trim() });
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
if (lineItems.length > 0) invoice.lineItems = lineItems;
|
|
482
|
-
|
|
483
|
-
var fieldsFound = Object.keys(invoice).length;
|
|
484
|
-
if (fieldsFound === 0) {
|
|
485
|
-
return textResult('No invoice fields could be extracted. The content may not be in a recognized invoice format.');
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
invoice._fieldsExtracted = fieldsFound;
|
|
489
|
-
return jsonResult(invoice);
|
|
490
|
-
},
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
var entDocConvert: AnyAgentTool = {
|
|
494
|
-
name: 'ent_doc_convert',
|
|
495
|
-
label: 'Convert Document',
|
|
496
|
-
description: 'Convert between document formats: markdown to HTML, HTML to plain text, JSON ...',
|
|
497
|
-
category: 'utility',
|
|
498
|
-
risk: 'medium',
|
|
499
|
-
parameters: {
|
|
500
|
-
type: 'object',
|
|
501
|
-
properties: {
|
|
502
|
-
input_path: { type: 'string', description: 'Path to the input file.' },
|
|
503
|
-
output_path: { type: 'string', description: 'Path to write the output file.' },
|
|
504
|
-
conversion: { type: 'string', description: 'Conversion type.', enum: ['md_to_html', 'html_to_text', 'json_to_csv', 'text_to_md'] },
|
|
505
|
-
},
|
|
506
|
-
required: ['input_path', 'output_path', 'conversion'],
|
|
507
|
-
},
|
|
508
|
-
execute: async function(_toolCallId, args) {
|
|
509
|
-
var params = args as Record<string, unknown>;
|
|
510
|
-
var inputPath = readStringParam(params, 'input_path', { required: true });
|
|
511
|
-
var outputPath = readStringParam(params, 'output_path', { required: true });
|
|
512
|
-
var conversion = readStringParam(params, 'conversion', { required: true });
|
|
513
|
-
|
|
514
|
-
if (!path.isAbsolute(inputPath) && options?.workspaceDir) {
|
|
515
|
-
inputPath = path.resolve(options.workspaceDir, inputPath);
|
|
516
|
-
}
|
|
517
|
-
if (!path.isAbsolute(outputPath) && options?.workspaceDir) {
|
|
518
|
-
outputPath = path.resolve(options.workspaceDir, outputPath);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
try {
|
|
522
|
-
var content = await fs.readFile(inputPath, 'utf-8');
|
|
523
|
-
var output: string;
|
|
524
|
-
|
|
525
|
-
switch (conversion) {
|
|
526
|
-
case 'md_to_html': {
|
|
527
|
-
// Simple markdown to HTML conversion
|
|
528
|
-
output = content
|
|
529
|
-
.replace(/^### (.+)$/gm, '<h3>$1</h3>')
|
|
530
|
-
.replace(/^## (.+)$/gm, '<h2>$1</h2>')
|
|
531
|
-
.replace(/^# (.+)$/gm, '<h1>$1</h1>')
|
|
532
|
-
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
|
533
|
-
.replace(/\*(.+?)\*/g, '<em>$1</em>')
|
|
534
|
-
.replace(/`(.+?)`/g, '<code>$1</code>')
|
|
535
|
-
.replace(/^\- (.+)$/gm, '<li>$1</li>')
|
|
536
|
-
.replace(/^\d+\. (.+)$/gm, '<li>$1</li>')
|
|
537
|
-
.replace(/\[(.+?)\]\((.+?)\)/g, '<a href="$2">$1</a>')
|
|
538
|
-
.replace(/^(?!<[hlo])(.*[^\n])$/gm, '<p>$1</p>')
|
|
539
|
-
.replace(/\n{2,}/g, '\n');
|
|
540
|
-
output = '<!DOCTYPE html>\n<html>\n<head><meta charset="utf-8"></head>\n<body>\n' + output + '\n</body>\n</html>';
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
case 'html_to_text': {
|
|
544
|
-
output = content
|
|
545
|
-
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
|
|
546
|
-
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
|
547
|
-
.replace(/<br\s*\/?>/gi, '\n')
|
|
548
|
-
.replace(/<\/p>/gi, '\n\n')
|
|
549
|
-
.replace(/<\/div>/gi, '\n')
|
|
550
|
-
.replace(/<\/h[1-6]>/gi, '\n\n')
|
|
551
|
-
.replace(/<\/li>/gi, '\n')
|
|
552
|
-
.replace(/<li[^>]*>/gi, ' - ')
|
|
553
|
-
.replace(/<[^>]+>/g, '')
|
|
554
|
-
.replace(/&/g, '&')
|
|
555
|
-
.replace(/</g, '<')
|
|
556
|
-
.replace(/>/g, '>')
|
|
557
|
-
.replace(/"/g, '"')
|
|
558
|
-
.replace(/'/g, "'")
|
|
559
|
-
.replace(/ /g, ' ')
|
|
560
|
-
.replace(/\n{3,}/g, '\n\n')
|
|
561
|
-
.trim();
|
|
562
|
-
break;
|
|
563
|
-
}
|
|
564
|
-
case 'json_to_csv': {
|
|
565
|
-
var data = JSON.parse(content);
|
|
566
|
-
if (!Array.isArray(data)) {
|
|
567
|
-
return errorResult('JSON input must be an array of objects for CSV conversion.');
|
|
568
|
-
}
|
|
569
|
-
if (data.length === 0) {
|
|
570
|
-
output = '';
|
|
571
|
-
break;
|
|
572
|
-
}
|
|
573
|
-
var headers = Object.keys(data[0]);
|
|
574
|
-
var csvLines = [headers.map(function(h) {
|
|
575
|
-
return h.indexOf(',') >= 0 || h.indexOf('"') >= 0 ? '"' + h.replace(/"/g, '""') + '"' : h;
|
|
576
|
-
}).join(',')];
|
|
577
|
-
for (var row of data) {
|
|
578
|
-
csvLines.push(headers.map(function(h) {
|
|
579
|
-
var val = row[h] != null ? String(row[h]) : '';
|
|
580
|
-
return val.indexOf(',') >= 0 || val.indexOf('"') >= 0 || val.indexOf('\n') >= 0
|
|
581
|
-
? '"' + val.replace(/"/g, '""') + '"' : val;
|
|
582
|
-
}).join(','));
|
|
583
|
-
}
|
|
584
|
-
output = csvLines.join('\n') + '\n';
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
case 'text_to_md': {
|
|
588
|
-
// Convert plain text to markdown: detect paragraphs, lists, headings
|
|
589
|
-
var lines = content.split('\n');
|
|
590
|
-
var mdLines: string[] = [];
|
|
591
|
-
for (var line of lines) {
|
|
592
|
-
var trimmed = line.trim();
|
|
593
|
-
if (!trimmed) {
|
|
594
|
-
mdLines.push('');
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
// Lines that are ALL CAPS could be headings
|
|
598
|
-
if (trimmed.length > 3 && trimmed === trimmed.toUpperCase() && /^[A-Z\s]+$/.test(trimmed)) {
|
|
599
|
-
mdLines.push('## ' + trimmed.charAt(0) + trimmed.slice(1).toLowerCase());
|
|
600
|
-
}
|
|
601
|
-
// Lines starting with - or * are already list-like
|
|
602
|
-
else if (/^[\-\*]\s/.test(trimmed)) {
|
|
603
|
-
mdLines.push(trimmed);
|
|
604
|
-
}
|
|
605
|
-
// Lines starting with a number + period are ordered lists
|
|
606
|
-
else if (/^\d+[\.\)]\s/.test(trimmed)) {
|
|
607
|
-
mdLines.push(trimmed);
|
|
608
|
-
}
|
|
609
|
-
else {
|
|
610
|
-
mdLines.push(trimmed);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
output = mdLines.join('\n');
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
default:
|
|
617
|
-
return errorResult('Unknown conversion type: ' + conversion);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
var dir = path.dirname(outputPath);
|
|
621
|
-
await fs.mkdir(dir, { recursive: true });
|
|
622
|
-
await fs.writeFile(outputPath, output, 'utf-8');
|
|
623
|
-
return textResult('Converted ' + conversion + ': ' + inputPath + ' -> ' + outputPath + ' (' + output.length + ' chars)');
|
|
624
|
-
} catch (err: any) {
|
|
625
|
-
return errorResult('Conversion failed: ' + (err.message || String(err)));
|
|
626
|
-
}
|
|
627
|
-
},
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
var entDocExtractTables: AnyAgentTool = {
|
|
631
|
-
name: 'ent_doc_extract_tables',
|
|
632
|
-
label: 'Extract Tables',
|
|
633
|
-
description: 'Extract tabular data from HTML files (HTML tables) or text files (aligned col...',
|
|
634
|
-
category: 'utility',
|
|
635
|
-
risk: 'low',
|
|
636
|
-
parameters: {
|
|
637
|
-
type: 'object',
|
|
638
|
-
properties: {
|
|
639
|
-
file_path: { type: 'string', description: 'Path to the HTML or text file.' },
|
|
640
|
-
},
|
|
641
|
-
required: ['file_path'],
|
|
642
|
-
},
|
|
643
|
-
execute: async function(_toolCallId, args) {
|
|
644
|
-
var params = args as Record<string, unknown>;
|
|
645
|
-
var filePath = readStringParam(params, 'file_path', { required: true });
|
|
646
|
-
|
|
647
|
-
if (!path.isAbsolute(filePath) && options?.workspaceDir) {
|
|
648
|
-
filePath = path.resolve(options.workspaceDir, filePath);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
try {
|
|
652
|
-
var content = await fs.readFile(filePath, 'utf-8');
|
|
653
|
-
var ext = path.extname(filePath).toLowerCase();
|
|
654
|
-
var tables: Array<{ headers: string[]; rows: string[][] }> = [];
|
|
655
|
-
|
|
656
|
-
if (ext === '.html' || ext === '.htm' || content.indexOf('<table') >= 0) {
|
|
657
|
-
// Extract HTML tables
|
|
658
|
-
var tableRegex = /<table[^>]*>([\s\S]*?)<\/table>/gi;
|
|
659
|
-
var tableMatch: RegExpExecArray | null;
|
|
660
|
-
while ((tableMatch = tableRegex.exec(content)) !== null) {
|
|
661
|
-
var tableHtml = tableMatch[1];
|
|
662
|
-
var headers: string[] = [];
|
|
663
|
-
var rows: string[][] = [];
|
|
664
|
-
|
|
665
|
-
// Extract headers from <th>
|
|
666
|
-
var thRegex = /<th[^>]*>([\s\S]*?)<\/th>/gi;
|
|
667
|
-
var thMatch: RegExpExecArray | null;
|
|
668
|
-
while ((thMatch = thRegex.exec(tableHtml)) !== null) {
|
|
669
|
-
headers.push(thMatch[1].replace(/<[^>]+>/g, '').trim());
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// Extract rows from <tr>
|
|
673
|
-
var trRegex = /<tr[^>]*>([\s\S]*?)<\/tr>/gi;
|
|
674
|
-
var trMatch: RegExpExecArray | null;
|
|
675
|
-
var firstRow = true;
|
|
676
|
-
while ((trMatch = trRegex.exec(tableHtml)) !== null) {
|
|
677
|
-
var cells: string[] = [];
|
|
678
|
-
var tdRegex = /<td[^>]*>([\s\S]*?)<\/td>/gi;
|
|
679
|
-
var tdMatch: RegExpExecArray | null;
|
|
680
|
-
while ((tdMatch = tdRegex.exec(trMatch[1])) !== null) {
|
|
681
|
-
cells.push(tdMatch[1].replace(/<[^>]+>/g, '').trim());
|
|
682
|
-
}
|
|
683
|
-
if (cells.length > 0) {
|
|
684
|
-
if (headers.length === 0 && firstRow) {
|
|
685
|
-
headers = cells;
|
|
686
|
-
} else {
|
|
687
|
-
rows.push(cells);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
firstRow = false;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
if (headers.length > 0 || rows.length > 0) {
|
|
694
|
-
tables.push({ headers: headers, rows: rows });
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
} else {
|
|
698
|
-
// Try to detect text tables (pipe-delimited or tab-delimited or aligned columns)
|
|
699
|
-
var lines = content.split('\n').filter(function(l) { return l.trim() !== ''; });
|
|
700
|
-
|
|
701
|
-
// Check for pipe-delimited tables (markdown-style)
|
|
702
|
-
var pipeLines = lines.filter(function(l) { return l.indexOf('|') >= 0; });
|
|
703
|
-
if (pipeLines.length >= 2) {
|
|
704
|
-
var dataLines = pipeLines.filter(function(l) { return !/^[\s|:-]+$/.test(l); });
|
|
705
|
-
if (dataLines.length > 0) {
|
|
706
|
-
var headers = dataLines[0].split('|').map(function(c) { return c.trim(); }).filter(Boolean);
|
|
707
|
-
var rows: string[][] = [];
|
|
708
|
-
for (var i = 1; i < dataLines.length; i++) {
|
|
709
|
-
var cells = dataLines[i].split('|').map(function(c) { return c.trim(); }).filter(Boolean);
|
|
710
|
-
if (cells.length > 0) rows.push(cells);
|
|
711
|
-
}
|
|
712
|
-
tables.push({ headers: headers, rows: rows });
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
// Check for tab-delimited
|
|
717
|
-
if (tables.length === 0) {
|
|
718
|
-
var tabLines = lines.filter(function(l) { return l.indexOf('\t') >= 0; });
|
|
719
|
-
if (tabLines.length >= 2) {
|
|
720
|
-
var headers = tabLines[0].split('\t').map(function(c) { return c.trim(); });
|
|
721
|
-
var rows: string[][] = [];
|
|
722
|
-
for (var i = 1; i < tabLines.length; i++) {
|
|
723
|
-
rows.push(tabLines[i].split('\t').map(function(c) { return c.trim(); }));
|
|
724
|
-
}
|
|
725
|
-
tables.push({ headers: headers, rows: rows });
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
if (tables.length === 0) {
|
|
731
|
-
return textResult('No tables found in ' + filePath);
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
return jsonResult({ file: filePath, tableCount: tables.length, tables: tables });
|
|
735
|
-
} catch (err: any) {
|
|
736
|
-
return errorResult('Table extraction failed: ' + (err.message || String(err)));
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
var entDocMergePdfs: AnyAgentTool = {
|
|
742
|
-
name: 'ent_doc_merge_pdfs',
|
|
743
|
-
label: 'Merge PDFs',
|
|
744
|
-
description: 'Concatenate multiple PDF files into a single PDF.',
|
|
745
|
-
category: 'file',
|
|
746
|
-
risk: 'medium',
|
|
747
|
-
parameters: {
|
|
748
|
-
type: 'object',
|
|
749
|
-
properties: {
|
|
750
|
-
input_files: { type: 'string', description: 'JSON array of PDF file paths to merge, in order.' },
|
|
751
|
-
output_path: { type: 'string', description: 'Path to write the merged PDF.' },
|
|
752
|
-
},
|
|
753
|
-
required: ['input_files', 'output_path'],
|
|
754
|
-
},
|
|
755
|
-
execute: async function(_toolCallId, args) {
|
|
756
|
-
var params = args as Record<string, unknown>;
|
|
757
|
-
var inputFilesStr = readStringParam(params, 'input_files', { required: true });
|
|
758
|
-
var outputPath = readStringParam(params, 'output_path', { required: true });
|
|
759
|
-
|
|
760
|
-
if (!path.isAbsolute(outputPath) && options?.workspaceDir) {
|
|
761
|
-
outputPath = path.resolve(options.workspaceDir, outputPath);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
try {
|
|
765
|
-
var inputFiles: string[];
|
|
766
|
-
try {
|
|
767
|
-
inputFiles = JSON.parse(inputFilesStr);
|
|
768
|
-
} catch {
|
|
769
|
-
return errorResult('Invalid JSON for input_files. Expected a JSON array of file paths.');
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if (!Array.isArray(inputFiles) || inputFiles.length < 2) {
|
|
773
|
-
return errorResult('At least 2 PDF files are required for merging.');
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
// Collect all text content from PDFs by re-reading them
|
|
777
|
-
// For simplicity, we extract text streams and regenerate a single PDF
|
|
778
|
-
var allLines: string[] = [];
|
|
779
|
-
for (var i = 0; i < inputFiles.length; i++) {
|
|
780
|
-
var filePath = inputFiles[i];
|
|
781
|
-
if (!path.isAbsolute(filePath) && options?.workspaceDir) {
|
|
782
|
-
filePath = path.resolve(options.workspaceDir, filePath);
|
|
783
|
-
}
|
|
784
|
-
try {
|
|
785
|
-
await fs.access(filePath);
|
|
786
|
-
} catch {
|
|
787
|
-
return errorResult('File not found: ' + filePath);
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
var pdfContent = await fs.readFile(filePath);
|
|
791
|
-
// Extract text between BT and ET markers
|
|
792
|
-
var pdfStr = pdfContent.toString('binary');
|
|
793
|
-
var btIdx = pdfStr.indexOf('BT\n');
|
|
794
|
-
var etIdx = pdfStr.indexOf('\nET', btIdx);
|
|
795
|
-
if (btIdx >= 0 && etIdx >= 0) {
|
|
796
|
-
var textBlock = pdfStr.slice(btIdx + 3, etIdx);
|
|
797
|
-
var textMatches = textBlock.match(/\(([^)]*)\)\s*Tj/g);
|
|
798
|
-
if (textMatches) {
|
|
799
|
-
if (i > 0) allLines.push('--- Page ' + (i + 1) + ' ---');
|
|
800
|
-
for (var tm of textMatches) {
|
|
801
|
-
var text = tm.replace(/^\(/, '').replace(/\)\s*Tj$/, '')
|
|
802
|
-
.replace(/\\\(/g, '(').replace(/\\\)/g, ')').replace(/\\\\/g, '\\');
|
|
803
|
-
allLines.push(text);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
var mergedPdf = buildPdf(allLines, undefined);
|
|
810
|
-
var dir = path.dirname(outputPath);
|
|
811
|
-
await fs.mkdir(dir, { recursive: true });
|
|
812
|
-
await fs.writeFile(outputPath, mergedPdf);
|
|
813
|
-
return textResult('Merged ' + inputFiles.length + ' PDFs into ' + outputPath + ' (' + mergedPdf.length + ' bytes)');
|
|
814
|
-
} catch (err: any) {
|
|
815
|
-
return errorResult('PDF merge failed: ' + (err.message || String(err)));
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
var entDocFillForm: AnyAgentTool = {
|
|
821
|
-
name: 'ent_doc_fill_form',
|
|
822
|
-
label: 'Fill Document Template',
|
|
823
|
-
description: 'Replace {{placeholder}} patterns in a document template with provided values.',
|
|
824
|
-
category: 'file',
|
|
825
|
-
risk: 'medium',
|
|
826
|
-
parameters: {
|
|
827
|
-
type: 'object',
|
|
828
|
-
properties: {
|
|
829
|
-
template_path: { type: 'string', description: 'Path to the template file with {{placeholder}} patterns.' },
|
|
830
|
-
output_path: { type: 'string', description: 'Path to write the filled document.' },
|
|
831
|
-
values: { type: 'string', description: 'JSON object of placeholder names to values (e.g., {"name": "John", "date": "2...' },
|
|
832
|
-
},
|
|
833
|
-
required: ['template_path', 'output_path', 'values'],
|
|
834
|
-
},
|
|
835
|
-
execute: async function(_toolCallId, args) {
|
|
836
|
-
var params = args as Record<string, unknown>;
|
|
837
|
-
var templatePath = readStringParam(params, 'template_path', { required: true });
|
|
838
|
-
var outputPath = readStringParam(params, 'output_path', { required: true });
|
|
839
|
-
var valuesStr = readStringParam(params, 'values', { required: true });
|
|
840
|
-
|
|
841
|
-
if (!path.isAbsolute(templatePath) && options?.workspaceDir) {
|
|
842
|
-
templatePath = path.resolve(options.workspaceDir, templatePath);
|
|
843
|
-
}
|
|
844
|
-
if (!path.isAbsolute(outputPath) && options?.workspaceDir) {
|
|
845
|
-
outputPath = path.resolve(options.workspaceDir, outputPath);
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
try {
|
|
849
|
-
var values: Record<string, string>;
|
|
850
|
-
try {
|
|
851
|
-
values = JSON.parse(valuesStr);
|
|
852
|
-
} catch {
|
|
853
|
-
return errorResult('Invalid JSON for values parameter.');
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
var template = await fs.readFile(templatePath, 'utf-8');
|
|
857
|
-
var filled = template;
|
|
858
|
-
var replacedCount = 0;
|
|
859
|
-
var missingPlaceholders: string[] = [];
|
|
860
|
-
|
|
861
|
-
// Find all placeholders in the template
|
|
862
|
-
var placeholderRegex = /\{\{(\w+)\}\}/g;
|
|
863
|
-
var match: RegExpExecArray | null;
|
|
864
|
-
var foundPlaceholders = new Set<string>();
|
|
865
|
-
while ((match = placeholderRegex.exec(template)) !== null) {
|
|
866
|
-
foundPlaceholders.add(match[1]);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// Replace each placeholder
|
|
870
|
-
for (var placeholder of foundPlaceholders) {
|
|
871
|
-
if (values[placeholder] !== undefined) {
|
|
872
|
-
var pattern = new RegExp('\\{\\{' + placeholder + '\\}\\}', 'g');
|
|
873
|
-
filled = filled.replace(pattern, values[placeholder]);
|
|
874
|
-
replacedCount++;
|
|
875
|
-
} else {
|
|
876
|
-
missingPlaceholders.push(placeholder);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
var dir = path.dirname(outputPath);
|
|
881
|
-
await fs.mkdir(dir, { recursive: true });
|
|
882
|
-
await fs.writeFile(outputPath, filled, 'utf-8');
|
|
883
|
-
|
|
884
|
-
var summary = 'Filled ' + replacedCount + ' placeholder(s) in template. Wrote to ' + outputPath;
|
|
885
|
-
if (missingPlaceholders.length > 0) {
|
|
886
|
-
summary += '\nWarning: ' + missingPlaceholders.length + ' unfilled placeholder(s): ' + missingPlaceholders.join(', ');
|
|
887
|
-
}
|
|
888
|
-
return textResult(summary);
|
|
889
|
-
} catch (err: any) {
|
|
890
|
-
return errorResult('Template fill failed: ' + (err.message || String(err)));
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
};
|
|
894
|
-
|
|
895
|
-
return [entDocGeneratePdf, entDocGenerateDocx, entDocOcr, entDocParseInvoice, entDocConvert, entDocExtractTables, entDocMergePdfs, entDocFillForm];
|
|
896
|
-
}
|