启动项目逻辑

This commit is contained in:
2026-06-09 22:43:29 +08:00
parent d5a28b11a3
commit f4a7c770af
43 changed files with 3797 additions and 42 deletions
+18
View File
@@ -99,6 +99,15 @@ const (
CodeMcpTokenNameRequired Code = "mcp.token_name_required"
CodeMcpTokenExpiresRequired Code = "mcp.token_expires_required"
CodeMcpRateLimited Code = "mcp.rate_limited"
// Run 域(workspace run profiles)
CodeRunProfileNotFound Code = "run.profile_not_found"
CodeRunProfileSlugTaken Code = "run.profile_slug_taken"
CodeRunProfileAlreadyRunning Code = "run.profile_already_running"
CodeRunProfileNotRunning Code = "run.profile_not_running"
CodeRunProfileDisabled Code = "run.profile_disabled"
CodeRunSpawnFailed Code = "run.spawn_failed"
CodeRunCommandInvalid Code = "run.command_invalid"
)
// AppError is the application's structured error type. It carries a stable
@@ -239,6 +248,15 @@ func HTTPStatus(code Code) int {
return http.StatusBadRequest
case CodeMcpRateLimited:
return http.StatusTooManyRequests
case CodeRunProfileNotFound:
return http.StatusNotFound
case CodeRunProfileSlugTaken, CodeRunProfileAlreadyRunning,
CodeRunProfileNotRunning, CodeRunProfileDisabled:
return http.StatusConflict
case CodeRunCommandInvalid:
return http.StatusBadRequest
case CodeRunSpawnFailed:
return http.StatusBadGateway
default:
return http.StatusInternalServerError
}