Add MiniMax H3 video generation actions - #251
Conversation
Summary by CodeRabbit
WalkthroughAdded MiniMax H3 video-generation support. The change defines multimodal text, image, video, and audio inputs, task filters, task outputs, and four provider actions. Handlers now create, query, list, and delete v2 video-generation tasks. Request normalization supports model options, callback URLs, pagination, filters, repeated task IDs, and URL encoding. Tests cover payloads, validation, routing, HTTP methods, and query construction. Sequence Diagram(s)sequenceDiagram
participant Caller
participant minimaxActionHandlers
participant MiniMaxAPI
Caller->>minimaxActionHandlers: Invoke H3 video action
minimaxActionHandlers->>MiniMaxAPI: Send normalized request
MiniMaxAPI-->>minimaxActionHandlers: Return task response
minimaxActionHandlers-->>Caller: Return validated output
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm-workspace.yaml`:
- Around line 1-3: Replace the placeholder string values under allowBuilds with
boolean true or false approvals for esbuild and workerd, using true where their
build scripts require approval and false otherwise.
In `@src/providers/minimax/actions.ts`:
- Around line 325-328: Constrain the filter.status schema in
src/providers/minimax/actions.ts at lines 325-328 to an optional string enum
containing only queued, running, succeeded, failed, cancelled, and expired,
replacing optionalTrimmedString. Update the test state and serialized query in
src/providers/minimax/executors.test.ts at line 70 from Success to succeeded.
- Around line 250-263: The MiniMax H3 media content schema and tests use string
URLs instead of the required nested media URL objects. In
src/providers/minimax/actions.ts lines 250-263, update the image_url, audio_url,
and video_url fields to required { url: s.string(...) } objects and restrict
each field to its valid content roles; in
src/providers/minimax/executors.test.ts lines 30-34, pass nested { url: "..." }
values for image and audio rows and assert the resulting request payload.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 59ca00dd-be4a-44fc-bfc0-f308ab80d3ac
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
pnpm-workspace.yamlsrc/providers/minimax/actions.tssrc/providers/minimax/executors.test.tssrc/providers/minimax/executors.ts
| allowBuilds: | ||
| esbuild: set this to true or false | ||
| workerd: set this to true or false |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
for package in esbuild workerd; do
value="$(awk -F': ' -v package="$package" \
'$1 == " " package { print $2; exit }' pnpm-workspace.yaml)"
case "$value" in
true|false) ;;
*)
echo "$package must map to true or false; found: $value" >&2
exit 1
;;
esac
doneRepository: oomol-lab/open-connector
Length of output: 230
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '--- pnpm-workspace.yaml ---\n'
cat -n pnpm-workspace.yaml
printf '\n--- package references ---\n'
rg -n '"?esbuild"?|"?workerd"?' package.json pnpm-lock.yaml . 2>/dev/null | head -80Repository: oomol-lab/open-connector
Length of output: 253
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- pnpm-workspace.yaml ---'
cat -n pnpm-workspace.yaml
echo
echo '--- package references ---'
rg -n '"?esbuild"?|"?workerd"?' package.json pnpm-lock.yaml . 2>/dev/null | head -80 || trueRepository: oomol-lab/open-connector
Length of output: 4804
🌐 Web query:
pnpm allowBuilds setting boolean values documentation
💡 Result:
In pnpm, the allowBuilds setting is a configuration map used to explicitly allow or disallow the execution of lifecycle scripts (such as postinstall) for specific dependencies [1][2]. This setting replaces legacy build-related options like onlyBuiltDependencies and ignoredBuiltDependencies [1][2]. The allowBuilds setting uses a record-based structure where the keys are package name patterns and the values are booleans (or sometimes string patterns for more complex matching) [2][3][4]. Usage details: - Boolean Values: Setting a package to true explicitly allows its scripts to run, while setting it to false explicitly disallows them [2]. - Default Behavior: Packages not explicitly listed in allowBuilds are disallowed by default, and pnpm will print a warning [2]. If the setting strictDepBuilds is enabled, pnpm will throw an error instead [2]. - Configuration File: This setting is configured in your project's pnpm-workspace.yaml file or the global config.yaml file [5][1][6]. - Management via CLI: You can manage these settings interactively or explicitly using the pnpm approve-builds command, which automatically updates the allowBuilds map in your pnpm-workspace.yaml [7]. You can also interact with this setting via pnpm config set --json allowBuilds '{"package-name": true}' [8]. Example configuration in pnpm-workspace.yaml: allowBuilds: esbuild: true core-js: false "some-package@*": true By using allowBuilds, you ensure that only trusted dependencies run scripts during installation, which is a key security practice to mitigate supply chain attacks [9].
Citations:
- 1: https://pnpm.io/blog/releases/11.0
- 2: https://pnpm.io/10.x/settings
- 3: https://github.com/pnpm/pnpm/blob/2b14c742/config/config/src/Config.ts
- 4: feat: create a new field for allowing/disallowing builds pnpm/pnpm#10311
- 5: https://pnpm.io/settings
- 6: https://pnpm.io/configuring
- 7: https://pnpm.io/cli/approve-builds
- 8: https://pnpm.io/cli/config
- 9: https://pnpm.io/supply-chain-security
🌐 Web query:
pnpm 11.0 settings allowBuilds false string value
💡 Result:
In pnpm 11.0, the allowBuilds setting is a map used to control which dependencies are permitted to execute build scripts (such as postinstall) [1][2]. This setting replaces legacy configurations like onlyBuiltDependencies, neverBuiltDependencies, and ignoredBuiltDependencies [1][3]. The map uses package name patterns as keys and boolean values to dictate behavior [2][4]: - true: The package is permitted to run build scripts [2]. - false: The package is explicitly denied from running build scripts [2]. While some internal type definitions may account for string values (as noted in early development PRs), the official documentation and usage patterns strictly emphasize boolean values (true or false) to enable or disable builds for specific dependencies [1][2][4]. If a package has build scripts and is not listed in allowBuilds, pnpm will print an error by default (due to the strictDepBuilds setting defaulting to true) [2][4]. You can manage this setting in your pnpm-workspace.yaml file or via the CLI [5][6][7]. For example: allowBuilds: electron: true core-js: false esbuild: false If you attempt to use a string value in the configuration, it is not standard usage and will not be treated as a functional toggle for allowing or disallowing builds [2][4].
Citations:
- 1: https://pnpm.io/blog/releases/11.0
- 2: https://github.com/pnpm/pnpm/releases/tag/v11.0.0
- 3: https://pnpm.io/migration
- 4: https://github.com/pnpm/pnpm.io/blob/048c97bed74ea6696318086620ebd819df435a0b/docs/settings.md
- 5: https://pnpm.io/settings
- 6: https://pnpm.io/cli/approve-builds
- 7: https://pnpm.io/cli/config
🌐 Web query:
pnpm 9 allowBuilds boolean values
💡 Result:
In pnpm, the allowBuilds configuration field is a map used to control which dependencies are permitted to execute build scripts (such as postinstall) [1][2]. It accepts boolean values to explicitly allow or disallow these builds [2][3]. Key details regarding allowBuilds: - Structure: It is a map where keys are package matchers (package names or patterns) and values are booleans [2][3]. - Boolean Usage: Setting a package to true allows its build scripts to run, while setting it to false prevents them [1][2]. - Default Behavior: Dependencies not listed in allowBuilds are disallowed by default [2][3]. Depending on the strictDepBuilds setting, pnpm will either print a warning or throw an error when an unlisted package attempts to build [2][3]. - Integration: This field was introduced in pnpm v10.26.0 as a unified replacement for legacy settings like onlyBuiltDependencies, neverBuiltDependencies, and ignoredBuiltDependencies [4][2][3]. In pnpm v11, these legacy settings were removed entirely [4][3]. - Configuration: You can manage this setting in your pnpm-workspace.yaml file or via the pnpm approve-builds command, which automatically populates the allowBuilds map [5][1][3]. You can also interact with it using pnpm config commands [6].
Citations:
- 1: https://pnpm.io/cli/approve-builds
- 2: https://pnpm.io/10.x/settings
- 3: https://github.com/pnpm/pnpm.io/blob/048c97bed74ea6696318086620ebd819df435a0b/docs/settings.md
- 4: https://pnpm.io/blog/releases/11.0
- 5: https://pnpm.io/settings
- 6: https://pnpm.io/cli/config
Replace the placeholder strings with boolean approvals.
pnpm-workspace.yaml declares esbuild and workerd as string values. allowBuilds entries must be true or false, or packages with build scripts will be treated as unapproved. If these dependencies need build approval, use boolean values.
Proposed fix
allowBuilds:
- esbuild: set this to true or false
- workerd: set this to true or false
+ esbuild: true
+ workerd: true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| allowBuilds: | |
| esbuild: set this to true or false | |
| workerd: set this to true or false | |
| allowBuilds: | |
| esbuild: true | |
| workerd: true |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pnpm-workspace.yaml` around lines 1 - 3, Replace the placeholder string
values under allowBuilds with boolean true or false approvals for esbuild and
workerd, using true where their build scripts require approval and false
otherwise.
f0afb10 to
a6d6cea
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/providers/minimax/executors.test.ts`:
- Around line 63-104: Update normalizeMinimaxVideoV2Body to validate every
content image_url and audio_url URL with assertPublicHttpUrl before
minimaxPostJson, rejecting loopback and private addresses. Extend the existing
create_video_generation_v2 tests to cover blocked private-media URLs and verify
the fetcher is not called.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 640830e2-171f-4cc8-bfeb-d68dd49ae229
📒 Files selected for processing (2)
src/providers/minimax/actions.tssrc/providers/minimax/executors.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/providers/minimax/actions.ts
| it("validates the v2 media shape and required text prompt", () => { | ||
| const action = minimaxActions.find((action) => action.id === "minimax.create_video_generation_v2")!; | ||
| const input = { | ||
| model: "MiniMax-H3", | ||
| content: [ | ||
| { type: "text", text: "city skyline" }, | ||
| { type: "image_url", image_url: { url: "https://example.com/frame.png" }, role: "first_frame" }, | ||
| ], | ||
| resolution: "768P", | ||
| duration: 5, | ||
| }; | ||
|
|
||
| expect(validateActionInput(action, input).valid).toBe(true); | ||
| expect( | ||
| validateActionInput(action, { | ||
| ...input, | ||
| content: [{ type: "image_url", image_url: { url: "https://example.com/frame.png" } }], | ||
| }).valid, | ||
| ).toBe(false); | ||
| expect( | ||
| validateActionInput(action, { | ||
| ...input, | ||
| content: [ | ||
| { type: "text", text: "city skyline" }, | ||
| { type: "video_url", video_url: "https://example.com/ref.mp4", role: "reference_video" }, | ||
| ], | ||
| }).valid, | ||
| ).toBe(false); | ||
| expect( | ||
| validateActionInput(action, { | ||
| ...input, | ||
| content: [ | ||
| { type: "text", text: "city skyline" }, | ||
| { | ||
| type: "image_url", | ||
| image_url: { url: "https://example.com/frame.png" }, | ||
| role: "reference_video", | ||
| }, | ||
| ], | ||
| }).valid, | ||
| ).toBe(false); | ||
| }); |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the provider executor before inspecting URL validation and egress calls.
ast-grep outline src/providers/minimax/executors.ts --items all
# Expect public-only validation for content media URLs before the provider request.
rg -n -C 5 'assertPublicHttpUrl|providerFetch|context\.fetcher|image_url|video_url|audio_url' \
src/providers/minimax/executors.ts \
src/providers/minimax/executors.test.tsRepository: oomol-lab/open-connector
Length of output: 10001
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "## executors.ts relevant sections"
sed -n '1,320p' src/providers/minimax/executors.ts | cat -n
echo
echo "## tests around create_video_generation_v2 and mocks"
sed -n '1,150p' src/providers/minimax/executors.test.ts | cat -n
echo
echo "## shared public URL implementation usages"
rg -n 'export function assertPublicHttpUrl|function assertPublicHttpUrl|assertPublicHttpUrl' src -g '*.ts'
echo
echo "## search private-network validation in provider code"
rg -n 'assertPublicHttpUrl|isBlockedIpAddress|allowPrivateNetwork|skipDnsValidation' src/providers -g '*.ts'Repository: oomol-lab/open-connector
Length of output: 50381
Reject private-media URLs in the MiniMax video executor.
create_video_generation_v2 does not validate content[*].image_url.audio_*/*_url with assertPublicHttpUrl; it only sends the body. Add executor-side validation for image_url/audio_url in normalizeMinimaxVideoV2Body before minimaxPostJson, and add tests that block loopback/private URLs without calling the fetcher.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/providers/minimax/executors.test.ts` around lines 63 - 104, Update
normalizeMinimaxVideoV2Body to validate every content image_url and audio_url
URL with assertPublicHttpUrl before minimaxPostJson, rejecting loopback and
private addresses. Extend the existing create_video_generation_v2 tests to cover
blocked private-media URLs and verify the fetcher is not called.
Source: Coding guidelines
Reason: MiniMax video generation now exposes H3 v2 task creation and management parameters.
Changes:
Checks: