package workbench import "time" type Balance struct { TenantID uint64 `json:"tenant_id" gorm:"primaryKey"` UserID string `json:"user_id" gorm:"primaryKey"` Balance int64 `json:"balance"` Reserved int64 `json:"reserved"` UpdatedAt time.Time `json:"updated_at"` } func (Balance) TableName() string { return "workbench_balances" } type Transaction struct { ID string `json:"id" gorm:"primaryKey"` TenantID uint64 `json:"tenant_id" gorm:"uniqueIndex:wb_transaction_key"` UserID string `json:"user_id"` Delta int64 `json:"delta"` Kind string `json:"kind"` Reason string `json:"reason"` ActorID string `json:"actor_id"` IdempotencyKey string `json:"-" gorm:"uniqueIndex:wb_transaction_key"` Metadata JSON `json:"metadata" gorm:"type:jsonb"` CreatedAt time.Time `json:"created_at"` } func (Transaction) TableName() string { return "workbench_transactions" } type Usage struct { ID string `json:"id" gorm:"primaryKey"` TenantID uint64 `json:"tenant_id" gorm:"uniqueIndex:wb_usage_key"` OwnerID string `json:"owner_id"` JobID string `json:"job_id"` CallID string `json:"call_id" gorm:"uniqueIndex:wb_usage_key"` AgentID string `json:"agent_id"` ModelID string `json:"model_id"` Action string `json:"action"` InputTokens int64 `json:"input_tokens"` OutputTokens int64 `json:"output_tokens"` Points int64 `json:"points"` Status string `json:"status"` Metadata JSON `json:"metadata" gorm:"type:jsonb"` CreatedAt time.Time `json:"created_at"` } func (Usage) TableName() string { return "workbench_usage" } type BalanceHold struct { ID string `gorm:"primaryKey"` TenantID uint64 UserID string Amount int64 Status string ExpiresAt time.Time CreatedAt time.Time } func (BalanceHold) TableName() string { return "workbench_balance_holds" } type Consumption struct { ID string `json:"id" gorm:"primaryKey"` TenantID uint64 `json:"tenant_id" gorm:"uniqueIndex:wb_consumption_key"` OwnerID string `json:"owner_id" gorm:"uniqueIndex:wb_consumption_key"` AgentID string `json:"agent_id" gorm:"uniqueIndex:wb_consumption_key"` KBID string `json:"kb_id" gorm:"uniqueIndex:wb_consumption_key"` ChunkID string `json:"chunk_id" gorm:"uniqueIndex:wb_consumption_key"` KnowledgeID string `json:"knowledge_id"` FileName string `json:"file_name"` Category string `json:"category"` Excerpt string `json:"excerpt"` ResourceID string `json:"resource_id"` SegmentID string `json:"segment_id"` JobID string `json:"job_id"` Status string `json:"status"` Banned bool `json:"banned"` LeaseUntil *time.Time `json:"lease_until"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func (Consumption) TableName() string { return "workbench_consumption" } type OperationLog struct { ID string `json:"id" gorm:"primaryKey"` TenantID uint64 `json:"tenant_id"` OwnerID string `json:"owner_id"` OwnerName string `json:"owner_name"` Kind string `json:"kind"` Level string `json:"level"` Action string `json:"action"` Message string `json:"message"` ResourceID string `json:"resource_id"` TraceID string `json:"trace_id"` Status int `json:"status"` Metadata JSON `json:"metadata" gorm:"type:jsonb"` CreatedAt time.Time `json:"created_at"` } func (OperationLog) TableName() string { return "workbench_operation_logs" } type PendingMemory struct { ID string `json:"id" gorm:"primaryKey"` TenantID uint64 `json:"tenant_id"` OwnerID string `json:"owner_id"` AgentID string `json:"agent_id"` Content string `json:"content"` SourceRef string `json:"source_ref"` Status string `json:"status"` ReviewedBy string `json:"reviewed_by"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` LegacyHistoryID string `json:"legacy_history_id,omitempty"` NativeMemoryID string `json:"native_memory_id,omitempty"` ReconfirmedContent string `json:"reconfirmed_content,omitempty"` ReconfirmedAt *time.Time `json:"reconfirmed_at,omitempty"` CanReconfirm bool `json:"can_reconfirm" gorm:"-"` ReconfirmationUnavailableReason string `json:"reconfirmation_unavailable_reason,omitempty" gorm:"-"` } func (PendingMemory) TableName() string { return "workbench_pending_memories" }