Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/release-notification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

name: Release Notification

on:
release:
types: [published] # Trigger on new releases being published

jobs:
slack_notification:
runs-on: ubuntu-latest
steps:
- name: Send Release Details to Slack
uses: slackapi/slack-github-action@v1.23.0 # Or the latest version of this action
with:
payload: |
{
"release_name": "${{ github.event.release.name }}",
"tag_name": "${{ github.event.release.tag_name }}",
"release_url": "${{ github.event.release.html_url }}",
"author_name": "${{ github.event.release.author.login }}",
"repository_name": "${{ github.event.repository.name }}",
"repository_url": "${{ github.event.repository.html_url }}",
"release_description": ${{ toJSON(github.event.release.body) }}
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # Use the secret for the webhook URL
Comment on lines +10 to +26

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
10 changes: 10 additions & 0 deletions crates/chat-cli/src/api_client/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use amzn_codewhisperer_client::operation::create_subscription_token::CreateSubscriptionTokenError;
use amzn_codewhisperer_client::operation::generate_completions::GenerateCompletionsError;
use amzn_codewhisperer_client::operation::get_profile::GetProfileError;
use amzn_codewhisperer_client::operation::list_available_customizations::ListAvailableCustomizationsError;
use amzn_codewhisperer_client::operation::list_available_models::ListAvailableModelsError;
use amzn_codewhisperer_client::operation::list_available_profiles::ListAvailableProfilesError;
Expand Down Expand Up @@ -100,6 +101,9 @@ pub enum ApiClientError {

#[error("No default model found in the ListAvailableModels API response")]
DefaultModelNotFound,

#[error(transparent)]
GetProfileError(#[from] SdkError<GetProfileError, HttpResponse>),
}

impl ApiClientError {
Expand All @@ -125,6 +129,7 @@ impl ApiClientError {
Self::Credentials(_e) => None,
Self::ListAvailableModelsError(e) => sdk_status_code(e),
Self::DefaultModelNotFound => None,
Self::GetProfileError(e) => sdk_status_code(e),
}
}
}
Expand Down Expand Up @@ -152,6 +157,7 @@ impl ReasonCode for ApiClientError {
Self::Credentials(_) => "CredentialsError".to_string(),
Self::ListAvailableModelsError(e) => sdk_error_code(e),
Self::DefaultModelNotFound => "DefaultModelNotFound".to_string(),
Self::GetProfileError(e) => sdk_error_code(e),
}
}
}
Expand Down Expand Up @@ -199,6 +205,10 @@ mod tests {
ListAvailableCustomizationsError::unhandled("<unhandled>"),
response(),
)),
ApiClientError::GetProfileError(SdkError::service_error(
GetProfileError::unhandled("<unhandled>"),
response(),
)),
ApiClientError::ListAvailableModelsError(SdkError::service_error(
ListAvailableModelsError::unhandled("<unhandled>"),
response(),
Expand Down
16 changes: 16 additions & 0 deletions crates/chat-cli/src/api_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use amzn_codewhisperer_client::operation::create_subscription_token::CreateSubsc
use amzn_codewhisperer_client::types::Origin::Cli;
use amzn_codewhisperer_client::types::{
Model,
OptInFeatureToggle,
OptOutPreference,
SubscriptionStatus,
TelemetryEvent,
Expand Down Expand Up @@ -334,6 +335,21 @@ impl ApiClient {
Ok(res)
}

pub async fn is_mcp_enabled(&self) -> Result<bool, ApiClientError> {
let request = self
.client
.get_profile()
.set_profile_arn(self.profile.as_ref().map(|p| p.arn.clone()));

let response = request.send().await?;
let mcp_enabled = response
.profile()
.opt_in_features()
.and_then(|features| features.mcp_configuration())
.is_none_or(|config| matches!(config.toggle(), OptInFeatureToggle::On));
Ok(mcp_enabled)
}

pub async fn create_subscription_token(&self) -> Result<CreateSubscriptionTokenOutput, ApiClientError> {
if cfg!(test) {
return Ok(CreateSubscriptionTokenOutput::builder()
Expand Down
Loading
Loading