Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
use crate::{
|
||||
api::object_permissions::OwnerType, error::UserFacingError, request_context::RequestContext,
|
||||
response_context::ResponseContext, scalars::Time, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct ApiKeysVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "APIKeyPropertiesOutput")]
|
||||
pub struct ApiKeyPropertiesOutput {
|
||||
pub api_keys: Vec<ApiKeyProperties>,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "APIKeyProperties")]
|
||||
pub struct ApiKeyProperties {
|
||||
pub uid: cynic::Id,
|
||||
pub name: String,
|
||||
pub key_suffix: String,
|
||||
pub owner_type: OwnerType,
|
||||
pub expires_at: Option<Time>,
|
||||
pub last_used_at: Option<Time>,
|
||||
pub created_at: Time,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[cynic(graphql_type = "APIKeyPropertiesResult")]
|
||||
pub enum ApiKeyPropertiesResult {
|
||||
ApiKeyPropertiesOutput(ApiKeyPropertiesOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "ApiKeysVariables")]
|
||||
pub struct ApiKeys {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub api_keys: ApiKeyPropertiesResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
api_keys(ApiKeysVariables) -> ApiKeys;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
use crate::{
|
||||
error::UserFacingError, full_source_code_embedding::EmbeddingConfig,
|
||||
request_context::RequestContext, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct CodebaseContextConfigVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "CodebaseContextConfigVariables"
|
||||
)]
|
||||
pub struct CodebaseContextConfigQuery {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub codebase_context_config: CodebaseContextConfigResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
codebase_context_config(CodebaseContextConfigVariables) -> CodebaseContextConfigQuery;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct CodebaseContextConfigOutput {
|
||||
pub embedding_cadence: i32,
|
||||
pub embedding_config: EmbeddingConfig,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum CodebaseContextConfigResult {
|
||||
CodebaseContextConfigOutput(CodebaseContextConfigOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
use crate::{
|
||||
api::queries::get_feature_model_choices::FeatureModelChoice, request_context::RequestContext,
|
||||
response_context::ResponseContext, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct FreeAvailableModelsVariables {
|
||||
pub input: FreeAvailableModelsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct FreeAvailableModelsInput {
|
||||
pub referrer: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "FreeAvailableModelsVariables")]
|
||||
pub struct FreeAvailableModels {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
pub free_available_models: FreeAvailableModelsResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
free_available_models(FreeAvailableModelsVariables) -> FreeAvailableModels;
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FreeAvailableModelsResult {
|
||||
FreeAvailableModelsOutput(FreeAvailableModelsOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct FreeAvailableModelsOutput {
|
||||
pub feature_model_choice: FeatureModelChoice,
|
||||
#[allow(dead_code)]
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
use crate::{
|
||||
ai::AIConversationFormat, error::UserFacingError, request_context::RequestContext,
|
||||
response_context::ResponseContext, schema,
|
||||
};
|
||||
|
||||
use super::list_ai_conversations::ListAIConversationsInput;
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetAIConversationFormatVariables {
|
||||
pub input: ListAIConversationsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
/// A minimal fragment that only selects the `format` field from an AIConversation.
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
#[cynic(graphql_type = "AIConversation")]
|
||||
pub struct AIConversationFormatOnly {
|
||||
pub conversation_id: cynic::Id,
|
||||
pub format: AIConversationFormat,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "ListAIConversationsOutput")]
|
||||
pub struct GetAIConversationFormatOutput {
|
||||
pub conversations: Vec<AIConversationFormatOnly>,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[cynic(graphql_type = "ListAIConversationsResult")]
|
||||
pub enum GetAIConversationFormatResult {
|
||||
ListAIConversationsOutput(GetAIConversationFormatOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetAIConversationFormatVariables"
|
||||
)]
|
||||
pub struct GetAIConversationFormat {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
#[cynic(rename = "listAIConversations")]
|
||||
pub list_ai_conversations: GetAIConversationFormatResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
get_ai_conversation_format(GetAIConversationFormatVariables) -> GetAIConversationFormat;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
use crate::{billing::BillingMetadata, request_context::RequestContext, schema};
|
||||
|
||||
/*
|
||||
query GetAiOveragesForWorkspace($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
workspaces {
|
||||
billingMetadata {
|
||||
aiOverages {
|
||||
currentMonthlyRequestCostCents
|
||||
currentMonthlyRequestsUsed
|
||||
currentPeriodEnd
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetAiOveragesForWorkspaceVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub workspaces: Vec<Workspace>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "Workspace")]
|
||||
pub struct Workspace {
|
||||
pub billing_metadata: BillingMetadata,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetAiOveragesForWorkspaceVariables"
|
||||
)]
|
||||
pub struct GetAiOveragesForWorkspace {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_ai_overages_for_workspace(GetAiOveragesForWorkspaceVariables) -> GetAiOveragesForWorkspace;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
use crate::request_context::RequestContext;
|
||||
use crate::scalars::Time;
|
||||
use crate::schema;
|
||||
|
||||
/*
|
||||
query GetBlocksForUser($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
blocks {
|
||||
uid
|
||||
timeStartedTerm
|
||||
command
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetBlocksForUserVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "GetBlocksForUserVariables")]
|
||||
pub struct GetBlocksForUser {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_blocks_for_user(GetBlocksForUserVariables) -> GetBlocksForUser;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub blocks: Vec<Block>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct Block {
|
||||
pub uid: cynic::Id,
|
||||
pub time_started_term: Option<Time>,
|
||||
pub command: Option<String>,
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
use crate::error::UserFacingError;
|
||||
use crate::request_context::RequestContext;
|
||||
use crate::scalars::Time;
|
||||
use crate::schema;
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetCloudEnvironmentsQueryVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetCloudEnvironmentsQueryVariables"
|
||||
)]
|
||||
pub struct GetCloudEnvironmentsQuery {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub get_cloud_environments: GetCloudEnvironmentsResult,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct GetCloudEnvironmentsOutput {
|
||||
pub __typename: String,
|
||||
pub cloud_environments: Vec<CloudEnvironment>,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ResponseContext {
|
||||
pub server_version: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct CloudEnvironment {
|
||||
pub config: CloudEnvironmentConfig,
|
||||
pub last_editor: Option<PublicUserProfile>,
|
||||
pub creator: Option<PublicUserProfile2>,
|
||||
pub last_task_created: Option<AgentTask>,
|
||||
pub last_updated: Time,
|
||||
pub uid: cynic::Id,
|
||||
pub scope: Space,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "AgentTask")]
|
||||
pub struct AgentTask {
|
||||
pub created_at: Time,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct Space {
|
||||
#[cynic(rename = "type")]
|
||||
pub type_: SpaceType,
|
||||
pub uid: cynic::Id,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "PublicUserProfile")]
|
||||
pub struct PublicUserProfile2 {
|
||||
pub uid: String,
|
||||
pub email: Option<String>,
|
||||
pub photo_url: Option<String>,
|
||||
pub display_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct PublicUserProfile {
|
||||
pub uid: String,
|
||||
pub photo_url: Option<String>,
|
||||
pub email: Option<String>,
|
||||
pub display_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct CloudEnvironmentConfig {
|
||||
pub setup_commands: Option<Vec<String>>,
|
||||
pub name: String,
|
||||
pub github_repos: Vec<GitHubRepo>,
|
||||
pub docker_image: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct GitHubRepo {
|
||||
pub repo: String,
|
||||
pub owner: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum GetCloudEnvironmentsResult {
|
||||
UserFacingError(UserFacingError),
|
||||
GetCloudEnvironmentsOutput(GetCloudEnvironmentsOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Clone, Copy, Debug)]
|
||||
pub enum SpaceType {
|
||||
#[cynic(rename = "Team")]
|
||||
Team,
|
||||
#[cynic(rename = "User")]
|
||||
User,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct ClientContext<'a> {
|
||||
pub version: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
#[cynic(graphql_type = "OSContext")]
|
||||
pub struct Oscontext<'a> {
|
||||
pub category: Option<&'a str>,
|
||||
pub linux_kernel_version: Option<&'a str>,
|
||||
pub name: Option<&'a str>,
|
||||
pub version: Option<&'a str>,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
get_cloud_environments(GetCloudEnvironmentsQueryVariables) -> GetCloudEnvironmentsQuery;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
use crate::{
|
||||
error::UserFacingError, object::CloudObjectWithDescendants,
|
||||
object_actions::ObjectActionHistory, request_context::RequestContext,
|
||||
response_context::ResponseContext, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetCloudObjectVariables {
|
||||
pub input: CloudObjectInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "GetCloudObjectVariables")]
|
||||
pub struct GetCloudObject {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
pub cloud_object: CloudObjectResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_cloud_object(GetCloudObjectVariables) -> GetCloudObject;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct CloudObjectOutput {
|
||||
pub object: CloudObjectWithDescendants,
|
||||
pub action_histories: Option<Vec<ObjectActionHistory>>,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CloudObjectResult {
|
||||
CloudObjectOutput(CloudObjectOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct CloudObjectInput {
|
||||
pub uid: cynic::Id,
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{request_context::RequestContext, scalars::Time, schema};
|
||||
|
||||
/*
|
||||
query GetConversationUsage(
|
||||
$requestContext: RequestContext!,
|
||||
$days: Int,
|
||||
$limit: Int,
|
||||
$lastUpdatedEndTimestamp: Time
|
||||
) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
conversationUsage(
|
||||
days: $days,
|
||||
limit: $limit,
|
||||
lastUpdatedEndTimestamp: $lastUpdatedEndTimestamp
|
||||
) {
|
||||
conversationId
|
||||
title
|
||||
lastUpdated
|
||||
usageMetadata {
|
||||
contextWindowUsage
|
||||
creditsSpent
|
||||
summarized
|
||||
tokenUsage { modelId totalTokens }
|
||||
warpTokenUsage { modelId totalTokens tokenUsageByCategory { category tokens } }
|
||||
byokTokenUsage { modelId totalTokens tokenUsageByCategory { category tokens } }
|
||||
toolUsageMetadata {
|
||||
runCommandStats { count }
|
||||
runCommandsExecuted
|
||||
readFilesStats { count }
|
||||
searchCodebaseStats { count }
|
||||
grepStats { count }
|
||||
fileGlobStats { count }
|
||||
callMcpToolStats { count }
|
||||
readMcpResourceStats { count }
|
||||
suggestPlanStats { count }
|
||||
suggestCreatePlanStats { count }
|
||||
writeToLongRunningShellCommandStats { count }
|
||||
applyFileDiffStats { count linesAdded linesRemoved filesChanged }
|
||||
readShellCommandOutputStats { count }
|
||||
useComputerStats { count }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetConversationUsageVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub days: Option<i32>,
|
||||
pub limit: Option<i32>,
|
||||
pub last_updated_end_timestamp: Option<Time>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetConversationUsageVariables"
|
||||
)]
|
||||
pub struct GetConversationUsage {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_conversation_usage_history(GetConversationUsageVariables) -> GetConversationUsage;
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[cynic(variables = "GetConversationUsageVariables")]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "UserOutput",
|
||||
variables = "GetConversationUsageVariables"
|
||||
)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "User", variables = "GetConversationUsageVariables")]
|
||||
pub struct User {
|
||||
#[arguments(
|
||||
days: $days,
|
||||
limit: $limit,
|
||||
lastUpdatedEndTimestamp: $last_updated_end_timestamp
|
||||
)]
|
||||
pub conversation_usage: Vec<ConversationUsage>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ConversationUsage {
|
||||
pub conversation_id: String,
|
||||
pub last_updated: Time,
|
||||
pub title: String,
|
||||
pub usage_metadata: ConversationUsageMetadata,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ConversationUsageMetadata {
|
||||
pub context_window_usage: f64,
|
||||
pub credits_spent: f64,
|
||||
pub summarized: bool,
|
||||
pub token_usage: Vec<ModelTokenUsage>,
|
||||
pub warp_token_usage: Vec<TokenUsage>,
|
||||
pub byok_token_usage: Vec<TokenUsage>,
|
||||
pub tool_usage_metadata: ToolUsageMetadata,
|
||||
}
|
||||
|
||||
fn convert_token_usage(
|
||||
warp_token_usage: &[TokenUsage],
|
||||
byok_token_usage: &[TokenUsage],
|
||||
) -> Vec<persistence::model::ModelTokenUsage> {
|
||||
let mut usage_by_model: HashMap<String, persistence::model::ModelTokenUsage> = HashMap::new();
|
||||
|
||||
for usage in warp_token_usage {
|
||||
let entry = usage_by_model
|
||||
.entry(usage.model_id.clone())
|
||||
.or_insert_with(|| persistence::model::ModelTokenUsage {
|
||||
model_id: usage.model_id.clone(),
|
||||
..Default::default()
|
||||
});
|
||||
entry.warp_tokens += u32::try_from(usage.total_tokens).unwrap_or_default();
|
||||
for category_breakdown in &usage.token_usage_by_category {
|
||||
*entry
|
||||
.warp_token_usage_by_category
|
||||
.entry(category_breakdown.category.clone())
|
||||
.or_default() += u32::try_from(category_breakdown.tokens).unwrap_or_default();
|
||||
}
|
||||
}
|
||||
|
||||
for usage in byok_token_usage {
|
||||
let entry = usage_by_model
|
||||
.entry(usage.model_id.clone())
|
||||
.or_insert_with(|| persistence::model::ModelTokenUsage {
|
||||
model_id: usage.model_id.clone(),
|
||||
..Default::default()
|
||||
});
|
||||
entry.byok_tokens += u32::try_from(usage.total_tokens).unwrap_or_default();
|
||||
for category_breakdown in &usage.token_usage_by_category {
|
||||
*entry
|
||||
.byok_token_usage_by_category
|
||||
.entry(category_breakdown.category.clone())
|
||||
.or_default() += u32::try_from(category_breakdown.tokens).unwrap_or_default();
|
||||
}
|
||||
}
|
||||
|
||||
let mut result: Vec<_> = usage_by_model.into_values().collect();
|
||||
result.sort_by(|a, b| a.model_id.cmp(&b.model_id));
|
||||
result
|
||||
}
|
||||
|
||||
impl From<&ConversationUsageMetadata> for persistence::model::ConversationUsageMetadata {
|
||||
fn from(gql: &ConversationUsageMetadata) -> Self {
|
||||
Self {
|
||||
was_summarized: gql.summarized,
|
||||
context_window_usage: gql.context_window_usage as f32,
|
||||
credits_spent: gql.credits_spent as f32,
|
||||
credits_spent_for_last_block: None,
|
||||
token_usage: convert_token_usage(&gql.warp_token_usage, &gql.byok_token_usage),
|
||||
tool_usage_metadata: (&gql.tool_usage_metadata).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ModelTokenUsage {
|
||||
pub model_id: String,
|
||||
pub total_tokens: i32,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct TokenUsage {
|
||||
pub model_id: String,
|
||||
pub total_tokens: i32,
|
||||
pub token_usage_by_category: Vec<CategoryTokenBreakdown>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct CategoryTokenBreakdown {
|
||||
pub category: String,
|
||||
pub tokens: i32,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ToolCallStats {
|
||||
pub count: i32,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ApplyFileDiffStats {
|
||||
pub count: i32,
|
||||
pub lines_added: i32,
|
||||
pub lines_removed: i32,
|
||||
pub files_changed: i32,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ToolUsageMetadata {
|
||||
pub run_command_stats: ToolCallStats,
|
||||
pub run_commands_executed: i32,
|
||||
pub read_files_stats: ToolCallStats,
|
||||
pub search_codebase_stats: ToolCallStats,
|
||||
pub grep_stats: ToolCallStats,
|
||||
pub file_glob_stats: ToolCallStats,
|
||||
pub call_mcp_tool_stats: ToolCallStats,
|
||||
pub read_mcp_resource_stats: ToolCallStats,
|
||||
pub suggest_plan_stats: ToolCallStats,
|
||||
pub suggest_create_plan_stats: ToolCallStats,
|
||||
pub write_to_long_running_shell_command_stats: ToolCallStats,
|
||||
pub apply_file_diff_stats: ApplyFileDiffStats,
|
||||
pub read_shell_command_output_stats: ToolCallStats,
|
||||
pub use_computer_stats: ToolCallStats,
|
||||
}
|
||||
|
||||
impl From<&ToolUsageMetadata> for persistence::model::ToolUsageMetadata {
|
||||
fn from(gql: &ToolUsageMetadata) -> Self {
|
||||
Self {
|
||||
run_command_stats: persistence::model::RunCommandStats {
|
||||
count: gql.run_command_stats.count,
|
||||
commands_executed: gql.run_commands_executed,
|
||||
},
|
||||
read_files_stats: persistence::model::ToolCallStats {
|
||||
count: gql.read_files_stats.count,
|
||||
},
|
||||
search_codebase_stats: persistence::model::ToolCallStats {
|
||||
count: gql.search_codebase_stats.count,
|
||||
},
|
||||
grep_stats: persistence::model::ToolCallStats {
|
||||
count: gql.grep_stats.count,
|
||||
},
|
||||
file_glob_stats: persistence::model::ToolCallStats {
|
||||
count: gql.file_glob_stats.count,
|
||||
},
|
||||
apply_file_diff_stats: persistence::model::ApplyFileDiffStats {
|
||||
count: gql.apply_file_diff_stats.count,
|
||||
lines_added: gql.apply_file_diff_stats.lines_added,
|
||||
lines_removed: gql.apply_file_diff_stats.lines_removed,
|
||||
files_changed: gql.apply_file_diff_stats.files_changed,
|
||||
},
|
||||
write_to_long_running_shell_command_stats: persistence::model::ToolCallStats {
|
||||
count: gql.write_to_long_running_shell_command_stats.count,
|
||||
},
|
||||
read_mcp_resource_stats: persistence::model::ToolCallStats {
|
||||
count: gql.read_mcp_resource_stats.count,
|
||||
},
|
||||
call_mcp_tool_stats: persistence::model::ToolCallStats {
|
||||
count: gql.call_mcp_tool_stats.count,
|
||||
},
|
||||
suggest_plan_stats: persistence::model::ToolCallStats {
|
||||
count: gql.suggest_plan_stats.count,
|
||||
},
|
||||
suggest_create_plan_stats: persistence::model::ToolCallStats {
|
||||
count: gql.suggest_create_plan_stats.count,
|
||||
},
|
||||
read_shell_command_output_stats: persistence::model::ToolCallStats {
|
||||
count: gql.read_shell_command_output_stats.count,
|
||||
},
|
||||
use_computer_stats: persistence::model::ToolCallStats {
|
||||
count: gql.use_computer_stats.count,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
use crate::{
|
||||
error::UserFacingError, request_context::RequestContext, schema, user::DiscoverableTeamData,
|
||||
};
|
||||
|
||||
/*
|
||||
query GetDiscoverableTeams($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
discoverableTeams {
|
||||
name
|
||||
numMembers
|
||||
teamAcceptingInvites
|
||||
teamUid
|
||||
}
|
||||
}
|
||||
}
|
||||
... on UserFacingError {
|
||||
error {
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetDiscoverableTeamsVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub discoverable_teams: Vec<DiscoverableTeamData>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetDiscoverableTeamsVariables"
|
||||
)]
|
||||
pub struct GetDiscoverableTeams {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_discoverable_teams(GetDiscoverableTeamsVariables) -> GetDiscoverableTeams;
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
use crate::{request_context::RequestContext, schema};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetFeatureModelChoicesVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetFeatureModelChoicesVariables"
|
||||
)]
|
||||
pub struct GetFeatureModelChoices {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_feature_model_choices(GetFeatureModelChoicesVariables) -> GetFeatureModelChoices;
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub workspaces: Vec<Workspace>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct Workspace {
|
||||
pub feature_model_choice: FeatureModelChoice,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct FeatureModelChoice {
|
||||
pub agent_mode: AvailableLlms,
|
||||
pub planning: AvailableLlms,
|
||||
pub coding: AvailableLlms,
|
||||
pub cli_agent: AvailableLlms,
|
||||
pub computer_use_agent: AvailableLlms,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct AvailableLlms {
|
||||
pub default_id: String,
|
||||
pub choices: Vec<LlmInfo>,
|
||||
pub preferred_codex_model_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Clone, Debug)]
|
||||
pub enum DisableReason {
|
||||
AdminDisabled,
|
||||
OutOfRequests,
|
||||
ProviderOutage,
|
||||
RequiresUpgrade,
|
||||
#[cynic(fallback)]
|
||||
Other(String),
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Clone, Debug)]
|
||||
pub enum LlmModelHost {
|
||||
AwsBedrock,
|
||||
DirectApi,
|
||||
#[cynic(fallback)]
|
||||
Other(String),
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct RoutingHostConfig {
|
||||
pub enabled: bool,
|
||||
pub model_routing_host: LlmModelHost,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct LlmInfo {
|
||||
pub display_name: String,
|
||||
pub base_model_name: String,
|
||||
pub id: String,
|
||||
pub reasoning_level: Option<String>,
|
||||
pub usage_metadata: LlmUsageMetadata,
|
||||
pub description: Option<String>,
|
||||
pub disable_reason: Option<DisableReason>,
|
||||
pub vision_supported: bool,
|
||||
pub spec: Option<LlmSpec>,
|
||||
pub provider: LlmProvider,
|
||||
pub host_configs: Vec<RoutingHostConfig>,
|
||||
pub pricing: LlmPricing,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct LlmPricing {
|
||||
pub discount_percentage: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Clone, Debug)]
|
||||
pub enum LlmProvider {
|
||||
Openai,
|
||||
Anthropic,
|
||||
Google,
|
||||
Xai,
|
||||
Unknown,
|
||||
#[cynic(fallback)]
|
||||
Other(String),
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct LlmSpec {
|
||||
pub cost: f64,
|
||||
pub quality: f64,
|
||||
pub speed: f64,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct LlmUsageMetadata {
|
||||
pub credit_multiplier: Option<f64>,
|
||||
pub request_multiplier: i32,
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
use crate::{error::UserFacingError, request_context::RequestContext, schema};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetIntegrationsUsingEnvironmentVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub input: GetIntegrationsUsingEnvironmentInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct GetIntegrationsUsingEnvironmentInput {
|
||||
pub environment_id: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetIntegrationsUsingEnvironmentVariables"
|
||||
)]
|
||||
pub struct GetIntegrationsUsingEnvironment {
|
||||
#[arguments(requestContext: $request_context, input: $input)]
|
||||
#[cynic(rename = "getIntegrationsUsingEnvironment")]
|
||||
pub get_integrations_using_environment: GetIntegrationsUsingEnvironmentResult,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct GetIntegrationsUsingEnvironmentOutput {
|
||||
pub provider_names: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum GetIntegrationsUsingEnvironmentResult {
|
||||
GetIntegrationsUsingEnvironmentOutput(GetIntegrationsUsingEnvironmentOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
GetIntegrationsUsingEnvironment(GetIntegrationsUsingEnvironmentVariables) -> GetIntegrationsUsingEnvironment;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
use crate::{error::UserFacingError, request_context::RequestContext, schema};
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct GetOAuthConnectTxStatusInput {
|
||||
#[cynic(rename = "txId")]
|
||||
pub tx_id: cynic::Id,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetOAuthConnectTxStatusVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub input: GetOAuthConnectTxStatusInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetOAuthConnectTxStatusVariables"
|
||||
)]
|
||||
pub struct GetOAuthConnectTxStatus {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
#[cynic(rename = "getOAuthConnectTxStatus")]
|
||||
pub get_oauth_connect_tx_status: GetOAuthConnectTxStatusResult,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct GetOAuthConnectTxStatusOutput {
|
||||
pub __typename: String,
|
||||
pub status: OauthConnectTxStatus,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum GetOAuthConnectTxStatusResult {
|
||||
GetOAuthConnectTxStatusOutput(GetOAuthConnectTxStatusOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Clone, Copy, Debug)]
|
||||
#[cynic(graphql_type = "OAuthConnectTxStatus")]
|
||||
pub enum OauthConnectTxStatus {
|
||||
Completed,
|
||||
Expired,
|
||||
Failed,
|
||||
InProgress,
|
||||
Pending,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
get_oauth_connect_tx_status(GetOAuthConnectTxStatusVariables) -> GetOAuthConnectTxStatus;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
use crate::{request_context::RequestContext, schema};
|
||||
|
||||
/*
|
||||
query GetReferralInfo($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
referrals {
|
||||
referralCode
|
||||
numberClaimed
|
||||
isReferred
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetReferralInfoVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub referrals: ReferralInfo,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "GetReferralInfoVariables")]
|
||||
pub struct GetReferralInfo {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_referral_info(GetReferralInfoVariables) -> GetReferralInfo;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ReferralInfo {
|
||||
pub referral_code: String,
|
||||
pub number_claimed: i32,
|
||||
pub is_referred: bool,
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
use crate::{
|
||||
error::UserFacingError,
|
||||
full_source_code_embedding::{ContentHash, EmbeddingConfig, NodeHash, RepoMetadata},
|
||||
request_context::RequestContext,
|
||||
schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetRelevantFragmentsVariables {
|
||||
pub embedding_config: EmbeddingConfig,
|
||||
pub repo_metadata: RepoMetadata,
|
||||
pub query: String,
|
||||
pub request_context: RequestContext,
|
||||
pub root_hash: NodeHash,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetRelevantFragmentsVariables"
|
||||
)]
|
||||
pub struct GetRelevantFragmentsQuery {
|
||||
#[arguments(input: { embeddingConfig: $embedding_config, query: $query, rootHash: $root_hash, repoMetadata: $repo_metadata }, requestContext: $request_context)]
|
||||
pub get_relevant_fragments: GetRelevantFragmentsResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_relevant_fragments(GetRelevantFragmentsVariables) -> GetRelevantFragmentsQuery;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct GetRelevantFragmentsError {
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct GetRelevantFragmentsOutput {
|
||||
pub candidate_hashes: Vec<ContentHash>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum GetRelevantFragmentsResult {
|
||||
GetRelevantFragmentsOutput(GetRelevantFragmentsOutput),
|
||||
GetRelevantFragmentsError(GetRelevantFragmentsError),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
use crate::{
|
||||
ai::RequestLimitInfo,
|
||||
billing::{BonusGrant, BonusGrantsInfo},
|
||||
error::UserFacingError,
|
||||
request_context::RequestContext,
|
||||
schema,
|
||||
};
|
||||
|
||||
/*
|
||||
query GetRequestLimitInfo($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
workspaces {
|
||||
uid
|
||||
bonusGrantsInfo {
|
||||
grants {
|
||||
createdAt
|
||||
costCents
|
||||
expiration
|
||||
grantType
|
||||
reason
|
||||
userFacingMessage
|
||||
requestCreditsGranted
|
||||
requestCreditsRemaining
|
||||
}
|
||||
spendingInfo {
|
||||
currentMonthCreditsPurchased
|
||||
currentMonthPeriodEnd
|
||||
currentMonthSpendCents
|
||||
}
|
||||
}
|
||||
}
|
||||
requestLimitInfo {
|
||||
isUnlimited
|
||||
requestsUsedSinceLastRefresh
|
||||
requestLimit
|
||||
nextRefreshTime
|
||||
requestLimitRefreshDuration
|
||||
}
|
||||
bonusGrants {
|
||||
createdAt
|
||||
costCents
|
||||
expiration
|
||||
grantType
|
||||
reason
|
||||
userFacingMessage
|
||||
requestCreditsGranted
|
||||
requestCreditsRemaining
|
||||
}
|
||||
}
|
||||
}
|
||||
... on UserFacingError {
|
||||
error {
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetRequestLimitInfoVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "Workspace")]
|
||||
pub struct WorkspaceInfo {
|
||||
pub uid: cynic::Id,
|
||||
pub bonus_grants_info: BonusGrantsInfo,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub workspaces: Vec<WorkspaceInfo>,
|
||||
pub request_limit_info: RequestLimitInfo,
|
||||
pub bonus_grants: Vec<BonusGrant>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "GetRequestLimitInfoVariables")]
|
||||
pub struct GetRequestLimitInfo {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_request_limit_info(GetRequestLimitInfoVariables) -> GetRequestLimitInfo;
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
use crate::{
|
||||
error::UserFacingError, request_context::RequestContext, response_context::ResponseContext,
|
||||
scalars::Time, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetScheduledAgentHistoryVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub input: ScheduledAgentHistoryInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetScheduledAgentHistoryVariables"
|
||||
)]
|
||||
pub struct GetScheduledAgentHistory {
|
||||
#[arguments(requestContext: $request_context, input: $input)]
|
||||
pub scheduled_agent_history: ScheduledAgentHistoryResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
get_scheduled_agent_history(GetScheduledAgentHistoryVariables) -> GetScheduledAgentHistory;
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct ScheduledAgentHistoryInput {
|
||||
pub schedule_id: cynic::Id,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum ScheduledAgentHistoryResult {
|
||||
ScheduledAgentHistoryOutput(ScheduledAgentHistoryOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ScheduledAgentHistoryOutput {
|
||||
pub history: ScheduledAgentHistory,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ScheduledAgentHistory {
|
||||
pub last_ran: Option<Time>,
|
||||
pub next_run: Option<Time>,
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
use crate::{error::UserFacingError, request_context::RequestContext, scalars::Time, schema};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct SimpleIntegrationsVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub input: SimpleIntegrationsInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct SimpleIntegrationsInput {
|
||||
pub providers: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "SimpleIntegrationsVariables")]
|
||||
pub struct SimpleIntegrations {
|
||||
#[arguments(requestContext: $request_context, input: $input)]
|
||||
#[cynic(rename = "simpleIntegrations")]
|
||||
pub simple_integrations: SimpleIntegrationsResult,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct SimpleIntegrationsOutput {
|
||||
pub integrations: Vec<SimpleIntegration>,
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct SimpleIntegration {
|
||||
pub provider_slug: String,
|
||||
pub description: String,
|
||||
pub connection_status: SimpleIntegrationConnectionStatus,
|
||||
pub integration_config: Option<ListedSimpleIntegrationConfig>,
|
||||
pub created_at: Option<Time>,
|
||||
pub updated_at: Option<Time>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ListedSimpleIntegrationConfig {
|
||||
pub environment_uid: String,
|
||||
pub base_prompt: String,
|
||||
pub model_id: String,
|
||||
pub mcp_servers_json: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Debug, Clone, Copy)]
|
||||
#[cynic(graphql_type = "SimpleIntegrationConnectionStatus")]
|
||||
pub enum SimpleIntegrationConnectionStatus {
|
||||
NotConnected,
|
||||
ConnectionError,
|
||||
IntegrationNotConfigured,
|
||||
NotEnabled,
|
||||
Active,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum SimpleIntegrationsResult {
|
||||
SimpleIntegrationsOutput(SimpleIntegrationsOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
SimpleIntegrations(SimpleIntegrationsVariables) -> SimpleIntegrations;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
use crate::{
|
||||
error::UserFacingError, folder::Folder, generic_string_object::GenericStringObject,
|
||||
mcp_gallery_template::MCPGalleryTemplate, notebook::Notebook,
|
||||
object_actions::ObjectActionHistory, request_context::RequestContext,
|
||||
response_context::ResponseContext, scalars::Time, schema, user::PublicUserProfile,
|
||||
workflow::Workflow,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetUpdatedCloudObjectsVariables {
|
||||
pub input: UpdatedCloudObjectsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UpdatedCloudObjectsOutput {
|
||||
pub action_histories: Option<Vec<ObjectActionHistory>>,
|
||||
pub deleted_object_uids: DeletedObjectUids,
|
||||
pub folders: Option<Vec<Folder>>,
|
||||
pub generic_string_objects: Option<Vec<GenericStringObject>>,
|
||||
pub mcp_gallery: Option<Vec<MCPGalleryTemplate>>,
|
||||
pub notebooks: Option<Vec<Notebook>>,
|
||||
pub response_context: ResponseContext,
|
||||
pub user_profiles: Option<Vec<PublicUserProfile>>,
|
||||
pub workflows: Option<Vec<Workflow>>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetUpdatedCloudObjectsVariables"
|
||||
)]
|
||||
pub struct GetUpdatedCloudObjects {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
pub updated_cloud_objects: UpdatedCloudObjectsResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_updated_cloud_objects(GetUpdatedCloudObjectsVariables) -> GetUpdatedCloudObjects;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct DeletedObjectUids {
|
||||
pub folder_uids: Option<Vec<cynic::Id>>,
|
||||
pub generic_string_object_uids: Option<Vec<cynic::Id>>,
|
||||
pub notebook_uids: Option<Vec<cynic::Id>>,
|
||||
pub workflow_uids: Option<Vec<cynic::Id>>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatedCloudObjectsResult {
|
||||
UpdatedCloudObjectsOutput(UpdatedCloudObjectsOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct UpdatedCloudObjectsInput {
|
||||
pub folders: Option<Vec<UpdatedObjectInput>>,
|
||||
pub force_refresh: bool,
|
||||
pub generic_string_objects: Option<Vec<UpdatedObjectInput>>,
|
||||
pub notebooks: Option<Vec<UpdatedObjectInput>>,
|
||||
pub workflows: Option<Vec<UpdatedObjectInput>>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct UpdatedObjectInput {
|
||||
pub actions_ts: Option<Time>,
|
||||
pub metadata_ts: Option<Time>,
|
||||
pub permissions_ts: Option<Time>,
|
||||
pub revision_ts: Time,
|
||||
pub uid: cynic::Id,
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
use crate::{
|
||||
experiment::Experiment, mutations::create_anonymous_user::AnonymousUserType,
|
||||
object_permissions::OwnerType, request_context::RequestContext, scalars::Time, schema,
|
||||
workspace::FeatureModelChoice,
|
||||
};
|
||||
|
||||
/*
|
||||
query GetUser($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
apiKeyOwnerType
|
||||
principalType
|
||||
user {
|
||||
anonymousUserInfo {
|
||||
anonymousUserType
|
||||
linkedAt
|
||||
personalObjectLimits {
|
||||
envVarLimit
|
||||
notebookLimit
|
||||
workflowLimit
|
||||
}
|
||||
}
|
||||
experiments
|
||||
isOnWorkDomain
|
||||
isOnboarded
|
||||
profile {
|
||||
displayName
|
||||
email
|
||||
needsSsoLink
|
||||
photoUrl
|
||||
uid
|
||||
}
|
||||
llms {
|
||||
agentMode {
|
||||
defaultId
|
||||
choices {
|
||||
id
|
||||
displayName
|
||||
baseModelName
|
||||
reasoningLevel
|
||||
description
|
||||
disableReason
|
||||
visionSupported
|
||||
onboardingInfo {
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
planning {
|
||||
defaultId
|
||||
choices {
|
||||
id
|
||||
displayName
|
||||
baseModelName
|
||||
reasoningLevel
|
||||
description
|
||||
disableReason
|
||||
visionSupported
|
||||
onboardingInfo {
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
coding {
|
||||
defaultId
|
||||
choices {
|
||||
id
|
||||
displayName
|
||||
baseModelName
|
||||
reasoningLevel
|
||||
description
|
||||
disableReason
|
||||
visionSupported
|
||||
onboardingInfo {
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
cliAgent {
|
||||
defaultId
|
||||
choices {
|
||||
id
|
||||
displayName
|
||||
baseModelName
|
||||
reasoningLevel
|
||||
description
|
||||
disableReason
|
||||
visionSupported
|
||||
onboardingInfo {
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "GetUserVariables")]
|
||||
pub struct GetUser {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_user(GetUserVariables) -> GetUser;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetUserVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub api_key_owner_type: Option<OwnerType>,
|
||||
pub principal_type: Option<PrincipalType>,
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum PrincipalType {
|
||||
User,
|
||||
ServiceAccount,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub anonymous_user_info: Option<AnonymousUserInfo>,
|
||||
pub experiments: Option<Vec<Experiment>>,
|
||||
pub is_onboarded: bool,
|
||||
pub is_on_work_domain: bool,
|
||||
pub profile: FirebaseProfile,
|
||||
pub llms: FeatureModelChoice,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct FirebaseProfile {
|
||||
pub display_name: Option<String>,
|
||||
pub email: Option<String>,
|
||||
pub needs_sso_link: bool,
|
||||
pub photo_url: Option<String>,
|
||||
pub uid: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct AnonymousUserInfo {
|
||||
pub anonymous_user_type: AnonymousUserType,
|
||||
pub linked_at: Option<Time>,
|
||||
pub personal_object_limits: Option<AnonymousUserPersonalObjectLimits>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct AnonymousUserPersonalObjectLimits {
|
||||
pub env_var_limit: i32,
|
||||
pub notebook_limit: i32,
|
||||
pub workflow_limit: i32,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
use crate::{request_context::RequestContext, schema};
|
||||
|
||||
/*
|
||||
query GetUserSettings($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
settings {
|
||||
isCloudConversationStorageEnabled
|
||||
isCrashReportingEnabled
|
||||
isTelemetryEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetUserSettingsVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub settings: Option<UserSettings>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "GetUserSettingsVariables")]
|
||||
pub struct GetUserSettings {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_user_settings(GetUserSettingsVariables) -> GetUserSettings;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserSettings {
|
||||
pub is_cloud_conversation_storage_enabled: bool,
|
||||
pub is_crash_reporting_enabled: bool,
|
||||
pub is_telemetry_enabled: bool,
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
use crate::{
|
||||
billing::PricingInfo, experiment::Experiment, request_context::RequestContext, schema,
|
||||
user::DiscoverableTeamData, workspace::Workspace,
|
||||
};
|
||||
|
||||
/*
|
||||
query GetWorkspacesMetadataForUser($requestContext: RequestContext!) {
|
||||
user(requestContext: $requestContext) {
|
||||
... on UserOutput {
|
||||
user {
|
||||
workspaces {
|
||||
uid
|
||||
name
|
||||
members {
|
||||
uid
|
||||
email
|
||||
role
|
||||
}
|
||||
teams {
|
||||
uid
|
||||
name
|
||||
members {
|
||||
uid
|
||||
email
|
||||
role
|
||||
}
|
||||
}
|
||||
billingMetadata {
|
||||
customerType
|
||||
delinquencyStatus
|
||||
tier {
|
||||
name
|
||||
description
|
||||
warpAiPolicy {
|
||||
limit
|
||||
isCodeSuggestionsToggleable
|
||||
isPromptSuggestionsToggleable
|
||||
isNextCommandEnabled
|
||||
isVoiceEnabled
|
||||
}
|
||||
teamSizePolicy {
|
||||
isUnlimited
|
||||
limit
|
||||
}
|
||||
sharedNotebooksPolicy {
|
||||
isUnlimited
|
||||
limit
|
||||
}
|
||||
sharedWorkflowsPolicy {
|
||||
isUnlimited
|
||||
limit
|
||||
}
|
||||
sessionSharingPolicy {
|
||||
enabled
|
||||
maxSessionBytesSize
|
||||
}
|
||||
anyoneWithLinkSharingPolicy {
|
||||
toggleable
|
||||
}
|
||||
directLinkSharingPolicy {
|
||||
toggleable
|
||||
}
|
||||
byoApiKeyPolicy {
|
||||
enabled
|
||||
}
|
||||
pricing {
|
||||
enablePayAsYouGo
|
||||
autoReloadCreditDenomination
|
||||
autoReloadCostCents
|
||||
}
|
||||
}
|
||||
serviceAgreements {
|
||||
currentPeriodEnd
|
||||
status
|
||||
stripeSubscriptionId
|
||||
type
|
||||
}
|
||||
}
|
||||
settings {
|
||||
isDiscoverable
|
||||
isInviteLinkEnabled
|
||||
llmSettings {
|
||||
enabled
|
||||
}
|
||||
telemetrySettings {
|
||||
forceEnabled
|
||||
}
|
||||
linkSharingSettings {
|
||||
anyoneWithLinkSharingEnabled
|
||||
directLinkSharingEnabled
|
||||
}
|
||||
codebaseContextSettings {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
hasBillingHistory
|
||||
inviteCode
|
||||
pendingEmailInvites {
|
||||
email
|
||||
expired
|
||||
}
|
||||
inviteLinkDomainRestrictions {
|
||||
uid
|
||||
domain
|
||||
}
|
||||
stripeCustomerId
|
||||
isEligibleForDiscovery
|
||||
}
|
||||
experiments
|
||||
discoverableTeams {
|
||||
teamUid
|
||||
numMembers
|
||||
name
|
||||
teamAcceptingInvites
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pricingInfo(requestContext: $requestContext) {
|
||||
... on PricingInfoOutput {
|
||||
pricingInfo {
|
||||
plans {
|
||||
plan
|
||||
monthlyPlanPricePerMonthUsdCents
|
||||
yearlyPlanPricePerMonthUsdCents
|
||||
requestLimit
|
||||
codebaseLimit
|
||||
codebaseContextFileLimit
|
||||
maxTeamSize
|
||||
}
|
||||
overages {
|
||||
pricePerRequestUsdCents
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetWorkspacesMetadataForUserVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct PricingInfoOutput {
|
||||
pub pricing_info: PricingInfo,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum PricingInfoResult {
|
||||
PricingInfoOutput(PricingInfoOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub workspaces: Vec<Workspace>,
|
||||
pub experiments: Option<Vec<Experiment>>,
|
||||
pub discoverable_teams: Vec<DiscoverableTeamData>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetWorkspacesMetadataForUserVariables"
|
||||
)]
|
||||
pub struct GetWorkspacesMetadataForUser {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub pricing_info: PricingInfoResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
get_workspaces_metadata_for_user(GetWorkspacesMetadataForUserVariables) -> GetWorkspacesMetadataForUser;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
use crate::{
|
||||
ai::AIConversation, ai::AIConversationArtifact, ai::AgentHarness, ai::ConversationUsage,
|
||||
error::UserFacingError, object::ObjectMetadata, object_permissions::ObjectPermissions,
|
||||
request_context::RequestContext, response_context::ResponseContext, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct ListAIConversationsVariables {
|
||||
pub input: ListAIConversationsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "ListAIConversationsVariables")]
|
||||
pub struct ListAIConversations {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
#[cynic(rename = "listAIConversations")]
|
||||
pub list_ai_conversations: ListAIConversationsResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
list_ai_conversations(ListAIConversationsVariables) -> ListAIConversations;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ListAIConversationsOutput {
|
||||
pub conversations: Vec<AIConversation>,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ListAIConversationsResult {
|
||||
ListAIConversationsOutput(ListAIConversationsOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct ListAIConversationsInput {
|
||||
pub conversation_ids: Option<Vec<cynic::Id>>,
|
||||
}
|
||||
|
||||
// Metadata-only fragment that omits final_task_list for efficiency
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
#[cynic(graphql_type = "AIConversation")]
|
||||
pub struct AIConversationMetadata {
|
||||
pub conversation_id: cynic::Id,
|
||||
pub harness: AgentHarness,
|
||||
pub title: String,
|
||||
pub working_directory: Option<String>,
|
||||
pub usage: ConversationUsage,
|
||||
pub metadata: ObjectMetadata,
|
||||
pub permissions: ObjectPermissions,
|
||||
pub ambient_agent_task_id: Option<cynic::Id>,
|
||||
pub artifacts: Option<Vec<AIConversationArtifact>>,
|
||||
}
|
||||
|
||||
// Query and types for listing metadata only (without final_task_list)
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct ListAIConversationMetadataVariables {
|
||||
pub input: ListAIConversationsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "ListAIConversationMetadataVariables"
|
||||
)]
|
||||
pub struct ListAIConversationMetadata {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
#[cynic(rename = "listAIConversations")]
|
||||
pub list_ai_conversations: ListAIConversationMetadataResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
list_ai_conversation_metadata(ListAIConversationMetadataVariables) -> ListAIConversationMetadata;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "ListAIConversationsOutput")]
|
||||
pub struct ListAIConversationMetadataOutput {
|
||||
pub conversations: Vec<AIConversationMetadata>,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[cynic(graphql_type = "ListAIConversationsResult")]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ListAIConversationMetadataResult {
|
||||
ListAIConversationsOutput(ListAIConversationMetadataOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
use crate::{
|
||||
error::UserFacingError, managed_secrets::ManagedSecret, request_context::RequestContext, schema,
|
||||
};
|
||||
|
||||
/// A GraphQL query to list all managed secrets for the current user.
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "ListManagedSecretsVariables")]
|
||||
pub struct ListManagedSecrets {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
pub managed_secrets: ManagedSecretsResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
list_managed_secrets(ListManagedSecretsVariables) -> ListManagedSecrets;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct ListManagedSecretsVariables {
|
||||
pub input: ManagedSecretsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug, Default)]
|
||||
pub struct ManagedSecretsInput {
|
||||
pub cursor: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum ManagedSecretsResult {
|
||||
ManagedSecretsOutput(ManagedSecretsOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ManagedSecretsOutput {
|
||||
pub managed_secrets: Vec<ManagedSecret>,
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
use crate::{error::UserFacingError, schema};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct ListWarpDevImagesVariables {}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "ListWarpDevImagesVariables")]
|
||||
pub struct ListWarpDevImages {
|
||||
#[cynic(rename = "listWarpDevImages")]
|
||||
pub list_warp_dev_images: ListWarpDevImagesResult,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ListWarpDevImagesOutput {
|
||||
pub images: Vec<ImageTag>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct ImageTag {
|
||||
pub image: String,
|
||||
pub repository: String,
|
||||
pub tag: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum ListWarpDevImagesResult {
|
||||
ListWarpDevImagesOutput(ListWarpDevImagesOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
ListWarpDevImages(ListWarpDevImagesVariables) -> ListWarpDevImages;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
use crate::{
|
||||
error::UserFacingError, managed_secrets::ManagedSecretConfig, request_context::RequestContext,
|
||||
schema,
|
||||
};
|
||||
|
||||
/// A GraphQL query to fetch all managed secret configuration for a user.
|
||||
///
|
||||
/// This is separate from the main user and workspace queries so that we do not make unnecessary
|
||||
/// KMS calls when managed secrets are not in use.
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "GetManagedSecretConfigVariables"
|
||||
)]
|
||||
pub struct GetManagedSecretConfig {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user: UserResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
get_managed_secret_config(GetManagedSecretConfigVariables) -> GetManagedSecretConfig;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct GetManagedSecretConfigVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum UserResult {
|
||||
UserOutput(UserOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserOutput {
|
||||
pub user: User,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct User {
|
||||
pub managed_secrets: Option<ManagedSecretConfig>,
|
||||
pub workspaces: Vec<Workspace>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct Workspace {
|
||||
pub teams: Vec<Team>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct Team {
|
||||
pub uid: cynic::Id,
|
||||
pub managed_secrets: Option<ManagedSecretConfig>,
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
pub mod api_keys;
|
||||
pub mod codebase_context_config;
|
||||
pub mod free_available_models;
|
||||
pub mod get_ai_conversation_format;
|
||||
pub mod get_ai_overages_for_workspace;
|
||||
pub mod get_blocks_for_user;
|
||||
pub mod get_cloud_environments;
|
||||
pub mod get_cloud_object;
|
||||
pub mod get_conversation_usage;
|
||||
pub mod get_discoverable_teams;
|
||||
pub mod get_feature_model_choices;
|
||||
pub mod get_integrations_using_environment;
|
||||
pub mod get_oauth_connect_tx_status;
|
||||
pub mod get_referral_info;
|
||||
pub mod get_relevant_fragments;
|
||||
pub mod get_request_limit_info;
|
||||
pub mod get_scheduled_agent_history;
|
||||
pub mod get_simple_integrations;
|
||||
pub mod get_updated_cloud_objects;
|
||||
pub mod get_user;
|
||||
pub mod get_user_settings;
|
||||
pub mod get_workspaces_metadata_for_user;
|
||||
pub mod list_ai_conversations;
|
||||
pub mod list_managed_secrets;
|
||||
pub mod list_warp_dev_images;
|
||||
pub mod managed_secret_config;
|
||||
pub mod rerank_fragments;
|
||||
pub mod suggest_cloud_environment_image;
|
||||
pub mod sync_merkle_tree;
|
||||
pub mod task_attachments;
|
||||
pub mod task_secrets;
|
||||
pub mod user_github_info;
|
||||
pub mod user_repo_auth_status;
|
||||
@@ -0,0 +1,68 @@
|
||||
use crate::{
|
||||
error::UserFacingError, full_source_code_embedding::ContentHash,
|
||||
request_context::RequestContext, schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct RerankFragmentsVariables {
|
||||
pub fragments: Vec<RerankFragmentInput>,
|
||||
pub query: String,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct RerankFragmentInput {
|
||||
pub content: String,
|
||||
pub content_hash: ContentHash,
|
||||
pub location: FragmentLocationInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "RerankFragmentsVariables")]
|
||||
pub struct RerankFragments {
|
||||
#[arguments(input: { fragments: $fragments, query: $query }, requestContext: $request_context)]
|
||||
pub rerank_fragments: RerankFragmentsResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
rerank_fragments(RerankFragmentsVariables) -> RerankFragments;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct RerankFragmentsError {
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct RerankFragmentsOutput {
|
||||
pub ranked_fragments: Vec<RerankFragment>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct RerankFragment {
|
||||
pub content: String,
|
||||
pub content_hash: ContentHash,
|
||||
pub location: FragmentLocation,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct FragmentLocation {
|
||||
pub byte_end: i32,
|
||||
pub byte_start: i32,
|
||||
pub file_path: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum RerankFragmentsResult {
|
||||
RerankFragmentsOutput(RerankFragmentsOutput),
|
||||
RerankFragmentsError(RerankFragmentsError),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct FragmentLocationInput {
|
||||
pub byte_end: i32,
|
||||
pub byte_start: i32,
|
||||
pub file_path: String,
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
use crate::{
|
||||
error::UserFacingError, request_context::RequestContext, response_context::ResponseContext,
|
||||
schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct SuggestCloudEnvironmentImageVariables {
|
||||
pub input: SuggestCloudEnvironmentImageInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(
|
||||
graphql_type = "RootQuery",
|
||||
variables = "SuggestCloudEnvironmentImageVariables"
|
||||
)]
|
||||
pub struct SuggestCloudEnvironmentImage {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
#[cynic(rename = "suggestCloudEnvironmentImage")]
|
||||
pub suggest_cloud_environment_image: SuggestCloudEnvironmentImageResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
suggest_cloud_environment_image(SuggestCloudEnvironmentImageVariables) -> SuggestCloudEnvironmentImage;
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct SuggestCloudEnvironmentImageInput {
|
||||
pub repos: Vec<RepoInput>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct RepoInput {
|
||||
pub owner: String,
|
||||
pub repo: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct SuggestCloudEnvironmentImageAuthRequiredOutput {
|
||||
pub auth_url: String,
|
||||
pub response_context: ResponseContext,
|
||||
#[cynic(rename = "txId")]
|
||||
pub tx_id: cynic::Id,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct SuggestCloudEnvironmentImageOutput {
|
||||
pub detected_languages: Vec<GithubReposLanguageStat>,
|
||||
pub image: String,
|
||||
pub needs_custom_image: bool,
|
||||
pub reason: String,
|
||||
pub response_context: ResponseContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct GithubReposLanguageStat {
|
||||
pub bytes: i32,
|
||||
pub language: String,
|
||||
pub percentage: f64,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum SuggestCloudEnvironmentImageResult {
|
||||
SuggestCloudEnvironmentImageAuthRequiredOutput(SuggestCloudEnvironmentImageAuthRequiredOutput),
|
||||
SuggestCloudEnvironmentImageOutput(SuggestCloudEnvironmentImageOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
use crate::{
|
||||
error::UserFacingError,
|
||||
full_source_code_embedding::{EmbeddingConfig, NodeHash},
|
||||
request_context::RequestContext,
|
||||
response_context::ResponseContext,
|
||||
schema,
|
||||
};
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct SyncMerkleTreeInput {
|
||||
pub hashed_nodes: Vec<NodeHash>,
|
||||
pub embedding_config: EmbeddingConfig,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct SyncMerkleTreeVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub input: SyncMerkleTreeInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "SyncMerkleTreeVariables")]
|
||||
pub struct SyncMerkleTree {
|
||||
#[arguments(requestContext: $request_context, input: $input)]
|
||||
pub sync_merkle_tree: SyncMerkleTreeResult,
|
||||
}
|
||||
crate::client::define_operation! {
|
||||
sync_merkle_tree(SyncMerkleTreeVariables) -> SyncMerkleTree;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct SyncMerkleTreeError {
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct SyncMerkleTreeOutput {
|
||||
pub response_context: ResponseContext,
|
||||
pub changed_nodes: Vec<NodeHash>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum SyncMerkleTreeResult {
|
||||
SyncMerkleTreeOutput(SyncMerkleTreeOutput),
|
||||
SyncMerkleTreeError(SyncMerkleTreeError),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
use crate::{error::UserFacingError, request_context::RequestContext, schema};
|
||||
|
||||
/// A GraphQL query to fetch attachments for a specific task.
|
||||
///
|
||||
/// This query is used by Agent Mode VMs to retrieve file attachments (images, PDFs, etc.)
|
||||
/// that have been made available to them.
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "TaskVariables")]
|
||||
pub struct Task {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
pub task: TaskResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
task(TaskVariables) -> Task;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct TaskVariables {
|
||||
pub input: TaskInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct TaskInput {
|
||||
pub task_id: cynic::Id,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum TaskResult {
|
||||
TaskOutput(TaskOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct TaskOutput {
|
||||
pub task: TaskData,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "Task")]
|
||||
pub struct TaskData {
|
||||
pub task_id: cynic::Id,
|
||||
pub attachments: Vec<TaskAttachment>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct TaskAttachment {
|
||||
pub file_id: cynic::Id,
|
||||
pub filename: String,
|
||||
pub download_url: String,
|
||||
pub mime_type: String,
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
use crate::{error::UserFacingError, request_context::RequestContext, schema};
|
||||
|
||||
/// A GraphQL query to fetch secrets for a specific task.
|
||||
///
|
||||
/// This query is used by Agent Mode tasks to retrieve secrets that have been made available
|
||||
/// to them via a short-lived workload token.
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "TaskSecretsVariables")]
|
||||
pub struct TaskSecrets {
|
||||
#[arguments(input: $input, requestContext: $request_context)]
|
||||
pub task_secrets: TaskSecretsResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
task_secrets(TaskSecretsVariables) -> TaskSecrets;
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct TaskSecretsVariables {
|
||||
pub input: TaskSecretsInput,
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct TaskSecretsInput {
|
||||
pub task_id: cynic::Id,
|
||||
pub workload_token: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum TaskSecretsResult {
|
||||
TaskSecretsOutput(TaskSecretsOutput),
|
||||
UserFacingError(UserFacingError),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct TaskSecretsOutput {
|
||||
pub secrets: Vec<TaskSecretEntry>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct TaskSecretEntry {
|
||||
pub name: String,
|
||||
pub value: ManagedSecretValue,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
pub enum ManagedSecretValue {
|
||||
ManagedSecretRawValue(ManagedSecretRawValue),
|
||||
ManagedSecretAnthropicApiKeyValue(ManagedSecretAnthropicApiKeyValue),
|
||||
ManagedSecretAnthropicBedrockAccessKeyValue(ManagedSecretAnthropicBedrockAccessKeyValue),
|
||||
ManagedSecretAnthropicBedrockApiKeyValue(ManagedSecretAnthropicBedrockApiKeyValue),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ManagedSecretRawValue {
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ManagedSecretAnthropicApiKeyValue {
|
||||
pub api_key: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ManagedSecretAnthropicBedrockAccessKeyValue {
|
||||
pub aws_access_key_id: String,
|
||||
pub aws_secret_access_key: String,
|
||||
/// Optional session token. Only set for temporary/STS credentials.
|
||||
pub aws_session_token: Option<String>,
|
||||
pub aws_region: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct ManagedSecretAnthropicBedrockApiKeyValue {
|
||||
pub aws_bearer_token_bedrock: String,
|
||||
pub aws_region: String,
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
use crate::{request_context::RequestContext, schema};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct UserGithubInfoVariables {
|
||||
pub request_context: RequestContext,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct GithubConnectedOutput {
|
||||
pub username: Option<String>,
|
||||
pub installed_repos: Vec<RepoResult>,
|
||||
pub app_install_link: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct GithubAuthRequiredOutput {
|
||||
pub auth_url: String,
|
||||
#[cynic(rename = "txId")]
|
||||
pub tx_id: cynic::Id,
|
||||
pub app_install_link: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug, Clone)]
|
||||
pub struct RepoResult {
|
||||
pub owner: String,
|
||||
pub repo: String,
|
||||
pub is_public: bool,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug, Clone)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UserGithubInfoResult {
|
||||
GithubConnectedOutput(GithubConnectedOutput),
|
||||
GithubAuthRequiredOutput(GithubAuthRequiredOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "UserGithubInfoVariables")]
|
||||
pub struct UserGithubInfo {
|
||||
#[arguments(requestContext: $request_context)]
|
||||
pub user_github_info: UserGithubInfoResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
user_github_info(UserGithubInfoVariables) -> UserGithubInfo;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
use crate::{request_context::RequestContext, schema};
|
||||
|
||||
#[derive(cynic::QueryVariables, Debug)]
|
||||
pub struct UserRepoAuthStatusVariables {
|
||||
pub request_context: RequestContext,
|
||||
pub input: UserRepoAuthStatusInput,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct UserRepoAuthStatusInput {
|
||||
pub repos: Vec<RepoInput>,
|
||||
}
|
||||
|
||||
#[derive(cynic::InputObject, Debug)]
|
||||
pub struct RepoInput {
|
||||
pub owner: String,
|
||||
pub repo: String,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct UserRepoAuthStatusOutput {
|
||||
pub statuses: Vec<RepoResult>,
|
||||
pub auth_url: Option<String>,
|
||||
#[cynic(rename = "txId")]
|
||||
pub tx_id: Option<cynic::Id>,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
pub struct RepoResult {
|
||||
pub owner: String,
|
||||
pub repo: String,
|
||||
pub status: UserRepoAuthStatusEnum,
|
||||
pub is_public: bool,
|
||||
}
|
||||
|
||||
#[derive(cynic::Enum, Debug, Clone, Copy)]
|
||||
#[cynic(graphql_type = "UserRepoAuthStatus")]
|
||||
pub enum UserRepoAuthStatusEnum {
|
||||
NoInstallationOrAccessForRepo,
|
||||
UserNotConnectedToGithub,
|
||||
Success,
|
||||
}
|
||||
|
||||
#[derive(cynic::InlineFragments, Debug)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UserRepoAuthStatusResult {
|
||||
UserRepoAuthStatusOutput(UserRepoAuthStatusOutput),
|
||||
#[cynic(fallback)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(cynic::QueryFragment, Debug)]
|
||||
#[cynic(graphql_type = "RootQuery", variables = "UserRepoAuthStatusVariables")]
|
||||
pub struct UserRepoAuthStatus {
|
||||
#[arguments(requestContext: $request_context, input: $input)]
|
||||
pub user_repo_auth_status: UserRepoAuthStatusResult,
|
||||
}
|
||||
|
||||
crate::client::define_operation! {
|
||||
user_repo_auth_status(UserRepoAuthStatusVariables) -> UserRepoAuthStatus;
|
||||
}
|
||||
Reference in New Issue
Block a user