Documentation
¶
Overview ¶
Package remoteapp composes `aimux remote serve`: it builds the services the remote API needs (provider registry, live sessions, chat manager and router, broker, search, terminal input, chat queue and dispatcher, namer, folders, Mac layout, waiting tracker, push, device login), runs their background jobs and shuts them down in order. cmd resolves flags and config into Options and calls New(cfg, opts).Run(ctx).
It is the remote API's composition root, so it imports net/http (the listener and http.Server) and the iTerm2 driver. It must not import cmd or frontend packages (boundary_test.go): the phone web client's handler comes in through Options.Client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuditPath ¶
AuditPath is the remote API's audit log, shared by the server and the CLI (aimux remote revoke).
func Providers ¶
Providers is the harnesses remote serve lists, follows and continues sessions of (catalog.ProvidersOf over the registry): every registry provider that implements catalog.Store and provider.LiveSource, so a new harness implements those two and needs no change here or inside remoteapi. Today that is Claude only. The first is the default: sessions a client creates, the router and the chat manager are its, since the ACP adapter (--adapter) is Claude Code's. Another entry's sessions are listed but cannot be continued until the router and the manager dispatch per provider.
Types ¶
type Options ¶
type Options struct {
Home string
Port int // on 127.0.0.1
Allowed []string // tailscale logins admitted
AdapterCommand string // the ACP adapter sessions run on
AdapterArgs []string
MaxRuns int
ApprovalTimeout time.Duration
// Reserve keeps two aimux processes from continuing one session;
// default acprun.Reservation(Home), the lock aimux chat takes too.
Reserve func(sessionID string) (release func(), err error)
Version string // the API's version on health
Client http.Handler // the phone web client served at /app/
Out io.Writer // startup lines
ErrOut io.Writer // warnings and failures while running
Getenv func(string) string // default os.Getenv
DetectHost func() (string, error) // default: tailscale's MagicDNS name
Drivers func() ([]terminput.Driver, func()) // default: iTerm2 on macOS
// OpenTab opens a pane running argv in dir for Open on Mac; default: a
// pane in iTerm2's aimux window (windowOpener). Used only with an
// iTerm2 driver and terminal input on.
OpenTab func(ctx context.Context, title string, argv []string, dir string) error
}
Options is what remote serve runs with once flags and config are resolved. Reserve, Getenv, DetectHost and Drivers default when nil; Out and ErrOut default to io.Discard.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is remote serve, ready to run.
func (*Server) Run ¶
Run builds the services, serves until ctx ends or the process gets SIGINT or SIGTERM, then stops: the HTTP server drains, the awaited jobs (chat queue, namer, Last on your Mac, folders, waiting alerts) return, and what was opened closes last first (listener, queue file, audit log, terminal input log, terminal drivers, chat manager). A build failure closes what was opened before it.