Integrate SCUM real ops workflows

This commit is contained in:
npc0-hue
2026-08-10 21:12:53 +08:00
parent 1063330710
commit a770bc6250
88 changed files with 6375 additions and 2719 deletions
+19 -27
View File
@@ -2,8 +2,6 @@ import { describe, expect, it } from "vitest";
import { configDiffViewFromPreview } from "./ServerDetailPage";
import serverDetailPageSource from "./ServerDetailPage.tsx?raw";
import sourceRCONCommandPanelSource from "../components/SourceRCONCommandPanel.tsx?raw";
import artifactTransferSource from "../utils/artifactTransfer.ts?raw";
import type { ServerConfigDiffPreviewResponse } from "../api/types";
const preview: ServerConfigDiffPreviewResponse = {
@@ -41,9 +39,11 @@ describe("ServerDetailPage config write approval", () => {
]);
});
it("uses config preview and approval APIs instead of generic config.write job creation", () => {
expect(serverDetailPageSource).toContain("previewServerConfigDiff");
expect(serverDetailPageSource).toContain("approveServerConfigWrite");
it("uses AI config diff approval without exposing raw config workbench APIs", () => {
expect(serverDetailPageSource).toContain("approveAIConfigDiff");
expect(serverDetailPageSource).toContain("AI 配置助手");
expect(serverDetailPageSource).not.toContain("previewServerConfigDiff");
expect(serverDetailPageSource).not.toContain("approveServerConfigWrite");
expect(serverDetailPageSource).not.toContain('capability: "config.write"');
});
@@ -62,10 +62,10 @@ describe("ServerDetailPage config write approval", () => {
expect(serverDetailPageSource).not.toContain("content: diff.nextContent");
});
it("uses platform-mediated artifact download and bridge references without backend internals", () => {
expect(serverDetailPageSource).toContain("openArtifactDownload");
expect(serverDetailPageSource).toContain("readArtifactContent");
expect(serverDetailPageSource).toContain("浏览器制品传输");
it("keeps artifact transfer and backend internals out of server detail", () => {
expect(serverDetailPageSource).not.toContain("openArtifactDownload");
expect(serverDetailPageSource).not.toContain("readArtifactContent");
expect(serverDetailPageSource).not.toContain("浏览器制品传输");
expect(serverDetailPageSource).not.toContain("storage://");
expect(serverDetailPageSource).not.toContain("unix://");
expect(serverDetailPageSource).not.toContain("Bearer ");
@@ -79,7 +79,7 @@ describe("ServerDetailPage config write approval", () => {
expect(serverDetailPageSource).not.toContain("pushRunUpdate");
expect(serverDetailPageSource).not.toContain("generateClientManager");
expect(serverDetailPageSource).not.toContain("ClientManagerLifecyclePanel");
expect(serverDetailPageSource).toContain("openServerLogEvents");
expect(serverDetailPageSource).not.toContain("openServerLogEvents");
expect(serverDetailPageSource).not.toContain("authKey");
expect(serverDetailPageSource).not.toContain("password=");
expect(serverDetailPageSource).not.toContain("unix://");
@@ -95,17 +95,12 @@ describe("ServerDetailPage config write approval", () => {
expect(serverDetailPageSource).not.toContain("RuntimeDLLExtensionsPanel");
});
it("adds SCUM announcements and raw commands through protected RCON bridge jobs", () => {
expect(serverDetailPageSource).toContain("SourceRCONCommandPanel");
expect(sourceRCONCommandPanelSource).toContain("queueGameClientBridgeCommand");
expect(sourceRCONCommandPanelSource).toContain("scumManagementRCONCommandRequest");
expect(sourceRCONCommandPanelSource).toContain("不保留指令原文");
expect(sourceRCONCommandPanelSource).toContain("执行结果以 Run 日志为准");
expect(sourceRCONCommandPanelSource).not.toContain("ConfirmDialog");
expect(sourceRCONCommandPanelSource).not.toContain("operations.");
for (const forbidden of ["password", "host", "transcript", "history"]) {
expect(sourceRCONCommandPanelSource).not.toContain(forbidden);
}
it("does not expose raw SCUM RCON command panels", () => {
expect(serverDetailPageSource).not.toContain("SourceRCONCommandPanel");
expect(serverDetailPageSource).not.toContain("queueGameClientBridgeCommand");
expect(serverDetailPageSource).not.toContain("scumManagementRCONCommandRequest");
expect(serverDetailPageSource).not.toContain("管理终端");
expect(serverDetailPageSource).toContain("PluginPageHostPage");
});
it("removes generic plugin controls from server detail", () => {
@@ -136,12 +131,9 @@ describe("ServerDetailPage config write approval", () => {
expect(serverDetailPageSource).not.toContain("ScumFileManagementSection");
});
it("keeps plugin lifecycle and bridge-visible output on platform-owned logical references", () => {
expect(serverDetailPageSource).toContain("platformApiClient.openArtifactDownload(artifact.id)");
expect(serverDetailPageSource).toContain("downloadArtifactReference(reference");
expect(artifactTransferSource).toContain("readContent(reference.artifactId");
expect(artifactTransferSource).toContain("replace(/Bearer\\s+[^\\s]+/gi, \"[token]\")");
expect(artifactTransferSource).toContain("replace(/sk-[A-Za-z0-9_-]+/g, \"[secret]\")");
it("keeps plugin lifecycle output out of raw bridge-visible detail surfaces", () => {
expect(serverDetailPageSource).not.toContain("platformApiClient.openArtifactDownload(artifact.id)");
expect(serverDetailPageSource).not.toContain("downloadArtifactReference(reference");
expect(serverDetailPageSource).not.toContain("storage://bucket");
expect(serverDetailPageSource).not.toContain("runSocket");
expect(serverDetailPageSource).not.toContain("rawApiKey");