Repository navigation
feat(agent-history-panel, agent-run-area, agent-view, workspace-service): Introduce Workspace Service and update Agent components - #689
Merged
Conversation
…ce): Introduce Workspace Service and update Agent components - Introduced a new `WorkspaceService` to manage workspace-related operations. - Updated `AgentHistoryPanel` to remove unused imports and refactor skill run history panel. - Enhanced `AgentRunArea` to handle Workspace and update turn responses. - Modified `AgentView` to incorporate Workspace and adjust agentic content handling. - Updated i18n messages for various languages to include new Agent and Skill titles. - Updated `DesktopModule` to include the new `WorkspaceService`. - Refactored `CursorAgent` to remove unused workspace directory handling. - Removed deprecated fields from `ExternalAgent` and `ExternalAgentTemplate`. - Updated `AgentRunRecord` to include workspace and conversation IDs. - Expanded `AgentRunHistoryRepository` to handle workspace and conversation IDs. - Added `findMostRecentlyUsed` method to `WorkspaceRepository`. - Refactored `DatabaseManager` to manage database connections more effectively.
There was a problem hiding this comment.
Pull request overview
This PR introduces a Workspace-centric model for agent runs by adding a WorkspaceService, updating UI components to resolve and pass a persisted Workspace, and refactoring agent run history to be grouped by workspace + multi-turn conversations (via conversation_id) instead of a sentinel skill path.
Changes:
- Added
WorkspaceServiceandWorkspaceRepository.findMostRecentlyUsed()to resolve/select the “current” workspace bylastUsedAt. - Refactored agent run history persistence and UI to use
workspace_id+conversation_id, enabling multi-turn history reconstruction and conversation-level deletion. - Updated settings/i18n labels and added integration tests for
WorkspaceRepositoryandAgentRunHistoryRepository.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/src/main/kotlin/io/askimo/core/db/DatabaseManager.kt | Reorders table creation for FK dependencies; updates agent_run_history schema/indexes; removes deprecated test helpers. |
| shared/src/main/kotlin/io/askimo/core/agent/service/WorkspaceService.kt | New service layer for resolving/selecting/renaming/pinning/deleting workspaces. |
| shared/src/main/kotlin/io/askimo/core/agent/repository/WorkspaceRepository.kt | Adds MRU lookup ignoring pinned ordering. |
| shared/src/main/kotlin/io/askimo/core/agent/repository/AgentRunHistoryRepository.kt | Persists and queries history by workspace_id and conversation_id; adds conversation/thread APIs and deletion helpers. |
| shared/src/main/kotlin/io/askimo/core/agent/domain/AgentRunRecord.kt | Updates domain + Exposed table to use workspaceId/conversationId and drops legacy fields. |
| shared/src/main/kotlin/io/askimo/core/agent/ExternalAgent.kt | Removes lastExecutionWorkspaceDir from agent interface. |
| shared/src/main/kotlin/io/askimo/core/agent/ExternalAgentTemplate.kt | Removes workspace-dir execution metadata tracking. |
| shared/src/main/kotlin/io/askimo/core/agent/CursorAgent.kt | Stops capturing cwd as execution workspace metadata. |
| desktop/src/main/kotlin/io/askimo/desktop/di/DesktopModule.kt | Registers WorkspaceRepository and WorkspaceService with DI. |
| desktop-shared/src/main/kotlin/io/askimo/ui/common/preferences/ApplicationPreferences.kt | Removes persisted “selected workspace id” preference (workspace selection now derives from lastUsedAt). |
| desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentView.kt | Resolves current workspace via WorkspaceService; loads/group history by conversation; passes Workspace through to run area. |
| desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentRunArea.kt | Saves runs with workspaceId/conversationId; reconstructs full conversation on preload. |
| desktop-shared/src/main/kotlin/io/askimo/ui/agent/AgentHistoryPanel.kt | Simplifies history rows (removes skill-name display/filtering). |
| desktop-shared/src/main/kotlin/io/askimo/ui/settings/AgentsSettingsSection.kt | Updates UI string key usage for the Skills title. |
| desktop-shared/src/main/resources/i18n/messages*.properties | Updates translations for “Agents & Skills” and adds a separate “Skills” title key across locales. |
| cli/src/test/kotlin/io/askimo/core/agent/repository/WorkspaceRepositoryIT.kt | Adds integration coverage for workspace CRUD + ordering behavior. |
| cli/src/test/kotlin/io/askimo/core/agent/repository/AgentRunHistoryRepositoryIT.kt | Adds integration coverage for history save/query/delete and conversation threading. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
713
to
748
| private fun createAgentRunHistoryTable(conn: Connection) { | ||
| conn.createStatement().use { stmt -> | ||
| stmt.executeUpdate( | ||
| """ | ||
| CREATE TABLE IF NOT EXISTS agent_run_history ( | ||
| id TEXT PRIMARY KEY, | ||
| skill_path TEXT NOT NULL, | ||
| workspace_id TEXT NOT NULL REFERENCES workspaces(id), | ||
| conversation_id TEXT NOT NULL, | ||
| user_input TEXT NOT NULL DEFAULT '', | ||
| response TEXT NOT NULL DEFAULT '', | ||
| error TEXT, | ||
| agent_session_id TEXT, | ||
| workspace_dir TEXT, | ||
| activity_log TEXT NOT NULL DEFAULT '', | ||
| input_tokens INTEGER, | ||
| output_tokens INTEGER, | ||
| total_tokens INTEGER, | ||
| duration_ms INTEGER, | ||
| created_at TEXT NOT NULL | ||
| ) | ||
| """.trimIndent(), | ||
| ) | ||
|
|
||
| stmt.executeUpdate( | ||
| """ | ||
| CREATE INDEX IF NOT EXISTS idx_agent_run_history_skill_path | ||
| ON agent_run_history (skill_path, created_at) | ||
| CREATE INDEX IF NOT EXISTS idx_agent_run_history_workspace | ||
| ON agent_run_history (workspace_id, created_at) | ||
| """.trimIndent(), | ||
| ) | ||
|
|
||
| stmt.executeUpdate( | ||
| """ | ||
| CREATE INDEX IF NOT EXISTS idx_agent_run_history_conversation | ||
| ON agent_run_history (conversation_id, created_at) | ||
| """.trimIndent(), | ||
| ) | ||
| } |
Comment on lines
717
to
722
| CREATE TABLE IF NOT EXISTS agent_run_history ( | ||
| id TEXT PRIMARY KEY, | ||
| skill_path TEXT NOT NULL, | ||
| workspace_id TEXT NOT NULL REFERENCES workspaces(id), | ||
| conversation_id TEXT NOT NULL, | ||
| user_input TEXT NOT NULL DEFAULT '', | ||
| response TEXT NOT NULL DEFAULT '', |
Comment on lines
+130
to
+133
| runHistory = all | ||
| .groupBy { it.conversationId } | ||
| .map { (_, turns) -> turns.maxBy { it.createdAt } } | ||
| .sortedByDescending { it.createdAt } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WorkspaceServiceto manage workspace-related operations.AgentHistoryPanelto remove unused imports and refactor skill run history panel.AgentRunAreato handle Workspace and update turn responses.AgentViewto incorporate Workspace and adjust agentic content handling.