mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 10:02:04 +08:00
refactor(jetbrains): move services to client.app package, rename ChatModel to SessionState
- Move KiloAppService, KiloSessionService, KiloWorkspaceService, Workspace from client/client.workspace to client.app package - Rename ChatModel to SessionState for clarity - Update all imports across actions, chat, tests
This commit is contained in:
+3
-1
@@ -1,7 +1,9 @@
|
||||
package ai.kilocode.client
|
||||
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.client.app.KiloSessionService
|
||||
import ai.kilocode.client.chat.SessionUi
|
||||
import ai.kilocode.client.workspace.KiloWorkspaceService
|
||||
import ai.kilocode.client.app.KiloWorkspaceService
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package ai.kilocode.client.actions
|
||||
|
||||
import ai.kilocode.client.KiloAppService
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.rpc.dto.KiloAppStatusDto
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package ai.kilocode.client.actions
|
||||
|
||||
import ai.kilocode.client.KiloAppService
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.rpc.dto.KiloAppStatusDto
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package ai.kilocode.client.actions
|
||||
|
||||
import ai.kilocode.client.KiloAppService
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.client.plugin.KiloBundle
|
||||
import ai.kilocode.rpc.dto.KiloAppStatusDto
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
package ai.kilocode.client
|
||||
package ai.kilocode.client.app
|
||||
|
||||
import ai.kilocode.rpc.KiloAppRpcApi
|
||||
import ai.kilocode.rpc.dto.HealthDto
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
package ai.kilocode.client
|
||||
package ai.kilocode.client.app
|
||||
|
||||
import ai.kilocode.rpc.KiloSessionRpcApi
|
||||
import ai.kilocode.rpc.dto.ChatEventDto
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
package ai.kilocode.client.workspace
|
||||
package ai.kilocode.client.app
|
||||
|
||||
import ai.kilocode.rpc.KiloWorkspaceRpcApi
|
||||
import ai.kilocode.rpc.dto.KiloWorkspaceStateDto
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ai.kilocode.client.workspace
|
||||
package ai.kilocode.client.app
|
||||
|
||||
import ai.kilocode.rpc.dto.KiloWorkspaceStateDto
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package ai.kilocode.client.chat
|
||||
|
||||
import ai.kilocode.client.KiloAppService
|
||||
import ai.kilocode.client.KiloSessionService
|
||||
import ai.kilocode.client.workspace.Workspace
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.client.app.KiloSessionService
|
||||
import ai.kilocode.client.app.Workspace
|
||||
import ai.kilocode.client.chat.model.SessionEvent
|
||||
import ai.kilocode.client.chat.model.SessionModel
|
||||
import ai.kilocode.client.chat.ui.LabelPicker
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ package ai.kilocode.client.chat.model
|
||||
* Change events fired by [SessionModel] on the EDT.
|
||||
*
|
||||
* Events carry IDs so the UI knows **which** message/part changed.
|
||||
* The UI can read full data from [ChatModel] directly (safe — same
|
||||
* The UI can read full data from [SessionState] directly (safe — same
|
||||
* EDT thread). [PartDelta] also carries the delta string so the
|
||||
* view can append efficiently without reading the whole text.
|
||||
*/
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
package ai.kilocode.client.chat.model
|
||||
|
||||
import ai.kilocode.client.KiloAppService
|
||||
import ai.kilocode.client.KiloSessionService
|
||||
import ai.kilocode.client.workspace.Workspace
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.client.app.KiloSessionService
|
||||
import ai.kilocode.client.app.Workspace
|
||||
import ai.kilocode.rpc.dto.ChatEventDto
|
||||
import ai.kilocode.rpc.dto.ConfigUpdateDto
|
||||
import ai.kilocode.rpc.dto.KiloAppStatusDto
|
||||
@@ -24,7 +24,7 @@ import kotlinx.coroutines.launch
|
||||
* ensures event subscription happens *before* the prompt is sent,
|
||||
* eliminating race conditions.
|
||||
*
|
||||
* Owns [ChatModel] and the listener list. All model mutations and
|
||||
* Owns [SessionState] and the listener list. All model mutations and
|
||||
* listener notifications happen on the EDT — [fire] auto-dispatches
|
||||
* via `invokeLater` when called from a background thread.
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ class SessionModel(
|
||||
Disposer.register(parent, this)
|
||||
}
|
||||
|
||||
val chat = ChatModel()
|
||||
val chat = SessionState()
|
||||
|
||||
private val listeners = mutableListOf<SessionModelListener>()
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import ai.kilocode.rpc.dto.PartDto
|
||||
* **EDT-only access** — no synchronization. [SessionModel] guarantees
|
||||
* all reads and writes happen on the EDT.
|
||||
*/
|
||||
class ChatModel {
|
||||
class SessionState {
|
||||
|
||||
private val messages = LinkedHashMap<String, MessageData>()
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import javax.swing.SwingConstants
|
||||
* Welcome panel showing app + workspace initialization progress.
|
||||
*
|
||||
* Pure view — listens to [SessionModel] events and reads
|
||||
* [ChatModel][ai.kilocode.client.chat.model.ChatModel] for data.
|
||||
* [ChatModel][ai.kilocode.client.chat.model.SessionState] for data.
|
||||
* No coroutines, no service references.
|
||||
*
|
||||
* Uses icon+label rows for each resource being loaded. Icons act as
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
package ai.kilocode.client.chat.model
|
||||
|
||||
import ai.kilocode.client.KiloAppService
|
||||
import ai.kilocode.client.KiloSessionService
|
||||
import ai.kilocode.client.app.KiloAppService
|
||||
import ai.kilocode.client.app.KiloSessionService
|
||||
import ai.kilocode.client.testing.FakeAppRpcApi
|
||||
import ai.kilocode.client.testing.FakeWorkspaceRpcApi
|
||||
import ai.kilocode.client.testing.FakeSessionRpcApi
|
||||
import ai.kilocode.client.workspace.KiloWorkspaceService
|
||||
import ai.kilocode.client.workspace.Workspace
|
||||
import ai.kilocode.client.app.KiloWorkspaceService
|
||||
import ai.kilocode.client.app.Workspace
|
||||
import ai.kilocode.rpc.dto.AgentDto
|
||||
import ai.kilocode.rpc.dto.AgentsDto
|
||||
import ai.kilocode.rpc.dto.ChatEventDto
|
||||
|
||||
Reference in New Issue
Block a user