feat: OpenCode chat support#4
Open
Ar9av wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Read OpenCode sessions from ~/.local/share/opencode/opencode.db (SQLite, v1.2.0+) and surface them alongside Claude Code sessions throughout the UI. Changes: - lib/opencode-fs.ts — new module; reads session/message/part tables and converts to AgentTower's ParsedMessage/SessionInfo/ProjectInfo types - typings/node-sqlite.d.ts — minimal type shim for node:sqlite built-in - lib/types.ts — add `source?: 'claude' | 'opencode'` to ProjectInfo, SessionInfo - lib/claude-fs.ts — add `source: 'claude'` to RecentSession type and all returned objects - API routes (projects, sessions, recent-sessions, session, tail) — merge Claude and OpenCode data; opencode: prefix routes to the new module - app/projects/page.tsx — merge both project lists, sort by mtime - app/project/page.tsx — OpenCode branch: read-only session list with source badge; Claude branch unchanged - app/session/page.tsx — detect opencode: filepath prefix, parse from SQLite instead of JSONL - components/LiveSession.tsx — new `source` prop; OpenCode sessions skip SSE tail, process polling, fork buttons, and the input bar (replaced by a read-only notice)
b97237f to
69e5cf0
Compare
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.
Summary
Adds support for reading and displaying OpenCode chat sessions alongside Claude Code sessions throughout AgentTower.
lib/opencode-fs.ts— new module that reads~/.local/share/opencode/opencode.db(SQLite, OpenCode v1.2.0+). Convertssession,message, andparttables into AgentTower'sParsedMessage/SessionInfo/ProjectInfotypes. Uses the built-innode:sqlitemodule (Node.js 22+); falls back gracefully when the DB doesn't exist.typings/node-sqlite.d.ts— minimal TypeScript shim fornode:sqlite(not yet in@types/nodefor this project's config).lib/types.ts— addedsource?: 'claude' | 'opencode'toProjectInfoandSessionInfo.lib/claude-fs.ts— addedsource: 'claude'field toRecentSessiontype and all returned objects.projects,sessions,recent-sessions,session,tail) — merged Claude + OpenCode data;opencode:prefix in thef/pparams routes to the new module. Thetailroute returns an empty SSE stream for OpenCode sessions (they're static).app/projects/page.tsx— merges both project lists, sorted by most-recently-active.app/project/page.tsx— OpenCode projects render a read-only session list with a source badge; Claude projects render the existing full-featured view.app/session/page.tsx— detectsopencode:filepath prefix and reads from SQLite instead of JSONL.components/LiveSession.tsx— newsourceprop; OpenCode sessions skip SSE connection, process polling, fork buttons, and the input bar (replaced by a "read-only" notice).How it works
OpenCode session paths are encoded as
opencode:<sessionId>(base64 in URLs). The existing routing, pagination, and session-viewer components work unchanged — they just receive pre-convertedParsedMessage[]from the new module.Test plan
/projectslist with anopencodebadge~/.local/share/opencode/opencode.dbabsent) — app works normally with only Claude sessions