Documentation
¶
Overview ¶
Package sessionkind is the per-run context stamp: the one token a reading bundle and a scribe context each carry, naming the kind of session the context is for, the run it belongs to and a digest of what it holds (adr-2609021016275803, spc-2609020626045177).
It is a LEAF, and that is the reason it exists as a package at all. Two packages read the stamp: core/reading writes it into the bundle, and core/history recognises it in a transcript at capture and checks separation over what it recorded. core/scribe writes it too. None of the three may import another for it — history importing reading would pull the whole assembler into the transcript store — so the grammar lives here, once, and each of them imports this.
The stamp is PER RUN on purpose. A fixed token per kind would sit committed in the documentation and the code, so any session that read either would carry both kinds and be reported in breach, and a session that reached the ledger by another route would carry one and be reported clean; the ADR rejects that mechanism by name. A stamp names one run and a digest, and it is matched exactly, so a session that reads the docs carries none and a transcript carrying the reading stamp of one run and the scribe stamp of another is not a violation.
Index ¶
Constants ¶
const DigestLen = 12
DigestLen is how many hex digits of the context's sha256 a stamp carries.
const Prefix = "abcd.context-stamp"
Prefix opens every stamp. It is carried in the documentation, which is why a prefix alone is never a stamp: StampRe requires a kind, a well-formed run and a full digest behind it.
Variables ¶
var StampRe = regexp.MustCompile(`abcd\.context-stamp/(reading|scribe)/(rdg-[0-9]+)/([0-9a-f]{12})`)
StampRe is the ONE expression that recognises a stamp. Find adds the boundaries RE2 cannot express as lookarounds; every reader goes through Find or Parse rather than this expression bare.
Functions ¶
func Find ¶
Find returns every distinct stamp in b, in first-seen order.
A match counts only between boundaries: the character before it may not continue a name (so `xabcd.context-stamp/...` is not a stamp) and the character after it may not continue the digest or the run (so a thirteenth hex digit, or any letter, disqualifies it). Without the trailing boundary a longer digest would be read as a shorter stamp that is not the one written.
func Stamp ¶
Stamp renders the stamp for one context: kind, run, and the first DigestLen hex digits of the context's sha256. It refuses a kind outside the closed set, a run that is not a reading run id and a digest that is not hex or is too short to cut, so no caller can mint a stamp Parse would not read back.