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
158 lines
4.8 KiB
TypeScript
158 lines
4.8 KiB
TypeScript
import type { GetPipelineRunParams, GetPipelineRunResponse } from '@/tools/azure_devops/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const getPipelineRunTool: ToolConfig<GetPipelineRunParams, GetPipelineRunResponse> = {
|
|
id: 'azure_devops_get_pipeline_run',
|
|
name: 'Azure DevOps Get Pipeline Run',
|
|
description:
|
|
'Get details for a specific pipeline run in an Azure DevOps project. Returns run state, result, timestamps, and the pipeline reference.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
organization: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Azure DevOps organization name',
|
|
},
|
|
project: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Azure DevOps project name',
|
|
},
|
|
pipelineId: {
|
|
type: 'number',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'ID of the pipeline',
|
|
},
|
|
runId: {
|
|
type: 'number',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'ID of the run to retrieve',
|
|
},
|
|
accessToken: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Azure DevOps Personal Access Token (scopes: Build: Read, Pipeline: Read)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const url = new URL(
|
|
`https://dev.azure.com/${params.organization.trim()}/${params.project.trim()}/_apis/pipelines/${params.pipelineId}/runs/${params.runId}`
|
|
)
|
|
url.searchParams.set('api-version', '7.2-preview.1')
|
|
return url.toString()
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => ({
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Basic ${btoa(`:${params.accessToken}`)}`,
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response) => {
|
|
const data = await response.json()
|
|
|
|
const run: AzureDevOpsPipelineRunDetailItem = {
|
|
id: data.id,
|
|
name: data.name,
|
|
state: data.state,
|
|
result: data.result,
|
|
createdDate: data.createdDate,
|
|
finishedDate: data.finishedDate,
|
|
url: data.url,
|
|
webUrl: data._links?.web?.href ?? '',
|
|
pipeline: {
|
|
id: data.pipeline?.id,
|
|
name: data.pipeline?.name,
|
|
folder: data.pipeline?.folder ?? '\\',
|
|
revision: data.pipeline?.revision,
|
|
url: data.pipeline?.url ?? '',
|
|
},
|
|
}
|
|
|
|
const resultLine = run.result ? ` | Result: ${run.result}` : ''
|
|
const finishedLine = run.finishedDate ? ` | Finished: ${run.finishedDate}` : ''
|
|
|
|
const content =
|
|
`Run: ${run.name} (ID: ${run.id})\n` +
|
|
`Pipeline: ${run.pipeline.name} (ID: ${run.pipeline.id})\n` +
|
|
`State: ${run.state}${resultLine}\n` +
|
|
`Created: ${run.createdDate}${finishedLine}\n` +
|
|
`Web URL: ${run.webUrl}`
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
content,
|
|
metadata: { run },
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
content: { type: 'string', description: 'Human-readable summary of the pipeline run' },
|
|
metadata: {
|
|
type: 'object',
|
|
description: 'Pipeline run metadata',
|
|
properties: {
|
|
run: {
|
|
type: 'object',
|
|
description: 'Full pipeline run detail object',
|
|
properties: {
|
|
id: { type: 'number', description: 'Run ID' },
|
|
name: { type: 'string', description: 'Run name (e.g. "20210601.1")' },
|
|
state: { type: 'string', description: 'Run state (e.g. "completed", "inProgress")' },
|
|
result: {
|
|
type: 'string',
|
|
description: 'Run result (e.g. "succeeded", "failed") — absent if still running',
|
|
},
|
|
createdDate: { type: 'string', description: 'ISO 8601 creation timestamp' },
|
|
finishedDate: {
|
|
type: 'string',
|
|
description: 'ISO 8601 finish timestamp — absent if still running',
|
|
},
|
|
url: { type: 'string', description: 'Run API URL' },
|
|
webUrl: { type: 'string', description: 'Browser URL for the run' },
|
|
pipeline: {
|
|
type: 'object',
|
|
description: 'Pipeline reference',
|
|
properties: {
|
|
id: { type: 'number', description: 'Pipeline ID' },
|
|
name: { type: 'string', description: 'Pipeline name' },
|
|
folder: { type: 'string', description: 'Pipeline folder' },
|
|
revision: { type: 'number', description: 'Pipeline revision number' },
|
|
url: { type: 'string', description: 'Pipeline API URL' },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
interface AzureDevOpsPipelineRunDetailItem {
|
|
id: number
|
|
name: string
|
|
state: string
|
|
result?: string
|
|
createdDate: string
|
|
finishedDate?: string
|
|
url: string
|
|
webUrl: string
|
|
pipeline: {
|
|
id: number
|
|
name: string
|
|
folder: string
|
|
revision: number
|
|
url: string
|
|
}
|
|
}
|