@mindstudio-ai/agent 0.1.169 → 0.1.170

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ What changed in `@mindstudio-ai/agent`, newest first, each version under its own
4
4
 
5
5
  Versions before 0.1.163 aren't recorded here.
6
6
 
7
+ ## 0.1.170
8
+
9
+ ### Changed behavior
10
+
11
+ - The auth table's `email` and `phone` columns are writable from code: `push()`, `update()` and `upsert()` no longer throw `managed_column_write` for them, so a seed, an import or a test fixture can create users with addresses, and whoever proves an address signs into its row (a "Sign in with Remy" user's row excepted, which only they sign into). From 0.1.149 to 0.1.169 every such write threw; before that, a write made before the table's first round trip in a process slipped past the check. The `apiKey` column still throws. A signed-in user changing their own address still goes through `auth.requestEmailChange()` / `auth.requestPhoneChange()` in `@mindstudio-ai/interface`. Code that caught `managed_column_write` for an email or phone write no longer gets it.
12
+
7
13
  ## 0.1.169
8
14
 
9
15
  ### Changed behavior
package/dist/cli.js CHANGED
@@ -3887,7 +3887,7 @@ var init_table = __esm({
3887
3887
  (item) => this._config.defaults ? { ...this._config.defaults, ...item } : item
3888
3888
  );
3889
3889
  const build = () => items.map((item) => {
3890
- this._checkManagedColumns(item);
3890
+ this._checkApiKeyWrite(item);
3891
3891
  return buildInsert(
3892
3892
  this._config.tableName,
3893
3893
  item,
@@ -3919,7 +3919,7 @@ var init_table = __esm({
3919
3919
  */
3920
3920
  update(id, data) {
3921
3921
  const build = () => {
3922
- this._checkManagedColumns(data);
3922
+ this._checkApiKeyWrite(data);
3923
3923
  return [
3924
3924
  buildUpdate(this._config.tableName, id, data, this._config.columns)
3925
3925
  ];
@@ -4026,7 +4026,7 @@ var init_table = __esm({
4026
4026
  }
4027
4027
  }
4028
4028
  const build = () => {
4029
- this._checkManagedColumns(withDefaults);
4029
+ this._checkApiKeyWrite(withDefaults);
4030
4030
  return [
4031
4031
  buildUpsert(
4032
4032
  this._config.tableName,
@@ -4055,22 +4055,19 @@ var init_table = __esm({
4055
4055
  // -------------------------------------------------------------------------
4056
4056
  // Internal helpers
4057
4057
  // -------------------------------------------------------------------------
4058
- /** @internal Throw if data includes a platform-managed read-only column. */
4059
- _checkManagedColumns(data) {
4060
- const mc = this._config.managedColumns;
4061
- if (!mc) {
4062
- return;
4063
- }
4064
- const keys = Object.keys(data);
4065
- for (const key of keys) {
4066
- if (mc.email && key === mc.email || mc.phone && key === mc.phone || mc.apiKey && key === mc.apiKey) {
4067
- const friendly = key === mc.email ? "email" : key === mc.phone ? "phone" : "API key";
4068
- throw new MindStudioError(
4069
- `Cannot write to "${key}" \u2014 this column is managed by auth. Use the auth API to change a user's ${friendly}.`,
4070
- "managed_column_write",
4071
- 400
4072
- );
4073
- }
4058
+ /**
4059
+ * @internal Throw if data writes the auth table's API key column, which holds
4060
+ * the masked key the platform issued. The other mapped columns are the app's
4061
+ * to write.
4062
+ */
4063
+ _checkApiKeyWrite(data) {
4064
+ const column = this._config.managedColumns?.apiKey;
4065
+ if (column && Object.keys(data).includes(column)) {
4066
+ throw new MindStudioError(
4067
+ `Cannot write to "${column}" \u2014 this column is managed by auth. Use the auth API to issue or revoke a user's API key.`,
4068
+ "managed_column_write",
4069
+ 400
4070
+ );
4074
4071
  }
4075
4072
  }
4076
4073
  /**
@@ -9472,7 +9469,7 @@ async function startMcpServer(options) {
9472
9469
  capabilities: { tools: {} },
9473
9470
  serverInfo: {
9474
9471
  name: "mindstudio-agent",
9475
- version: "0.1.169"
9472
+ version: "0.1.170"
9476
9473
  },
9477
9474
  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, pass its public image URL to `changeProfilePicture`.\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.'
9478
9475
  });
@@ -10512,7 +10509,7 @@ function isNewerVersion(current, latest) {
10512
10509
  return false;
10513
10510
  }
10514
10511
  async function checkForUpdate() {
10515
- const currentVersion = "0.1.169";
10512
+ const currentVersion = "0.1.170";
10516
10513
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
10517
10514
  return null;
10518
10515
  }
@@ -10547,7 +10544,7 @@ async function checkForUpdate() {
10547
10544
  }
10548
10545
  }
10549
10546
  function printUpdateNotice(latestVersion) {
10550
- const currentVersion = "0.1.169";
10547
+ const currentVersion = "0.1.170";
10551
10548
  process.stderr.write(
10552
10549
  `
10553
10550
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -10560,7 +10557,7 @@ function isStandaloneBinary() {
10560
10557
  return !argv1.includes("node_modules");
10561
10558
  }
10562
10559
  async function cmdUpdate() {
10563
- const currentVersion = "0.1.169";
10560
+ const currentVersion = "0.1.170";
10564
10561
  process.stderr.write(
10565
10562
  ` ${ansi2.gray("Current version:")} ${currentVersion}
10566
10563
  `
@@ -10701,7 +10698,7 @@ async function cmdLogin(options) {
10701
10698
  process.stderr.write("\n");
10702
10699
  printLogo();
10703
10700
  process.stderr.write("\n");
10704
- const ver = "0.1.169";
10701
+ const ver = "0.1.170";
10705
10702
  process.stderr.write(
10706
10703
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
10707
10704
  `
@@ -11029,7 +11026,7 @@ async function main() {
11029
11026
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
11030
11027
  try {
11031
11028
  if (command === "version" || command === "-v") {
11032
- process.stdout.write("0.1.169\n");
11029
+ process.stdout.write("0.1.170\n");
11033
11030
  return;
11034
11031
  }
11035
11032
  if (command === "login") {
package/dist/index.d.ts CHANGED
@@ -1117,7 +1117,8 @@ interface TableConfig {
1117
1117
  defaults?: Record<string, unknown>;
1118
1118
  /**
1119
1119
  * Platform-managed auth columns. Set when this table is the app's auth
1120
- * table. Writes to email/phone/apiKey columns throw; roles writes are allowed.
1120
+ * table. Writes to the apiKey column throw; email, phone and roles are the
1121
+ * app's to write, and a roles write syncs to the platform.
1121
1122
  */
1122
1123
  managedColumns?: {
1123
1124
  email?: string;
@@ -1692,8 +1693,12 @@ declare class Table<T> {
1692
1693
  * @param data - Row data to insert (or update on conflict). Defaults apply.
1693
1694
  */
1694
1695
  upsert(conflictKey: (keyof Omit<T, SystemFields> & string) | (keyof Omit<T, SystemFields> & string)[], data: PushInput<T>): Mutation<T>;
1695
- /** @internal Throw if data includes a platform-managed read-only column. */
1696
- private _checkManagedColumns;
1696
+ /**
1697
+ * @internal Throw if data writes the auth table's API key column, which holds
1698
+ * the masked key the platform issued. The other mapped columns are the app's
1699
+ * to write.
1700
+ */
1701
+ private _checkApiKeyWrite;
1697
1702
  /**
1698
1703
  * @internal Fire role sync for rows that wrote to the roles column.
1699
1704
  * Called inside processResult (runs after SQL execution in both
package/dist/index.js CHANGED
@@ -2546,7 +2546,7 @@ var Table = class {
2546
2546
  (item) => this._config.defaults ? { ...this._config.defaults, ...item } : item
2547
2547
  );
2548
2548
  const build = () => items.map((item) => {
2549
- this._checkManagedColumns(item);
2549
+ this._checkApiKeyWrite(item);
2550
2550
  return buildInsert(
2551
2551
  this._config.tableName,
2552
2552
  item,
@@ -2578,7 +2578,7 @@ var Table = class {
2578
2578
  */
2579
2579
  update(id, data) {
2580
2580
  const build = () => {
2581
- this._checkManagedColumns(data);
2581
+ this._checkApiKeyWrite(data);
2582
2582
  return [
2583
2583
  buildUpdate(this._config.tableName, id, data, this._config.columns)
2584
2584
  ];
@@ -2685,7 +2685,7 @@ var Table = class {
2685
2685
  }
2686
2686
  }
2687
2687
  const build = () => {
2688
- this._checkManagedColumns(withDefaults);
2688
+ this._checkApiKeyWrite(withDefaults);
2689
2689
  return [
2690
2690
  buildUpsert(
2691
2691
  this._config.tableName,
@@ -2714,22 +2714,19 @@ var Table = class {
2714
2714
  // -------------------------------------------------------------------------
2715
2715
  // Internal helpers
2716
2716
  // -------------------------------------------------------------------------
2717
- /** @internal Throw if data includes a platform-managed read-only column. */
2718
- _checkManagedColumns(data) {
2719
- const mc = this._config.managedColumns;
2720
- if (!mc) {
2721
- return;
2722
- }
2723
- const keys = Object.keys(data);
2724
- for (const key of keys) {
2725
- if (mc.email && key === mc.email || mc.phone && key === mc.phone || mc.apiKey && key === mc.apiKey) {
2726
- const friendly = key === mc.email ? "email" : key === mc.phone ? "phone" : "API key";
2727
- throw new MindStudioError(
2728
- `Cannot write to "${key}" \u2014 this column is managed by auth. Use the auth API to change a user's ${friendly}.`,
2729
- "managed_column_write",
2730
- 400
2731
- );
2732
- }
2717
+ /**
2718
+ * @internal Throw if data writes the auth table's API key column, which holds
2719
+ * the masked key the platform issued. The other mapped columns are the app's
2720
+ * to write.
2721
+ */
2722
+ _checkApiKeyWrite(data) {
2723
+ const column = this._config.managedColumns?.apiKey;
2724
+ if (column && Object.keys(data).includes(column)) {
2725
+ throw new MindStudioError(
2726
+ `Cannot write to "${column}" \u2014 this column is managed by auth. Use the auth API to issue or revoke a user's API key.`,
2727
+ "managed_column_write",
2728
+ 400
2729
+ );
2733
2730
  }
2734
2731
  }
2735
2732
  /**