Documentation
¶
Overview ¶
Package company follows one AI-native company on the upstream rysh-server for a session bound to it (design 037, "Company Connect"): a REST client that reads the company's state with the read-only workspace key, and a follower that keeps a snapshot fresh from live NATS hints and a poll.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // follower treats specially: the key was revoked from the dashboard (or the // company was deleted), and polling harder will not help. ErrUnauthorized = errors.New("the server rejected this company's key — reconnect from the dashboard") )
Functions ¶
func ActivitySubject ¶
ActivitySubject and ProgressSubject are the two subjects a connected client follows; both sit inside the workspace namespace the key is scoped to.
func NATSWebSocketURL ¶
NATSWebSocketURL turns the server's HTTP origin into the WebSocket origin the proxy speaks on.
func ProgressSubject ¶
Types ¶
type Client ¶
Client reads a company over the owner routes with a connect key.
func (*Client) Fetch ¶
Fetch reads the whole company. The company record itself is required; every other resource is best-effort — a failure there is recorded in Link.LastError and the snapshot still carries what did load, so one broken endpoint never blanks the view. An authorization failure anywhere is returned as ErrUnauthorized, because it means the key, not the endpoint.
type Follower ¶
type Follower struct {
// contains filtered or unexported fields
}
Follower keeps one company's snapshot fresh: a REST fetch on start, on every live hint from the workspace NATS namespace, on demand (Refresh), and on a timer regardless. Every hint is only a reason to fetch; REST is the truth (design 037 §Architecture).
func New ¶
func New(client *Client, companyID, workspaceID string, up config.UpstreamConfig, onSnapshot func(msg.CompanySnapshot)) *Follower
New builds a follower. onSnapshot is called on the follower's goroutine after every fetch and on every live/offline transition; it must not block.
func (*Follower) Refresh ¶
func (f *Follower) Refresh()
Refresh asks for a fetch soon. Non-blocking; coalesces.
func (*Follower) Snapshot ¶
func (f *Follower) Snapshot() msg.CompanySnapshot
Snapshot returns the latest snapshot (a copy).
type LinkDescription ¶
type LinkDescription string
LinkDescription is a one-line reading of a CompanyLink.
func DescribeLink ¶
func DescribeLink(l msg.CompanyLink) LinkDescription
func (LinkDescription) String ¶
func (l LinkDescription) String() string
String describes the link for logs and ##company status.