package agent import ( "context" "sync" ) // checkpointStore 只保存当前终端进程中的暂停状态,退出后不再保留。 type checkpointStore struct { mu sync.Mutex data map[string][]byte } func (s *checkpointStore) Get(_ context.Context, id string) ([]byte, bool, error) { s.mu.Lock() defer s.mu.Unlock() data, ok := s.data[id] return data, ok, nil } func (s *checkpointStore) Set(_ context.Context, id string, data []byte) error { s.mu.Lock() defer s.mu.Unlock() s.data[id] = data return nil } func (s *checkpointStore) Clear() { s.mu.Lock() defer s.mu.Unlock() clear(s.data) }