oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package assist
2
3import "context"
4
5// Filter decides what a person may be offered and run (spec
6// 2026-11-26-assistant-abilities §6.1): a provider whose whole ability is
7// off is never asked to list (Provider false), and an operation the
8// person can't use isn't offered, described or run (Operation false).
9type Filter interface {
10 Provider(name string) bool
11 Operation(op Operation) bool
12}
13
14type filterKey struct{}
15
16// WithFilter is ctx with f applied to look, describe and invoke.
17func WithFilter(ctx context.Context, f Filter) context.Context {
18 return context.WithValue(ctx, filterKey{}, f)
19}
20
21func filterFrom(ctx context.Context) Filter {
22 f, _ := ctx.Value(filterKey{}).(Filter)
23 return f
24}
25