mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
[agent-workbench][ai-review]: use AI review providers constants (FUS-8202)
Use the shared provider list as an inline FUS allow-list instead of registering a custom validation rule with the broad values. GitOrigin-RevId: dd5b3a66ab9cde859317369df1700c8216f7583a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
04523d936b
commit
b62a692a05
@@ -15,8 +15,6 @@
|
||||
|
||||
<statistics.counterUsagesCollector
|
||||
implementationClass="com.intellij.agent.workbench.ai.review.AIReviewCollector"/>
|
||||
<statistics.validation.customValidationRule
|
||||
implementation="com.intellij.agent.workbench.ai.review.AIReviewAgentProviderValidationRule"/>
|
||||
|
||||
<registryKey key="ai.review.enabled"
|
||||
defaultValue="true"
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// Copyright 2000-2026 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.agent.workbench.ai.review
|
||||
|
||||
import com.intellij.platform.ai.agent.core.session.AgentSessionProvider
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
val CLAUDE_AGENT_SESSION_PROVIDER: AgentSessionProvider = AgentSessionProvider.from("claude")
|
||||
|
||||
@ApiStatus.Internal
|
||||
val CODEX_AGENT_SESSION_PROVIDER: AgentSessionProvider = AgentSessionProvider.from("codex")
|
||||
|
||||
@ApiStatus.Internal
|
||||
val JUNIE_AGENT_SESSION_PROVIDER: AgentSessionProvider = AgentSessionProvider.from("junie")
|
||||
|
||||
@ApiStatus.Internal
|
||||
val OPENCODE_AGENT_SESSION_PROVIDER: AgentSessionProvider = AgentSessionProvider.from("opencode")
|
||||
|
||||
@ApiStatus.Internal
|
||||
val AVAILABLE_AI_REVIEW_AGENT_PROVIDERS: List<AgentSessionProvider> = listOf(
|
||||
CLAUDE_AGENT_SESSION_PROVIDER,
|
||||
CODEX_AGENT_SESSION_PROVIDER,
|
||||
JUNIE_AGENT_SESSION_PROVIDER,
|
||||
OPENCODE_AGENT_SESSION_PROVIDER,
|
||||
)
|
||||
+2
-15
@@ -7,7 +7,6 @@ import com.intellij.agent.workbench.ai.review.model.ReviewRating
|
||||
import com.intellij.internal.statistic.StructuredIdeActivity
|
||||
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.impl.CustomValidationRule
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
import com.intellij.lang.LanguageUtil
|
||||
import com.intellij.openapi.diagnostic.fileLogger
|
||||
@@ -15,12 +14,9 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vcs.VcsException
|
||||
import com.intellij.openapi.vcs.changes.Change
|
||||
import com.intellij.platform.ai.agent.core.session.AgentSessionProvider
|
||||
import com.jetbrains.fus.reporting.api.IEventContext
|
||||
import com.jetbrains.fus.reporting.api.ValidationResultType
|
||||
|
||||
internal object AIReviewCollector : CounterUsagesCollector() {
|
||||
private val group = EventLogGroup("agent.workbench.ai.review", 5)
|
||||
private val group = EventLogGroup("agent.workbench.ai.review", 6)
|
||||
|
||||
private val REQUEST_ID = EventFields.Long("request_id", "ID of the review request.")
|
||||
private val RATING = EventFields.Enum("rating", ReviewRating::class.java)
|
||||
@@ -49,7 +45,7 @@ internal object AIReviewCollector : CounterUsagesCollector() {
|
||||
|
||||
private val SUCCESS = EventFields.Boolean("success")
|
||||
|
||||
private val AGENT = EventFields.StringValidatedByCustomRule<AIReviewAgentProviderValidationRule>("agent")
|
||||
private val AGENT = EventFields.String("agent", AVAILABLE_AI_REVIEW_AGENT_PROVIDERS.map { it.value })
|
||||
private val YOLO = EventFields.Boolean("yolo", "Whether the agent was launched in YOLO (skip-permissions / full-auto) mode.")
|
||||
|
||||
private data class ChangeMetrics(
|
||||
@@ -239,13 +235,4 @@ internal object AIReviewCollector : CounterUsagesCollector() {
|
||||
charsRemoved = charsRemoved,
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal class AIReviewAgentProviderValidationRule : CustomValidationRule() {
|
||||
override fun doValidate(data: String, context: IEventContext): ValidationResultType {
|
||||
return if (AgentSessionProvider.fromOrNull(data) != null) ValidationResultType.ACCEPTED else ValidationResultType.REJECTED
|
||||
}
|
||||
|
||||
override fun getRuleId(): String = "agent_workbench_ai_review_provider"
|
||||
}
|
||||
Reference in New Issue
Block a user