@mindstudio-ai/agent 0.1.50 → 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.
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
4
  var __esm = (fn, res) => function __init() {
11
5
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
6
  };
@@ -1293,27 +1287,25 @@ var init_http = __esm({
1293
1287
  });
1294
1288
 
1295
1289
  // src/context.ts
1296
- function getAls() {
1297
- if (!als) {
1298
- try {
1299
- const { AsyncLocalStorage } = __require("async_hooks");
1300
- als = new AsyncLocalStorage();
1301
- } catch {
1302
- als = {
1303
- getStore: () => void 0,
1304
- run: (_store, fn) => fn()
1305
- };
1306
- }
1307
- }
1308
- return als;
1309
- }
1310
1290
  function getRequestContext() {
1311
- return getAls().getStore();
1291
+ return als.getStore();
1312
1292
  }
1313
- var als;
1293
+ var noopAls, als;
1314
1294
  var init_context = __esm({
1315
- "src/context.ts"() {
1295
+ async "src/context.ts"() {
1316
1296
  "use strict";
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
+ }
1317
1309
  }
1318
1310
  });
1319
1311
 
@@ -3216,11 +3208,11 @@ async function runTaskStream(httpConfig, body, onEvent) {
3216
3208
  return result;
3217
3209
  }
3218
3210
  var init_task = __esm({
3219
- "src/task/index.ts"() {
3211
+ async "src/task/index.ts"() {
3220
3212
  "use strict";
3221
3213
  init_http();
3222
3214
  init_errors();
3223
- init_context();
3215
+ await init_context();
3224
3216
  init_metadata();
3225
3217
  }
3226
3218
  });
@@ -3750,16 +3742,16 @@ function resolveToken(provided, config) {
3750
3742
  }
3751
3743
  var DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, MindStudioAgent;
3752
3744
  var init_client = __esm({
3753
- "src/client.ts"() {
3745
+ async "src/client.ts"() {
3754
3746
  "use strict";
3755
3747
  init_http();
3756
3748
  init_errors();
3757
- init_context();
3749
+ await init_context();
3758
3750
  init_rate_limit();
3759
3751
  init_config();
3760
3752
  init_auth();
3761
3753
  init_db();
3762
- init_task();
3754
+ await init_task();
3763
3755
  init_steps();
3764
3756
  init_metadata();
3765
3757
  DEFAULT_BASE_URL = "https://v1.mindstudio-api.com";
@@ -5499,10 +5491,10 @@ async function cmdAsk(question, options) {
5499
5491
  }
5500
5492
  var DEFAULT_BASE_URL2, ansi;
5501
5493
  var init_ask = __esm({
5502
- "src/ask/index.ts"() {
5494
+ async "src/ask/index.ts"() {
5503
5495
  "use strict";
5504
5496
  init_config();
5505
- init_client();
5497
+ await init_client();
5506
5498
  init_sse();
5507
5499
  init_tools();
5508
5500
  init_prompt2();
@@ -5577,7 +5569,7 @@ async function startMcpServer(options) {
5577
5569
  capabilities: { tools: {} },
5578
5570
  serverInfo: {
5579
5571
  name: "mindstudio-agent",
5580
- version: "0.1.50"
5572
+ version: "0.1.51"
5581
5573
  },
5582
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.'
5583
5575
  });
@@ -5593,7 +5585,7 @@ async function startMcpServer(options) {
5593
5585
  try {
5594
5586
  let result;
5595
5587
  if (toolName === "ask") {
5596
- const { runAsk: runAsk2 } = await Promise.resolve().then(() => (init_ask(), ask_exports));
5588
+ const { runAsk: runAsk2 } = await init_ask().then(() => ask_exports);
5597
5589
  result = await runAsk2(
5598
5590
  args.question,
5599
5591
  options
@@ -5727,9 +5719,9 @@ async function startMcpServer(options) {
5727
5719
  }
5728
5720
  var MCP_PROTOCOL_VERSION, MIME_TYPES, ASK_TOOL, HELPER_DESCRIPTIONS, HELPER_TOOLS;
5729
5721
  var init_mcp = __esm({
5730
- "src/mcp.ts"() {
5722
+ async "src/mcp.ts"() {
5731
5723
  "use strict";
5732
- init_client();
5724
+ await init_client();
5733
5725
  init_errors();
5734
5726
  MCP_PROTOCOL_VERSION = "2024-11-05";
5735
5727
  MIME_TYPES = {
@@ -6197,7 +6189,7 @@ function formatPropType(prop) {
6197
6189
  return "string";
6198
6190
  }
6199
6191
  async function cmdExec(method, input, options) {
6200
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6192
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6201
6193
  await Promise.resolve().then(() => (init_steps(), steps_exports)).then(
6202
6194
  (m) => m.applyStepMethods(MindStudioAgent2)
6203
6195
  );
@@ -6250,7 +6242,7 @@ async function cmdExec(method, input, options) {
6250
6242
  }
6251
6243
  }
6252
6244
  async function cmdAgents(asJson, options) {
6253
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6245
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6254
6246
  const agent = new MindStudioAgent2({
6255
6247
  apiKey: options.apiKey,
6256
6248
  baseUrl: options.baseUrl
@@ -6279,7 +6271,7 @@ async function cmdAgents(asJson, options) {
6279
6271
  }
6280
6272
  }
6281
6273
  function createAgent(options) {
6282
- return Promise.resolve().then(() => (init_client(), client_exports)).then(
6274
+ return init_client().then(() => client_exports).then(
6283
6275
  ({ MindStudioAgent: MindStudioAgent2 }) => new MindStudioAgent2({
6284
6276
  apiKey: options.apiKey,
6285
6277
  baseUrl: options.baseUrl
@@ -6335,7 +6327,7 @@ async function cmdChangeProfilePicture(url, options) {
6335
6327
  `);
6336
6328
  }
6337
6329
  async function cmdRun(appId, variables, options) {
6338
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6330
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6339
6331
  const agent = new MindStudioAgent2({
6340
6332
  apiKey: options.apiKey,
6341
6333
  baseUrl: options.baseUrl
@@ -6415,7 +6407,7 @@ async function cmdUpload(filePath, options) {
6415
6407
  if (!ext) fatal("Cannot determine file extension. Please provide a file with an extension.");
6416
6408
  const content = readFileSync3(filePath);
6417
6409
  const mimeType = MIME_TYPES2[ext];
6418
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6410
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6419
6411
  const agent = new MindStudioAgent2({
6420
6412
  apiKey: options.apiKey,
6421
6413
  baseUrl: options.baseUrl
@@ -6438,7 +6430,7 @@ function isNewerVersion(current, latest) {
6438
6430
  return false;
6439
6431
  }
6440
6432
  async function checkForUpdate() {
6441
- const currentVersion = "0.1.50";
6433
+ const currentVersion = "0.1.51";
6442
6434
  if (!currentVersion) return null;
6443
6435
  try {
6444
6436
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6467,7 +6459,7 @@ async function checkForUpdate() {
6467
6459
  }
6468
6460
  }
6469
6461
  function printUpdateNotice(latestVersion) {
6470
- const currentVersion = "0.1.50";
6462
+ const currentVersion = "0.1.51";
6471
6463
  process.stderr.write(
6472
6464
  `
6473
6465
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6480,7 +6472,7 @@ function isStandaloneBinary() {
6480
6472
  return !argv1.includes("node_modules");
6481
6473
  }
6482
6474
  async function cmdUpdate() {
6483
- const currentVersion = "0.1.50";
6475
+ const currentVersion = "0.1.51";
6484
6476
  process.stderr.write(
6485
6477
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6486
6478
  `
@@ -6595,7 +6587,7 @@ async function cmdLogin(options) {
6595
6587
  process.stderr.write("\n");
6596
6588
  printLogo();
6597
6589
  process.stderr.write("\n");
6598
- const ver = "0.1.50";
6590
+ const ver = "0.1.51";
6599
6591
  process.stderr.write(
6600
6592
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6601
6593
  `
@@ -6745,7 +6737,7 @@ async function cmdWhoami(options) {
6745
6737
  for (const line of detail) process.stderr.write(line + "\n");
6746
6738
  process.stderr.write(` ${ansi2.gray("Verifying...")} `);
6747
6739
  try {
6748
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6740
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6749
6741
  const agent = new MindStudioAgent2({
6750
6742
  apiKey: options.apiKey,
6751
6743
  baseUrl: options.baseUrl
@@ -6906,7 +6898,7 @@ async function main() {
6906
6898
  try {
6907
6899
  if (command === "version" || command === "-v") {
6908
6900
  process.stdout.write(
6909
- "0.1.50\n"
6901
+ "0.1.51\n"
6910
6902
  );
6911
6903
  return;
6912
6904
  }
@@ -6957,7 +6949,7 @@ async function main() {
6957
6949
  ` mindstudio ask "what's the difference between generateText and userMessage?"`
6958
6950
  ]);
6959
6951
  }
6960
- const { cmdAsk: cmdAsk2 } = await Promise.resolve().then(() => (init_ask(), ask_exports));
6952
+ const { cmdAsk: cmdAsk2 } = await init_ask().then(() => ask_exports);
6961
6953
  await cmdAsk2(question, {
6962
6954
  apiKey: values["api-key"],
6963
6955
  baseUrl: values["base-url"]
@@ -7243,7 +7235,7 @@ async function main() {
7243
7235
  return;
7244
7236
  }
7245
7237
  if (command === "mcp") {
7246
- const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
7238
+ const { startMcpServer: startMcpServer2 } = await init_mcp().then(() => mcp_exports);
7247
7239
  await startMcpServer2({
7248
7240
  apiKey: values["api-key"],
7249
7241
  baseUrl: values["base-url"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",