telemetry

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCausalOrder

func BuildCausalOrder(events []EventEnvelope) (*CausalOrder, []IntegrityIssue)

func DescriptorBytes

func DescriptorBytes() []byte

func DescriptorSHA256

func DescriptorSHA256() string

func ParseSelectorTime

func ParseSelectorTime(value string) (time.Time, error)

ParseSelectorTime accepts the canonical CLI timestamp forms.

func ProjectTypeScript

func ProjectTypeScript() string

ProjectTypeScript projects the normative descriptor into the generated Pi runtime. The descriptor remains the sole vocabulary and shape authority.

func RenderDoctorHuman

func RenderDoctorHuman(out io.Writer, result DoctorResult) error

RenderDoctorHuman renders only the stable DoctorResult model. Findings are advisory output and do not imply a process exit status.

func RenderMetricsHuman

func RenderMetricsHuman(out io.Writer, result MetricsResult) error

RenderMetricsHuman renders only the stable MetricsResult model. It never reads storage or recomputes projection state.

func SelectNormalizedEvents

func SelectNormalizedEvents(reads []EffortRead, selector Selector) ([]json.RawMessage, error)

SelectNormalizedEvents returns selected, validated events in canonical effort/session/stream-sequence order. Corrupt raw records are never returned.

func ValidateSelector

func ValidateSelector(selector Selector) error

ValidateSelector validates closed values and the inclusive/exclusive window.

Types

type AbandonLifecycleRequest

type AbandonLifecycleRequest struct {
	LifecycleRequestBase
	Reason BoundedCategory `json:"reason,omitempty"`
}

type Activity

type Activity string

type AppendResult

type AppendResult struct {
	Event      EventEnvelope
	Idempotent bool
}

type AssociateLifecycleRequest

type AssociateLifecycleRequest struct {
	LifecycleRequestBase
	TrajectoryID      string            `json:"trajectoryId"`
	AssociationOrigin AssociationOrigin `json:"associationOrigin"`
	HandoffEventID    string            `json:"handoffEventId,omitempty"`
}

type Association

type Association struct {
	EffortID          string            `json:"effortId"`
	SessionID         string            `json:"sessionId"`
	TrajectoryID      string            `json:"trajectoryId"`
	AssociationOrigin AssociationOrigin `json:"associationOrigin"`
}

type AssociationOrigin

type AssociationOrigin string

type BoundedCategory

type BoundedCategory string

type CausalOrder

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

CausalOrder is the protocol partial order. It deliberately has no timestamp edge: timestamps measure causally linked intervals but never order writers.

func (*CausalOrder) Comparable

func (o *CausalOrder) Comparable(left, right string) bool

func (*CausalOrder) Concurrent

func (o *CausalOrder) Concurrent(left, right string) bool

func (*CausalOrder) HappensBefore

func (o *CausalOrder) HappensBefore(left, right string) bool

type CompactionObservedPayload

type CompactionObservedPayload struct {
	Count uint64 `json:"count"`
}

type Counters

type Counters struct {
	Compactions          uint64 `json:"compactions"`
	Handoffs             uint64 `json:"handoffs"`
	ToolFailures         uint64 `json:"toolFailures"`
	GateFailures         uint64 `json:"gateFailures"`
	SubagentInvocations  uint64 `json:"subagentInvocations"`
	ImplementationRework uint64 `json:"implementationRework"`
}

type CreateLifecycleRequest

type CreateLifecycleRequest struct {
	LifecycleRequestBase
	CreationMode CreationMode    `json:"creationMode"`
	Origin       *OriginMetadata `json:"origin,omitempty"`
}

type CreationMode

type CreationMode string

type DetachLifecycleRequest

type DetachLifecycleRequest struct {
	LifecycleRequestBase
	Reason DetachReason `json:"reason"`
}

type DetachReason

type DetachReason string

type DiagnosticRuleCode

type DiagnosticRuleCode string

type DoctorResult

type DoctorResult struct {
	SchemaVersion int               `json:"schemaVersion"`
	ProtocolMajor int               `json:"protocolMajor"`
	GeneratedAt   time.Time         `json:"generatedAt"`
	Selector      Selector          `json:"selector"`
	Findings      []Finding         `json:"findings"`
	Integrity     []IntegrityNotice `json:"integrity"`
}

func Diagnose

func Diagnose(reads []EffortRead, selector Selector, options HeuristicOptions, generatedAt time.Time) (DoctorResult, error)

Diagnose evaluates exact diagnostics and, when enabled, version-one heuristics against comparable completed-effort baselines.

func DiagnoseExact

func DiagnoseExact(reads []EffortRead, selector Selector, generatedAt time.Time) (DoctorResult, error)

DiagnoseExact evaluates the closed WFV1 exact rule set without mutating the ledger. Callers may combine its stable result with separately evaluated heuristic findings.

type EffortAbandonedPayload

type EffortAbandonedPayload struct {
	TerminalEpoch uint64          `json:"terminalEpoch"`
	Reason        BoundedCategory `json:"reason,omitempty"`
}

type EffortCreatedPayload

type EffortCreatedPayload struct {
	CreationMode       CreationMode `json:"creationMode"`
	OriginEffortID     string       `json:"originEffortId,omitempty"`
	OriginTrajectoryID string       `json:"originTrajectoryId,omitempty"`
	OriginAnchorID     string       `json:"originAnchorId,omitempty"`
}

type EffortMetadata

type EffortMetadata struct {
	EffortID     string          `json:"effortId"`
	CreatedAt    string          `json:"createdAt"`
	CreationMode CreationMode    `json:"creationMode"`
	Origin       *OriginMetadata `json:"origin,omitempty"`
}

type EffortProjection

type EffortProjection struct {
	EffortID           string            `json:"effortId"`
	State              string            `json:"state"`
	Route              string            `json:"route"`
	ActiveTrajectoryID string            `json:"activeTrajectoryId"`
	CurrentPath        ScopeProjection   `json:"currentPath"`
	AllWork            ScopeProjection   `json:"allWork"`
	Sessions           []ScopeProjection `json:"sessions"`
	Phases             []ScopeProjection `json:"phases"`
	Trajectories       []ScopeProjection `json:"trajectories"`
	DerivedEffortIDs   []string          `json:"derivedEffortIds"`
	Origin             *OriginMetadata   `json:"origin,omitempty"`
	Integrity          []IntegrityNotice `json:"integrity"`
}

type EffortRead

type EffortRead struct {
	Metadata        EffortMetadata
	Events          []EventEnvelope
	EffectApplied   map[string]bool
	RejectedEffects map[string]bool
	Records         []LedgerRecord
	Integrity       []IntegrityIssue
}

type EffortReopenedPayload

type EffortReopenedPayload struct {
	TerminalEpoch uint64 `json:"terminalEpoch"`
	TrajectoryID  string `json:"trajectoryId"`
	AnchorID      string `json:"anchorId"`
}

type EffortState

type EffortState string
const (
	EffortDiscovery EffortState = "discovery"
	EffortActive    EffortState = "active"
	EffortCompleted EffortState = "completed"
	EffortAbandoned EffortState = "abandoned"
)

type EffortTerminalPayload

type EffortTerminalPayload struct {
	TerminalEpoch uint64 `json:"terminalEpoch"`
}

type ErrorCategory

type ErrorCategory string

type EventEnvelope

type EventEnvelope struct {
	Version            ProtocolVersion            `json:"version"`
	EventID            string                     `json:"eventId"`
	IdempotencyKey     string                     `json:"idempotencyKey,omitempty"`
	ObservationID      string                     `json:"observationId,omitempty"`
	EffortID           string                     `json:"effortId"`
	SessionID          string                     `json:"sessionId"`
	TrajectoryID       string                     `json:"trajectoryId,omitempty"`
	ParentTrajectoryID string                     `json:"parentTrajectoryId,omitempty"`
	PiAnchorID         string                     `json:"piAnchorId,omitempty"`
	ForkAnchorID       string                     `json:"forkAnchorId,omitempty"`
	Timestamp          string                     `json:"timestamp"`
	Kind               EventKind                  `json:"kind"`
	Predecessors       []string                   `json:"predecessors"`
	Payload            json.RawMessage            `json:"payload"`
	EnvelopeExtensions map[string]json.RawMessage `json:"-"`
	PayloadExtensions  map[string]json.RawMessage `json:"-"`
}

func ValidateEvent

func ValidateEvent(raw json.RawMessage) (EventEnvelope, error)

type EventKind

type EventKind string

type Finding

type Finding struct {
	EffortID       string                  `json:"effortId"`
	Code           string                  `json:"code"`
	Type           string                  `json:"type"`
	Severity       string                  `json:"severity"`
	Scope          string                  `json:"scope"`
	Evidence       FindingEvidence         `json:"evidence"`
	Threshold      *FindingThreshold       `json:"threshold,omitempty"`
	Baseline       *FindingBaseline        `json:"baseline,omitempty"`
	Confidence     string                  `json:"confidence"`
	Explanation    string                  `json:"explanation"`
	NextAction     string                  `json:"nextAction"`
	Reconciliation *ReconciliationProposal `json:"reconciliation,omitempty"`
	Waived         bool                    `json:"waived"`
}

func DiagnoseHeuristics

func DiagnoseHeuristics(reads []EffortRead, selector Selector, options HeuristicOptions) ([]Finding, error)

DiagnoseHeuristics evaluates only the version-one heuristic rule set.

type FindingBaseline

type FindingBaseline struct {
	Route       string  `json:"route"`
	RuleVersion int     `json:"ruleVersion"`
	SampleCount int     `json:"sampleCount"`
	Percentile  int     `json:"percentile"`
	Value       float64 `json:"value"`
	Unit        string  `json:"unit"`
}

type FindingEvidence

type FindingEvidence struct {
	EventIDs      []string `json:"eventIds"`
	CounterIDs    []string `json:"counterIds"`
	ObservedValue *float64 `json:"observedValue,omitempty"`
	Unit          string   `json:"unit,omitempty"`
}

type FindingThreshold

type FindingThreshold struct {
	Kind       string  `json:"kind"`
	Comparator string  `json:"comparator"`
	Value      float64 `json:"value"`
	Unit       string  `json:"unit"`
}

type FindingWaivedPayload

type FindingWaivedPayload struct {
	RuleCode    DiagnosticRuleCode `json:"ruleCode"`
	Scope       BoundedCategory    `json:"scope"`
	EvidenceIDs []string           `json:"evidenceIds"`
	ReasonCode  WaiverReasonCode   `json:"reasonCode"`
}

type FinishPhaseLifecycleRequest

type FinishPhaseLifecycleRequest struct {
	LifecycleRequestBase
	Phase        Phase   `json:"phase"`
	StartEventID string  `json:"startEventId"`
	Outcome      Outcome `json:"outcome,omitempty"`
}

type ForkTrajectoryLifecycleRequest

type ForkTrajectoryLifecycleRequest struct {
	LifecycleRequestBase
	TrajectoryID       string `json:"trajectoryId"`
	ParentTrajectoryID string `json:"parentTrajectoryId"`
	ForkAnchorID       string `json:"forkAnchorId"`
}

type GateMode

type GateMode string

type HandoffObservedPayload

type HandoffObservedPayload struct {
	Outcome         Outcome       `json:"outcome"`
	TargetSessionID string        `json:"targetSessionId"`
	DurationMS      uint64        `json:"durationMs,omitempty"`
	ErrorCategory   ErrorCategory `json:"errorCategory,omitempty"`
}

type HeuristicOptions

type HeuristicOptions struct {
	Enabled                bool
	MinimumBaselineSamples int
	BaselinePercentile     int
	Thresholds             HeuristicThresholds
}

HeuristicOptions controls optional heuristic diagnosis. Exact diagnosis is independent of Enabled.

type HeuristicThresholds

type HeuristicThresholds struct {
	PhaseReentryCount         int
	PhaseDurationSeconds      int
	PhaseTokens               int
	CompactionCount           int
	HandoffCount              int
	ToolFailureCount          int
	GateFailureCount          int
	CacheReadPercentBelow     int
	SubagentQueueWaitSeconds  int
	ImplementationReworkCount int
}

HeuristicThresholds are the absolute version-one diagnostic thresholds.

type IntegrityIssue

type IntegrityIssue struct {
	Code     string
	Scope    string
	Line     int
	EventIDs []string
	Detail   string
}

type IntegrityNotice

type IntegrityNotice struct {
	Code        string   `json:"code"`
	Severity    string   `json:"severity"`
	Scope       string   `json:"scope"`
	EventIDs    []string `json:"eventIds"`
	Explanation string   `json:"explanation"`
}

type Ledger

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

func NewLedger

func NewLedger(root string) (*Ledger, error)

func OpenLedger

func OpenLedger(root string) (*Ledger, error)

OpenLedger opens existing resident telemetry without creating or recovering any path. It is the read-only constructor for metrics and doctor queries.

func (*Ledger) Append

func (l *Ledger) Append(ctx context.Context, raw json.RawMessage) (AppendResult, error)

func (*Ledger) ApplyLifecycle

func (l *Ledger) ApplyLifecycle(ctx context.Context, request LifecycleRequest) (AppendResult, error)

func (*Ledger) CreateEffort

func (l *Ledger) CreateEffort(metadata EffortMetadata, first json.RawMessage) (AppendResult, error)

func (*Ledger) Purge

func (l *Ledger) Purge(ctx context.Context, effortID string, confirmed bool) (RetentionResult, error)

Purge performs the only explicitly confirmed recursive removal of a named resident effort. Discovery, active, missing, and already-pruned efforts are refused.

func (*Ledger) ReadAllEfforts

func (l *Ledger) ReadAllEfforts() ([]EffortRead, error)

ReadAllEfforts reads every resident effort in stable effort-ID order. An unexpected entry is an integrity failure rather than an object to skip.

func (*Ledger) ReadEffort

func (l *Ledger) ReadEffort(effortID string) (EffortRead, error)

func (*Ledger) Recover

func (l *Ledger) Recover() (RecoveryReport, error)

func (*Ledger) Retain

func (l *Ledger) Retain(ctx context.Context, policy RetentionPolicy, dryRun bool) (RetentionResult, error)

Retain selects repository-wide terminal efforts and, unless dryRun is true, prunes them oldest first.

type LedgerRecord

type LedgerRecord struct {
	SessionID string
	Line      int
	Raw       json.RawMessage
	Event     *EventEnvelope
	Applied   bool
}

type LifecycleProjection

type LifecycleProjection struct {
	State              EffortState
	Route              Route
	RouteHistory       []RouteSelection
	TerminalEpoch      uint64
	ActiveTrajectoryID string
	Associations       map[string]Association
	OpenPhases         map[string]PhaseInterval
	PhaseIntervals     []PhaseInterval
	Trajectories       map[string]TrajectoryNode
	Waivers            []WaiverState
	Repairs            []RepairState
	SupersededEventIDs map[string]string
	AppliedEventIDs    []string
	EffectApplied      map[string]bool

	Invalid []IntegrityIssue
	// contains filtered or unexported fields
}

func ProjectLifecycle

func ProjectLifecycle(events []EventEnvelope) LifecycleProjection

type LifecycleRequest

type LifecycleRequest interface {
	// contains filtered or unexported methods
}

func DecodeLifecycleRequest

func DecodeLifecycleRequest(raw json.RawMessage) (LifecycleRequest, error)

type LifecycleRequestBase

type LifecycleRequestBase struct {
	Action         string   `json:"action"`
	IdempotencyKey string   `json:"idempotencyKey"`
	EventID        string   `json:"eventId"`
	EffortID       string   `json:"effortId"`
	SessionID      string   `json:"sessionId"`
	Timestamp      string   `json:"timestamp"`
	Predecessors   []string `json:"predecessors"`
}

type MetricsOptions

type MetricsOptions struct {
	GeneratedAt time.Time
	Retention   RetentionPolicy
	LastRunAt   *time.Time
}

MetricsOptions supplies repository-wide state which is not encoded in an effort stream.

type MetricsResult

type MetricsResult struct {
	SchemaVersion int                `json:"schemaVersion"`
	ProtocolMajor int                `json:"protocolMajor"`
	GeneratedAt   time.Time          `json:"generatedAt"`
	Selector      Selector           `json:"selector"`
	Efforts       []EffortProjection `json:"efforts"`
	Retention     RetentionState     `json:"retention"`
	Integrity     []IntegrityNotice  `json:"integrity"`
}

func AggregateMetrics

func AggregateMetrics(reads []EffortRead, selector Selector, options MetricsOptions) (MetricsResult, error)

AggregateMetrics builds the canonical, deterministically ordered metrics projection from validated effort reads.

type ModelName

type ModelName string

type OriginMetadata

type OriginMetadata struct {
	EffortID     string `json:"effortId"`
	TrajectoryID string `json:"trajectoryId"`
	AnchorID     string `json:"anchorId"`
}

type Outcome

type Outcome string

type Phase

type Phase string

type PhaseFinishedPayload

type PhaseFinishedPayload struct {
	Phase        Phase   `json:"phase"`
	StartEventID string  `json:"startEventId"`
	Outcome      Outcome `json:"outcome,omitempty"`
}

type PhaseInterval

type PhaseInterval struct {
	Phase         Phase
	StartEventID  string
	FinishEventID string
	TrajectoryID  string
	TerminalEpoch uint64
}

type PhaseStartedPayload

type PhaseStartedPayload struct {
	Phase              Phase           `json:"phase"`
	Activity           Activity        `json:"activity,omitempty"`
	ImplementationMode BoundedCategory `json:"implementationMode,omitempty"`
}

type PhaseTransitionedPayload

type PhaseTransitionedPayload struct {
	Phase              Phase           `json:"phase"`
	StartEventID       string          `json:"startEventId"`
	NextPhase          Phase           `json:"nextPhase"`
	Outcome            Outcome         `json:"outcome,omitempty"`
	Activity           Activity        `json:"activity,omitempty"`
	ImplementationMode BoundedCategory `json:"implementationMode,omitempty"`
	RouteAction        RouteAction     `json:"routeAction,omitempty"`
	Route              Route           `json:"route,omitempty"`
}

type ProposalKind

type ProposalKind string

type ProtocolVersion

type ProtocolVersion struct {
	Major uint16 `json:"major"`
	Minor uint16 `json:"minor"`
}

type ReconciliationProposal

type ReconciliationProposal struct {
	Kind           string            `json:"kind"`
	SourceEventIDs []string          `json:"sourceEventIds"`
	Replacement    RepairReplacement `json:"replacement"`
}

type RecoveryReport

type RecoveryReport struct {
	Recovered []string
	Ambiguous []IntegrityIssue
}

type ReopenLifecycleRequest

type ReopenLifecycleRequest struct {
	LifecycleRequestBase
	TrajectoryID string `json:"trajectoryId"`
	AnchorID     string `json:"anchorId"`
}

type RepairAppliedPayload

type RepairAppliedPayload struct {
	ProposalKind   ProposalKind      `json:"proposalKind"`
	SourceEventIDs []string          `json:"sourceEventIds"`
	Replacement    RepairReplacement `json:"replacement"`
}

type RepairLifecycleRequest

type RepairLifecycleRequest struct {
	LifecycleRequestBase
	Proposal RepairProposal `json:"proposal"`
}

type RepairProposal

type RepairProposal struct {
	Kind           ProposalKind      `json:"kind"`
	SourceEventIDs []string          `json:"sourceEventIds"`
	Replacement    RepairReplacement `json:"replacement"`
}

type RepairReplacement

type RepairReplacement struct {
	EventKind EventKind       `json:"eventKind"`
	Payload   json.RawMessage `json:"payload"`
}

type RepairState

type RepairState struct {
	EventID        string
	ProposalKind   ProposalKind
	SourceEventIDs []string
	Replacement    RepairReplacement
}

type RetentionPolicy

type RetentionPolicy struct {
	MaxCompletedEffortAgeDays int
	MaxCompletedEffortCount   int
}

RetentionPolicy bounds terminal effort history. A zero value disables that dimension independently.

type RetentionResult

type RetentionResult struct {
	Candidates []string
	Pruned     []string
	Skipped    []string
}

RetentionResult reports deterministic prune-order candidates and completed removals. Skipped contains candidates which became active before their prune lease was acquired.

type RetentionState

type RetentionState struct {
	MaxAgeDays          int        `json:"maxAgeDays"`
	MaxCount            int        `json:"maxCount"`
	TerminalEffortCount int        `json:"terminalEffortCount"`
	Candidates          []string   `json:"candidates"`
	LastRunAt           *time.Time `json:"lastRunAt,omitempty"`
}

type Route

type Route string

type RouteAction

type RouteAction string

type RouteLifecycleRequest

type RouteLifecycleRequest struct {
	LifecycleRequestBase
	Route Route `json:"route"`
}

type RoutePayload

type RoutePayload struct {
	Route Route `json:"route"`
}

type RouteSelection

type RouteSelection struct {
	Route   Route
	EventID string
}

type ScopeProjection

type ScopeProjection struct {
	ScopeID  string      `json:"scopeId"`
	Usage    UsageTotals `json:"usage"`
	Counters Counters    `json:"counters"`
	EventIDs []string    `json:"eventIds"`
}

type Selector

type Selector struct {
	EffortID  *string    `json:"effortId,omitempty"`
	SessionID *string    `json:"sessionId,omitempty"`
	Phase     *string    `json:"phase,omitempty"`
	Since     *time.Time `json:"since,omitempty"`
	Until     *time.Time `json:"until,omitempty"`
}

Selector is the shared metrics and diagnosis event selector. Since is inclusive and Until is exclusive.

type SessionAssociatedPayload

type SessionAssociatedPayload struct {
	AssociationOrigin AssociationOrigin `json:"associationOrigin"`
	TrajectoryID      string            `json:"trajectoryId"`
	HandoffEventID    string            `json:"handoffEventId,omitempty"`
}

type SessionDetachedPayload

type SessionDetachedPayload struct {
	Reason DetachReason `json:"reason"`
}

type SessionObservedPayload

type SessionObservedPayload struct {
	Outcome       Outcome       `json:"outcome"`
	DurationMS    uint64        `json:"durationMs,omitempty"`
	ErrorCategory ErrorCategory `json:"errorCategory,omitempty"`
}

type ShellClassification

type ShellClassification string

type ShellObservedPayload

type ShellObservedPayload struct {
	Classification ShellClassification `json:"classification"`
	Outcome        Outcome             `json:"outcome"`
	GateMode       GateMode            `json:"gateMode,omitempty"`
}

type StartPhaseLifecycleRequest

type StartPhaseLifecycleRequest struct {
	LifecycleRequestBase
	Phase              Phase           `json:"phase"`
	Activity           Activity        `json:"activity,omitempty"`
	ImplementationMode BoundedCategory `json:"implementationMode,omitempty"`
}

type StopReason

type StopReason string

type SubagentObservedPayload

type SubagentObservedPayload struct {
	Role             BoundedCategory `json:"role"`
	RequestedModel   ModelName       `json:"requestedModel"`
	ResolvedModel    ModelName       `json:"resolvedModel"`
	ThinkingLevel    BoundedCategory `json:"thinkingLevel"`
	QueueDurationMS  uint64          `json:"queueDurationMs"`
	RunDurationMS    uint64          `json:"runDurationMs"`
	InputTokens      uint64          `json:"inputTokens"`
	OutputTokens     uint64          `json:"outputTokens"`
	CacheReadTokens  uint64          `json:"cacheReadTokens"`
	CacheWriteTokens uint64          `json:"cacheWriteTokens"`
	CostUSD          float64         `json:"costUsd"`
	Outcome          Outcome         `json:"outcome"`
	StopReason       StopReason      `json:"stopReason"`
	ToolCount        uint64          `json:"toolCount"`
	ToolFailureCount uint64          `json:"toolFailureCount"`
	ErrorCategory    ErrorCategory   `json:"errorCategory,omitempty"`
}

type TerminalLifecycleRequest

type TerminalLifecycleRequest struct {
	LifecycleRequestBase
}

type TerminalOutcome

type TerminalOutcome string

type ToolName

type ToolName string

type ToolObservedPayload

type ToolObservedPayload struct {
	Tool          ToolName      `json:"tool"`
	Outcome       Outcome       `json:"outcome"`
	DurationMS    uint64        `json:"durationMs"`
	ErrorCategory ErrorCategory `json:"errorCategory,omitempty"`
}

type TrajectoryForkedPayload

type TrajectoryForkedPayload struct {
	TrajectoryID       string `json:"trajectoryId"`
	ParentTrajectoryID string `json:"parentTrajectoryId"`
	ForkAnchorID       string `json:"forkAnchorId"`
}

type TrajectoryLifecycleRequest

type TrajectoryLifecycleRequest struct {
	LifecycleRequestBase
	TrajectoryID string          `json:"trajectoryId"`
	AnchorID     string          `json:"anchorId"`
	Reason       BoundedCategory `json:"reason,omitempty"`
}

type TrajectoryNode

type TrajectoryNode struct {
	ID                 string
	ParentTrajectoryID string
	ForkAnchorID       string
	EventID            string
}

type TrajectoryPayload

type TrajectoryPayload struct {
	TrajectoryID string          `json:"trajectoryId"`
	AnchorID     string          `json:"anchorId"`
	Reason       BoundedCategory `json:"reason,omitempty"`
}

type TrajectoryProjection

type TrajectoryProjection struct {
	TrajectoryID       string
	ParentTrajectoryID string
	ForkAnchorID       string
	EventIDs           []string
	Discarded          bool
}

type TransitionPhaseLifecycleRequest

type TransitionPhaseLifecycleRequest struct {
	LifecycleRequestBase
	Phase              Phase           `json:"phase"`
	StartEventID       string          `json:"startEventId"`
	NextPhase          Phase           `json:"nextPhase"`
	Outcome            Outcome         `json:"outcome,omitempty"`
	Activity           Activity        `json:"activity,omitempty"`
	ImplementationMode BoundedCategory `json:"implementationMode,omitempty"`
	RouteAction        RouteAction     `json:"routeAction,omitempty"`
	Route              Route           `json:"route,omitempty"`
}

type UsageObservedPayload

type UsageObservedPayload struct {
	Model            ModelName `json:"model"`
	InputTokens      uint64    `json:"inputTokens"`
	OutputTokens     uint64    `json:"outputTokens"`
	CacheReadTokens  uint64    `json:"cacheReadTokens"`
	CacheWriteTokens uint64    `json:"cacheWriteTokens"`
	CostUSD          float64   `json:"costUsd"`
	DurationMS       uint64    `json:"durationMs"`
	Phase            Phase     `json:"phase,omitempty"`
	Activity         Activity  `json:"activity,omitempty"`
}

type UsageTotals

type UsageTotals struct {
	InputTokens      uint64  `json:"inputTokens"`
	OutputTokens     uint64  `json:"outputTokens"`
	CacheReadTokens  uint64  `json:"cacheReadTokens"`
	CacheWriteTokens uint64  `json:"cacheWriteTokens"`
	CostUSD          float64 `json:"costUsd"`
	DurationMS       uint64  `json:"durationMs"`
}

type WaiveLifecycleRequest

type WaiveLifecycleRequest struct {
	LifecycleRequestBase
	RuleCode    DiagnosticRuleCode `json:"ruleCode"`
	Scope       BoundedCategory    `json:"scope"`
	EvidenceIDs []string           `json:"evidenceIds"`
	ReasonCode  WaiverReasonCode   `json:"reasonCode"`
}

type WaiverReasonCode

type WaiverReasonCode string

type WaiverState

type WaiverState struct {
	EventID     string
	RuleCode    DiagnosticRuleCode
	Scope       string
	EvidenceIDs []string
	ReasonCode  WaiverReasonCode
}

type WorkflowProjection

type WorkflowProjection struct {
	Metadata            EffortMetadata
	Lifecycle           LifecycleProjection
	ActiveAncestry      []string
	EvidenceEventIDs    []string
	EffectApplied       map[string]bool
	CurrentPathEventIDs []string
	AllWorkEventIDs     []string
	DiscardedEventIDs   []string
	Trajectories        []TrajectoryProjection
	DerivedEffortIDs    []string
	Origin              *OriginMetadata
	Integrity           []IntegrityIssue
}

func GroupDerivedFamilies

func GroupDerivedFamilies(projections []WorkflowProjection) []WorkflowProjection

GroupDerivedFamilies annotates derived descendants. Each effort remains a separate projection, so callers can group lineage without adding parent work to a child and double-counting its totals.

func ProjectWorkflow

func ProjectWorkflow(read EffortRead) WorkflowProjection

Jump to

Keyboard shortcuts

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