devserver

package
v0.1.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package devserver hosts the HTTP surface the agent IDE talks to. Every endpoint is read-only — code is canon, the IDE never writes back through this server. The shape mirrors what the frontend's `lib/agent-api.ts` consumes: list skills, fetch a skill's parsed graph, subscribe to file-watcher events, scaffold a starter project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server bundles the parser + watcher into the HTTP routes the IDE consumes. One Server is constructed per `gridctl agent dev` invocation; tests build it with NewServer(root, nil) to skip the watcher subscription.

func NewServer

func NewServer(root string, w *watcher.Watcher) (*Server, error)

NewServer constructs a Server rooted at the given directory. A nil watcher disables the SSE endpoint — useful for unit tests that want only the parser surface.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler with all dev-server routes registered. The returned handler scopes paths to /api/agent/dev/* and /api/agent/skills/*; mount it under the parent API server in production or directly via http.ListenAndServe in tests.

func (*Server) SetLogger

func (s *Server) SetLogger(l *slog.Logger)

SetLogger overrides the slog.Logger the server logs requests on.

type SkillEntry

type SkillEntry struct {
	Name      string `json:"name"`
	Lang      string `json:"lang"`
	Dir       string `json:"dir"`
	NodeCount int    `json:"node_count"`
	HasError  bool   `json:"has_error,omitempty"`
}

SkillEntry is the per-skill summary returned by GET /api/agent/skills.

Jump to

Keyboard shortcuts

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