-
Notifications
You must be signed in to change notification settings - Fork 89
feat: Movie Render Queue (MRQ) handler — 11 actions #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
REMvisual
wants to merge
5
commits into
ChiR24:main
Choose a base branch
from
REMvisual:feat/mrq-handler
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
201fe91
feat: add Movie Render Queue (MRQ) handler with 11 actions
REMvisual d941fec
fix: address code review — null checks, path sanitization, command va…
REMvisual 27cf089
fix: guard write handlers against null payload and missing jobIndex
REMvisual 6687cea
fix: add __has_include guard for UE 5.0-5.1 MasterConfig header
REMvisual 5f4fd43
fix: remove stale save_preset from header comment
REMvisual File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
770 changes: 770 additions & 0 deletions
770
...cpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_MrqHandlers.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| import { cleanObject } from '../../utils/safe-json.js'; | ||
| import { ITools } from '../../types/tool-interfaces.js'; | ||
| import { executeAutomationRequest, requireAction } from './common-handlers.js'; | ||
| import { CommandValidator } from '../../utils/command-validator.js'; | ||
|
|
||
| /** | ||
| * Normalize asset path fields to canonical /Game/... form. | ||
| */ | ||
| function normalizePathFields(args: Record<string, unknown>, fields: string[]): Record<string, unknown> { | ||
| const result = { ...args }; | ||
| for (const field of fields) { | ||
| const value = result[field]; | ||
| if (typeof value === 'string' && value.length > 0) { | ||
| let normalized = value.replace(/\\/g, '/'); | ||
| if (normalized.startsWith('/Content/')) { | ||
| normalized = '/Game/' + normalized.slice('/Content/'.length); | ||
| } | ||
| if (!normalized.startsWith('/')) { | ||
| normalized = '/Game/' + normalized; | ||
| } | ||
| result[field] = normalized; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| /** | ||
| * Validate an array of console commands using the existing safety filter. | ||
| */ | ||
| function validateCommands(commands: unknown): string[] | undefined { | ||
| if (!Array.isArray(commands)) return undefined; | ||
| const validated: string[] = []; | ||
| for (const cmd of commands) { | ||
| if (typeof cmd === 'string') { | ||
| CommandValidator.validate(cmd); // throws on dangerous commands | ||
| validated.push(cmd); | ||
| } | ||
| } | ||
| return validated; | ||
| } | ||
|
|
||
| export async function handleMrqTools( | ||
| _action: string, | ||
| args: Record<string, unknown>, | ||
| tools: ITools | ||
| ): Promise<Record<string, unknown>> { | ||
| const mrqAction = requireAction(args); | ||
|
|
||
| switch (mrqAction) { | ||
| case 'get_queue': | ||
| case 'get_job_config': | ||
| case 'get_cvars': | ||
| case 'get_output_settings': | ||
| case 'get_render_status': | ||
| case 'delete_job': | ||
| case 'render': { | ||
| const res = await executeAutomationRequest( | ||
| tools, | ||
| 'manage_mrq', | ||
| { ...args, action: mrqAction }, | ||
| 'MRQ automation bridge not available — ensure Movie Render Queue plugin is enabled' | ||
| ); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| return cleanObject(res) as Record<string, unknown>; | ||
| } | ||
|
|
||
| case 'create_job': | ||
| case 'load_preset': { | ||
| // Normalize asset paths to canonical /Game/... form | ||
| const normalized = normalizePathFields(args, ['map', 'sequence', 'presetPath']); | ||
| const res = await executeAutomationRequest( | ||
| tools, | ||
| 'manage_mrq', | ||
| { ...normalized, action: mrqAction }, | ||
| 'MRQ automation bridge not available — ensure Movie Render Queue plugin is enabled' | ||
| ); | ||
| return cleanObject(res) as Record<string, unknown>; | ||
| } | ||
|
|
||
| case 'set_cvars': { | ||
| const payload: Record<string, unknown> = { ...args, action: mrqAction }; | ||
| if (args.cvars && typeof args.cvars === 'object' && !payload.set) { | ||
| payload.set = args.cvars; | ||
| } | ||
| // Validate start/end console commands through safety filter | ||
| if (payload.startCommands) { | ||
| payload.startCommands = validateCommands(payload.startCommands); | ||
| } | ||
| if (payload.endCommands) { | ||
| payload.endCommands = validateCommands(payload.endCommands); | ||
| } | ||
| const res = await executeAutomationRequest( | ||
| tools, | ||
| 'manage_mrq', | ||
| payload, | ||
| 'MRQ automation bridge not available' | ||
| ); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| return cleanObject(res) as Record<string, unknown>; | ||
| } | ||
|
|
||
| case 'set_output_settings': { | ||
| const res = await executeAutomationRequest( | ||
| tools, | ||
| 'manage_mrq', | ||
| { ...args, action: mrqAction }, | ||
| 'MRQ automation bridge not available' | ||
| ); | ||
| return cleanObject(res) as Record<string, unknown>; | ||
| } | ||
|
|
||
| default: | ||
| return { | ||
| success: false, | ||
| error: 'UNKNOWN_ACTION', | ||
| message: `Unknown MRQ action: ${mrqAction}. Available: get_queue, get_job_config, get_cvars, set_cvars, get_output_settings, set_output_settings, create_job, delete_job, render, get_render_status, load_preset` | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.