Files
simstudioai--sim/apps/sim/tools/trigger_dev/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

123 lines
3.6 KiB
TypeScript

import type {
TriggerDevListDeploymentsParams,
TriggerDevListDeploymentsResponse,
} from '@/tools/trigger_dev/types'
import {
buildTriggerDevHeaders,
mapTriggerDevDeployment,
TRIGGER_DEV_API_BASE,
TRIGGER_DEV_DEPLOYMENT_PROPERTIES,
} from '@/tools/trigger_dev/utils'
import type { ToolConfig } from '@/tools/types'
export const triggerDevListDeploymentsTool: ToolConfig<
TriggerDevListDeploymentsParams,
TriggerDevListDeploymentsResponse
> = {
id: 'trigger_dev_list_deployments',
name: 'Trigger.dev List Deployments',
description:
'List Trigger.dev deployments in the environment of the API key, with optional status and creation-time filters.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Trigger.dev secret API key (starts with tr_)',
},
status: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Deployment status to filter by: PENDING, BUILDING, DEPLOYING, DEPLOYED, FAILED, CANCELED, or TIMED_OUT',
},
period: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return deployments created in the given period (e.g., "1h", "7d")',
},
from: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return deployments created on or after this ISO 8601 timestamp',
},
to: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return deployments created on or before this ISO 8601 timestamp',
},
pageSize: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of deployments per page (5 to 100, default 20)',
},
pageAfter: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Cursor to start the page after, from the previous response pagination',
},
},
request: {
url: (params) => {
const query = new URLSearchParams()
if (params.pageSize) query.set('page[size]', String(params.pageSize))
if (params.pageAfter) query.set('page[after]', params.pageAfter)
if (params.status) query.set('status', params.status.toUpperCase())
if (params.period) query.set('period', params.period)
if (params.from) query.set('from', params.from)
if (params.to) query.set('to', params.to)
const queryString = query.toString()
return queryString
? `${TRIGGER_DEV_API_BASE}/api/v1/deployments?${queryString}`
: `${TRIGGER_DEV_API_BASE}/api/v1/deployments`
},
method: 'GET',
headers: (params) => buildTriggerDevHeaders(params.apiKey),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
deployments: (data.data ?? []).map(mapTriggerDevDeployment),
pagination: {
next: data.pagination?.next ?? null,
},
},
}
},
outputs: {
deployments: {
type: 'array',
description: 'Deployments matching the filters',
items: {
type: 'object',
description: 'Deployment',
properties: TRIGGER_DEV_DEPLOYMENT_PROPERTIES,
},
},
pagination: {
type: 'object',
description: 'Cursor pagination details',
properties: {
next: {
type: 'string',
description: 'Cursor to pass as the page-after parameter for the next page',
nullable: true,
},
},
},
},
}