Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled

Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11),
free to diverge. Tree copied sans upstream .git; upstream remote added for
future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19.
Preserves docs/ARCHITECTURE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
2026-07-05 09:36:54 +00:00
parent 3216769225
commit bedb527145
21108 changed files with 6010766 additions and 0 deletions

View File

@@ -0,0 +1,306 @@
// Minimax tests cover video generation provider plugin behavior.
import { expectExplicitVideoGenerationCapabilities } from "openclaw/plugin-sdk/provider-test-contracts";
import { beforeAll, describe, expect, it, vi } from "vitest";
import {
getMinimaxProviderHttpMocks,
installMinimaxProviderHttpMockCleanup,
loadMinimaxVideoGenerationProviderModule,
} from "./provider-http.test-helpers.js";
const {
resolveApiKeyForProviderMock,
postJsonRequestMock,
fetchWithTimeoutMock,
resolveProviderHttpRequestConfigMock,
} = getMinimaxProviderHttpMocks();
let buildMinimaxVideoGenerationProvider: Awaited<
ReturnType<typeof loadMinimaxVideoGenerationProviderModule>
>["buildMinimaxVideoGenerationProvider"];
let buildMinimaxPortalVideoGenerationProvider: Awaited<
ReturnType<typeof loadMinimaxVideoGenerationProviderModule>
>["buildMinimaxPortalVideoGenerationProvider"];
beforeAll(async () => {
({ buildMinimaxVideoGenerationProvider, buildMinimaxPortalVideoGenerationProvider } =
await loadMinimaxVideoGenerationProviderModule());
});
installMinimaxProviderHttpMockCleanup();
function expectMinimaxFetchCall(index: number, url: string) {
const call = fetchWithTimeoutMock.mock.calls[index];
if (!call) {
throw new Error(`expected MiniMax fetch call ${index + 1}`);
}
const [actualUrl, init, timeoutMs, fetchFn] = call;
expect(actualUrl).toBe(url);
expect(init?.method).toBe("GET");
expect(Number.isInteger(timeoutMs)).toBe(true);
expect(timeoutMs).toBeGreaterThan(0);
expect(fetchFn).toBe(fetch);
}
function mockCallArg(mock: { mock: { calls: unknown[][] } }, index = 0): Record<string, unknown> {
const call = mock.mock.calls[index];
if (!call) {
throw new Error(`expected mock call ${index}`);
}
return call[0] as Record<string, unknown>;
}
function streamedVideoResponse(bytes: string): Response {
return new Response(
new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode(bytes));
controller.close();
},
}),
{ headers: { "content-type": "video/mp4" } },
);
}
function jsonResponse(payload: unknown): Response {
return new Response(JSON.stringify(payload), {
headers: { "content-type": "application/json" },
});
}
function oversizedJsonResponse(): Response {
return new Response(
new ReadableStream({
pull(controller) {
controller.enqueue(new Uint8Array(1024 * 1024).fill(0x20));
},
cancel: vi.fn(),
}),
{ headers: { "content-type": "application/json" } },
);
}
describe("minimax video generation provider", () => {
it("declares explicit mode capabilities", () => {
const provider = buildMinimaxVideoGenerationProvider();
expectExplicitVideoGenerationCapabilities(provider);
expect(provider.capabilities.generate?.resolutions).toEqual(["768P", "1080P"]);
expect(provider.capabilities.imageToVideo?.resolutions).toEqual(["768P", "1080P"]);
});
it("creates a task, polls status, and downloads the generated video", async () => {
postJsonRequestMock.mockResolvedValue({
response: jsonResponse({
task_id: "task-123",
base_resp: { status_code: 0 },
}),
release: vi.fn(async () => {}),
});
fetchWithTimeoutMock
.mockResolvedValueOnce(
jsonResponse({
task_id: "task-123",
status: "Success",
video_url: "https://example.com/out.mp4",
file_id: "file-1",
base_resp: { status_code: 0 },
}),
)
.mockResolvedValueOnce({
headers: new Headers({ "content-type": "video/webm" }),
arrayBuffer: async () => Buffer.from("webm-bytes"),
});
const provider = buildMinimaxVideoGenerationProvider();
const result = await provider.generateVideo({
provider: "minimax",
model: "MiniMax-Hailuo-2.3",
prompt: "A fox sprints across snowy hills",
cfg: {},
durationSeconds: 5,
resolution: "720P",
});
const request = mockCallArg(postJsonRequestMock);
expect(request.url).toBe("https://api.minimax.io/v1/video_generation");
const body = request.body as Record<string, unknown>;
expect(body.duration).toBe(6);
expect(body.resolution).toBe("768P");
expect(result.videos).toHaveLength(1);
expect(result.videos[0]?.fileName).toBe("video-1.webm");
expect(result.metadata?.taskId).toBe("task-123");
expect(result.metadata?.fileId).toBe("file-1");
});
it("rejects generated video downloads that exceed the configured media cap", async () => {
postJsonRequestMock.mockResolvedValue({
response: jsonResponse({
task_id: "task-too-large",
base_resp: { status_code: 0 },
}),
release: vi.fn(async () => {}),
});
fetchWithTimeoutMock
.mockResolvedValueOnce(
jsonResponse({
task_id: "task-too-large",
status: "Success",
video_url: "https://example.com/too-large.mp4",
base_resp: { status_code: 0 },
}),
)
.mockResolvedValueOnce(streamedVideoResponse("too-large"));
const provider = buildMinimaxVideoGenerationProvider();
await expect(
provider.generateVideo({
provider: "minimax",
model: "MiniMax-Hailuo-2.3",
prompt: "short video",
cfg: { agents: { defaults: { mediaMaxMb: 0.000001 } } },
}),
).rejects.toThrow("MiniMax generated video download exceeds 1 bytes");
});
it("downloads via file_id when the status response omits video_url", async () => {
postJsonRequestMock.mockResolvedValue({
response: jsonResponse({
task_id: "task-456",
base_resp: { status_code: 0 },
}),
release: vi.fn(async () => {}),
});
fetchWithTimeoutMock
.mockResolvedValueOnce(
jsonResponse({
task_id: "task-456",
status: "Success",
file_id: "file-9",
base_resp: { status_code: 0 },
}),
)
.mockResolvedValueOnce(
jsonResponse({
file: {
file_id: "file-9",
filename: "output_aigc.mp4",
download_url: "https://example.com/download.mp4",
},
base_resp: { status_code: 0 },
}),
)
.mockResolvedValueOnce({
headers: new Headers({ "content-type": "video/mp4" }),
arrayBuffer: async () => Buffer.from("mp4-bytes"),
});
const provider = buildMinimaxVideoGenerationProvider();
const result = await provider.generateVideo({
provider: "minimax",
model: "MiniMax-Hailuo-2.3",
prompt: "A fox sprints across snowy hills",
cfg: {},
});
expectMinimaxFetchCall(1, "https://api.minimax.io/v1/files/retrieve?file_id=file-9");
expectMinimaxFetchCall(2, "https://example.com/download.mp4");
expect(result.videos).toHaveLength(1);
expect(result.metadata?.taskId).toBe("task-456");
expect(result.metadata?.fileId).toBe("file-9");
expect(result.metadata?.videoUrl).toBeUndefined();
});
it("rejects oversized file_id metadata JSON before downloading", async () => {
postJsonRequestMock.mockResolvedValue({
response: new Response(
JSON.stringify({
task_id: "task-metadata-too-large",
base_resp: { status_code: 0 },
}),
),
release: vi.fn(async () => {}),
});
fetchWithTimeoutMock
.mockResolvedValueOnce(
new Response(
JSON.stringify({
task_id: "task-metadata-too-large",
status: "Success",
file_id: "file-too-large",
base_resp: { status_code: 0 },
}),
),
)
.mockResolvedValueOnce(oversizedJsonResponse());
const provider = buildMinimaxVideoGenerationProvider();
await expect(
provider.generateVideo({
provider: "minimax",
model: "MiniMax-Hailuo-2.3",
prompt: "A fox sprints across snowy hills",
cfg: {},
}),
).rejects.toThrow("MiniMax generated video metadata: JSON response exceeds 16777216 bytes");
expectMinimaxFetchCall(1, "https://api.minimax.io/v1/files/retrieve?file_id=file-too-large");
expect(fetchWithTimeoutMock).toHaveBeenCalledTimes(2);
});
it("routes portal video generation through minimax-portal auth and HTTP config", async () => {
postJsonRequestMock.mockResolvedValue({
response: jsonResponse({
task_id: "task-portal",
base_resp: { status_code: 0 },
}),
release: vi.fn(async () => {}),
});
fetchWithTimeoutMock
.mockResolvedValueOnce(
jsonResponse({
task_id: "task-portal",
status: "Success",
video_url: "https://example.com/portal.mp4",
base_resp: { status_code: 0 },
}),
)
.mockResolvedValueOnce({
headers: new Headers({ "content-type": "video/mp4" }),
arrayBuffer: async () => Buffer.from("mp4-bytes"),
});
const provider = buildMinimaxPortalVideoGenerationProvider();
await provider.generateVideo({
provider: "minimax-portal",
model: "MiniMax-Hailuo-2.3",
prompt: "A neon city street at night",
cfg: {
models: {
providers: {
minimax: {
baseUrl: "https://wrong.example/anthropic",
models: [],
},
"minimax-portal": {
baseUrl: "https://api.minimaxi.com/anthropic",
models: [],
},
},
},
},
});
expect(mockCallArg(resolveApiKeyForProviderMock).provider).toBe("minimax-portal");
const httpConfigParams = mockCallArg(resolveProviderHttpRequestConfigMock);
expect(httpConfigParams.baseUrl).toBe("https://api.minimaxi.com");
expect(httpConfigParams.provider).toBe("minimax-portal");
expect(httpConfigParams.capability).toBe("video");
expect(httpConfigParams.transport).toBe("http");
expect(mockCallArg(postJsonRequestMock).url).toBe(
"https://api.minimaxi.com/v1/video_generation",
);
expectMinimaxFetchCall(
0,
"https://api.minimaxi.com/v1/query/video_generation?task_id=task-portal",
);
});
});