Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/parser/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ func providerFactoryForDef(def AgentDef) ProviderFactory {
return newQwenProviderFactory(def)
case AgentQwenPaw:
return newQwenPawProviderFactory(def)
case AgentShelley:
return newShelleyProviderFactory(def)
case AgentVSCopilot:
return newVisualStudioCopilotProviderFactory(def)
case AgentVSCodeCopilot:
Expand All @@ -410,6 +412,8 @@ func providerFactoryForDef(def AgentDef) ProviderFactory {
return newWorkBuddyProviderFactory(def)
case AgentZencoder:
return newZencoderProviderFactory(def)
case AgentZed:
return newZedProviderFactory(def)
default:
return legacyProviderFactory{def: def}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/parser/provider_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ var providerMigrationModes = map[AgentType]ProviderMigrationMode{
AgentAntigravity: ProviderMigrationLegacyOnly,
AgentAntigravityCLI: ProviderMigrationLegacyOnly,
AgentVibe: ProviderMigrationProviderAuthoritative,
AgentZed: ProviderMigrationLegacyOnly,
AgentZed: ProviderMigrationProviderAuthoritative,
AgentQwenPaw: ProviderMigrationProviderAuthoritative,
AgentGptme: ProviderMigrationProviderAuthoritative,
AgentShelley: ProviderMigrationLegacyOnly,
AgentShelley: ProviderMigrationProviderAuthoritative,
AgentAider: ProviderMigrationLegacyOnly,
AgentOMP: ProviderMigrationProviderAuthoritative,
AgentReasonix: ProviderMigrationLegacyOnly,
Expand Down
3 changes: 1 addition & 2 deletions internal/parser/provider_shim_scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ var pendingShimProviderFiles = map[string]bool{
"kiro_ide_provider.go": true,
"kiro_provider.go": true,
"opencode_provider.go": true,
"shelley_provider.go": true,
"positron_provider.go": true,
"vibe_provider.go": true,
"visualstudio_copilot_provider.go": true,
"vscode_copilot_provider.go": true,
"zed_provider.go": true,
}

// collectLegacyFreeFuncs returns the set of package-level free functions in the
Expand Down
81 changes: 3 additions & 78 deletions internal/parser/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"hash"
"hash/fnv"
"os"
"path/filepath"
"strconv"
"strings"

Expand Down Expand Up @@ -102,63 +101,6 @@ func ShelleyVirtualPath(dbPath, conversationID string) string {
return dbPath + "#" + conversationID
}

// ParseShelleyVirtualPath splits a virtual Shelley source path back into
// its database path and raw conversation ID.
func ParseShelleyVirtualPath(path string) (string, string, bool) {
idx := strings.LastIndex(path, "#")
if idx < 0 {
return "", "", false
}
dbPath, conversationID := path[:idx], path[idx+1:]
if filepath.Base(dbPath) != shelleyDBName || conversationID == "" {
return "", "", false
}
return dbPath, conversationID, true
}

// FindShelleyDBPath returns the shelley.db under the configured root, or
// "" when the root holds no Shelley database.
func FindShelleyDBPath(dir string) string {
if dir == "" {
return ""
}
path := filepath.Join(dir, shelleyDBName)
if !IsRegularFile(path) {
return ""
}
return path
}

// DiscoverShelleySessions discovers Shelley's conversation database under
// the configured data directory. Like Zed, it returns a single entry for
// the shared DB; the sync engine fans it out to one session per
// conversation.
func DiscoverShelleySessions(root string) []DiscoveredFile {
dbPath := FindShelleyDBPath(root)
if dbPath == "" {
return nil
}
return []DiscoveredFile{{Path: dbPath, Agent: AgentShelley}}
}

// FindShelleySourceFile locates Shelley's shared conversation database
// for a raw conversation ID. All conversations live in one SQLite DB, so
// the ID is validated only to reject path-like input and is resolved to
// a virtual path when the conversation exists under this root.
func FindShelleySourceFile(root, rawID string) string {
if root == "" || !IsValidSessionID(rawID) {
return ""
}
dbPath := FindShelleyDBPath(root)
if dbPath == "" {
return ""
}
if ShelleyConversationExists(dbPath, rawID) {
return ShelleyVirtualPath(dbPath, rawID)
}
return ""
}

// ShelleyConversationExists reports whether the Shelley DB has a
// conversation row with the given ID.
func ShelleyConversationExists(dbPath, conversationID string) bool {
Expand Down Expand Up @@ -347,7 +289,7 @@ func ListShelleyConversationMetas(
// This value is watcher-only and never written to file_mtime or
// range-filtered, so the sub-second term is harmless here.
func ShelleySourceMtime(path string) (int64, error) {
dbPath, conversationID, ok := ParseShelleyVirtualPath(path)
dbPath, conversationID, ok := parseShelleyVirtualPath(path)
if !ok {
return 0, fmt.Errorf("not a shelley virtual path: %s", path)
}
Expand Down Expand Up @@ -413,27 +355,10 @@ func openShelleyDB(dbPath string) (*sql.DB, error) {
return db, nil
}

// ParseShelleyConversationDirect parses a single conversation by ID,
// opening and closing its own connection. dbInfo must be the os.FileInfo
// of the shelley.db file itself.
func ParseShelleyConversationDirect(
dbPath, rawID, machine string, dbInfo os.FileInfo,
) (*ParseResult, error) {
if !IsValidSessionID(rawID) {
return nil, fmt.Errorf("invalid Shelley session ID: %s", rawID)
}
conn, err := openShelleyDB(dbPath)
if err != nil {
return nil, err
}
defer conn.Close()
return ParseShelleyConversationFromDB(conn, dbPath, rawID, machine, dbInfo)
}

// ParseShelleyConversationFromDB parses one conversation using an
// parseShelleyConversationFromDB parses one conversation using an
// already-open connection. Callers parsing multiple conversations should
// open the DB once and call this in a loop.
func ParseShelleyConversationFromDB(
func parseShelleyConversationFromDB(
conn *sql.DB, dbPath, rawID, machine string, dbInfo os.FileInfo,
) (*ParseResult, error) {
conv, err := loadShelleyConversation(conn, rawID)
Expand Down
Loading