@squadbase/vite-server 0.1.10 → 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.
package/dist/cli/index.js CHANGED
@@ -438,6 +438,37 @@ import { z } from "zod";
438
438
 
439
439
  // ../connectors/src/connectors/snowflake/utils.ts
440
440
  import crypto from "crypto";
441
+
442
+ // ../connectors/src/lib/approx-bytes.ts
443
+ function approxBytes(value, acc, limit) {
444
+ if (acc > limit) return acc;
445
+ if (value == null) return acc;
446
+ const t = typeof value;
447
+ if (t === "string") return acc + value.length;
448
+ if (t === "number" || t === "boolean") return acc + 8;
449
+ if (t === "bigint") return acc + 16;
450
+ if (value instanceof Date) return acc + 8;
451
+ if (Buffer.isBuffer(value)) return acc + value.byteLength;
452
+ if (Array.isArray(value)) {
453
+ for (const item of value) {
454
+ acc = approxBytes(item, acc, limit);
455
+ if (acc > limit) return acc;
456
+ }
457
+ return acc;
458
+ }
459
+ if (t === "object") {
460
+ const obj = value;
461
+ for (const k in obj) {
462
+ acc += k.length;
463
+ acc = approxBytes(obj[k], acc, limit);
464
+ if (acc > limit) return acc;
465
+ }
466
+ return acc;
467
+ }
468
+ return acc;
469
+ }
470
+
471
+ // ../connectors/src/connectors/snowflake/utils.ts
441
472
  function decryptPrivateKey(pem, passphrase) {
442
473
  if (!passphrase) return pem;
443
474
  return crypto.createPrivateKey({
@@ -446,10 +477,46 @@ function decryptPrivateKey(pem, passphrase) {
446
477
  passphrase
447
478
  }).export({ type: "pkcs8", format: "pem" });
448
479
  }
480
+ async function executeWithSizeLimit(conn, sql, options) {
481
+ const rows = [];
482
+ let acc = 0;
483
+ let exceeded = false;
484
+ await new Promise((resolve, reject) => {
485
+ const stmt = conn.execute({
486
+ sqlText: sql,
487
+ streamResult: true
488
+ });
489
+ const stream = stmt.streamRows();
490
+ stream.on("data", (row) => {
491
+ if (exceeded) return;
492
+ acc = approxBytes(row, acc, options.maxBytes);
493
+ if (acc > options.maxBytes) {
494
+ exceeded = true;
495
+ stream.destroy();
496
+ stmt.cancel(() => {
497
+ });
498
+ resolve();
499
+ return;
500
+ }
501
+ rows.push(row);
502
+ });
503
+ stream.on("end", () => {
504
+ resolve();
505
+ });
506
+ stream.on("error", (err) => {
507
+ if (exceeded) return;
508
+ reject(new Error(`Snowflake query failed: ${err.message}`));
509
+ });
510
+ });
511
+ if (exceeded) {
512
+ return { exceeded: true };
513
+ }
514
+ return { exceeded: false, rows };
515
+ }
449
516
 
450
517
  // ../connectors/src/connectors/snowflake/tools/execute-query.ts
451
- var MAX_ROWS = 500;
452
- var QUERY_TIMEOUT_MS = 6e4;
518
+ var MAX_RESULT_BYTES = 5 * 1024 * 1024;
519
+ var STATEMENT_TIMEOUT_SECONDS = 60;
453
520
  var inputSchema = z.object({
454
521
  toolUseIntent: z.string().optional().describe(
455
522
  "Brief description of what you intend to accomplish with this tool call"
@@ -463,7 +530,6 @@ var outputSchema = z.discriminatedUnion("success", [
463
530
  z.object({
464
531
  success: z.literal(true),
465
532
  rowCount: z.number(),
466
- truncated: z.boolean(),
467
533
  rows: z.array(z.record(z.string(), z.unknown()))
468
534
  }),
469
535
  z.object({
@@ -473,9 +539,12 @@ var outputSchema = z.discriminatedUnion("success", [
473
539
  ]);
474
540
  var executeQueryTool = new ConnectorTool({
475
541
  name: "executeQuery",
476
- description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
477
- Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
478
- Avoid loading large amounts of data; always include LIMIT in queries.`,
542
+ 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).
543
+ Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), sampling (LIMIT, SAMPLE), and analytical queries.
544
+ Memory guidance:
545
+ - 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).
546
+ - For full-dataset analysis, do the aggregation inside Snowflake (COUNT, SUM, GROUP BY, APPROX_TOP_K, HISTOGRAM) instead of returning raw rows.
547
+ - Exploration is iterative: start with a small LIMIT to inspect shape, then refine.`,
479
548
  inputSchema,
480
549
  outputSchema,
481
550
  async execute({ connectionId, sql }, connections) {
@@ -517,39 +586,43 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
517
586
  else resolve();
518
587
  });
519
588
  });
520
- const allRows = await new Promise(
521
- (resolve, reject) => {
522
- const timeoutId = setTimeout(() => {
523
- reject(
524
- new Error(
525
- "Snowflake query timeout: query exceeded 60 seconds"
526
- )
527
- );
528
- }, QUERY_TIMEOUT_MS);
589
+ try {
590
+ await new Promise((resolve, reject) => {
529
591
  conn.execute({
530
- sqlText: sql,
531
- complete: (err, _stmt, rows) => {
532
- clearTimeout(timeoutId);
592
+ sqlText: `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${STATEMENT_TIMEOUT_SECONDS}`,
593
+ complete: (err) => {
533
594
  if (err)
534
- reject(new Error(`Snowflake query failed: ${err.message}`));
535
- else resolve(rows ?? []);
595
+ reject(
596
+ new Error(
597
+ `Failed to set Snowflake statement timeout: ${err.message}`
598
+ )
599
+ );
600
+ else resolve();
536
601
  }
537
602
  });
603
+ });
604
+ const result = await executeWithSizeLimit(conn, sql, {
605
+ maxBytes: MAX_RESULT_BYTES
606
+ });
607
+ if (result.exceeded) {
608
+ return {
609
+ success: false,
610
+ 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)."
611
+ };
538
612
  }
539
- );
540
- conn.destroy((err) => {
541
- if (err)
542
- console.warn(
543
- `[connector-query] Snowflake destroy error: ${err.message}`
544
- );
545
- });
546
- const truncated = allRows.length > MAX_ROWS;
547
- return {
548
- success: true,
549
- rowCount: Math.min(allRows.length, MAX_ROWS),
550
- truncated,
551
- rows: allRows.slice(0, MAX_ROWS)
552
- };
613
+ return {
614
+ success: true,
615
+ rowCount: result.rows.length,
616
+ rows: result.rows
617
+ };
618
+ } finally {
619
+ conn.destroy((err) => {
620
+ if (err)
621
+ console.warn(
622
+ `[connector-query] Snowflake destroy error: ${err.message}`
623
+ );
624
+ });
625
+ }
553
626
  } catch (err) {
554
627
  const msg = err instanceof Error ? err.message : String(err);
555
628
  return { success: false, error: msg };
@@ -738,8 +811,8 @@ var parameters2 = {
738
811
 
739
812
  // ../connectors/src/connectors/snowflake-pat/tools/execute-query.ts
740
813
  import { z as z2 } from "zod";
741
- var MAX_ROWS2 = 500;
742
- var QUERY_TIMEOUT_MS2 = 6e4;
814
+ var MAX_ROWS = 500;
815
+ var QUERY_TIMEOUT_MS = 6e4;
743
816
  var inputSchema2 = z2.object({
744
817
  toolUseIntent: z2.string().optional().describe(
745
818
  "Brief description of what you intend to accomplish with this tool call"
@@ -763,7 +836,7 @@ var outputSchema2 = z2.discriminatedUnion("success", [
763
836
  ]);
764
837
  var executeQueryTool2 = new ConnectorTool({
765
838
  name: "executeQuery",
766
- description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS2} rows.
839
+ description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
767
840
  Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
768
841
  Avoid loading large amounts of data; always include LIMIT in queries.`,
769
842
  inputSchema: inputSchema2,
@@ -809,7 +882,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
809
882
  "Snowflake query timeout: query exceeded 60 seconds"
810
883
  )
811
884
  );
812
- }, QUERY_TIMEOUT_MS2);
885
+ }, QUERY_TIMEOUT_MS);
813
886
  conn.execute({
814
887
  sqlText: sql,
815
888
  complete: (err, _stmt, rows) => {
@@ -827,12 +900,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
827
900
  `[connector-query] Snowflake destroy error: ${err.message}`
828
901
  );
829
902
  });
830
- const truncated = allRows.length > MAX_ROWS2;
903
+ const truncated = allRows.length > MAX_ROWS;
831
904
  return {
832
905
  success: true,
833
- rowCount: Math.min(allRows.length, MAX_ROWS2),
906
+ rowCount: Math.min(allRows.length, MAX_ROWS),
834
907
  truncated,
835
- rows: allRows.slice(0, MAX_ROWS2)
908
+ rows: allRows.slice(0, MAX_ROWS)
836
909
  };
837
910
  } catch (err) {
838
911
  const msg = err instanceof Error ? err.message : String(err);
@@ -1166,7 +1239,7 @@ var POSTGRES_DEFAULT_PORT = 5432;
1166
1239
 
1167
1240
  // ../connectors/src/connectors/postgresql/tools/execute-query.ts
1168
1241
  import { z as z3 } from "zod";
1169
- var MAX_ROWS3 = 500;
1242
+ var MAX_ROWS2 = 500;
1170
1243
  var CONNECT_TIMEOUT_MS = 1e4;
1171
1244
  var STATEMENT_TIMEOUT_MS = 6e4;
1172
1245
  var inputSchema3 = z3.object({
@@ -1190,7 +1263,7 @@ var outputSchema3 = z3.discriminatedUnion("success", [
1190
1263
  ]);
1191
1264
  var executeQueryTool3 = new ConnectorTool({
1192
1265
  name: "executeQuery",
1193
- description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS3} rows.
1266
+ description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS2} rows.
1194
1267
  Use for: schema exploration (information_schema), data sampling, analytical queries.
1195
1268
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1196
1269
  inputSchema: inputSchema3,
@@ -1228,12 +1301,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1228
1301
  STATEMENT_TIMEOUT_MS
1229
1302
  );
1230
1303
  const rows = result.rows;
1231
- const truncated = rows.length > MAX_ROWS3;
1304
+ const truncated = rows.length > MAX_ROWS2;
1232
1305
  return {
1233
1306
  success: true,
1234
- rowCount: Math.min(rows.length, MAX_ROWS3),
1307
+ rowCount: Math.min(rows.length, MAX_ROWS2),
1235
1308
  truncated,
1236
- rows: rows.slice(0, MAX_ROWS3)
1309
+ rows: rows.slice(0, MAX_ROWS2)
1237
1310
  };
1238
1311
  } finally {
1239
1312
  await pool.end();
@@ -1370,9 +1443,9 @@ var MYSQL_DEFAULT_PORT = 3306;
1370
1443
 
1371
1444
  // ../connectors/src/connectors/mysql/tools/execute-query.ts
1372
1445
  import { z as z4 } from "zod";
1373
- var MAX_ROWS4 = 500;
1446
+ var MAX_ROWS3 = 500;
1374
1447
  var CONNECT_TIMEOUT_MS2 = 1e4;
1375
- var QUERY_TIMEOUT_MS3 = 6e4;
1448
+ var QUERY_TIMEOUT_MS2 = 6e4;
1376
1449
  var inputSchema4 = z4.object({
1377
1450
  toolUseIntent: z4.string().optional().describe(
1378
1451
  "Brief description of what you intend to accomplish with this tool call"
@@ -1394,7 +1467,7 @@ var outputSchema4 = z4.discriminatedUnion("success", [
1394
1467
  ]);
1395
1468
  var executeQueryTool4 = new ConnectorTool({
1396
1469
  name: "executeQuery",
1397
- description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS4} rows.
1470
+ description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS3} rows.
1398
1471
  Use for: schema exploration (information_schema), data sampling, analytical queries.
1399
1472
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1400
1473
  inputSchema: inputSchema4,
@@ -1427,16 +1500,16 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1427
1500
  try {
1428
1501
  const queryPromise = pool.query(sql);
1429
1502
  const timeoutPromise = new Promise(
1430
- (_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS3)
1503
+ (_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS2)
1431
1504
  );
1432
1505
  const [rows] = await Promise.race([queryPromise, timeoutPromise]);
1433
1506
  const resultRows = Array.isArray(rows) ? rows : [];
1434
- const truncated = resultRows.length > MAX_ROWS4;
1507
+ const truncated = resultRows.length > MAX_ROWS3;
1435
1508
  return {
1436
1509
  success: true,
1437
- rowCount: Math.min(resultRows.length, MAX_ROWS4),
1510
+ rowCount: Math.min(resultRows.length, MAX_ROWS3),
1438
1511
  truncated,
1439
- rows: resultRows.slice(0, MAX_ROWS4)
1512
+ rows: resultRows.slice(0, MAX_ROWS3)
1440
1513
  };
1441
1514
  } finally {
1442
1515
  await pool.end();
@@ -1763,7 +1836,7 @@ var bigqueryOnboarding = new ConnectorOnboarding({
1763
1836
 
1764
1837
  // ../connectors/src/connectors/bigquery/tools/execute-query.ts
1765
1838
  import { z as z7 } from "zod";
1766
- var MAX_ROWS5 = 500;
1839
+ var MAX_ROWS4 = 500;
1767
1840
  var inputSchema7 = z7.object({
1768
1841
  toolUseIntent: z7.string().optional().describe(
1769
1842
  "Brief description of what you intend to accomplish with this tool call"
@@ -1787,7 +1860,7 @@ var outputSchema7 = z7.discriminatedUnion("success", [
1787
1860
  ]);
1788
1861
  var executeQueryTool5 = new ConnectorTool({
1789
1862
  name: "executeQuery",
1790
- description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS5} rows.
1863
+ description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS4} rows.
1791
1864
  Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
1792
1865
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1793
1866
  inputSchema: inputSchema7,
@@ -1814,12 +1887,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1814
1887
  const [job] = await bq.createQueryJob({ query: sql });
1815
1888
  const [rows] = await job.getQueryResults();
1816
1889
  const allRows = rows;
1817
- const truncated = allRows.length > MAX_ROWS5;
1890
+ const truncated = allRows.length > MAX_ROWS4;
1818
1891
  return {
1819
1892
  success: true,
1820
- rowCount: Math.min(allRows.length, MAX_ROWS5),
1893
+ rowCount: Math.min(allRows.length, MAX_ROWS4),
1821
1894
  truncated,
1822
- rows: allRows.slice(0, MAX_ROWS5)
1895
+ rows: allRows.slice(0, MAX_ROWS4)
1823
1896
  };
1824
1897
  } catch (err) {
1825
1898
  const msg = err instanceof Error ? err.message : String(err);
@@ -2220,7 +2293,7 @@ var bigqueryOnboarding2 = new ConnectorOnboarding({
2220
2293
 
2221
2294
  // ../connectors/src/connectors/bigquery-oauth/tools/execute-query.ts
2222
2295
  import { z as z10 } from "zod";
2223
- var MAX_ROWS6 = 500;
2296
+ var MAX_ROWS5 = 500;
2224
2297
  var REQUEST_TIMEOUT_MS3 = 6e4;
2225
2298
  var cachedToken3 = null;
2226
2299
  async function getProxyToken3(config) {
@@ -2287,7 +2360,7 @@ function parseQueryResponse(data) {
2287
2360
  }
2288
2361
  var executeQueryTool6 = new ConnectorTool({
2289
2362
  name: "executeQuery",
2290
- description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS6} rows.
2363
+ description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS5} rows.
2291
2364
  Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
2292
2365
  Avoid loading large amounts of data; always include LIMIT in queries.`,
2293
2366
  inputSchema: inputSchema10,
@@ -2320,7 +2393,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2320
2393
  body: JSON.stringify({
2321
2394
  url: queryUrl,
2322
2395
  method: "POST",
2323
- body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS6 }
2396
+ body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS5 }
2324
2397
  }),
2325
2398
  signal: controller.signal
2326
2399
  });
@@ -2330,12 +2403,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2330
2403
  return { success: false, error: errorMessage };
2331
2404
  }
2332
2405
  const rows = parseQueryResponse(data);
2333
- const truncated = rows.length > MAX_ROWS6;
2406
+ const truncated = rows.length > MAX_ROWS5;
2334
2407
  return {
2335
2408
  success: true,
2336
- rowCount: Math.min(rows.length, MAX_ROWS6),
2409
+ rowCount: Math.min(rows.length, MAX_ROWS5),
2337
2410
  truncated,
2338
- rows: rows.slice(0, MAX_ROWS6)
2411
+ rows: rows.slice(0, MAX_ROWS5)
2339
2412
  };
2340
2413
  } finally {
2341
2414
  clearTimeout(timeout);
@@ -2515,7 +2588,7 @@ var parameters7 = {
2515
2588
 
2516
2589
  // ../connectors/src/connectors/aws-athena/tools/execute-query.ts
2517
2590
  import { z as z11 } from "zod";
2518
- var MAX_ROWS7 = 500;
2591
+ var MAX_ROWS6 = 500;
2519
2592
  var POLL_INTERVAL_MS = 1e3;
2520
2593
  var POLL_TIMEOUT_MS = 12e4;
2521
2594
  var inputSchema11 = z11.object({
@@ -2539,7 +2612,7 @@ var outputSchema11 = z11.discriminatedUnion("success", [
2539
2612
  ]);
2540
2613
  var executeQueryTool7 = new ConnectorTool({
2541
2614
  name: "executeQuery",
2542
- description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS7} rows.
2615
+ description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS6} rows.
2543
2616
  Use for: schema exploration (SHOW DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries on S3 data.
2544
2617
  Avoid loading large amounts of data; always include LIMIT in queries.`,
2545
2618
  inputSchema: inputSchema11,
@@ -2616,12 +2689,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2616
2689
  });
2617
2690
  return obj;
2618
2691
  });
2619
- const truncated = dataRows.length > MAX_ROWS7;
2692
+ const truncated = dataRows.length > MAX_ROWS6;
2620
2693
  return {
2621
2694
  success: true,
2622
- rowCount: Math.min(dataRows.length, MAX_ROWS7),
2695
+ rowCount: Math.min(dataRows.length, MAX_ROWS6),
2623
2696
  truncated,
2624
- rows: dataRows.slice(0, MAX_ROWS7)
2697
+ rows: dataRows.slice(0, MAX_ROWS6)
2625
2698
  };
2626
2699
  } catch (err) {
2627
2700
  const msg = err instanceof Error ? err.message : String(err);
@@ -3536,7 +3609,7 @@ var parameters9 = {
3536
3609
 
3537
3610
  // ../connectors/src/connectors/redshift/tools/execute-query.ts
3538
3611
  import { z as z15 } from "zod";
3539
- var MAX_ROWS8 = 500;
3612
+ var MAX_ROWS7 = 500;
3540
3613
  var POLL_INTERVAL_MS2 = 1e3;
3541
3614
  var POLL_TIMEOUT_MS2 = 12e4;
3542
3615
  var inputSchema15 = z15.object({
@@ -3562,7 +3635,7 @@ var outputSchema15 = z15.discriminatedUnion("success", [
3562
3635
  ]);
3563
3636
  var executeQueryTool8 = new ConnectorTool({
3564
3637
  name: "executeQuery",
3565
- description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS8} rows.
3638
+ description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS7} rows.
3566
3639
  Use for: schema exploration, data sampling, analytical queries.
3567
3640
  Avoid loading large amounts of data; always include LIMIT in queries.`,
3568
3641
  inputSchema: inputSchema15,
@@ -3641,12 +3714,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
3641
3714
  });
3642
3715
  return row;
3643
3716
  });
3644
- const truncated = allRows.length > MAX_ROWS8;
3717
+ const truncated = allRows.length > MAX_ROWS7;
3645
3718
  return {
3646
3719
  success: true,
3647
- rowCount: Math.min(allRows.length, MAX_ROWS8),
3720
+ rowCount: Math.min(allRows.length, MAX_ROWS7),
3648
3721
  truncated,
3649
- rows: allRows.slice(0, MAX_ROWS8)
3722
+ rows: allRows.slice(0, MAX_ROWS7)
3650
3723
  };
3651
3724
  } catch (err) {
3652
3725
  const msg = err instanceof Error ? err.message : String(err);
@@ -3867,7 +3940,7 @@ var parameters10 = {
3867
3940
 
3868
3941
  // ../connectors/src/connectors/databricks/tools/execute-query.ts
3869
3942
  import { z as z16 } from "zod";
3870
- var MAX_ROWS9 = 500;
3943
+ var MAX_ROWS8 = 500;
3871
3944
  var inputSchema16 = z16.object({
3872
3945
  toolUseIntent: z16.string().optional().describe(
3873
3946
  "Brief description of what you intend to accomplish with this tool call"
@@ -3889,7 +3962,7 @@ var outputSchema16 = z16.discriminatedUnion("success", [
3889
3962
  ]);
3890
3963
  var executeQueryTool9 = new ConnectorTool({
3891
3964
  name: "executeQuery",
3892
- description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS9} rows.
3965
+ description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS8} rows.
3893
3966
  Use for: schema exploration (SHOW CATALOGS/DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries.
3894
3967
  Avoid loading large amounts of data; always include LIMIT in queries.`,
3895
3968
  inputSchema: inputSchema16,
@@ -3920,12 +3993,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
3920
3993
  runAsync: true
3921
3994
  });
3922
3995
  const allRows = await operation.fetchAll();
3923
- const truncated = allRows.length > MAX_ROWS9;
3996
+ const truncated = allRows.length > MAX_ROWS8;
3924
3997
  return {
3925
3998
  success: true,
3926
- rowCount: Math.min(allRows.length, MAX_ROWS9),
3999
+ rowCount: Math.min(allRows.length, MAX_ROWS8),
3927
4000
  truncated,
3928
- rows: allRows.slice(0, MAX_ROWS9)
4001
+ rows: allRows.slice(0, MAX_ROWS8)
3929
4002
  };
3930
4003
  } finally {
3931
4004
  if (operation) await operation.close().catch(() => {
@@ -10870,7 +10943,7 @@ var parameters29 = {
10870
10943
 
10871
10944
  // ../connectors/src/connectors/squadbase-db/tools/execute-query.ts
10872
10945
  import { z as z40 } from "zod";
10873
- var MAX_ROWS10 = 500;
10946
+ var MAX_ROWS9 = 500;
10874
10947
  var CONNECT_TIMEOUT_MS3 = 1e4;
10875
10948
  var STATEMENT_TIMEOUT_MS2 = 6e4;
10876
10949
  var inputSchema40 = z40.object({
@@ -10894,7 +10967,7 @@ var outputSchema40 = z40.discriminatedUnion("success", [
10894
10967
  ]);
10895
10968
  var executeQueryTool10 = new ConnectorTool({
10896
10969
  name: "executeQuery",
10897
- description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS10} rows.
10970
+ description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS9} rows.
10898
10971
  Use for: schema exploration (information_schema), data sampling, analytical queries.
10899
10972
  Avoid loading large amounts of data; always include LIMIT in queries.`,
10900
10973
  inputSchema: inputSchema40,
@@ -10923,12 +10996,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
10923
10996
  try {
10924
10997
  const result = await pool.query(sql);
10925
10998
  const rows = result.rows;
10926
- const truncated = rows.length > MAX_ROWS10;
10999
+ const truncated = rows.length > MAX_ROWS9;
10927
11000
  return {
10928
11001
  success: true,
10929
- rowCount: Math.min(rows.length, MAX_ROWS10),
11002
+ rowCount: Math.min(rows.length, MAX_ROWS9),
10930
11003
  truncated,
10931
- rows: rows.slice(0, MAX_ROWS10)
11004
+ rows: rows.slice(0, MAX_ROWS9)
10932
11005
  };
10933
11006
  } finally {
10934
11007
  await pool.end();
@@ -13702,8 +13775,8 @@ var parameters41 = {
13702
13775
 
13703
13776
  // ../connectors/src/connectors/clickhouse/tools/execute-query.ts
13704
13777
  import { z as z49 } from "zod";
13705
- var MAX_ROWS11 = 500;
13706
- var QUERY_TIMEOUT_MS4 = 6e4;
13778
+ var MAX_ROWS10 = 500;
13779
+ var QUERY_TIMEOUT_MS3 = 6e4;
13707
13780
  var inputSchema49 = z49.object({
13708
13781
  toolUseIntent: z49.string().optional().describe(
13709
13782
  "Brief description of what you intend to accomplish with this tool call"
@@ -13725,7 +13798,7 @@ var outputSchema49 = z49.discriminatedUnion("success", [
13725
13798
  ]);
13726
13799
  var executeQueryTool11 = new ConnectorTool({
13727
13800
  name: "executeQuery",
13728
- description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS11} rows.
13801
+ description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS10} rows.
13729
13802
  Use for: schema exploration (SHOW DATABASES, SHOW TABLES, DESCRIBE TABLE), data sampling, analytical queries on large-scale columnar data.
13730
13803
  Avoid loading large amounts of data; always include LIMIT in queries.`,
13731
13804
  inputSchema: inputSchema49,
@@ -13753,7 +13826,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
13753
13826
  username,
13754
13827
  password: password || "",
13755
13828
  database: database || "default",
13756
- request_timeout: QUERY_TIMEOUT_MS4
13829
+ request_timeout: QUERY_TIMEOUT_MS3
13757
13830
  });
13758
13831
  try {
13759
13832
  const resultSet = await client.query({
@@ -13761,12 +13834,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
13761
13834
  format: "JSONEachRow"
13762
13835
  });
13763
13836
  const allRows = await resultSet.json();
13764
- const truncated = allRows.length > MAX_ROWS11;
13837
+ const truncated = allRows.length > MAX_ROWS10;
13765
13838
  return {
13766
13839
  success: true,
13767
- rowCount: Math.min(allRows.length, MAX_ROWS11),
13840
+ rowCount: Math.min(allRows.length, MAX_ROWS10),
13768
13841
  truncated,
13769
- rows: allRows.slice(0, MAX_ROWS11)
13842
+ rows: allRows.slice(0, MAX_ROWS10)
13770
13843
  };
13771
13844
  } finally {
13772
13845
  await client.close();
@@ -13922,7 +13995,7 @@ var parameters42 = {
13922
13995
  import { z as z50 } from "zod";
13923
13996
  var MAX_DOCUMENTS = 500;
13924
13997
  var CONNECT_TIMEOUT_MS4 = 1e4;
13925
- var QUERY_TIMEOUT_MS5 = 6e4;
13998
+ var QUERY_TIMEOUT_MS4 = 6e4;
13926
13999
  var inputSchema50 = z50.object({
13927
14000
  toolUseIntent: z50.string().optional().describe(
13928
14001
  "Brief description of what you intend to accomplish with this tool call"
@@ -13981,7 +14054,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
13981
14054
  const client = new MongoClient(connectionUrl, {
13982
14055
  connectTimeoutMS: CONNECT_TIMEOUT_MS4,
13983
14056
  serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS4,
13984
- socketTimeoutMS: QUERY_TIMEOUT_MS5
14057
+ socketTimeoutMS: QUERY_TIMEOUT_MS4
13985
14058
  });
13986
14059
  try {
13987
14060
  await client.connect();
@@ -14027,7 +14100,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
14027
14100
  import { z as z51 } from "zod";
14028
14101
  var MAX_DOCUMENTS2 = 500;
14029
14102
  var CONNECT_TIMEOUT_MS5 = 1e4;
14030
- var QUERY_TIMEOUT_MS6 = 6e4;
14103
+ var QUERY_TIMEOUT_MS5 = 6e4;
14031
14104
  var inputSchema51 = z51.object({
14032
14105
  toolUseIntent: z51.string().optional().describe(
14033
14106
  "Brief description of what you intend to accomplish with this tool call"
@@ -14078,7 +14151,7 @@ Common stages: $match (filter), $group (aggregate), $sort (order), $project (res
14078
14151
  const client = new MongoClient(connectionUrl, {
14079
14152
  connectTimeoutMS: CONNECT_TIMEOUT_MS5,
14080
14153
  serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS5,
14081
- socketTimeoutMS: QUERY_TIMEOUT_MS6
14154
+ socketTimeoutMS: QUERY_TIMEOUT_MS5
14082
14155
  });
14083
14156
  try {
14084
14157
  await client.connect();
@@ -23307,7 +23380,7 @@ function redactJdbcUrl(jdbcUrl) {
23307
23380
  }
23308
23381
 
23309
23382
  // ../connectors/src/connectors/jdbc/tools/execute-query.ts
23310
- var MAX_ROWS12 = 500;
23383
+ var MAX_ROWS11 = 500;
23311
23384
  var CONNECT_TIMEOUT_MS7 = 1e4;
23312
23385
  var STATEMENT_TIMEOUT_MS3 = 6e4;
23313
23386
  var inputSchema82 = z82.object({
@@ -23333,7 +23406,7 @@ var outputSchema82 = z82.discriminatedUnion("success", [
23333
23406
  ]);
23334
23407
  var executeQueryTool12 = new ConnectorTool({
23335
23408
  name: "executeQuery",
23336
- description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS12} rows.
23409
+ description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS11} rows.
23337
23410
  Use for: schema exploration via \`information_schema\` (or USER_TABLES on Oracle), data sampling, analytical queries.
23338
23411
  The connector dispatches by JDBC URL prefix to the matching driver
23339
23412
  (PostgreSQL / Redshift / MySQL / MariaDB / SQL Server / Oracle), so use the dialect that matches the connection.
@@ -23374,9 +23447,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23374
23447
  const rows = result.rows;
23375
23448
  return {
23376
23449
  success: true,
23377
- rowCount: Math.min(rows.length, MAX_ROWS12),
23378
- truncated: rows.length > MAX_ROWS12,
23379
- rows: rows.slice(0, MAX_ROWS12)
23450
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23451
+ truncated: rows.length > MAX_ROWS11,
23452
+ rows: rows.slice(0, MAX_ROWS11)
23380
23453
  };
23381
23454
  }
23382
23455
  if (parsed.driver === "oracle") {
@@ -23391,9 +23464,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23391
23464
  const rows = result.rows;
23392
23465
  return {
23393
23466
  success: true,
23394
- rowCount: Math.min(rows.length, MAX_ROWS12),
23395
- truncated: rows.length > MAX_ROWS12,
23396
- rows: rows.slice(0, MAX_ROWS12)
23467
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23468
+ truncated: rows.length > MAX_ROWS11,
23469
+ rows: rows.slice(0, MAX_ROWS11)
23397
23470
  };
23398
23471
  }
23399
23472
  let tunnel;
@@ -23417,12 +23490,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23417
23490
  STATEMENT_TIMEOUT_MS3
23418
23491
  );
23419
23492
  const rows = result.rows;
23420
- const truncated = rows.length > MAX_ROWS12;
23493
+ const truncated = rows.length > MAX_ROWS11;
23421
23494
  return {
23422
23495
  success: true,
23423
- rowCount: Math.min(rows.length, MAX_ROWS12),
23496
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23424
23497
  truncated,
23425
- rows: rows.slice(0, MAX_ROWS12)
23498
+ rows: rows.slice(0, MAX_ROWS11)
23426
23499
  };
23427
23500
  } finally {
23428
23501
  await pool2.end();
@@ -23443,12 +23516,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23443
23516
  );
23444
23517
  const [rows] = await Promise.race([queryPromise, timeoutPromise]);
23445
23518
  const resultRows = Array.isArray(rows) ? rows : [];
23446
- const truncated = resultRows.length > MAX_ROWS12;
23519
+ const truncated = resultRows.length > MAX_ROWS11;
23447
23520
  return {
23448
23521
  success: true,
23449
- rowCount: Math.min(resultRows.length, MAX_ROWS12),
23522
+ rowCount: Math.min(resultRows.length, MAX_ROWS11),
23450
23523
  truncated,
23451
- rows: resultRows.slice(0, MAX_ROWS12)
23524
+ rows: resultRows.slice(0, MAX_ROWS11)
23452
23525
  };
23453
23526
  } finally {
23454
23527
  await pool.end();
@@ -24717,7 +24790,7 @@ var parameters70 = {
24717
24790
 
24718
24791
  // ../connectors/src/connectors/supabase/tools/execute-query.ts
24719
24792
  import { z as z86 } from "zod";
24720
- var MAX_ROWS13 = 500;
24793
+ var MAX_ROWS12 = 500;
24721
24794
  var CONNECT_TIMEOUT_MS8 = 1e4;
24722
24795
  var STATEMENT_TIMEOUT_MS4 = 6e4;
24723
24796
  var inputSchema86 = z86.object({
@@ -24743,7 +24816,7 @@ var outputSchema86 = z86.discriminatedUnion("success", [
24743
24816
  ]);
24744
24817
  var executeQueryTool13 = new ConnectorTool({
24745
24818
  name: "executeQuery",
24746
- description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS13} rows.
24819
+ description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS12} rows.
24747
24820
  Use for: schema exploration (information_schema), data sampling, and analytical queries against Supabase tables.
24748
24821
  User tables live in the \`public\` schema by default; Supabase-managed metadata lives in \`auth\` and \`storage\`.
24749
24822
  Avoid loading large amounts of data; always include LIMIT in queries.`,
@@ -24773,12 +24846,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
24773
24846
  try {
24774
24847
  const result = await pool.query(sql);
24775
24848
  const rows = result.rows;
24776
- const truncated = rows.length > MAX_ROWS13;
24849
+ const truncated = rows.length > MAX_ROWS12;
24777
24850
  return {
24778
24851
  success: true,
24779
- rowCount: Math.min(rows.length, MAX_ROWS13),
24852
+ rowCount: Math.min(rows.length, MAX_ROWS12),
24780
24853
  truncated,
24781
- rows: rows.slice(0, MAX_ROWS13)
24854
+ rows: rows.slice(0, MAX_ROWS12)
24782
24855
  };
24783
24856
  } finally {
24784
24857
  await pool.end();
@@ -25257,7 +25330,7 @@ var parameters72 = {
25257
25330
 
25258
25331
  // ../connectors/src/connectors/sqlserver/tools/execute-query.ts
25259
25332
  import { z as z88 } from "zod";
25260
- var MAX_ROWS14 = 500;
25333
+ var MAX_ROWS13 = 500;
25261
25334
  var inputSchema88 = z88.object({
25262
25335
  toolUseIntent: z88.string().optional().describe(
25263
25336
  "Brief description of what you intend to accomplish with this tool call"
@@ -25281,7 +25354,7 @@ var outputSchema88 = z88.discriminatedUnion("success", [
25281
25354
  ]);
25282
25355
  var executeQueryTool14 = new ConnectorTool({
25283
25356
  name: "executeQuery",
25284
- description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS14} rows.
25357
+ description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS13} rows.
25285
25358
  Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
25286
25359
  SQL Server uses \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets (\`[schema].[table]\`).
25287
25360
  Avoid loading large amounts of data; always include \`TOP\` in queries.`,
@@ -25314,12 +25387,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
25314
25387
  const { rows } = await runMssqlQuery(parsed, sql, {
25315
25388
  tunnelParams: connectionParamsToRecord(connection)
25316
25389
  });
25317
- const truncated = rows.length > MAX_ROWS14;
25390
+ const truncated = rows.length > MAX_ROWS13;
25318
25391
  return {
25319
25392
  success: true,
25320
- rowCount: Math.min(rows.length, MAX_ROWS14),
25393
+ rowCount: Math.min(rows.length, MAX_ROWS13),
25321
25394
  truncated,
25322
- rows: rows.slice(0, MAX_ROWS14)
25395
+ rows: rows.slice(0, MAX_ROWS13)
25323
25396
  };
25324
25397
  } catch (err) {
25325
25398
  let msg = err instanceof Error ? err.message : String(err);
@@ -25452,7 +25525,7 @@ var parameters73 = {
25452
25525
 
25453
25526
  // ../connectors/src/connectors/azure-sql/tools/execute-query.ts
25454
25527
  import { z as z89 } from "zod";
25455
- var MAX_ROWS15 = 500;
25528
+ var MAX_ROWS14 = 500;
25456
25529
  var inputSchema89 = z89.object({
25457
25530
  toolUseIntent: z89.string().optional().describe(
25458
25531
  "Brief description of what you intend to accomplish with this tool call"
@@ -25476,7 +25549,7 @@ var outputSchema89 = z89.discriminatedUnion("success", [
25476
25549
  ]);
25477
25550
  var executeQueryTool15 = new ConnectorTool({
25478
25551
  name: "executeQuery",
25479
- description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS15} rows.
25552
+ description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS14} rows.
25480
25553
  Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
25481
25554
  Azure SQL is T-SQL: use \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets.
25482
25555
  Avoid loading large amounts of data; always include \`TOP\` in queries.`,
@@ -25510,12 +25583,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
25510
25583
  forceEncrypt: true,
25511
25584
  tunnelParams: connectionParamsToRecord(connection)
25512
25585
  });
25513
- const truncated = rows.length > MAX_ROWS15;
25586
+ const truncated = rows.length > MAX_ROWS14;
25514
25587
  return {
25515
25588
  success: true,
25516
- rowCount: Math.min(rows.length, MAX_ROWS15),
25589
+ rowCount: Math.min(rows.length, MAX_ROWS14),
25517
25590
  truncated,
25518
- rows: rows.slice(0, MAX_ROWS15)
25591
+ rows: rows.slice(0, MAX_ROWS14)
25519
25592
  };
25520
25593
  } catch (err) {
25521
25594
  let msg = err instanceof Error ? err.message : String(err);
@@ -25992,7 +26065,7 @@ var parameters75 = {
25992
26065
 
25993
26066
  // ../connectors/src/connectors/oracle/tools/execute-query.ts
25994
26067
  import { z as z92 } from "zod";
25995
- var MAX_ROWS16 = 500;
26068
+ var MAX_ROWS15 = 500;
25996
26069
  var inputSchema92 = z92.object({
25997
26070
  toolUseIntent: z92.string().optional().describe(
25998
26071
  "Brief description of what you intend to accomplish with this tool call"
@@ -26016,7 +26089,7 @@ var outputSchema92 = z92.discriminatedUnion("success", [
26016
26089
  ]);
26017
26090
  var executeQueryTool16 = new ConnectorTool({
26018
26091
  name: "executeQuery",
26019
- description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS16} rows.
26092
+ description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS15} rows.
26020
26093
  Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\`, data sampling, and analytical queries.
26021
26094
  Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
26022
26095
  Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
@@ -26051,12 +26124,12 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
26051
26124
  const { rows } = await runOracleQuery(parsed, cleanSql, {
26052
26125
  tunnelParams: connectionParamsToRecord(connection)
26053
26126
  });
26054
- const truncated = rows.length > MAX_ROWS16;
26127
+ const truncated = rows.length > MAX_ROWS15;
26055
26128
  return {
26056
26129
  success: true,
26057
- rowCount: Math.min(rows.length, MAX_ROWS16),
26130
+ rowCount: Math.min(rows.length, MAX_ROWS15),
26058
26131
  truncated,
26059
- rows: rows.slice(0, MAX_ROWS16)
26132
+ rows: rows.slice(0, MAX_ROWS15)
26060
26133
  };
26061
26134
  } catch (err) {
26062
26135
  let msg = err instanceof Error ? err.message : String(err);
@@ -26075,7 +26148,7 @@ var oracleConnector = new ConnectorPlugin({
26075
26148
  description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
26076
26149
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
26077
26150
  parameters: parameters75,
26078
- releaseFlag: { dev1: true, dev2: false, prod: false },
26151
+ releaseFlag: { dev1: true, dev2: true, prod: true },
26079
26152
  categories: ["database"],
26080
26153
  onboarding: oracleOnboarding,
26081
26154
  systemPrompt: {