Documentation
¶
Overview ¶
Package id defines TypeID-based identity types for all Cortex entities.
Every entity in Cortex uses a single ID struct with a prefix that identifies the entity type. IDs are K-sortable (UUIDv7-based), globally unique, and URL-safe in the format "prefix_suffix".
Index ¶
- type AgentID
- type AgentRunID
- type AnyID
- type BehaviorID
- type CheckpointID
- type ConversationID
- type DeliveryID
- type ID
- func MustParse(s string) ID
- func MustParseWithPrefix(s string, expected Prefix) ID
- func New(prefix Prefix) ID
- func NewAgentID() ID
- func NewAgentRunID() ID
- func NewBehaviorID() ID
- func NewCheckpointID() ID
- func NewConversationID() ID
- func NewDeliveryID() ID
- func NewMemoryID() ID
- func NewMessageID() ID
- func NewOrchestrationConfigID() ID
- func NewOrchestrationID() ID
- func NewOverlayID() ID
- func NewPersonaID() ID
- func NewSessionID() ID
- func NewSkillID() ID
- func NewStepID() ID
- func NewSuspensionID() ID
- func NewToolCallID() ID
- func NewToolID() ID
- func NewTraitID() ID
- func Parse(s string) (ID, error)
- func ParseAgentID(s string) (ID, error)
- func ParseAgentRunID(s string) (ID, error)
- func ParseAny(s string) (ID, error)
- func ParseBehaviorID(s string) (ID, error)
- func ParseCheckpointID(s string) (ID, error)
- func ParseMemoryID(s string) (ID, error)
- func ParseOptionalSessionID(s string) (ID, error)
- func ParseOrchestrationConfigID(s string) (ID, error)
- func ParseOrchestrationID(s string) (ID, error)
- func ParseOverlayID(s string) (ID, error)
- func ParsePersonaID(s string) (ID, error)
- func ParseSessionID(s string) (ID, error)
- func ParseSkillID(s string) (ID, error)
- func ParseStepID(s string) (ID, error)
- func ParseSuspensionID(s string) (ID, error)
- func ParseToolCallID(s string) (ID, error)
- func ParseToolID(s string) (ID, error)
- func ParseTraitID(s string) (ID, error)
- func ParseWithPrefix(s string, expected Prefix) (ID, error)
- func (i ID) IsNil() bool
- func (i ID) MarshalBSONValue() (bsonType byte, data []byte, err error)
- func (i ID) MarshalText() ([]byte, error)
- func (i ID) Prefix() Prefix
- func (i *ID) Scan(src any) error
- func (i ID) String() string
- func (i *ID) UnmarshalBSONValue(t byte, data []byte) error
- func (i *ID) UnmarshalText(data []byte) error
- func (i ID) Value() (driver.Value, error)
- type MemoryID
- type MessageID
- type OrchestrationConfigID
- type OrchestrationID
- type OverlayID
- type PersonaID
- type Prefix
- type SessionID
- type SkillID
- type StepID
- type SuspensionID
- type ToolCallID
- type ToolID
- type TraitID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentRunID ¶
type AgentRunID = ID
AgentRunID is a type-safe identifier for agent runs (prefix: "arun").
type BehaviorID ¶
type BehaviorID = ID
BehaviorID is a type-safe identifier for behaviors (prefix: "bhv").
type CheckpointID ¶
type CheckpointID = ID
CheckpointID is a type-safe identifier for checkpoints (prefix: "acp").
type ConversationID ¶
type ConversationID = ID
ConversationID is a type-safe identifier for a2a conversations (prefix: "conv").
type DeliveryID ¶
type DeliveryID = ID
DeliveryID is a type-safe identifier for a2a deliveries (prefix: "dlv").
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is the primary identifier type for all Cortex entities. It wraps a TypeID providing a prefix-qualified, globally unique, sortable, URL-safe identifier in the format "prefix_suffix".
var Nil ID
Nil is the zero-value ID.
func MustParseWithPrefix ¶
MustParseWithPrefix is like ParseWithPrefix but panics on error.
func New ¶
New generates a new globally unique ID with the given prefix. It panics if prefix is not a valid TypeID prefix (programming error).
func NewCheckpointID ¶
func NewCheckpointID() ID
NewCheckpointID generates a new unique checkpoint ID.
func NewConversationID ¶
func NewConversationID() ID
NewConversationID generates a new unique a2a conversation ID.
func NewOrchestrationConfigID ¶
func NewOrchestrationConfigID() ID
NewOrchestrationConfigID generates a new unique orchestration config ID.
func NewOrchestrationID ¶
func NewOrchestrationID() ID
NewOrchestrationID generates a new unique orchestration ID.
func NewSuspensionID ¶
func NewSuspensionID() ID
NewSuspensionID generates a new unique suspension ID.
func Parse ¶
Parse parses a TypeID string (e.g., "agt_01h2xcejqtf2nbrexx3vqjhp41") into an ID. Returns an error if the string is not valid.
func ParseAgentID ¶
ParseAgentID parses a string and validates the "agt" prefix.
func ParseAgentRunID ¶
ParseAgentRunID parses a string and validates the "arun" prefix.
func ParseBehaviorID ¶
ParseBehaviorID parses a string and validates the "bhv" prefix.
func ParseCheckpointID ¶
ParseCheckpointID parses a string and validates the "acp" prefix.
func ParseMemoryID ¶
ParseMemoryID parses a string and validates the "mem" prefix.
func ParseOptionalSessionID ¶
ParseOptionalSessionID parses s as a session ID, returning the zero ID (rather than an error) when s is empty. Run and memory rows written before session_id existed carry an empty column, and the store layer reconstructing those rows into structs needs a nil session id there, not a parse failure.
func ParseOrchestrationConfigID ¶
ParseOrchestrationConfigID parses a string and validates the "orchcfg" prefix.
func ParseOrchestrationID ¶
ParseOrchestrationID parses a string and validates the "orch" prefix.
func ParseOverlayID ¶
ParseOverlayID parses a string and validates the "ovl" prefix.
func ParsePersonaID ¶
ParsePersonaID parses a string and validates the "prs" prefix.
func ParseSessionID ¶
ParseSessionID parses a string and validates the "ses" prefix.
func ParseSkillID ¶
ParseSkillID parses a string and validates the "skl" prefix.
func ParseStepID ¶
ParseStepID parses a string and validates the "astp" prefix.
func ParseSuspensionID ¶
ParseSuspensionID parses a string and validates the "sus" prefix.
func ParseToolCallID ¶
ParseToolCallID parses a string and validates the "tcall" prefix.
func ParseToolID ¶
ParseToolID parses a string and validates the "tool" prefix.
func ParseTraitID ¶
ParseTraitID parses a string and validates the "trt" prefix.
func ParseWithPrefix ¶
ParseWithPrefix parses a TypeID string and validates that its prefix matches the expected value.
func (ID) MarshalBSONValue ¶
MarshalBSONValue satisfies bson.ValueMarshaler (mongo-driver v2) so the ID is stored as a BSON string instead of an opaque struct. No bson import needed because Go uses structural typing for interface satisfaction.
func (ID) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (ID) String ¶
String returns the full TypeID string representation (prefix_suffix). Returns an empty string for the Nil ID.
func (*ID) UnmarshalBSONValue ¶
UnmarshalBSONValue satisfies bson.ValueUnmarshaler (mongo-driver v2).
func (*ID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type MessageID ¶
type MessageID = ID
MessageID is a type-safe identifier for a2a envelopes (prefix: "msg").
type OrchestrationConfigID ¶
type OrchestrationConfigID = ID
OrchestrationConfigID is a type-safe identifier for orchestration configs (prefix: "orchcfg").
type OrchestrationID ¶
type OrchestrationID = ID
OrchestrationID is a type-safe identifier for orchestrations (prefix: "orch").
type OverlayID ¶
type OverlayID = ID
OverlayID is a type-safe identifier for prompt overlays (prefix: "ovl").
type PersonaID ¶
type PersonaID = ID
PersonaID is a type-safe identifier for personas (prefix: "prs").
type Prefix ¶
type Prefix string
Prefix identifies the entity type encoded in a TypeID.
const ( PrefixAgent Prefix = "agt" PrefixAgentRun Prefix = "arun" PrefixTool Prefix = "tool" PrefixToolCall Prefix = "tcall" PrefixStep Prefix = "astp" PrefixMemory Prefix = "mem" PrefixCheckpoint Prefix = "acp" PrefixOrchestration Prefix = "orch" PrefixOrchestrationConfig Prefix = "orchcfg" PrefixSkill Prefix = "skl" PrefixTrait Prefix = "trt" PrefixBehavior Prefix = "bhv" PrefixPersona Prefix = "prs" PrefixSession Prefix = "ses" PrefixSuspension Prefix = "sus" PrefixOverlay Prefix = "ovl" PrefixMessage Prefix = "msg" PrefixConversation Prefix = "conv" PrefixDelivery Prefix = "dlv" PrefixDeliveryClaim Prefix = "dclaim" )
Prefix constants for all Cortex entity types.
type SessionID ¶
type SessionID = ID
SessionID is a type-safe identifier for sessions (prefix: "ses").
type SuspensionID ¶
type SuspensionID = ID
SuspensionID is a type-safe identifier for suspensions (prefix: "sus").
type ToolCallID ¶
type ToolCallID = ID
ToolCallID is a type-safe identifier for tool calls (prefix: "tcall").