lineage

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lineage stores portable causal history beside native agent transcripts. Native files stay vendor-owned; receipts describe their exact logical coverage.

Index

Constants

View Source
const (
	HopMove     = "move"
	HopContinue = "continue"
	HopHandoff  = "handoff"
	HopFetch    = "fetch"
)
View Source
const Format = "lineage/5"
View Source
const Suffix = ".hopsesh.json"

Variables

This section is empty.

Functions

func PathFor

func PathFor(main string) string

func Subset added in v0.4.0

func Subset(a, b map[ir.NodeID]bool) bool

Types

type Branch added in v0.4.0

type Branch struct {
	ID        string      `json:"id"`
	Parent    string      `json:"parent,omitempty"`
	ForkHeads []ir.NodeID `json:"forkHeads,omitempty"`
	Origin    ReplicaID   `json:"origin,omitempty"`
}

type CodeHop added in v0.4.0

type CodeHop struct {
	Way        agent.CodeWay `json:"way"`
	Remote     string        `json:"remote,omitempty"`
	Branch     string        `json:"branch,omitempty"`
	Base       string        `json:"base,omitempty"`
	Snapshot   string        `json:"snapshot,omitempty"`
	Withheld   []string      `json:"withheld,omitempty"`
	Redactions int           `json:"redactions,omitempty"`
}

type Compensation added in v0.4.0

type Compensation struct {
	ID        string `json:"id"`
	Operation string `json:"operation"`
}

type Hop

type Hop struct {
	Notify   bool      `json:"notify,omitempty"` // optional source notice; never conversation work
	Rollover *Rollover `json:"rollover,omitempty"`
	ID       string    `json:"id"`
	Parents  []string  `json:"parents,omitempty"`
	Line     string    `json:"line"`
	Time     time.Time `json:"time"`
	From     ReplicaID `json:"from"`
	To       ReplicaID `json:"to"`
	Source   StateID   `json:"source,omitempty"`
	Target   StateID   `json:"target,omitempty"`
	Kind     string    `json:"kind"`
	Fork     bool      `json:"fork,omitempty"`
	Backup   bool      `json:"backup,omitempty"`
	Fidelity string    `json:"fidelity,omitempty"`
	Written  *Range    `json:"written,omitempty"`
	Code     *CodeHop  `json:"code,omitempty"`
}

type Journey added in v0.4.0

type Journey struct {
	MachineTransfers  int    `json:"machineTransfers"`
	MachineRoundTrips int    `json:"machineRoundTrips"`
	MachineReturns    int    `json:"machineReturns"`
	OriginProfile     string `json:"originProfile,omitempty"`
	ParentBranch      string `json:"parentBranch,omitempty"`
	Origin            string `json:"origin,omitempty"`
	Transfers         int    `json:"transfers"`
	RoundTrips        int    `json:"roundTrips"`
	Returns           int    `json:"returns"`
	Fork              bool   `json:"fork"`
	Branch            string `json:"branch"`
	Family            string `json:"family"`
}

type Manifest

type Manifest struct {
	Format        string         `json:"hopsesh"`
	Family        string         `json:"family"`
	Branch        string         `json:"branch"` // branch of the native session beside this manifest
	Branches      []Branch       `json:"branches"`
	Replicas      []Replica      `json:"replicas"`
	Revisions     []Revision     `json:"revisions"`
	States        []State        `json:"states"`
	Hops          []Hop          `json:"hops"`
	Compensations []Compensation `json:"compensations,omitempty"`
}

func New

func New(family string) *Manifest

func NewNative added in v0.4.0

func NewNative(endpoint string, key agent.SessionKey) *Manifest

func Parse

func Parse(b []byte) (*Manifest, error)

func Read

func Read(fsys agent.FS, main string) (*Manifest, error)

func (*Manifest) ActiveHops added in v0.4.0

func (m *Manifest) ActiveHops() []Hop

ActiveHops excludes undone operations and implementation-only native backups. OrderedHops supplies causal ordering; wall-clock timestamps are not authorities.

func (*Manifest) AdoptNativeFork added in v0.4.0

func (m *Manifest) AdoptNativeFork(parent ReplicaID, child Replica, proof []agent.NativeInheritance, seg *ir.Segment) (*Manifest, error)

AdoptNativeFork requires module-verified native inheritance. It returns a new branch view without modifying the parent's manifest or its native session.

func (*Manifest) AppendHop added in v0.4.0

func (m *Manifest) AppendHop(h Hop) error

func (*Manifest) Clone added in v0.4.0

func (m *Manifest) Clone() *Manifest

func (*Manifest) Covered added in v0.4.0

func (m *Manifest) Covered(heads []ir.NodeID) map[ir.NodeID]bool

func (*Manifest) Deliver added in v0.4.0

func (m *Manifest) Deliver(replica ReplicaID, cursor ir.Cursor, projection []ir.Projection, heads []ir.NodeID, loss []string) State

Deliver records the destination's own receipt. It acknowledges only this replica, keeping all provenance and losses; another destination's receipt is unaffected.

func (*Manifest) Departed added in v0.4.2

func (m *Manifest) Departed(current ReplicaID) (Hop, bool)

Departed returns where a replica's branch went after it: the latest hop on its line, when the replica left that line and has not been returned to since. It is the committed movement record, whether or not the move asked for a notice; a fork leaves its parent current and is not a departure.

func (*Manifest) Departure added in v0.4.0

func (m *Manifest) Departure(current ReplicaID) (Hop, bool)

Departure returns the latest unambiguous route away from a replica. A return clears it. Fork notices describe a separate branch and never retire the parent.

func (*Manifest) Encode

func (m *Manifest) Encode() []byte

func (*Manifest) Find

func (m *Manifest) Find(key agent.SessionKey, location string) (Replica, ReplicaID, bool)

func (*Manifest) FindBinding added in v0.4.2

func (m *Manifest) FindBinding(key agent.SessionKey, endpoint, binding string) (Replica, ReplicaID, bool)

FindBinding selects the current segment of one physical session without confusing it with its retained historical login segments.

func (*Manifest) FindEndpoint added in v0.4.0

func (m *Manifest) FindEndpoint(key agent.SessionKey, endpoint string) (Replica, ReplicaID, bool)

func (*Manifest) FindOnBranch added in v0.4.0

func (m *Manifest) FindOnBranch(key agent.SessionKey, location, line string) (Replica, ReplicaID, bool)

func (*Manifest) ForBranch added in v0.4.0

func (m *Manifest) ForBranch(branch string) *Manifest

func (*Manifest) Fork added in v0.4.0

func (m *Manifest) Fork(id string, heads []ir.NodeID) string

func (*Manifest) HasReplica added in v0.4.0

func (m *Manifest) HasReplica(id ReplicaID) bool

func (*Manifest) Heads added in v0.4.0

func (m *Manifest) Heads(ids []ir.NodeID) []ir.NodeID

func (*Manifest) Journey added in v0.4.0

func (m *Manifest) Journey() Journey

func (*Manifest) LastHopTo

func (m *Manifest) LastHopTo(id ReplicaID) (Hop, bool)

func (*Manifest) LatestState added in v0.4.0

func (m *Manifest) LatestState(id ReplicaID) (State, bool)

func (*Manifest) Merge

func (m *Manifest) Merge(o *Manifest) error

func (*Manifest) Observe added in v0.4.0

func (m *Manifest) Observe(replica ReplicaID, seg *ir.Segment) (State, error)

Observe validates previously delivered native anchors, then registers only newly authored records. Imported nodes retain their logical origins through every hop.

func (*Manifest) ObserveBinding added in v0.4.0

func (m *Manifest) ObserveBinding(r Replica, seg *ir.Segment) (ReplicaID, State, error)

ObserveBinding starts a new replica segment when the login bound to a root changes. Native anchors verify inherited history; old revisions retain their original author. This never grants permission to replay protected native data across accounts.

func (*Manifest) OrderedHops added in v0.4.0

func (m *Manifest) OrderedHops() []Hop

func (*Manifest) ReplaceProjection added in v0.4.0

func (m *Manifest) ReplaceProjection(replica ReplicaID, cursor ir.Cursor, projection []ir.Projection, heads []ir.NodeID, loss []string) State

ReplaceProjection is a verified native replacement, not an append receipt.

func (*Manifest) Replica added in v0.4.0

func (m *Manifest) Replica(id ReplicaID) Replica

func (*Manifest) ReturnReplicas added in v0.4.0

func (m *Manifest) ReturnReplicas(current ReplicaID) []Replica

ReturnReplicas lists destinations actually visited by this branch before the selected replica's latest arrival. A sibling's or parent's history is not a return.

func (*Manifest) State added in v0.4.0

func (m *Manifest) State(id StateID) State

func (*Manifest) UndoOperation added in v0.4.0

func (m *Manifest) UndoOperation(id string) error

func (*Manifest) Upsert

func (m *Manifest) Upsert(r Replica) ReplicaID

func (*Manifest) Validate added in v0.4.0

func (m *Manifest) Validate() error

type Range

type Range struct {
	From int64 `json:"from"`
	To   int64 `json:"to"`
}

type Replica

type Replica struct {
	Binding      string           `json:"binding,omitempty"`
	ID           ReplicaID        `json:"id"`
	Key          agent.SessionKey `json:"key"`
	Endpoint     string           `json:"endpoint"`
	Location     string           `json:"location"`
	Line         string           `json:"line"`
	AgentVersion string           `json:"agentVersion,omitempty"`
	// Native checkpoints are derived from immutable states, never merge authorities.
	Head   ir.NodeID `json:"-"`
	Offset int64     `json:"-"`
	Time   time.Time `json:"time"`
	URL    string    `json:"url,omitempty"`
	Branch string    `json:"branch,omitempty"` // code branch, independent of conversation Line
}

type ReplicaID added in v0.4.0

type ReplicaID string

type Revision added in v0.4.0

type Revision struct {
	ID      ir.NodeID   `json:"id"`
	Parents []ir.NodeID `json:"parents,omitempty"`
	Replica ReplicaID   `json:"replica"`
	Anchor  string      `json:"anchor"`
	Hash    string      `json:"hash"`
}

type Rollover added in v0.4.0

type Rollover struct {
	Replica ReplicaID `json:"replica"`
	Cursor  ir.Cursor `json:"cursor"`
}

Rollover records the unchanged replica retained when its active context was full.

type State added in v0.4.0

type State struct {
	ID         StateID         `json:"id"`
	Replica    ReplicaID       `json:"replica"`
	Parents    []StateID       `json:"parents,omitempty"`
	Head       ir.NodeID       `json:"head,omitempty"`
	Offset     int64           `json:"offset"`
	Heads      []ir.NodeID     `json:"heads,omitempty"`
	Projection []ir.Projection `json:"projection,omitempty"`
	Loss       []string        `json:"loss,omitempty"`
}

type StateID added in v0.4.0

type StateID string

Jump to

Keyboard shortcuts

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