@squadbase/vite-server 0.1.10-dev.d23e546 → 0.1.11-dev.0c78963

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.
@@ -364,6 +364,37 @@ import { z } from "zod";
364
364
 
365
365
  // ../connectors/src/connectors/snowflake/utils.ts
366
366
  import crypto from "crypto";
367
+
368
+ // ../connectors/src/lib/approx-bytes.ts
369
+ function approxBytes(value, acc, limit) {
370
+ if (acc > limit) return acc;
371
+ if (value == null) return acc;
372
+ const t = typeof value;
373
+ if (t === "string") return acc + value.length;
374
+ if (t === "number" || t === "boolean") return acc + 8;
375
+ if (t === "bigint") return acc + 16;
376
+ if (value instanceof Date) return acc + 8;
377
+ if (Buffer.isBuffer(value)) return acc + value.byteLength;
378
+ if (Array.isArray(value)) {
379
+ for (const item of value) {
380
+ acc = approxBytes(item, acc, limit);
381
+ if (acc > limit) return acc;
382
+ }
383
+ return acc;
384
+ }
385
+ if (t === "object") {
386
+ const obj = value;
387
+ for (const k in obj) {
388
+ acc += k.length;
389
+ acc = approxBytes(obj[k], acc, limit);
390
+ if (acc > limit) return acc;
391
+ }
392
+ return acc;
393
+ }
394
+ return acc;
395
+ }
396
+
397
+ // ../connectors/src/connectors/snowflake/utils.ts
367
398
  function decryptPrivateKey(pem, passphrase) {
368
399
  if (!passphrase) return pem;
369
400
  return crypto.createPrivateKey({
@@ -372,10 +403,46 @@ function decryptPrivateKey(pem, passphrase) {
372
403
  passphrase
373
404
  }).export({ type: "pkcs8", format: "pem" });
374
405
  }
406
+ async function executeWithSizeLimit(conn, sql, options) {
407
+ const rows = [];
408
+ let acc = 0;
409
+ let exceeded = false;
410
+ await new Promise((resolve, reject) => {
411
+ const stmt = conn.execute({
412
+ sqlText: sql,
413
+ streamResult: true
414
+ });
415
+ const stream = stmt.streamRows();
416
+ stream.on("data", (row) => {
417
+ if (exceeded) return;
418
+ acc = approxBytes(row, acc, options.maxBytes);
419
+ if (acc > options.maxBytes) {
420
+ exceeded = true;
421
+ stream.destroy();
422
+ stmt.cancel(() => {
423
+ });
424
+ resolve();
425
+ return;
426
+ }
427
+ rows.push(row);
428
+ });
429
+ stream.on("end", () => {
430
+ resolve();
431
+ });
432
+ stream.on("error", (err) => {
433
+ if (exceeded) return;
434
+ reject(new Error(`Snowflake query failed: ${err.message}`));
435
+ });
436
+ });
437
+ if (exceeded) {
438
+ return { exceeded: true };
439
+ }
440
+ return { exceeded: false, rows };
441
+ }
375
442
 
376
443
  // ../connectors/src/connectors/snowflake/tools/execute-query.ts
377
- var MAX_ROWS = 500;
378
- var QUERY_TIMEOUT_MS = 6e4;
444
+ var MAX_RESULT_BYTES = 5 * 1024 * 1024;
445
+ var STATEMENT_TIMEOUT_SECONDS = 60;
379
446
  var inputSchema = z.object({
380
447
  toolUseIntent: z.string().optional().describe(
381
448
  "Brief description of what you intend to accomplish with this tool call"
@@ -389,7 +456,6 @@ var outputSchema = z.discriminatedUnion("success", [
389
456
  z.object({
390
457
  success: z.literal(true),
391
458
  rowCount: z.number(),
392
- truncated: z.boolean(),
393
459
  rows: z.array(z.record(z.string(), z.unknown()))
394
460
  }),
395
461
  z.object({
@@ -399,9 +465,12 @@ var outputSchema = z.discriminatedUnion("success", [
399
465
  ]);
400
466
  var executeQueryTool = new ConnectorTool({
401
467
  name: "executeQuery",
402
- description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
403
- Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
404
- Avoid loading large amounts of data; always include LIMIT in queries.`,
468
+ description: `Execute SQL against Snowflake. Results are streamed; if the approximate result size exceeds 5MB the call fails with an explicit error and you must retry with a smaller query (add LIMIT, wrap wide text columns with SUBSTR, or aggregate inside Snowflake).
469
+ Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), sampling (LIMIT, SAMPLE), and analytical queries.
470
+ Memory guidance:
471
+ - Avoid SELECT * on tables with long text columns (logs, JSON, concatenated text). Project only the columns you need; truncate wide text with SUBSTR(col, 1, N).
472
+ - For full-dataset analysis, do the aggregation inside Snowflake (COUNT, SUM, GROUP BY, APPROX_TOP_K, HISTOGRAM) instead of returning raw rows.
473
+ - Exploration is iterative: start with a small LIMIT to inspect shape, then refine.`,
405
474
  inputSchema,
406
475
  outputSchema,
407
476
  async execute({ connectionId, sql }, connections) {
@@ -443,39 +512,43 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
443
512
  else resolve();
444
513
  });
445
514
  });
446
- const allRows = await new Promise(
447
- (resolve, reject) => {
448
- const timeoutId = setTimeout(() => {
449
- reject(
450
- new Error(
451
- "Snowflake query timeout: query exceeded 60 seconds"
452
- )
453
- );
454
- }, QUERY_TIMEOUT_MS);
515
+ try {
516
+ await new Promise((resolve, reject) => {
455
517
  conn.execute({
456
- sqlText: sql,
457
- complete: (err, _stmt, rows) => {
458
- clearTimeout(timeoutId);
518
+ sqlText: `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${STATEMENT_TIMEOUT_SECONDS}`,
519
+ complete: (err) => {
459
520
  if (err)
460
- reject(new Error(`Snowflake query failed: ${err.message}`));
461
- else resolve(rows ?? []);
521
+ reject(
522
+ new Error(
523
+ `Failed to set Snowflake statement timeout: ${err.message}`
524
+ )
525
+ );
526
+ else resolve();
462
527
  }
463
528
  });
529
+ });
530
+ const result = await executeWithSizeLimit(conn, sql, {
531
+ maxBytes: MAX_RESULT_BYTES
532
+ });
533
+ if (result.exceeded) {
534
+ return {
535
+ success: false,
536
+ error: "Result size exceeded 5MB. Reduce the query: add LIMIT, wrap wide text columns with SUBSTR(col, 1, N), or aggregate inside Snowflake (COUNT/SUM/GROUP BY)."
537
+ };
464
538
  }
465
- );
466
- conn.destroy((err) => {
467
- if (err)
468
- console.warn(
469
- `[connector-query] Snowflake destroy error: ${err.message}`
470
- );
471
- });
472
- const truncated = allRows.length > MAX_ROWS;
473
- return {
474
- success: true,
475
- rowCount: Math.min(allRows.length, MAX_ROWS),
476
- truncated,
477
- rows: allRows.slice(0, MAX_ROWS)
478
- };
539
+ return {
540
+ success: true,
541
+ rowCount: result.rows.length,
542
+ rows: result.rows
543
+ };
544
+ } finally {
545
+ conn.destroy((err) => {
546
+ if (err)
547
+ console.warn(
548
+ `[connector-query] Snowflake destroy error: ${err.message}`
549
+ );
550
+ });
551
+ }
479
552
  } catch (err) {
480
553
  const msg = err instanceof Error ? err.message : String(err);
481
554
  return { success: false, error: msg };
@@ -664,8 +737,8 @@ var parameters2 = {
664
737
 
665
738
  // ../connectors/src/connectors/snowflake-pat/tools/execute-query.ts
666
739
  import { z as z2 } from "zod";
667
- var MAX_ROWS2 = 500;
668
- var QUERY_TIMEOUT_MS2 = 6e4;
740
+ var MAX_ROWS = 500;
741
+ var QUERY_TIMEOUT_MS = 6e4;
669
742
  var inputSchema2 = z2.object({
670
743
  toolUseIntent: z2.string().optional().describe(
671
744
  "Brief description of what you intend to accomplish with this tool call"
@@ -689,7 +762,7 @@ var outputSchema2 = z2.discriminatedUnion("success", [
689
762
  ]);
690
763
  var executeQueryTool2 = new ConnectorTool({
691
764
  name: "executeQuery",
692
- description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS2} rows.
765
+ description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
693
766
  Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
694
767
  Avoid loading large amounts of data; always include LIMIT in queries.`,
695
768
  inputSchema: inputSchema2,
@@ -735,7 +808,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
735
808
  "Snowflake query timeout: query exceeded 60 seconds"
736
809
  )
737
810
  );
738
- }, QUERY_TIMEOUT_MS2);
811
+ }, QUERY_TIMEOUT_MS);
739
812
  conn.execute({
740
813
  sqlText: sql,
741
814
  complete: (err, _stmt, rows) => {
@@ -753,12 +826,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
753
826
  `[connector-query] Snowflake destroy error: ${err.message}`
754
827
  );
755
828
  });
756
- const truncated = allRows.length > MAX_ROWS2;
829
+ const truncated = allRows.length > MAX_ROWS;
757
830
  return {
758
831
  success: true,
759
- rowCount: Math.min(allRows.length, MAX_ROWS2),
832
+ rowCount: Math.min(allRows.length, MAX_ROWS),
760
833
  truncated,
761
- rows: allRows.slice(0, MAX_ROWS2)
834
+ rows: allRows.slice(0, MAX_ROWS)
762
835
  };
763
836
  } catch (err) {
764
837
  const msg = err instanceof Error ? err.message : String(err);
@@ -1092,7 +1165,7 @@ var POSTGRES_DEFAULT_PORT = 5432;
1092
1165
 
1093
1166
  // ../connectors/src/connectors/postgresql/tools/execute-query.ts
1094
1167
  import { z as z3 } from "zod";
1095
- var MAX_ROWS3 = 500;
1168
+ var MAX_ROWS2 = 500;
1096
1169
  var CONNECT_TIMEOUT_MS = 1e4;
1097
1170
  var STATEMENT_TIMEOUT_MS = 6e4;
1098
1171
  var inputSchema3 = z3.object({
@@ -1116,7 +1189,7 @@ var outputSchema3 = z3.discriminatedUnion("success", [
1116
1189
  ]);
1117
1190
  var executeQueryTool3 = new ConnectorTool({
1118
1191
  name: "executeQuery",
1119
- description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS3} rows.
1192
+ description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS2} rows.
1120
1193
  Use for: schema exploration (information_schema), data sampling, analytical queries.
1121
1194
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1122
1195
  inputSchema: inputSchema3,
@@ -1154,12 +1227,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1154
1227
  STATEMENT_TIMEOUT_MS
1155
1228
  );
1156
1229
  const rows = result.rows;
1157
- const truncated = rows.length > MAX_ROWS3;
1230
+ const truncated = rows.length > MAX_ROWS2;
1158
1231
  return {
1159
1232
  success: true,
1160
- rowCount: Math.min(rows.length, MAX_ROWS3),
1233
+ rowCount: Math.min(rows.length, MAX_ROWS2),
1161
1234
  truncated,
1162
- rows: rows.slice(0, MAX_ROWS3)
1235
+ rows: rows.slice(0, MAX_ROWS2)
1163
1236
  };
1164
1237
  } finally {
1165
1238
  await pool.end();
@@ -1296,9 +1369,9 @@ var MYSQL_DEFAULT_PORT = 3306;
1296
1369
 
1297
1370
  // ../connectors/src/connectors/mysql/tools/execute-query.ts
1298
1371
  import { z as z4 } from "zod";
1299
- var MAX_ROWS4 = 500;
1372
+ var MAX_ROWS3 = 500;
1300
1373
  var CONNECT_TIMEOUT_MS2 = 1e4;
1301
- var QUERY_TIMEOUT_MS3 = 6e4;
1374
+ var QUERY_TIMEOUT_MS2 = 6e4;
1302
1375
  var inputSchema4 = z4.object({
1303
1376
  toolUseIntent: z4.string().optional().describe(
1304
1377
  "Brief description of what you intend to accomplish with this tool call"
@@ -1320,7 +1393,7 @@ var outputSchema4 = z4.discriminatedUnion("success", [
1320
1393
  ]);
1321
1394
  var executeQueryTool4 = new ConnectorTool({
1322
1395
  name: "executeQuery",
1323
- description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS4} rows.
1396
+ description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS3} rows.
1324
1397
  Use for: schema exploration (information_schema), data sampling, analytical queries.
1325
1398
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1326
1399
  inputSchema: inputSchema4,
@@ -1353,16 +1426,16 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1353
1426
  try {
1354
1427
  const queryPromise = pool.query(sql);
1355
1428
  const timeoutPromise = new Promise(
1356
- (_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS3)
1429
+ (_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS2)
1357
1430
  );
1358
1431
  const [rows] = await Promise.race([queryPromise, timeoutPromise]);
1359
1432
  const resultRows = Array.isArray(rows) ? rows : [];
1360
- const truncated = resultRows.length > MAX_ROWS4;
1433
+ const truncated = resultRows.length > MAX_ROWS3;
1361
1434
  return {
1362
1435
  success: true,
1363
- rowCount: Math.min(resultRows.length, MAX_ROWS4),
1436
+ rowCount: Math.min(resultRows.length, MAX_ROWS3),
1364
1437
  truncated,
1365
- rows: resultRows.slice(0, MAX_ROWS4)
1438
+ rows: resultRows.slice(0, MAX_ROWS3)
1366
1439
  };
1367
1440
  } finally {
1368
1441
  await pool.end();
@@ -1689,7 +1762,7 @@ var bigqueryOnboarding = new ConnectorOnboarding({
1689
1762
 
1690
1763
  // ../connectors/src/connectors/bigquery/tools/execute-query.ts
1691
1764
  import { z as z7 } from "zod";
1692
- var MAX_ROWS5 = 500;
1765
+ var MAX_ROWS4 = 500;
1693
1766
  var inputSchema7 = z7.object({
1694
1767
  toolUseIntent: z7.string().optional().describe(
1695
1768
  "Brief description of what you intend to accomplish with this tool call"
@@ -1713,7 +1786,7 @@ var outputSchema7 = z7.discriminatedUnion("success", [
1713
1786
  ]);
1714
1787
  var executeQueryTool5 = new ConnectorTool({
1715
1788
  name: "executeQuery",
1716
- description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS5} rows.
1789
+ description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS4} rows.
1717
1790
  Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
1718
1791
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1719
1792
  inputSchema: inputSchema7,
@@ -1740,12 +1813,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1740
1813
  const [job] = await bq.createQueryJob({ query: sql });
1741
1814
  const [rows] = await job.getQueryResults();
1742
1815
  const allRows = rows;
1743
- const truncated = allRows.length > MAX_ROWS5;
1816
+ const truncated = allRows.length > MAX_ROWS4;
1744
1817
  return {
1745
1818
  success: true,
1746
- rowCount: Math.min(allRows.length, MAX_ROWS5),
1819
+ rowCount: Math.min(allRows.length, MAX_ROWS4),
1747
1820
  truncated,
1748
- rows: allRows.slice(0, MAX_ROWS5)
1821
+ rows: allRows.slice(0, MAX_ROWS4)
1749
1822
  };
1750
1823
  } catch (err) {
1751
1824
  const msg = err instanceof Error ? err.message : String(err);
@@ -2146,7 +2219,7 @@ var bigqueryOnboarding2 = new ConnectorOnboarding({
2146
2219
 
2147
2220
  // ../connectors/src/connectors/bigquery-oauth/tools/execute-query.ts
2148
2221
  import { z as z10 } from "zod";
2149
- var MAX_ROWS6 = 500;
2222
+ var MAX_ROWS5 = 500;
2150
2223
  var REQUEST_TIMEOUT_MS3 = 6e4;
2151
2224
  var cachedToken3 = null;
2152
2225
  async function getProxyToken3(config) {
@@ -2213,7 +2286,7 @@ function parseQueryResponse(data) {
2213
2286
  }
2214
2287
  var executeQueryTool6 = new ConnectorTool({
2215
2288
  name: "executeQuery",
2216
- description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS6} rows.
2289
+ description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS5} rows.
2217
2290
  Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
2218
2291
  Avoid loading large amounts of data; always include LIMIT in queries.`,
2219
2292
  inputSchema: inputSchema10,
@@ -2246,7 +2319,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2246
2319
  body: JSON.stringify({
2247
2320
  url: queryUrl,
2248
2321
  method: "POST",
2249
- body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS6 }
2322
+ body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS5 }
2250
2323
  }),
2251
2324
  signal: controller.signal
2252
2325
  });
@@ -2256,12 +2329,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2256
2329
  return { success: false, error: errorMessage };
2257
2330
  }
2258
2331
  const rows = parseQueryResponse(data);
2259
- const truncated = rows.length > MAX_ROWS6;
2332
+ const truncated = rows.length > MAX_ROWS5;
2260
2333
  return {
2261
2334
  success: true,
2262
- rowCount: Math.min(rows.length, MAX_ROWS6),
2335
+ rowCount: Math.min(rows.length, MAX_ROWS5),
2263
2336
  truncated,
2264
- rows: rows.slice(0, MAX_ROWS6)
2337
+ rows: rows.slice(0, MAX_ROWS5)
2265
2338
  };
2266
2339
  } finally {
2267
2340
  clearTimeout(timeout);
@@ -2441,7 +2514,7 @@ var parameters7 = {
2441
2514
 
2442
2515
  // ../connectors/src/connectors/aws-athena/tools/execute-query.ts
2443
2516
  import { z as z11 } from "zod";
2444
- var MAX_ROWS7 = 500;
2517
+ var MAX_ROWS6 = 500;
2445
2518
  var POLL_INTERVAL_MS = 1e3;
2446
2519
  var POLL_TIMEOUT_MS = 12e4;
2447
2520
  var inputSchema11 = z11.object({
@@ -2465,7 +2538,7 @@ var outputSchema11 = z11.discriminatedUnion("success", [
2465
2538
  ]);
2466
2539
  var executeQueryTool7 = new ConnectorTool({
2467
2540
  name: "executeQuery",
2468
- description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS7} rows.
2541
+ description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS6} rows.
2469
2542
  Use for: schema exploration (SHOW DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries on S3 data.
2470
2543
  Avoid loading large amounts of data; always include LIMIT in queries.`,
2471
2544
  inputSchema: inputSchema11,
@@ -2542,12 +2615,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2542
2615
  });
2543
2616
  return obj;
2544
2617
  });
2545
- const truncated = dataRows.length > MAX_ROWS7;
2618
+ const truncated = dataRows.length > MAX_ROWS6;
2546
2619
  return {
2547
2620
  success: true,
2548
- rowCount: Math.min(dataRows.length, MAX_ROWS7),
2621
+ rowCount: Math.min(dataRows.length, MAX_ROWS6),
2549
2622
  truncated,
2550
- rows: dataRows.slice(0, MAX_ROWS7)
2623
+ rows: dataRows.slice(0, MAX_ROWS6)
2551
2624
  };
2552
2625
  } catch (err) {
2553
2626
  const msg = err instanceof Error ? err.message : String(err);
@@ -3462,7 +3535,7 @@ var parameters9 = {
3462
3535
 
3463
3536
  // ../connectors/src/connectors/redshift/tools/execute-query.ts
3464
3537
  import { z as z15 } from "zod";
3465
- var MAX_ROWS8 = 500;
3538
+ var MAX_ROWS7 = 500;
3466
3539
  var POLL_INTERVAL_MS2 = 1e3;
3467
3540
  var POLL_TIMEOUT_MS2 = 12e4;
3468
3541
  var inputSchema15 = z15.object({
@@ -3488,7 +3561,7 @@ var outputSchema15 = z15.discriminatedUnion("success", [
3488
3561
  ]);
3489
3562
  var executeQueryTool8 = new ConnectorTool({
3490
3563
  name: "executeQuery",
3491
- description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS8} rows.
3564
+ description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS7} rows.
3492
3565
  Use for: schema exploration, data sampling, analytical queries.
3493
3566
  Avoid loading large amounts of data; always include LIMIT in queries.`,
3494
3567
  inputSchema: inputSchema15,
@@ -3567,12 +3640,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
3567
3640
  });
3568
3641
  return row;
3569
3642
  });
3570
- const truncated = allRows.length > MAX_ROWS8;
3643
+ const truncated = allRows.length > MAX_ROWS7;
3571
3644
  return {
3572
3645
  success: true,
3573
- rowCount: Math.min(allRows.length, MAX_ROWS8),
3646
+ rowCount: Math.min(allRows.length, MAX_ROWS7),
3574
3647
  truncated,
3575
- rows: allRows.slice(0, MAX_ROWS8)
3648
+ rows: allRows.slice(0, MAX_ROWS7)
3576
3649
  };
3577
3650
  } catch (err) {
3578
3651
  const msg = err instanceof Error ? err.message : String(err);
@@ -3793,7 +3866,7 @@ var parameters10 = {
3793
3866
 
3794
3867
  // ../connectors/src/connectors/databricks/tools/execute-query.ts
3795
3868
  import { z as z16 } from "zod";
3796
- var MAX_ROWS9 = 500;
3869
+ var MAX_ROWS8 = 500;
3797
3870
  var inputSchema16 = z16.object({
3798
3871
  toolUseIntent: z16.string().optional().describe(
3799
3872
  "Brief description of what you intend to accomplish with this tool call"
@@ -3815,7 +3888,7 @@ var outputSchema16 = z16.discriminatedUnion("success", [
3815
3888
  ]);
3816
3889
  var executeQueryTool9 = new ConnectorTool({
3817
3890
  name: "executeQuery",
3818
- description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS9} rows.
3891
+ description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS8} rows.
3819
3892
  Use for: schema exploration (SHOW CATALOGS/DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries.
3820
3893
  Avoid loading large amounts of data; always include LIMIT in queries.`,
3821
3894
  inputSchema: inputSchema16,
@@ -3846,12 +3919,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
3846
3919
  runAsync: true
3847
3920
  });
3848
3921
  const allRows = await operation.fetchAll();
3849
- const truncated = allRows.length > MAX_ROWS9;
3922
+ const truncated = allRows.length > MAX_ROWS8;
3850
3923
  return {
3851
3924
  success: true,
3852
- rowCount: Math.min(allRows.length, MAX_ROWS9),
3925
+ rowCount: Math.min(allRows.length, MAX_ROWS8),
3853
3926
  truncated,
3854
- rows: allRows.slice(0, MAX_ROWS9)
3927
+ rows: allRows.slice(0, MAX_ROWS8)
3855
3928
  };
3856
3929
  } finally {
3857
3930
  if (operation) await operation.close().catch(() => {
@@ -10796,7 +10869,7 @@ var parameters29 = {
10796
10869
 
10797
10870
  // ../connectors/src/connectors/squadbase-db/tools/execute-query.ts
10798
10871
  import { z as z40 } from "zod";
10799
- var MAX_ROWS10 = 500;
10872
+ var MAX_ROWS9 = 500;
10800
10873
  var CONNECT_TIMEOUT_MS3 = 1e4;
10801
10874
  var STATEMENT_TIMEOUT_MS2 = 6e4;
10802
10875
  var inputSchema40 = z40.object({
@@ -10820,7 +10893,7 @@ var outputSchema40 = z40.discriminatedUnion("success", [
10820
10893
  ]);
10821
10894
  var executeQueryTool10 = new ConnectorTool({
10822
10895
  name: "executeQuery",
10823
- description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS10} rows.
10896
+ description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS9} rows.
10824
10897
  Use for: schema exploration (information_schema), data sampling, analytical queries.
10825
10898
  Avoid loading large amounts of data; always include LIMIT in queries.`,
10826
10899
  inputSchema: inputSchema40,
@@ -10849,12 +10922,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
10849
10922
  try {
10850
10923
  const result = await pool.query(sql);
10851
10924
  const rows = result.rows;
10852
- const truncated = rows.length > MAX_ROWS10;
10925
+ const truncated = rows.length > MAX_ROWS9;
10853
10926
  return {
10854
10927
  success: true,
10855
- rowCount: Math.min(rows.length, MAX_ROWS10),
10928
+ rowCount: Math.min(rows.length, MAX_ROWS9),
10856
10929
  truncated,
10857
- rows: rows.slice(0, MAX_ROWS10)
10930
+ rows: rows.slice(0, MAX_ROWS9)
10858
10931
  };
10859
10932
  } finally {
10860
10933
  await pool.end();
@@ -13628,8 +13701,8 @@ var parameters41 = {
13628
13701
 
13629
13702
  // ../connectors/src/connectors/clickhouse/tools/execute-query.ts
13630
13703
  import { z as z49 } from "zod";
13631
- var MAX_ROWS11 = 500;
13632
- var QUERY_TIMEOUT_MS4 = 6e4;
13704
+ var MAX_ROWS10 = 500;
13705
+ var QUERY_TIMEOUT_MS3 = 6e4;
13633
13706
  var inputSchema49 = z49.object({
13634
13707
  toolUseIntent: z49.string().optional().describe(
13635
13708
  "Brief description of what you intend to accomplish with this tool call"
@@ -13651,7 +13724,7 @@ var outputSchema49 = z49.discriminatedUnion("success", [
13651
13724
  ]);
13652
13725
  var executeQueryTool11 = new ConnectorTool({
13653
13726
  name: "executeQuery",
13654
- description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS11} rows.
13727
+ description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS10} rows.
13655
13728
  Use for: schema exploration (SHOW DATABASES, SHOW TABLES, DESCRIBE TABLE), data sampling, analytical queries on large-scale columnar data.
13656
13729
  Avoid loading large amounts of data; always include LIMIT in queries.`,
13657
13730
  inputSchema: inputSchema49,
@@ -13679,7 +13752,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
13679
13752
  username,
13680
13753
  password: password || "",
13681
13754
  database: database || "default",
13682
- request_timeout: QUERY_TIMEOUT_MS4
13755
+ request_timeout: QUERY_TIMEOUT_MS3
13683
13756
  });
13684
13757
  try {
13685
13758
  const resultSet = await client.query({
@@ -13687,12 +13760,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
13687
13760
  format: "JSONEachRow"
13688
13761
  });
13689
13762
  const allRows = await resultSet.json();
13690
- const truncated = allRows.length > MAX_ROWS11;
13763
+ const truncated = allRows.length > MAX_ROWS10;
13691
13764
  return {
13692
13765
  success: true,
13693
- rowCount: Math.min(allRows.length, MAX_ROWS11),
13766
+ rowCount: Math.min(allRows.length, MAX_ROWS10),
13694
13767
  truncated,
13695
- rows: allRows.slice(0, MAX_ROWS11)
13768
+ rows: allRows.slice(0, MAX_ROWS10)
13696
13769
  };
13697
13770
  } finally {
13698
13771
  await client.close();
@@ -13848,7 +13921,7 @@ var parameters42 = {
13848
13921
  import { z as z50 } from "zod";
13849
13922
  var MAX_DOCUMENTS = 500;
13850
13923
  var CONNECT_TIMEOUT_MS4 = 1e4;
13851
- var QUERY_TIMEOUT_MS5 = 6e4;
13924
+ var QUERY_TIMEOUT_MS4 = 6e4;
13852
13925
  var inputSchema50 = z50.object({
13853
13926
  toolUseIntent: z50.string().optional().describe(
13854
13927
  "Brief description of what you intend to accomplish with this tool call"
@@ -13907,7 +13980,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
13907
13980
  const client = new MongoClient(connectionUrl, {
13908
13981
  connectTimeoutMS: CONNECT_TIMEOUT_MS4,
13909
13982
  serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS4,
13910
- socketTimeoutMS: QUERY_TIMEOUT_MS5
13983
+ socketTimeoutMS: QUERY_TIMEOUT_MS4
13911
13984
  });
13912
13985
  try {
13913
13986
  await client.connect();
@@ -13953,7 +14026,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
13953
14026
  import { z as z51 } from "zod";
13954
14027
  var MAX_DOCUMENTS2 = 500;
13955
14028
  var CONNECT_TIMEOUT_MS5 = 1e4;
13956
- var QUERY_TIMEOUT_MS6 = 6e4;
14029
+ var QUERY_TIMEOUT_MS5 = 6e4;
13957
14030
  var inputSchema51 = z51.object({
13958
14031
  toolUseIntent: z51.string().optional().describe(
13959
14032
  "Brief description of what you intend to accomplish with this tool call"
@@ -14004,7 +14077,7 @@ Common stages: $match (filter), $group (aggregate), $sort (order), $project (res
14004
14077
  const client = new MongoClient(connectionUrl, {
14005
14078
  connectTimeoutMS: CONNECT_TIMEOUT_MS5,
14006
14079
  serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS5,
14007
- socketTimeoutMS: QUERY_TIMEOUT_MS6
14080
+ socketTimeoutMS: QUERY_TIMEOUT_MS5
14008
14081
  });
14009
14082
  try {
14010
14083
  await client.connect();
@@ -14137,7 +14210,41 @@ var mongodbConnector = new ConnectorPlugin({
14137
14210
 
14138
14211
  ### Business Logic
14139
14212
 
14140
- The business logic type for this connector is "typescript".
14213
+ The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables, and do NOT \`import { MongoClient } from "mongodb"\` in handler code \u2014 the \`mongodb\` driver is not part of the user dashboard's runtime, only of the connector SDK.
14214
+
14215
+ \u26A0\uFE0F **The client returned by \`connection(connectionId)\` is NOT a raw \`mongodb\` \`MongoClient\`.** It is a thin wrapper that opens a fresh connection per call, runs the requested operation against the database configured on the connection, and converts BSON \`ObjectId\` values to their hex string for JSON-safe responses. The methods are:
14216
+
14217
+ - \`client.aggregate<T>(collection, pipeline, options?) => Promise<T[]>\` \u2014 runs an aggregation pipeline and returns the document array. Always include a \`$limit\` stage.
14218
+ - \`client.find<T>(collection, filter?, options?) => Promise<T[]>\` \u2014 \`options\` accepts \`{ projection?, sort?, limit?, skip? }\`. Always pass \`limit\`.
14219
+ - \`client.findOne<T>(collection, filter?, options?) => Promise<T | null>\` \u2014 convenience wrapper around \`find\` with \`limit: 1\`.
14220
+ - \`client.countDocuments(collection, filter?) => Promise<number>\` \u2014 accurate count (not \`estimatedDocumentCount\`).
14221
+ - \`client.listCollections() => Promise<{ name: string; type: string }[]>\` \u2014 collections in the configured database.
14222
+
14223
+ There is **no** \`client.db(...)\`, \`client.connect()\`, or raw cursor / \`MongoClient\` API exposed through this client \u2014 those calls fail with \`X is not a function\`.
14224
+
14225
+ \`\`\`ts
14226
+ import type { Context } from "hono";
14227
+ import { connection } from "@squadbase/vite-server/connectors/mongodb";
14228
+
14229
+ const mongo = connection("<connectionId>");
14230
+
14231
+ export default async function handler(_c: Context) {
14232
+ const rows = await mongo.aggregate<{ country: string; count: number }>(
14233
+ "<collectionName>",
14234
+ [
14235
+ { $match: { country: { $nin: [null, ""] } } },
14236
+ { $group: { _id: "$country", count: { $sum: 1 } } },
14237
+ { $sort: { count: -1 } },
14238
+ { $limit: 20 },
14239
+ { $project: { _id: 0, country: "$_id", count: 1 } },
14240
+ ],
14241
+ );
14242
+
14243
+ return new Response(JSON.stringify(rows), {
14244
+ headers: { "Content-Type": "application/json" },
14245
+ });
14246
+ }
14247
+ \`\`\`
14141
14248
 
14142
14249
  ### MongoDB Reference
14143
14250
  - MongoDB stores data as flexible JSON-like documents (BSON)
@@ -14158,7 +14265,41 @@ The business logic type for this connector is "typescript".
14158
14265
 
14159
14266
  ### Business Logic
14160
14267
 
14161
- \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002
14268
+ \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u305F\u308A\u3001\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3067 \`import { MongoClient } from "mongodb"\` \u3092\u884C\u3063\u305F\u308A\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 \`mongodb\` \u30C9\u30E9\u30A4\u30D0\u306F\u30E6\u30FC\u30B6\u30FC\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u306E\u30E9\u30F3\u30BF\u30A4\u30E0\u306B\u306F\u542B\u307E\u308C\u305A\u3001\u30B3\u30CD\u30AF\u30BFSDK\u5185\u90E8\u306B\u306E\u307F\u5B58\u5728\u3057\u307E\u3059\u3002
14269
+
14270
+ \u26A0\uFE0F **\`connection(connectionId)\` \u304C\u8FD4\u3059\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u306F \`mongodb\` \u306E \`MongoClient\` \u305D\u306E\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002** \u547C\u3073\u51FA\u3057\u3054\u3068\u306B\u65B0\u3057\u3044\u63A5\u7D9A\u3092\u958B\u304D\u3001\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u5BFE\u3057\u3066\u64CD\u4F5C\u3092\u5B9F\u884C\u3057\u3001BSON \u306E \`ObjectId\` \u3092 JSON \u5316\u306B\u5B89\u5168\u306A hex \u6587\u5B57\u5217\u306B\u5909\u63DB\u3059\u308B\u8584\u3044\u30E9\u30C3\u30D1\u30FC\u3067\u3059\u3002\u516C\u958B\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059\uFF1A
14271
+
14272
+ - \`client.aggregate<T>(collection, pipeline, options?) => Promise<T[]>\` \u2014 \u96C6\u7D04\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u3092\u5B9F\u884C\u3057\u3066\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u914D\u5217\u3092\u8FD4\u3059\u3002\`$limit\` \u30B9\u30C6\u30FC\u30B8\u3092\u5FC5\u305A\u542B\u3081\u308B\u3053\u3068\u3002
14273
+ - \`client.find<T>(collection, filter?, options?) => Promise<T[]>\` \u2014 \`options\` \u306F \`{ projection?, sort?, limit?, skip? }\`\u3002\`limit\` \u3092\u5FC5\u305A\u6307\u5B9A\u3059\u308B\u3053\u3068\u3002
14274
+ - \`client.findOne<T>(collection, filter?, options?) => Promise<T | null>\` \u2014 \`limit: 1\` \u3067\u306E \`find\` \u306E\u30E9\u30C3\u30D1\u30FC\u3002
14275
+ - \`client.countDocuments(collection, filter?) => Promise<number>\` \u2014 \u6B63\u78BA\u306A\u30AB\u30A6\u30F3\u30C8\uFF08\`estimatedDocumentCount\` \u3067\u306F\u306A\u3044\uFF09\u3002
14276
+ - \`client.listCollections() => Promise<{ name: string; type: string }[]>\` \u2014 \u8A2D\u5B9A\u3055\u308C\u305F\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u5185\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7\u3002
14277
+
14278
+ \`client.db(...)\`\u3001\`client.connect()\`\u3001\u751F\u306E\u30AB\u30FC\u30BD\u30EB\u3084 \`MongoClient\` API \u306F **\u5B58\u5728\u3057\u306A\u3044** \u2014 \`X is not a function\` \u3067\u5931\u6557\u3059\u308B\u3002
14279
+
14280
+ \`\`\`ts
14281
+ import type { Context } from "hono";
14282
+ import { connection } from "@squadbase/vite-server/connectors/mongodb";
14283
+
14284
+ const mongo = connection("<connectionId>");
14285
+
14286
+ export default async function handler(_c: Context) {
14287
+ const rows = await mongo.aggregate<{ country: string; count: number }>(
14288
+ "<collectionName>",
14289
+ [
14290
+ { $match: { country: { $nin: [null, ""] } } },
14291
+ { $group: { _id: "$country", count: { $sum: 1 } } },
14292
+ { $sort: { count: -1 } },
14293
+ { $limit: 20 },
14294
+ { $project: { _id: 0, country: "$_id", count: 1 } },
14295
+ ],
14296
+ );
14297
+
14298
+ return new Response(JSON.stringify(rows), {
14299
+ headers: { "Content-Type": "application/json" },
14300
+ });
14301
+ }
14302
+ \`\`\`
14162
14303
 
14163
14304
  ### MongoDB \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
14164
14305
  - MongoDB\u306F\u30D5\u30EC\u30AD\u30B7\u30D6\u30EB\u306AJSON\u5F62\u5F0F\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\uFF08BSON\uFF09\u3068\u3057\u3066\u30C7\u30FC\u30BF\u3092\u683C\u7D0D\u3057\u307E\u3059
@@ -23165,7 +23306,7 @@ function redactJdbcUrl(jdbcUrl) {
23165
23306
  }
23166
23307
 
23167
23308
  // ../connectors/src/connectors/jdbc/tools/execute-query.ts
23168
- var MAX_ROWS12 = 500;
23309
+ var MAX_ROWS11 = 500;
23169
23310
  var CONNECT_TIMEOUT_MS7 = 1e4;
23170
23311
  var STATEMENT_TIMEOUT_MS3 = 6e4;
23171
23312
  var inputSchema82 = z82.object({
@@ -23191,7 +23332,7 @@ var outputSchema82 = z82.discriminatedUnion("success", [
23191
23332
  ]);
23192
23333
  var executeQueryTool12 = new ConnectorTool({
23193
23334
  name: "executeQuery",
23194
- description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS12} rows.
23335
+ description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS11} rows.
23195
23336
  Use for: schema exploration via \`information_schema\` (or USER_TABLES on Oracle), data sampling, analytical queries.
23196
23337
  The connector dispatches by JDBC URL prefix to the matching driver
23197
23338
  (PostgreSQL / Redshift / MySQL / MariaDB / SQL Server / Oracle), so use the dialect that matches the connection.
@@ -23232,9 +23373,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23232
23373
  const rows = result.rows;
23233
23374
  return {
23234
23375
  success: true,
23235
- rowCount: Math.min(rows.length, MAX_ROWS12),
23236
- truncated: rows.length > MAX_ROWS12,
23237
- rows: rows.slice(0, MAX_ROWS12)
23376
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23377
+ truncated: rows.length > MAX_ROWS11,
23378
+ rows: rows.slice(0, MAX_ROWS11)
23238
23379
  };
23239
23380
  }
23240
23381
  if (parsed.driver === "oracle") {
@@ -23249,9 +23390,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23249
23390
  const rows = result.rows;
23250
23391
  return {
23251
23392
  success: true,
23252
- rowCount: Math.min(rows.length, MAX_ROWS12),
23253
- truncated: rows.length > MAX_ROWS12,
23254
- rows: rows.slice(0, MAX_ROWS12)
23393
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23394
+ truncated: rows.length > MAX_ROWS11,
23395
+ rows: rows.slice(0, MAX_ROWS11)
23255
23396
  };
23256
23397
  }
23257
23398
  let tunnel;
@@ -23275,12 +23416,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23275
23416
  STATEMENT_TIMEOUT_MS3
23276
23417
  );
23277
23418
  const rows = result.rows;
23278
- const truncated = rows.length > MAX_ROWS12;
23419
+ const truncated = rows.length > MAX_ROWS11;
23279
23420
  return {
23280
23421
  success: true,
23281
- rowCount: Math.min(rows.length, MAX_ROWS12),
23422
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23282
23423
  truncated,
23283
- rows: rows.slice(0, MAX_ROWS12)
23424
+ rows: rows.slice(0, MAX_ROWS11)
23284
23425
  };
23285
23426
  } finally {
23286
23427
  await pool2.end();
@@ -23301,12 +23442,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23301
23442
  );
23302
23443
  const [rows] = await Promise.race([queryPromise, timeoutPromise]);
23303
23444
  const resultRows = Array.isArray(rows) ? rows : [];
23304
- const truncated = resultRows.length > MAX_ROWS12;
23445
+ const truncated = resultRows.length > MAX_ROWS11;
23305
23446
  return {
23306
23447
  success: true,
23307
- rowCount: Math.min(resultRows.length, MAX_ROWS12),
23448
+ rowCount: Math.min(resultRows.length, MAX_ROWS11),
23308
23449
  truncated,
23309
- rows: resultRows.slice(0, MAX_ROWS12)
23450
+ rows: resultRows.slice(0, MAX_ROWS11)
23310
23451
  };
23311
23452
  } finally {
23312
23453
  await pool.end();
@@ -24575,7 +24716,7 @@ var parameters70 = {
24575
24716
 
24576
24717
  // ../connectors/src/connectors/supabase/tools/execute-query.ts
24577
24718
  import { z as z86 } from "zod";
24578
- var MAX_ROWS13 = 500;
24719
+ var MAX_ROWS12 = 500;
24579
24720
  var CONNECT_TIMEOUT_MS8 = 1e4;
24580
24721
  var STATEMENT_TIMEOUT_MS4 = 6e4;
24581
24722
  var inputSchema86 = z86.object({
@@ -24601,7 +24742,7 @@ var outputSchema86 = z86.discriminatedUnion("success", [
24601
24742
  ]);
24602
24743
  var executeQueryTool13 = new ConnectorTool({
24603
24744
  name: "executeQuery",
24604
- description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS13} rows.
24745
+ description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS12} rows.
24605
24746
  Use for: schema exploration (information_schema), data sampling, and analytical queries against Supabase tables.
24606
24747
  User tables live in the \`public\` schema by default; Supabase-managed metadata lives in \`auth\` and \`storage\`.
24607
24748
  Avoid loading large amounts of data; always include LIMIT in queries.`,
@@ -24631,12 +24772,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
24631
24772
  try {
24632
24773
  const result = await pool.query(sql);
24633
24774
  const rows = result.rows;
24634
- const truncated = rows.length > MAX_ROWS13;
24775
+ const truncated = rows.length > MAX_ROWS12;
24635
24776
  return {
24636
24777
  success: true,
24637
- rowCount: Math.min(rows.length, MAX_ROWS13),
24778
+ rowCount: Math.min(rows.length, MAX_ROWS12),
24638
24779
  truncated,
24639
- rows: rows.slice(0, MAX_ROWS13)
24780
+ rows: rows.slice(0, MAX_ROWS12)
24640
24781
  };
24641
24782
  } finally {
24642
24783
  await pool.end();
@@ -25115,7 +25256,7 @@ var parameters72 = {
25115
25256
 
25116
25257
  // ../connectors/src/connectors/sqlserver/tools/execute-query.ts
25117
25258
  import { z as z88 } from "zod";
25118
- var MAX_ROWS14 = 500;
25259
+ var MAX_ROWS13 = 500;
25119
25260
  var inputSchema88 = z88.object({
25120
25261
  toolUseIntent: z88.string().optional().describe(
25121
25262
  "Brief description of what you intend to accomplish with this tool call"
@@ -25139,7 +25280,7 @@ var outputSchema88 = z88.discriminatedUnion("success", [
25139
25280
  ]);
25140
25281
  var executeQueryTool14 = new ConnectorTool({
25141
25282
  name: "executeQuery",
25142
- description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS14} rows.
25283
+ description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS13} rows.
25143
25284
  Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
25144
25285
  SQL Server uses \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets (\`[schema].[table]\`).
25145
25286
  Avoid loading large amounts of data; always include \`TOP\` in queries.`,
@@ -25172,12 +25313,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
25172
25313
  const { rows } = await runMssqlQuery(parsed, sql, {
25173
25314
  tunnelParams: connectionParamsToRecord(connection)
25174
25315
  });
25175
- const truncated = rows.length > MAX_ROWS14;
25316
+ const truncated = rows.length > MAX_ROWS13;
25176
25317
  return {
25177
25318
  success: true,
25178
- rowCount: Math.min(rows.length, MAX_ROWS14),
25319
+ rowCount: Math.min(rows.length, MAX_ROWS13),
25179
25320
  truncated,
25180
- rows: rows.slice(0, MAX_ROWS14)
25321
+ rows: rows.slice(0, MAX_ROWS13)
25181
25322
  };
25182
25323
  } catch (err) {
25183
25324
  let msg = err instanceof Error ? err.message : String(err);
@@ -25310,7 +25451,7 @@ var parameters73 = {
25310
25451
 
25311
25452
  // ../connectors/src/connectors/azure-sql/tools/execute-query.ts
25312
25453
  import { z as z89 } from "zod";
25313
- var MAX_ROWS15 = 500;
25454
+ var MAX_ROWS14 = 500;
25314
25455
  var inputSchema89 = z89.object({
25315
25456
  toolUseIntent: z89.string().optional().describe(
25316
25457
  "Brief description of what you intend to accomplish with this tool call"
@@ -25334,7 +25475,7 @@ var outputSchema89 = z89.discriminatedUnion("success", [
25334
25475
  ]);
25335
25476
  var executeQueryTool15 = new ConnectorTool({
25336
25477
  name: "executeQuery",
25337
- description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS15} rows.
25478
+ description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS14} rows.
25338
25479
  Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
25339
25480
  Azure SQL is T-SQL: use \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets.
25340
25481
  Avoid loading large amounts of data; always include \`TOP\` in queries.`,
@@ -25368,12 +25509,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
25368
25509
  forceEncrypt: true,
25369
25510
  tunnelParams: connectionParamsToRecord(connection)
25370
25511
  });
25371
- const truncated = rows.length > MAX_ROWS15;
25512
+ const truncated = rows.length > MAX_ROWS14;
25372
25513
  return {
25373
25514
  success: true,
25374
- rowCount: Math.min(rows.length, MAX_ROWS15),
25515
+ rowCount: Math.min(rows.length, MAX_ROWS14),
25375
25516
  truncated,
25376
- rows: rows.slice(0, MAX_ROWS15)
25517
+ rows: rows.slice(0, MAX_ROWS14)
25377
25518
  };
25378
25519
  } catch (err) {
25379
25520
  let msg = err instanceof Error ? err.message : String(err);
@@ -25692,7 +25833,7 @@ var cosmosdbConnector = new ConnectorPlugin({
25692
25833
 
25693
25834
  ### Business Logic
25694
25835
 
25695
- The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
25836
+ The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables, and do NOT \`import { CosmosClient } from "@azure/cosmos"\` in handler code \u2014 the \`@azure/cosmos\` driver is not part of the user dashboard's runtime, only of the connector SDK.
25696
25837
 
25697
25838
  \u26A0\uFE0F **The client returned by \`connection(connectionId)\` is NOT the raw \`@azure/cosmos\` \`CosmosClient\`.** It is a thin wrapper exposing only two methods:
25698
25839
  - \`client.query<T>(container, sql, options?) => Promise<T[]>\` \u2014 runs a Cosmos SQL query against the named container and returns the **already-unwrapped** items array (no \`{ resources }\` wrapper). \`options\` accepts \`{ maxItemCount?: number; partitionKey?: unknown }\`.
@@ -25738,7 +25879,7 @@ export default async function handler(_c: Context) {
25738
25879
 
25739
25880
  ### Business Logic
25740
25881
 
25741
- \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
25882
+ \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u305F\u308A\u3001\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3067 \`import { CosmosClient } from "@azure/cosmos"\` \u3092\u884C\u3063\u305F\u308A\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 \`@azure/cosmos\` \u30C9\u30E9\u30A4\u30D0\u306F\u30E6\u30FC\u30B6\u30FC\u30C0\u30C3\u30B7\u30E5\u30DC\u30FC\u30C9\u306E\u30E9\u30F3\u30BF\u30A4\u30E0\u306B\u306F\u542B\u307E\u308C\u305A\u3001\u30B3\u30CD\u30AF\u30BFSDK\u5185\u90E8\u306B\u306E\u307F\u5B58\u5728\u3057\u307E\u3059\u3002
25742
25883
 
25743
25884
  \u26A0\uFE0F **\`connection(connectionId)\` \u304C\u8FD4\u3059\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u306F \`@azure/cosmos\` \u306E \`CosmosClient\` \u305D\u306E\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002** \u4EE5\u4E0B\u306E2\u30E1\u30BD\u30C3\u30C9\u306E\u307F\u3092\u516C\u958B\u3059\u308B\u8584\u3044\u30E9\u30C3\u30D1\u30FC\u3067\u3059\uFF1A
25744
25885
  - \`client.query<T>(container, sql, options?) => Promise<T[]>\` \u2014 \u6307\u5B9A\u30B3\u30F3\u30C6\u30CA\u306B\u5BFE\u3057\u3066 Cosmos SQL \u3092\u5B9F\u884C\u3057\u3001**\u3059\u3067\u306B\u5C55\u958B\u6E08\u307F\u306E\u30A2\u30A4\u30C6\u30E0\u914D\u5217**\u3092\u8FD4\u3059\uFF08\`{ resources }\` \u3067\u30E9\u30C3\u30D7\u3055\u308C\u3066\u3044\u306A\u3044\uFF09\u3002\`options\` \u306F \`{ maxItemCount?: number; partitionKey?: unknown }\`\u3002
@@ -25850,7 +25991,7 @@ var parameters75 = {
25850
25991
 
25851
25992
  // ../connectors/src/connectors/oracle/tools/execute-query.ts
25852
25993
  import { z as z92 } from "zod";
25853
- var MAX_ROWS16 = 500;
25994
+ var MAX_ROWS15 = 500;
25854
25995
  var inputSchema92 = z92.object({
25855
25996
  toolUseIntent: z92.string().optional().describe(
25856
25997
  "Brief description of what you intend to accomplish with this tool call"
@@ -25874,7 +26015,7 @@ var outputSchema92 = z92.discriminatedUnion("success", [
25874
26015
  ]);
25875
26016
  var executeQueryTool16 = new ConnectorTool({
25876
26017
  name: "executeQuery",
25877
- description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS16} rows.
26018
+ description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS15} rows.
25878
26019
  Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\`, data sampling, and analytical queries.
25879
26020
  Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
25880
26021
  Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
@@ -25909,12 +26050,12 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
25909
26050
  const { rows } = await runOracleQuery(parsed, cleanSql, {
25910
26051
  tunnelParams: connectionParamsToRecord(connection)
25911
26052
  });
25912
- const truncated = rows.length > MAX_ROWS16;
26053
+ const truncated = rows.length > MAX_ROWS15;
25913
26054
  return {
25914
26055
  success: true,
25915
- rowCount: Math.min(rows.length, MAX_ROWS16),
26056
+ rowCount: Math.min(rows.length, MAX_ROWS15),
25916
26057
  truncated,
25917
- rows: rows.slice(0, MAX_ROWS16)
26058
+ rows: rows.slice(0, MAX_ROWS15)
25918
26059
  };
25919
26060
  } catch (err) {
25920
26061
  let msg = err instanceof Error ? err.message : String(err);
@@ -25933,7 +26074,7 @@ var oracleConnector = new ConnectorPlugin({
25933
26074
  description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
25934
26075
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
25935
26076
  parameters: parameters75,
25936
- releaseFlag: { dev1: true, dev2: false, prod: false },
26077
+ releaseFlag: { dev1: true, dev2: true, prod: true },
25937
26078
  categories: ["database"],
25938
26079
  onboarding: oracleOnboarding,
25939
26080
  systemPrompt: {