Documentation
¶
Overview ¶
Package sessionclassification defines bounded, provider-neutral evidence and classifier contracts for session classification.
Index ¶
Constants ¶
const MaxClassifierIDBytes = 256
MaxClassifierIDBytes caps a classifier's stable identity by UTF-8 byte length.
Variables ¶
var ErrInvalidClassifier = errors.New("sessionclassification: invalid classifier")
ErrInvalidClassifier identifies a nil classifier, an unavailable identity, or an identity that violates the bounded classifier contract.
Functions ¶
func ClassifierIdentity ¶
func ClassifierIdentity(classifier Classifier) (id string, err error)
ClassifierIdentity validates a classifier's stable identity during feature composition and returns the bounded ID retained by the generation. Typed-nil classifiers and ID panics fail closed without exposing classifier text.
func ValidateClassifierID ¶
ValidateClassifierID accepts a non-empty, bounded, control-free stable ID.
Types ¶
type Classifier ¶
type Classifier interface {
// ID returns the stable identifier of this classifier implementation.
ID() string
// Classify evaluates one bounded metadata snapshot and returns its projection.
Classify(context.Context, Input) (session.Classification, error)
}
Classifier classifies the current bounded session metadata snapshot.
type Evidence ¶
type Evidence struct {
Operation lipapi.Operation
ClientUserAgent string
ToolCategories ToolCategorySet
}
Evidence carries accepted request metadata for one classification evaluation. ClientUserAgent must already satisfy the canonical identity acceptance and length policy; this SDK contract does not parse headers or define a second acceptance policy. Classifiers must not persist the raw User-Agent.
type Input ¶
type Input struct {
TraceID string
Session session.SessionView
Workspace workspace.WorkspaceView
Evidence Evidence
}
Input is the bounded metadata snapshot presented to a session classifier. Session and Workspace are read-only projections. Classifiers may inspect bounded workspace markers and labels but must not persist ProjectRoot. No request Call, transcript, tool definitions, raw header map, or route state is included.
type ToolCategorySet ¶
type ToolCategorySet uint16
ToolCategorySet is a fixed bitset of canonical tool-name categories.
const ( // ToolCategoryFileRead records at least one canonical file-read tool. ToolCategoryFileRead ToolCategorySet = 1 << iota // ToolCategoryFileSearch records at least one canonical file-search tool. ToolCategoryFileSearch // ToolCategoryOSCommand records at least one canonical operating-system command tool. ToolCategoryOSCommand // ToolCategoryFileEdit records at least one canonical file-edit tool. ToolCategoryFileEdit // ToolCategoryFileRemove records at least one canonical file-removal tool. ToolCategoryFileRemove // ToolCategoryWebAccess records at least one canonical web-access tool. ToolCategoryWebAccess // ToolCategoryUnknownSeen records at least one unrecognized tool name. ToolCategoryUnknownSeen )
func (ToolCategorySet) AddToolName ¶
func (s ToolCategorySet) AddToolName(name string) ToolCategorySet
AddToolName returns the set with the canonical category for name added. The name itself is not retained; unknown names set ToolCategoryUnknownSeen.