@mindstudio-ai/agent 0.1.49 → 0.1.51

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
@@ -1287,15 +1287,25 @@ var init_http = __esm({
1287
1287
  });
1288
1288
 
1289
1289
  // src/context.ts
1290
- import { AsyncLocalStorage } from "async_hooks";
1291
1290
  function getRequestContext() {
1292
1291
  return als.getStore();
1293
1292
  }
1294
- var als;
1293
+ var noopAls, als;
1295
1294
  var init_context = __esm({
1296
- "src/context.ts"() {
1295
+ async "src/context.ts"() {
1297
1296
  "use strict";
1298
- als = new AsyncLocalStorage();
1297
+ noopAls = {
1298
+ getStore: () => void 0,
1299
+ run: (_store, fn) => fn()
1300
+ };
1301
+ als = noopAls;
1302
+ try {
1303
+ if (typeof process !== "undefined" && process.versions?.node) {
1304
+ const mod = await import("async_hooks");
1305
+ als = new mod.AsyncLocalStorage();
1306
+ }
1307
+ } catch {
1308
+ }
1299
1309
  }
1300
1310
  });
1301
1311
 
@@ -3198,11 +3208,11 @@ async function runTaskStream(httpConfig, body, onEvent) {
3198
3208
  return result;
3199
3209
  }
3200
3210
  var init_task = __esm({
3201
- "src/task/index.ts"() {
3211
+ async "src/task/index.ts"() {
3202
3212
  "use strict";
3203
3213
  init_http();
3204
3214
  init_errors();
3205
- init_context();
3215
+ await init_context();
3206
3216
  init_metadata();
3207
3217
  }
3208
3218
  });
@@ -3732,16 +3742,16 @@ function resolveToken(provided, config) {
3732
3742
  }
3733
3743
  var DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, MindStudioAgent;
3734
3744
  var init_client = __esm({
3735
- "src/client.ts"() {
3745
+ async "src/client.ts"() {
3736
3746
  "use strict";
3737
3747
  init_http();
3738
3748
  init_errors();
3739
- init_context();
3749
+ await init_context();
3740
3750
  init_rate_limit();
3741
3751
  init_config();
3742
3752
  init_auth();
3743
3753
  init_db();
3744
- init_task();
3754
+ await init_task();
3745
3755
  init_steps();
3746
3756
  init_metadata();
3747
3757
  DEFAULT_BASE_URL = "https://v1.mindstudio-api.com";
@@ -5481,10 +5491,10 @@ async function cmdAsk(question, options) {
5481
5491
  }
5482
5492
  var DEFAULT_BASE_URL2, ansi;
5483
5493
  var init_ask = __esm({
5484
- "src/ask/index.ts"() {
5494
+ async "src/ask/index.ts"() {
5485
5495
  "use strict";
5486
5496
  init_config();
5487
- init_client();
5497
+ await init_client();
5488
5498
  init_sse();
5489
5499
  init_tools();
5490
5500
  init_prompt2();
@@ -5559,7 +5569,7 @@ async function startMcpServer(options) {
5559
5569
  capabilities: { tools: {} },
5560
5570
  serverInfo: {
5561
5571
  name: "mindstudio-agent",
5562
- version: "0.1.49"
5572
+ version: "0.1.51"
5563
5573
  },
5564
5574
  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.'
5565
5575
  });
@@ -5575,7 +5585,7 @@ async function startMcpServer(options) {
5575
5585
  try {
5576
5586
  let result;
5577
5587
  if (toolName === "ask") {
5578
- const { runAsk: runAsk2 } = await Promise.resolve().then(() => (init_ask(), ask_exports));
5588
+ const { runAsk: runAsk2 } = await init_ask().then(() => ask_exports);
5579
5589
  result = await runAsk2(
5580
5590
  args.question,
5581
5591
  options
@@ -5709,9 +5719,9 @@ async function startMcpServer(options) {
5709
5719
  }
5710
5720
  var MCP_PROTOCOL_VERSION, MIME_TYPES, ASK_TOOL, HELPER_DESCRIPTIONS, HELPER_TOOLS;
5711
5721
  var init_mcp = __esm({
5712
- "src/mcp.ts"() {
5722
+ async "src/mcp.ts"() {
5713
5723
  "use strict";
5714
- init_client();
5724
+ await init_client();
5715
5725
  init_errors();
5716
5726
  MCP_PROTOCOL_VERSION = "2024-11-05";
5717
5727
  MIME_TYPES = {
@@ -6248,7 +6258,7 @@ function formatPropType(prop) {
6248
6258
  return "string";
6249
6259
  }
6250
6260
  async function cmdExec(method, input, options) {
6251
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6261
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6252
6262
  await Promise.resolve().then(() => (init_steps(), steps_exports)).then(
6253
6263
  (m) => m.applyStepMethods(MindStudioAgent2)
6254
6264
  );
@@ -6301,7 +6311,7 @@ async function cmdExec(method, input, options) {
6301
6311
  }
6302
6312
  }
6303
6313
  async function cmdAgents(asJson, options) {
6304
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6314
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6305
6315
  const agent = new MindStudioAgent2({
6306
6316
  apiKey: options.apiKey,
6307
6317
  baseUrl: options.baseUrl
@@ -6330,7 +6340,7 @@ async function cmdAgents(asJson, options) {
6330
6340
  }
6331
6341
  }
6332
6342
  function createAgent(options) {
6333
- return Promise.resolve().then(() => (init_client(), client_exports)).then(
6343
+ return init_client().then(() => client_exports).then(
6334
6344
  ({ MindStudioAgent: MindStudioAgent2 }) => new MindStudioAgent2({
6335
6345
  apiKey: options.apiKey,
6336
6346
  baseUrl: options.baseUrl
@@ -6386,7 +6396,7 @@ async function cmdChangeProfilePicture(url, options) {
6386
6396
  `);
6387
6397
  }
6388
6398
  async function cmdRun(appId, variables, options) {
6389
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6399
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6390
6400
  const agent = new MindStudioAgent2({
6391
6401
  apiKey: options.apiKey,
6392
6402
  baseUrl: options.baseUrl
@@ -6482,7 +6492,7 @@ async function cmdUpload(filePath, options) {
6482
6492
  if (!ext) fatal("Cannot determine file extension. Please provide a file with an extension.");
6483
6493
  const content = readFileSync3(filePath);
6484
6494
  const mimeType = MIME_TYPES2[ext];
6485
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6495
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6486
6496
  const agent = new MindStudioAgent2({
6487
6497
  apiKey: options.apiKey,
6488
6498
  baseUrl: options.baseUrl
@@ -6516,7 +6526,7 @@ function isNewerVersion(current, latest) {
6516
6526
  return false;
6517
6527
  }
6518
6528
  async function checkForUpdate() {
6519
- const currentVersion = "0.1.49";
6529
+ const currentVersion = "0.1.51";
6520
6530
  if (!currentVersion) return null;
6521
6531
  try {
6522
6532
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6545,7 +6555,7 @@ async function checkForUpdate() {
6545
6555
  }
6546
6556
  }
6547
6557
  function printUpdateNotice(latestVersion) {
6548
- const currentVersion = "0.1.49";
6558
+ const currentVersion = "0.1.51";
6549
6559
  process.stderr.write(
6550
6560
  `
6551
6561
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6558,7 +6568,7 @@ function isStandaloneBinary() {
6558
6568
  return !argv1.includes("node_modules");
6559
6569
  }
6560
6570
  async function cmdUpdate() {
6561
- const currentVersion = "0.1.49";
6571
+ const currentVersion = "0.1.51";
6562
6572
  process.stderr.write(
6563
6573
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6564
6574
  `
@@ -6693,7 +6703,7 @@ async function cmdLogin(options) {
6693
6703
  process.stderr.write("\n");
6694
6704
  printLogo();
6695
6705
  process.stderr.write("\n");
6696
- const ver = "0.1.49";
6706
+ const ver = "0.1.51";
6697
6707
  process.stderr.write(
6698
6708
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6699
6709
  `
@@ -6843,7 +6853,7 @@ async function cmdWhoami(options) {
6843
6853
  for (const line of detail) process.stderr.write(line + "\n");
6844
6854
  process.stderr.write(` ${ansi2.gray("Verifying...")} `);
6845
6855
  try {
6846
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6856
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6847
6857
  const agent = new MindStudioAgent2({
6848
6858
  apiKey: options.apiKey,
6849
6859
  baseUrl: options.baseUrl
@@ -7020,7 +7030,7 @@ async function main() {
7020
7030
  try {
7021
7031
  if (command === "version" || command === "-v") {
7022
7032
  process.stdout.write(
7023
- "0.1.49\n"
7033
+ "0.1.51\n"
7024
7034
  );
7025
7035
  return;
7026
7036
  }
@@ -7071,7 +7081,7 @@ async function main() {
7071
7081
  ` mindstudio ask "what's the difference between generateText and userMessage?"`
7072
7082
  ]);
7073
7083
  }
7074
- const { cmdAsk: cmdAsk2 } = await Promise.resolve().then(() => (init_ask(), ask_exports));
7084
+ const { cmdAsk: cmdAsk2 } = await init_ask().then(() => ask_exports);
7075
7085
  await cmdAsk2(question, {
7076
7086
  apiKey: values["api-key"],
7077
7087
  baseUrl: values["base-url"]
@@ -7357,7 +7367,7 @@ async function main() {
7357
7367
  return;
7358
7368
  }
7359
7369
  if (command === "mcp") {
7360
- const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
7370
+ const { startMcpServer: startMcpServer2 } = await init_mcp().then(() => mcp_exports);
7361
7371
  await startMcpServer2({
7362
7372
  apiKey: values["api-key"],
7363
7373
  baseUrl: values["base-url"]
package/dist/index.js CHANGED
@@ -81,8 +81,18 @@ function sleep(ms) {
81
81
  }
82
82
 
83
83
  // src/context.ts
84
- import { AsyncLocalStorage } from "async_hooks";
85
- var als = new AsyncLocalStorage();
84
+ var noopAls = {
85
+ getStore: () => void 0,
86
+ run: (_store, fn) => fn()
87
+ };
88
+ var als = noopAls;
89
+ try {
90
+ if (typeof process !== "undefined" && process.versions?.node) {
91
+ const mod = await import("async_hooks");
92
+ als = new mod.AsyncLocalStorage();
93
+ }
94
+ } catch {
95
+ }
86
96
  function getRequestContext() {
87
97
  return als.getStore();
88
98
  }