Documentation
¶
Overview ¶
Package render turns mail into the text a Claude session sees: a small batch in full, a large one as a digest of one line per message.
Index ¶
- Constants
- func Batch(to, owner string, msgs []Mail, maxMsgs, maxBytes int) string
- func HookBatch(to, owner string, msgs []Mail, maxMsgs, maxBytes int) string
- func IsDigest(msgs []Mail, maxMsgs, maxBytes int) bool
- func Line(m Mail) string
- func Num(stream string, seq uint64) string
- func One(m Mail) string
- func Sender(owner string, m Mail) string
- type Mail
Constants ¶
const LegacyStream = "legacy"
LegacyStream is the Stream of a message in the legacy inbox stream, which an endpoint reads during the transition to a new identity. Its numbers are shown with an L: #L5.
Variables ¶
This section is empty.
Functions ¶
func Batch ¶
Batch renders msgs for the endpoint named to, of owner: in full when there are at most maxMsgs and their bodies total at most maxBytes, otherwise as a digest. The first line is a short summary of the count and the senders, since Claude Code shows it as the terminal line after its own "← mash:".
func HookBatch ¶ added in v0.3.2
HookBatch is Batch for the hook, whose digest says plainly that a listed message stays unread until the model reads it with the read tool (ADR 0046). A batch shown in full is the same as Batch's.
func IsDigest ¶ added in v0.3.2
IsDigest reports whether Batch and HookBatch render msgs as a digest, not in full.
func Num ¶ added in v0.4.0
Num is the text of a message number: "5" for the primary stream (Stream empty), "L5" for the legacy stream. A message of any other stream has no short form and is written "<stream>:<seq>", for a log line.
func Sender ¶
Sender is the one place a sender's name is shown, for a receiver of owner, by the sender's endpoint name:
- a three-token sender: agent.owner.name, whatever its owner;
- a sender whose owner is unknown (not in the directory): the name alone;
- another owner than the receiver's: owner/name (devops/nats-ops);
- otherwise: the name as is.
Types ¶
type Mail ¶
type Mail struct {
Seq uint64
// Stream names the stream Seq is a sequence of; empty for the endpoint's own (primary) stream, whose numbers are
// shown bare, and a legacy-stream message's with an L (Num). It is part of the message's identity (with Seq).
Stream string
From string
// Instance is the sender's verified instance id; empty when it sent none
// or the binding did not verify.
Instance string
Trust sap.Trust
At time.Time
Body []byte
// Owner is the sender's owner (its directory record's owner); empty when the directory does not know it.
Owner string
// Urgent is a verified sender's signed urgent mark.
Urgent bool
// Kind is the sender's kind (blocker, question, task, result, fyi); the zero value reads as task.
Kind kind.Kind
// ReplyTo is the #seq the sender says this answers, only when its signature on it verified; 0 otherwise.
ReplyTo uint64
// Via is "<origin> #<seq>": the sender's signed declaration that this relays or quotes that message of its own
// inbox, only when it verified; empty otherwise. Neither mark changes the trust label.
Via string
// Redelivered: a hook began to show this message and was interrupted, so it may already have been seen.
Redelivered bool
}
Mail is one message as delivered.