@mindstudio-ai/agent 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -682,8 +682,8 @@ var init_metadata = __esm({
682
682
  "postToX": {
683
683
  stepType: "postToX",
684
684
  description: "Create a post on X (Twitter) from the connected account.",
685
- usageNotes: "- Requires an X OAuth connection (connectionId).\n- Posts are plain text. Maximum 280 characters.",
686
- inputSchema: { "type": "object", "properties": { "text": { "type": "string", "description": "The text content of the post (max 280 characters)" }, "connectionId": { "type": "string", "description": "X (Twitter) OAuth connection ID" } }, "required": ["text"] },
685
+ usageNotes: "- Requires an X OAuth connection (connectionId).\n- Maximum 280 characters of text.\n- Optionally attach up to 4 media items (images, GIFs, or videos) via mediaUrls.\n- Media URLs must be publicly accessible. The service fetches and uploads them to X.\n- Supported formats: JPEG, PNG, GIF, WEBP, MP4. Images up to 5MB, videos up to 512MB.",
686
+ inputSchema: { "type": "object", "properties": { "text": { "type": "string", "description": "The text content of the post (max 280 characters)" }, "connectionId": { "type": "string", "description": "X (Twitter) OAuth connection ID" }, "mediaUrls": { "type": "array", "items": { "type": "string" }, "description": "Up to 4 URLs of images, GIFs, or videos to attach to the post" } }, "required": ["text"] },
687
687
  outputSchema: { "description": "This step does not produce output data." }
688
688
  },
689
689
  "postToZapier": {
@@ -1907,6 +1907,69 @@ var init_client = __esm({
1907
1907
  $billingEvents: billingEvents != null ? JSON.parse(billingEvents) : void 0
1908
1908
  };
1909
1909
  }
1910
+ /**
1911
+ * Execute multiple steps in parallel in a single request.
1912
+ *
1913
+ * All steps run in parallel on the server. Results are returned in the same
1914
+ * order as the input. Individual step failures do not affect other steps —
1915
+ * partial success is possible.
1916
+ *
1917
+ * ```ts
1918
+ * const { results } = await agent.executeStepBatch([
1919
+ * { stepType: 'generateImage', step: { prompt: 'a sunset' } },
1920
+ * { stepType: 'textToSpeech', step: { text: 'Hello world' } },
1921
+ * ]);
1922
+ * ```
1923
+ */
1924
+ async executeStepBatch(steps, options) {
1925
+ const threadId = options?.threadId ?? (this._reuseThreadId ? this._threadId : void 0);
1926
+ const { data } = await request(this._httpConfig, "POST", "/steps/execute-batch", {
1927
+ steps,
1928
+ ...options?.appId != null && { appId: options.appId },
1929
+ ...threadId != null && { threadId }
1930
+ });
1931
+ const results = await Promise.all(
1932
+ data.results.map(async (r) => {
1933
+ if (r.output != null) {
1934
+ return {
1935
+ stepType: r.stepType,
1936
+ output: r.output,
1937
+ billingCost: r.billingCost,
1938
+ error: r.error
1939
+ };
1940
+ }
1941
+ if (r.outputUrl) {
1942
+ const res = await fetch(r.outputUrl);
1943
+ if (!res.ok) {
1944
+ return {
1945
+ stepType: r.stepType,
1946
+ error: `Failed to fetch output from S3: ${res.status} ${res.statusText}`
1947
+ };
1948
+ }
1949
+ const envelope = await res.json();
1950
+ return {
1951
+ stepType: r.stepType,
1952
+ output: envelope.value,
1953
+ billingCost: r.billingCost
1954
+ };
1955
+ }
1956
+ return {
1957
+ stepType: r.stepType,
1958
+ billingCost: r.billingCost,
1959
+ error: r.error
1960
+ };
1961
+ })
1962
+ );
1963
+ if (this._reuseThreadId && data.threadId) {
1964
+ this._threadId = data.threadId;
1965
+ }
1966
+ return {
1967
+ results,
1968
+ totalBillingCost: data.totalBillingCost,
1969
+ appId: data.appId,
1970
+ threadId: data.threadId
1971
+ };
1972
+ }
1910
1973
  /**
1911
1974
  * Get the authenticated user's identity and organization info.
1912
1975
  *
@@ -2211,7 +2274,7 @@ async function startMcpServer(options) {
2211
2274
  capabilities: { tools: {} },
2212
2275
  serverInfo: {
2213
2276
  name: "mindstudio-agent",
2214
- version: "0.1.5"
2277
+ version: "0.1.7"
2215
2278
  },
2216
2279
  instructions: "Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `listAgents` to verify your connection and see available agents.\n2. Call `changeName` to set your display name \u2014 use your name or whatever your user calls you. This is how you'll appear in MindStudio request logs.\n3. If you have a profile picture or icon, call `uploadFile` to upload it, then `changeProfilePicture` with the returned URL. This helps users identify your requests in their logs.\n4. Call `listActions` to discover all available actions.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more.\n\nImportant:\n- AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateActionCost` and confirm with the user before proceeding \u2014 unless they've explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run."
2217
2280
  });
@@ -2264,8 +2327,11 @@ async function startMcpServer(options) {
2264
2327
  } else if (toolName === "listConnections") {
2265
2328
  result = await getAgent().listConnections();
2266
2329
  } else if (toolName === "estimateActionCost") {
2330
+ const meta = await getMetadata();
2331
+ const rawType = args.stepType;
2332
+ const resolved = meta[rawType]?.stepType ?? rawType;
2267
2333
  result = await getAgent().estimateStepCost(
2268
- args.stepType,
2334
+ resolved,
2269
2335
  args.step,
2270
2336
  {
2271
2337
  appId: args.appId,
@@ -2292,6 +2358,10 @@ async function startMcpServer(options) {
2292
2358
  extension: ext,
2293
2359
  ...mimeType && { type: mimeType }
2294
2360
  });
2361
+ } else if (toolName === "executeBatch") {
2362
+ result = await getAgent().executeStepBatch(
2363
+ args.steps
2364
+ );
2295
2365
  } else if (toolName === "listAgents") {
2296
2366
  result = await getAgent().listAgents();
2297
2367
  } else if (toolName === "runAgent") {
@@ -2382,7 +2452,8 @@ var init_mcp = __esm({
2382
2452
  changeProfilePicture: "Update the profile picture of the authenticated agent.",
2383
2453
  uploadFile: "Upload a file to the MindStudio CDN.",
2384
2454
  listAgents: "List all pre-built agents in the organization.",
2385
- runAgent: "Run a pre-built agent and wait for the result."
2455
+ runAgent: "Run a pre-built agent and wait for the result.",
2456
+ executeBatch: "Execute multiple actions in parallel in a single request."
2386
2457
  };
2387
2458
  HELPER_TOOLS = [
2388
2459
  {
@@ -2550,6 +2621,37 @@ var init_mcp = __esm({
2550
2621
  required: ["filePath"]
2551
2622
  }
2552
2623
  },
2624
+ {
2625
+ name: "executeBatch",
2626
+ description: "Execute multiple actions in parallel in a single request. All steps run in parallel on the server. Results are returned in the same order as the input. Individual step failures do not affect other steps \u2014 partial success is possible. Maximum 50 steps per batch.",
2627
+ inputSchema: {
2628
+ type: "object",
2629
+ properties: {
2630
+ steps: {
2631
+ type: "array",
2632
+ description: "Array of steps to execute.",
2633
+ minItems: 1,
2634
+ maxItems: 50,
2635
+ items: {
2636
+ type: "object",
2637
+ properties: {
2638
+ stepType: {
2639
+ type: "string",
2640
+ description: 'The action type name (e.g. "generateImage", "textToSpeech").'
2641
+ },
2642
+ step: {
2643
+ type: "object",
2644
+ description: "Action input parameters.",
2645
+ additionalProperties: true
2646
+ }
2647
+ },
2648
+ required: ["stepType", "step"]
2649
+ }
2650
+ }
2651
+ },
2652
+ required: ["steps"]
2653
+ }
2654
+ },
2553
2655
  {
2554
2656
  name: "listAgents",
2555
2657
  description: "List all pre-built agents in the organization along with org metadata.",
@@ -2643,6 +2745,10 @@ function fatal(message) {
2643
2745
  process.stderr.write(JSON.stringify({ error: { message } }) + "\n");
2644
2746
  process.exit(1);
2645
2747
  }
2748
+ function usageBlock(lines) {
2749
+ process.stderr.write("\n" + lines.map((l) => " " + l).join("\n") + "\n\n");
2750
+ process.exit(1);
2751
+ }
2646
2752
  async function readStdin() {
2647
2753
  const chunks = [];
2648
2754
  for await (const chunk of process.stdin) {
@@ -2914,6 +3020,52 @@ async function cmdRun(appId, variables, options) {
2914
3020
  process.stdout.write(JSON.stringify(result, null, 2) + "\n");
2915
3021
  }
2916
3022
  }
3023
+ async function cmdBatch(input, options) {
3024
+ if (!Array.isArray(input)) {
3025
+ fatal(
3026
+ `Batch input must be a JSON array of { stepType, step } objects.
3027
+ Example: mindstudio batch '[{"stepType":"generateImage","step":{"prompt":"a cat"}}]'`
3028
+ );
3029
+ }
3030
+ for (let i = 0; i < input.length; i++) {
3031
+ const item = input[i];
3032
+ if (!item || typeof item !== "object" || !item.stepType || !item.step) {
3033
+ fatal(
3034
+ `Invalid step at index ${i}: each entry must have "stepType" and "step" fields.`
3035
+ );
3036
+ }
3037
+ }
3038
+ const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
3039
+ const metaByName = new Map(
3040
+ Object.entries(stepMetadata2).map(([name, m]) => [name, m])
3041
+ );
3042
+ const steps = input.map(
3043
+ (item, i) => {
3044
+ let meta = metaByName.get(item.stepType);
3045
+ if (!meta) {
3046
+ const camel = item.stepType.replace(
3047
+ /-([a-z])/g,
3048
+ (_, c) => c.toUpperCase()
3049
+ );
3050
+ meta = metaByName.get(camel);
3051
+ }
3052
+ if (meta) {
3053
+ return { stepType: meta.stepType, step: item.step };
3054
+ }
3055
+ return { stepType: item.stepType, step: item.step };
3056
+ }
3057
+ );
3058
+ const agent = await createAgent(options);
3059
+ const result = await agent.executeStepBatch(steps, {
3060
+ appId: options.appId,
3061
+ threadId: options.threadId
3062
+ });
3063
+ if (options.noMeta) {
3064
+ process.stdout.write(JSON.stringify(result.results, null, 2) + "\n");
3065
+ } else {
3066
+ process.stdout.write(JSON.stringify(result, null, 2) + "\n");
3067
+ }
3068
+ }
2917
3069
  async function cmdUpload(filePath, options) {
2918
3070
  const ext = extname2(filePath).slice(1).toLowerCase();
2919
3071
  if (!ext) fatal("Cannot determine file extension. Please provide a file with an extension.");
@@ -2942,7 +3094,7 @@ function isNewerVersion(current, latest) {
2942
3094
  return false;
2943
3095
  }
2944
3096
  async function checkForUpdate() {
2945
- const currentVersion = "0.1.5";
3097
+ const currentVersion = "0.1.7";
2946
3098
  if (!currentVersion) return null;
2947
3099
  try {
2948
3100
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -2971,7 +3123,7 @@ async function checkForUpdate() {
2971
3123
  }
2972
3124
  }
2973
3125
  function printUpdateNotice(latestVersion) {
2974
- const currentVersion = "0.1.5";
3126
+ const currentVersion = "0.1.7";
2975
3127
  process.stderr.write(
2976
3128
  `
2977
3129
  ${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
@@ -3026,7 +3178,7 @@ async function cmdLogin(options) {
3026
3178
  process.stderr.write("\n");
3027
3179
  printLogo();
3028
3180
  process.stderr.write("\n");
3029
- const ver = "0.1.5";
3181
+ const ver = "0.1.7";
3030
3182
  process.stderr.write(
3031
3183
  ` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
3032
3184
  `
@@ -3350,10 +3502,82 @@ async function main() {
3350
3502
  });
3351
3503
  return;
3352
3504
  }
3505
+ if (command === "batch") {
3506
+ let input2;
3507
+ const firstArg = positionals[1];
3508
+ if (firstArg && firstArg.startsWith("[")) {
3509
+ try {
3510
+ input2 = parseJson5(firstArg);
3511
+ } catch {
3512
+ fatal(`Invalid JSON input: ${firstArg}`);
3513
+ }
3514
+ } else if (!process.stdin.isTTY) {
3515
+ const raw = (await readStdin()).trim();
3516
+ if (raw) {
3517
+ try {
3518
+ input2 = parseJson5(raw);
3519
+ } catch {
3520
+ fatal(`Invalid JSON on stdin: ${raw}`);
3521
+ }
3522
+ }
3523
+ }
3524
+ if (input2 === void 0) {
3525
+ usageBlock([
3526
+ "batch \u2014 Execute multiple actions in parallel",
3527
+ "",
3528
+ "Usage:",
3529
+ ` mindstudio batch '[{ "stepType": "<action>", "step": { ... } }, ...]'`,
3530
+ " cat steps.json | mindstudio batch",
3531
+ "",
3532
+ 'Each entry needs "stepType" (action name) and "step" (input object).',
3533
+ "Maximum 50 steps per batch. Results come back in the same order.",
3534
+ "Individual failures don't affect other steps.",
3535
+ "",
3536
+ "Options:",
3537
+ " --app-id <id> App ID for thread context",
3538
+ " --thread-id <id> Thread ID for state persistence",
3539
+ " --no-meta Strip top-level metadata from output",
3540
+ "",
3541
+ "Examples:",
3542
+ " mindstudio batch '[",
3543
+ ' { "stepType": "generateImage", "step": { "prompt": "a sunset" } },',
3544
+ ' { "stepType": "textToSpeech", "step": { "text": "hello world" } }',
3545
+ " ]'",
3546
+ "",
3547
+ ` echo '[{"stepType":"searchGoogle","step":{"query":"cats"}}]' | mindstudio batch`
3548
+ ]);
3549
+ }
3550
+ await cmdBatch(input2, {
3551
+ apiKey: values["api-key"],
3552
+ baseUrl: values["base-url"],
3553
+ appId: values["app-id"],
3554
+ threadId: values["thread-id"],
3555
+ noMeta: values["no-meta"]
3556
+ });
3557
+ return;
3558
+ }
3353
3559
  if (command === "run-agent") {
3354
3560
  const appId = positionals[1];
3355
3561
  if (!appId)
3356
- fatal("Missing app ID. Usage: mindstudio run-agent <appId> [json | --flags]");
3562
+ usageBlock([
3563
+ "run-agent \u2014 Run a pre-built agent and wait for the result",
3564
+ "",
3565
+ "Usage:",
3566
+ " mindstudio run-agent <appId> [json | --flags]",
3567
+ "",
3568
+ "Options:",
3569
+ " --workflow <name> Workflow to execute (default: app default)",
3570
+ ' --version <ver> App version, e.g. "draft" (default: "live")',
3571
+ " --output-key <key> Extract a single field from the result",
3572
+ " --no-meta Strip metadata from output",
3573
+ "",
3574
+ "Examples:",
3575
+ ' mindstudio run-agent abc123 --query "hello"',
3576
+ ` mindstudio run-agent abc123 '{"query": "hello"}'`,
3577
+ " mindstudio run-agent abc123 --workflow summarize --version draft",
3578
+ "",
3579
+ 'Tip: run "mindstudio agents" to list available agent IDs.'
3580
+ ]);
3357
3581
  const runArgv = process.argv.slice(process.argv.indexOf("run-agent") + 2);
3358
3582
  const stepArgs = [];
3359
3583
  for (let i = 0; i < runArgv.length; i++) {
@@ -3402,7 +3626,18 @@ async function main() {
3402
3626
  if (command === "upload") {
3403
3627
  const filePath = positionals[1];
3404
3628
  if (!filePath)
3405
- fatal("Missing file path. Usage: mindstudio upload <filepath>");
3629
+ usageBlock([
3630
+ "upload \u2014 Upload a file to the MindStudio CDN",
3631
+ "",
3632
+ "Usage:",
3633
+ " mindstudio upload <filepath>",
3634
+ "",
3635
+ "Returns the permanent public URL for the uploaded file.",
3636
+ "",
3637
+ "Examples:",
3638
+ " mindstudio upload photo.png",
3639
+ " mindstudio upload /path/to/document.pdf"
3640
+ ]);
3406
3641
  await cmdUpload(filePath, {
3407
3642
  apiKey: values["api-key"],
3408
3643
  baseUrl: values["base-url"]
@@ -3419,7 +3654,20 @@ async function main() {
3419
3654
  if (command === "list-models-by-type" || command === "list-models-summary-by-type") {
3420
3655
  type = positionals[1];
3421
3656
  if (!type)
3422
- fatal(`Missing model type. Usage: mindstudio ${command} <type>`);
3657
+ usageBlock([
3658
+ `${command} \u2014 List AI models filtered by type`,
3659
+ "",
3660
+ "Usage:",
3661
+ ` mindstudio ${command} <type>`,
3662
+ "",
3663
+ "Types:",
3664
+ " llm_chat, image_generation, video_generation,",
3665
+ " video_analysis, text_to_speech, vision, transcription",
3666
+ "",
3667
+ "Examples:",
3668
+ ` mindstudio ${command} image_generation`,
3669
+ ` mindstudio ${command} llm_chat`
3670
+ ]);
3423
3671
  }
3424
3672
  if (command === "list-models-summary" || command === "list-models-summary-by-type") {
3425
3673
  summary = true;
@@ -3449,9 +3697,22 @@ async function main() {
3449
3697
  if (command === "estimate-cost") {
3450
3698
  const stepMethod = positionals[1];
3451
3699
  if (!stepMethod)
3452
- fatal(
3453
- "Missing action name. Usage: mindstudio estimate-cost <action> [json | --flags]"
3454
- );
3700
+ usageBlock([
3701
+ "estimate-cost \u2014 Estimate the cost of an action before running it",
3702
+ "",
3703
+ "Usage:",
3704
+ " mindstudio estimate-cost <action> [json | --flags]",
3705
+ "",
3706
+ "Examples:",
3707
+ ' mindstudio estimate-cost generate-image --prompt "a sunset"',
3708
+ ` mindstudio estimate-cost generate-text '{"message": "hello"}'`,
3709
+ "",
3710
+ 'Tip: run "mindstudio list-actions" to see available actions.'
3711
+ ]);
3712
+ const allKeys2 = await getAllMethodKeys();
3713
+ const resolvedMethod = resolveMethodOrFail(stepMethod, allKeys2);
3714
+ const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
3715
+ const meta = stepMetadata2[resolvedMethod];
3455
3716
  const costArgv = positionals.slice(2);
3456
3717
  let costInput;
3457
3718
  const firstArg = costArgv[0];
@@ -3464,7 +3725,7 @@ async function main() {
3464
3725
  } else {
3465
3726
  costInput = parseStepFlags(costArgv);
3466
3727
  }
3467
- await cmdEstimateStepCost(stepMethod, costInput, {
3728
+ await cmdEstimateStepCost(meta.stepType, costInput, {
3468
3729
  apiKey: values["api-key"],
3469
3730
  baseUrl: values["base-url"]
3470
3731
  });
@@ -3473,7 +3734,15 @@ async function main() {
3473
3734
  if (command === "change-name") {
3474
3735
  const name = positionals[1];
3475
3736
  if (!name)
3476
- fatal("Missing name. Usage: mindstudio change-name <name>");
3737
+ usageBlock([
3738
+ "change-name \u2014 Update your display name",
3739
+ "",
3740
+ "Usage:",
3741
+ " mindstudio change-name <name>",
3742
+ "",
3743
+ "Examples:",
3744
+ ' mindstudio change-name "My Agent"'
3745
+ ]);
3477
3746
  await cmdChangeName(name, {
3478
3747
  apiKey: values["api-key"],
3479
3748
  baseUrl: values["base-url"]
@@ -3483,9 +3752,17 @@ async function main() {
3483
3752
  if (command === "change-profile-picture") {
3484
3753
  const url = positionals[1];
3485
3754
  if (!url)
3486
- fatal(
3487
- "Missing URL. Usage: mindstudio change-profile-picture <url>"
3488
- );
3755
+ usageBlock([
3756
+ "change-profile-picture \u2014 Update your profile picture",
3757
+ "",
3758
+ "Usage:",
3759
+ " mindstudio change-profile-picture <url>",
3760
+ "",
3761
+ "Examples:",
3762
+ " mindstudio change-profile-picture https://example.com/avatar.png",
3763
+ "",
3764
+ 'Tip: use "mindstudio upload" to host an image first.'
3765
+ ]);
3489
3766
  await cmdChangeProfilePicture(url, {
3490
3767
  apiKey: values["api-key"],
3491
3768
  baseUrl: values["base-url"]
@@ -3503,13 +3780,48 @@ async function main() {
3503
3780
  if (command === "info") {
3504
3781
  const rawMethod2 = positionals[1];
3505
3782
  if (!rawMethod2)
3506
- fatal("Missing action name. Usage: mindstudio info <action>");
3783
+ usageBlock([
3784
+ "info \u2014 Show action details and parameters",
3785
+ "",
3786
+ "Usage:",
3787
+ " mindstudio info <action>",
3788
+ "",
3789
+ "Shows the description, input parameters (with types and",
3790
+ "defaults), and output fields for an action.",
3791
+ "",
3792
+ "Examples:",
3793
+ " mindstudio info generate-image",
3794
+ " mindstudio info search-google",
3795
+ "",
3796
+ 'Tip: run "mindstudio list-actions" to see available actions.'
3797
+ ]);
3507
3798
  await cmdInfo(rawMethod2);
3508
3799
  return;
3509
3800
  }
3510
3801
  const split = findMethodSplit(process.argv.slice(2));
3511
3802
  if (!split)
3512
- fatal("Missing action name. Usage: mindstudio <action> [json | --flags]");
3803
+ usageBlock([
3804
+ "Run an action directly",
3805
+ "",
3806
+ "Usage:",
3807
+ " mindstudio <action> [json | --flags]",
3808
+ " mindstudio run <action> [json | --flags]",
3809
+ "",
3810
+ "Input can be inline JSON, --flags, or piped via stdin.",
3811
+ "",
3812
+ "Options:",
3813
+ " --app-id <id> App ID for thread context",
3814
+ " --thread-id <id> Thread ID for state persistence",
3815
+ " --output-key <key> Extract a single field from the result",
3816
+ " --no-meta Strip $-prefixed metadata from output",
3817
+ "",
3818
+ "Examples:",
3819
+ ' mindstudio generate-image --prompt "a sunset"',
3820
+ ` mindstudio search-google '{"query": "cats"}'`,
3821
+ ` echo '{"message":"hello"}' | mindstudio generate-text`,
3822
+ "",
3823
+ 'Tip: run "mindstudio list-actions" to see available actions.'
3824
+ ]);
3513
3825
  const { rawMethod, stepArgv } = split;
3514
3826
  const allKeys = await getAllMethodKeys();
3515
3827
  const method = resolveMethodOrFail(rawMethod, allKeys);
@@ -3568,6 +3880,9 @@ Discover:
3568
3880
  info <action> Show action details and parameters
3569
3881
  list-models [--type <t>] [--summary] List available AI models
3570
3882
 
3883
+ Batch:
3884
+ batch [json] Execute multiple actions in parallel
3885
+
3571
3886
  Pre-built agents:
3572
3887
  agents [--json] List agents in your organization
3573
3888
  run-agent <appId> [json | --flags] Run an agent and wait for result
@@ -3610,6 +3925,7 @@ Examples:
3610
3925
  mindstudio list-actions --summary
3611
3926
  mindstudio info generate-image
3612
3927
  mindstudio list-models --type image_generation
3928
+ mindstudio batch '[{"stepType":"generateImage","step":{"prompt":"a cat"}}]'
3613
3929
  mindstudio run-agent <appId> --query "hello"
3614
3930
  mindstudio agents
3615
3931
  mindstudio mcp
package/llms.txt CHANGED
@@ -205,6 +205,34 @@ For action types not covered by generated methods:
205
205
  const result = await agent.executeStep('stepType', { ...params });
206
206
  ```
207
207
 
208
+ ## Batch execution
209
+
210
+ Execute multiple steps in parallel in a single request. Maximum 50 steps per batch.
211
+ Individual step failures do not affect other steps — partial success is possible.
212
+
213
+ ```typescript
214
+ const result = await agent.executeStepBatch([
215
+ { stepType: 'generateImage', step: { prompt: 'a sunset' } },
216
+ { stepType: 'textToSpeech', step: { text: 'hello world' } },
217
+ ], { appId?, threadId? });
218
+
219
+ // Result:
220
+ result.results; // BatchStepResult[] — same order as input
221
+ result.results[0].stepType; // string
222
+ result.results[0].output; // object | undefined (step output on success)
223
+ result.results[0].error; // string | undefined (error message on failure)
224
+ result.results[0].billingCost; // number | undefined (cost on success)
225
+ result.totalBillingCost; // number | undefined
226
+ result.appId; // string
227
+ result.threadId; // string
228
+ ```
229
+
230
+ CLI:
231
+ ```bash
232
+ mindstudio batch '[{"stepType":"generateImage","step":{"prompt":"a cat"}}]'
233
+ cat steps.json | mindstudio batch
234
+ ```
235
+
208
236
  ## Methods
209
237
 
210
238
  All methods below are called on a `MindStudioAgent` instance (`agent.methodName(...)`).
@@ -1320,8 +1348,11 @@ Update the content of an existing Notion page.
1320
1348
  #### postToX
1321
1349
  Create a post on X (Twitter) from the connected account.
1322
1350
  - Requires an X OAuth connection (connectionId).
1323
- - Posts are plain text. Maximum 280 characters.
1324
- - Input: `{ text: string, connectionId?: string }`
1351
+ - Maximum 280 characters of text.
1352
+ - Optionally attach up to 4 media items (images, GIFs, or videos) via mediaUrls.
1353
+ - Media URLs must be publicly accessible. The service fetches and uploads them to X.
1354
+ - Supported formats: JPEG, PNG, GIF, WEBP, MP4. Images up to 5MB, videos up to 512MB.
1355
+ - Input: `{ text: string, connectionId?: string, mediaUrls?: string[] }`
1325
1356
  - Output: `unknown`
1326
1357
 
1327
1358
  #### searchXPosts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",