@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.
package/dist/cli.js CHANGED
@@ -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 = {
@@ -6266,7 +6258,7 @@ function formatPropType(prop) {
6266
6258
  return "string";
6267
6259
  }
6268
6260
  async function cmdExec(method, input, options) {
6269
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6261
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6270
6262
  await Promise.resolve().then(() => (init_steps(), steps_exports)).then(
6271
6263
  (m) => m.applyStepMethods(MindStudioAgent2)
6272
6264
  );
@@ -6319,7 +6311,7 @@ async function cmdExec(method, input, options) {
6319
6311
  }
6320
6312
  }
6321
6313
  async function cmdAgents(asJson, options) {
6322
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6314
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6323
6315
  const agent = new MindStudioAgent2({
6324
6316
  apiKey: options.apiKey,
6325
6317
  baseUrl: options.baseUrl
@@ -6348,7 +6340,7 @@ async function cmdAgents(asJson, options) {
6348
6340
  }
6349
6341
  }
6350
6342
  function createAgent(options) {
6351
- return Promise.resolve().then(() => (init_client(), client_exports)).then(
6343
+ return init_client().then(() => client_exports).then(
6352
6344
  ({ MindStudioAgent: MindStudioAgent2 }) => new MindStudioAgent2({
6353
6345
  apiKey: options.apiKey,
6354
6346
  baseUrl: options.baseUrl
@@ -6404,7 +6396,7 @@ async function cmdChangeProfilePicture(url, options) {
6404
6396
  `);
6405
6397
  }
6406
6398
  async function cmdRun(appId, variables, options) {
6407
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6399
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6408
6400
  const agent = new MindStudioAgent2({
6409
6401
  apiKey: options.apiKey,
6410
6402
  baseUrl: options.baseUrl
@@ -6500,7 +6492,7 @@ async function cmdUpload(filePath, options) {
6500
6492
  if (!ext) fatal("Cannot determine file extension. Please provide a file with an extension.");
6501
6493
  const content = readFileSync3(filePath);
6502
6494
  const mimeType = MIME_TYPES2[ext];
6503
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6495
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6504
6496
  const agent = new MindStudioAgent2({
6505
6497
  apiKey: options.apiKey,
6506
6498
  baseUrl: options.baseUrl
@@ -6534,7 +6526,7 @@ function isNewerVersion(current, latest) {
6534
6526
  return false;
6535
6527
  }
6536
6528
  async function checkForUpdate() {
6537
- const currentVersion = "0.1.50";
6529
+ const currentVersion = "0.1.51";
6538
6530
  if (!currentVersion) return null;
6539
6531
  try {
6540
6532
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6563,7 +6555,7 @@ async function checkForUpdate() {
6563
6555
  }
6564
6556
  }
6565
6557
  function printUpdateNotice(latestVersion) {
6566
- const currentVersion = "0.1.50";
6558
+ const currentVersion = "0.1.51";
6567
6559
  process.stderr.write(
6568
6560
  `
6569
6561
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6576,7 +6568,7 @@ function isStandaloneBinary() {
6576
6568
  return !argv1.includes("node_modules");
6577
6569
  }
6578
6570
  async function cmdUpdate() {
6579
- const currentVersion = "0.1.50";
6571
+ const currentVersion = "0.1.51";
6580
6572
  process.stderr.write(
6581
6573
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6582
6574
  `
@@ -6711,7 +6703,7 @@ async function cmdLogin(options) {
6711
6703
  process.stderr.write("\n");
6712
6704
  printLogo();
6713
6705
  process.stderr.write("\n");
6714
- const ver = "0.1.50";
6706
+ const ver = "0.1.51";
6715
6707
  process.stderr.write(
6716
6708
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6717
6709
  `
@@ -6861,7 +6853,7 @@ async function cmdWhoami(options) {
6861
6853
  for (const line of detail) process.stderr.write(line + "\n");
6862
6854
  process.stderr.write(` ${ansi2.gray("Verifying...")} `);
6863
6855
  try {
6864
- const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
6856
+ const { MindStudioAgent: MindStudioAgent2 } = await init_client().then(() => client_exports);
6865
6857
  const agent = new MindStudioAgent2({
6866
6858
  apiKey: options.apiKey,
6867
6859
  baseUrl: options.baseUrl
@@ -7038,7 +7030,7 @@ async function main() {
7038
7030
  try {
7039
7031
  if (command === "version" || command === "-v") {
7040
7032
  process.stdout.write(
7041
- "0.1.50\n"
7033
+ "0.1.51\n"
7042
7034
  );
7043
7035
  return;
7044
7036
  }
@@ -7089,7 +7081,7 @@ async function main() {
7089
7081
  ` mindstudio ask "what's the difference between generateText and userMessage?"`
7090
7082
  ]);
7091
7083
  }
7092
- const { cmdAsk: cmdAsk2 } = await Promise.resolve().then(() => (init_ask(), ask_exports));
7084
+ const { cmdAsk: cmdAsk2 } = await init_ask().then(() => ask_exports);
7093
7085
  await cmdAsk2(question, {
7094
7086
  apiKey: values["api-key"],
7095
7087
  baseUrl: values["base-url"]
@@ -7375,7 +7367,7 @@ async function main() {
7375
7367
  return;
7376
7368
  }
7377
7369
  if (command === "mcp") {
7378
- const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
7370
+ const { startMcpServer: startMcpServer2 } = await init_mcp().then(() => mcp_exports);
7379
7371
  await startMcpServer2({
7380
7372
  apiKey: values["api-key"],
7381
7373
  baseUrl: values["base-url"]
package/dist/index.js CHANGED
@@ -1,10 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
1
  // src/errors.ts
9
2
  var MindStudioError = class extends Error {
10
3
  constructor(message, code, status, details) {
@@ -88,26 +81,23 @@ function sleep(ms) {
88
81
  }
89
82
 
90
83
  // src/context.ts
91
- var als;
92
- function getAls() {
93
- if (!als) {
94
- try {
95
- const { AsyncLocalStorage } = __require("async_hooks");
96
- als = new AsyncLocalStorage();
97
- } catch {
98
- als = {
99
- getStore: () => void 0,
100
- run: (_store, fn) => fn()
101
- };
102
- }
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();
103
93
  }
104
- return als;
94
+ } catch {
105
95
  }
106
96
  function getRequestContext() {
107
- return getAls().getStore();
97
+ return als.getStore();
108
98
  }
109
99
  function runWithContext(ctx, fn) {
110
- return getAls().run(ctx, fn);
100
+ return als.run(ctx, fn);
111
101
  }
112
102
 
113
103
  // src/rate-limit.ts