feat: support custom server deployment drafts

This commit is contained in:
npc0-hue
2026-07-24 16:56:28 +08:00
parent 292b380f3c
commit 220ef91a8e
36 changed files with 1520 additions and 85 deletions
+14
View File
@@ -88,6 +88,8 @@ import type {
ServerLifecycleCommandRequest,
ServerLifecycleCreateRequest,
ServerLifecycleResponse,
ServerDeploymentRequest,
ServerDeploymentResponse,
ServerConfigWriteApprovalRequest,
ServerConfigWriteDispatchResponse,
SourceRCONCommandRequest,
@@ -185,6 +187,18 @@ export class PlatformApiClient {
});
}
async getServerDeployment(id: string): Promise<ServerDeploymentResponse> {
return this.request<ServerDeploymentResponse>(`/server-instances/${encodeURIComponent(id)}/deployment`);
}
async updateServerDeployment(id: string, request: ServerDeploymentRequest): Promise<ServerDeploymentResponse> {
return this.request<ServerDeploymentResponse>(`/server-instances/${encodeURIComponent(id)}/deployment`, { method: "PUT", body: request });
}
async deployServerInstance(id: string, request: ServerLifecycleCommandRequest): Promise<ServerLifecycleResponse> {
return this.request<ServerLifecycleResponse>(`/server-instances/${encodeURIComponent(id)}/deploy`, { method: "POST", body: request });
}
async getServerRuntimeBinding(id: string): Promise<RuntimeBindingResponse> {
return this.request<RuntimeBindingResponse>(`/server-instances/${encodeURIComponent(id)}/runtime-binding`);
}
+54 -3
View File
@@ -342,6 +342,7 @@ export interface GamePluginResponse {
supportedOs?: string[];
manifestRef: string;
createFormSchemaRef: string;
createFields?: PluginCreateFieldResponse[];
requiredRunCapabilities: string[];
declaredPermissions: string[];
permissions: PluginPermissionsResponse;
@@ -357,6 +358,18 @@ export interface GamePluginResponse {
status: GamePluginStatus;
}
export type PluginCreateFieldType = "text" | "number" | "boolean" | "select" | "port";
export interface PluginCreateFieldResponse {
key: string;
label: string;
type: PluginCreateFieldType;
required?: boolean;
defaultValue?: string;
options?: string[];
configKey?: string;
}
export interface GamePluginListResponse {
items: GamePluginResponse[];
count: number;
@@ -439,11 +452,48 @@ export interface ServerInstanceListResponse {
export interface ServerLifecycleCreateRequest {
id: string;
pluginId: string;
runEndpointId: string;
runEndpointId?: string;
name: string;
idempotencyKey: string;
profileKey: string;
bindings: Record<string, string>;
profileKey?: string;
bindings?: Record<string, string>;
deployment?: ServerDeploymentRequest;
}
export type ServerDeploymentMode = "guided-install" | "existing-server" | "custom-command";
export type ServerCommandShell = "" | "posix-sh" | "powershell" | "cmd";
// This request is write-only for paths and commands. The matching response
// intentionally returns configured flags rather than those values.
export interface ServerDeploymentRequest {
runEndpointId?: string;
mode: ServerDeploymentMode;
profileKey?: string;
runtimeBindings?: Record<string, string>;
createInputs?: Record<string, string>;
serverRoot?: string;
workingDirectory?: string;
installCommand?: string;
startCommand?: string;
stopCommand?: string;
statusCommand?: string;
shell?: ServerCommandShell;
}
export interface ServerDeploymentResponse {
serverInstanceId: string;
mode?: ServerDeploymentMode;
profileKey?: string;
createInputs?: Record<string, string>;
serverRootConfigured: boolean;
workingDirectoryConfigured: boolean;
installCommandConfigured: boolean;
startCommandConfigured: boolean;
stopCommandConfigured: boolean;
statusCommandConfigured: boolean;
shell?: ServerCommandShell;
revision: number;
updatedAt?: string;
}
export interface RuntimeBindingUpdateRequest {
@@ -531,6 +581,7 @@ export interface RunEndpointListResponse {
export interface JobProgressBody {
percent: number;
phase?: "queued" | "claimed" | "preflight" | "install" | "configure" | "start" | "health";
message?: string;
}