Skip to main content

parseConversationDefaultInputArgs

workflow.parseConversationDefaultInputArgs(args) parses the fixed --message, --images, --videos, and --files parameters written by the default conversation input. It does not read RunContext or replace the executor's createInput.

Conversation always uses the standard message input without an enable setting. Hosts serialize attachments according to conversation.attachments. Call this helper explicitly in createInput({ args }).

Signature​

workflow.parseConversationDefaultInputArgs(
args: string[],
): {
message: string;
images: FileReference[];
videos: FileReference[];
files: FileReference[];
}

parsing rules​

ParameterBehavior
--message <text>Reads the last occurrence of the value and executes trim(); returns an empty string if not passed.
--images <value>Each occurrence is parsed into one or more FileReference s and eventually merged into an array.
--videos <value>Each occurrence is parsed into one or more references and merged into the videos array.
--files <value>Each occurrence is parsed into one or more FileReference s and eventually merged into an array.
Missing valueThe flag is ignored.
Other parametersReserved for business code to parse, this helper does not process.

--images, --videos, and --files accept file reference JSON or local path strings using parseProjectFileReferences(), just like the file input node. Only projects with attachments.videos: true use --videos; existing projects with only files: true continue to serialize videos under --files.

executor Configuration​

export const executor = workflow.defineExecutor<Input, OutputPayload>({
projectType: "conversation",
workflow: conversationProject,
conversation: {
attachments: {
images: true,
videos: true,
files: true,
},
},
createInput({ args, conversationId }) {
const defaults = workflow.parseConversationDefaultInputArgs(args);
return {
conversationId,
message: defaults.message,
images: defaults.images,
videos: defaults.videos,
files: defaults.files,
};
},
});

with file input node​

The helper only resolves the parameter to FileReference[]. If you need to read the contents of the file, pass the reference to workflow.createFileInputNode():

const imageInputNode = workflow.createFileInputNode({
name: "images",
accept: ["image/png", "image/jpeg", "image/webp"],
multiple: true,
});

const images = await workflow.runNode(imageInputNode, input.images, context);
const imageParts = await Promise.all(images.map((file) => file.toLLMImagePart()));

Precautions​

SceneDescription
Multiple --messageReturns the last value suitable for the host to overwrite the previous draft with the next input.
Multiple attachments--images, --videos, and --files each merge all occurrences.
Enable default input boxYou still need to explicitly call the helper in createInput.
CLI Manual debuggingPass --message, --images, --videos, and --files to simulate the default input box.