scope

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package scope resuelve el alcance de lectura activo: dado un scope con nombre (de config), calcula qué chats puede ver el agente. Es opt-in — sin scope activo, el acceso es completo (comportamiento por defecto de nem).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRef

type ChatRef struct {
	ID     string
	Title  string
	Source string
}

ChatRef es la metadata mínima de un chat necesaria para resolver el scope.

type Option

type Option func(*cfg) error

Option configura el Resolver.

func WithName

func WithName(name string) Option

WithName fija el nombre del scope activo. "" = sin scope (acceso completo).

func WithScopes

func WithScopes(scopes map[string]config.Scope) Option

WithScopes inyecta los scopes definidos (normalmente de config.Scopes()).

type Resolver

type Resolver interface {
	// Active indica si hay un scope activo. Si es false, el acceso es completo.
	Active() bool
	// Name devuelve el nombre del scope activo ("" si no hay).
	Name() string
	// AllowedChatIDs filtra los chats dados a los que caen dentro del scope.
	// Si no hay scope activo, devuelve los ids de todos los chats.
	AllowedChatIDs(chats []ChatRef) ([]string, error)
}

Resolver decide qué chats son visibles bajo el scope activo.

func New

func New(options ...Option) (Resolver, error)

New crea un Resolver. Si el nombre no está vacío pero no existe entre los scopes configurados, devuelve un error claro.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL