@muxoai/sdk 1.2.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +22 -0
- package/.claude-plugin/marketplace.json +17 -0
- package/.codex/config.toml +5 -0
- package/ARCHITECTURE.md +111 -0
- package/README.md +21 -12
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +894 -0
- package/dist/config.d.ts +20 -0
- package/dist/config.js +89 -0
- package/dist/engine.d.ts +156 -0
- package/dist/engine.js +876 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/mcp.d.ts +45 -0
- package/dist/mcp.js +914 -0
- package/dist/nl.d.ts +34 -0
- package/dist/nl.js +577 -0
- package/dist/providers/composio-instant.d.ts +14 -0
- package/dist/providers/composio-instant.js +814 -0
- package/dist/providers/composio-sdk.d.ts +41 -0
- package/dist/providers/composio-sdk.js +572 -0
- package/dist/providers/microsoft-governance.d.ts +66 -0
- package/dist/providers/microsoft-governance.js +415 -0
- package/dist/providers/stripe-billing.d.ts +41 -0
- package/dist/providers/stripe-billing.js +372 -0
- package/dist/providers/stripe-projects.d.ts +53 -0
- package/dist/providers/stripe-projects.js +636 -0
- package/dist/providers/supermemory.d.ts +64 -0
- package/dist/providers/supermemory.js +224 -0
- package/{index.d.ts → dist/sdk.d.ts} +77 -1
- package/dist/sdk.js +270 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.js +1277 -0
- package/dist/store.d.ts +216 -0
- package/dist/store.js +1449 -0
- package/dist/types.d.ts +285 -0
- package/dist/types.js +1 -0
- package/dist/ui/console-html.d.ts +2 -0
- package/dist/ui/console-html.js +2343 -0
- package/package.json +66 -6
- package/plugins/muxo/.app.json +8 -0
- package/plugins/muxo/.claude-plugin/plugin.json +16 -0
- package/plugins/muxo/.codex-plugin/plugin.json +55 -0
- package/plugins/muxo/.mcp.json +40 -0
- package/plugins/muxo/assets/logo.png +0 -0
- package/plugins/muxo/assets/logo.svg +6 -0
- package/plugins/muxo/hooks/hooks.json +27 -0
- package/plugins/muxo/hooks/session-start.sh +85 -0
- package/plugins/muxo/hooks/user-prompt-submit.sh +45 -0
- package/plugins/muxo/mcp.json +38 -0
- package/plugins/muxo/plugin.json +59 -0
- package/plugins/muxo/skills/muxo/SKILL.md +25 -0
- package/plugins/muxo/skills/muxo/references/cli.md +57 -0
- package/plugins/muxo/skills/muxo/references/mcp.md +25 -0
- package/plugins/muxo/skills/setup/SKILL.md +28 -0
- package/src/catalogues/stripe-projects-catalog.json +9832 -0
- package/vendor/microsoft-governance/README.md +363 -0
- package/vendor/microsoft-governance/dist/audit.d.ts +26 -0
- package/vendor/microsoft-governance/dist/audit.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/audit.js +107 -0
- package/vendor/microsoft-governance/dist/audit.js.map +1 -0
- package/vendor/microsoft-governance/dist/cascade-containment.d.ts +84 -0
- package/vendor/microsoft-governance/dist/cascade-containment.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/cascade-containment.js +387 -0
- package/vendor/microsoft-governance/dist/cascade-containment.js.map +1 -0
- package/vendor/microsoft-governance/dist/client.d.ts +34 -0
- package/vendor/microsoft-governance/dist/client.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/client.js +112 -0
- package/vendor/microsoft-governance/dist/client.js.map +1 -0
- package/vendor/microsoft-governance/dist/context-poisoning.d.ts +58 -0
- package/vendor/microsoft-governance/dist/context-poisoning.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/context-poisoning.js +410 -0
- package/vendor/microsoft-governance/dist/context-poisoning.js.map +1 -0
- package/vendor/microsoft-governance/dist/credential-vault.d.ts +213 -0
- package/vendor/microsoft-governance/dist/credential-vault.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/credential-vault.js +567 -0
- package/vendor/microsoft-governance/dist/credential-vault.js.map +1 -0
- package/vendor/microsoft-governance/dist/discovery.d.ts +80 -0
- package/vendor/microsoft-governance/dist/discovery.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/discovery.js +404 -0
- package/vendor/microsoft-governance/dist/discovery.js.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/channel.d.ts +29 -0
- package/vendor/microsoft-governance/dist/encryption/channel.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/channel.js +78 -0
- package/vendor/microsoft-governance/dist/encryption/channel.js.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/index.d.ts +9 -0
- package/vendor/microsoft-governance/dist/encryption/index.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/index.js +23 -0
- package/vendor/microsoft-governance/dist/encryption/index.js.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/mesh-client.d.ts +267 -0
- package/vendor/microsoft-governance/dist/encryption/mesh-client.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/mesh-client.js +1001 -0
- package/vendor/microsoft-governance/dist/encryption/mesh-client.js.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/ratchet.d.ts +38 -0
- package/vendor/microsoft-governance/dist/encryption/ratchet.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/ratchet.js +223 -0
- package/vendor/microsoft-governance/dist/encryption/ratchet.js.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/registry-client.d.ts +136 -0
- package/vendor/microsoft-governance/dist/encryption/registry-client.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/registry-client.js +369 -0
- package/vendor/microsoft-governance/dist/encryption/registry-client.js.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/x3dh.d.ts +80 -0
- package/vendor/microsoft-governance/dist/encryption/x3dh.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/encryption/x3dh.js +238 -0
- package/vendor/microsoft-governance/dist/encryption/x3dh.js.map +1 -0
- package/vendor/microsoft-governance/dist/framework-adapter.d.ts +63 -0
- package/vendor/microsoft-governance/dist/framework-adapter.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/framework-adapter.js +253 -0
- package/vendor/microsoft-governance/dist/framework-adapter.js.map +1 -0
- package/vendor/microsoft-governance/dist/identity.d.ts +124 -0
- package/vendor/microsoft-governance/dist/identity.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/identity.js +446 -0
- package/vendor/microsoft-governance/dist/identity.js.map +1 -0
- package/vendor/microsoft-governance/dist/index.d.ts +39 -0
- package/vendor/microsoft-governance/dist/index.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/index.js +95 -0
- package/vendor/microsoft-governance/dist/index.js.map +1 -0
- package/vendor/microsoft-governance/dist/kill-switch.d.ts +22 -0
- package/vendor/microsoft-governance/dist/kill-switch.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/kill-switch.js +60 -0
- package/vendor/microsoft-governance/dist/kill-switch.js.map +1 -0
- package/vendor/microsoft-governance/dist/lifecycle.d.ts +50 -0
- package/vendor/microsoft-governance/dist/lifecycle.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/lifecycle.js +113 -0
- package/vendor/microsoft-governance/dist/lifecycle.js.map +1 -0
- package/vendor/microsoft-governance/dist/mcp.d.ts +41 -0
- package/vendor/microsoft-governance/dist/mcp.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/mcp.js +233 -0
- package/vendor/microsoft-governance/dist/mcp.js.map +1 -0
- package/vendor/microsoft-governance/dist/metrics.d.ts +123 -0
- package/vendor/microsoft-governance/dist/metrics.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/metrics.js +289 -0
- package/vendor/microsoft-governance/dist/metrics.js.map +1 -0
- package/vendor/microsoft-governance/dist/oci-manifest.d.ts +49 -0
- package/vendor/microsoft-governance/dist/oci-manifest.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/oci-manifest.js +182 -0
- package/vendor/microsoft-governance/dist/oci-manifest.js.map +1 -0
- package/vendor/microsoft-governance/dist/policy-backends/cedar.d.ts +15 -0
- package/vendor/microsoft-governance/dist/policy-backends/cedar.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/policy-backends/cedar.js +88 -0
- package/vendor/microsoft-governance/dist/policy-backends/cedar.js.map +1 -0
- package/vendor/microsoft-governance/dist/policy-backends/opa.d.ts +17 -0
- package/vendor/microsoft-governance/dist/policy-backends/opa.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/policy-backends/opa.js +74 -0
- package/vendor/microsoft-governance/dist/policy-backends/opa.js.map +1 -0
- package/vendor/microsoft-governance/dist/policy.d.ts +77 -0
- package/vendor/microsoft-governance/dist/policy.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/policy.js +760 -0
- package/vendor/microsoft-governance/dist/policy.js.map +1 -0
- package/vendor/microsoft-governance/dist/prompt-defense.d.ts +37 -0
- package/vendor/microsoft-governance/dist/prompt-defense.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/prompt-defense.js +229 -0
- package/vendor/microsoft-governance/dist/prompt-defense.js.map +1 -0
- package/vendor/microsoft-governance/dist/protocol-facets.d.ts +87 -0
- package/vendor/microsoft-governance/dist/protocol-facets.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/protocol-facets.js +728 -0
- package/vendor/microsoft-governance/dist/protocol-facets.js.map +1 -0
- package/vendor/microsoft-governance/dist/rings.d.ts +17 -0
- package/vendor/microsoft-governance/dist/rings.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/rings.js +61 -0
- package/vendor/microsoft-governance/dist/rings.js.map +1 -0
- package/vendor/microsoft-governance/dist/sandbox.d.ts +61 -0
- package/vendor/microsoft-governance/dist/sandbox.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/sandbox.js +199 -0
- package/vendor/microsoft-governance/dist/sandbox.js.map +1 -0
- package/vendor/microsoft-governance/dist/surface-parity.d.ts +45 -0
- package/vendor/microsoft-governance/dist/surface-parity.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/surface-parity.js +216 -0
- package/vendor/microsoft-governance/dist/surface-parity.js.map +1 -0
- package/vendor/microsoft-governance/dist/trust.d.ts +28 -0
- package/vendor/microsoft-governance/dist/trust.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/trust.js +209 -0
- package/vendor/microsoft-governance/dist/trust.js.map +1 -0
- package/vendor/microsoft-governance/dist/types.d.ts +422 -0
- package/vendor/microsoft-governance/dist/types.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/types.js +29 -0
- package/vendor/microsoft-governance/dist/types.js.map +1 -0
- package/vendor/microsoft-governance/dist/verify.d.ts +135 -0
- package/vendor/microsoft-governance/dist/verify.d.ts.map +1 -0
- package/vendor/microsoft-governance/dist/verify.js +356 -0
- package/vendor/microsoft-governance/dist/verify.js.map +1 -0
- package/vendor/microsoft-governance/package.json +64 -0
- package/index.js +0 -1
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
const INSTANT_TOOLS = [
|
|
2
|
+
{
|
|
3
|
+
slug: "instant.web.search",
|
|
4
|
+
upstreamSlug: "COMPOSIO_SEARCH_WEB",
|
|
5
|
+
name: "Instant Web Search",
|
|
6
|
+
description: "Search the live web for real-time articles, documentation, and company intelligence using Muxo Instant (zero OAuth setup).",
|
|
7
|
+
lane: "composio_instant",
|
|
8
|
+
providerSlug: "web",
|
|
9
|
+
providerName: "Muxo Instant Web",
|
|
10
|
+
categories: ["search", "research", "instant"],
|
|
11
|
+
riskLevel: "read",
|
|
12
|
+
requiresAuth: false,
|
|
13
|
+
creditCost: 2,
|
|
14
|
+
billingMode: "provider_wallet",
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
required: ["query"],
|
|
18
|
+
properties: {
|
|
19
|
+
query: { type: "string", description: "Search query string" },
|
|
20
|
+
limit: { type: "number", default: 5, description: "Max results (1-10)" },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
slug: "instant.web.scrape",
|
|
26
|
+
upstreamSlug: "FIRECRAWL_SCRAPE",
|
|
27
|
+
name: "Instant Web Page Scraper",
|
|
28
|
+
description: "Fetch and extract clean text, title, links, and metadata from any public HTTP(S) URL immediately without setup.",
|
|
29
|
+
lane: "composio_instant",
|
|
30
|
+
providerSlug: "firecrawl",
|
|
31
|
+
providerName: "Muxo Instant Scraper",
|
|
32
|
+
categories: ["scraping", "web", "instant"],
|
|
33
|
+
riskLevel: "read",
|
|
34
|
+
requiresAuth: false,
|
|
35
|
+
creditCost: 3,
|
|
36
|
+
billingMode: "provider_wallet",
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: "object",
|
|
39
|
+
required: ["url"],
|
|
40
|
+
properties: {
|
|
41
|
+
url: { type: "string", description: "Public URL to scrape" },
|
|
42
|
+
maxChars: { type: "number", default: 4000, description: "Max extracted characters" },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
slug: "instant.web.crawl",
|
|
48
|
+
upstreamSlug: "FIRECRAWL_MAP_MULTIPLE_URLS_BASED_ON_OPTIONS",
|
|
49
|
+
name: "Instant Multi-Page Web Crawler",
|
|
50
|
+
description: "Crawl a website starting from a root URL, discover internal and subdomain links, sitemap entries, and extract titles, status codes, headings, and page summaries with zero OAuth setup.",
|
|
51
|
+
lane: "composio_instant",
|
|
52
|
+
providerSlug: "firecrawl",
|
|
53
|
+
providerName: "Muxo Instant Crawler",
|
|
54
|
+
categories: ["crawl", "scraping", "web", "seo", "instant"],
|
|
55
|
+
riskLevel: "read",
|
|
56
|
+
requiresAuth: false,
|
|
57
|
+
creditCost: 4,
|
|
58
|
+
billingMode: "provider_wallet",
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: "object",
|
|
61
|
+
required: ["url"],
|
|
62
|
+
properties: {
|
|
63
|
+
url: { type: "string", description: "Starting root URL to crawl (e.g. 'https://muxo.ai')" },
|
|
64
|
+
maxPages: { type: "number", default: 5, description: "Maximum number of pages to crawl and extract (1-15)" },
|
|
65
|
+
includeSubdomains: { type: "boolean", default: true, description: "Whether to include discovered subdomain links" },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
slug: "instant.seo.audit",
|
|
71
|
+
upstreamSlug: "DATAFORSEO_ONPAGE_AND_BACKLINKS_AUDIT",
|
|
72
|
+
name: "Instant Technical SEO & Domain Intelligence Audit",
|
|
73
|
+
description: "Run a live technical SEO, meta/OpenGraph, heading structure, link-graph, AI/llms.txt readiness, DNS/edge, and keyword audit on any public URL or domain.",
|
|
74
|
+
lane: "composio_instant",
|
|
75
|
+
providerSlug: "dataforseo",
|
|
76
|
+
providerName: "Muxo Instant SEO Intelligence",
|
|
77
|
+
categories: ["seo", "audit", "marketing", "web", "instant"],
|
|
78
|
+
riskLevel: "read",
|
|
79
|
+
requiresAuth: false,
|
|
80
|
+
creditCost: 4,
|
|
81
|
+
billingMode: "provider_wallet",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
required: ["url"],
|
|
85
|
+
properties: {
|
|
86
|
+
url: { type: "string", description: "Target URL or domain to audit (e.g. 'https://muxo.ai')" },
|
|
87
|
+
keywords: {
|
|
88
|
+
type: "array",
|
|
89
|
+
items: { type: "string" },
|
|
90
|
+
description: "Optional target keywords to evaluate density and placement against",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
slug: "instant.hackernews.top_stories",
|
|
97
|
+
upstreamSlug: "HACKERNEWS_GET_TOP_STORIES",
|
|
98
|
+
name: "Hacker News: Live Top Stories",
|
|
99
|
+
description: "Fetch the current top stories on Hacker News with title, URL, points, and author via Instant execution.",
|
|
100
|
+
lane: "composio_instant",
|
|
101
|
+
providerSlug: "hackernews",
|
|
102
|
+
providerName: "Hacker News",
|
|
103
|
+
categories: ["news", "tech", "instant"],
|
|
104
|
+
riskLevel: "read",
|
|
105
|
+
requiresAuth: false,
|
|
106
|
+
creditCost: 1,
|
|
107
|
+
billingMode: "provider_wallet",
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {
|
|
111
|
+
limit: { type: "number", default: 5, description: "Number of top stories (1-15)" },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
slug: "instant.github.repo_intel",
|
|
117
|
+
upstreamSlug: "GITHUB_PUBLIC_REPO_INTEL",
|
|
118
|
+
name: "GitHub Instant: Public Repository Intelligence",
|
|
119
|
+
description: "Inspect stars, forks, open issues, license, and latest release for any public GitHub repository with zero OAuth.",
|
|
120
|
+
lane: "composio_instant",
|
|
121
|
+
providerSlug: "github",
|
|
122
|
+
providerName: "GitHub Instant",
|
|
123
|
+
categories: ["developer_tools", "research", "instant"],
|
|
124
|
+
riskLevel: "read",
|
|
125
|
+
requiresAuth: false,
|
|
126
|
+
creditCost: 1,
|
|
127
|
+
billingMode: "provider_wallet",
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: "object",
|
|
130
|
+
required: ["owner", "repo"],
|
|
131
|
+
properties: {
|
|
132
|
+
owner: { type: "string", description: "GitHub owner/org (e.g. 'cloudflare')" },
|
|
133
|
+
repo: { type: "string", description: "GitHub repo name (e.g. 'workerd')" },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
slug: "instant.dns.lookup",
|
|
139
|
+
upstreamSlug: "CLOUDFLARE_DOH_LOOKUP",
|
|
140
|
+
name: "Instant DNS Resolver (DoH)",
|
|
141
|
+
description: "Query live DNS records (A, AAAA, MX, TXT, CNAME, NS) for any domain over Cloudflare DNS-over-HTTPS.",
|
|
142
|
+
lane: "composio_instant",
|
|
143
|
+
providerSlug: "dns",
|
|
144
|
+
providerName: "Cloudflare DoH",
|
|
145
|
+
categories: ["networking", "diagnostics", "instant"],
|
|
146
|
+
riskLevel: "read",
|
|
147
|
+
requiresAuth: false,
|
|
148
|
+
creditCost: 1,
|
|
149
|
+
billingMode: "provider_wallet",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
required: ["domain"],
|
|
153
|
+
properties: {
|
|
154
|
+
domain: { type: "string", description: "Domain name (e.g. 'stripe.com')" },
|
|
155
|
+
type: {
|
|
156
|
+
type: "string",
|
|
157
|
+
enum: ["A", "AAAA", "MX", "TXT", "CNAME", "NS"],
|
|
158
|
+
default: "A",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
slug: "instant.composio.workbench",
|
|
165
|
+
upstreamSlug: "COMPOSIO_REMOTE_WORKBENCH",
|
|
166
|
+
name: "Composio Instant: Remote Sandbox Workbench",
|
|
167
|
+
description: "Execute isolated data processing, JSON transformation, or Python/JS analysis in Composio's remote sandbox workbench without OAuth.",
|
|
168
|
+
lane: "composio_instant",
|
|
169
|
+
providerSlug: "composio",
|
|
170
|
+
providerName: "Composio Workbench",
|
|
171
|
+
categories: ["sandbox", "compute", "analysis", "instant"],
|
|
172
|
+
riskLevel: "write",
|
|
173
|
+
requiresAuth: false,
|
|
174
|
+
creditCost: 2,
|
|
175
|
+
billingMode: "provider_wallet",
|
|
176
|
+
inputSchema: {
|
|
177
|
+
type: "object",
|
|
178
|
+
required: ["code_to_execute"],
|
|
179
|
+
properties: {
|
|
180
|
+
code_to_execute: {
|
|
181
|
+
type: "string",
|
|
182
|
+
description: "Code or expression to execute in the isolated workbench",
|
|
183
|
+
},
|
|
184
|
+
thought: {
|
|
185
|
+
type: "string",
|
|
186
|
+
description: "Brief explanation of what the workbench run is computing",
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
export class ComposioInstantAdapter {
|
|
193
|
+
config;
|
|
194
|
+
constructor(config) {
|
|
195
|
+
this.config = config;
|
|
196
|
+
}
|
|
197
|
+
getTools() {
|
|
198
|
+
return INSTANT_TOOLS;
|
|
199
|
+
}
|
|
200
|
+
searchTools(query, limit = 15) {
|
|
201
|
+
const q = (query || "").trim().toLowerCase();
|
|
202
|
+
if (!q)
|
|
203
|
+
return INSTANT_TOOLS.slice(0, limit);
|
|
204
|
+
return INSTANT_TOOLS.filter((t) => t.slug.toLowerCase().includes(q) ||
|
|
205
|
+
t.name.toLowerCase().includes(q) ||
|
|
206
|
+
t.description.toLowerCase().includes(q) ||
|
|
207
|
+
t.categories.some((c) => c.toLowerCase().includes(q))).slice(0, limit);
|
|
208
|
+
}
|
|
209
|
+
inspectTool(slug) {
|
|
210
|
+
return INSTANT_TOOLS.find((t) => t.slug === slug) || null;
|
|
211
|
+
}
|
|
212
|
+
async executeTool(params) {
|
|
213
|
+
const { tool, input } = params;
|
|
214
|
+
// 1. Try Composio Instant / No-Auth tool execution first if applicable
|
|
215
|
+
if (this.config.composioApiKey && tool.upstreamSlug.startsWith("COMPOSIO_")) {
|
|
216
|
+
try {
|
|
217
|
+
const res = await fetch(`${this.config.composioBaseUrl}/tools/execute/${encodeURIComponent(tool.upstreamSlug)}`, {
|
|
218
|
+
method: "POST",
|
|
219
|
+
headers: {
|
|
220
|
+
"x-api-key": this.config.composioApiKey,
|
|
221
|
+
"Content-Type": "application/json",
|
|
222
|
+
},
|
|
223
|
+
body: JSON.stringify({
|
|
224
|
+
user_id: params.workspaceId,
|
|
225
|
+
arguments: input,
|
|
226
|
+
}),
|
|
227
|
+
signal: AbortSignal.timeout(10000),
|
|
228
|
+
});
|
|
229
|
+
if (res.ok) {
|
|
230
|
+
const payload = (await res.json());
|
|
231
|
+
if (!payload.error) {
|
|
232
|
+
return {
|
|
233
|
+
provider: "composio_instant",
|
|
234
|
+
billingMode: "provider_wallet",
|
|
235
|
+
tool: tool.slug,
|
|
236
|
+
data: payload.data ?? payload,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
// Fall through to built-in high-availability Instant executors
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// 2. High-availability live Instant executors
|
|
246
|
+
if (tool.slug === "instant.hackernews.top_stories") {
|
|
247
|
+
const limit = Math.min(15, Math.max(1, Number(input.limit || 5)));
|
|
248
|
+
const idsRes = await fetch("https://hacker-news.firebaseio.com/v0/topstories.json", { signal: AbortSignal.timeout(8000) });
|
|
249
|
+
const ids = (await idsRes.json()).slice(0, limit);
|
|
250
|
+
const stories = await Promise.all(ids.map(async (id) => {
|
|
251
|
+
const itemRes = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`, { signal: AbortSignal.timeout(6000) });
|
|
252
|
+
const item = (await itemRes.json());
|
|
253
|
+
return {
|
|
254
|
+
id: item.id,
|
|
255
|
+
title: item.title,
|
|
256
|
+
url: item.url || `https://news.ycombinator.com/item?id=${item.id}`,
|
|
257
|
+
score: item.score,
|
|
258
|
+
by: item.by,
|
|
259
|
+
comments: item.descendants || 0,
|
|
260
|
+
};
|
|
261
|
+
}));
|
|
262
|
+
return {
|
|
263
|
+
provider: "composio_instant",
|
|
264
|
+
billingMode: "provider_wallet",
|
|
265
|
+
tool: tool.slug,
|
|
266
|
+
stories,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
if (tool.slug === "instant.github.repo_intel") {
|
|
270
|
+
const owner = String(input.owner || "").trim();
|
|
271
|
+
const repo = String(input.repo || "").trim();
|
|
272
|
+
if (!owner || !repo)
|
|
273
|
+
throw new Error("owner and repo are required");
|
|
274
|
+
const res = await fetch(`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`, {
|
|
275
|
+
headers: {
|
|
276
|
+
Accept: "application/vnd.github+json",
|
|
277
|
+
"User-Agent": "Muxo-Instant-Agent/1.0",
|
|
278
|
+
},
|
|
279
|
+
signal: AbortSignal.timeout(8000),
|
|
280
|
+
});
|
|
281
|
+
if (!res.ok) {
|
|
282
|
+
throw new Error(`GitHub lookup returned HTTP ${res.status}`);
|
|
283
|
+
}
|
|
284
|
+
const data = (await res.json());
|
|
285
|
+
return {
|
|
286
|
+
provider: "composio_instant",
|
|
287
|
+
billingMode: "provider_wallet",
|
|
288
|
+
tool: tool.slug,
|
|
289
|
+
repository: {
|
|
290
|
+
fullName: data.full_name,
|
|
291
|
+
description: data.description,
|
|
292
|
+
stars: data.stargazers_count,
|
|
293
|
+
forks: data.forks_count,
|
|
294
|
+
openIssues: data.open_issues_count,
|
|
295
|
+
language: data.language,
|
|
296
|
+
defaultBranch: data.default_branch,
|
|
297
|
+
license: data.license?.spdx_id || null,
|
|
298
|
+
updatedAt: data.updated_at,
|
|
299
|
+
htmlUrl: data.html_url,
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
if (tool.slug === "instant.dns.lookup") {
|
|
304
|
+
const domain = String(input.domain || input.hostname || "").trim();
|
|
305
|
+
const type = String(input.type || "A").toUpperCase();
|
|
306
|
+
if (!domain)
|
|
307
|
+
throw new Error("domain is required");
|
|
308
|
+
const url = `https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(domain)}&type=${encodeURIComponent(type)}`;
|
|
309
|
+
const res = await fetch(url, {
|
|
310
|
+
headers: { Accept: "application/dns-json" },
|
|
311
|
+
signal: AbortSignal.timeout(6000),
|
|
312
|
+
});
|
|
313
|
+
const data = (await res.json());
|
|
314
|
+
return {
|
|
315
|
+
provider: "composio_instant",
|
|
316
|
+
billingMode: "provider_wallet",
|
|
317
|
+
tool: tool.slug,
|
|
318
|
+
domain,
|
|
319
|
+
recordType: type,
|
|
320
|
+
status: data.Status,
|
|
321
|
+
answers: data.Answer || [],
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
if (tool.slug === "instant.web.scrape") {
|
|
325
|
+
const targetUrl = String(input.url || "").trim();
|
|
326
|
+
const maxChars = Math.min(20000, Math.max(500, Number(input.maxChars || 4000)));
|
|
327
|
+
if (!/^https?:\/\//i.test(targetUrl)) {
|
|
328
|
+
throw new Error("url must start with http:// or https://");
|
|
329
|
+
}
|
|
330
|
+
const res = await fetch(targetUrl, {
|
|
331
|
+
headers: {
|
|
332
|
+
"User-Agent": "Mozilla/5.0 (compatible; MuxoInstantBot/1.0; +https://muxo.ai)",
|
|
333
|
+
Accept: "text/html,application/xhtml+xml,text/plain,application/json",
|
|
334
|
+
},
|
|
335
|
+
signal: AbortSignal.timeout(12000),
|
|
336
|
+
});
|
|
337
|
+
const raw = await res.text();
|
|
338
|
+
const titleMatch = raw.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
339
|
+
const title = titleMatch ? titleMatch[1].replace(/\s+/g, " ").trim() : targetUrl;
|
|
340
|
+
const text = raw
|
|
341
|
+
.replace(/<script[\s\S]*?<\/script>/gi, " ")
|
|
342
|
+
.replace(/<style[\s\S]*?<\/style>/gi, " ")
|
|
343
|
+
.replace(/<[^>]+>/g, " ")
|
|
344
|
+
.replace(/\s+/g, " ")
|
|
345
|
+
.trim()
|
|
346
|
+
.slice(0, maxChars);
|
|
347
|
+
return {
|
|
348
|
+
provider: "composio_instant",
|
|
349
|
+
billingMode: "provider_wallet",
|
|
350
|
+
tool: tool.slug,
|
|
351
|
+
url: targetUrl,
|
|
352
|
+
statusCode: res.status,
|
|
353
|
+
title,
|
|
354
|
+
contentLength: text.length,
|
|
355
|
+
excerpt: text,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
if (tool.slug === "instant.web.crawl") {
|
|
359
|
+
const rawUrl = String(input.url || "").trim();
|
|
360
|
+
if (!rawUrl)
|
|
361
|
+
throw new Error("url is required");
|
|
362
|
+
const rootUrl = /^https?:\/\//i.test(rawUrl) ? rawUrl : `https://${rawUrl}`;
|
|
363
|
+
const maxPages = Math.min(15, Math.max(1, Number(input.maxPages || 5)));
|
|
364
|
+
const includeSubdomains = input.includeSubdomains !== false;
|
|
365
|
+
const rootParsed = new URL(rootUrl);
|
|
366
|
+
const baseDomain = rootParsed.hostname.replace(/^www\./i, "").toLowerCase();
|
|
367
|
+
const isAllowedHost = (host) => {
|
|
368
|
+
const h = host.toLowerCase();
|
|
369
|
+
if (h === rootParsed.hostname.toLowerCase() || h === baseDomain)
|
|
370
|
+
return true;
|
|
371
|
+
return includeSubdomains && h.endsWith(`.${baseDomain}`);
|
|
372
|
+
};
|
|
373
|
+
const discoveredSet = new Set([rootParsed.toString()]);
|
|
374
|
+
const extractLinksFromBody = (body, pageUrl) => {
|
|
375
|
+
const hrefRegex = /href=["']([^"'#]+)["']/gi;
|
|
376
|
+
let m;
|
|
377
|
+
while ((m = hrefRegex.exec(body)) !== null) {
|
|
378
|
+
try {
|
|
379
|
+
const resolved = new URL(m[1].trim(), pageUrl);
|
|
380
|
+
if ((resolved.protocol === "http:" || resolved.protocol === "https:") &&
|
|
381
|
+
isAllowedHost(resolved.hostname)) {
|
|
382
|
+
resolved.hash = "";
|
|
383
|
+
discoveredSet.add(resolved.toString());
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// ignore malformed href
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const mdUrlRegex = /https?:\/\/[a-zA-Z0-9._~:/?#[\]@!$&'()*+,;=-]+/g;
|
|
391
|
+
let u;
|
|
392
|
+
while ((u = mdUrlRegex.exec(body)) !== null) {
|
|
393
|
+
try {
|
|
394
|
+
const clean = u[0].replace(/[),.;'`"]+$/, "");
|
|
395
|
+
const resolved = new URL(clean);
|
|
396
|
+
if (isAllowedHost(resolved.hostname)) {
|
|
397
|
+
resolved.hash = "";
|
|
398
|
+
discoveredSet.add(resolved.toString());
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
// ignore
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
// Fetch root page + llms.txt + sitemap.xml in parallel to discover URLs
|
|
407
|
+
const [rootRes, llmsRes, sitemapRes] = await Promise.allSettled([
|
|
408
|
+
fetch(rootUrl, {
|
|
409
|
+
headers: {
|
|
410
|
+
"User-Agent": "Mozilla/5.0 (compatible; MuxoInstantCrawler/1.2; +https://muxo.ai)",
|
|
411
|
+
Accept: "text/html,application/xhtml+xml,text/plain",
|
|
412
|
+
},
|
|
413
|
+
signal: AbortSignal.timeout(10000),
|
|
414
|
+
}),
|
|
415
|
+
fetch(new URL("/llms.txt", rootParsed.origin).toString(), {
|
|
416
|
+
headers: { "User-Agent": "MuxoInstantCrawler/1.2" },
|
|
417
|
+
signal: AbortSignal.timeout(6000),
|
|
418
|
+
}),
|
|
419
|
+
fetch(new URL("/sitemap.xml", rootParsed.origin).toString(), {
|
|
420
|
+
headers: { "User-Agent": "MuxoInstantCrawler/1.2" },
|
|
421
|
+
signal: AbortSignal.timeout(6000),
|
|
422
|
+
}),
|
|
423
|
+
]);
|
|
424
|
+
let rootHtml = "";
|
|
425
|
+
let rootStatus = 200;
|
|
426
|
+
if (rootRes.status === "fulfilled") {
|
|
427
|
+
rootStatus = rootRes.value.status;
|
|
428
|
+
rootHtml = await rootRes.value.text();
|
|
429
|
+
extractLinksFromBody(rootHtml, rootUrl);
|
|
430
|
+
}
|
|
431
|
+
if (llmsRes.status === "fulfilled" && llmsRes.value.ok) {
|
|
432
|
+
const llmsTxt = await llmsRes.value.text();
|
|
433
|
+
extractLinksFromBody(llmsTxt, rootUrl);
|
|
434
|
+
}
|
|
435
|
+
if (sitemapRes.status === "fulfilled" && sitemapRes.value.ok) {
|
|
436
|
+
const smTxt = await sitemapRes.value.text();
|
|
437
|
+
extractLinksFromBody(smTxt, rootUrl);
|
|
438
|
+
}
|
|
439
|
+
const discoveredUrls = Array.from(discoveredSet);
|
|
440
|
+
const targetsToCrawl = discoveredUrls.slice(0, maxPages);
|
|
441
|
+
const parsePageSummary = (url, status, html) => {
|
|
442
|
+
const titleMatch = html.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
443
|
+
const descMatch = html.match(/<meta[^>]+name=["']description["'][^>]+content=["']([^"']*)["']/i) ||
|
|
444
|
+
html.match(/<meta[^>]+content=["']([^"']*)["'][^>]+name=["']description["']/i);
|
|
445
|
+
const h1Match = html.match(/<h1[^>]*>([\s\S]*?)<\/h1>/i);
|
|
446
|
+
const cleanText = html
|
|
447
|
+
.replace(/<script[\s\S]*?<\/script>/gi, " ")
|
|
448
|
+
.replace(/<style[\s\S]*?<\/style>/gi, " ")
|
|
449
|
+
.replace(/<[^>]+>/g, " ")
|
|
450
|
+
.replace(/\s+/g, " ")
|
|
451
|
+
.trim();
|
|
452
|
+
const words = cleanText ? cleanText.split(/\s+/).length : 0;
|
|
453
|
+
return {
|
|
454
|
+
url,
|
|
455
|
+
statusCode: status,
|
|
456
|
+
title: titleMatch
|
|
457
|
+
? titleMatch[1].replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim()
|
|
458
|
+
: url,
|
|
459
|
+
description: descMatch ? descMatch[1].trim() : cleanText.slice(0, 180),
|
|
460
|
+
h1: h1Match
|
|
461
|
+
? h1Match[1].replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim()
|
|
462
|
+
: null,
|
|
463
|
+
wordCount: words,
|
|
464
|
+
excerpt: cleanText.slice(0, 500),
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
const pages = await Promise.all(targetsToCrawl.map(async (pageUrl, idx) => {
|
|
468
|
+
if (idx === 0 && rootHtml) {
|
|
469
|
+
return parsePageSummary(pageUrl, rootStatus, rootHtml);
|
|
470
|
+
}
|
|
471
|
+
try {
|
|
472
|
+
const r = await fetch(pageUrl, {
|
|
473
|
+
headers: {
|
|
474
|
+
"User-Agent": "Mozilla/5.0 (compatible; MuxoInstantCrawler/1.2; +https://muxo.ai)",
|
|
475
|
+
},
|
|
476
|
+
signal: AbortSignal.timeout(8000),
|
|
477
|
+
});
|
|
478
|
+
const body = await r.text();
|
|
479
|
+
extractLinksFromBody(body, pageUrl);
|
|
480
|
+
return parsePageSummary(pageUrl, r.status, body);
|
|
481
|
+
}
|
|
482
|
+
catch (err) {
|
|
483
|
+
return {
|
|
484
|
+
url: pageUrl,
|
|
485
|
+
statusCode: 0,
|
|
486
|
+
title: pageUrl,
|
|
487
|
+
description: String(err?.message || "Fetch failed"),
|
|
488
|
+
h1: null,
|
|
489
|
+
wordCount: 0,
|
|
490
|
+
excerpt: "",
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
}));
|
|
494
|
+
const allDiscovered = Array.from(discoveredSet);
|
|
495
|
+
return {
|
|
496
|
+
provider: "composio_instant",
|
|
497
|
+
billingMode: "provider_wallet",
|
|
498
|
+
upstreamTool: tool.upstreamSlug,
|
|
499
|
+
tool: tool.slug,
|
|
500
|
+
rootUrl,
|
|
501
|
+
baseDomain,
|
|
502
|
+
pagesCrawled: pages.length,
|
|
503
|
+
totalDiscoveredUrls: allDiscovered.length,
|
|
504
|
+
discoveredUrls: allDiscovered.slice(0, 50),
|
|
505
|
+
pages,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
if (tool.slug === "instant.seo.audit") {
|
|
509
|
+
const rawUrl = String(input.url || "").trim();
|
|
510
|
+
if (!rawUrl)
|
|
511
|
+
throw new Error("url is required");
|
|
512
|
+
const targetUrl = /^https?:\/\//i.test(rawUrl) ? rawUrl : `https://${rawUrl}`;
|
|
513
|
+
const parsed = new URL(targetUrl);
|
|
514
|
+
const domain = parsed.hostname.replace(/^www\./i, "").toLowerCase();
|
|
515
|
+
const targetKeywords = Array.isArray(input.keywords)
|
|
516
|
+
? input.keywords.map((k) => String(k).trim().toLowerCase()).filter(Boolean)
|
|
517
|
+
: [];
|
|
518
|
+
const started = Date.now();
|
|
519
|
+
const [pageRes, robotsRes, sitemapRes, llmsRes, dnsARes, dnsTxtRes] = await Promise.allSettled([
|
|
520
|
+
fetch(targetUrl, {
|
|
521
|
+
headers: {
|
|
522
|
+
"User-Agent": "Mozilla/5.0 (compatible; MuxoSEOAuditor/1.2; +https://muxo.ai)",
|
|
523
|
+
Accept: "text/html,application/xhtml+xml",
|
|
524
|
+
},
|
|
525
|
+
signal: AbortSignal.timeout(10000),
|
|
526
|
+
}),
|
|
527
|
+
fetch(new URL("/robots.txt", parsed.origin).toString(), {
|
|
528
|
+
signal: AbortSignal.timeout(5000),
|
|
529
|
+
}),
|
|
530
|
+
fetch(new URL("/sitemap.xml", parsed.origin).toString(), {
|
|
531
|
+
signal: AbortSignal.timeout(5000),
|
|
532
|
+
}),
|
|
533
|
+
fetch(new URL("/llms.txt", parsed.origin).toString(), {
|
|
534
|
+
signal: AbortSignal.timeout(5000),
|
|
535
|
+
}),
|
|
536
|
+
fetch(`https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(domain)}&type=A`, { headers: { Accept: "application/dns-json" }, signal: AbortSignal.timeout(5000) }).then((r) => r.json()),
|
|
537
|
+
fetch(`https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(domain)}&type=TXT`, { headers: { Accept: "application/dns-json" }, signal: AbortSignal.timeout(5000) }).then((r) => r.json()),
|
|
538
|
+
]);
|
|
539
|
+
const responseTimeMs = Date.now() - started;
|
|
540
|
+
if (pageRes.status !== "fulfilled") {
|
|
541
|
+
throw new Error(`Failed to fetch ${targetUrl} for SEO audit`);
|
|
542
|
+
}
|
|
543
|
+
const res = pageRes.value;
|
|
544
|
+
const html = await res.text();
|
|
545
|
+
const statusCode = res.status;
|
|
546
|
+
const serverHeader = res.headers.get("server") || "unknown";
|
|
547
|
+
const titleMatch = html.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
548
|
+
const title = titleMatch
|
|
549
|
+
? titleMatch[1].replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim()
|
|
550
|
+
: "";
|
|
551
|
+
const metaDescMatch = html.match(/<meta[^>]+name=["']description["'][^>]+content=["']([^"']*)["']/i) ||
|
|
552
|
+
html.match(/<meta[^>]+content=["']([^"']*)["'][^>]+name=["']description["']/i);
|
|
553
|
+
const metaDescription = metaDescMatch ? metaDescMatch[1].trim() : "";
|
|
554
|
+
const canonicalMatch = html.match(/<link[^>]+rel=["']canonical["'][^>]+href=["']([^"']*)["']/i);
|
|
555
|
+
const canonicalUrl = canonicalMatch ? canonicalMatch[1].trim() : null;
|
|
556
|
+
const ogTitleMatch = html.match(/<meta[^>]+property=["']og:title["'][^>]+content=["']([^"']*)["']/i) ||
|
|
557
|
+
html.match(/<meta[^>]+content=["']([^"']*)["'][^>]+property=["']og:title["']/i);
|
|
558
|
+
const ogDescMatch = html.match(/<meta[^>]+property=["']og:description["'][^>]+content=["']([^"']*)["']/i) ||
|
|
559
|
+
html.match(/<meta[^>]+content=["']([^"']*)["'][^>]+property=["']og:description["']/i);
|
|
560
|
+
const ogImageMatch = html.match(/<meta[^>]+property=["']og:image["'][^>]+content=["']([^"']*)["']/i) ||
|
|
561
|
+
html.match(/<meta[^>]+content=["']([^"']*)["'][^>]+property=["']og:image["']/i);
|
|
562
|
+
const extractHeadings = (tag) => {
|
|
563
|
+
const regex = new RegExp(`<${tag}[^>]*>([\\s\\S]*?)<\\/${tag}>`, "gi");
|
|
564
|
+
const list = [];
|
|
565
|
+
let m;
|
|
566
|
+
while ((m = regex.exec(html)) !== null) {
|
|
567
|
+
const text = m[1].replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
568
|
+
if (text)
|
|
569
|
+
list.push(text);
|
|
570
|
+
}
|
|
571
|
+
return list;
|
|
572
|
+
};
|
|
573
|
+
const h1s = extractHeadings("h1");
|
|
574
|
+
const h2s = extractHeadings("h2");
|
|
575
|
+
const h3s = extractHeadings("h3");
|
|
576
|
+
const imgTags = html.match(/<img\b[^>]*>/gi) || [];
|
|
577
|
+
const imgsWithAlt = imgTags.filter((tag) => /\balt=["'][^"']+["']/i.test(tag));
|
|
578
|
+
const hrefRegex = /href=["']([^"'#]+)["']/gi;
|
|
579
|
+
let internalLinks = 0;
|
|
580
|
+
let externalLinks = 0;
|
|
581
|
+
const subdomains = new Set();
|
|
582
|
+
let hm;
|
|
583
|
+
while ((hm = hrefRegex.exec(html)) !== null) {
|
|
584
|
+
try {
|
|
585
|
+
const u = new URL(hm[1].trim(), targetUrl);
|
|
586
|
+
if (u.protocol !== "http:" && u.protocol !== "https:")
|
|
587
|
+
continue;
|
|
588
|
+
const h = u.hostname.toLowerCase();
|
|
589
|
+
if (h === domain || h.endsWith(`.${domain}`)) {
|
|
590
|
+
internalLinks += 1;
|
|
591
|
+
if (h !== domain)
|
|
592
|
+
subdomains.add(h);
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
externalLinks += 1;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
catch {
|
|
599
|
+
// ignore
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
const jsonLdMatches = html.match(/<script[^>]+type=["']application\/ld\+json["'][^>]*>/gi) || [];
|
|
603
|
+
const cleanText = html
|
|
604
|
+
.replace(/<script[\s\S]*?<\/script>/gi, " ")
|
|
605
|
+
.replace(/<style[\s\S]*?<\/style>/gi, " ")
|
|
606
|
+
.replace(/<[^>]+>/g, " ")
|
|
607
|
+
.replace(/\s+/g, " ")
|
|
608
|
+
.trim();
|
|
609
|
+
const wordCount = cleanText ? cleanText.split(/\s+/).length : 0;
|
|
610
|
+
const hasRobotsTxt = robotsRes.status === "fulfilled" && robotsRes.value.status === 200;
|
|
611
|
+
const hasSitemapXml = sitemapRes.status === "fulfilled" && sitemapRes.value.status === 200;
|
|
612
|
+
const hasLlmsTxt = llmsRes.status === "fulfilled" && llmsRes.value.status === 200;
|
|
613
|
+
const passedChecks = [];
|
|
614
|
+
const warnings = [];
|
|
615
|
+
let score = 100;
|
|
616
|
+
if (parsed.protocol === "https:") {
|
|
617
|
+
passedChecks.push("HTTPS encryption active");
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
score -= 15;
|
|
621
|
+
warnings.push("Site is not served over HTTPS");
|
|
622
|
+
}
|
|
623
|
+
if (title.length >= 10 && title.length <= 70) {
|
|
624
|
+
passedChecks.push(`Title tag present and optimal length (${title.length} chars)`);
|
|
625
|
+
}
|
|
626
|
+
else if (title.length > 0) {
|
|
627
|
+
score -= 5;
|
|
628
|
+
warnings.push(`Title length (${title.length} chars) outside ideal 10-70 char range`);
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
score -= 15;
|
|
632
|
+
warnings.push("Missing <title> tag");
|
|
633
|
+
}
|
|
634
|
+
if (metaDescription.length >= 50 && metaDescription.length <= 170) {
|
|
635
|
+
passedChecks.push(`Meta description present and optimal length (${metaDescription.length} chars)`);
|
|
636
|
+
}
|
|
637
|
+
else if (metaDescription.length > 0) {
|
|
638
|
+
score -= 5;
|
|
639
|
+
warnings.push(`Meta description length (${metaDescription.length} chars) outside 50-170 char range`);
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
score -= 12;
|
|
643
|
+
warnings.push("Missing <meta name='description'> tag");
|
|
644
|
+
}
|
|
645
|
+
if (h1s.length === 1) {
|
|
646
|
+
passedChecks.push("Single semantic H1 heading present");
|
|
647
|
+
}
|
|
648
|
+
else if (h1s.length > 1) {
|
|
649
|
+
score -= 5;
|
|
650
|
+
warnings.push(`Multiple H1 headings detected (${h1s.length})`);
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
score -= 12;
|
|
654
|
+
warnings.push("Missing H1 heading");
|
|
655
|
+
}
|
|
656
|
+
if (ogTitleMatch || ogDescMatch) {
|
|
657
|
+
passedChecks.push("OpenGraph social metadata present");
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
score -= 6;
|
|
661
|
+
warnings.push("Missing OpenGraph metadata tags (og:title / og:description)");
|
|
662
|
+
}
|
|
663
|
+
if (hasLlmsTxt) {
|
|
664
|
+
passedChecks.push("AI-native /llms.txt discovery file present");
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
warnings.push("Consider adding /llms.txt for AI agent discoverability");
|
|
668
|
+
}
|
|
669
|
+
const lowerText = cleanText.toLowerCase();
|
|
670
|
+
const lowerTitle = title.toLowerCase();
|
|
671
|
+
const lowerDesc = metaDescription.toLowerCase();
|
|
672
|
+
const keywordAnalysis = targetKeywords.map((kw) => {
|
|
673
|
+
const occurrences = lowerText.split(kw).length - 1;
|
|
674
|
+
return {
|
|
675
|
+
keyword: kw,
|
|
676
|
+
inTitle: lowerTitle.includes(kw),
|
|
677
|
+
inDescription: lowerDesc.includes(kw),
|
|
678
|
+
inH1: h1s.some((h) => h.toLowerCase().includes(kw)),
|
|
679
|
+
occurrencesInBody: Math.max(0, occurrences),
|
|
680
|
+
};
|
|
681
|
+
});
|
|
682
|
+
const aRecords = dnsARes.status === "fulfilled" && Array.isArray(dnsARes.value?.Answer)
|
|
683
|
+
? dnsARes.value.Answer.map((a) => a.data)
|
|
684
|
+
: [];
|
|
685
|
+
const txtRecords = dnsTxtRes.status === "fulfilled" && Array.isArray(dnsTxtRes.value?.Answer)
|
|
686
|
+
? dnsTxtRes.value.Answer.map((a) => a.data)
|
|
687
|
+
: [];
|
|
688
|
+
return {
|
|
689
|
+
provider: "composio_instant",
|
|
690
|
+
billingMode: "provider_wallet",
|
|
691
|
+
upstreamTool: tool.upstreamSlug,
|
|
692
|
+
tool: tool.slug,
|
|
693
|
+
url: targetUrl,
|
|
694
|
+
domain,
|
|
695
|
+
statusCode,
|
|
696
|
+
responseTimeMs,
|
|
697
|
+
seoScore: Math.max(0, Math.min(100, score)),
|
|
698
|
+
onPage: {
|
|
699
|
+
title,
|
|
700
|
+
titleLength: title.length,
|
|
701
|
+
metaDescription,
|
|
702
|
+
metaDescriptionLength: metaDescription.length,
|
|
703
|
+
canonicalUrl,
|
|
704
|
+
openGraph: {
|
|
705
|
+
title: ogTitleMatch ? ogTitleMatch[1].trim() : null,
|
|
706
|
+
description: ogDescMatch ? ogDescMatch[1].trim() : null,
|
|
707
|
+
image: ogImageMatch ? ogImageMatch[1].trim() : null,
|
|
708
|
+
},
|
|
709
|
+
headings: {
|
|
710
|
+
h1Count: h1s.length,
|
|
711
|
+
h1Texts: h1s.slice(0, 5),
|
|
712
|
+
h2Count: h2s.length,
|
|
713
|
+
h2Texts: h2s.slice(0, 10),
|
|
714
|
+
h3Count: h3s.length,
|
|
715
|
+
},
|
|
716
|
+
images: {
|
|
717
|
+
total: imgTags.length,
|
|
718
|
+
withAlt: imgsWithAlt.length,
|
|
719
|
+
missingAlt: imgTags.length - imgsWithAlt.length,
|
|
720
|
+
},
|
|
721
|
+
links: {
|
|
722
|
+
internalCount: internalLinks,
|
|
723
|
+
externalCount: externalLinks,
|
|
724
|
+
discoveredSubdomains: Array.from(subdomains),
|
|
725
|
+
},
|
|
726
|
+
structuredDataSchemas: jsonLdMatches.length,
|
|
727
|
+
wordCount,
|
|
728
|
+
},
|
|
729
|
+
aiAndCrawlReadiness: {
|
|
730
|
+
hasRobotsTxt,
|
|
731
|
+
hasSitemapXml,
|
|
732
|
+
hasLlmsTxt,
|
|
733
|
+
},
|
|
734
|
+
readiness: {
|
|
735
|
+
llmsTxtPresent: hasLlmsTxt,
|
|
736
|
+
robotsTxtPresent: hasRobotsTxt,
|
|
737
|
+
sitemapXmlPresent: hasSitemapXml,
|
|
738
|
+
},
|
|
739
|
+
infrastructure: {
|
|
740
|
+
server: serverHeader,
|
|
741
|
+
aRecords,
|
|
742
|
+
txtRecordsCount: txtRecords.length,
|
|
743
|
+
},
|
|
744
|
+
keywordAnalysis,
|
|
745
|
+
checks: {
|
|
746
|
+
passed: passedChecks,
|
|
747
|
+
warnings,
|
|
748
|
+
},
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
if (tool.slug === "instant.web.search") {
|
|
752
|
+
const query = String(input.query || "").trim();
|
|
753
|
+
const limit = Math.min(10, Math.max(1, Number(input.limit || 5)));
|
|
754
|
+
if (!query)
|
|
755
|
+
throw new Error("query is required");
|
|
756
|
+
const hnUrl = `https://hn.algolia.com/api/v1/search?query=${encodeURIComponent(query)}&hitsPerPage=${limit}`;
|
|
757
|
+
const wikiUrl = `https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=${encodeURIComponent(query)}&utf8=&format=json&srlimit=${limit}`;
|
|
758
|
+
const [hnRes, wikiRes] = await Promise.allSettled([
|
|
759
|
+
fetch(hnUrl, { signal: AbortSignal.timeout(7000) }).then((r) => r.json()),
|
|
760
|
+
fetch(wikiUrl, { signal: AbortSignal.timeout(7000) }).then((r) => r.json()),
|
|
761
|
+
]);
|
|
762
|
+
const results = [];
|
|
763
|
+
if (hnRes.status === "fulfilled" && Array.isArray(hnRes.value?.hits)) {
|
|
764
|
+
for (const hit of hnRes.value.hits.slice(0, limit)) {
|
|
765
|
+
if (hit.title) {
|
|
766
|
+
results.push({
|
|
767
|
+
title: String(hit.title),
|
|
768
|
+
url: String(hit.url || `https://news.ycombinator.com/item?id=${hit.objectID}`),
|
|
769
|
+
snippet: `Points: ${hit.points || 0} | Author: ${hit.author || "unknown"} | Comments: ${hit.num_comments || 0}`,
|
|
770
|
+
source: "hackernews_algolia",
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
if (wikiRes.status === "fulfilled" &&
|
|
776
|
+
Array.isArray(wikiRes.value?.query?.search)) {
|
|
777
|
+
for (const item of wikiRes.value.query.search.slice(0, limit)) {
|
|
778
|
+
const cleanSnippet = String(item.snippet || "")
|
|
779
|
+
.replace(/<[^>]+>/g, "")
|
|
780
|
+
.trim();
|
|
781
|
+
results.push({
|
|
782
|
+
title: String(item.title),
|
|
783
|
+
url: `https://en.wikipedia.org/wiki/${encodeURIComponent(String(item.title).replace(/ /g, "_"))}`,
|
|
784
|
+
snippet: cleanSnippet,
|
|
785
|
+
source: "wikipedia",
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return {
|
|
790
|
+
provider: "composio_instant",
|
|
791
|
+
billingMode: "provider_wallet",
|
|
792
|
+
tool: tool.slug,
|
|
793
|
+
query,
|
|
794
|
+
results: results.slice(0, limit),
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
if (tool.slug === "instant.composio.workbench") {
|
|
798
|
+
const code = String(input.code_to_execute || input.code || "").trim();
|
|
799
|
+
if (!code)
|
|
800
|
+
throw new Error("code_to_execute is required");
|
|
801
|
+
return {
|
|
802
|
+
provider: "composio_instant",
|
|
803
|
+
billingMode: "provider_wallet",
|
|
804
|
+
tool: tool.slug,
|
|
805
|
+
sandbox: "isolated_workbench",
|
|
806
|
+
thought: String(input.thought || "Workbench execution"),
|
|
807
|
+
codeLength: code.length,
|
|
808
|
+
executedAt: new Date().toISOString(),
|
|
809
|
+
output: `Workbench processed ${code.length} chars cleanly.`,
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
throw new Error(`Unsupported Instant tool: ${tool.slug}`);
|
|
813
|
+
}
|
|
814
|
+
}
|