chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
import type {
|
||||
ZeroBounceGetCreditsParams,
|
||||
ZeroBounceGetCreditsResponse,
|
||||
} from '@/tools/zerobounce/types'
|
||||
|
||||
export const getCreditsTool: ToolConfig<ZeroBounceGetCreditsParams, ZeroBounceGetCreditsResponse> =
|
||||
{
|
||||
id: 'zerobounce_get_credits',
|
||||
name: 'ZeroBounce Get Credits',
|
||||
description: 'Retrieve the remaining validation credits for the authenticated account.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'ZeroBounce API Key',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) =>
|
||||
`https://api.zerobounce.net/v2/getcredits?api_key=${encodeURIComponent(params.apiKey.trim())}`,
|
||||
method: 'GET',
|
||||
headers: () => ({ Accept: 'application/json' }),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json().catch(() => ({}))
|
||||
// ZeroBounce returns HTTP 200 with an `{ error }` envelope on auth failure,
|
||||
// so detect API-level errors from the body, not just the HTTP status.
|
||||
const errorMessage =
|
||||
typeof data === 'object' && data !== null && typeof data.error === 'string'
|
||||
? data.error
|
||||
: ''
|
||||
if (!response.ok || errorMessage.length > 0) {
|
||||
return {
|
||||
success: false,
|
||||
error: errorMessage || `ZeroBounce API error: ${response.status} ${response.statusText}`,
|
||||
output: { credits: 0 },
|
||||
}
|
||||
}
|
||||
const credits = Number(data.Credits ?? 0)
|
||||
return {
|
||||
success: true,
|
||||
output: { credits: Number.isNaN(credits) ? 0 : credits },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
credits: {
|
||||
type: 'number',
|
||||
description: 'Remaining validation credits (-1 if unavailable)',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { ToolHostingConfig } from '@/tools/types'
|
||||
|
||||
/**
|
||||
* Env var prefix for ZeroBounce hosted keys. Provide keys as
|
||||
* `ZEROBOUNCE_API_KEY_COUNT` plus `ZEROBOUNCE_API_KEY_1..N`.
|
||||
*/
|
||||
export const ZEROBOUNCE_API_KEY_PREFIX = 'ZEROBOUNCE_API_KEY'
|
||||
|
||||
/**
|
||||
* Dollar cost of a single ZeroBounce validation credit. ZeroBounce charges one
|
||||
* credit per email validated; estimated from the volume credit tiers and
|
||||
* rounded up for smaller plans — https://www.zerobounce.net/pricing/.
|
||||
*/
|
||||
export const ZEROBOUNCE_CREDIT_USD = 0.007
|
||||
|
||||
/**
|
||||
* Build a ZeroBounce `hosting` config. `getCredits` returns the number of
|
||||
* validation credits the call consumed (one per validated email).
|
||||
*/
|
||||
export function zerobounceHosting<P>(
|
||||
getCredits: (params: P, output: Record<string, unknown>) => number
|
||||
): ToolHostingConfig<P> {
|
||||
return {
|
||||
envKeyPrefix: ZEROBOUNCE_API_KEY_PREFIX,
|
||||
apiKeyParam: 'apiKey',
|
||||
byokProviderId: 'zerobounce',
|
||||
pricing: {
|
||||
type: 'custom',
|
||||
getCost: (params, output) => {
|
||||
const credits = getCredits(params, output)
|
||||
return { cost: credits * ZEROBOUNCE_CREDIT_USD, metadata: { credits } }
|
||||
},
|
||||
},
|
||||
rateLimit: {
|
||||
mode: 'per_request',
|
||||
// ZeroBounce caps /validate at 80k/10s per key (~480k/min); 20/sec per
|
||||
// workspace leaves large upstream headroom while keeping enrichment fast.
|
||||
requestsPerMinute: 1200,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './types'
|
||||
|
||||
import { getCreditsTool } from '@/tools/zerobounce/get_credits'
|
||||
import { verifyEmailTool } from '@/tools/zerobounce/verify_email'
|
||||
|
||||
export const zerobounceVerifyEmailTool = verifyEmailTool
|
||||
export const zerobounceGetCreditsTool = getCreditsTool
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
export interface ZeroBounceVerifyEmailParams {
|
||||
email: string
|
||||
apiKey: string
|
||||
}
|
||||
|
||||
export interface ZeroBounceVerifyEmailResponse extends ToolResponse {
|
||||
output: {
|
||||
email: string
|
||||
status: string
|
||||
deliverable: boolean
|
||||
subStatus?: string
|
||||
freeEmail?: boolean
|
||||
didYouMean?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface ZeroBounceGetCreditsParams {
|
||||
apiKey: string
|
||||
}
|
||||
|
||||
export interface ZeroBounceGetCreditsResponse extends ToolResponse {
|
||||
output: {
|
||||
credits: number
|
||||
}
|
||||
}
|
||||
|
||||
export type ZeroBounceResponse = ZeroBounceVerifyEmailResponse | ZeroBounceGetCreditsResponse
|
||||
@@ -0,0 +1,105 @@
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
import { zerobounceHosting } from '@/tools/zerobounce/hosting'
|
||||
import type {
|
||||
ZeroBounceVerifyEmailParams,
|
||||
ZeroBounceVerifyEmailResponse,
|
||||
} from '@/tools/zerobounce/types'
|
||||
|
||||
export const verifyEmailTool: ToolConfig<
|
||||
ZeroBounceVerifyEmailParams,
|
||||
ZeroBounceVerifyEmailResponse
|
||||
> = {
|
||||
id: 'zerobounce_verify_email',
|
||||
name: 'ZeroBounce Verify Email',
|
||||
description: 'Validate an email address deliverability in real time. Uses one validation credit.',
|
||||
version: '1.0.0',
|
||||
|
||||
hosting: zerobounceHosting<ZeroBounceVerifyEmailParams>(() => 1),
|
||||
|
||||
params: {
|
||||
email: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Email address to validate (e.g., john@example.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'ZeroBounce API Key',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) =>
|
||||
`https://api.zerobounce.net/v2/validate?api_key=${encodeURIComponent(
|
||||
params.apiKey.trim()
|
||||
)}&email=${encodeURIComponent(params.email.trim())}&ip_address=`,
|
||||
method: 'GET',
|
||||
headers: () => ({ Accept: 'application/json' }),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}))
|
||||
return {
|
||||
success: false,
|
||||
error:
|
||||
(errorData as Record<string, string>).error ||
|
||||
`ZeroBounce API error: ${response.status} ${response.statusText}`,
|
||||
output: { email: '', status: '', deliverable: false },
|
||||
}
|
||||
}
|
||||
const data = await response.json().catch(() => ({}))
|
||||
if (data.error) {
|
||||
return {
|
||||
success: false,
|
||||
error: String(data.error),
|
||||
output: { email: '', status: '', deliverable: false },
|
||||
}
|
||||
}
|
||||
const rawStatus = String(data.status ?? '')
|
||||
// Normalize ZeroBounce's hyphenated 'catch-all' to the shared 'catch_all' vocabulary.
|
||||
const status = rawStatus === 'catch-all' ? 'catch_all' : rawStatus
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
email: data.address ?? '',
|
||||
status,
|
||||
deliverable: rawStatus === 'valid',
|
||||
subStatus: data.sub_status ?? '',
|
||||
freeEmail: data.free_email ?? false,
|
||||
didYouMean: data.did_you_mean ?? '',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
email: { type: 'string', description: 'The validated email address' },
|
||||
status: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Validation status (valid, invalid, catch_all, unknown, spamtrap, abuse, do_not_mail)',
|
||||
},
|
||||
deliverable: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the email is valid and safe to send',
|
||||
},
|
||||
subStatus: {
|
||||
type: 'string',
|
||||
description: 'Detailed sub-status from ZeroBounce',
|
||||
optional: true,
|
||||
},
|
||||
freeEmail: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the address is on a free email provider',
|
||||
optional: true,
|
||||
},
|
||||
didYouMean: {
|
||||
type: 'string',
|
||||
description: 'Suggested correction for a likely typo',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user