Documentation
¶
Overview ¶
Package forge is the LaForge backend: it runs shells and agent CLIs in pseudo-terminals, keeps them alive while browsers come and go, and serves the Forge web client that lays them out as tabs and split panes.
Server is an http.Handler so a host program (the la binary, or Outcome) can serve it on a listener of its own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoginShell ¶
func LoginShell() string
LoginShell is the user's shell: $SHELL, else /bin/sh; on Windows, PowerShell 7 (pwsh), else Windows PowerShell, else COMSPEC (cmd.exe).
Types ¶
type Options ¶
type Options struct {
// Home is the forge's folder (layout.json, profiles.json).
Home string
// Token is the secret a browser presents once (?token=) to get its cookie,
// and a client presents as a bearer token. Empty generates one.
Token string
// Cwd is the folder new panes start in when the client names none.
Cwd string
// Version is reported by /api/health.
Version string
// Scrollback is each session's replay buffer in bytes (0: 256 KiB).
Scrollback int
// Web replaces the embedded client (tests, development).
Web fs.FS
}
Options configure a Server.
type Pane ¶
type Pane struct {
terminal.SessionView
Profile string `json:"profile"`
Title string `json:"title"`
Cwd string `json:"cwd"`
// After names the agent profile a pane ran before it became a shell, and
// AgentExit that agent's exit code.
After string `json:"after,omitempty"`
AgentExit *int `json:"agentExit,omitempty"`
}
Pane is a running or finished terminal session, as the client sees it.
type Profile ¶
type Profile struct {
Name string `json:"name"`
Label string `json:"label"`
Description string `json:"description"`
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Env []string `json:"env,omitempty"`
Agent bool `json:"agent"`
// Available and Reason are filled in when profiles are listed.
Available bool `json:"available"`
Reason string `json:"reason,omitempty"`
}
Profile is one kind of pane the forge can start: a shell or an agent CLI.
func BuiltinProfiles ¶
func BuiltinProfiles() []Profile
BuiltinProfiles are the panes every forge offers. The shell is the user's own login shell; each agent is its platform's own CLI, run unchanged with its own login.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the forge's HTTP surface.