@mindstudio-ai/agent 0.1.137 → 0.1.138

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.
@@ -5191,7 +5191,7 @@ function logTaskResult(result) {
5191
5191
  }
5192
5192
  const toolSummary = result.toolCalls.map((tc) => `${tc.name} (${tc.durationMs}ms) ${tc.success ? "\u2713" : "\u2717"}`).join(", ");
5193
5193
  console.log(
5194
- `[task] ${result.turns} turn${result.turns === 1 ? "" : "s"}` + (toolSummary ? `: ${toolSummary}` : "") + ` | ${result.parsedSuccessfully ? "output OK" : "\u26A0 output not valid JSON"} | cost: ${result.usage.totalBillingCost}`
5194
+ `[task] ${result.turns} turn${result.turns === 1 ? "" : "s"}` + (toolSummary ? `: ${toolSummary}` : "") + ` | ${result.parsedSuccessfully ? "output OK" : "\u26A0 output not valid JSON"} | cost: ${result.usage.totalBillingCost} | trace: ${result.traceId}`
5195
5195
  );
5196
5196
  }
5197
5197
  async function runTaskPoll(httpConfig, body) {
@@ -5686,7 +5686,8 @@ ${structuredOutputExample}
5686
5686
  errors,
5687
5687
  turns: loopCount,
5688
5688
  usage: totalUsage,
5689
- toolCalls: toolCallLog
5689
+ toolCalls: toolCallLog,
5690
+ traceId
5690
5691
  }
5691
5692
  );
5692
5693
  };
@@ -5700,7 +5701,12 @@ ${structuredOutputExample}
5700
5701
  `[task] ${err.message}`,
5701
5702
  "task_execution_error",
5702
5703
  500,
5703
- { turns: loopCount, usage: totalUsage, toolCalls: toolCallLog }
5704
+ {
5705
+ turns: loopCount,
5706
+ usage: totalUsage,
5707
+ toolCalls: toolCallLog,
5708
+ traceId
5709
+ }
5704
5710
  );
5705
5711
  }
5706
5712
  return finish(buildResult(null, "", false, loopCount));
@@ -5709,7 +5715,8 @@ ${structuredOutputExample}
5709
5715
  throw new MindStudioError(
5710
5716
  `[task] ${err.message}`,
5711
5717
  err.errorCode ?? "task_turn_error",
5712
- err.status ?? 500
5718
+ err.status ?? 500,
5719
+ { traceId }
5713
5720
  );
5714
5721
  }
5715
5722
  throw err;
@@ -5773,9 +5780,13 @@ ${structuredOutputExample}
5773
5780
  isError: true
5774
5781
  };
5775
5782
  }
5783
+ } else if (kind === "method") {
5784
+ result = await deps.executeMethodTool(toolCall.name, mergedInput, {
5785
+ traceId,
5786
+ toolCallId: toolCall.id
5787
+ });
5776
5788
  } else {
5777
- const execute = kind === "method" ? deps.executeMethodTool : deps.executeStepTool;
5778
- result = await execute(toolCall.name, mergedInput);
5789
+ result = await deps.executeStepTool(toolCall.name, mergedInput);
5779
5790
  }
5780
5791
  toolCallLog.push({
5781
5792
  name: toolCall.name,
@@ -7086,7 +7097,7 @@ var init_client = __esm({
7086
7097
  };
7087
7098
  }
7088
7099
  },
7089
- executeMethodTool: async (methodId, input) => {
7100
+ executeMethodTool: async (methodId, input, call) => {
7090
7101
  try {
7091
7102
  const { data } = await request(
7092
7103
  { ...httpConfig, maxRetries: 0 },
@@ -7094,7 +7105,9 @@ var init_client = __esm({
7094
7105
  "/task/invoke-method",
7095
7106
  {
7096
7107
  methodId,
7097
- input
7108
+ input,
7109
+ traceId: call.traceId,
7110
+ toolCallId: call.toolCallId
7098
7111
  }
7099
7112
  );
7100
7113
  if (data.error) {
@@ -8627,7 +8640,7 @@ function buildReferenceDocs(data) {
8627
8640
 
8628
8641
  User-typed columns: The \`User\` type is just \`string\` at runtime. Write plain UUIDs to user-typed columns \u2014 do NOT add a \`@@user@@\` prefix manually and do NOT use \`as any\`. The SDK adds and strips the prefix automatically on read/write. If TypeScript complains about assigning a plain string to a \`User\` field, use \`db.userRef(id)\` to type-cast cleanly. Reads always return bare UUIDs; use \`resolveUser(id)\` when you need display info (name, email, avatar). Never do your own prefix handling \u2014 it will fight the SDK and cause double-prefixing or orphan refs. The \`@@user@@\` prefix is only visible in storage if you bypass the SDK with raw SQL; app code should never see or produce it.
8629
8642
 
8630
- Task agents: For multi-step tasks requiring autonomous tool use, use \`runTask()\`. Provide a prompt, input, a set of tools, an output contract, and a model. The SDK runs a tool-use loop and returns structured output. Prefer \`outputSchema\` for the output contract: plain JSON Schema (\`type\`/\`properties\`/\`required\`/\`enum\`/\`items\`; nullable via type arrays like \`["string","null"]\` \u2014 never \`nullable: true\`, never \`oneOf\`/\`$ref\`). Output is validated every turn with automatic repair and \`result.output\` is typed by inference from the schema \u2014 no generic argument and no \`parsedSuccessfully\` check needed; the call throws \`MindStudioError\` code \`task_output_schema_mismatch\` instead of ever returning nonconforming output. The legacy \`structuredOutputExample\` option (example object the model imitates) still works but is unvalidated \u2014 always check \`result.parsedSuccessfully\` before using its output. \`result.traceId\` is a stable id for the task's model transcript \u2014 inside a jewel, attach it to the propose/grade return (\`trace: task.traceId\`) to preserve the transcript with the pair. Tools can include any SDK action \u2014 e.g. \`['searchGoogle', 'fetchUrl', { method: 'generateImage', defaults: { imageModelOverride: { model: 'seedream-4.5' } } }]\` \u2014 plus the app's own methods (\`{ appMethod: 'save-vendor', description: 'when to use it' }\`, run as the user who invoked the method that started the task) and inline functions (\`{ name, description, inputSchema, execute }\` \u2014 the function runs in the calling process; thrown errors go back to the model as tool output; no \`defaults\`). Supports SSE streaming via \`onEvent\` callback.
8643
+ Task agents: For multi-step tasks requiring autonomous tool use, use \`runTask()\`. Provide a prompt, input, a set of tools, an output contract, and a model. The SDK runs a tool-use loop and returns structured output. Prefer \`outputSchema\` for the output contract: plain JSON Schema (\`type\`/\`properties\`/\`required\`/\`enum\`/\`items\`; nullable via type arrays like \`["string","null"]\` \u2014 never \`nullable: true\`, never \`oneOf\`/\`$ref\`). Output is validated every turn with automatic repair and \`result.output\` is typed by inference from the schema \u2014 no generic argument and no \`parsedSuccessfully\` check needed; the call throws \`MindStudioError\` code \`task_output_schema_mismatch\` instead of ever returning nonconforming output. The legacy \`structuredOutputExample\` option (example object the model imitates) still works but is unvalidated \u2014 always check \`result.parsedSuccessfully\` before using its output. \`result.traceId\` is a stable id for the task's model transcript, which the platform records for every task (\`remy-admin tasks get <traceId>\` reads it back) \u2014 inside a jewel, also attach it to the propose/grade return (\`trace: task.traceId\`) to preserve the transcript with the pair. Tools can include any SDK action \u2014 e.g. \`['searchGoogle', 'fetchUrl', { method: 'generateImage', defaults: { imageModelOverride: { model: 'seedream-4.5' } } }]\` \u2014 plus the app's own methods (\`{ appMethod: 'save-vendor', description: 'when to use it' }\`, run as the user who invoked the method that started the task) and inline functions (\`{ name, description, inputSchema, execute }\` \u2014 the function runs in the calling process; thrown errors go back to the model as tool output; no \`defaults\`). \`onEvent\` receives each turn's events (text, thinking, tool calls and results) as the turn completes.
8631
8644
 
8632
8645
  Uploading files / getting a hosted URL: For app file storage (user uploads, generated documents, images, marketing assets), use the \`files\` store \u2014 define a store at module scope and call \`await SomeStore.put(bytes, { contentType?, filename? })\` \u2192 returns \`{ url }\` served on the app's own domain (private by default; use a public store for world-readable assets). \`bytes\` is a \`Buffer\`/\`Uint8Array\`, so read/fetch the content first. The older \`mindstudio.uploadFile(...)\` (and the \`mindstudio upload <filepath>\` CLI) upload to the shared account media CDN and are DEPRECATED for app storage \u2014 they remain only for account-level one-off assets (e.g. an agent avatar for \`changeProfilePicture\`). Actions that generate a file (generateImage, generateVideo, generateSpeech, generatePdf, upscaleImage, \u2026) can write their output directly into a store: pass the store handle as \`store\` in the options object, e.g. \`await mindstudio.generateImage({ prompt }, { store: Assets })\`. It's optional \u2014 omit it and the asset goes to the shared CDN as before. More generally: some SDK capabilities are exposed as \`mindstudio\` CLI commands (list-actions, run-agent, exec, batch, \u2026), not only as code \u2014 reach for the CLI for one-off operations instead of writing and running code.
8633
8646
 
@@ -9234,7 +9247,7 @@ async function startMcpServer(options) {
9234
9247
  capabilities: { tools: {} },
9235
9248
  serverInfo: {
9236
9249
  name: "mindstudio-agent",
9237
- version: "0.1.137"
9250
+ version: "0.1.138"
9238
9251
  },
9239
9252
  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.'
9240
9253
  });
@@ -10149,7 +10162,7 @@ function isNewerVersion(current, latest) {
10149
10162
  return false;
10150
10163
  }
10151
10164
  async function checkForUpdate() {
10152
- const currentVersion = "0.1.137";
10165
+ const currentVersion = "0.1.138";
10153
10166
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
10154
10167
  return null;
10155
10168
  }
@@ -10184,7 +10197,7 @@ async function checkForUpdate() {
10184
10197
  }
10185
10198
  }
10186
10199
  function printUpdateNotice(latestVersion) {
10187
- const currentVersion = "0.1.137";
10200
+ const currentVersion = "0.1.138";
10188
10201
  process.stderr.write(
10189
10202
  `
10190
10203
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -10197,7 +10210,7 @@ function isStandaloneBinary() {
10197
10210
  return !argv1.includes("node_modules");
10198
10211
  }
10199
10212
  async function cmdUpdate() {
10200
- const currentVersion = "0.1.137";
10213
+ const currentVersion = "0.1.138";
10201
10214
  process.stderr.write(
10202
10215
  ` ${ansi2.gray("Current version:")} ${currentVersion}
10203
10216
  `
@@ -10318,7 +10331,7 @@ async function cmdLogin(options) {
10318
10331
  process.stderr.write("\n");
10319
10332
  printLogo();
10320
10333
  process.stderr.write("\n");
10321
- const ver = "0.1.137";
10334
+ const ver = "0.1.138";
10322
10335
  process.stderr.write(
10323
10336
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
10324
10337
  `
@@ -10630,7 +10643,7 @@ async function main() {
10630
10643
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
10631
10644
  try {
10632
10645
  if (command === "version" || command === "-v") {
10633
- process.stdout.write("0.1.137\n");
10646
+ process.stdout.write("0.1.138\n");
10634
10647
  return;
10635
10648
  }
10636
10649
  if (command === "login") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.137",
3
+ "version": "0.1.138",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",