caelum0x db831658ab feat(agent): expand gRPC surface, tasks, intents, negotiations, IBC discovery
Adds full QueryServer/MsgServer gRPC services, task lifecycle handlers
(accept, checkpoint, complete, delegate), intent protocol, negotiation
system, IBC agent discovery, rate limiting, reputation adapter, and
comprehensive test coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:13:45 +03:00

26 lines
554 B
Go

package keeper
import (
"context"
"errors"
"clawchain/x/agent/types"
"cosmossdk.io/collections"
)
func (k Keeper) getOrInitAgentStats(ctx context.Context, address string) (types.AgentStats, error) {
stats, err := k.AgentStats.Get(ctx, address)
if err == nil {
return stats, nil
}
if !errors.Is(err, collections.ErrNotFound) {
return types.AgentStats{}, err
}
stats = types.AgentStats{AgentAddress: address}
if setErr := k.AgentStats.Set(ctx, address, stats); setErr != nil {
return types.AgentStats{}, setErr
}
return stats, nil
}