mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-06-10 10:10:49 +00:00
f3f4c67b36
Multi-agent AI gateway with WebSocket RPC, HTTP API, and messaging channel integrations. Go port of OpenClaw with multi-tenant PostgreSQL, per-user isolation, security hardening, and production observability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
844 B
Go
35 lines
844 B
Go
package bootstrap
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/nextlevelbuilder/goclaw/internal/store"
|
|
)
|
|
|
|
// LoadFromStore loads agent-level context files from the agent store (DB).
|
|
// Returns files as ContextFile slice ready for system prompt injection.
|
|
// Returns nil if no files found or on error.
|
|
func LoadFromStore(ctx context.Context, agentStore store.AgentStore, agentID uuid.UUID) []ContextFile {
|
|
files, err := agentStore.GetAgentContextFiles(ctx, agentID)
|
|
if err != nil {
|
|
slog.Warn("failed to load context files from store", "agent", agentID, "error", err)
|
|
return nil
|
|
}
|
|
|
|
var contextFiles []ContextFile
|
|
for _, f := range files {
|
|
if f.Content == "" {
|
|
continue
|
|
}
|
|
contextFiles = append(contextFiles, ContextFile{
|
|
Path: f.FileName,
|
|
Content: f.Content,
|
|
})
|
|
}
|
|
|
|
return contextFiles
|
|
}
|