MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / Resume

Method Resume

backend/session.go:45–68  ·  view source on GitHub ↗
(sessionID, cwd string)

Source from the content-addressed store, hash-verified

43func (m *SessionManager) Create(cwd string) (*SessionController, error) {
44 id := uuid.NewString()
45 return m.createWithState(id, cwd, nil)
46}
47
48func (m *SessionManager) Resume(sessionID, cwd string) (*SessionController, error) {
49 if strings.TrimSpace(sessionID) == "" {
50 return nil, errors.New("session_id is required")
51 }
52 m.mu.Lock()
53 if existing := m.sessions[sessionID]; existing != nil {
54 m.mu.Unlock()
55 return existing, nil
56 }
57 m.mu.Unlock()
58 state := m.store.LoadState(sessionID)
59 if state == nil {
60 messages := m.store.Load(sessionID)
61 if len(messages) > 0 {
62 s := agent.NewAgentState()
63 s.Messages = messages
64 state = &s
65 }
66 }
67 if state == nil {
68 return nil, fmt.Errorf("session %s not found", sessionID)
69 }
70 return m.createWithState(sessionID, cwd, state)
71}

Callers 1

dispatchResultMethod · 0.80

Calls 4

createWithStateMethod · 0.95
NewAgentStateFunction · 0.92
LoadStateMethod · 0.80
LoadMethod · 0.80

Tested by

no test coverage detected