Help us shape the future of Go! Take the 2026 Go Developer Survey

session

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	New(modelID string, agentType, workdir string, binding *model.AgentRuntimeBinding) (*model.Session, error)
	// Get returns the session pointer for sid. Callers MUST treat the returned
	// *model.Session as read-only. Metadata updates must go through one of the
	// Update* methods; mutating the pointer directly races with concurrent
	// writers and produces lost-update and internal/disk divergence bugs.
	Get(sid string) (*model.Session, bool)
	// SetInitFields is used once at session creation to stamp JobID/WorkspaceID
	// onto the in-memory session and persist. After this call external callers
	// must not mutate fields on the pointer returned by Get.
	SetInitFields(sid, jobID, wsID string) error
	UpdateAgentBinding(sid string, binding model.AgentRuntimeBinding) error
	// Delete durably writes the deletion tombstone before removing the
	// session from memory. A persistence failure leaves the session available
	// for retry and is returned to the caller.
	Delete(sid string) error
	// UpdateModelID atomically sets ModelID on the in-memory session and
	// persists the change. Handlers must never mutate Session fields on the
	// pointer returned by Get(). Returns nil (not an error) when the session
	// is missing so legacy call sites using best-effort semantics keep working.
	UpdateModelID(sid, modelID string) error
	// UpdateACPMode is the ACPMode counterpart to UpdateModelID.
	UpdateACPMode(sid, acpMode string) error
	// UpdateACPThoughtLevel is the thought_level counterpart to UpdateACPMode.
	UpdateACPThoughtLevel(sid, acpThoughtLevel string) error
	// UpdateTitle atomically sets Title + UpdatedAt and persists.
	UpdateTitle(sid, title string) error
	// UpdateACPState atomically sets ACPSessionID + the ACP sync
	// fingerprint (count + content hash) and persists. Used by the ACP
	// agent when a fresh subprocess session is minted so id and
	// fingerprint advance as a pair — a partial write would let the
	// next Run prompt a session id whose sync baseline does not match
	// disk, so the next drift check would either miss a real divergence
	// or force a spurious reset.
	UpdateACPState(sid, acpSessionID string, fingerprint repository.MessagesFingerprint) error
	// UpdateACPSyncFingerprint atomically advances the sync fingerprint
	// alone. Used at the end of a Run when the acp session id is
	// unchanged and only the post-Run disk state needs to be recorded.
	UpdateACPSyncFingerprint(sid string, fingerprint repository.MessagesFingerprint) error
	// Touch bumps UpdatedAt and persists.
	Touch(sid string) error
}

func NewService

func NewService(wsID, jobID string) (Service, error)

type TranscriptStore

type TranscriptStore interface {
	Load(ctx context.Context, workspaceID, jobID, sessionID string) ([]*schema.Message, error)
	LoadPage(ctx context.Context, workspaceID, jobID, sessionID string, beforeOffset, boundaryEndOffset int64, boundaryHash string, limit int) (*repository.MessagePage, error)
	Append(ctx context.Context, workspaceID, jobID, sessionID string, messages []*schema.Message) error
}

TranscriptStore exposes session transcript operations to application adapters while keeping repository construction inside the service layer.

func NewTranscriptStore

func NewTranscriptStore() TranscriptStore

Jump to

Keyboard shortcuts

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