collab: Add can_use_web_search_tool to LLM token claims (#29278)

This PR adds a `can_use_web_search_tool` field to the LLM token claims.

Currently anyone in the `assistant2` feature flag will have access to
the web search tool.

Co-authored-by: Bennet <bennet@zed.dev>

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-04-23 10:22:18 -04:00 committed by GitHub
parent 4f4bbf264f
commit 266c41ed9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,6 +33,8 @@ pub struct LlmTokenClaims {
pub plan: Plan, pub plan: Plan,
#[serde(default)] #[serde(default)]
pub subscription_period: Option<(NaiveDateTime, NaiveDateTime)>, pub subscription_period: Option<(NaiveDateTime, NaiveDateTime)>,
#[serde(default)]
pub can_use_web_search_tool: bool,
} }
const LLM_TOKEN_LIFETIME: Duration = Duration::from_secs(60 * 60); const LLM_TOKEN_LIFETIME: Duration = Duration::from_secs(60 * 60);
@ -70,6 +72,7 @@ impl LlmTokenClaims {
bypass_account_age_check: feature_flags bypass_account_age_check: feature_flags
.iter() .iter()
.any(|flag| flag == "bypass-account-age-check"), .any(|flag| flag == "bypass-account-age-check"),
can_use_web_search_tool: feature_flags.iter().any(|flag| flag == "assistant2"),
has_llm_subscription: has_legacy_llm_subscription, has_llm_subscription: has_legacy_llm_subscription,
max_monthly_spend_in_cents: billing_preferences max_monthly_spend_in_cents: billing_preferences
.map_or(DEFAULT_MAX_MONTHLY_SPEND.0, |preferences| { .map_or(DEFAULT_MAX_MONTHLY_SPEND.0, |preferences| {