IJPL-233558 extract cc session support

GitOrigin-RevId: cedf48d6c852c81731ce4b37fb2afeb2a85c4409
This commit is contained in:
Vladimir Krivosheev
2026-02-13 20:24:44 +01:00
committed by intellij-monorepo-bot
parent d673f2a758
commit f73c1da172
19 changed files with 159 additions and 13 deletions

1
.idea/modules.xml generated
View File

@@ -49,6 +49,7 @@
<module fileurl="file://$PROJECT_DIR$/fleet/util/serialization/fleet.util.serialization.iml" filepath="$PROJECT_DIR$/fleet/util/serialization/fleet.util.serialization.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/agent-workbench/chat/intellij.agent.workbench.chat.iml" filepath="$PROJECT_DIR$/plugins/agent-workbench/chat/intellij.agent.workbench.chat.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/agent-workbench/claude/common/intellij.agent.workbench.claude.common.iml" filepath="$PROJECT_DIR$/plugins/agent-workbench/claude/common/intellij.agent.workbench.claude.common.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/agent-workbench/claude/sessions/intellij.agent.workbench.claude.sessions.iml" filepath="$PROJECT_DIR$/plugins/agent-workbench/claude/sessions/intellij.agent.workbench.claude.sessions.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/agent-workbench/codex/common/intellij.agent.workbench.codex.common.iml" filepath="$PROJECT_DIR$/plugins/agent-workbench/codex/common/intellij.agent.workbench.codex.common.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/agent-workbench/codex/sessions/intellij.agent.workbench.codex.sessions.iml" filepath="$PROJECT_DIR$/plugins/agent-workbench/codex/sessions/intellij.agent.workbench.codex.sessions.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/agent-workbench/plugin/intellij.agent.workbench.plugin.iml" filepath="$PROJECT_DIR$/plugins/agent-workbench/plugin/intellij.agent.workbench.plugin.iml" />

View File

@@ -876,6 +876,7 @@ plugins/IntelliLang/backend
plugins/IntelliLang/tests
plugins/agent-workbench/chat
plugins/agent-workbench/claude/common
plugins/agent-workbench/claude/sessions
plugins/agent-workbench/codex/common
plugins/agent-workbench/codex/sessions
plugins/agent-workbench/plugin

View File

@@ -0,0 +1,57 @@
### auto-generated section `build intellij.agent.workbench.claude.sessions` start
load("@rules_jvm//:jvm.bzl", "jvm_library", "resourcegroup")
resourcegroup(
name = "sessions_resources",
srcs = glob(["resources/**/*"]),
strip_prefix = "resources"
)
jvm_library(
name = "sessions",
module_name = "intellij.agent.workbench.claude.sessions",
visibility = ["//visibility:public"],
srcs = glob(["src/**/*.kt", "src/**/*.java", "src/**/*.form"], allow_empty = True),
resources = [":sessions_resources"],
deps = [
"@lib//:kotlin-stdlib",
"//platform/core-api:core",
"//platform/projectModel-api:projectModel",
"//platform/util",
"//platform/platform-api:ide",
"//platform/platform-util-io:ide-util-io",
"//plugins/agent-workbench/claude/common",
]
)
jvm_library(
name = "sessions_test_lib",
visibility = ["//visibility:public"],
srcs = glob(["testSrc/**/*.kt", "testSrc/**/*.java", "testSrc/**/*.form"], allow_empty = True),
associates = [":sessions"],
deps = [
"@lib//:kotlin-stdlib",
"//platform/core-api:core",
"//platform/projectModel-api:projectModel",
"//platform/util",
"//platform/platform-api:ide",
"//platform/platform-util-io:ide-util-io",
"//plugins/agent-workbench/claude/common",
"//libraries/junit5",
"//platform/testFramework",
"//platform/testFramework:testFramework_test_lib",
"//platform/testFramework/junit5",
"//platform/testFramework/junit5:junit5_test_lib",
"//libraries/assertj-core",
]
)
### auto-generated section `build intellij.agent.workbench.claude.sessions` end
### auto-generated section `test intellij.agent.workbench.claude.sessions` start
load("@community//build:tests-options.bzl", "jps_test")
jps_test(
name = "sessions_test",
runtime_deps = [":sessions_test_lib"]
)
### auto-generated section `test intellij.agent.workbench.claude.sessions` end

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="com.intellij.agent.workbench.claude.sessions" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" packagePrefix="com.intellij.agent.workbench.claude.sessions" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.util" />
<orderEntry type="module" module-name="intellij.platform.ide" />
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
<orderEntry type="module" module-name="intellij.agent.workbench.claude.common" />
<orderEntry type="module" module-name="intellij.libraries.junit5" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.testFramework.junit5" scope="TEST" />
<orderEntry type="module" module-name="intellij.libraries.assertj.core" scope="TEST" />
</component>
</module>

View File

@@ -0,0 +1,7 @@
<idea-plugin>
<!-- region Generated dependencies - run `Generate Product Layouts` to regenerate -->
<dependencies>
<module name="intellij.agent.workbench.claude.common"/>
</dependencies>
<!-- endregion -->
</idea-plugin>

View File

@@ -0,0 +1,16 @@
// 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.claude.sessions
import com.intellij.openapi.project.Project
data class ClaudeBackendThread(
val id: String,
val title: String,
val updatedAt: Long,
val gitBranch: String? = null,
)
interface ClaudeSessionBackend {
suspend fun listThreads(path: String, openProject: Project?): List<ClaudeBackendThread>
}

View File

@@ -0,0 +1,7 @@
// 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.claude.sessions
fun createDefaultClaudeSessionBackend(): ClaudeSessionBackend {
return ClaudeStoreSessionBackend()
}

View File

@@ -0,0 +1,24 @@
// 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.claude.sessions
import com.intellij.agent.workbench.claude.common.ClaudeSessionThread
import com.intellij.agent.workbench.claude.common.ClaudeSessionsStore
import com.intellij.openapi.project.Project
class ClaudeStoreSessionBackend(
private val store: ClaudeSessionsStore = ClaudeSessionsStore(),
) : ClaudeSessionBackend {
override suspend fun listThreads(path: String, @Suppress("UNUSED_PARAMETER") openProject: Project?): List<ClaudeBackendThread> {
return store.listThreads(projectPath = path).map { it.toBackendThread() }
}
}
private fun ClaudeSessionThread.toBackendThread(): ClaudeBackendThread {
return ClaudeBackendThread(
id = id,
title = title,
updatedAt = updatedAt,
gitBranch = gitBranch,
)
}

View File

@@ -1,5 +1,5 @@
// 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.sessions
package com.intellij.agent.workbench.claude.sessions
import com.intellij.agent.workbench.claude.common.ClaudeSessionsStore
import kotlinx.coroutines.runBlocking
@@ -174,3 +174,4 @@ class ClaudeSessionsStoreTest {
assertThat(threads).isEmpty()
}
}

View File

@@ -2,6 +2,8 @@
modules:
- name: intellij.agent.workbench.plugin
contentModules:
- name: intellij.agent.workbench.claude.common
- name: intellij.agent.workbench.claude.sessions
- name: intellij.agent.workbench.codex.common
- name: intellij.agent.workbench.codex.sessions
- name: intellij.agent.workbench.sessions

View File

@@ -7,6 +7,9 @@
- name: lib/modules/intellij.agent.workbench.claude.common.jar
contentModules:
- name: intellij.agent.workbench.claude.common
- name: lib/modules/intellij.agent.workbench.claude.sessions.jar
contentModules:
- name: intellij.agent.workbench.claude.sessions
- name: lib/modules/intellij.agent.workbench.codex.common.jar
contentModules:
- name: intellij.agent.workbench.codex.common

View File

@@ -6,6 +6,7 @@
<vendor>JetBrains</vendor>
<content namespace="jetbrains">
<module name="intellij.agent.workbench.claude.common"/>
<module name="intellij.agent.workbench.claude.sessions"/>
<module name="intellij.agent.workbench.codex.common"/>
<module name="intellij.agent.workbench.codex.sessions"/>
<module name="intellij.agent.workbench.sessions"/>

View File

@@ -7,6 +7,7 @@ import org.junit.platform.suite.api.Suite
@Suite
@SelectPackages(
"com.intellij.agent.workbench.chat",
"com.intellij.agent.workbench.claude.sessions",
"com.intellij.agent.workbench.codex.sessions",
"com.intellij.agent.workbench.sessions",
)

View File

@@ -25,7 +25,7 @@ jvm_library(
"//platform/projectModel-api:projectModel",
"//platform/util",
"//platform/platform-util-io:ide-util-io",
"//plugins/agent-workbench/claude/common",
"//plugins/agent-workbench/claude/sessions",
"//plugins/agent-workbench/codex/common",
"//plugins/agent-workbench/codex/sessions",
"//plugins/agent-workbench/chat",
@@ -54,7 +54,8 @@ jvm_library(
"//platform/projectModel-api:projectModel",
"//platform/util",
"//platform/platform-util-io:ide-util-io",
"//plugins/agent-workbench/claude/common",
"//plugins/agent-workbench/claude/sessions",
"//plugins/agent-workbench/claude/sessions:sessions_test_lib",
"//plugins/agent-workbench/codex/common",
"//plugins/agent-workbench/codex/sessions",
"//plugins/agent-workbench/codex/sessions:sessions_test_lib",

View File

@@ -44,7 +44,7 @@
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.util" />
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
<orderEntry type="module" module-name="intellij.agent.workbench.claude.common" />
<orderEntry type="module" module-name="intellij.agent.workbench.claude.sessions" />
<orderEntry type="module" module-name="intellij.agent.workbench.codex.common" />
<orderEntry type="module" module-name="intellij.agent.workbench.codex.sessions" />
<orderEntry type="module" module-name="intellij.agent.workbench.chat" />

View File

@@ -0,0 +1 @@
skip: icons/**/*

View File

@@ -3,7 +3,7 @@
<dependencies>
<!-- region Generated dependencies - run `Generate Product Layouts` to regenerate -->
<module name="intellij.agent.workbench.claude.common"/>
<module name="intellij.agent.workbench.claude.sessions"/>
<module name="intellij.agent.workbench.codex.common"/>
<module name="intellij.agent.workbench.codex.sessions"/>
<module name="intellij.agent.workbench.chat"/>

View File

@@ -1,13 +1,12 @@
// 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.sessions.providers
import com.intellij.agent.workbench.claude.common.ClaudeSessionsStore
import com.intellij.agent.workbench.sessions.providers.claude.ClaudeSessionSource
import com.intellij.agent.workbench.sessions.providers.codex.CodexSessionSource
internal fun createDefaultAgentSessionSources(): List<AgentSessionSource> {
return listOf(
CodexSessionSource(),
ClaudeSessionSource(ClaudeSessionsStore()),
ClaudeSessionSource(),
)
}

View File

@@ -1,23 +1,23 @@
// 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.sessions.providers.claude
import com.intellij.agent.workbench.claude.common.ClaudeSessionThread
import com.intellij.agent.workbench.claude.common.ClaudeSessionsStore
import com.intellij.agent.workbench.claude.sessions.ClaudeBackendThread
import com.intellij.agent.workbench.claude.sessions.ClaudeSessionBackend
import com.intellij.agent.workbench.claude.sessions.createDefaultClaudeSessionBackend
import com.intellij.agent.workbench.sessions.AgentSessionProvider
import com.intellij.agent.workbench.sessions.AgentSessionThread
import com.intellij.agent.workbench.sessions.providers.BaseAgentSessionSource
import com.intellij.openapi.project.Project
internal class ClaudeSessionSource(
private val store: ClaudeSessionsStore,
private val backend: ClaudeSessionBackend = createDefaultClaudeSessionBackend(),
) : BaseAgentSessionSource(provider = AgentSessionProvider.CLAUDE) {
@Suppress("UNUSED_PARAMETER")
override suspend fun listThreads(path: String, openProject: Project?): List<AgentSessionThread> {
return store.listThreads(projectPath = path).map { it.toAgentSessionThread() }
return backend.listThreads(path = path, openProject = openProject).map { it.toAgentSessionThread() }
}
}
private fun ClaudeSessionThread.toAgentSessionThread(): AgentSessionThread {
private fun ClaudeBackendThread.toAgentSessionThread(): AgentSessionThread {
return AgentSessionThread(
id = id,
title = title,