@mindstudio-ai/agent 0.1.26 → 0.1.28

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.
@@ -3355,6 +3355,17 @@ var init_client = __esm({
3355
3355
  _db;
3356
3356
  /** @internal Auth type — 'internal' for CALLBACK_TOKEN (managed mode), 'apiKey' otherwise. */
3357
3357
  _authType;
3358
+ /**
3359
+ * @internal Resolve the current auth token. For internal (CALLBACK_TOKEN)
3360
+ * auth, re-reads the env var each time so that long-lived singleton
3361
+ * instances pick up token rotations from the host process.
3362
+ */
3363
+ get _token() {
3364
+ if (this._authType === "internal" && process.env.CALLBACK_TOKEN) {
3365
+ return process.env.CALLBACK_TOKEN;
3366
+ }
3367
+ return this._httpConfig.token;
3368
+ }
3358
3369
  constructor(options = {}) {
3359
3370
  const config = loadConfig();
3360
3371
  const { token, authType } = resolveToken(options.apiKey, config);
@@ -3453,7 +3464,7 @@ var init_client = __esm({
3453
3464
  res = await fetch(url, {
3454
3465
  method: "POST",
3455
3466
  headers: {
3456
- Authorization: `Bearer ${this._httpConfig.token}`,
3467
+ Authorization: `Bearer ${this._token}`,
3457
3468
  "Content-Type": "application/json",
3458
3469
  "User-Agent": "@mindstudio-ai/agent",
3459
3470
  Accept: "text/event-stream"
@@ -3874,7 +3885,7 @@ var init_client = __esm({
3874
3885
  method: "POST",
3875
3886
  headers: {
3876
3887
  "Content-Type": "application/json",
3877
- Authorization: this._httpConfig.token
3888
+ Authorization: this._token
3878
3889
  },
3879
3890
  body: JSON.stringify(body)
3880
3891
  });
@@ -4029,7 +4040,7 @@ var init_client = __esm({
4029
4040
  method: "POST",
4030
4041
  headers: {
4031
4042
  "Content-Type": "application/json",
4032
- Authorization: this._httpConfig.token
4043
+ Authorization: this._token
4033
4044
  },
4034
4045
  body: JSON.stringify({ databaseId, queries })
4035
4046
  });
@@ -4807,7 +4818,7 @@ async function startMcpServer(options) {
4807
4818
  capabilities: { tools: {} },
4808
4819
  serverInfo: {
4809
4820
  name: "mindstudio-agent",
4810
- version: "0.1.26"
4821
+ version: "0.1.28"
4811
4822
  },
4812
4823
  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.'
4813
4824
  });
@@ -5254,6 +5265,10 @@ function kebabToCamel2(s) {
5254
5265
  return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
5255
5266
  }
5256
5267
  function parseJson5(input) {
5268
+ try {
5269
+ return JSON.parse(input);
5270
+ } catch {
5271
+ }
5257
5272
  let s = input;
5258
5273
  s = s.replace(/\/\/.*$/gm, "");
5259
5274
  s = s.replace(/\/\*[\s\S]*?\*\//g, "");
@@ -5663,7 +5678,7 @@ function isNewerVersion(current, latest) {
5663
5678
  return false;
5664
5679
  }
5665
5680
  async function checkForUpdate() {
5666
- const currentVersion = "0.1.26";
5681
+ const currentVersion = "0.1.28";
5667
5682
  if (!currentVersion) return null;
5668
5683
  try {
5669
5684
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -5692,7 +5707,7 @@ async function checkForUpdate() {
5692
5707
  }
5693
5708
  }
5694
5709
  function printUpdateNotice(latestVersion) {
5695
- const currentVersion = "0.1.26";
5710
+ const currentVersion = "0.1.28";
5696
5711
  process.stderr.write(
5697
5712
  `
5698
5713
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -5705,7 +5720,7 @@ function isStandaloneBinary() {
5705
5720
  return !argv1.includes("node_modules");
5706
5721
  }
5707
5722
  async function cmdUpdate() {
5708
- const currentVersion = "0.1.26";
5723
+ const currentVersion = "0.1.28";
5709
5724
  process.stderr.write(
5710
5725
  ` ${ansi2.gray("Current version:")} ${currentVersion}
5711
5726
  `
@@ -5820,7 +5835,7 @@ async function cmdLogin(options) {
5820
5835
  process.stderr.write("\n");
5821
5836
  printLogo();
5822
5837
  process.stderr.write("\n");
5823
- const ver = "0.1.26";
5838
+ const ver = "0.1.28";
5824
5839
  process.stderr.write(
5825
5840
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
5826
5841
  `
@@ -6131,7 +6146,7 @@ async function main() {
6131
6146
  try {
6132
6147
  if (command === "version" || command === "-v") {
6133
6148
  process.stdout.write(
6134
- "0.1.26\n"
6149
+ "0.1.28\n"
6135
6150
  );
6136
6151
  return;
6137
6152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",