@mindstudio-ai/agent 0.1.5 → 0.1.6
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.
- package/README.md +46 -0
- package/dist/cli.js +328 -19
- package/dist/index.d.ts +58 -2
- package/dist/index.js +65 -2
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +328 -19
- package/llms.txt +33 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -264,6 +264,47 @@ const result = await agent.runAgent({
|
|
|
264
264
|
|
|
265
265
|
`runAgent()` uses async polling internally — it submits the run, then polls until complete or failed. The poll interval defaults to 1 second and can be configured with `pollIntervalMs`.
|
|
266
266
|
|
|
267
|
+
## Batch execution
|
|
268
|
+
|
|
269
|
+
Execute multiple steps in parallel in a single request. All steps run server-side in parallel — results come back in the same order as the input. Individual failures don't affect other steps.
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
const { results, totalBillingCost } = await agent.executeStepBatch([
|
|
273
|
+
{ stepType: 'generateImage', step: { prompt: 'A mountain landscape' } },
|
|
274
|
+
{ stepType: 'textToSpeech', step: { text: 'Welcome to the app' } },
|
|
275
|
+
{ stepType: 'searchGoogle', step: { query: 'TypeScript best practices' } },
|
|
276
|
+
]);
|
|
277
|
+
|
|
278
|
+
// Each result has: stepType, output?, billingCost?, error?
|
|
279
|
+
for (const r of results) {
|
|
280
|
+
if (r.error) {
|
|
281
|
+
console.error(`${r.stepType} failed: ${r.error}`);
|
|
282
|
+
} else {
|
|
283
|
+
console.log(`${r.stepType}:`, r.output);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Maximum 50 steps per batch. Supports `appId` and `threadId` options for thread context.
|
|
289
|
+
|
|
290
|
+
From the CLI:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Inline JSON array
|
|
294
|
+
mindstudio batch '[
|
|
295
|
+
{"stepType": "generateImage", "step": {"prompt": "a sunset"}},
|
|
296
|
+
{"stepType": "searchGoogle", "step": {"query": "cats"}}
|
|
297
|
+
]'
|
|
298
|
+
|
|
299
|
+
# Piped from a file
|
|
300
|
+
cat steps.json | mindstudio batch
|
|
301
|
+
|
|
302
|
+
# Strip metadata
|
|
303
|
+
mindstudio batch --no-meta '[...]'
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Run `mindstudio batch` with no arguments for full usage help.
|
|
307
|
+
|
|
267
308
|
## Thread persistence
|
|
268
309
|
|
|
269
310
|
Steps execute within threads. Pass `$threadId` and `$appId` from a previous call to maintain state:
|
|
@@ -374,6 +415,10 @@ import type {
|
|
|
374
415
|
ListAgentsResult,
|
|
375
416
|
RunAgentOptions,
|
|
376
417
|
RunAgentResult,
|
|
418
|
+
BatchStepInput,
|
|
419
|
+
BatchStepResult,
|
|
420
|
+
ExecuteStepBatchOptions,
|
|
421
|
+
ExecuteStepBatchResult,
|
|
377
422
|
} from '@mindstudio-ai/agent';
|
|
378
423
|
```
|
|
379
424
|
|
|
@@ -411,6 +456,7 @@ Commands:
|
|
|
411
456
|
whoami Show current authentication status
|
|
412
457
|
<method> [json | --flags] Execute a step method
|
|
413
458
|
exec <method> [json | --flags] Execute a step method (same as above)
|
|
459
|
+
batch [json] Execute multiple steps in parallel
|
|
414
460
|
list [--json] List available methods
|
|
415
461
|
info <method> Show method details (params, types, output)
|
|
416
462
|
agents [--json] List pre-built agents in your organization
|
package/dist/cli.js
CHANGED
|
@@ -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-
|
|
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.
|
|
2277
|
+
version: "0.1.6"
|
|
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
|
});
|
|
@@ -2292,6 +2355,10 @@ async function startMcpServer(options) {
|
|
|
2292
2355
|
extension: ext,
|
|
2293
2356
|
...mimeType && { type: mimeType }
|
|
2294
2357
|
});
|
|
2358
|
+
} else if (toolName === "executeBatch") {
|
|
2359
|
+
result = await getAgent().executeStepBatch(
|
|
2360
|
+
args.steps
|
|
2361
|
+
);
|
|
2295
2362
|
} else if (toolName === "listAgents") {
|
|
2296
2363
|
result = await getAgent().listAgents();
|
|
2297
2364
|
} else if (toolName === "runAgent") {
|
|
@@ -2382,7 +2449,8 @@ var init_mcp = __esm({
|
|
|
2382
2449
|
changeProfilePicture: "Update the profile picture of the authenticated agent.",
|
|
2383
2450
|
uploadFile: "Upload a file to the MindStudio CDN.",
|
|
2384
2451
|
listAgents: "List all pre-built agents in the organization.",
|
|
2385
|
-
runAgent: "Run a pre-built agent and wait for the result."
|
|
2452
|
+
runAgent: "Run a pre-built agent and wait for the result.",
|
|
2453
|
+
executeBatch: "Execute multiple actions in parallel in a single request."
|
|
2386
2454
|
};
|
|
2387
2455
|
HELPER_TOOLS = [
|
|
2388
2456
|
{
|
|
@@ -2550,6 +2618,37 @@ var init_mcp = __esm({
|
|
|
2550
2618
|
required: ["filePath"]
|
|
2551
2619
|
}
|
|
2552
2620
|
},
|
|
2621
|
+
{
|
|
2622
|
+
name: "executeBatch",
|
|
2623
|
+
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.",
|
|
2624
|
+
inputSchema: {
|
|
2625
|
+
type: "object",
|
|
2626
|
+
properties: {
|
|
2627
|
+
steps: {
|
|
2628
|
+
type: "array",
|
|
2629
|
+
description: "Array of steps to execute.",
|
|
2630
|
+
minItems: 1,
|
|
2631
|
+
maxItems: 50,
|
|
2632
|
+
items: {
|
|
2633
|
+
type: "object",
|
|
2634
|
+
properties: {
|
|
2635
|
+
stepType: {
|
|
2636
|
+
type: "string",
|
|
2637
|
+
description: 'The action type name (e.g. "generateImage", "textToSpeech").'
|
|
2638
|
+
},
|
|
2639
|
+
step: {
|
|
2640
|
+
type: "object",
|
|
2641
|
+
description: "Action input parameters.",
|
|
2642
|
+
additionalProperties: true
|
|
2643
|
+
}
|
|
2644
|
+
},
|
|
2645
|
+
required: ["stepType", "step"]
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
},
|
|
2649
|
+
required: ["steps"]
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2553
2652
|
{
|
|
2554
2653
|
name: "listAgents",
|
|
2555
2654
|
description: "List all pre-built agents in the organization along with org metadata.",
|
|
@@ -2603,6 +2702,9 @@ Discover:
|
|
|
2603
2702
|
info <action> Show action details and parameters
|
|
2604
2703
|
list-models [--type <t>] [--summary] List available AI models
|
|
2605
2704
|
|
|
2705
|
+
Batch:
|
|
2706
|
+
batch [json] Execute multiple actions in parallel
|
|
2707
|
+
|
|
2606
2708
|
Pre-built agents:
|
|
2607
2709
|
agents [--json] List agents in your organization
|
|
2608
2710
|
run-agent <appId> [json | --flags] Run an agent and wait for result
|
|
@@ -2645,6 +2747,7 @@ Examples:
|
|
|
2645
2747
|
mindstudio list-actions --summary
|
|
2646
2748
|
mindstudio info generate-image
|
|
2647
2749
|
mindstudio list-models --type image_generation
|
|
2750
|
+
mindstudio batch '[{"stepType":"generateImage","step":{"prompt":"a cat"}}]'
|
|
2648
2751
|
mindstudio run-agent <appId> --query "hello"
|
|
2649
2752
|
mindstudio agents
|
|
2650
2753
|
mindstudio mcp
|
|
@@ -2700,6 +2803,10 @@ function fatal(message) {
|
|
|
2700
2803
|
process.stderr.write(JSON.stringify({ error: { message } }) + "\n");
|
|
2701
2804
|
process.exit(1);
|
|
2702
2805
|
}
|
|
2806
|
+
function usageBlock(lines) {
|
|
2807
|
+
process.stderr.write("\n" + lines.map((l) => " " + l).join("\n") + "\n\n");
|
|
2808
|
+
process.exit(1);
|
|
2809
|
+
}
|
|
2703
2810
|
async function readStdin() {
|
|
2704
2811
|
const chunks = [];
|
|
2705
2812
|
for await (const chunk of process.stdin) {
|
|
@@ -2971,6 +3078,52 @@ async function cmdRun(appId, variables, options) {
|
|
|
2971
3078
|
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
2972
3079
|
}
|
|
2973
3080
|
}
|
|
3081
|
+
async function cmdBatch(input, options) {
|
|
3082
|
+
if (!Array.isArray(input)) {
|
|
3083
|
+
fatal(
|
|
3084
|
+
`Batch input must be a JSON array of { stepType, step } objects.
|
|
3085
|
+
Example: mindstudio batch '[{"stepType":"generateImage","step":{"prompt":"a cat"}}]'`
|
|
3086
|
+
);
|
|
3087
|
+
}
|
|
3088
|
+
for (let i = 0; i < input.length; i++) {
|
|
3089
|
+
const item = input[i];
|
|
3090
|
+
if (!item || typeof item !== "object" || !item.stepType || !item.step) {
|
|
3091
|
+
fatal(
|
|
3092
|
+
`Invalid step at index ${i}: each entry must have "stepType" and "step" fields.`
|
|
3093
|
+
);
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
3097
|
+
const metaByName = new Map(
|
|
3098
|
+
Object.entries(stepMetadata2).map(([name, m]) => [name, m])
|
|
3099
|
+
);
|
|
3100
|
+
const steps = input.map(
|
|
3101
|
+
(item, i) => {
|
|
3102
|
+
let meta = metaByName.get(item.stepType);
|
|
3103
|
+
if (!meta) {
|
|
3104
|
+
const camel = item.stepType.replace(
|
|
3105
|
+
/-([a-z])/g,
|
|
3106
|
+
(_, c) => c.toUpperCase()
|
|
3107
|
+
);
|
|
3108
|
+
meta = metaByName.get(camel);
|
|
3109
|
+
}
|
|
3110
|
+
if (meta) {
|
|
3111
|
+
return { stepType: meta.stepType, step: item.step };
|
|
3112
|
+
}
|
|
3113
|
+
return { stepType: item.stepType, step: item.step };
|
|
3114
|
+
}
|
|
3115
|
+
);
|
|
3116
|
+
const agent = await createAgent(options);
|
|
3117
|
+
const result = await agent.executeStepBatch(steps, {
|
|
3118
|
+
appId: options.appId,
|
|
3119
|
+
threadId: options.threadId
|
|
3120
|
+
});
|
|
3121
|
+
if (options.noMeta) {
|
|
3122
|
+
process.stdout.write(JSON.stringify(result.results, null, 2) + "\n");
|
|
3123
|
+
} else {
|
|
3124
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
2974
3127
|
var MIME_TYPES2 = {
|
|
2975
3128
|
png: "image/png",
|
|
2976
3129
|
jpg: "image/jpeg",
|
|
@@ -3026,7 +3179,7 @@ function isNewerVersion(current, latest) {
|
|
|
3026
3179
|
return false;
|
|
3027
3180
|
}
|
|
3028
3181
|
async function checkForUpdate() {
|
|
3029
|
-
const currentVersion = "0.1.
|
|
3182
|
+
const currentVersion = "0.1.6";
|
|
3030
3183
|
if (!currentVersion) return null;
|
|
3031
3184
|
try {
|
|
3032
3185
|
const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
@@ -3055,7 +3208,7 @@ async function checkForUpdate() {
|
|
|
3055
3208
|
}
|
|
3056
3209
|
}
|
|
3057
3210
|
function printUpdateNotice(latestVersion) {
|
|
3058
|
-
const currentVersion = "0.1.
|
|
3211
|
+
const currentVersion = "0.1.6";
|
|
3059
3212
|
process.stderr.write(
|
|
3060
3213
|
`
|
|
3061
3214
|
${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
|
|
@@ -3130,7 +3283,7 @@ async function cmdLogin(options) {
|
|
|
3130
3283
|
process.stderr.write("\n");
|
|
3131
3284
|
printLogo();
|
|
3132
3285
|
process.stderr.write("\n");
|
|
3133
|
-
const ver = "0.1.
|
|
3286
|
+
const ver = "0.1.6";
|
|
3134
3287
|
process.stderr.write(
|
|
3135
3288
|
` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
|
|
3136
3289
|
`
|
|
@@ -3463,10 +3616,82 @@ async function main() {
|
|
|
3463
3616
|
});
|
|
3464
3617
|
return;
|
|
3465
3618
|
}
|
|
3619
|
+
if (command === "batch") {
|
|
3620
|
+
let input2;
|
|
3621
|
+
const firstArg = positionals[1];
|
|
3622
|
+
if (firstArg && firstArg.startsWith("[")) {
|
|
3623
|
+
try {
|
|
3624
|
+
input2 = parseJson5(firstArg);
|
|
3625
|
+
} catch {
|
|
3626
|
+
fatal(`Invalid JSON input: ${firstArg}`);
|
|
3627
|
+
}
|
|
3628
|
+
} else if (!process.stdin.isTTY) {
|
|
3629
|
+
const raw = (await readStdin()).trim();
|
|
3630
|
+
if (raw) {
|
|
3631
|
+
try {
|
|
3632
|
+
input2 = parseJson5(raw);
|
|
3633
|
+
} catch {
|
|
3634
|
+
fatal(`Invalid JSON on stdin: ${raw}`);
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
if (input2 === void 0) {
|
|
3639
|
+
usageBlock([
|
|
3640
|
+
"batch \u2014 Execute multiple actions in parallel",
|
|
3641
|
+
"",
|
|
3642
|
+
"Usage:",
|
|
3643
|
+
` mindstudio batch '[{ "stepType": "<action>", "step": { ... } }, ...]'`,
|
|
3644
|
+
" cat steps.json | mindstudio batch",
|
|
3645
|
+
"",
|
|
3646
|
+
'Each entry needs "stepType" (action name) and "step" (input object).',
|
|
3647
|
+
"Maximum 50 steps per batch. Results come back in the same order.",
|
|
3648
|
+
"Individual failures don't affect other steps.",
|
|
3649
|
+
"",
|
|
3650
|
+
"Options:",
|
|
3651
|
+
" --app-id <id> App ID for thread context",
|
|
3652
|
+
" --thread-id <id> Thread ID for state persistence",
|
|
3653
|
+
" --no-meta Strip top-level metadata from output",
|
|
3654
|
+
"",
|
|
3655
|
+
"Examples:",
|
|
3656
|
+
" mindstudio batch '[",
|
|
3657
|
+
' { "stepType": "generateImage", "step": { "prompt": "a sunset" } },',
|
|
3658
|
+
' { "stepType": "textToSpeech", "step": { "text": "hello world" } }',
|
|
3659
|
+
" ]'",
|
|
3660
|
+
"",
|
|
3661
|
+
` echo '[{"stepType":"searchGoogle","step":{"query":"cats"}}]' | mindstudio batch`
|
|
3662
|
+
]);
|
|
3663
|
+
}
|
|
3664
|
+
await cmdBatch(input2, {
|
|
3665
|
+
apiKey: values["api-key"],
|
|
3666
|
+
baseUrl: values["base-url"],
|
|
3667
|
+
appId: values["app-id"],
|
|
3668
|
+
threadId: values["thread-id"],
|
|
3669
|
+
noMeta: values["no-meta"]
|
|
3670
|
+
});
|
|
3671
|
+
return;
|
|
3672
|
+
}
|
|
3466
3673
|
if (command === "run-agent") {
|
|
3467
3674
|
const appId = positionals[1];
|
|
3468
3675
|
if (!appId)
|
|
3469
|
-
|
|
3676
|
+
usageBlock([
|
|
3677
|
+
"run-agent \u2014 Run a pre-built agent and wait for the result",
|
|
3678
|
+
"",
|
|
3679
|
+
"Usage:",
|
|
3680
|
+
" mindstudio run-agent <appId> [json | --flags]",
|
|
3681
|
+
"",
|
|
3682
|
+
"Options:",
|
|
3683
|
+
" --workflow <name> Workflow to execute (default: app default)",
|
|
3684
|
+
' --version <ver> App version, e.g. "draft" (default: "live")',
|
|
3685
|
+
" --output-key <key> Extract a single field from the result",
|
|
3686
|
+
" --no-meta Strip metadata from output",
|
|
3687
|
+
"",
|
|
3688
|
+
"Examples:",
|
|
3689
|
+
' mindstudio run-agent abc123 --query "hello"',
|
|
3690
|
+
` mindstudio run-agent abc123 '{"query": "hello"}'`,
|
|
3691
|
+
" mindstudio run-agent abc123 --workflow summarize --version draft",
|
|
3692
|
+
"",
|
|
3693
|
+
'Tip: run "mindstudio agents" to list available agent IDs.'
|
|
3694
|
+
]);
|
|
3470
3695
|
const runArgv = process.argv.slice(process.argv.indexOf("run-agent") + 2);
|
|
3471
3696
|
const stepArgs = [];
|
|
3472
3697
|
for (let i = 0; i < runArgv.length; i++) {
|
|
@@ -3515,7 +3740,18 @@ async function main() {
|
|
|
3515
3740
|
if (command === "upload") {
|
|
3516
3741
|
const filePath = positionals[1];
|
|
3517
3742
|
if (!filePath)
|
|
3518
|
-
|
|
3743
|
+
usageBlock([
|
|
3744
|
+
"upload \u2014 Upload a file to the MindStudio CDN",
|
|
3745
|
+
"",
|
|
3746
|
+
"Usage:",
|
|
3747
|
+
" mindstudio upload <filepath>",
|
|
3748
|
+
"",
|
|
3749
|
+
"Returns the permanent public URL for the uploaded file.",
|
|
3750
|
+
"",
|
|
3751
|
+
"Examples:",
|
|
3752
|
+
" mindstudio upload photo.png",
|
|
3753
|
+
" mindstudio upload /path/to/document.pdf"
|
|
3754
|
+
]);
|
|
3519
3755
|
await cmdUpload(filePath, {
|
|
3520
3756
|
apiKey: values["api-key"],
|
|
3521
3757
|
baseUrl: values["base-url"]
|
|
@@ -3532,7 +3768,20 @@ async function main() {
|
|
|
3532
3768
|
if (command === "list-models-by-type" || command === "list-models-summary-by-type") {
|
|
3533
3769
|
type = positionals[1];
|
|
3534
3770
|
if (!type)
|
|
3535
|
-
|
|
3771
|
+
usageBlock([
|
|
3772
|
+
`${command} \u2014 List AI models filtered by type`,
|
|
3773
|
+
"",
|
|
3774
|
+
"Usage:",
|
|
3775
|
+
` mindstudio ${command} <type>`,
|
|
3776
|
+
"",
|
|
3777
|
+
"Types:",
|
|
3778
|
+
" llm_chat, image_generation, video_generation,",
|
|
3779
|
+
" video_analysis, text_to_speech, vision, transcription",
|
|
3780
|
+
"",
|
|
3781
|
+
"Examples:",
|
|
3782
|
+
` mindstudio ${command} image_generation`,
|
|
3783
|
+
` mindstudio ${command} llm_chat`
|
|
3784
|
+
]);
|
|
3536
3785
|
}
|
|
3537
3786
|
if (command === "list-models-summary" || command === "list-models-summary-by-type") {
|
|
3538
3787
|
summary = true;
|
|
@@ -3562,9 +3811,18 @@ async function main() {
|
|
|
3562
3811
|
if (command === "estimate-cost") {
|
|
3563
3812
|
const stepMethod = positionals[1];
|
|
3564
3813
|
if (!stepMethod)
|
|
3565
|
-
|
|
3566
|
-
"
|
|
3567
|
-
|
|
3814
|
+
usageBlock([
|
|
3815
|
+
"estimate-cost \u2014 Estimate the cost of an action before running it",
|
|
3816
|
+
"",
|
|
3817
|
+
"Usage:",
|
|
3818
|
+
" mindstudio estimate-cost <action> [json | --flags]",
|
|
3819
|
+
"",
|
|
3820
|
+
"Examples:",
|
|
3821
|
+
' mindstudio estimate-cost generate-image --prompt "a sunset"',
|
|
3822
|
+
` mindstudio estimate-cost generate-text '{"message": "hello"}'`,
|
|
3823
|
+
"",
|
|
3824
|
+
'Tip: run "mindstudio list-actions" to see available actions.'
|
|
3825
|
+
]);
|
|
3568
3826
|
const costArgv = positionals.slice(2);
|
|
3569
3827
|
let costInput;
|
|
3570
3828
|
const firstArg = costArgv[0];
|
|
@@ -3586,7 +3844,15 @@ async function main() {
|
|
|
3586
3844
|
if (command === "change-name") {
|
|
3587
3845
|
const name = positionals[1];
|
|
3588
3846
|
if (!name)
|
|
3589
|
-
|
|
3847
|
+
usageBlock([
|
|
3848
|
+
"change-name \u2014 Update your display name",
|
|
3849
|
+
"",
|
|
3850
|
+
"Usage:",
|
|
3851
|
+
" mindstudio change-name <name>",
|
|
3852
|
+
"",
|
|
3853
|
+
"Examples:",
|
|
3854
|
+
' mindstudio change-name "My Agent"'
|
|
3855
|
+
]);
|
|
3590
3856
|
await cmdChangeName(name, {
|
|
3591
3857
|
apiKey: values["api-key"],
|
|
3592
3858
|
baseUrl: values["base-url"]
|
|
@@ -3596,9 +3862,17 @@ async function main() {
|
|
|
3596
3862
|
if (command === "change-profile-picture") {
|
|
3597
3863
|
const url = positionals[1];
|
|
3598
3864
|
if (!url)
|
|
3599
|
-
|
|
3600
|
-
"
|
|
3601
|
-
|
|
3865
|
+
usageBlock([
|
|
3866
|
+
"change-profile-picture \u2014 Update your profile picture",
|
|
3867
|
+
"",
|
|
3868
|
+
"Usage:",
|
|
3869
|
+
" mindstudio change-profile-picture <url>",
|
|
3870
|
+
"",
|
|
3871
|
+
"Examples:",
|
|
3872
|
+
" mindstudio change-profile-picture https://example.com/avatar.png",
|
|
3873
|
+
"",
|
|
3874
|
+
'Tip: use "mindstudio upload" to host an image first.'
|
|
3875
|
+
]);
|
|
3602
3876
|
await cmdChangeProfilePicture(url, {
|
|
3603
3877
|
apiKey: values["api-key"],
|
|
3604
3878
|
baseUrl: values["base-url"]
|
|
@@ -3616,13 +3890,48 @@ async function main() {
|
|
|
3616
3890
|
if (command === "info") {
|
|
3617
3891
|
const rawMethod2 = positionals[1];
|
|
3618
3892
|
if (!rawMethod2)
|
|
3619
|
-
|
|
3893
|
+
usageBlock([
|
|
3894
|
+
"info \u2014 Show action details and parameters",
|
|
3895
|
+
"",
|
|
3896
|
+
"Usage:",
|
|
3897
|
+
" mindstudio info <action>",
|
|
3898
|
+
"",
|
|
3899
|
+
"Shows the description, input parameters (with types and",
|
|
3900
|
+
"defaults), and output fields for an action.",
|
|
3901
|
+
"",
|
|
3902
|
+
"Examples:",
|
|
3903
|
+
" mindstudio info generate-image",
|
|
3904
|
+
" mindstudio info search-google",
|
|
3905
|
+
"",
|
|
3906
|
+
'Tip: run "mindstudio list-actions" to see available actions.'
|
|
3907
|
+
]);
|
|
3620
3908
|
await cmdInfo(rawMethod2);
|
|
3621
3909
|
return;
|
|
3622
3910
|
}
|
|
3623
3911
|
const split = findMethodSplit(process.argv.slice(2));
|
|
3624
3912
|
if (!split)
|
|
3625
|
-
|
|
3913
|
+
usageBlock([
|
|
3914
|
+
"Run an action directly",
|
|
3915
|
+
"",
|
|
3916
|
+
"Usage:",
|
|
3917
|
+
" mindstudio <action> [json | --flags]",
|
|
3918
|
+
" mindstudio run <action> [json | --flags]",
|
|
3919
|
+
"",
|
|
3920
|
+
"Input can be inline JSON, --flags, or piped via stdin.",
|
|
3921
|
+
"",
|
|
3922
|
+
"Options:",
|
|
3923
|
+
" --app-id <id> App ID for thread context",
|
|
3924
|
+
" --thread-id <id> Thread ID for state persistence",
|
|
3925
|
+
" --output-key <key> Extract a single field from the result",
|
|
3926
|
+
" --no-meta Strip $-prefixed metadata from output",
|
|
3927
|
+
"",
|
|
3928
|
+
"Examples:",
|
|
3929
|
+
' mindstudio generate-image --prompt "a sunset"',
|
|
3930
|
+
` mindstudio search-google '{"query": "cats"}'`,
|
|
3931
|
+
` echo '{"message":"hello"}' | mindstudio generate-text`,
|
|
3932
|
+
"",
|
|
3933
|
+
'Tip: run "mindstudio list-actions" to see available actions.'
|
|
3934
|
+
]);
|
|
3626
3935
|
const { rawMethod, stepArgv } = split;
|
|
3627
3936
|
const allKeys = await getAllMethodKeys();
|
|
3628
3937
|
const method = resolveMethodOrFail(rawMethod, allKeys);
|