gunk-dev/the-valley

agy.go

sourced9c8073fd613main's published tip history
733 bytes
1package backend
2
3import (
4 "encoding/json"
5 "os"
6 "path/filepath"
7)
8
9// AgyConversationID recovers only the conversation recorded for this workspace.
10// The cache is best-effort: absent/changed metadata means a fresh conversation,
11// never a guess at the globally most recent conversation.
12func AgyConversationID(workspace string) string {
13 home, err := os.UserHomeDir()
14 if err != nil {
15 return ""
16 }
17 data, err := os.ReadFile(filepath.Join(home, ".gemini", "antigravity-cli", "cache", "last_conversations.json"))
18 if err != nil {
19 return ""
20 }
21 var sessions map[string]string
22 if json.Unmarshal(data, &sessions) != nil {
23 return ""
24 }
25 abs, err := filepath.Abs(workspace)
26 if err != nil {
27 return ""
28 }
29 return sessions[abs]
30}