mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 19:39:31 +08:00
Phase 3 Chunk 5-8: 完成 Host/VM 模块从内部项目到开源项目的迁移。 Repo 层: - biz/host/repo/host.go: HostRepo (16 个方法) - biz/host/repo/publichost.go: PublicHostRepo - biz/team/repo/host.go: TeamHostRepo Usecase 层: - biz/host/usecase/host.go: HostUsecase (VM 生命周期、终端、端口转发) - biz/host/usecase/publichost.go: PublicHostUsecase (加权轮询) - biz/team/usecase/host.go: TeamHostUsecase Handler 层: - biz/host/handler/v1/host.go: 主机/VM REST + WebSocket 终端接口 - biz/team/handler/http/v1/host.go: 团队主机 CRUD 接口 注册与 Bridge: - biz/host/register.go, biz/register.go, biz/team/register.go - bridge.go: WithTaskflow, WithPublicHost, WithPrivilegeChecker - pkg/register.go: VMExpireQueue 注册 可选注入(开源项目默认不启用,内部项目通过 BridgeOption 注入): - PublicHost: 公共主机逻辑 (PickHost/CountLimit/TTLLimit) - PrivilegeChecker: 特权用户绕过 VM 所有权检查 新增工具包: - domain/domain.go: IDReq[T], PrivilegeChecker 接口 - pkg/ws: WebSocket 管理器 (基于 coder/websocket) - pkg/random: 随机字符串生成 - config: TaskFlow, PublicHost 配置段
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package consts
|
|
|
|
type UserPlatform string
|
|
|
|
const (
|
|
UserPlatformBaizhi UserPlatform = "baizhi" // 百智云平台
|
|
UserPlatformGithub UserPlatform = "github"
|
|
UserPlatformGitLab UserPlatform = "gitlab"
|
|
UserPlatformGitea UserPlatform = "gitea"
|
|
UserPlatformGitee UserPlatform = "gitee"
|
|
)
|
|
|
|
type UserStatus string
|
|
|
|
const (
|
|
UserStatusActive UserStatus = "active"
|
|
UserStatusInactive UserStatus = "inactive"
|
|
)
|
|
|
|
type UserRole string
|
|
|
|
const (
|
|
UserRoleIndividual UserRole = "individual" // 个人用户
|
|
UserRoleEnterprise UserRole = "enterprise" // 企业用户
|
|
UserRoleSubAccount UserRole = "subaccount" // 企业子账户
|
|
UserRoleAdmin UserRole = "admin" // MonkeyCode-AI 管理员账号,用来配置公共资源. 如公共宿主机等
|
|
)
|
|
|
|
type DefaultConfigType string
|
|
|
|
const (
|
|
DefaultConfigTypeModel DefaultConfigType = "model"
|
|
DefaultConfigTypeImage DefaultConfigType = "image"
|
|
DefaultConfigTypeHost DefaultConfigType = "host"
|
|
UserRoleGitTask UserRole = "gittask" // 全自动 git 任务插入的用户
|
|
)
|