Skip to content

Refactor: shared utilities, plugin cleanup, and bug fixes#6

Merged
Vrtak-CZ merged 73 commits intomainfrom
refactor
Feb 24, 2026
Merged

Refactor: shared utilities, plugin cleanup, and bug fixes#6
Vrtak-CZ merged 73 commits intomainfrom
refactor

Conversation

@Vrtak-CZ
Copy link
Copy Markdown
Member

Summary

  • Shared utilities: Centralized JSON parsing, JSONL iteration, text truncation, ISO timestamp sorting, epoch-to-ISO conversion, discovery file scan helpers, and session ID normalization into shared modules
  • Plugin refactoring: Simplified discovery and parser logic across claude-code, codex-cli, and opencode plugins; removed deprecated Claude compatibility APIs; localized generated tool ID state; removed in-memory caching from stats and session index
  • Frontend improvements: Extracted App view state/routing concerns, shared session fetch hooks and error UI component, added plugin registry for tool summaries, and added stale request abort on cleanup
  • Bug fixes: Validated sub-agent session IDs, rejected empty session IDs in API routes, included pluginId in sub-agent sessions, bound server to localhost by default
  • Housekeeping: Renamed .claude to .agents with compatibility symlinks, gitignored local agent settings, excluded dist artifacts from typecheck

Test plan

  • bun run check — lint and format pass
  • bun run typecheck — no type errors
  • bun test — 560 tests pass, 0 failures

🤖 Generated with Claude Code

Vrtak-CZ and others added 30 commits February 23, 2026 23:14
Approved design for making Klovi a universal AI coding session viewer
with plugin system supporting Claude Code, Codex CLI, and OpenCode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 tasks across 8 phases: plugin types, registry, Claude Code extraction,
config/CLI, API wiring, frontend changes, Codex CLI plugin, OpenCode plugin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move project discovery, session listing, classifySessionTypes, aggregateSessions,
and related helpers from src/server/parser/claude-dir.ts into
src/server/plugins/claude-code/discovery.ts. Add discoverClaudeProjects() and
listClaudeSessions() with pluginId support. Original file now re-exports for
backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move parseSession (renamed to loadClaudeSession), parseSubAgentSession,
buildTurns, extractSubAgentMap, extractSlug, findPlanSessionId,
findImplSessionId, and all helpers from src/server/parser/session.ts into
src/server/plugins/claude-code/parser.ts. loadClaudeSession sets pluginId on
returned Session objects. Original file now re-exports for backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add src/server/plugins/claude-code/index.ts implementing the ToolPlugin
interface with id, displayName, project discovery, session listing, session
loading, and resume command support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add getCodexCliDir/setCodexCliDir and getOpenCodeDir/setOpenCodeDir
config functions alongside existing Claude Code config, with full
test coverage and proper save/restore in beforeEach/afterEach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add CLI flags for Codex CLI and OpenCode data directories, update help
text to say "AI coding sessions", show all scanned directories in the
security warning, and change missing Claude Code dir from fatal error
to warning so Klovi starts even if only other tools are installed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace direct Claude Code function calls in API handlers with PluginRegistry.
Create registry factory that auto-discovers plugins by checking data dir existence.
Support compound session IDs (pluginId::sessionId) with backward compatibility.
Search endpoint now aggregates sessions from all registered plugins.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a session has a pluginId, display the plugin's display name
(e.g., "Claude Code") instead of the model name in the sidebar
session list and global search results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded isClaudeModel() check with getResumeCommand()
that returns the correct resume command per plugin (claude --resume,
codex resume). Add frontend plugin registry for future tool-specific
renderers and pluginId prop to ToolCall component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add discovery module that scans ~/.codex/sessions/ recursively for JSONL
session files, extracts SessionMeta from the first line, and groups
sessions by cwd to identify projects. Includes summary extractors for
Codex-specific tool names (command_execution, file_change, web_search).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parse Codex CLI JSONL sessions into the shared Session type. Maps
item.completed events to ContentBlocks: agent_message to text,
reasoning to thinking, command_execution/file_change/mcp_tool_call/
web_search to ToolCallWithResult. Tracks token usage from
turn.completed events.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire the Codex CLI plugin into the server registry (auto-discovered
when ~/.codex exists) and register frontend summary extractors and
input formatters for Codex-specific tool names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add project discovery and session listing for SST's OpenCode tool,
which stores sessions in a SQLite database. Uses schema introspection
to handle schema variations gracefully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parse OpenCode messages and parts from SQLite into shared Turn types.
Handles text, reasoning, and tool parts with completed/error/pending
states. Includes comprehensive tests with temp SQLite databases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire OpenCode plugin into server registry (checks for opencode.db)
and frontend plugin registry. Add plugin entry point with no resume
command since OpenCode doesn't support session resumption.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update README, architecture, components, testing, and content types
docs to reflect the plugin system supporting Claude Code, Codex CLI,
and OpenCode. Add new CLI flags, plugin system architecture, frontend
plugin registry docs, expanded test file listing, and Codex CLI /
OpenCode content type catalogs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update countProjects() in stats.ts to use the PluginRegistry instead
of scanning only the Claude Code projects directory. This ensures the
dashboard project count reflects all discovered tools. Recent session
counting still uses Claude Code directory only (relies on file mtimes).
Update stats tests to isolate tool directories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
keep existing claude-oriented tooling working while introducing agents naming
for the project configuration and skills directory.

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
…formatting

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Vrtak-CZ and others added 15 commits February 23, 2026 23:21
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Vrtak-CZ and others added 10 commits February 23, 2026 23:49
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Browsers encode special characters like `::` as `%3A%3A` in URL path
segments, causing session lookups to fail with 400 because parseSessionId
couldn't find the `::` separator in the encoded string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ail view

Replace plain-text plugin/model identifier with a styled plugin badge,
remove model name and git branch from session list and search results,
and display git branch in the session detail view instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover lightbox rendering, keyboard/click close behavior, listener
cleanup, and SmartToolOutput integration (open/close on image click).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codex CLI updated its JSONL format to wrap everything in
{type, timestamp, payload} envelopes. This adds support for
the new format while preserving backward compatibility with
the old flat format.

- Parse session_meta envelope to extract uuid, cwd, timestamps
- Match rollout-*-{uuid}.jsonl filenames in addition to {uuid}.jsonl
- Extract user messages from event_msg/user_message payloads
- Normalize response_item/function_call events with call_id matching
- Handle task_started, task_complete, token_count, agent_reasoning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Provide Codex JSONL demo transcripts with comparable project and
session coverage to the existing Claude demo data so mixed-source
browsing can be exercised locally.

Co-Authored-By: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Add demo data for opencode including:
- Session data with JWT auth and dashboard bug fix examples
- Project data with Kanban board creation example

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Vrtak-CZ Vrtak-CZ merged commit 834a598 into main Feb 24, 2026
1 check passed
@Vrtak-CZ Vrtak-CZ deleted the refactor branch February 25, 2026 12:52
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.

1 participant