Documentation
¶
Index ¶
- Variables
- func CreateApiServer(domain string, port int, dataDir string, staticFS embed.FS, docsFS embed.FS)
- func EnsureDocRepos()
- func ExtractResources()
- func GetDocs(w http.ResponseWriter, r *http.Request)
- func GetManifest(w http.ResponseWriter, r *http.Request)
- func InitModules(m *mux.Router, dataDir string, docsFS embed.FS)
- func InitWorldMap(dbPath string) error
- func ListDocs(w http.ResponseWriter, r *http.Request)
- func RecordTurtleSight(t Turtle)
- func ReturnData(w http.ResponseWriter, data interface{})
- func ReturnDataRaw(w http.ResponseWriter, data []byte, headers map[string]string)
- func ReturnError(w http.ResponseWriter, code int, message string)
- func TextureHandle(w http.ResponseWriter, r *http.Request)
- func TurtleHandle(w http.ResponseWriter, r *http.Request)
- func TurtleHandleWs(w http.ResponseWriter, r *http.Request)
- func TurtleUsage() string
- type ActiveConnections
- type BlockRecord
- type CommandError
- type CommandRequest
- type CommandResponse
- type DocEntry
- type DocManifest
- type Turtle
- type TurtleCommandMutex
Constants ¶
This section is empty.
Variables ¶
var DocsDir string
DocsDir is set by InitModules to the extracted docs directory (dataDir/docs).
var MCPHandler http.Handler
var TextureWorkdir string
TextureWorkdir is set by InitModules from the configured dataDir.
var Turtles []Turtle
Functions ¶
func CreateApiServer ¶
func EnsureDocRepos ¶
func EnsureDocRepos()
EnsureDocRepos checks each entry in the manifest and clones the repo if the target directory does not already contain a git repository. Runs each clone sequentially; call in a goroutine to avoid blocking startup.
func ExtractResources ¶
func ExtractResources()
func GetManifest ¶
func GetManifest(w http.ResponseWriter, r *http.Request)
func InitWorldMap ¶
InitWorldMap opens (or creates) the SQLite world map database.
func RecordTurtleSight ¶
func RecordTurtleSight(t Turtle)
RecordTurtleSight extracts block observations from a turtle's sight data and upserts them into the world map. Called on every heartbeat.
func ReturnData ¶
func ReturnData(w http.ResponseWriter, data interface{})
ReturnData returns data as json to the client
func ReturnDataRaw ¶
func ReturnDataRaw(w http.ResponseWriter, data []byte, headers map[string]string)
func ReturnError ¶
func ReturnError(w http.ResponseWriter, code int, message string)
ReturnError returns an error to the client with the specified status code and message
func TextureHandle ¶
func TextureHandle(w http.ResponseWriter, r *http.Request)
func TurtleHandle ¶
func TurtleHandle(w http.ResponseWriter, r *http.Request)
func TurtleHandleWs ¶
func TurtleHandleWs(w http.ResponseWriter, r *http.Request)
handle turtle websocket
func TurtleUsage ¶
func TurtleUsage() string
func Name() string { return `turtle` } //OP func Version() string { return `0.1.0` } func Desc() string { return `The Base turtle control API` } //OP
Types ¶
type ActiveConnections ¶
type ActiveConnections struct {
// contains filtered or unexported fields
}
Connection tracking for synchronous command execution
type BlockRecord ¶
type BlockRecord struct {
X int `json:"x"`
Y int `json:"y"`
Z int `json:"z"`
Name *string `json:"name"`
State interface{} `json:"state,omitempty"`
Extra map[string]interface{} `json:"extra,omitempty"`
ObservedAt int64 `json:"observed_at"`
ObservedBy int `json:"observed_by"`
}
func FindBlock ¶
func FindBlock(nameSearch string, limit int) ([]BlockRecord, error)
FindBlock returns all known coordinates where name contains the search string. Results capped at limit (max 500).
func GetBlock ¶
func GetBlock(x, y, z int) (*BlockRecord, error)
GetBlock returns the known data for a single coordinate, or nil if unknown.
func GetRegion ¶
func GetRegion(x1, y1, z1, x2, y2, z2 int) ([]BlockRecord, error)
GetRegion returns all known blocks within a bounding box. Capped at 1000.
type CommandError ¶
type CommandError struct {
Message string
}
Custom error type for command execution
func (*CommandError) Error ¶
func (e *CommandError) Error() string
type CommandRequest ¶
Command request/response structures
type CommandResponse ¶
type DocEntry ¶
type DocEntry struct {
Name string `json:"name"`
Repo string `json:"repo"`
Root string `json:"root"`
Local bool `json:"local,omitempty"`
}
DocEntry mirrors one entry in mcp/docs/manifest.json
type DocManifest ¶
type DocManifest struct {
Docs []DocEntry `json:"docs"`
}
DocManifest is the top-level structure of manifest.json
func ReadManifest ¶
func ReadManifest() (*DocManifest, error)
ReadManifest reads and parses manifest.json from DocsDir.
type Turtle ¶
type Turtle struct {
Name string `json:"name"`
ID int `json:"id"`
Inventory []interface{} `json:"inventory"`
SelectedSlot int `json:"selectedSlot"`
Pos struct {
Y int `json:"y"`
X int `json:"x"`
Z int `json:"z"`
R int `json:"r"`
Rname string `json:"rname"`
} `json:"pos"`
Fuel struct {
Current int `json:"current"`
Max int `json:"max"`
} `json:"fuel"`
Sight struct {
Up interface{} `json:"up"`
Down interface{} `json:"down"`
Front interface{} `json:"front"`
Left interface{} `json:"left,omitempty"`
Right interface{} `json:"right,omitempty"`
Back interface{} `json:"back,omitempty"`
} `json:"sight"`
CmdResult interface{} `json:"cmdResult"`
CmdQueue []string `json:"cmdQueue"`
Misc interface{} `json:"misc"`
HeartBeat int `json:"heartbeat"`
}
type TurtleCommandMutex ¶
type TurtleCommandMutex struct {
// contains filtered or unexported fields
}
Per-turtle command serialization