friend

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package friend is the friend lane client: the part of a friend's supervised hook service (nova-hook.client.<name>) that takes her cards from the sprint server and tells her model once (the card the-friend-lane-is-a-client-with-no-local-state, v1.3, pulled forward by the owner on 2026-10-14).

The server (nova-sprint) owns every friend lane's record: the card it holds, its generation, the lease (lane_at, renewed by every ask and progress, the tick returning a card unheard past LaneGoneAfter), and the finish. The client holds a cache it rebuilds from the server's answers and nothing else: started in an empty directory it asks the server what each lane holds and resumes from that alone. The protocol is the fleet's: one `take --as friend.<name> --lane <n>` per lane (pkg/friend LaneTakeArgv, ParseLaneHold), and the model finishes through the server's own finish verb.

Liveness is the hook record's alone: the client asks, and so renews the leases, only while the model proves (Round's proven). A dead client renews nothing, and neither does a live client whose model stopped answering its challenges: the lease runs out and the server returns the card. The model is tla/FriendLaneClient.tla (OneLanePerCard, FinishedOnce, TakenStaysTaken, RestartResumes, DeadClientReleases, DeadModelReleases; witnesses MCFriendLaneClientBroken*.cfg).

Index

Constants

View Source
const Subject = "SPRINT CARDS "

Subject is the subject prefix of the one notice a round's new holds make.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ask

type Ask func(ctx context.Context, argv []string) (string, error)

Ask sends one verb to the sprint server and answers what it printed, or its refusal.

type Client

type Client struct {
	Name  string
	Width int
	Ask   Ask
	Dir   string
	// contains filtered or unexported fields
}

Client is one friend's lane client. Name is her name (her row is friend.<name>), Width her lanes (lanes 1..Width are asked), Ask the server, Dir the brief cache (a directory the client may find empty at any start).

func (*Client) LaneArgv

func (c *Client) LaneArgv(n int) []string

LaneArgv is lane n's ask: the fleet's lane take, its answer as JSON (the LANE line and the card's packet with its brief).

func (*Client) Notice

func (c *Client) Notice(fresh, holds []Hold) (subject, body string)

Notice is the one bus message for a round's fresh holds: its subject and body, the body naming every card the server says she holds now, its brief and the verbs that finish it.

func (*Client) Round

func (c *Client) Round(ctx context.Context, proven bool) (holds, fresh []Hold, errs []error)

Round asks the server once for every lane, 1..Width, and answers every hold the server names and, of them, the ones this client has not told the model yet (fresh), lane order. Not proven, it asks nothing: an ask renews a lease, and only a proving model's lanes are renewed. A lane whose ask fails is skipped this round, its error kept; the server's record stands, and the next round asks again.

func (*Client) Row

func (c *Client) Row() string

Row is her fleet row on the server.

func (*Client) Told

func (c *Client) Told(hs []Hold)

Told marks holds as told to the model (the notice was sent).

type Hold

type Hold struct {
	Lane  int
	Card  string
	Gen   int
	Epoch uint64
	Kind  string
	Job   string
	Brief string // the cached BRIEF.md, "" when the server sent no brief
}

Hold is one lane's card as the server's answer names it, and where its brief is cached.

Jump to

Keyboard shortcuts

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