(
params: { workflowId?: string; versionDescription?: string; versionName?: string },
context: ExecutionContext
)
| 763 | } |
| 764 | |
| 765 | export async function executeRedeploy( |
| 766 | params: { workflowId?: string; versionDescription?: string; versionName?: string }, |
| 767 | context: ExecutionContext |
| 768 | ): Promise<ToolCallResult> { |
| 769 | try { |
| 770 | const workflowId = params.workflowId || context.workflowId |
| 771 | if (!workflowId) { |
| 772 | return { success: false, error: 'workflowId is required' } |
| 773 | } |
| 774 | const versionDescription = params.versionDescription?.trim() |
| 775 | if (!versionDescription) { |
| 776 | return { |
| 777 | success: false, |
| 778 | error: |
| 779 | 'versionDescription is required. Provide a concise summary of what changed in this deployment version (call diff_workflows with ref1 "live" and ref2 "draft" if unsure what changed).', |
| 780 | } |
| 781 | } |
| 782 | const versionName = params.versionName?.trim() |
| 783 | if (!versionName) { |
| 784 | return { |
| 785 | success: false, |
| 786 | error: |
| 787 | 'versionName is required. Provide a short human-readable label for this deployment version.', |
| 788 | } |
| 789 | } |
| 790 | await ensureWorkflowAccess(workflowId, context.userId, 'admin') |
| 791 | |
| 792 | const result = await performFullDeploy({ |
| 793 | workflowId, |
| 794 | userId: context.userId, |
| 795 | versionDescription, |
| 796 | versionName, |
| 797 | }) |
| 798 | if (!result.success) { |
| 799 | return { success: false, error: result.error || 'Failed to redeploy workflow' } |
| 800 | } |
| 801 | const baseUrl = getBaseUrl() |
| 802 | const apiEndpoint = buildWorkflowApiEndpoint(baseUrl, workflowId) |
| 803 | const apiConfig = buildWorkflowApiConfig(baseUrl, apiEndpoint) |
| 804 | const apiExamples = buildWorkflowApiExamples(baseUrl, apiEndpoint) |
| 805 | return { |
| 806 | success: true, |
| 807 | output: { |
| 808 | workflowId, |
| 809 | isDeployed: true, |
| 810 | deployedAt: result.deployedAt || null, |
| 811 | version: result.version, |
| 812 | apiEndpoint, |
| 813 | baseUrl, |
| 814 | deploymentType: 'api', |
| 815 | deploymentStatus: { |
| 816 | api: { |
| 817 | isDeployed: true, |
| 818 | endpoint: apiEndpoint, |
| 819 | deployedAt: result.deployedAt || null, |
| 820 | version: result.version, |
| 821 | }, |
| 822 | }, |
nothing calls this directly
no test coverage detected