(new): rich message support
Golang lint / lint (pull_request) Successful in 1m20s
Golang lint / lint (push) Successful in 4m8s

(fix): runtime reliability
(tests): regression coverage
(doc): v1.1 release notes
This commit is contained in:
2026-08-12 16:34:44 +03:00
parent 48ddf66540
commit f03a081ed6
83 changed files with 6122 additions and 1925 deletions
+5 -3
View File
@@ -1,6 +1,7 @@
package laniakea
import (
"bytes"
"encoding/json"
"maps"
"sync"
@@ -131,18 +132,17 @@ type SceneSession struct {
Scene string
// Step is the current step name inside the active scene.
Step string
// data stores opaque session payload bytes, typically JSON.
data []byte
}
// SetData stores arbitrary opaque session data.
func (s *SceneSession) SetData(data []byte) {
s.data = data
s.data = bytes.Clone(data)
}
// GetData returns the raw session data payload.
func (s *SceneSession) GetData() []byte {
return s.data
return bytes.Clone(s.data)
}
// HasData reports whether the session has a non-empty data payload.
@@ -198,6 +198,7 @@ func (s *MemorySessionStore) Get(key string) (SceneSession, error) {
s.mu.RLock()
defer s.mu.RUnlock()
if session, ok := s.store[key]; ok {
session.data = bytes.Clone(session.data)
return session, nil
}
return SceneSession{}, nil
@@ -205,6 +206,7 @@ func (s *MemorySessionStore) Get(key string) (SceneSession, error) {
// Set stores session under key.
func (s *MemorySessionStore) Set(key string, session SceneSession) error {
session.data = bytes.Clone(session.data)
s.mu.Lock()
s.store[key] = session
s.mu.Unlock()