@mindstudio-ai/agent 0.1.52 → 0.1.54

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.
@@ -5132,12 +5132,24 @@ function buildReferenceDocs(data) {
5132
5132
  Thread persistence: pass \`{ threadId: result.$threadId, appId: result.$appId }\` as second arg.
5133
5133
  All 200+ models accessed through one API key \u2014 MindStudio routes to the provider server-side.
5134
5134
 
5135
- Debug logging / execution visibility:
5136
- - **All step methods** (generateImage, generateText, searchGoogle, etc.) accept an \`onLog\` callback in the OPTIONS object (second argument). This enables SSE streaming with real-time debug logs during execution. Example: \`await mindstudio.generateImage({ prompt: '...' }, { onLog: (event) => console.log(event.tag, event.value) })\`. The event has \`{ value: string, tag: string, ts: number }\`. This is the programmatic equivalent of the CLI's stderr logging. It works on ANY step method \u2014 not just generateText.
5135
+ Execution visibility (\`onLog\`):
5136
+ - **All step methods** (generateImage, generateText, searchGoogle, etc.) accept an \`onLog\` callback in the OPTIONS object (second argument). This enables SSE streaming with real-time progress during execution. Example: \`await mindstudio.generateImage({ prompt: '...' }, { onLog: (event) => console.log(event.tag, event.value) })\`. The event has \`{ value: string, tag: string, ts: number }\`. It works on ANY step method.
5137
5137
  - **Task agents** use \`onEvent\` (on the options object itself, not a second arg) for streaming events during the tool-use loop.
5138
- - **\`stream()\`** is for pushing SSE chunks to the frontend UI \u2014 it is NOT for debug logging.
5139
5138
 
5140
- Streaming: \`stream()\` is a separate function for sending SSE chunks to the frontend \u2014 it is NOT an option you pass to step methods. Streaming is automatic when the sandbox sets STREAM_ID. Import as \`import { stream } from '@mindstudio-ai/agent'\` and call \`await stream('Processing...')\` or \`await stream({ progress: 50 })\`. When there's no active stream, calls are silently ignored.
5139
+ Progress for long-running operations:
5140
+ For any step that takes more than a few seconds (video generation, image generation, audio generation, lipsync, upscaling, etc.), ALWAYS use \`onLog\` combined with \`stream()\` to keep the user informed. This is the standard pattern, not optional:
5141
+ \`\`\`typescript
5142
+ import { mindstudio, stream } from '@mindstudio-ai/agent';
5143
+
5144
+ await stream('Generating your video...');
5145
+ const { videoUrl } = await mindstudio.generateVideo({
5146
+ prompt: '...',
5147
+ }, {
5148
+ onLog: (event) => stream({ status: event.value }),
5149
+ });
5150
+ await stream({ status: 'done', videoUrl });
5151
+ \`\`\`
5152
+ Without this pattern, long-running operations appear to hang with no feedback to the user. \`stream()\` calls are silently ignored when there is no active SSE connection (CLI, background jobs), so it is always safe to include.
5141
5153
 
5142
5154
  Database queries (Query, Mutation) support both \`await\` and \`.then()/.catch()\` \u2014 use standard try/catch with await or chain \`.catch()\` directly.
5143
5155
 
@@ -5224,6 +5236,7 @@ var init_instructions = __esm({
5224
5236
  - Do not recommend using thread persistence. This is an advanced feature - if someone needs this they will discover it on their own.
5225
5237
  - Generate text is great for one-off text generation requests to models. For sustained conversations, conversations that require history, persistence, or multiple threads or tool use, recommend that the developer add an Agent interface to their MindStudio app and use that directly. They will understand what you mean by this.
5226
5238
  - **Manual multi-step orchestration when runTask() fits** \u2014 if the caller is chaining multiple SDK actions with conditional logic (search \u2192 extract \u2192 generate \u2192 validate), suggest \`runTask()\` instead. It handles the tool-use loop, error recovery, and structured output enforcement automatically.
5239
+ - **Recommending model switches when the user needs better prompting** \u2014 when a user says "my generated images aren't faithful enough" or "the output quality isn't good," the answer is to improve the prompt, NOT to recommend a different model. Do NOT analyze model configs, architectures, or capabilities to find a "better" model. The recommended models (Seedream 4.5, Gemini 3.1 Flash Image) handle all use cases. Help the user write a better prompt instead.
5227
5240
  </anti_patterns>
5228
5241
 
5229
5242
  <task_agent_guidance>
@@ -5255,14 +5268,16 @@ var init_instructions = __esm({
5255
5268
  - Use the names of model input objects to infer **technical capabilities** \u2014 e.g., a model with a source image input supports image editing, a video model with start/end frame supports looping. Do not look at model tags or descriptions to determine capabilities.
5256
5269
  - **Do NOT use config presets/enums to judge model quality or recommend models.** A model having style presets (e.g. "oil painting", "watercolor") does NOT make it better at those styles than models without presets. The recommended models (Seedream, Nano Banana Pro, etc.) are far more capable and achieve any style through prompting alone. Presets are a crutch for weaker models \u2014 never recommend a model just because it has an enum that matches the user's request.
5257
5270
  - **Never set maxResponseTokens to a low value.** Many models use extended thinking/reasoning that counts against the token limit. Setting maxResponseTokens to 256 or 512 will cause truncated or failed responses. Set it to something high, like 16000+, even if you don't need it. Models stop generating on their own when the response is complete \u2014 a low cap does not save money, it just breaks output.
5271
+ - **Do NOT do deep model analysis to find "the right model for the job."** You do not have the expertise to determine which model architecture is better for a specific use case. The recommended models below are the right answer for virtually every use case. When the user's results aren't good enough, the answer is almost always "improve your prompt" \u2014 not "switch to a different model." Prompt engineering is the lever, model selection is not.
5272
+ - **Do NOT hallucinate model IDs.** Only recommend models you can see in the models reference above. If you're not sure a model ID exists, do NOT use it. Call listModels to verify.
5258
5273
 
5259
- ## Explicit preferences
5260
- MindStudio has hundreds of models. Many of them are for niche use cases. In general, prefer to recommend the following models unless the user specifies otherwise.
5274
+ ## Explicit preferences \u2014 USE THESE MODELS
5275
+ MindStudio has hundreds of models. Many of them are legacy or niche. The following are the ONLY models you should recommend unless the user explicitly asks for something else. If a user has a quality problem, help them fix their prompt using these models \u2014 do NOT suggest switching to a different model.
5261
5276
 
5262
5277
  Text generation:
5263
5278
  - Google Gemini, Anthropic Claude, OpenAI GPT
5264
5279
  Image generation:
5265
- - Seedream 4.5, Google Gemini 3.1 Flash Image (Nano Banana Pro). Never recommend things like Flux 1 or other models that have been superseded by later generations from the same provider.
5280
+ - Seedream 4.5, Google Gemini 3.1 Flash Image (Nano Banana Pro). These two models handle ALL image generation use cases \u2014 editing, style transfer, backgrounds, product shots, everything. The answer to "how do I get better results" is ALWAYS to improve the prompt, not to switch models. Never recommend Flux, DALL-E, or other legacy/niche models.
5266
5281
  Video generation:
5267
5282
  - Grok Imagine, Kling O3, Google Veo 3.1
5268
5283
  Text to speech:
@@ -5574,7 +5589,7 @@ async function startMcpServer(options) {
5574
5589
  capabilities: { tools: {} },
5575
5590
  serverInfo: {
5576
5591
  name: "mindstudio-agent",
5577
- version: "0.1.52"
5592
+ version: "0.1.54"
5578
5593
  },
5579
5594
  instructions: 'Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `ask` with any question about the SDK \u2014 it knows every action, model, and connector and returns working code with real model IDs and config options. Examples: ask("generate an image with FLUX"), ask("what models support vision?"), ask("how do I send a Slack message?").\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.\n4. For manual browsing, 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.'
5580
5595
  });
@@ -6435,7 +6450,7 @@ function isNewerVersion(current, latest) {
6435
6450
  return false;
6436
6451
  }
6437
6452
  async function checkForUpdate() {
6438
- const currentVersion = "0.1.52";
6453
+ const currentVersion = "0.1.54";
6439
6454
  if (!currentVersion) return null;
6440
6455
  try {
6441
6456
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6464,7 +6479,7 @@ async function checkForUpdate() {
6464
6479
  }
6465
6480
  }
6466
6481
  function printUpdateNotice(latestVersion) {
6467
- const currentVersion = "0.1.52";
6482
+ const currentVersion = "0.1.54";
6468
6483
  process.stderr.write(
6469
6484
  `
6470
6485
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6477,7 +6492,7 @@ function isStandaloneBinary() {
6477
6492
  return !argv1.includes("node_modules");
6478
6493
  }
6479
6494
  async function cmdUpdate() {
6480
- const currentVersion = "0.1.52";
6495
+ const currentVersion = "0.1.54";
6481
6496
  process.stderr.write(
6482
6497
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6483
6498
  `
@@ -6592,7 +6607,7 @@ async function cmdLogin(options) {
6592
6607
  process.stderr.write("\n");
6593
6608
  printLogo();
6594
6609
  process.stderr.write("\n");
6595
- const ver = "0.1.52";
6610
+ const ver = "0.1.54";
6596
6611
  process.stderr.write(
6597
6612
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6598
6613
  `
@@ -6903,7 +6918,7 @@ async function main() {
6903
6918
  try {
6904
6919
  if (command === "version" || command === "-v") {
6905
6920
  process.stdout.write(
6906
- "0.1.52\n"
6921
+ "0.1.54\n"
6907
6922
  );
6908
6923
  return;
6909
6924
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",