@mindstudio-ai/agent 0.1.59 → 0.1.61

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.
@@ -3822,8 +3822,7 @@ function resolveToken(provided, config) {
3822
3822
  if (provided) return { token: provided, authType: "apiKey" };
3823
3823
  if (process.env.MINDSTUDIO_API_KEY)
3824
3824
  return { token: process.env.MINDSTUDIO_API_KEY, authType: "apiKey" };
3825
- if (config?.apiKey)
3826
- return { token: config.apiKey, authType: "apiKey" };
3825
+ if (config?.apiKey) return { token: config.apiKey, authType: "apiKey" };
3827
3826
  throw new MindStudioError(
3828
3827
  "No API key provided. Run `mindstudio login`, pass `apiKey` to the constructor, or set the MINDSTUDIO_API_KEY environment variable.",
3829
3828
  "missing_api_key",
@@ -3898,7 +3897,11 @@ var init_client = __esm({
3898
3897
  get _currentHttpConfig() {
3899
3898
  const rctx = getRequestContext();
3900
3899
  if (rctx?.remoteHostname) {
3901
- return { ...this._httpConfig, baseUrl: rctx.remoteHostname, token: this._token };
3900
+ return {
3901
+ ...this._httpConfig,
3902
+ baseUrl: rctx.remoteHostname,
3903
+ token: this._token
3904
+ };
3902
3905
  }
3903
3906
  return this._httpConfig;
3904
3907
  }
@@ -3914,7 +3917,11 @@ var init_client = __esm({
3914
3917
  _getContext() {
3915
3918
  const rctx = getRequestContext();
3916
3919
  if (rctx?.auth && rctx?.databases) {
3917
- return { auth: rctx.auth, databases: rctx.databases, authConfig: rctx.authConfig };
3920
+ return {
3921
+ auth: rctx.auth,
3922
+ databases: rctx.databases,
3923
+ authConfig: rctx.authConfig
3924
+ };
3918
3925
  }
3919
3926
  return this._context;
3920
3927
  }
@@ -3977,7 +3984,8 @@ var init_client = __esm({
3977
3984
  const res = await fetch(pollUrl, {
3978
3985
  headers: { "User-Agent": "@mindstudio-ai/agent" }
3979
3986
  });
3980
- if (res.status === 502 || res.status === 503 || res.status === 504) continue;
3987
+ if (res.status === 502 || res.status === 503 || res.status === 504)
3988
+ continue;
3981
3989
  if (res.status === 404) {
3982
3990
  throw new MindStudioError(
3983
3991
  `[${stepType}] Execution token expired.`,
@@ -4074,7 +4082,9 @@ var init_client = __esm({
4074
4082
  const errMsg = (typeof body2.error === "string" ? body2.error : void 0) ?? (typeof body2.message === "string" ? body2.message : void 0) ?? (typeof body2.details === "string" ? body2.details : void 0);
4075
4083
  if (errMsg) message = errMsg;
4076
4084
  else if (body2.error || body2.message || body2.details) {
4077
- message = JSON.stringify(body2.error ?? body2.message ?? body2.details);
4085
+ message = JSON.stringify(
4086
+ body2.error ?? body2.message ?? body2.details
4087
+ );
4078
4088
  }
4079
4089
  if (body2.code) code = body2.code;
4080
4090
  } catch {
@@ -4083,7 +4093,12 @@ var init_client = __esm({
4083
4093
  }
4084
4094
  } catch {
4085
4095
  }
4086
- throw new MindStudioError(`[${stepType}] ${message}`, code, res.status, details);
4096
+ throw new MindStudioError(
4097
+ `[${stepType}] ${message}`,
4098
+ code,
4099
+ res.status,
4100
+ details
4101
+ );
4087
4102
  }
4088
4103
  const headers = res.headers;
4089
4104
  try {
@@ -4215,7 +4230,10 @@ var init_client = __esm({
4215
4230
  async executeStepBatch(steps, options) {
4216
4231
  const threadId = options?.threadId ?? (this._reuseThreadId && !getRequestContext() ? this._threadId : void 0);
4217
4232
  const { data: asyncData } = await request(this._currentHttpConfig, "POST", "/steps/execute-batch-async", {
4218
- steps: steps.map((s) => ({ ...s, stepType: resolveStepType2(s.stepType) })),
4233
+ steps: steps.map((s) => ({
4234
+ ...s,
4235
+ stepType: resolveStepType2(s.stepType)
4236
+ })),
4219
4237
  ...options?.appId != null && { appId: options.appId },
4220
4238
  ...threadId != null && { threadId }
4221
4239
  });
@@ -4227,7 +4245,8 @@ var init_client = __esm({
4227
4245
  const res = await fetch(pollUrl, {
4228
4246
  headers: { "User-Agent": "@mindstudio-ai/agent" }
4229
4247
  });
4230
- if (res.status === 502 || res.status === 503 || res.status === 504) continue;
4248
+ if (res.status === 502 || res.status === 503 || res.status === 504)
4249
+ continue;
4231
4250
  if (res.status === 404) {
4232
4251
  throw new MindStudioError(
4233
4252
  "Batch poll token not found or expired.",
@@ -4391,7 +4410,8 @@ var init_client = __esm({
4391
4410
  const res = await fetch(pollUrl, {
4392
4411
  headers: { "User-Agent": "@mindstudio-ai/agent" }
4393
4412
  });
4394
- if (res.status === 502 || res.status === 503 || res.status === 504) continue;
4413
+ if (res.status === 502 || res.status === 503 || res.status === 504)
4414
+ continue;
4395
4415
  if (res.status === 404) {
4396
4416
  throw new MindStudioError(
4397
4417
  "Poll token not found or expired.",
@@ -4507,6 +4527,15 @@ var init_client = __esm({
4507
4527
  );
4508
4528
  return data;
4509
4529
  }
4530
+ /** List packaged workflows available to the organization. */
4531
+ async listPackagedWorkflows() {
4532
+ const { data } = await request(
4533
+ this._currentHttpConfig,
4534
+ "GET",
4535
+ "/helpers/packaged-workflows"
4536
+ );
4537
+ return data;
4538
+ }
4510
4539
  // -------------------------------------------------------------------------
4511
4540
  // Helper methods — cost estimation
4512
4541
  // -------------------------------------------------------------------------
@@ -4737,7 +4766,9 @@ var init_client = __esm({
4737
4766
  const errMsg = (typeof body.error === "string" ? body.error : void 0) ?? (typeof body.message === "string" ? body.message : void 0) ?? (typeof body.details === "string" ? body.details : void 0);
4738
4767
  if (errMsg) message = errMsg;
4739
4768
  else if (body.error || body.message || body.details) {
4740
- message = JSON.stringify(body.error ?? body.message ?? body.details);
4769
+ message = JSON.stringify(
4770
+ body.error ?? body.message ?? body.details
4771
+ );
4741
4772
  }
4742
4773
  if (body.code) code = body.code;
4743
4774
  } catch {
@@ -4745,11 +4776,7 @@ var init_client = __esm({
4745
4776
  }
4746
4777
  } catch {
4747
4778
  }
4748
- throw new MindStudioError(
4749
- `[db] ${message}`,
4750
- code,
4751
- res.status
4752
- );
4779
+ throw new MindStudioError(`[db] ${message}`, code, res.status);
4753
4780
  }
4754
4781
  const data = await res.json();
4755
4782
  return data.results;
@@ -4959,9 +4986,14 @@ var init_client = __esm({
4959
4986
  }
4960
4987
  /** Update the profile picture of the authenticated user/agent. */
4961
4988
  async changeProfilePicture(url) {
4962
- await request(this._currentHttpConfig, "POST", "/account/change-profile-picture", {
4963
- url
4964
- });
4989
+ await request(
4990
+ this._currentHttpConfig,
4991
+ "POST",
4992
+ "/account/change-profile-picture",
4993
+ {
4994
+ url
4995
+ }
4996
+ );
4965
4997
  }
4966
4998
  /**
4967
4999
  * Upload a file to the MindStudio CDN.
@@ -5847,7 +5879,7 @@ async function startMcpServer(options) {
5847
5879
  capabilities: { tools: {} },
5848
5880
  serverInfo: {
5849
5881
  name: "mindstudio-agent",
5850
- version: "0.1.59"
5882
+ version: "0.1.61"
5851
5883
  },
5852
5884
  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.'
5853
5885
  });
@@ -5905,6 +5937,8 @@ async function startMcpServer(options) {
5905
5937
  );
5906
5938
  } else if (toolName === "listConnections") {
5907
5939
  result = await getAgent().listConnections();
5940
+ } else if (toolName === "listPackagedWorkflows") {
5941
+ result = await getAgent().listPackagedWorkflows();
5908
5942
  } else if (toolName === "estimateActionCost") {
5909
5943
  const meta = await getMetadata();
5910
5944
  const rawType = args.stepType;
@@ -6041,6 +6075,7 @@ var init_mcp = __esm({
6041
6075
  getConnector: "Get details for an OAuth connector service.",
6042
6076
  getConnectorAction: "Get full configuration for an OAuth connector action.",
6043
6077
  listConnections: "List OAuth connections for the organization (authenticated third-party service links).",
6078
+ listPackagedWorkflows: "List packaged workflows available to the organization.",
6044
6079
  estimateStepCost: "Estimate the cost of executing an action before running it.",
6045
6080
  changeName: "Update the display name of the authenticated agent.",
6046
6081
  changeProfilePicture: "Update the profile picture of the authenticated agent.",
@@ -6146,6 +6181,11 @@ var init_mcp = __esm({
6146
6181
  description: "List OAuth connections for the organization (authenticated third-party service links). Use the returned connection IDs when calling OAuth connector actions.",
6147
6182
  inputSchema: { type: "object", properties: {} }
6148
6183
  },
6184
+ {
6185
+ name: "listPackagedWorkflows",
6186
+ description: "List packaged workflows available to the organization, including their app/workflow IDs and input/output signatures.",
6187
+ inputSchema: { type: "object", properties: {} }
6188
+ },
6149
6189
  {
6150
6190
  name: "estimateActionCost",
6151
6191
  description: "Estimate the cost of executing an action before running it. Pass the same config you would use for execution.",
@@ -6587,6 +6627,11 @@ async function cmdListConnections(options) {
6587
6627
  const result = await agent.listConnections();
6588
6628
  jsonOut(result);
6589
6629
  }
6630
+ async function cmdListPackagedWorkflows(options) {
6631
+ const agent = await createAgent(options);
6632
+ const result = await agent.listPackagedWorkflows();
6633
+ jsonOut(result);
6634
+ }
6590
6635
  async function cmdEstimateStepCost(method, input, options) {
6591
6636
  const agent = await createAgent(options);
6592
6637
  const result = await agent.estimateStepCost(method, input);
@@ -6708,7 +6753,7 @@ function isNewerVersion(current, latest) {
6708
6753
  return false;
6709
6754
  }
6710
6755
  async function checkForUpdate() {
6711
- const currentVersion = "0.1.59";
6756
+ const currentVersion = "0.1.61";
6712
6757
  if (!currentVersion) return null;
6713
6758
  try {
6714
6759
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -6737,7 +6782,7 @@ async function checkForUpdate() {
6737
6782
  }
6738
6783
  }
6739
6784
  function printUpdateNotice(latestVersion) {
6740
- const currentVersion = "0.1.59";
6785
+ const currentVersion = "0.1.61";
6741
6786
  process.stderr.write(
6742
6787
  `
6743
6788
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -6750,7 +6795,7 @@ function isStandaloneBinary() {
6750
6795
  return !argv1.includes("node_modules");
6751
6796
  }
6752
6797
  async function cmdUpdate() {
6753
- const currentVersion = "0.1.59";
6798
+ const currentVersion = "0.1.61";
6754
6799
  process.stderr.write(
6755
6800
  ` ${ansi2.gray("Current version:")} ${currentVersion}
6756
6801
  `
@@ -6865,7 +6910,7 @@ async function cmdLogin(options) {
6865
6910
  process.stderr.write("\n");
6866
6911
  printLogo();
6867
6912
  process.stderr.write("\n");
6868
- const ver = "0.1.59";
6913
+ const ver = "0.1.61";
6869
6914
  process.stderr.write(
6870
6915
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
6871
6916
  `
@@ -7176,7 +7221,7 @@ async function main() {
7176
7221
  try {
7177
7222
  if (command === "version" || command === "-v") {
7178
7223
  process.stdout.write(
7179
- "0.1.59\n"
7224
+ "0.1.61\n"
7180
7225
  );
7181
7226
  return;
7182
7227
  }
@@ -7437,6 +7482,13 @@ async function main() {
7437
7482
  });
7438
7483
  return;
7439
7484
  }
7485
+ if (command === "list-packaged-workflows") {
7486
+ await cmdListPackagedWorkflows({
7487
+ apiKey: values["api-key"],
7488
+ baseUrl: values["base-url"]
7489
+ });
7490
+ return;
7491
+ }
7440
7492
  if (command === "estimate-cost") {
7441
7493
  const stepMethod = positionals[1];
7442
7494
  if (!stepMethod)
@@ -7627,6 +7679,7 @@ Discover:
7627
7679
  list-actions [--json] [--summary] List all available actions
7628
7680
  info <action> Show action details and parameters
7629
7681
  list-models [--type <t>] [--summary] List available AI models
7682
+ list-packaged-workflows List packaged workflows
7630
7683
 
7631
7684
  Batch:
7632
7685
  batch [json] Execute multiple actions in parallel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.59",
3
+ "version": "0.1.61",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",