remote

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 39 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package remote implements the published, read-only integration boundary.

@facet: navigation/interfaces/remote-read-access @facet-role: primary

@facet: navigation/interfaces/claude-connector @facet-role: primary

Index

Constants

View Source
const CodeScope = "facet:code:read"
View Source
const MaxCorpusBytes = 64 << 20
View Source
const MaxFileBytes = 4 << 20
View Source
const RecordsScope = "facet:records:read"
View Source
const SearchScope = "facet:search:read"

Variables

This section is empty.

Functions

func RegisterViewer

func RegisterViewer(html string)

RegisterViewer installs the MCP Apps viewer page for every server created afterwards. The page is not part of this package: a build that ships it registers it from package main before serving. Without a registered page a server configured with 'ui: true' offers no resources capability, attaches no '_meta.ui' to its tools and answers resources/* with JSON-RPC Method not found, so a host falls back to the text and structured results. It panics on an empty page or a second registration, because two pages would make the served resource depend on initialization order.

func RegisteredViewer

func RegisteredViewer() string

RegisteredViewer returns the registered viewer page, or "" when this build carries none.

Types

type Anchor

type Anchor struct {
	ID       string `json:"id"`
	Registry string `json:"registry"`
	Path     string `json:"path"`
	Line     int    `json:"line"`
	Role     string `json:"role"`
}

type Anchors

type Anchors struct {
	Category string   `json:"category"`
	Snapshot string   `json:"snapshot"`
	Anchors  []Anchor `json:"anchors"`
}

type AuditEvent

type AuditEvent struct {
	Code       string `json:"code,omitempty"`
	RequestID  string `json:"request_id"`
	Operation  string `json:"operation"`
	Status     int    `json:"status"`
	DurationMS int64  `json:"duration_ms"`
	Principal  string `json:"principal"`
	Snapshot   string `json:"snapshot"`
}

type Authenticator

type Authenticator struct {
	Keys    []Key
	OAuth   TokenProvider
	MCPKeys bool
}

func (*Authenticator) Validate

func (a *Authenticator) Validate() error

func (*Authenticator) Verify

func (a *Authenticator) Verify(ctx context.Context, token, transport string) (Principal, error)

type ChunkSource

type ChunkSource struct {
	SHA256   string `json:"sha256"`
	Category string `json:"category"`
	Start    int    `json:"start"`
	End      int    `json:"end"`
}

type Config

type Config struct {
	Audit          func(AuditEvent) `json:"-"`
	UI             bool             `json:"ui"`
	RAG            *RAGConfig       `json:"rag,omitempty"`
	Origin         string           `json:"origin"`
	AllowedOrigins []string         `json:"allowed_origins"`
	Keys           []Key            `json:"keys"`
	MCPKeys        bool             `json:"mcp_api_keys"`
	OAuth          *OAuthConfig     `json:"oauth,omitempty"`
}

type Corpus

type Corpus struct {
	Snapshot string
	// contains filtered or unexported fields
}

func LoadCorpus

func LoadCorpus(root string, publication Publication) (*Corpus, error)

LoadCorpus takes a content-addressed snapshot. Only these verified bytes are subsequently read; repository settings and environment overrides are ignored.

type Input

type Input struct {
	ID       string   `json:"id,omitempty"`
	Kind     string   `json:"kind,omitempty"`
	Query    string   `json:"query,omitempty"`
	Limit    int      `json:"limit,omitempty"`
	Cursor   string   `json:"cursor,omitempty"`
	Sections []string `json:"sections,omitempty"`
	Path     string   `json:"path,omitempty"`
	Start    int      `json:"start,omitempty"`
	End      int      `json:"end,omitempty"`
}

type Key

type Key struct {
	ID         string    `json:"id"`
	Digest     string    `json:"sha256"`
	Scopes     []string  `json:"scopes"`
	Transports []string  `json:"transports"`
	ExpiresAt  time.Time `json:"expires_at"`
	Disabled   bool      `json:"disabled,omitempty"`
}

func GenerateKey

func GenerateKey(scopes, transports []string, expires time.Time) (string, Key, error)

type OAuthConfig

type OAuthConfig struct {
	Mode             string            `json:"mode"`
	Issuer           string            `json:"issuer"`
	Audience         string            `json:"audience"`
	JWKSURL          string            `json:"jwks_url,omitempty"`
	IntrospectionURL string            `json:"introspection_url,omitempty"`
	ClientID         string            `json:"client_id,omitempty"`
	ClientSecret     string            `json:"-"`
	Subjects         []string          `json:"subjects"`
	ScopeClaim       string            `json:"scope_claim"`
	ScopeMap         map[string]string `json:"scope_map"`
}

OAuthConfig is operator-owned. A subject allowlist is mandatory and independent of the OAuth scopes: registration or consent is not repository entitlement.

type OAuthProvider

type OAuthProvider struct {
	// contains filtered or unexported fields
}

func NewOAuthProvider

func NewOAuthProvider(cfg OAuthConfig) (*OAuthProvider, error)

func (*OAuthProvider) Verify

func (p *OAuthProvider) Verify(ctx context.Context, token string) (Principal, error)

type Principal

type Principal struct {
	ID        string
	Scopes    []string
	ExpiresAt time.Time
	OAuth     bool
}

type Problem

type Problem struct {
	Status    int    `json:"status"`
	Code      string `json:"code"`
	Title     string `json:"title"`
	Type      string `json:"type"`
	RequestID string `json:"request_id"`
	Hint      string `json:"hint,omitempty"`
}

func (*Problem) Error

func (p *Problem) Error() string

type Publication

type Publication struct {
	SchemaVersion int             `json:"schema_version"`
	GitRevision   string          `json:"git_revision,omitempty"`
	Files         []PublishedFile `json:"files"`
}

func LoadPublication

func LoadPublication(r io.Reader) (Publication, error)

LoadPublication accepts configuration, not an automatically discovered manifest.

type PublishedFile

type PublishedFile struct {
	Path     string `json:"path"`
	SHA256   string `json:"sha256"`
	Kind     string `json:"kind"`
	Registry string `json:"registry"`
}

type RAGConfig

type RAGConfig struct {
	Index            string `json:"index"`
	IndexSHA256      string `json:"index_sha256"`
	Provenance       string `json:"provenance"`
	Provider         string `json:"provider"`
	Model            string `json:"model"`
	BaseURL          string `json:"base_url,omitempty"`
	AllowQueryEgress bool   `json:"allow_query_egress"`
	APIKey           string `json:"-"`
}

type RAGProvenance

type RAGProvenance struct {
	Version  int                    `json:"version"`
	Snapshot string                 `json:"snapshot"`
	Chunks   map[string]ChunkSource `json:"chunks"`
}

func BuildIndex

func BuildIndex(ctx context.Context, corpus *Corpus, cfg *RAGConfig, allowRecordEgress bool) (*rag.Store, RAGProvenance, error)

BuildIndex is an operator-only offline operation. It never runs from HTTP/MCP. Chunk bytes are exact section slices, unlike the enriched general-purpose index.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(c *Corpus) *Reader

type Record

type Record struct {
	Snapshot string `json:"snapshot"`
	ID       string `json:"id"`
	Registry string `json:"registry"`
	Category string `json:"category"`
	Path     string `json:"path"`
	YAML     string `json:"yaml"`
	// contains filtered or unexported fields
}

type RecordList

type RecordList struct {
	Snapshot   string    `json:"snapshot"`
	Records    []Summary `json:"records"`
	NextCursor *string   `json:"next_cursor"`
}

type Retrieval

type Retrieval struct {
	// contains filtered or unexported fields
}

type SearchHit

type SearchHit struct {
	ID          string  `json:"id"`
	QualifiedID string  `json:"qualified_id"`
	Registry    string  `json:"registry"`
	Category    string  `json:"category"`
	Path        string  `json:"path"`
	Section     string  `json:"section"`
	Text        string  `json:"text"`
	Score       float32 `json:"score"`
}

type SearchResult

type SearchResult struct {
	Snapshot string      `json:"snapshot"`
	Model    string      `json:"model"`
	Hits     []SearchHit `json:"hits"`
}

type Section

type Section struct {
	Name  string  `json:"name"`
	Bytes int     `json:"bytes"`
	Lines int     `json:"lines"`
	Text  *string `json:"text"`
}

type Sections

type Sections struct {
	Category string    `json:"category"`
	Snapshot string    `json:"snapshot"`
	ID       string    `json:"id"`
	Registry string    `json:"registry"`
	Sections []Section `json:"sections"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c *Corpus, cfg Config) (*Server, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Source

type Source struct {
	Snapshot string `json:"snapshot"`
	Path     string `json:"path"`
	Start    int    `json:"start"`
	End      int    `json:"end"`
	Text     string `json:"text"`
}

type Summary

type Summary struct {
	ID          string `json:"id"`
	Registry    string `json:"registry"`
	Category    string `json:"category"`
	Summary     string `json:"summary"`
	QualifiedID string `json:"qualified_id"`
}

type TokenProvider

type TokenProvider interface {
	Verify(context.Context, string) (Principal, error)
}

Jump to

Keyboard shortcuts

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