mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-14 14:17:40 +00:00
fix(store): add missing WithAgentKey context function
Commit a8815a94 introduced a call to store.WithAgentKey() in agent/loop.go but never added the function to store/context.go, breaking the build on main.
This commit is contained in:
1 parent
781ed2a2fd
commit
b221ed2fb6
1 file changed
+15
@@ -29,6 +29,8 @@ const (
|
||||
SharedKGKey contextKey = "goclaw_shared_kg"
|
||||
// ShellDenyGroupsKey holds per-agent shell deny group overrides.
|
||||
ShellDenyGroupsKey contextKey = "goclaw_shell_deny_groups"
|
||||
// AgentKeyKey is the context key for the agent key/name (string identifier, e.g. "default").
|
||||
AgentKeyKey contextKey = "goclaw_agent_key"
|
||||
// TenantIDKey is the context key for the tenant UUID.
|
||||
TenantIDKey contextKey = "goclaw_tenant_id"
|
||||
// CrossTenantKey indicates the caller has cross-tenant access (owner/system admin).
|
||||
@@ -89,6 +91,19 @@ func AgentTypeFromContext(ctx context.Context) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// WithAgentKey returns a new context with the agent key/name (string identifier).
|
||||
func WithAgentKey(ctx context.Context, key string) context.Context {
|
||||
return context.WithValue(ctx, AgentKeyKey, key)
|
||||
}
|
||||
|
||||
// AgentKeyFromContext extracts the agent key from context. Returns "" if not set.
|
||||
func AgentKeyFromContext(ctx context.Context) string {
|
||||
if v, ok := ctx.Value(AgentKeyKey).(string); ok {
|
||||
return v
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// WithSenderID returns a new context with the original individual sender ID.
|
||||
func WithSenderID(ctx context.Context, id string) context.Context {
|
||||
return context.WithValue(ctx, SenderIDKey, id)
|
||||
|
||||
Reference in new issue
Block a user