Documentation
¶
Overview ¶
Package tablepreference validates presentation preferences exchanged with an external adapter. It does not implement storage or host an MCP server.
Index ¶
Constants ¶
const ConfigPath = "extension/forge/preferences.yaml"
const MaxBytes = 64 << 10
const Version = 1
Variables ¶
var Schema []byte
Schema describes the portable preference document. Validate additionally enforces unique column IDs, key hygiene and the encoded payload size limit.
Functions ¶
func Validate ¶
func Validate(p *Preferences) error
func ValidateKey ¶
ValidateKey treats the key as opaque. The host must namespace it by workspace and authenticated principal; it must not trust a caller-supplied user ID.
Types ¶
type AdapterConfig ¶
type Column ¶
type Column struct {
ID string `json:"id"`
Visible *bool `json:"visible,omitempty"`
Width *float64 `json:"width,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
Align string `json:"align,omitempty"`
Tooltip *string `json:"tooltip,omitempty"`
}
Column order in this slice is the user's preferred display order.
type Config ¶
type Config struct {
Version int `json:"version" yaml:"version"`
TablePreferences AdapterConfig `json:"tablePreferences" yaml:"tablePreferences"`
}
func DefaultConfig ¶
func DefaultConfig() Config
func LoadConfig ¶
LoadConfig reads a workspace's optional declaration. Missing configuration selects browser storage; malformed explicit configuration fails visibly.
type MCP ¶
type MCP struct {
ServerRef string `json:"serverRef" yaml:"serverRef"`
Tools Tools `json:"tools" yaml:"tools"`
}
MCP selects an existing host-configured server, never a credential or URL.
type Preferences ¶
type Preferences struct {
Version int `json:"version"`
Columns []Column `json:"columns,omitempty"`
Sort *Sort `json:"sort,omitempty"`
Density string `json:"density,omitempty"`
FrozenColumnIDs []string `json:"frozenColumnIds,omitempty"`
}
func Decode ¶
func Decode(data []byte) (*Preferences, error)
Decode rejects runtime metadata, row values, and other unknown fields.
type Request ¶
type Request struct {
Key string `json:"key"`
Preferences *Preferences `json:"preferences,omitempty"`
}
type Transport ¶
type Transport interface {
Call(context.Context, string, json.RawMessage) (json.RawMessage, error)
}
Transport maps get/set/reset operations to external MCP tools (or another host adapter). It unwraps the MCP envelope into the JSON contract below. Authentication, workspace authorization and persistence belong to the host.