Files
simstudioai--sim/apps/sim/tools/codepipeline/get_pipeline_state.ts
T
wehub-resource-sync d25d482dc2
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) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

120 lines
3.4 KiB
TypeScript

import type {
CodePipelineGetPipelineStateParams,
CodePipelineGetPipelineStateResponse,
} from '@/tools/codepipeline/types'
import type { ToolConfig } from '@/tools/types'
export const getPipelineStateTool: ToolConfig<
CodePipelineGetPipelineStateParams,
CodePipelineGetPipelineStateResponse
> = {
id: 'codepipeline_get_pipeline_state',
name: 'CodePipeline Get Pipeline State',
description:
'Get the current state of a CodePipeline pipeline, including stage and action status and pending approval tokens',
version: '1.0.0',
params: {
awsRegion: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AWS region (e.g., us-east-1)',
},
awsAccessKeyId: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AWS access key ID',
},
awsSecretAccessKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AWS secret access key',
},
pipelineName: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Name of the pipeline',
},
},
request: {
url: '/api/tools/codepipeline/get-pipeline-state',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
region: params.awsRegion,
accessKeyId: params.awsAccessKeyId,
secretAccessKey: params.awsSecretAccessKey,
pipelineName: params.pipelineName,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.error || 'Failed to get CodePipeline pipeline state')
}
return {
success: true,
output: {
pipelineName: data.output.pipelineName,
pipelineVersion: data.output.pipelineVersion,
created: data.output.created,
updated: data.output.updated,
stageStates: data.output.stageStates,
},
}
},
outputs: {
pipelineName: { type: 'string', description: 'Pipeline name' },
pipelineVersion: { type: 'number', description: 'Pipeline version number', optional: true },
created: {
type: 'number',
description: 'Epoch ms when the pipeline was created',
optional: true,
},
updated: {
type: 'number',
description: 'Epoch ms when the pipeline was last updated',
optional: true,
},
stageStates: {
type: 'array',
description: 'Per-stage state including latest execution status and action details',
items: {
type: 'object',
properties: {
stageName: { type: 'string', description: 'Stage name' },
status: {
type: 'string',
description:
'Latest stage execution status (InProgress, Succeeded, Failed, Stopped, Cancelled)',
},
pipelineExecutionId: {
type: 'string',
description: 'Pipeline execution ID currently in the stage',
},
inboundTransitionEnabled: {
type: 'boolean',
description: 'Whether the inbound transition into the stage is enabled',
},
actionStates: {
type: 'array',
description:
'Per-action state with status, summary, error details, and approval token (for pending manual approvals)',
},
},
},
},
},
}