@mindstudio-ai/agent 0.1.187 → 0.1.188

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,16 @@ 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.188
8
+
9
+ ### New
10
+
11
+ - A database batch with a large answer logs a warning in the log of the request that ran it, with the answer's size, rows and queries: `[mindstudio] A database batch returned 136 MB of JSON (27103 rows from 3 queries). The sandbox holds it in memory that every call on the release shares. Select only the columns needed, page through the rows, or use an aggregate.` The platform reports the size beside the batch's results, over the socket and over fetch alike. Check: nothing.
12
+
13
+ ### Changed behavior
14
+
15
+ - `db.batch()`'s doc comment says it runs as one atomic transaction per database: statements run in argument order, and if any fails the batch rolls back and the call rejects. It said only that the operations share a connection. Nothing changed at run time. Check: nothing.
16
+
7
17
  ## 0.1.187
8
18
 
9
19
  ### New
package/dist/cli.js CHANGED
@@ -1382,7 +1382,7 @@ var init_context = __esm({
1382
1382
  }
1383
1383
  });
1384
1384
 
1385
- // src/db/scanHints.ts
1385
+ // src/db/queryHints.ts
1386
1386
  function warnTableScans(scans) {
1387
1387
  if (!Array.isArray(scans)) {
1388
1388
  return;
@@ -1396,8 +1396,20 @@ function warnTableScans(scans) {
1396
1396
  );
1397
1397
  }
1398
1398
  }
1399
- var init_scanHints = __esm({
1400
- "src/db/scanHints.ts"() {
1399
+ function warnLargeResult(largeResult) {
1400
+ const { chars, rows, queries } = largeResult ?? {};
1401
+ if (typeof chars !== "number" || !Number.isFinite(chars)) {
1402
+ return;
1403
+ }
1404
+ const megabytes = Math.round(chars / (1024 * 1024));
1405
+ const rowCount = typeof rows === "number" ? `${rows} rows from ` : "";
1406
+ const queryCount = typeof queries === "number" ? ` (${rowCount}${queries} ${queries === 1 ? "query" : "queries"})` : "";
1407
+ console.warn(
1408
+ `[mindstudio] A database batch returned ${megabytes} MB of JSON${queryCount}. The sandbox holds it in memory that every call on the release shares. Select only the columns needed, page through the rows, or use an aggregate.`
1409
+ );
1410
+ }
1411
+ var init_queryHints = __esm({
1412
+ "src/db/queryHints.ts"() {
1401
1413
  "use strict";
1402
1414
  }
1403
1415
  });
@@ -1471,6 +1483,7 @@ function deliver(self, msg) {
1471
1483
  );
1472
1484
  } else {
1473
1485
  warnTableScans(msg.scans);
1486
+ warnLargeResult(msg.largeResult);
1474
1487
  p.resolve(msg.results);
1475
1488
  }
1476
1489
  }
@@ -1665,7 +1678,7 @@ var DB_WS_SUBPROTOCOL, WS_ACK_TIMEOUT_MS, WS_IDLE_TIMEOUT_MS, WS_OPEN_TIMEOUT_MS
1665
1678
  var init_db_ws = __esm({
1666
1679
  "src/db-ws.ts"() {
1667
1680
  "use strict";
1668
- init_scanHints();
1681
+ init_queryHints();
1669
1682
  init_errors();
1670
1683
  DB_WS_SUBPROTOCOL = "ms-db-v2";
1671
1684
  WS_ACK_TIMEOUT_MS = 2e4;
@@ -7811,7 +7824,7 @@ var init_client = __esm({
7811
7824
  init_sql();
7812
7825
  init_time();
7813
7826
  init_readBatching();
7814
- init_scanHints();
7827
+ init_queryHints();
7815
7828
  init_files();
7816
7829
  init_datasources();
7817
7830
  init_voice();
@@ -9312,6 +9325,7 @@ var init_client = __esm({
9312
9325
  }
9313
9326
  const data = await res.json();
9314
9327
  warnTableScans(data.scans);
9328
+ warnLargeResult(data.largeResult);
9315
9329
  return data.results;
9316
9330
  }
9317
9331
  /**
@@ -10271,7 +10285,7 @@ async function startMcpServer(options) {
10271
10285
  capabilities: { tools: {} },
10272
10286
  serverInfo: {
10273
10287
  name: "mindstudio-agent",
10274
- version: "0.1.187"
10288
+ version: "0.1.188"
10275
10289
  },
10276
10290
  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.'
10277
10291
  });
@@ -11311,7 +11325,7 @@ function isNewerVersion(current, latest) {
11311
11325
  return false;
11312
11326
  }
11313
11327
  async function checkForUpdate() {
11314
- const currentVersion = "0.1.187";
11328
+ const currentVersion = "0.1.188";
11315
11329
  if (!currentVersion || process.env.MINDSTUDIO_NO_UPDATE_CHECK) {
11316
11330
  return null;
11317
11331
  }
@@ -11346,7 +11360,7 @@ async function checkForUpdate() {
11346
11360
  }
11347
11361
  }
11348
11362
  function printUpdateNotice(latestVersion) {
11349
- const currentVersion = "0.1.187";
11363
+ const currentVersion = "0.1.188";
11350
11364
  process.stderr.write(
11351
11365
  `
11352
11366
  ${ansi2.cyanBright("Update available")} ${ansi2.gray(currentVersion + " \u2192")} ${ansi2.cyanBold(latestVersion)}
@@ -11359,7 +11373,7 @@ function isStandaloneBinary() {
11359
11373
  return !argv1.includes("node_modules");
11360
11374
  }
11361
11375
  async function cmdUpdate() {
11362
- const currentVersion = "0.1.187";
11376
+ const currentVersion = "0.1.188";
11363
11377
  process.stderr.write(
11364
11378
  ` ${ansi2.gray("Current version:")} ${currentVersion}
11365
11379
  `
@@ -11500,7 +11514,7 @@ async function cmdLogin(options) {
11500
11514
  process.stderr.write("\n");
11501
11515
  printLogo();
11502
11516
  process.stderr.write("\n");
11503
- const ver = "0.1.187";
11517
+ const ver = "0.1.188";
11504
11518
  process.stderr.write(
11505
11519
  ` ${ansi2.bold("MindStudio Agent")} ${ver ? " " + ansi2.gray("v" + ver) : ""}
11506
11520
  `
@@ -11830,7 +11844,7 @@ async function main() {
11830
11844
  const updatePromise = command !== "mcp" && command !== "login" && command !== "update" ? checkForUpdate() : Promise.resolve(null);
11831
11845
  try {
11832
11846
  if (command === "version" || command === "-v") {
11833
- process.stdout.write("0.1.187\n");
11847
+ process.stdout.write("0.1.188\n");
11834
11848
  return;
11835
11849
  }
11836
11850
  if (command === "login") {
@@ -210,9 +210,9 @@ export interface Db {
210
210
  database?: string;
211
211
  }): RawQuery<T[]>;
212
212
  /**
213
- * Execute multiple reads and writes in a single round trip. All
214
- * operations run on the same database connection, eliminating
215
- * per-operation HTTP overhead. Writes execute in argument order.
213
+ * Execute multiple reads and writes in a single round trip, as one atomic
214
+ * transaction per database. Statements run in argument order; if any
215
+ * fails, the batch rolls back and the call rejects.
216
216
  *
217
217
  * Accepts Query objects (reads) and Mutation objects (writes from
218
218
  * push, update, remove, removeAll, clear). Compiles them to SQL,
@@ -0,0 +1,19 @@
1
+ /**
2
+ * What the platform reports beside a batch's results, said in the log of the
3
+ * request that ran the batch.
4
+ */
5
+ /**
6
+ * Whole-table reads the platform reports beside a batch's results: a statement
7
+ * that took a while because it read every row of a table, which an index on
8
+ * the columns it filters or sorts by (`defineTable`'s `indexes`) would make a
9
+ * lookup. The platform reports one for a slow statement at most once every 15
10
+ * minutes, so the line is a hint, not a count.
11
+ */
12
+ export declare function warnTableScans(scans: unknown): void;
13
+ /**
14
+ * A batch whose answer is large, which the platform reports with its size
15
+ * (`chars` of JSON), its rows and its queries. Every such batch warns, so the
16
+ * line is in the log of each request that read this much: the rows are held
17
+ * in the sandbox's memory, which all of a release's calls share.
18
+ */
19
+ export declare function warnLargeResult(largeResult: unknown): void;
package/dist/index.js CHANGED
@@ -125,7 +125,7 @@ function runWithContext(ctx, fn) {
125
125
  return als.run(ctx, fn);
126
126
  }
127
127
 
128
- // src/db/scanHints.ts
128
+ // src/db/queryHints.ts
129
129
  function warnTableScans(scans) {
130
130
  if (!Array.isArray(scans)) {
131
131
  return;
@@ -139,6 +139,18 @@ function warnTableScans(scans) {
139
139
  );
140
140
  }
141
141
  }
142
+ function warnLargeResult(largeResult) {
143
+ const { chars, rows, queries } = largeResult ?? {};
144
+ if (typeof chars !== "number" || !Number.isFinite(chars)) {
145
+ return;
146
+ }
147
+ const megabytes = Math.round(chars / (1024 * 1024));
148
+ const rowCount = typeof rows === "number" ? `${rows} rows from ` : "";
149
+ const queryCount = typeof queries === "number" ? ` (${rowCount}${queries} ${queries === 1 ? "query" : "queries"})` : "";
150
+ console.warn(
151
+ `[mindstudio] A database batch returned ${megabytes} MB of JSON${queryCount}. The sandbox holds it in memory that every call on the release shares. Select only the columns needed, page through the rows, or use an aggregate.`
152
+ );
153
+ }
142
154
 
143
155
  // src/db-ws.ts
144
156
  var DB_WS_SUBPROTOCOL = "ms-db-v2";
@@ -227,6 +239,7 @@ function deliver(self, msg) {
227
239
  );
228
240
  } else {
229
241
  warnTableScans(msg.scans);
242
+ warnLargeResult(msg.largeResult);
230
243
  p.resolve(msg.results);
231
244
  }
232
245
  }
@@ -8959,6 +8972,7 @@ var MindStudioAgent = class {
8959
8972
  }
8960
8973
  const data = await res.json();
8961
8974
  warnTableScans(data.scans);
8975
+ warnLargeResult(data.largeResult);
8962
8976
  return data.results;
8963
8977
  }
8964
8978
  /**