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,56 @@
|
||||
import type {
|
||||
MillionVerifierGetCreditsParams,
|
||||
MillionVerifierGetCreditsResponse,
|
||||
} from '@/tools/millionverifier/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const getCreditsTool: ToolConfig<
|
||||
MillionVerifierGetCreditsParams,
|
||||
MillionVerifierGetCreditsResponse
|
||||
> = {
|
||||
id: 'millionverifier_get_credits',
|
||||
name: 'MillionVerifier Get Credits',
|
||||
description: 'Retrieve the remaining verification credits for the authenticated account.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'MillionVerifier API Key',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) =>
|
||||
`https://api.millionverifier.com/api/v3/credits?api=${encodeURIComponent(params.apiKey.trim())}`,
|
||||
method: 'GET',
|
||||
headers: () => ({ Accept: 'application/json' }),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json().catch(() => ({}))
|
||||
const errorMessage =
|
||||
typeof data === 'object' && data !== null && typeof data.error === 'string' ? data.error : ''
|
||||
if (!response.ok || errorMessage.length > 0) {
|
||||
return {
|
||||
success: false,
|
||||
error:
|
||||
errorMessage || `MillionVerifier API error: ${response.status} ${response.statusText}`,
|
||||
output: { credits: 0 },
|
||||
}
|
||||
}
|
||||
// The credits endpoint may return either `{ credits }` or a bare number.
|
||||
const raw = typeof data === 'number' ? data : (data.credits ?? 0)
|
||||
const credits = Number(raw)
|
||||
return {
|
||||
success: true,
|
||||
output: { credits: Number.isNaN(credits) ? 0 : credits },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
credits: { type: 'number', description: 'Remaining verification credits' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { ToolHostingConfig } from '@/tools/types'
|
||||
|
||||
/**
|
||||
* Env var prefix for MillionVerifier hosted keys. Provide keys as
|
||||
* `MILLIONVERIFIER_API_KEY_COUNT` plus `MILLIONVERIFIER_API_KEY_1..N`.
|
||||
*/
|
||||
export const MILLIONVERIFIER_API_KEY_PREFIX = 'MILLIONVERIFIER_API_KEY'
|
||||
|
||||
/**
|
||||
* Dollar cost of a single MillionVerifier verification credit. MillionVerifier
|
||||
* charges one credit per email checked; estimated from the bulk credit plans
|
||||
* (≈ $0.0012/credit at volume) — https://millionverifier.com/pricing.
|
||||
*/
|
||||
export const MILLIONVERIFIER_CREDIT_USD = 0.0012
|
||||
|
||||
/**
|
||||
* Build a MillionVerifier `hosting` config. `getCredits` returns the number of
|
||||
* verification credits the call consumed (one per checked email).
|
||||
*/
|
||||
export function millionverifierHosting<P>(
|
||||
getCredits: (params: P, output: Record<string, unknown>) => number
|
||||
): ToolHostingConfig<P> {
|
||||
return {
|
||||
envKeyPrefix: MILLIONVERIFIER_API_KEY_PREFIX,
|
||||
apiKeyParam: 'apiKey',
|
||||
byokProviderId: 'millionverifier',
|
||||
pricing: {
|
||||
type: 'custom',
|
||||
getCost: (params, output) => {
|
||||
const credits = getCredits(params, output)
|
||||
return { cost: credits * MILLIONVERIFIER_CREDIT_USD, metadata: { credits } }
|
||||
},
|
||||
},
|
||||
rateLimit: {
|
||||
mode: 'per_request',
|
||||
// MillionVerifier caps the real-time API at 160/sec per account (~9.6k/min);
|
||||
// 20/sec per workspace stays well under while keeping enrichment fast.
|
||||
requestsPerMinute: 1200,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './types'
|
||||
|
||||
import { getCreditsTool } from '@/tools/millionverifier/get_credits'
|
||||
import { verifyEmailTool } from '@/tools/millionverifier/verify_email'
|
||||
|
||||
export const millionverifierVerifyEmailTool = verifyEmailTool
|
||||
export const millionverifierGetCreditsTool = getCreditsTool
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
export interface MillionVerifierVerifyEmailParams {
|
||||
email: string
|
||||
apiKey: string
|
||||
}
|
||||
|
||||
export interface MillionVerifierVerifyEmailResponse extends ToolResponse {
|
||||
output: {
|
||||
email: string
|
||||
status: string
|
||||
deliverable: boolean
|
||||
freeEmail?: boolean
|
||||
roleAccount?: boolean
|
||||
didYouMean?: string
|
||||
subResult?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface MillionVerifierGetCreditsParams {
|
||||
apiKey: string
|
||||
}
|
||||
|
||||
export interface MillionVerifierGetCreditsResponse extends ToolResponse {
|
||||
output: {
|
||||
credits: number
|
||||
}
|
||||
}
|
||||
|
||||
export type MillionVerifierResponse =
|
||||
| MillionVerifierVerifyEmailResponse
|
||||
| MillionVerifierGetCreditsResponse
|
||||
@@ -0,0 +1,115 @@
|
||||
import { millionverifierHosting } from '@/tools/millionverifier/hosting'
|
||||
import type {
|
||||
MillionVerifierVerifyEmailParams,
|
||||
MillionVerifierVerifyEmailResponse,
|
||||
} from '@/tools/millionverifier/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
/** Maps a MillionVerifier `result` to the shared verification vocabulary. */
|
||||
const STATUS_MAP: Record<string, string> = {
|
||||
ok: 'valid',
|
||||
invalid: 'invalid',
|
||||
catch_all: 'catch_all',
|
||||
disposable: 'disposable',
|
||||
unknown: 'unknown',
|
||||
unverified: 'unverified',
|
||||
}
|
||||
|
||||
export const verifyEmailTool: ToolConfig<
|
||||
MillionVerifierVerifyEmailParams,
|
||||
MillionVerifierVerifyEmailResponse
|
||||
> = {
|
||||
id: 'millionverifier_verify_email',
|
||||
name: 'MillionVerifier Verify Email',
|
||||
description: 'Verify the deliverability of an email address. Uses one verification credit.',
|
||||
version: '1.0.0',
|
||||
|
||||
hosting: millionverifierHosting<MillionVerifierVerifyEmailParams>(() => {
|
||||
// Each verification consumes one MillionVerifier credit.
|
||||
return 1
|
||||
}),
|
||||
|
||||
params: {
|
||||
email: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Email address to verify (e.g., john@example.com)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'MillionVerifier API Key',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) =>
|
||||
`https://api.millionverifier.com/api/v3/?api=${encodeURIComponent(
|
||||
params.apiKey.trim()
|
||||
)}&email=${encodeURIComponent(params.email.trim())}&timeout=10`,
|
||||
method: 'GET',
|
||||
headers: () => ({ Accept: 'application/json' }),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json().catch(() => ({}))
|
||||
const errorMessage =
|
||||
typeof data === 'object' && data !== null && typeof data.error === 'string' ? data.error : ''
|
||||
if (!response.ok || errorMessage.length > 0) {
|
||||
return {
|
||||
success: false,
|
||||
error:
|
||||
errorMessage || `MillionVerifier API error: ${response.status} ${response.statusText}`,
|
||||
output: { email: '', status: '', deliverable: false },
|
||||
}
|
||||
}
|
||||
const result = String(data.result ?? '')
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
email: data.email ?? '',
|
||||
status: STATUS_MAP[result] ?? result,
|
||||
deliverable: result === 'ok',
|
||||
freeEmail: data.free ?? false,
|
||||
roleAccount: data.role ?? false,
|
||||
didYouMean: data.didyoumean ?? '',
|
||||
subResult: data.subresult ?? '',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
email: { type: 'string', description: 'The verified email address' },
|
||||
status: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Verification status (valid, invalid, catch_all, disposable, unknown, unverified)',
|
||||
},
|
||||
deliverable: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the email is valid and safe to send',
|
||||
},
|
||||
freeEmail: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the address is on a free email provider',
|
||||
optional: true,
|
||||
},
|
||||
roleAccount: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the address is a role account (e.g., info@, sales@)',
|
||||
optional: true,
|
||||
},
|
||||
didYouMean: {
|
||||
type: 'string',
|
||||
description: 'Suggested correction for a likely typo',
|
||||
optional: true,
|
||||
},
|
||||
subResult: {
|
||||
type: 'string',
|
||||
description: 'Additional MillionVerifier classification detail',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user