Files
simstudioai--sim/apps/sim/tools/vercel/list_deployments.ts
T
wehub-resource-sync d25d482dc2
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
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

197 lines
6.2 KiB
TypeScript

import type { ToolConfig } from '@/tools/types'
import type {
VercelListDeploymentsParams,
VercelListDeploymentsResponse,
} from '@/tools/vercel/types'
export const vercelListDeploymentsTool: ToolConfig<
VercelListDeploymentsParams,
VercelListDeploymentsResponse
> = {
id: 'vercel_list_deployments',
name: 'Vercel List Deployments',
description: 'List deployments for a Vercel project or team',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Vercel Access Token',
},
projectId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter deployments by project ID or name',
},
target: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by environment: production or staging',
},
state: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Filter by state: BUILDING, ERROR, INITIALIZING, QUEUED, READY, CANCELED, BLOCKED',
},
app: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by deployment name',
},
since: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Get deployments created after this JavaScript timestamp',
},
until: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Get deployments created before this JavaScript timestamp',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of deployments to return per request',
},
teamId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Team ID to scope the request',
},
slug: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Team slug to scope the request (alternative to teamId)',
},
},
request: {
url: (params: VercelListDeploymentsParams) => {
const query = new URLSearchParams()
if (params.projectId) query.set('projectId', params.projectId.trim())
if (params.target) query.set('target', params.target)
if (params.state) query.set('state', params.state)
if (params.app) query.set('app', params.app.trim())
if (params.since) query.set('since', String(params.since))
if (params.until) query.set('until', String(params.until))
if (params.limit) query.set('limit', String(params.limit))
if (params.teamId) query.set('teamId', params.teamId.trim())
if (params.slug) query.set('slug', params.slug.trim())
const qs = query.toString()
return `https://api.vercel.com/v7/deployments${qs ? `?${qs}` : ''}`
},
method: 'GET',
headers: (params: VercelListDeploymentsParams) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
const deployments = (data.deployments ?? []).map((d: any) => ({
uid: d.uid,
name: d.name,
url: d.url ?? null,
state: d.state ?? d.readyState ?? 'UNKNOWN',
target: d.target ?? null,
created: d.created ?? d.createdAt,
projectId: d.projectId ?? '',
source: d.source ?? '',
inspectorUrl: d.inspectorUrl ?? '',
checksState: d.checksState ?? null,
checksConclusion: d.checksConclusion ?? null,
errorMessage: d.errorMessage ?? null,
creator: {
uid: d.creator?.uid ?? '',
email: d.creator?.email ?? '',
username: d.creator?.username ?? '',
},
meta: d.meta ?? {},
}))
return {
success: true,
output: {
deployments,
count: deployments.length,
hasMore: data.pagination?.next != null,
},
}
},
outputs: {
deployments: {
type: 'array',
description: 'List of deployments',
items: {
type: 'object',
properties: {
uid: { type: 'string', description: 'Unique deployment identifier' },
name: { type: 'string', description: 'Deployment name' },
url: { type: 'string', description: 'Deployment URL', optional: true },
state: {
type: 'string',
description:
'Deployment state: BUILDING, ERROR, INITIALIZING, QUEUED, READY, CANCELED, DELETED, BLOCKED',
},
target: { type: 'string', description: 'Target environment', optional: true },
created: { type: 'number', description: 'Creation timestamp' },
projectId: { type: 'string', description: 'Associated project ID' },
source: {
type: 'string',
description:
'Deployment source: api-trigger-git-deploy, cli, clone/repo, git, import, import/repo, redeploy, v0-web',
},
inspectorUrl: { type: 'string', description: 'Vercel inspector URL' },
checksState: {
type: 'string',
description: 'Checks state: completed, registered, running',
optional: true,
},
checksConclusion: {
type: 'string',
description: 'Checks conclusion: succeeded, failed, skipped, canceled',
optional: true,
},
errorMessage: {
type: 'string',
description: 'Deployment error message',
optional: true,
},
creator: {
type: 'object',
description: 'Creator information',
properties: {
uid: { type: 'string', description: 'Creator user ID' },
email: { type: 'string', description: 'Creator email' },
username: { type: 'string', description: 'Creator username' },
},
},
meta: { type: 'object', description: 'Git provider metadata (key-value strings)' },
},
},
},
count: {
type: 'number',
description: 'Number of deployments returned',
},
hasMore: {
type: 'boolean',
description: 'Whether more deployments are available',
},
},
}