🎨 优化扩展模块

This commit is contained in:
2026-02-14 06:20:05 +08:00
parent 572f3aa15b
commit 0f9c9c9b9c
16 changed files with 2334 additions and 3123 deletions

View File

@@ -3,148 +3,65 @@ package app
import (
"git.echol.cn/loser/st/server/global"
"gorm.io/datatypes"
"time"
)
// AIExtension 扩展表 (兼容 SillyTavern Extension 规范)
// AIExtension 扩展Extension)表
type AIExtension struct {
global.GVA_MODEL
UserID uint `json:"userId" gorm:"not null;index;comment:所属用户ID"`
User *AppUser `json:"user" gorm:"foreignKey:UserID"`
Name string `json:"name" gorm:"type:varchar(500);not null;index;comment:扩展名称"`
DisplayName string `json:"displayName" gorm:"type:varchar(500);comment:显示名称"`
Version string `json:"version" gorm:"type:varchar(50);comment:版本号"`
Author string `json:"author" gorm:"type:varchar(200);comment:作者"`
Description string `json:"description" gorm:"type:text;comment:扩展描述"`
Homepage string `json:"homepage" gorm:"type:varchar(1024);comment:主页地址"`
Repository string `json:"repository" gorm:"type:varchar(1024);comment:仓库地址"`
License string `json:"license" gorm:"type:varchar(100);comment:许可证"`
Tags datatypes.JSON `json:"tags" gorm:"type:jsonb;comment:标签列表"`
UserID uint `json:"userId" gorm:"not null;index;comment:所属用户ID"`
User *AppUser `json:"user" gorm:"foreignKey:UserID"`
// 扩展类型和功能
ExtensionType string `json:"extensionType" gorm:"type:varchar(50);default:'ui';comment:扩展类型(ui/server/hybrid)"` // ui, server, hybrid
Category string `json:"category" gorm:"type:varchar(100);comment:分类(utilities/themes/integrations/tools)"`
// 基础信息
Name string `json:"name" gorm:"type:varchar(200);not null;index;comment:扩展名称(唯一标识)"`
DisplayName string `json:"displayName" gorm:"type:varchar(200);comment:扩展显示名称"`
Version string `json:"version" gorm:"type:varchar(50);default:'1.0.0';comment:版本号"`
Author string `json:"author" gorm:"type:varchar(200);comment:作者"`
Description string `json:"description" gorm:"type:text;comment:扩展描述"`
Homepage string `json:"homepage" gorm:"type:varchar(500);comment:主页链接"`
Repository string `json:"repository" gorm:"type:varchar(500);comment:仓库地址"`
License string `json:"license" gorm:"type:varchar(100);comment:许可证"`
// 依赖关系
Dependencies datatypes.JSON `json:"dependencies" gorm:"type:jsonb;comment:依赖的其他扩展"`
Conflicts datatypes.JSON `json:"conflicts" gorm:"type:jsonb;comment:冲突的扩展列表"`
// 分类与标签
ExtensionType string `json:"extensionType" gorm:"type:varchar(20);default:'ui';comment:扩展类型:ui,server,hybrid"`
Category string `json:"category" gorm:"type:varchar(50);comment:分类:utilities,themes,integrations,tools"`
Tags datatypes.JSON `json:"tags" gorm:"type:jsonb;comment:标签列表"`
// 扩展文件
ManifestData datatypes.JSON `json:"manifestData" gorm:"type:jsonb;not null;comment:manifest.json 完整内容"`
ScriptPath string `json:"scriptPath" gorm:"type:varchar(1024);comment:主脚本文件路径"`
StylePath string `json:"stylePath" gorm:"type:varchar(1024);comment:样式文件路径"`
AssetsPaths datatypes.JSON `json:"assetsPaths" gorm:"type:jsonb;comment:资源文件路径列表"`
// 依赖管理
Dependencies datatypes.JSON `json:"dependencies" gorm:"type:jsonb;comment:依赖扩展"`
Conflicts datatypes.JSON `json:"conflicts" gorm:"type:jsonb;comment:冲突扩展"`
// 扩展配置
Settings datatypes.JSON `json:"settings" gorm:"type:jsonb;comment:扩展配置项"`
Options datatypes.JSON `json:"options" gorm:"type:jsonb;comment:扩展选项"`
// 文件路径
ScriptPath string `json:"scriptPath" gorm:"type:varchar(500);comment:脚本文件路径"`
StylePath string `json:"stylePath" gorm:"type:varchar(500);comment:样式文件路径"`
AssetPaths datatypes.JSON `json:"assetPaths" gorm:"type:jsonb;comment:资源文件路径列表"`
// 状态
IsEnabled bool `json:"isEnabled" gorm:"default:false;index;comment:是否启用"`
IsInstalled bool `json:"isInstalled" gorm:"default:true;index;comment:是否已安装"`
IsSystemExt bool `json:"isSystemExt" gorm:"default:false;comment:是否系统内置扩展"`
InstallSource string `json:"installSource" gorm:"type:varchar(500);comment:安装来源(url/git/file/marketplace)"`
SourceURL string `json:"sourceUrl" gorm:"type:varchar(1000);comment:原始安装 URL用于更新"`
Branch string `json:"branch" gorm:"type:varchar(100);comment:Git 分支名称"`
InstallDate time.Time `json:"installDate" gorm:"comment:安装日期"`
LastEnabled time.Time `json:"lastEnabled" gorm:"comment:最后启用时间"`
// 配置与元数据
ManifestData datatypes.JSON `json:"manifestData" gorm:"type:jsonb;comment:manifest 元数据"`
Settings datatypes.JSON `json:"settings" gorm:"type:jsonb;comment:扩展配置"`
Options datatypes.JSON `json:"options" gorm:"type:jsonb;comment:扩展选项"`
Metadata datatypes.JSON `json:"metadata" gorm:"type:jsonb;comment:额外元数据"`
// 更新相关
AutoUpdate bool `json:"autoUpdate" gorm:"default:false;comment:是否自动更新"`
LastUpdateCheck *time.Time `json:"lastUpdateCheck" gorm:"comment:最后检查更新时间"`
AvailableVersion string `json:"availableVersion" gorm:"type:varchar(50);comment:可用的新版本"`
// 状态管理
IsEnabled bool `json:"isEnabled" gorm:"default:false;comment:是否启用"`
IsInstalled bool `json:"isInstalled" gorm:"default:true;comment:是否已安装"`
IsSystemExt bool `json:"isSystemExt" gorm:"default:false;comment:是否系统扩展"`
// 统计
// 安装信息
InstallSource string `json:"installSource" gorm:"type:varchar(50);comment:安装来源:url,git,file,marketplace"`
SourceURL string `json:"sourceUrl" gorm:"type:varchar(500);comment:源地址"`
Branch string `json:"branch" gorm:"type:varchar(100);default:'main';comment:Git 分支"`
AutoUpdate bool `json:"autoUpdate" gorm:"default:false;comment:是否自动更新"`
LastUpdateCheck *int64 `json:"lastUpdateCheck" gorm:"comment:最后检查更新时间戳"`
AvailableVersion string `json:"availableVersion" gorm:"type:varchar(50);comment:可用的新版本"`
InstallDate *int64 `json:"installDate" gorm:"comment:安装日期时间戳"`
LastEnabled *int64 `json:"lastEnabled" gorm:"comment:最后启用时间戳"`
// 统计信息
UsageCount int `json:"usageCount" gorm:"default:0;comment:使用次数"`
ErrorCount int `json:"errorCount" gorm:"default:0;comment:错误次数"`
LoadTime int `json:"loadTime" gorm:"default:0;comment:平均加载时间(ms)"`
// 元数据
Metadata datatypes.JSON `json:"metadata" gorm:"type:jsonb;comment:扩展元数据"`
LoadTime int `json:"loadTime" gorm:"default:0;comment:加载时间(ms)"`
}
func (AIExtension) TableName() string {
return "ai_extensions"
}
// AIExtensionManifest 扩展清单结构 (对应 manifest.json兼容 SillyTavern 格式)
type AIExtensionManifest struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Homepage string `json:"homepage,omitempty"`
HomePage string `json:"homePage,omitempty"` // SillyTavern 兼容(驼峰命名)
Repository string `json:"repository,omitempty"`
License string `json:"license,omitempty"`
Tags []string `json:"tags,omitempty"`
Type string `json:"type,omitempty"` // ui, server, hybrid
Category string `json:"category,omitempty"` // utilities, themes, integrations, tools
Dependencies map[string]string `json:"dependencies,omitempty"` // {"extension-name": ">=1.0.0"}
Conflicts []string `json:"conflicts,omitempty"`
Entry string `json:"entry,omitempty"` // 主入口文件
Js string `json:"js,omitempty"` // SillyTavern 兼容: JS 入口文件
Style string `json:"style,omitempty"` // 样式文件
Css string `json:"css,omitempty"` // SillyTavern 兼容: CSS 样式文件
Assets []string `json:"assets,omitempty"` // 资源文件列表
Settings map[string]interface{} `json:"settings,omitempty"` // 默认设置
Options map[string]interface{} `json:"options,omitempty"` // 扩展选项
Metadata map[string]interface{} `json:"metadata,omitempty"` // 扩展元数据
AutoUpdate bool `json:"auto_update,omitempty"` // 是否自动更新SillyTavern 兼容)
InlineScript string `json:"inline_script,omitempty"` // 内联脚本SillyTavern 兼容)
Requires []string `json:"requires,omitempty"` // SillyTavern 兼容: 依赖列表
Optional []string `json:"optional,omitempty"` // SillyTavern 兼容: 可选依赖
LoadingOrder int `json:"loading_order,omitempty"` // SillyTavern 兼容: 加载顺序
I18n map[string]string `json:"i18n,omitempty"` // SillyTavern 兼容: 国际化文件
}
// GetEffectiveName 获取有效名称,兼容 SillyTavern manifest 没有 name 字段的情况
func (m *AIExtensionManifest) GetEffectiveName() string {
if m.Name != "" {
return m.Name
}
if m.DisplayName != "" {
return m.DisplayName
}
return ""
}
// GetEffectiveHomepage 获取有效主页地址
func (m *AIExtensionManifest) GetEffectiveHomepage() string {
if m.Homepage != "" {
return m.Homepage
}
return m.HomePage
}
// GetEffectiveEntry 获取有效的 JS 入口文件路径
func (m *AIExtensionManifest) GetEffectiveEntry() string {
if m.Entry != "" {
return m.Entry
}
return m.Js
}
// GetEffectiveStyle 获取有效的 CSS 样式文件路径
func (m *AIExtensionManifest) GetEffectiveStyle() string {
if m.Style != "" {
return m.Style
}
return m.Css
}
// AIExtensionSettings 用户的扩展配置(已废弃,配置现在直接存储在 AIExtension.Settings 中)
// type AIExtensionSettings struct {
// global.GVA_MODEL
// UserID uint `json:"userId" gorm:"not null;index:idx_user_ext,unique;comment:用户ID"`
// User *AppUser `json:"user" gorm:"foreignKey:UserID"`
// ExtensionID uint `json:"extensionId" gorm:"not null;index:idx_user_ext,unique;comment:扩展ID"`
// Extension *AIExtension `json:"extension" gorm:"foreignKey:ExtensionID"`
// Settings datatypes.JSON `json:"settings" gorm:"type:jsonb;not null;comment:用户配置"`
// IsEnabled bool `json:"isEnabled" gorm:"default:true;comment:用户是否启用"`
// }
//
// func (AIExtensionSettings) TableName() string {
// return "ai_extension_settings"
// }

View File

@@ -4,9 +4,9 @@ import (
common "git.echol.cn/loser/st/server/model/common/request"
)
// CreateExtensionRequest 创建/安装扩展请求
// CreateExtensionRequest 创建扩展请求
type CreateExtensionRequest struct {
Name string `json:"name" binding:"required,min=1,max=500"`
Name string `json:"name" binding:"required"`
DisplayName string `json:"displayName"`
Version string `json:"version"`
Author string `json:"author"`
@@ -15,93 +15,69 @@ type CreateExtensionRequest struct {
Repository string `json:"repository"`
License string `json:"license"`
Tags []string `json:"tags"`
ExtensionType string `json:"extensionType" binding:"required,oneof=ui server hybrid"`
ExtensionType string `json:"extensionType" binding:"required"`
Category string `json:"category"`
Dependencies map[string]string `json:"dependencies"`
Conflicts []string `json:"conflicts"`
ManifestData map[string]interface{} `json:"manifestData" binding:"required"`
ManifestData map[string]interface{} `json:"manifestData"`
ScriptPath string `json:"scriptPath"`
StylePath string `json:"stylePath"`
AssetsPaths []string `json:"assetsPaths"`
AssetPaths []string `json:"assetPaths"`
Settings map[string]interface{} `json:"settings"`
Options map[string]interface{} `json:"options"`
InstallSource string `json:"installSource"`
SourceURL string `json:"sourceUrl"` // 原始安装 URL用于更新
Branch string `json:"branch"` // Git 分支
AutoUpdate bool `json:"autoUpdate"` // 是否自动更新
SourceURL string `json:"sourceUrl"`
Branch string `json:"branch"`
Metadata map[string]interface{} `json:"metadata"`
}
// UpdateExtensionRequest 更新扩展请求
type UpdateExtensionRequest struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
Version string `json:"version"`
Author string `json:"author"`
Homepage string `json:"homepage"`
Repository string `json:"repository"`
License string `json:"license"`
Tags []string `json:"tags"`
ExtensionType string `json:"extensionType"`
Category string `json:"category"`
Dependencies map[string]string `json:"dependencies"`
Conflicts []string `json:"conflicts"`
ManifestData map[string]interface{} `json:"manifestData"`
ScriptPath string `json:"scriptPath"`
StylePath string `json:"stylePath"`
AssetPaths []string `json:"assetPaths"`
Settings map[string]interface{} `json:"settings"`
Options map[string]interface{} `json:"options"`
Metadata map[string]interface{} `json:"metadata"`
}
// ExtensionListRequest 扩展列表查询请求
type ExtensionListRequest struct {
common.PageInfo
Name string `json:"name" form:"name"` // 扩展名称(模糊搜索)
Keyword string `json:"keyword" form:"keyword"` // 搜索关键词
Name string `json:"name" form:"name"` // 扩展名称
ExtensionType string `json:"extensionType" form:"extensionType"` // 扩展类型
Category string `json:"category" form:"category"` // 分类
IsEnabled *bool `json:"isEnabled" form:"isEnabled"` // 是否启用
IsInstalled *bool `json:"isInstalled" form:"isInstalled"` // 是否已安装
Tag string `json:"tag" form:"tag"` // 标签过滤
}
// InstallExtensionRequest 安装扩展请求
type InstallExtensionRequest struct {
Source string `json:"source" binding:"required,oneof=url file marketplace"` // 安装来源
URL string `json:"url"` // URL 安装
ManifestData []byte `json:"manifestData"` // 文件安装
MarketplaceID string `json:"marketplaceId"` // 市场安装
}
// UninstallExtensionRequest 卸载扩展请求
type UninstallExtensionRequest struct {
DeleteFiles bool `json:"deleteFiles"` // 是否删除文件
Tag string `json:"tag" form:"tag"` // 标签
}
// ToggleExtensionRequest 启用/禁用扩展请求
type ToggleExtensionRequest struct {
IsEnabled *bool `json:"isEnabled"` // 使用指针类型,允许 false 值
IsEnabled bool `json:"isEnabled"`
}
// UpdateExtensionSettingsRequest 更新扩展置请求
// UpdateExtensionSettingsRequest 更新扩展置请求
type UpdateExtensionSettingsRequest struct {
Settings map[string]interface{} `json:"settings" binding:"required"`
}
// ImportExtensionRequest 导入扩展请求
type ImportExtensionRequest struct {
Format string `json:"format" binding:"required,oneof=zip folder"`
}
// ExportExtensionRequest 导出扩展请求
type ExportExtensionRequest struct {
Format string `json:"format" binding:"required,oneof=zip folder"`
IncludeAssets bool `json:"includeAssets"` // 是否包含资源文件
}
// ExtensionStatsRequest 扩展统计请求
type ExtensionStatsRequest struct {
ExtensionID uint `json:"extensionId" binding:"required"`
Action string `json:"action" binding:"required,oneof=usage error load"` // 统计类型
Value int `json:"value"`
}
// InstallExtensionFromGitRequest 从 Git URL 安装扩展请求
type InstallExtensionFromGitRequest struct {
GitUrl string `json:"gitUrl" binding:"required"` // Git 仓库 URL
Branch string `json:"branch" binding:"omitempty,max=100"` // 分支名称(可选,默认 main
}
// InstallExtensionFromURLRequest 从 URL 安装扩展请求(智能识别 Git URL 或 Manifest URL
type InstallExtensionFromURLRequest struct {
URL string `json:"url" binding:"required"` // Git 仓库 URL 或 Manifest.json URL
Branch string `json:"branch"` // Git 分支名称(可选,默认 main
}
// UpdateExtensionRequest 更新扩展请求
type UpdateExtensionRequest struct {
Force bool `json:"force"` // 是否强制更新(忽略本地修改)
DisplayName string `json:"displayName"`
Description string `json:"description"`
Settings map[string]interface{} `json:"settings"`
Options map[string]interface{} `json:"options"`
Metadata map[string]interface{} `json:"metadata"`
// InstallExtensionRequest 从URL安装扩展请求
type InstallExtensionRequest struct {
URL string `json:"url" binding:"required"`
Branch string `json:"branch"`
}

View File

@@ -2,8 +2,8 @@ package response
import (
"encoding/json"
"git.echol.cn/loser/st/server/model/app"
"time"
)
// ExtensionResponse 扩展响应
@@ -23,12 +23,13 @@ type ExtensionResponse struct {
Category string `json:"category"`
Dependencies map[string]string `json:"dependencies"`
Conflicts []string `json:"conflicts"`
ManifestData map[string]interface{} `json:"manifestData"`
ScriptPath string `json:"scriptPath"`
StylePath string `json:"stylePath"`
AssetsPaths []string `json:"assetsPaths"`
AssetPaths []string `json:"assetPaths"`
ManifestData map[string]interface{} `json:"manifestData"`
Settings map[string]interface{} `json:"settings"`
Options map[string]interface{} `json:"options"`
Metadata map[string]interface{} `json:"metadata"`
IsEnabled bool `json:"isEnabled"`
IsInstalled bool `json:"isInstalled"`
IsSystemExt bool `json:"isSystemExt"`
@@ -36,16 +37,15 @@ type ExtensionResponse struct {
SourceURL string `json:"sourceUrl"`
Branch string `json:"branch"`
AutoUpdate bool `json:"autoUpdate"`
InstallDate time.Time `json:"installDate"`
LastEnabled time.Time `json:"lastEnabled"`
LastUpdateCheck *time.Time `json:"lastUpdateCheck"`
LastUpdateCheck *int64 `json:"lastUpdateCheck"`
AvailableVersion string `json:"availableVersion"`
InstallDate *int64 `json:"installDate"`
LastEnabled *int64 `json:"lastEnabled"`
UsageCount int `json:"usageCount"`
ErrorCount int `json:"errorCount"`
LoadTime int `json:"loadTime"`
Metadata map[string]interface{} `json:"metadata"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// ExtensionListResponse 扩展列表响应
@@ -56,105 +56,20 @@ type ExtensionListResponse struct {
PageSize int `json:"pageSize"`
}
// ExtensionManifestResponse manifest.json 响应
type ExtensionManifestResponse struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Homepage string `json:"homepage,omitempty"`
Repository string `json:"repository,omitempty"`
License string `json:"license,omitempty"`
Tags []string `json:"tags,omitempty"`
Type string `json:"type,omitempty"`
Category string `json:"category,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
Conflicts []string `json:"conflicts,omitempty"`
Entry string `json:"entry,omitempty"`
Style string `json:"style,omitempty"`
Assets []string `json:"assets,omitempty"`
Settings map[string]interface{} `json:"settings,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
// unmarshalJSONB 通用 JSONB 反序列化辅助函数
func unmarshalJSONB[T any](data []byte, fallback T) T {
if len(data) == 0 {
return fallback
}
var result T
if err := json.Unmarshal(data, &result); err != nil {
return fallback
}
return result
}
// ExtensionStatsResponse 扩展统计响应
type ExtensionStatsResponse struct {
ExtensionID uint `json:"extensionId"`
ExtensionName string `json:"extensionName"`
UsageCount int `json:"usageCount"`
ErrorCount int `json:"errorCount"`
LoadTime int `json:"loadTime"`
LastUsed time.Time `json:"lastUsed"`
}
// ToExtensionResponse 转换为扩展响应
// ToExtensionResponse 将 AIExtension 转换为 ExtensionResponse
func ToExtensionResponse(ext *app.AIExtension) ExtensionResponse {
var tags []string
if ext.Tags != nil {
_ = json.Unmarshal([]byte(ext.Tags), &tags)
}
if tags == nil {
tags = []string{}
}
var dependencies map[string]string
if ext.Dependencies != nil {
_ = json.Unmarshal([]byte(ext.Dependencies), &dependencies)
}
if dependencies == nil {
dependencies = map[string]string{}
}
var conflicts []string
if ext.Conflicts != nil {
_ = json.Unmarshal([]byte(ext.Conflicts), &conflicts)
}
if conflicts == nil {
conflicts = []string{}
}
var manifestData map[string]interface{}
if ext.ManifestData != nil {
_ = json.Unmarshal([]byte(ext.ManifestData), &manifestData)
}
if manifestData == nil {
manifestData = map[string]interface{}{}
}
var assetsPaths []string
if ext.AssetsPaths != nil {
_ = json.Unmarshal([]byte(ext.AssetsPaths), &assetsPaths)
}
if assetsPaths == nil {
assetsPaths = []string{}
}
var settings map[string]interface{}
if ext.Settings != nil {
_ = json.Unmarshal([]byte(ext.Settings), &settings)
}
if settings == nil {
settings = map[string]interface{}{}
}
var options map[string]interface{}
if ext.Options != nil {
_ = json.Unmarshal([]byte(ext.Options), &options)
}
if options == nil {
options = map[string]interface{}{}
}
var metadata map[string]interface{}
if ext.Metadata != nil {
_ = json.Unmarshal([]byte(ext.Metadata), &metadata)
}
if metadata == nil {
metadata = map[string]interface{}{}
}
return ExtensionResponse{
ID: ext.ID,
UserID: ext.UserID,
@@ -166,17 +81,18 @@ func ToExtensionResponse(ext *app.AIExtension) ExtensionResponse {
Homepage: ext.Homepage,
Repository: ext.Repository,
License: ext.License,
Tags: tags,
Tags: unmarshalJSONB(ext.Tags, []string{}),
ExtensionType: ext.ExtensionType,
Category: ext.Category,
Dependencies: dependencies,
Conflicts: conflicts,
ManifestData: manifestData,
Dependencies: unmarshalJSONB(ext.Dependencies, map[string]string{}),
Conflicts: unmarshalJSONB(ext.Conflicts, []string{}),
ScriptPath: ext.ScriptPath,
StylePath: ext.StylePath,
AssetsPaths: assetsPaths,
Settings: settings,
Options: options,
AssetPaths: unmarshalJSONB(ext.AssetPaths, []string{}),
ManifestData: unmarshalJSONB(ext.ManifestData, map[string]interface{}{}),
Settings: unmarshalJSONB(ext.Settings, map[string]interface{}{}),
Options: unmarshalJSONB(ext.Options, map[string]interface{}{}),
Metadata: unmarshalJSONB(ext.Metadata, map[string]interface{}{}),
IsEnabled: ext.IsEnabled,
IsInstalled: ext.IsInstalled,
IsSystemExt: ext.IsSystemExt,
@@ -184,15 +100,14 @@ func ToExtensionResponse(ext *app.AIExtension) ExtensionResponse {
SourceURL: ext.SourceURL,
Branch: ext.Branch,
AutoUpdate: ext.AutoUpdate,
InstallDate: ext.InstallDate,
LastEnabled: ext.LastEnabled,
LastUpdateCheck: ext.LastUpdateCheck,
AvailableVersion: ext.AvailableVersion,
InstallDate: ext.InstallDate,
LastEnabled: ext.LastEnabled,
UsageCount: ext.UsageCount,
ErrorCount: ext.ErrorCount,
LoadTime: ext.LoadTime,
Metadata: metadata,
CreatedAt: ext.CreatedAt,
UpdatedAt: ext.UpdatedAt,
CreatedAt: ext.CreatedAt.Unix(),
UpdatedAt: ext.UpdatedAt.Unix(),
}
}