@mindstudio-ai/agent 0.1.42 → 0.1.43

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
@@ -3489,6 +3489,9 @@ function resolveStepType(name) {
3489
3489
  return meta ? meta.stepType : name;
3490
3490
  }
3491
3491
  function resolveToken(provided, config) {
3492
+ const rctx = getRequestContext();
3493
+ if (rctx?.callbackToken)
3494
+ return { token: rctx.callbackToken, authType: "internal" };
3492
3495
  if (process.env.CALLBACK_TOKEN)
3493
3496
  return { token: process.env.CALLBACK_TOKEN, authType: "internal" };
3494
3497
  if (provided) return { token: provided, authType: "apiKey" };
@@ -3592,7 +3595,8 @@ var init_client = __esm({
3592
3595
  constructor(options = {}) {
3593
3596
  const config = loadConfig();
3594
3597
  const { token, authType } = resolveToken(options.apiKey, config);
3595
- const baseUrl = options.baseUrl ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? config.baseUrl ?? DEFAULT_BASE_URL;
3598
+ const rctx = getRequestContext();
3599
+ const baseUrl = options.baseUrl ?? rctx?.remoteHostname ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? config.baseUrl ?? DEFAULT_BASE_URL;
3596
3600
  this._reuseThreadId = options.reuseThreadId ?? /^(true|1)$/i.test(process.env.MINDSTUDIO_REUSE_THREAD_ID ?? "");
3597
3601
  this._appId = options.appId ?? process.env.MINDSTUDIO_APP_ID ?? void 0;
3598
3602
  this._authType = authType;
@@ -5193,7 +5197,7 @@ async function startMcpServer(options) {
5193
5197
  capabilities: { tools: {} },
5194
5198
  serverInfo: {
5195
5199
  name: "mindstudio-agent",
5196
- version: "0.1.42"
5200
+ version: "0.1.43"
5197
5201
  },
5198
5202
  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.'
5199
5203
  });
@@ -6150,7 +6154,7 @@ function isNewerVersion(current, latest) {
6150
6154
  return false;
6151
6155
  }
6152
6156
  async function checkForUpdate() {
6153
- const currentVersion = "0.1.42";
6157
+ const currentVersion = "0.1.43";
6154
6158
  if (!currentVersion) return null;
6155
6159
  try {
6156
6160
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6179,7 +6183,7 @@ async function checkForUpdate() {
6179
6183
  }
6180
6184
  }
6181
6185
  function printUpdateNotice(latestVersion) {
6182
- const currentVersion = "0.1.42";
6186
+ const currentVersion = "0.1.43";
6183
6187
  process.stderr.write(
6184
6188
  `
6185
6189
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6192,7 +6196,7 @@ function isStandaloneBinary() {
6192
6196
  return !argv1.includes("node_modules");
6193
6197
  }
6194
6198
  async function cmdUpdate() {
6195
- const currentVersion = "0.1.42";
6199
+ const currentVersion = "0.1.43";
6196
6200
  process.stderr.write(
6197
6201
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6198
6202
  `
@@ -6327,7 +6331,7 @@ async function cmdLogin(options) {
6327
6331
  process.stderr.write("\n");
6328
6332
  printLogo();
6329
6333
  process.stderr.write("\n");
6330
- const ver = "0.1.42";
6334
+ const ver = "0.1.43";
6331
6335
  process.stderr.write(
6332
6336
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6333
6337
  `
@@ -6654,7 +6658,7 @@ async function main() {
6654
6658
  try {
6655
6659
  if (command === "version" || command === "-v") {
6656
6660
  process.stdout.write(
6657
- "0.1.42\n"
6661
+ "0.1.43\n"
6658
6662
  );
6659
6663
  return;
6660
6664
  }
package/dist/index.js CHANGED
@@ -3423,7 +3423,8 @@ var MindStudioAgent = class {
3423
3423
  constructor(options = {}) {
3424
3424
  const config = loadConfig();
3425
3425
  const { token, authType } = resolveToken(options.apiKey, config);
3426
- const baseUrl = options.baseUrl ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? config.baseUrl ?? DEFAULT_BASE_URL;
3426
+ const rctx = getRequestContext();
3427
+ const baseUrl = options.baseUrl ?? rctx?.remoteHostname ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? config.baseUrl ?? DEFAULT_BASE_URL;
3427
3428
  this._reuseThreadId = options.reuseThreadId ?? /^(true|1)$/i.test(process.env.MINDSTUDIO_REUSE_THREAD_ID ?? "");
3428
3429
  this._appId = options.appId ?? process.env.MINDSTUDIO_APP_ID ?? void 0;
3429
3430
  this._authType = authType;
@@ -4406,6 +4407,9 @@ function resolveStepType(name) {
4406
4407
  return meta ? meta.stepType : name;
4407
4408
  }
4408
4409
  function resolveToken(provided, config) {
4410
+ const rctx = getRequestContext();
4411
+ if (rctx?.callbackToken)
4412
+ return { token: rctx.callbackToken, authType: "internal" };
4409
4413
  if (process.env.CALLBACK_TOKEN)
4410
4414
  return { token: process.env.CALLBACK_TOKEN, authType: "internal" };
4411
4415
  if (provided) return { token: provided, authType: "apiKey" };