digest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package digest assembles check-in digests from forge issues.

The digest is the primary surface through which users interact with Samverk during their limited availability windows. It answers three questions:

  1. What needs my decision? (Tier 3 pending actions)
  2. What happened while I was away? (Tier 2 completed actions)
  3. What is the overall state? (Active work, backlog, cost)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDigest

func FormatDigest(d DigestData) string

FormatDigest renders DigestData as the conversational text format defined in docs/check-in-digest-design.md.

Types

type ActiveWork

type ActiveWork struct {
	IssueNumber int
	Title       string
	AgentType   models.AgentType
	ClaimedAt   time.Time
}

ActiveWork is an issue currently being worked by an agent.

type CompletedAction

type CompletedAction struct {
	IssueNumber   int
	Title         string
	ActionType    autonomy.ActionType
	ResultSummary string
	TokensUsed    int
	ModelUsed     string
	CompletedAt   time.Time
}

CompletedAction is a Tier 2 item the agent executed autonomously.

type CostSource

type CostSource interface {
	ComputeCostSince(ctx context.Context, since time.Time) CostSummary
}

CostSource provides cost data for the digest. A nil CostSource is valid and results in zeroed cost fields.

type CostSummary

type CostSummary struct {
	TokensUsed         int
	EstimatedCostUSD   float64
	BudgetRemainingUSD float64
}

CostSummary aggregates token spend since the last check-in.

type DigestData

type DigestData struct {
	PendingActions   []PendingAction
	CompletedActions []CompletedAction
	ActiveWork       []ActiveWork
	QueuedCount      int
	BlockedCount     int
	Cost             CostSummary
	LastCheckIn      time.Time
}

DigestData is the top-level container returned by BuildDigest.

func BuildDigest

func BuildDigest(ctx context.Context, tracker forge.IssueTracker, costs CostSource, lastCheckIn time.Time) (DigestData, error)

BuildDigest queries the IssueTracker to populate DigestData in a single server-side call. The costs parameter may be nil for environments without cost tracking (e.g., this spike).

type PendingAction

type PendingAction struct {
	IssueNumber  int
	Title        string
	ActionType   autonomy.ActionType
	Priority     models.Priority
	Context      string
	BlockedCount int
	RequestedAt  time.Time
}

PendingAction is a Tier 3 item awaiting user approval or rejection.

type StoreCostSource

type StoreCostSource struct {
	// contains filtered or unexported fields
}

StoreCostSource adapts store.Store to the CostSource interface.

func NewStoreCostSource

func NewStoreCostSource(s store.Store, dailyBudget float64) *StoreCostSource

NewStoreCostSource creates a CostSource backed by the SQLite store.

func (*StoreCostSource) ComputeCostSince

func (s *StoreCostSource) ComputeCostSince(ctx context.Context, since time.Time) CostSummary

ComputeCostSince implements CostSource by querying the store and mapping models.CostSummary fields to digest.CostSummary fields.

Jump to

Keyboard shortcuts

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