@mindstudio-ai/agent 0.1.179 → 0.1.181

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/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ What changed in `@mindstudio-ai/agent`, newest first, each version under its own
4
4
 
5
5
  Versions before 0.1.163 aren't recorded here.
6
6
 
7
+ ## 0.1.181
8
+
9
+ ### Changed behavior
10
+
11
+ - A database error over the socket throws with the status the platform answered with, as the HTTP path always has, where it was always 400: a parked database server's `database_lease_parked` and `database_unavailable` are 503s, a query past its time a 504, the platform's own fault a 500, and the app's own SQL stays a 400. The code is unchanged. Check code that branches on `err.status === 400` for every database error: branch on `err.code` instead.
12
+ - `generate3dModel`'s usage notes list `wavespeed-meshy-t2.5`, Meshy's low-poly model, which makes a triangle mesh of up to 30,000 polygons from the prompt or one `image`. App code isn't affected.
13
+ - `generateImage`'s usage notes name `ideogram-v4.5` among the models that take one `image`, in place of the MAI models, which retired onto it on 2026-11-05. App code isn't affected.
14
+
15
+ ## 0.1.180
16
+
17
+ ### Changed behavior
18
+
19
+ - Internal functions renamed to say what they do. Nothing exported changed, and nothing behaves differently. App code isn't affected.
20
+
7
21
  ## 0.1.179
8
22
 
9
23
  ### Changed behavior
package/dist/cli.js CHANGED
@@ -376,7 +376,7 @@ var init_metadata = __esm({
376
376
  "generate3dModel": {
377
377
  stepType: "generate3dModel",
378
378
  description: "Generate a 3D model using a 3D generation model.",
379
- usageNotes: "- The default model is wavespeed-tripo3d-h3.1 (Tripo v3.1), which makes a model from the prompt, from one `image`, or from `images`: 2\u20134 views of the same object, in order front, left, back, right.\n- Models and what they take, set in `threeDModelOverride.config`:\n - From text or an image: wavespeed-tripo3d-h3.1, wavespeed-meshy7.1 (also `images`, 1\u20134 views), wavespeed-hunyuan3d-v3 (an `image`, plus optional `back_image_url`, `left_image_url`, `right_image_url`), wavespeed-hunyuan-3d-v3.1-rapid, wavespeed-tripo3d-p2, wavespeed-rodin-v2.5 (`images`, 1\u20135).\n - From an image only: trellis-2, wavespeed-meshy7 (or `images`, 1\u20134 views), seed3d-2.0.\n - From views: wavespeed-hi3d-v3.0 (`front_image`, and optional `back_image`, `left_image`, `right_image`).\n- `$mode` in the config picks a model's mode (`text-to-3d`, `image-to-3d`, or its multi-view mode). Left out, `images` picks the multi-view mode and `image` picks image-to-3d; with neither, the model's default mode. A text mode needs the prompt; in the others the prompt is optional guidance.\n- The output is standardized as a GLB URL plus optional FBX/OBJ/USDZ, thumbnail, texture maps, and provider task ID.",
379
+ usageNotes: "- The default model is wavespeed-tripo3d-h3.1 (Tripo v3.1), which makes a model from the prompt, from one `image`, or from `images`: 2\u20134 views of the same object, in order front, left, back, right.\n- Models and what they take, set in `threeDModelOverride.config`:\n - From text or an image: wavespeed-tripo3d-h3.1, wavespeed-meshy7.1 (also `images`, 1\u20134 views), wavespeed-meshy-t2.5 (a low-poly mesh of up to 30,000 polygons), wavespeed-hunyuan3d-v3 (an `image`, plus optional `back_image_url`, `left_image_url`, `right_image_url`), wavespeed-hunyuan-3d-v3.1-rapid, wavespeed-tripo3d-p2, wavespeed-rodin-v2.5 (`images`, 1\u20135).\n - From an image only: trellis-2, wavespeed-meshy7 (or `images`, 1\u20134 views), seed3d-2.0.\n - From views: wavespeed-hi3d-v3.0 (`front_image`, and optional `back_image`, `left_image`, `right_image`).\n- `$mode` in the config picks a model's mode (`text-to-3d`, `image-to-3d`, or its multi-view mode). Left out, `images` picks the multi-view mode and `image` picks image-to-3d; with neither, the model's default mode. A text mode needs the prompt; in the others the prompt is optional guidance.\n- The output is standardized as a GLB URL plus optional FBX/OBJ/USDZ, thumbnail, texture maps, and provider task ID.",
380
380
  inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt for text-to-3D models, or optional guidance for image-to-3D models" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "threeDModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "3D generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default 3D model if not specified" } } },
381
381
  outputSchema: { "type": "object", "properties": { "prompt": { "type": "string" }, "glbUrl": { "type": "string" }, "fbxUrl": { "type": "string" }, "objUrl": { "type": "string" }, "usdzUrl": { "type": "string" }, "thumbnailUrl": { "type": "string" }, "textureUrls": { "type": "array", "items": { "type": "object", "properties": {}, "required": [] } }, "providerTaskId": { "type": "string" }, "resolvedConfig": { "type": "object", "properties": {}, "required": [] } }, "required": ["glbUrl"] }
382
382
  },
@@ -390,7 +390,7 @@ var init_metadata = __esm({
390
390
  "generateImage": {
391
391
  stepType: "generateImage",
392
392
  description: "Generate an image from a text prompt, or edit one, using an AI model.",
393
- usageNotes: "- Prompts should be descriptive but concise (roughly 3\u20136 sentences).\n- The default model is seedream-4.5. Options go in `imageModelOverride.config` under the model's own names, and differ by model, so look the model up before writing the call. Images to edit or draw from go there too, as URLs: `images` on most models, `source_images` on the Gemini and GPT Image models, one `image` on qwen-image, z-image-turbo, krea-v2-turbo, ideogram-v4 and the MAI models, `source_image` on Grok Imagine, `image_url` on the Ideogram remix and FLUX Kontext models, and `reference` on krea-v2-large.\n- A model that makes and edits images by separate means takes `$mode` in its config (`text-to-image`, and `edit`, `image-edit` or `image-to-image`, as it lists). Left out, images in the config pick the edit mode, and otherwise the model makes the image from the prompt.\n- Images are hosted on the public CDN by default, or in one of the app's own file stores when the call passes `store` \u2014 a private store keeps the image private.\n- In foreground mode, the image is displayed to the user. In background mode, the URL is saved to a variable.\n- When generateVariants is true with numVariants > 1 (up to 10), the images are generated in parallel. One that fails is left out of the URLs returned, and the step fails only when every one does.\n- In direct execution, foreground mode behaves as background, and userSelect variant behavior behaves as saveAll.",
393
+ usageNotes: "- Prompts should be descriptive but concise (roughly 3\u20136 sentences).\n- The default model is seedream-4.5. Options go in `imageModelOverride.config` under the model's own names, and differ by model, so look the model up before writing the call. Images to edit or draw from go there too, as URLs: `images` on most models, `source_images` on the Gemini and GPT Image models, one `image` on qwen-image, z-image-turbo, krea-v2-turbo, ideogram-v4 and ideogram-v4.5, `source_image` on Grok Imagine, `image_url` on the Ideogram remix and FLUX Kontext models, and `reference` on krea-v2-large.\n- A model that makes and edits images by separate means takes `$mode` in its config (`text-to-image`, and `edit`, `image-edit` or `image-to-image`, as it lists). Left out, images in the config pick the edit mode, and otherwise the model makes the image from the prompt.\n- Images are hosted on the public CDN by default, or in one of the app's own file stores when the call passes `store` \u2014 a private store keeps the image private.\n- In foreground mode, the image is displayed to the user. In background mode, the URL is saved to a variable.\n- When generateVariants is true with numVariants > 1 (up to 10), the images are generated in parallel. One that fails is left out of the URLs returned, and the step fails only when every one does.\n- In direct execution, foreground mode behaves as background, and userSelect variant behavior behaves as saveAll.",
394
394
  inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the image to generate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "imageModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Image generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default image model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple image variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated image.\n\nThe watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there." } }, "required": ["prompt"] },
395
395
  outputSchema: { "type": "object", "properties": { "imageUrl": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["imageUrl"] }
396
396
  },
@@ -1399,7 +1399,7 @@ function clearPendingTimer(p) {
1399
1399
  p.timer = null;
1400
1400
  }
1401
1401
  }
1402
- function forget(self, id) {
1402
+ function dropSettledRequest(self, id) {
1403
1403
  self.pending.delete(id);
1404
1404
  self.inbound.delete(id);
1405
1405
  if (self.retired && self.pending.size === 0) {
@@ -1433,7 +1433,7 @@ function retire(self, reason) {
1433
1433
  function armIdleTimer(self, id, p) {
1434
1434
  clearPendingTimer(p);
1435
1435
  p.timer = setTimeout(() => {
1436
- forget(self, id);
1436
+ dropSettledRequest(self, id);
1437
1437
  retire(self, "a reply went silent");
1438
1438
  p.reject(new DbWsTransportError("ws reply went silent", true));
1439
1439
  }, WS_IDLE_TIMEOUT_MS);
@@ -1444,13 +1444,14 @@ function deliver(self, msg) {
1444
1444
  return;
1445
1445
  }
1446
1446
  clearPendingTimer(p);
1447
- forget(self, msg.id);
1447
+ dropSettledRequest(self, msg.id);
1448
1448
  if (msg.error) {
1449
+ const status = typeof msg.error.status === "number" && Number.isInteger(msg.error.status) && msg.error.status >= 400 && msg.error.status <= 599 ? msg.error.status : 400;
1449
1450
  p.reject(
1450
1451
  new MindStudioError(
1451
1452
  `[db] ${msg.error.message || "Database query failed"}`,
1452
1453
  msg.error.code || "db_query_error",
1453
- 400,
1454
+ status,
1454
1455
  msg.error
1455
1456
  )
1456
1457
  );
@@ -1465,7 +1466,7 @@ function failTransport(self, id, err) {
1465
1466
  return;
1466
1467
  }
1467
1468
  clearPendingTimer(p);
1468
- forget(self, id);
1469
+ dropSettledRequest(self, id);
1469
1470
  p.reject(err);
1470
1471
  }
1471
1472
  function getOrOpen(url, token) {
@@ -1618,7 +1619,7 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
1618
1619
  return await new Promise((resolve, reject) => {
1619
1620
  const pending = { resolve, reject, timer: null, acked: false };
1620
1621
  pending.timer = setTimeout(() => {
1621
- forget(self, id);
1622
+ dropSettledRequest(self, id);
1622
1623
  retire(self, "a request went unacknowledged");
1623
1624
  reject(new DbWsTransportError("ws ack timed out", true));
1624
1625
  }, WS_ACK_TIMEOUT_MS);
@@ -1633,7 +1634,7 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
1633
1634
  complete = true;
1634
1635
  } catch (err) {
1635
1636
  clearPendingTimer(pending);
1636
- forget(self, id);
1637
+ dropSettledRequest(self, id);
1637
1638
  if (started) {
1638
1639
  retire(self, "a partial request upload failed");
1639
1640
  }
@@ -2463,7 +2464,7 @@ function nestedComparison(node, negated, params) {
2463
2464
  function withNulls(core, field, nullsMatch) {
2464
2465
  return nullsMatch ? `(${core} OR ${field.sql} IS NULL)` : core;
2465
2466
  }
2466
- function readsBackAsWritten(value) {
2467
+ function isNonJsonString(value) {
2467
2468
  if (typeof value !== "string") {
2468
2469
  return false;
2469
2470
  }
@@ -2501,7 +2502,7 @@ function compileNode(node, negated, columns, params) {
2501
2502
  const type = column(node.field)?.type;
2502
2503
  if (type === "json") {
2503
2504
  const strictEquals = node.op === "===" ? !negated : node.op === "!==" ? negated : null;
2504
- return strictEquals !== null && readsBackAsWritten(node.value) ? jsonColumnIn(node.field, [node.value], !strictEquals, params) : null;
2505
+ return strictEquals !== null && isNonJsonString(node.value) ? jsonColumnIn(node.field, [node.value], !strictEquals, params) : null;
2505
2506
  }
2506
2507
  if (!type || typeof node.value !== VALUE_KIND[type]) {
2507
2508
  return null;
@@ -2531,7 +2532,7 @@ function compileNode(node, negated, columns, params) {
2531
2532
  case "in": {
2532
2533
  const type = column(node.field)?.type;
2533
2534
  if (type === "json") {
2534
- return node.values.every(readsBackAsWritten) ? jsonColumnIn(node.field, node.values, negated, params) : null;
2535
+ return node.values.every(isNonJsonString) ? jsonColumnIn(node.field, node.values, negated, params) : null;
2535
2536
  }
2536
2537
  if (!type || node.values.some(
2537
2538
  (v) => v !== null && v !== void 0 && typeof v !== VALUE_KIND[type]
@@ -10086,7 +10087,7 @@ async function startMcpServer(options) {
10086
10087
  capabilities: { tools: {} },
10087
10088
  serverInfo: {
10088
10089
  name: "mindstudio-agent",
10089
- version: "0.1.179"
10090
+ version: "0.1.181"
10090
10091
  },
10091
10092
  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, pass its public image URL to `changeProfilePicture`.\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.'
10092
10093
  });
@@ -10680,7 +10681,7 @@ function fatal(message) {
10680
10681
  process.stderr.write(JSON.stringify({ error: { message } }) + "\n");
10681
10682
  process.exit(1);
10682
10683
  }
10683
- function usageBlock(lines) {
10684
+ function exitWithUsage(lines) {
10684
10685
  process.stderr.write("\n" + lines.map((l) => " " + l).join("\n") + "\n\n");
10685
10686
  process.exit(1);
10686
10687
  }
@@ -11126,7 +11127,7 @@ function isNewerVersion(current, latest) {
11126
11127
  return false;
11127
11128
  }
11128
11129
  async function checkForUpdate() {
11129
- const currentVersion = "0.1.179";
11130
+ const currentVersion = "0.1.181";
11130
11131
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
11131
11132
  return null;
11132
11133
  }
@@ -11161,7 +11162,7 @@ async function checkForUpdate() {
11161
11162
  }
11162
11163
  }
11163
11164
  function printUpdateNotice(latestVersion) {
11164
- const currentVersion = "0.1.179";
11165
+ const currentVersion = "0.1.181";
11165
11166
  process.stderr.write(
11166
11167
  `
11167
11168
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -11174,7 +11175,7 @@ function isStandaloneBinary() {
11174
11175
  return !argv1.includes("node_modules");
11175
11176
  }
11176
11177
  async function cmdUpdate() {
11177
- const currentVersion = "0.1.179";
11178
+ const currentVersion = "0.1.181";
11178
11179
  process.stderr.write(
11179
11180
  ` ${ansi2.gray("Current version:")} ${currentVersion}
11180
11181
  `
@@ -11315,7 +11316,7 @@ async function cmdLogin(options) {
11315
11316
  process.stderr.write("\n");
11316
11317
  printLogo();
11317
11318
  process.stderr.write("\n");
11318
- const ver = "0.1.179";
11319
+ const ver = "0.1.181";
11319
11320
  process.stderr.write(
11320
11321
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
11321
11322
  `
@@ -11643,7 +11644,7 @@ async function main() {
11643
11644
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
11644
11645
  try {
11645
11646
  if (command === "version" || command === "-v") {
11646
- process.stdout.write("0.1.179\n");
11647
+ process.stdout.write("0.1.181\n");
11647
11648
  return;
11648
11649
  }
11649
11650
  if (command === "login") {
@@ -11673,7 +11674,7 @@ async function main() {
11673
11674
  question = (await readStdin()).trim();
11674
11675
  }
11675
11676
  if (!question) {
11676
- usageBlock([
11677
+ exitWithUsage([
11677
11678
  "ask \u2014 Built-in SDK assistant",
11678
11679
  "",
11679
11680
  "Returns working code with real model IDs, config options,",
@@ -11733,7 +11734,7 @@ async function main() {
11733
11734
  }
11734
11735
  }
11735
11736
  if (input2 === void 0) {
11736
- usageBlock([
11737
+ exitWithUsage([
11737
11738
  "batch \u2014 Execute multiple actions in parallel",
11738
11739
  "",
11739
11740
  "Usage:",
@@ -11770,7 +11771,7 @@ async function main() {
11770
11771
  if (command === "run-agent") {
11771
11772
  const appId = positionals[1];
11772
11773
  if (!appId) {
11773
- usageBlock([
11774
+ exitWithUsage([
11774
11775
  "run-agent \u2014 Run a pre-built agent and wait for the result",
11775
11776
  "",
11776
11777
  "Usage:",
@@ -11838,7 +11839,7 @@ async function main() {
11838
11839
  if (command === "upload" || command === "upload-file") {
11839
11840
  const filePath = positionals[1];
11840
11841
  if (!filePath) {
11841
- usageBlock([
11842
+ exitWithUsage([
11842
11843
  "upload \u2014 Upload a file to the MindStudio CDN (alias: upload-file)",
11843
11844
  "",
11844
11845
  "Usage:",
@@ -11869,7 +11870,7 @@ async function main() {
11869
11870
  if (command === "list-models-by-type" || command === "list-models-summary-by-type") {
11870
11871
  type = positionals[1];
11871
11872
  if (!type) {
11872
- usageBlock([
11873
+ exitWithUsage([
11873
11874
  `${command} \u2014 List AI models filtered by type`,
11874
11875
  "",
11875
11876
  "Usage:",
@@ -11924,7 +11925,7 @@ async function main() {
11924
11925
  if (command === "estimate-cost") {
11925
11926
  const stepMethod = positionals[1];
11926
11927
  if (!stepMethod) {
11927
- usageBlock([
11928
+ exitWithUsage([
11928
11929
  "estimate-cost \u2014 Estimate the cost of an action before running it",
11929
11930
  "",
11930
11931
  "Usage:",
@@ -11962,7 +11963,7 @@ async function main() {
11962
11963
  if (command === "change-name") {
11963
11964
  const name = positionals[1];
11964
11965
  if (!name) {
11965
- usageBlock([
11966
+ exitWithUsage([
11966
11967
  "change-name \u2014 Update your display name",
11967
11968
  "",
11968
11969
  "Usage:",
@@ -11981,7 +11982,7 @@ async function main() {
11981
11982
  if (command === "change-profile-picture") {
11982
11983
  const url = positionals[1];
11983
11984
  if (!url) {
11984
- usageBlock([
11985
+ exitWithUsage([
11985
11986
  "change-profile-picture \u2014 Update your profile picture",
11986
11987
  "",
11987
11988
  "Usage:",
@@ -12010,7 +12011,7 @@ async function main() {
12010
12011
  if (command === "info") {
12011
12012
  const rawMethod2 = positionals[1];
12012
12013
  if (!rawMethod2) {
12013
- usageBlock([
12014
+ exitWithUsage([
12014
12015
  "info \u2014 Show action details and parameters",
12015
12016
  "",
12016
12017
  "Usage:",
@@ -12031,7 +12032,7 @@ async function main() {
12031
12032
  }
12032
12033
  const split = findMethodSplit(process.argv.slice(2));
12033
12034
  if (!split) {
12034
- usageBlock([
12035
+ exitWithUsage([
12035
12036
  "Run an action directly",
12036
12037
  "",
12037
12038
  "Usage:",
@@ -811,7 +811,7 @@ export interface StepMethods {
811
811
  * @remarks
812
812
  * - The default model is wavespeed-tripo3d-h3.1 (Tripo v3.1), which makes a model from the prompt, from one `image`, or from `images`: 2–4 views of the same object, in order front, left, back, right.
813
813
  * - Models and what they take, set in `threeDModelOverride.config`:
814
- * - From text or an image: wavespeed-tripo3d-h3.1, wavespeed-meshy7.1 (also `images`, 1–4 views), wavespeed-hunyuan3d-v3 (an `image`, plus optional `back_image_url`, `left_image_url`, `right_image_url`), wavespeed-hunyuan-3d-v3.1-rapid, wavespeed-tripo3d-p2, wavespeed-rodin-v2.5 (`images`, 1–5).
814
+ * - From text or an image: wavespeed-tripo3d-h3.1, wavespeed-meshy7.1 (also `images`, 1–4 views), wavespeed-meshy-t2.5 (a low-poly mesh of up to 30,000 polygons), wavespeed-hunyuan3d-v3 (an `image`, plus optional `back_image_url`, `left_image_url`, `right_image_url`), wavespeed-hunyuan-3d-v3.1-rapid, wavespeed-tripo3d-p2, wavespeed-rodin-v2.5 (`images`, 1–5).
815
815
  * - From an image only: trellis-2, wavespeed-meshy7 (or `images`, 1–4 views), seed3d-2.0.
816
816
  * - From views: wavespeed-hi3d-v3.0 (`front_image`, and optional `back_image`, `left_image`, `right_image`).
817
817
  * - `$mode` in the config picks a model's mode (`text-to-3d`, `image-to-3d`, or its multi-view mode). Left out, `images` picks the multi-view mode and `image` picks image-to-3d; with neither, the model's default mode. A text mode needs the prompt; in the others the prompt is optional guidance.
@@ -828,7 +828,7 @@ export interface StepMethods {
828
828
  *
829
829
  * @remarks
830
830
  * - Prompts should be descriptive but concise (roughly 3–6 sentences).
831
- * - The default model is seedream-4.5. Options go in `imageModelOverride.config` under the model's own names, and differ by model, so look the model up before writing the call. Images to edit or draw from go there too, as URLs: `images` on most models, `source_images` on the Gemini and GPT Image models, one `image` on qwen-image, z-image-turbo, krea-v2-turbo, ideogram-v4 and the MAI models, `source_image` on Grok Imagine, `image_url` on the Ideogram remix and FLUX Kontext models, and `reference` on krea-v2-large.
831
+ * - The default model is seedream-4.5. Options go in `imageModelOverride.config` under the model's own names, and differ by model, so look the model up before writing the call. Images to edit or draw from go there too, as URLs: `images` on most models, `source_images` on the Gemini and GPT Image models, one `image` on qwen-image, z-image-turbo, krea-v2-turbo, ideogram-v4 and ideogram-v4.5, `source_image` on Grok Imagine, `image_url` on the Ideogram remix and FLUX Kontext models, and `reference` on krea-v2-large.
832
832
  * - A model that makes and edits images by separate means takes `$mode` in its config (`text-to-image`, and `edit`, `image-edit` or `image-to-image`, as it lists). Left out, images in the config pick the edit mode, and otherwise the model makes the image from the prompt.
833
833
  * - Images are hosted on the public CDN by default, or in one of the app's own file stores when the call passes `store` — a private store keeps the image private.
834
834
  * - In foreground mode, the image is displayed to the user. In background mode, the URL is saved to a variable.
package/dist/index.js CHANGED
@@ -169,7 +169,7 @@ function clearPendingTimer(p) {
169
169
  p.timer = null;
170
170
  }
171
171
  }
172
- function forget(self, id) {
172
+ function dropSettledRequest(self, id) {
173
173
  self.pending.delete(id);
174
174
  self.inbound.delete(id);
175
175
  if (self.retired && self.pending.size === 0) {
@@ -203,7 +203,7 @@ function retire(self, reason) {
203
203
  function armIdleTimer(self, id, p) {
204
204
  clearPendingTimer(p);
205
205
  p.timer = setTimeout(() => {
206
- forget(self, id);
206
+ dropSettledRequest(self, id);
207
207
  retire(self, "a reply went silent");
208
208
  p.reject(new DbWsTransportError("ws reply went silent", true));
209
209
  }, WS_IDLE_TIMEOUT_MS);
@@ -214,13 +214,14 @@ function deliver(self, msg) {
214
214
  return;
215
215
  }
216
216
  clearPendingTimer(p);
217
- forget(self, msg.id);
217
+ dropSettledRequest(self, msg.id);
218
218
  if (msg.error) {
219
+ const status = typeof msg.error.status === "number" && Number.isInteger(msg.error.status) && msg.error.status >= 400 && msg.error.status <= 599 ? msg.error.status : 400;
219
220
  p.reject(
220
221
  new MindStudioError(
221
222
  `[db] ${msg.error.message || "Database query failed"}`,
222
223
  msg.error.code || "db_query_error",
223
- 400,
224
+ status,
224
225
  msg.error
225
226
  )
226
227
  );
@@ -235,7 +236,7 @@ function failTransport(self, id, err) {
235
236
  return;
236
237
  }
237
238
  clearPendingTimer(p);
238
- forget(self, id);
239
+ dropSettledRequest(self, id);
239
240
  p.reject(err);
240
241
  }
241
242
  function getOrOpen(url, token) {
@@ -388,7 +389,7 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
388
389
  return await new Promise((resolve, reject) => {
389
390
  const pending = { resolve, reject, timer: null, acked: false };
390
391
  pending.timer = setTimeout(() => {
391
- forget(self, id);
392
+ dropSettledRequest(self, id);
392
393
  retire(self, "a request went unacknowledged");
393
394
  reject(new DbWsTransportError("ws ack timed out", true));
394
395
  }, WS_ACK_TIMEOUT_MS);
@@ -403,7 +404,7 @@ async function executeDbBatchOverWs(url, token, databaseId, queries) {
403
404
  complete = true;
404
405
  } catch (err) {
405
406
  clearPendingTimer(pending);
406
- forget(self, id);
407
+ dropSettledRequest(self, id);
407
408
  if (started) {
408
409
  retire(self, "a partial request upload failed");
409
410
  }
@@ -1608,7 +1609,7 @@ function nestedComparison(node, negated, params) {
1608
1609
  function withNulls(core, field, nullsMatch) {
1609
1610
  return nullsMatch ? `(${core} OR ${field.sql} IS NULL)` : core;
1610
1611
  }
1611
- function readsBackAsWritten(value) {
1612
+ function isNonJsonString(value) {
1612
1613
  if (typeof value !== "string") {
1613
1614
  return false;
1614
1615
  }
@@ -1646,7 +1647,7 @@ function compileNode(node, negated, columns, params) {
1646
1647
  const type = column(node.field)?.type;
1647
1648
  if (type === "json") {
1648
1649
  const strictEquals = node.op === "===" ? !negated : node.op === "!==" ? negated : null;
1649
- return strictEquals !== null && readsBackAsWritten(node.value) ? jsonColumnIn(node.field, [node.value], !strictEquals, params) : null;
1650
+ return strictEquals !== null && isNonJsonString(node.value) ? jsonColumnIn(node.field, [node.value], !strictEquals, params) : null;
1650
1651
  }
1651
1652
  if (!type || typeof node.value !== VALUE_KIND[type]) {
1652
1653
  return null;
@@ -1676,7 +1677,7 @@ function compileNode(node, negated, columns, params) {
1676
1677
  case "in": {
1677
1678
  const type = column(node.field)?.type;
1678
1679
  if (type === "json") {
1679
- return node.values.every(readsBackAsWritten) ? jsonColumnIn(node.field, node.values, negated, params) : null;
1680
+ return node.values.every(isNonJsonString) ? jsonColumnIn(node.field, node.values, negated, params) : null;
1680
1681
  }
1681
1682
  if (!type || node.values.some(
1682
1683
  (v) => v !== null && v !== void 0 && typeof v !== VALUE_KIND[type]
@@ -5188,7 +5189,7 @@ var stepMetadata = {
5188
5189
  "generate3dModel": {
5189
5190
  stepType: "generate3dModel",
5190
5191
  description: "Generate a 3D model using a 3D generation model.",
5191
- usageNotes: "- The default model is wavespeed-tripo3d-h3.1 (Tripo v3.1), which makes a model from the prompt, from one `image`, or from `images`: 2\u20134 views of the same object, in order front, left, back, right.\n- Models and what they take, set in `threeDModelOverride.config`:\n - From text or an image: wavespeed-tripo3d-h3.1, wavespeed-meshy7.1 (also `images`, 1\u20134 views), wavespeed-hunyuan3d-v3 (an `image`, plus optional `back_image_url`, `left_image_url`, `right_image_url`), wavespeed-hunyuan-3d-v3.1-rapid, wavespeed-tripo3d-p2, wavespeed-rodin-v2.5 (`images`, 1\u20135).\n - From an image only: trellis-2, wavespeed-meshy7 (or `images`, 1\u20134 views), seed3d-2.0.\n - From views: wavespeed-hi3d-v3.0 (`front_image`, and optional `back_image`, `left_image`, `right_image`).\n- `$mode` in the config picks a model's mode (`text-to-3d`, `image-to-3d`, or its multi-view mode). Left out, `images` picks the multi-view mode and `image` picks image-to-3d; with neither, the model's default mode. A text mode needs the prompt; in the others the prompt is optional guidance.\n- The output is standardized as a GLB URL plus optional FBX/OBJ/USDZ, thumbnail, texture maps, and provider task ID.",
5192
+ usageNotes: "- The default model is wavespeed-tripo3d-h3.1 (Tripo v3.1), which makes a model from the prompt, from one `image`, or from `images`: 2\u20134 views of the same object, in order front, left, back, right.\n- Models and what they take, set in `threeDModelOverride.config`:\n - From text or an image: wavespeed-tripo3d-h3.1, wavespeed-meshy7.1 (also `images`, 1\u20134 views), wavespeed-meshy-t2.5 (a low-poly mesh of up to 30,000 polygons), wavespeed-hunyuan3d-v3 (an `image`, plus optional `back_image_url`, `left_image_url`, `right_image_url`), wavespeed-hunyuan-3d-v3.1-rapid, wavespeed-tripo3d-p2, wavespeed-rodin-v2.5 (`images`, 1\u20135).\n - From an image only: trellis-2, wavespeed-meshy7 (or `images`, 1\u20134 views), seed3d-2.0.\n - From views: wavespeed-hi3d-v3.0 (`front_image`, and optional `back_image`, `left_image`, `right_image`).\n- `$mode` in the config picks a model's mode (`text-to-3d`, `image-to-3d`, or its multi-view mode). Left out, `images` picks the multi-view mode and `image` picks image-to-3d; with neither, the model's default mode. A text mode needs the prompt; in the others the prompt is optional guidance.\n- The output is standardized as a GLB URL plus optional FBX/OBJ/USDZ, thumbnail, texture maps, and provider task ID.",
5192
5193
  inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt for text-to-3D models, or optional guidance for image-to-3D models" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "threeDModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "3D generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default 3D model if not specified" } } },
5193
5194
  outputSchema: { "type": "object", "properties": { "prompt": { "type": "string" }, "glbUrl": { "type": "string" }, "fbxUrl": { "type": "string" }, "objUrl": { "type": "string" }, "usdzUrl": { "type": "string" }, "thumbnailUrl": { "type": "string" }, "textureUrls": { "type": "array", "items": { "type": "object", "properties": {}, "required": [] } }, "providerTaskId": { "type": "string" }, "resolvedConfig": { "type": "object", "properties": {}, "required": [] } }, "required": ["glbUrl"] }
5194
5195
  },
@@ -5202,7 +5203,7 @@ var stepMetadata = {
5202
5203
  "generateImage": {
5203
5204
  stepType: "generateImage",
5204
5205
  description: "Generate an image from a text prompt, or edit one, using an AI model.",
5205
- usageNotes: "- Prompts should be descriptive but concise (roughly 3\u20136 sentences).\n- The default model is seedream-4.5. Options go in `imageModelOverride.config` under the model's own names, and differ by model, so look the model up before writing the call. Images to edit or draw from go there too, as URLs: `images` on most models, `source_images` on the Gemini and GPT Image models, one `image` on qwen-image, z-image-turbo, krea-v2-turbo, ideogram-v4 and the MAI models, `source_image` on Grok Imagine, `image_url` on the Ideogram remix and FLUX Kontext models, and `reference` on krea-v2-large.\n- A model that makes and edits images by separate means takes `$mode` in its config (`text-to-image`, and `edit`, `image-edit` or `image-to-image`, as it lists). Left out, images in the config pick the edit mode, and otherwise the model makes the image from the prompt.\n- Images are hosted on the public CDN by default, or in one of the app's own file stores when the call passes `store` \u2014 a private store keeps the image private.\n- In foreground mode, the image is displayed to the user. In background mode, the URL is saved to a variable.\n- When generateVariants is true with numVariants > 1 (up to 10), the images are generated in parallel. One that fails is left out of the URLs returned, and the step fails only when every one does.\n- In direct execution, foreground mode behaves as background, and userSelect variant behavior behaves as saveAll.",
5206
+ usageNotes: "- Prompts should be descriptive but concise (roughly 3\u20136 sentences).\n- The default model is seedream-4.5. Options go in `imageModelOverride.config` under the model's own names, and differ by model, so look the model up before writing the call. Images to edit or draw from go there too, as URLs: `images` on most models, `source_images` on the Gemini and GPT Image models, one `image` on qwen-image, z-image-turbo, krea-v2-turbo, ideogram-v4 and ideogram-v4.5, `source_image` on Grok Imagine, `image_url` on the Ideogram remix and FLUX Kontext models, and `reference` on krea-v2-large.\n- A model that makes and edits images by separate means takes `$mode` in its config (`text-to-image`, and `edit`, `image-edit` or `image-to-image`, as it lists). Left out, images in the config pick the edit mode, and otherwise the model makes the image from the prompt.\n- Images are hosted on the public CDN by default, or in one of the app's own file stores when the call passes `store` \u2014 a private store keeps the image private.\n- In foreground mode, the image is displayed to the user. In background mode, the URL is saved to a variable.\n- When generateVariants is true with numVariants > 1 (up to 10), the images are generated in parallel. One that fails is left out of the URLs returned, and the step fails only when every one does.\n- In direct execution, foreground mode behaves as background, and userSelect variant behavior behaves as saveAll.",
5206
5207
  inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the image to generate" }, "intermediateAsset": { "type": "boolean", "description": "When true, the asset is created but hidden from the user's gallery (tagged as intermediate)" }, "imageModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Image generation model identifier" }, "config": { "type": "object", "properties": {}, "required": [], "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default image model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple image variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated image.\n\nThe watermark is a product mark on assets generated in the MindStudio UI. A step run directly via the SDK or API is producing the app's own asset, so it is never watermarked and this flag has no effect there." } }, "required": ["prompt"] },
5207
5208
  outputSchema: { "type": "object", "properties": { "imageUrl": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["imageUrl"] }
5208
5209
  },