Skip to content

feat(agent-history-panel, agent-run-area, agent-view, workspace-service): Introduce Workspace Service and update Agent components - #689

Merged
haiphucnguyen merged 1 commit into
mainfrom
feature/minor-improvements
Sep 1, 2026
Merged

haiphucnguyen merged 1 commit into
mainfrom
feature/minor-improvements

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator
  • 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.

…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.
Copilot AI lite review requested due to automatic review settings September 1, 2026 19:01
@haiphucnguyen
haiphucnguyen merged commit 5e6ba1d into main Sep 1, 2026
11 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/minor-improvements branch September 1, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WorkspaceService and WorkspaceRepository.findMostRecentlyUsed() to resolve/select the “current” workspace by lastUsedAt.
  • 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 WorkspaceRepository and AgentRunHistoryRepository.

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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants