Documentation
¶
Index ¶
- func WithState(ctx context.Context) context.Context
- type ContextProjection
- type ProjectionState
- func (s *ProjectionState) AddReason(reason string)
- func (s *ProjectionState) AddTokensFreed(tokens int)
- func (s *ProjectionState) HideMessages(messageIDs ...string)
- func (s *ProjectionState) HideTurns(turnIDs ...string)
- func (s *ProjectionState) SetReason(reason string)
- func (s *ProjectionState) SetScope(scope string)
- func (s *ProjectionState) Snapshot() ContextProjection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContextProjection ¶
type ContextProjection struct {
// Scope mirrors Agent.Tool.CallExposure ("turn" | "conversation").
Scope string
// HiddenTurnIDs lists turns hidden from active prompt history.
HiddenTurnIDs []string
// HiddenMessageIDs lists message-level prompt suppressions, including
// superseded tool-call results and turn-expanded hides.
HiddenMessageIDs []string
// Reason is a short human-readable explanation for observability.
Reason string
// TokensFreed is an approximate count of tokens removed by projection.
TokensFreed int
}
ContextProjection carries model-facing prompt projection decisions for the current request. It does not mutate transcript truth; it only records what should be hidden from the active prompt build.
func SnapshotFromContext ¶
func SnapshotFromContext(ctx context.Context) (ContextProjection, bool)
SnapshotFromContext returns a copy of the current projection value.
type ProjectionState ¶
type ProjectionState struct {
// contains filtered or unexported fields
}
ProjectionState is a mutable request-scoped holder for ContextProjection. Callers should update it during decision phases and consume a Snapshot() during prompt-history construction.
func StateFromContext ¶
func StateFromContext(ctx context.Context) (*ProjectionState, bool)
StateFromContext returns the mutable state holder when present.
func (*ProjectionState) AddReason ¶
func (s *ProjectionState) AddReason(reason string)
AddReason appends a distinct reason segment for observability.
func (*ProjectionState) AddTokensFreed ¶
func (s *ProjectionState) AddTokensFreed(tokens int)
AddTokensFreed accumulates projected token savings.
func (*ProjectionState) HideMessages ¶
func (s *ProjectionState) HideMessages(messageIDs ...string)
HideMessages adds message IDs to the hidden set, preserving insertion order.
func (*ProjectionState) HideTurns ¶
func (s *ProjectionState) HideTurns(turnIDs ...string)
HideTurns adds turn IDs to the hidden set, preserving insertion order.
func (*ProjectionState) SetReason ¶
func (s *ProjectionState) SetReason(reason string)
SetReason replaces the reason string when non-empty.
func (*ProjectionState) SetScope ¶
func (s *ProjectionState) SetScope(scope string)
SetScope sets the projection scope.
func (*ProjectionState) Snapshot ¶
func (s *ProjectionState) Snapshot() ContextProjection
Snapshot returns a stable copy of the current projection value.