Documentation
¶
Overview ¶
transcript.go writes transcript.json into the SAME directory as the causal event log, which the Spawnfile compiler mounts unconditionally so the social record survives container teardown even for a purely in-memory room store.
THIS CHANGES THAT VOLUME'S CONTRACT, DELIBERATELY. It previously held only hashes: the causal log records content_sha256, never message text and never a sender. It now also holds message bodies. That is not an incidental widening: agent speech is the research data the memetics programme exists to study, and a run record that cannot show who said what to whom cannot support the claim that agents held a conversation.
Two properties keep this an attestation rather than a second, drifting copy of the truth:
- Text is checkable. Each message's sha256(json.Marshal(Parts)) equals the content_sha256 the causal log already recorded for that message_id, so a reader verifies the transcript against the sealed log rather than trusting it.
- Attribution is stated, never assumed. `from` is what the SENDER claimed and a sender can claim anything; the authenticated identity is the causal event's principal_id, which causalPrincipal() derives from auth claims alone. The attestation block therefore reports three states and not two: attested, violated, and unattested, because a network running auth.mode: none stamps system:moltnet.anonymous and there is then nothing to compare against. Unattested must never be read as passed.
Index ¶
- Variables
- func Logger(ctx context.Context, component string, attrs ...any) *slog.Logger
- func NetworkStreamID(networkID string) string
- func NewRequestID() string
- func NormalizeRequestID(value string) string
- func RedactURL(raw string) string
- func RequestID(ctx context.Context) string
- func WithRequestID(ctx context.Context, requestID string) context.Context
- func WriteMessageAcceptedFixture(w io.Writer, runID string) error
- type CausalWriter
- type Metrics
- func (m *Metrics) AddActiveAttachments(delta int64)
- func (m *Metrics) AddActiveSSE(delta int64)
- func (m *Metrics) RecordDroppedEvent()
- func (m *Metrics) RecordHTTPRequest(method string, route string, status int, duration time.Duration)
- func (m *Metrics) RecordRelay(result string)
- func (m *Metrics) RecordStoreHealth(ok bool)
- func (m *Metrics) RenderPrometheus() string
- func (m *Metrics) ServeHTTP(response http.ResponseWriter, _ *http.Request)
- type TranscriptWriter
Constants ¶
This section is empty.
Variables ¶
var DefaultMetrics = NewMetrics()
Functions ¶
func NetworkStreamID ¶ added in v0.1.14
NetworkStreamID builds the stream_id convention moltnet uses for message.accepted causal events: "network:<networkID>".
func NewRequestID ¶
func NewRequestID() string
func NormalizeRequestID ¶
func WriteMessageAcceptedFixture ¶ added in v0.1.14
WriteMessageAcceptedFixture writes exactly two message.accepted causal events for runID to w, through the real CausalWriter (so seq assignment and CausalEvent.Validate both run for real, the same as production moltnet). It is B92's cross-repo conformance fixture: the root conformance harness stitches these two events into the daimon/mneme/ simfile chain (see specs/causal-event.v1.schema.json and src/ledger/conformance.ts).
Types ¶
type CausalWriter ¶ added in v0.1.14
type CausalWriter struct {
// contains filtered or unexported fields
}
CausalWriter is an append-only per-network causal JSONL sink. It owns sequence assignment for every (run_id, stream_id) it sees, so callers never have to coordinate contiguity themselves: Append fills in event.Emitter.Seq before validating and writing the record.
func NewCausalFileWriter ¶ added in v0.1.14
func NewCausalFileWriter(path string) (*CausalWriter, error)
NewCausalFileWriter opens (creating parent directories and the file as needed) an append-only JSONL file at path for causal events.
func NewCausalWriter ¶ added in v0.1.14
func NewCausalWriter(writer io.Writer) *CausalWriter
NewCausalWriter wraps an arbitrary io.Writer (a file, an in-memory buffer in tests, etc.) as a CausalWriter.
func (*CausalWriter) Append ¶ added in v0.1.14
func (w *CausalWriter) Append(event protocol.CausalEvent) (protocol.CausalEvent, error)
Append assigns the next contiguous seq for (event.RunID, event.Emitter.StreamID), validates the resulting record, and appends it as one JSONL line. It returns the stamped event (with Emitter.Seq populated) regardless of whether the append itself succeeded, so callers can log the attempted record on failure.
func (*CausalWriter) Close ¶ added in v0.1.14
func (w *CausalWriter) Close() error
Close releases the underlying writer if it supports io.Closer.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics() *Metrics
func (*Metrics) AddActiveAttachments ¶
func (*Metrics) AddActiveSSE ¶
func (*Metrics) RecordDroppedEvent ¶
func (m *Metrics) RecordDroppedEvent()
func (*Metrics) RecordHTTPRequest ¶
func (*Metrics) RecordRelay ¶
func (*Metrics) RecordStoreHealth ¶
func (*Metrics) RenderPrometheus ¶
type TranscriptWriter ¶ added in v0.1.14
type TranscriptWriter struct {
// contains filtered or unexported fields
}
TranscriptWriter writes the social record beside causal.jsonl. Bodies are research data for the memetics programme, not an incidental widening of the causal volume: this artifact makes accepted message text available for replay and lets readers attest it against the adjacent content_sha256.
func NewTranscriptFileWriter ¶ added in v0.1.14
func NewTranscriptFileWriter(path string, _ string) (*TranscriptWriter, error)
func (*TranscriptWriter) Append ¶ added in v0.1.14
func (w *TranscriptWriter) Append(message protocol.Message, principalID string) error
func (*TranscriptWriter) Close ¶ added in v0.1.14
func (w *TranscriptWriter) Close() error