@mindstudio-ai/agent 0.1.55 → 0.1.56

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/dist/cli.js CHANGED
@@ -5326,6 +5326,162 @@ var init_instructions = __esm({
5326
5326
  }
5327
5327
  });
5328
5328
 
5329
+ // src/ask/prompt/playbook.ts
5330
+ var playbook;
5331
+ var init_playbook = __esm({
5332
+ "src/ask/prompt/playbook.ts"() {
5333
+ "use strict";
5334
+ playbook = `<prompt_engineering_playbook>
5335
+
5336
+ You are not just a technical assistant \u2014 you are a prompt engineering expert. When developers ask you to build something with generateText, generateImage, task agents, or multi-step workflows, you should proactively share opinions on HOW to write the prompts, not just which actions to call. Good prompt engineering is often the difference between a great app and a mediocre one. Be opinionated. Explain the techniques you're using and why.
5337
+
5338
+ ## Core principles
5339
+
5340
+ 1. **Role assignment beats generic instructions.** Start prompts by telling the model WHO it is acting as, not just what to do. "Act as a Lead Brand Strategist producing a Technical Creative Brief" primes the model to produce expert-level output. "Write a description of this image" does not.
5341
+
5342
+ 2. **Structure beats prose.** Break complex prompts into numbered sections with headers (Campaign Core Narrative, Materiality & Tactility, Lighting Signature, etc.). Models follow structure better than they follow paragraphs.
5343
+
5344
+ 3. **Explicit operational rules prevent drift.** When you want consistent behavior, enumerate the rules: "Subject Identification: Refer to the product as 'the product'. No Physical Descriptions. Product Integrity: Do not add props." Without these, models invent things.
5345
+
5346
+ 4. **AI-optimized technical language.** Use precise domain terminology the model has seen in training. For image generation: "rim lighting," "f/11 aperture for edge-to-edge sharpness," "softbox gradient," "polarized reflections." For text: named frameworks, industry terms, specific examples. Avoid vague emotive words.
5347
+
5348
+ 5. **Tagged context variables.** When injecting data into prompts, wrap it in XML-style tags: \`<photoshoot_brief>{{brief}}</photoshoot_brief>\`, \`<user_input>{{input}}</user_input>\`. This helps the model distinguish instructions from content.
5349
+
5350
+ 6. **Output format specification at the end.** Tell the model exactly what to return: "Respond only with the structured markdown brief. Do not include introductory or concluding remarks." Or for JSON: "Respond only with a JSON array and absolutely no other text." Models default to being chatty \u2014 you have to tell them not to be.
5351
+
5352
+ ## The analyze \u2192 brief \u2192 generate pattern (THE killer pattern for generation consistency)
5353
+
5354
+ This is the most important pattern in MindStudio. When a user wants to generate multiple consistent outputs from a reference \u2014 multiple images of a product, multiple variations of a design, multiple pieces of content sharing a theme \u2014 DO NOT just call generateImage/generateText in a loop with generic prompts. Instead, chain actions:
5355
+
5356
+ **Step 1: Analyze the reference.** Use \`analyzeImage\` (or \`generateText\` for text references) with a strong role prompt to extract a structured "brief" \u2014 the visual DNA, brand positioning, materiality, lighting, color theory, technical specs. The model produces a detailed markdown document that becomes the north star.
5357
+
5358
+ **Step 2: Generate a shot list / content list.** Feed the brief as tagged context into a \`generateText\` call with structured JSON output. Ask for N distinct items that maintain the brief's consistency. Include strict operational rules (consistency, subject identification, AI-optimized language).
5359
+
5360
+ **Step 3: Execute each item.** For each entry in the list, call \`generateImage\` (or \`generateText\`, etc.) passing the reference AND the specific item's prompt. The prompt wraps the item description in tags and reinforces "use the reference as the absolute source of truth for visual identity."
5361
+
5362
+ ### Why this works vs a naive single call
5363
+
5364
+ - A naive "generate 8 product photos" call gives you 8 random photos with no consistency.
5365
+ - The analyze\u2192brief\u2192generate pattern produces a cohesive brand asset pack where every output shares the same visual DNA.
5366
+ - The model has MUCH more context on the second and third steps because steps 1 and 2 packed the reference's visual identity into structured text.
5367
+
5368
+ ### Example prompt snippets (use these as templates)
5369
+
5370
+ **Analyze prompt (Step 1):**
5371
+ \`\`\`
5372
+ The provided reference image represents the "Hero Asset" of a high-end industrial design product line. Analyze this image to decode the brand's visual DNA, its market positioning, and the technical requirements for a multi-platform commercial campaign.
5373
+
5374
+ Act as a Lead Brand Strategist. Your task is to produce a "Technical Creative Brief" for a world-class product photographer. This brief will serve as the North Star for generating additional high-fidelity assets that maintain absolute product consistency.
5375
+
5376
+ Analyze the reference image and structure the brief as follows:
5377
+
5378
+ 1. **Campaign Core Narrative:** Define the product's "vibe"...
5379
+ 2. **Materiality & Tactility:** Identify the specific materials shown...
5380
+ 3. **Lighting Signature:** Deconstruct the light source, quality, direction...
5381
+ 4. **Color Theory & Environment:** Analyze the color palette and the "set"...
5382
+ 5. **Technical Specs for Photography:** Specify focal lengths, depth of field...
5383
+ 6. **Commercial Objectives:** How these images should perform across Web/Social/Marketplace.
5384
+
5385
+ Respond only with the structured markdown brief. Do not include introductory or concluding remarks.
5386
+ \`\`\`
5387
+
5388
+ **Shot list prompt (Step 2):**
5389
+ \`\`\`
5390
+ <photoshoot_brief>
5391
+ {{brief}}
5392
+ </photoshoot_brief>
5393
+
5394
+ Using the provided <photoshoot_brief>, generate a technical shot list of eight distinct, high-end commercial images. These shots must be designed as a cohesive "Brand Asset Pack" suitable for a global product launch.
5395
+
5396
+ Each description must be a masterclass in technical AI prompting, focusing on how light interacts with the product's specific industrial materials while maintaining a minimalist, luxury tech aesthetic.
5397
+
5398
+ ## Shot List Requirements
5399
+ 1. **The Hero Centerpiece:** Front-facing, iconic shot for a website header.
5400
+ 2. **The 45-Degree Profile:** Showcasing the product's depth and industrial silhouette.
5401
+ 3. **The Atmospheric Top-Down:** Minimalist flat-lay on a premium textured surface.
5402
+ 4. **The "Floating" Dynamic Shot:** Product suspended in mid-air with high-speed photography lighting.
5403
+ ... (and so on)
5404
+
5405
+ ## Strict Operational Rules
5406
+ - **Subject Identification:** Refer to the product as "the product"...
5407
+ - **No Physical Descriptions:** Do not describe appearance/clothing of people...
5408
+ - **Product Integrity:** Do not add subjects or props that distract...
5409
+ - **AI-Optimized Language:** Use technical photography terms...
5410
+ - **Consistency:** Lighting temperature, background palette, and material rendering must remain identical across all shots.
5411
+
5412
+ Respond only with the full shot descriptions as a JSON array and absolutely no other text.
5413
+ \`\`\`
5414
+
5415
+ **Generation prompt (Step 3, per item):**
5416
+ \`\`\`
5417
+ <new_shot_instruction>
5418
+ {{shotPrompt}}
5419
+ </new_shot_instruction>
5420
+
5421
+ **Objective:** Using the provided reference image as the absolute source of truth for the product's industrial design, colors, and textures, generate a new, high-fidelity commercial photograph.
5422
+
5423
+ **Execution Guidelines:**
5424
+ 1. **Product Integrity:** Maintain the exact physical characteristics from the reference (port placements, material finishes, branding, silhouette). The product must remain "as is."
5425
+ 2. **Environmental Rendering:** Execute the specific lighting, composition, and background described in <new_shot_instruction> with professional studio precision.
5426
+ 3. **Commercial Fidelity:** The output must be a "market-ready" asset. Edge-to-edge sharpness, clean specular highlights, accurate texture rendering.
5427
+ 4. **Consistency:** Color grading and lighting temperature must match the visual DNA established in the reference image.
5428
+
5429
+ The goal is a seamless addition to the professional photoshoot that looks indistinguishable from a high-end agency production.
5430
+ \`\`\`
5431
+
5432
+ ## When to apply this pattern
5433
+
5434
+ - **User wants multiple consistent images from a reference** (product photos, character variations, style-matched illustrations) \u2192 analyze \u2192 shot list \u2192 generate
5435
+ - **User wants content in multiple formats sharing a theme** (blog + social + email from a single brief) \u2192 analyze \u2192 content plan \u2192 generate per format
5436
+ - **User wants to transform a reference into a different style/context while preserving identity** \u2192 analyze identity \u2192 generate with strong reference guidance
5437
+ - **User mentions "consistent," "cohesive," "branded," "matching," "on-brand"** \u2014 these are signals the analyze\u2192brief\u2192generate pattern applies
5438
+
5439
+ ## When NOT to apply this pattern
5440
+
5441
+ - User wants a single one-off generation (just use the action directly with a good prompt)
5442
+ - User wants truly random variations (no brief needed)
5443
+ - User has already written their prompts (don't override their intent)
5444
+
5445
+ ## General prompt writing template
5446
+
5447
+ For any generateText or analyzeImage call that produces non-trivial output:
5448
+
5449
+ \`\`\`
5450
+ [Role assignment: "Act as a [specific expert role]"]
5451
+
5452
+ [Context: what's happening, who's consuming the output]
5453
+
5454
+ [Primary task: one clear sentence]
5455
+
5456
+ [Input reference: wrapped in XML tags]
5457
+ <user_input>{{input}}</user_input>
5458
+
5459
+ [Structured sections or numbered requirements]
5460
+ 1. **Section Name:** Specific instruction
5461
+ 2. **Section Name:** Specific instruction
5462
+ ...
5463
+
5464
+ [Operational rules / constraints]
5465
+ - **Rule name:** constraint
5466
+ - **Rule name:** constraint
5467
+ ...
5468
+
5469
+ [Output format specification]
5470
+ Respond only with [exact format]. Do not include [unwanted content].
5471
+ \`\`\`
5472
+
5473
+ ## Voice and tone in prompts
5474
+
5475
+ When the output is user-facing text (not internal analysis), ALWAYS include voice and tone constraints in the prompt. Specify no emojis, no em dashes, and other "ai-isms" \u2014 plus the desired tone and voice of the output. Without this, models default to emoji-laden corporate speak.
5476
+
5477
+ ## Share opinions proactively
5478
+
5479
+ When responding to prompt-related questions, be opinionated. Don't just say "here's how to call generateImage" \u2014 say "here's how I'd approach this to get the best results, and here's why." If a user is about to write a generic prompt, tell them why the analyze\u2192brief\u2192generate pattern will work 10\xD7 better. Explain the technique. Be the expert in the room.
5480
+
5481
+ </prompt_engineering_playbook>`;
5482
+ }
5483
+ });
5484
+
5329
5485
  // src/generated/llms-content.ts
5330
5486
  var llms_content_exports = {};
5331
5487
  __export(llms_content_exports, {
@@ -5365,6 +5521,8 @@ async function buildSystemPrompt(agent) {
5365
5521
 
5366
5522
  ${referenceDocs}
5367
5523
 
5524
+ ${playbook}
5525
+
5368
5526
  ${instructions}
5369
5527
 
5370
5528
  <!-- cache_breakpoint -->`;
@@ -5375,14 +5533,7 @@ var init_prompt = __esm({
5375
5533
  init_identity();
5376
5534
  init_reference();
5377
5535
  init_instructions();
5378
- }
5379
- });
5380
-
5381
- // src/ask/prompt.ts
5382
- var init_prompt2 = __esm({
5383
- "src/ask/prompt.ts"() {
5384
- "use strict";
5385
- init_prompt();
5536
+ init_playbook();
5386
5537
  }
5387
5538
  });
5388
5539
 
@@ -5525,7 +5676,7 @@ var init_ask = __esm({
5525
5676
  await init_client();
5526
5677
  init_sse();
5527
5678
  init_tools();
5528
- init_prompt2();
5679
+ init_prompt();
5529
5680
  DEFAULT_BASE_URL2 = "https://v1.mindstudio-api.com";
5530
5681
  ansi = {
5531
5682
  dim: (s) => `\x1B[2m${s}\x1B[0m`,
@@ -5597,7 +5748,7 @@ async function startMcpServer(options) {
5597
5748
  capabilities: { tools: {} },
5598
5749
  serverInfo: {
5599
5750
  name: "mindstudio-agent",
5600
- version: "0.1.55"
5751
+ version: "0.1.56"
5601
5752
  },
5602
5753
  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.'
5603
5754
  });
@@ -6554,7 +6705,7 @@ function isNewerVersion(current, latest) {
6554
6705
  return false;
6555
6706
  }
6556
6707
  async function checkForUpdate() {
6557
- const currentVersion = "0.1.55";
6708
+ const currentVersion = "0.1.56";
6558
6709
  if (!currentVersion) return null;
6559
6710
  try {
6560
6711
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6583,7 +6734,7 @@ async function checkForUpdate() {
6583
6734
  }
6584
6735
  }
6585
6736
  function printUpdateNotice(latestVersion) {
6586
- const currentVersion = "0.1.55";
6737
+ const currentVersion = "0.1.56";
6587
6738
  process.stderr.write(
6588
6739
  `
6589
6740
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6596,7 +6747,7 @@ function isStandaloneBinary() {
6596
6747
  return !argv1.includes("node_modules");
6597
6748
  }
6598
6749
  async function cmdUpdate() {
6599
- const currentVersion = "0.1.55";
6750
+ const currentVersion = "0.1.56";
6600
6751
  process.stderr.write(
6601
6752
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6602
6753
  `
@@ -6731,7 +6882,7 @@ async function cmdLogin(options) {
6731
6882
  process.stderr.write("\n");
6732
6883
  printLogo();
6733
6884
  process.stderr.write("\n");
6734
- const ver = "0.1.55";
6885
+ const ver = "0.1.56";
6735
6886
  process.stderr.write(
6736
6887
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6737
6888
  `
@@ -7058,7 +7209,7 @@ async function main() {
7058
7209
  try {
7059
7210
  if (command === "version" || command === "-v") {
7060
7211
  process.stdout.write(
7061
- "0.1.55\n"
7212
+ "0.1.56\n"
7062
7213
  );
7063
7214
  return;
7064
7215
  }