refactor(context): carry route and scope through runtime
This commit is contained in:
1 parent
79de00f7f3
commit
e0ceea91f6
17 files changed
+487
-84
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package session
|
||||
|
||||
// ScopeVersionV1 is the first structured session-scope schema version.
|
||||
const ScopeVersionV1 = 1
|
||||
|
||||
// SessionScope describes the semantic session partition selected for a turn.
|
||||
type SessionScope struct {
|
||||
Version int `json:"version"`
|
||||
AgentID string `json:"agent_id"`
|
||||
Channel string `json:"channel"`
|
||||
Account string `json:"account"`
|
||||
Dimensions []string `json:"dimensions"`
|
||||
Values map[string]string `json:"values"`
|
||||
}
|
||||
|
||||
// CloneScope returns a deep copy of scope.
|
||||
func CloneScope(scope *SessionScope) *SessionScope {
|
||||
if scope == nil {
|
||||
return nil
|
||||
}
|
||||
cloned := *scope
|
||||
if len(scope.Dimensions) > 0 {
|
||||
cloned.Dimensions = append([]string(nil), scope.Dimensions...)
|
||||
}
|
||||
if len(scope.Values) > 0 {
|
||||
cloned.Values = make(map[string]string, len(scope.Values))
|
||||
for key, value := range scope.Values {
|
||||
cloned.Values[key] = value
|
||||
}
|
||||
}
|
||||
return &cloned
|
||||
}
|
||||
Reference in new issue
Block a user