Documentation
¶
Index ¶
- Variables
- func NewMCPServer(fs bashfs.FileSystem, opts ...MCPOption) *mcp.Server
- type AuthConfig
- type AuthIdentity
- type DirFS
- type DocsetSpec
- type EmbedFS
- type FSAdapter
- type FileSystem
- type FilesConfig
- type FolderConfig
- type Identity
- type MCPOption
- type MergeFS
- func (m *MergeFS) FilteredView(allowedMounts map[string]bool) *MergeFS
- func (m *MergeFS) Mount(name string, fs bashfs.FileSystem)
- func (m *MergeFS) ReadDir(p string) ([]bashfs.FileInfo, error)
- func (m *MergeFS) ReadFile(p string) ([]byte, error)
- func (m *MergeFS) SetRoot(fs bashfs.FileSystem)
- func (m *MergeFS) Stat(p string) (*bashfs.FileInfo, error)
- type OnConnectFunc
- type OnDisconnectFunc
- type Option
- type PasskeysConfig
- type PathMapping
- type SFTPHandler
- type Server
- func (s *Server) Config() config.Config
- func (s *Server) FileSystem() bashfs.FileSystem
- func (s *Server) ListenAndServe() error
- func (s *Server) Mount(name string, fs bashfs.FileSystem)
- func (s *Server) MountFS(name string, fsys fs.FS)
- func (s *Server) OnConnect(fn OnConnectFunc)
- func (s *Server) OnDisconnect(fn OnDisconnectFunc)
- func (s *Server) SetRootBashFS(fsys bashfs.FileSystem)
- func (s *Server) SetRootFS(fsys fs.FS)
- func (s *Server) SetSessionFSFn(fn SessionFSFn)
- func (s *Server) Shutdown(ctx context.Context) error
- type SessionFSFn
Constants ¶
This section is empty.
Variables ¶
var ( WithConfigFile = config.WithConfigFile WithEmbeddedConfig = config.WithEmbeddedConfig WithPort = config.WithPort WithMetricsPort = config.WithMetricsPort WithHostKeyPath = config.WithHostKeyPath WithAllowKeyless = config.WithAllowKeyless WithDefaultCwd = config.WithDefaultCwd WithMOTD = config.WithMOTD WithMOTDFile = config.WithMOTDFile WithAuthFile = config.WithAuthFile WithAllowedPatterns = config.WithAllowedPatterns WithIgnorePatterns = config.WithIgnorePatterns WithLogger = config.WithLogger WithSkillsDir = config.WithSkillsDir WithHTTPPort = config.WithHTTPPort WithTLS = config.WithTLS WithCAKeysFile = config.WithCAKeysFile WithHostCertFile = config.WithHostCertFile WithPasskeys = config.WithPasskeys LoadAuthConfig = config.LoadAuthConfig )
Configuration options re-exported for external consumers.
Functions ¶
func NewMCPServer ¶
func NewMCPServer(fs bashfs.FileSystem, opts ...MCPOption) *mcp.Server
NewMCPServer creates an MCP server backed by the given filesystem. The returned server exposes two tools — `shell` and `list_commands` — that let agents browse and operate on the filesystem via a restricted shell.
Types ¶
type AuthIdentity ¶
type AuthIdentity = config.AuthIdentity
AuthIdentity defines a user identity with access to a lore spec.
type DirFS ¶
type DirFS struct {
// contains filtered or unexported fields
}
DirFS serves files from a real directory on disk.
DirFS is read-only by default. Call WithBus(...) to obtain a copy that supports WriteFile and emits a KindPostWrite event on each successful write. (P1-06.)
func NewDirFS ¶
func NewDirFS(root string, files config.FilesConfig) *DirFS
NewDirFS creates a new DirFS rooted at the given directory.
func (*DirFS) WithBus ¶
WithBus returns a copy of DirFS that allows writes via WriteFile and fans every successful write out as a KindPostWrite event on the supplied bus. Pass nil to disable writes.
type DocsetSpec ¶
type DocsetSpec = config.DocsetSpec
DocsetSpec defines a named set of path mappings for a docset.
type EmbedFS ¶
type EmbedFS struct {
// contains filtered or unexported fields
}
EmbedFS serves files from an embed.FS.
func NewEmbedFS ¶
NewEmbedFS creates a new EmbedFS.
type FSAdapter ¶
type FSAdapter struct {
// contains filtered or unexported fields
}
FSAdapter adapts a standard fs.FS to the bashfs.FileSystem interface.
type FileSystem ¶
type FileSystem = bashfs.FileSystem
FileSystem is the read-only filesystem interface used by OpenLore.
type FilesConfig ¶
type FilesConfig = config.FilesConfig
FilesConfig controls which files are served.
type FolderConfig ¶
type FolderConfig = config.FolderConfig
FolderConfig defines an additional named folder mount.
type Identity ¶
type Identity struct {
RemoteAddr string
User string
PublicKey ssh.PublicKey
SessionID string
ConnectedAt time.Time
IdentityName string // matched identity name from auth config
LoreName string // name of the lore spec this identity uses
PathAccess []config.PathMapping // resolved path mappings
PublishDocsets []string // writable docsets (nil = all in lore)
}
Identity represents a connected SSH user.
type MCPOption ¶
type MCPOption func(*mcpConfig)
MCPOption configures the MCP server constructed by NewMCPServer.
func WithMCPEnvVars ¶
WithMCPEnvVars sets environment variables on the shell for every command execution.
func WithMCPInstructions ¶
WithMCPInstructions sets server instructions that are automatically injected into the client's context when it connects.
func WithMCPServerName ¶
WithMCPServerName overrides the MCP server name reported in the initialize response. Clients see this in their connector list.
func WithMCPShellDescription ¶
WithMCPShellDescription overrides the shell tool's description.
type MergeFS ¶
type MergeFS struct {
// contains filtered or unexported fields
}
MergeFS merges multiple filesystems under named mount points. An optional root filesystem serves content directly at "/".
func (*MergeFS) FilteredView ¶
FilteredView returns a new MergeFS that only includes the specified mount names. The root filesystem is always included. If allowedMounts is nil, returns the original.
func (*MergeFS) Mount ¶
func (m *MergeFS) Mount(name string, fs bashfs.FileSystem)
Mount adds a filesystem under the given name.
func (*MergeFS) SetRoot ¶
func (m *MergeFS) SetRoot(fs bashfs.FileSystem)
SetRoot sets the root filesystem that serves content at "/".
type OnConnectFunc ¶
type OnConnectFunc func(Identity)
OnConnectFunc is called when a new SSH session is established.
type OnDisconnectFunc ¶
type OnDisconnectFunc func(Identity)
OnDisconnectFunc is called when an SSH session ends.
type PasskeysConfig ¶
type PasskeysConfig = config.PasskeysConfig
PasskeysConfig holds WebAuthn passkey configuration.
type SFTPHandler ¶
type SFTPHandler struct {
// contains filtered or unexported fields
}
SFTPHandler implements the SFTP server interfaces using a bashfs.FileSystem.
func NewSFTPHandler ¶
func NewSFTPHandler(fs bashfs.FileSystem) *SFTPHandler
NewSFTPHandler creates a new SFTP handler backed by the given filesystem.
func (*SFTPHandler) Filecmd ¶
func (h *SFTPHandler) Filecmd(r *sftp.Request) error
Filecmd rejects all file commands (read-only filesystem).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the main OpenLore SSH server.
func NewServer ¶
NewServer creates a new OpenLore SSH server. rootDir is the primary directory to serve (can be empty if using Mount). Options are applied using the functional options pattern via config.Option.
func (*Server) FileSystem ¶
func (s *Server) FileSystem() bashfs.FileSystem
FileSystem returns the server's filesystem.
func (*Server) ListenAndServe ¶
ListenAndServe starts the SSH server (blocks).
func (*Server) Mount ¶
func (s *Server) Mount(name string, fs bashfs.FileSystem)
Mount adds a named filesystem mount point using a bashfs.FileSystem.
func (*Server) OnConnect ¶
func (s *Server) OnConnect(fn OnConnectFunc)
OnConnect registers a callback for new connections.
func (*Server) OnDisconnect ¶
func (s *Server) OnDisconnect(fn OnDisconnectFunc)
OnDisconnect registers a callback for disconnections.
func (*Server) SetRootBashFS ¶
func (s *Server) SetRootBashFS(fsys bashfs.FileSystem)
SetRootBashFS sets the root filesystem using a bashfs.FileSystem. Paths that don't match any mount fall through to this filesystem.
func (*Server) SetSessionFSFn ¶
func (s *Server) SetSessionFSFn(fn SessionFSFn)
SetSessionFSFn registers a per-session filesystem decorator. When set, the server calls fn(identity, baseFS) for each new SSH session and uses the returned filesystem for that session's shell.
type SessionFSFn ¶
type SessionFSFn func(id Identity, base bashfs.FileSystem) bashfs.FileSystem
SessionFSFn returns the filesystem to use for a given SSH session identity. The default implementation returns the base FS unchanged.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package eventbus is the openlore storage-event bus.
|
Package eventbus is the openlore storage-event bus. |
|
Package hooks implements the storage substrate hook subscribers (P1-04 and P1-05).
|
Package hooks implements the storage substrate hook subscribers (P1-04 and P1-05). |
|
Package plugin defines the seven primary hook interfaces that pluggable openlore implementations satisfy (P1-07).
|
Package plugin defines the seven primary hook interfaces that pluggable openlore implementations satisfy (P1-07). |