httpapi

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package httpapi is CandaceOS Core's operator-facing HTTP transport.

The package owns the action, event-stream, and health endpoints: request decoding and validation, same-origin enforcement on every mutation, the response shapes, and the server-sent-event channel the browser client subscribes to. All behavior behind those endpoints is supplied by IBackend, which the embedding core implements.

Callers may rely on Register mounting onto a caller-owned gin.IRouter and on the package serving no path that browserroutes does not name: it never creates an engine, never proxies, and never reaches past IBackend for state.

Index

Constants

This section is empty.

Variables

View Source
var ErrNilBackend = errors.New("httpapi: nil backend")

ErrNilBackend reports an API assembled without its behavior owner.

Functions

This section is empty.

Types

type API

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

API is Core's action, event, and health transport. It registers onto a caller-owned Gin router and never creates or proxies another router.

func New

func New(backend IBackend) (*API, error)

New constructs Core's action, event, and health transport.

func (*API) Register

func (a *API) Register(router gin.IRouter)

Register mounts Core's transport routes on a caller-owned Gin router.

type IBackend

type IBackend interface {
	webui.ISnapshotProvider
	Send(ctx context.Context, prompt string) (string, error)
	SendToClaw(ctx context.Context, sessionID, expectedRunID, prompt string, delivery candaceosv1.HarnessDelivery) (string, error)
	Abort(ctx context.Context) error
	AbortRun(ctx context.Context, sessionID, runID string) error
	ResolveApproval(id, decision string) error
	Subscribe() (<-chan struct{}, func())
	Health(ctx context.Context) error
}

IBackend is the complete behavior required by the local operator transport.

Jump to

Keyboard shortcuts

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