mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-11 03:13:24 +00:00
Migration 000023: - Migrate group_file_writers data into agent_config_permissions (config_type='file_writer') - Add FK CASCADE/SET NULL on 16 tables for agent hard delete - Clean up soft-deleted zombie agents - ALTER scope VARCHAR(100) → VARCHAR(255) - Partial unique index on agent_key (allows reuse after delete) Store layer: - Remove GroupWriterCache, GroupFileWriterData, 5 AgentStore methods - Add CheckFileWriterPermission (fail-open), ListFileWriters (cached) - Add scope filter to ConfigPermissionStore.List() Tools: Replace GroupWriterCache with ConfigPermissionStore in read_file, write_file, edit, cron, context_file_interceptor Agent loop: buildGroupWriterPrompt uses ListFileWriters + metadata parsing Channels: Telegram commands rewritten to use configPermStore.Grant/Revoke/List HTTP API: Writer endpoints rewired to configPermStore (same response shapes) Hard delete: agents.go DELETE FROM instead of soft delete
29 lines
881 B
Go
29 lines
881 B
Go
//go:build !redis
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/nextlevelbuilder/goclaw/internal/cache"
|
|
"github.com/nextlevelbuilder/goclaw/internal/config"
|
|
"github.com/nextlevelbuilder/goclaw/internal/store"
|
|
)
|
|
|
|
// initRedisClient is a no-op when built without the "redis" tag.
|
|
// Build with `go build -tags redis` to enable Redis cache.
|
|
func initRedisClient(_ *config.Config) any { return nil }
|
|
|
|
// makeCaches returns in-memory cache instances when Redis is not compiled in.
|
|
func makeCaches(_ any) (
|
|
agentCtxCache cache.Cache[[]store.AgentContextFileData],
|
|
userCtxCache cache.Cache[[]store.AgentContextFileData],
|
|
) {
|
|
slog.Info("cache backend: in-memory")
|
|
return cache.NewInMemoryCache[[]store.AgentContextFileData](),
|
|
cache.NewInMemoryCache[[]store.AgentContextFileData]()
|
|
}
|
|
|
|
// shutdownRedis is a no-op when built without the "redis" tag.
|
|
func shutdownRedis(_ any) {}
|