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:
viettranx committed 2026-03-24 22:47:57 +07:00
1 parent 781ed2a2fd
commit b221ed2fb6
1 file changed
+15
+15
View File
@@ -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)