@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/main.js CHANGED
@@ -363,6 +363,37 @@ import { z } from "zod";
363
363
 
364
364
  // ../connectors/src/connectors/snowflake/utils.ts
365
365
  import crypto from "crypto";
366
+
367
+ // ../connectors/src/lib/approx-bytes.ts
368
+ function approxBytes(value, acc, limit) {
369
+ if (acc > limit) return acc;
370
+ if (value == null) return acc;
371
+ const t = typeof value;
372
+ if (t === "string") return acc + value.length;
373
+ if (t === "number" || t === "boolean") return acc + 8;
374
+ if (t === "bigint") return acc + 16;
375
+ if (value instanceof Date) return acc + 8;
376
+ if (Buffer.isBuffer(value)) return acc + value.byteLength;
377
+ if (Array.isArray(value)) {
378
+ for (const item of value) {
379
+ acc = approxBytes(item, acc, limit);
380
+ if (acc > limit) return acc;
381
+ }
382
+ return acc;
383
+ }
384
+ if (t === "object") {
385
+ const obj = value;
386
+ for (const k in obj) {
387
+ acc += k.length;
388
+ acc = approxBytes(obj[k], acc, limit);
389
+ if (acc > limit) return acc;
390
+ }
391
+ return acc;
392
+ }
393
+ return acc;
394
+ }
395
+
396
+ // ../connectors/src/connectors/snowflake/utils.ts
366
397
  function decryptPrivateKey(pem, passphrase) {
367
398
  if (!passphrase) return pem;
368
399
  return crypto.createPrivateKey({
@@ -371,10 +402,46 @@ function decryptPrivateKey(pem, passphrase) {
371
402
  passphrase
372
403
  }).export({ type: "pkcs8", format: "pem" });
373
404
  }
405
+ async function executeWithSizeLimit(conn, sql, options) {
406
+ const rows = [];
407
+ let acc = 0;
408
+ let exceeded = false;
409
+ await new Promise((resolve, reject) => {
410
+ const stmt = conn.execute({
411
+ sqlText: sql,
412
+ streamResult: true
413
+ });
414
+ const stream = stmt.streamRows();
415
+ stream.on("data", (row) => {
416
+ if (exceeded) return;
417
+ acc = approxBytes(row, acc, options.maxBytes);
418
+ if (acc > options.maxBytes) {
419
+ exceeded = true;
420
+ stream.destroy();
421
+ stmt.cancel(() => {
422
+ });
423
+ resolve();
424
+ return;
425
+ }
426
+ rows.push(row);
427
+ });
428
+ stream.on("end", () => {
429
+ resolve();
430
+ });
431
+ stream.on("error", (err) => {
432
+ if (exceeded) return;
433
+ reject(new Error(`Snowflake query failed: ${err.message}`));
434
+ });
435
+ });
436
+ if (exceeded) {
437
+ return { exceeded: true };
438
+ }
439
+ return { exceeded: false, rows };
440
+ }
374
441
 
375
442
  // ../connectors/src/connectors/snowflake/tools/execute-query.ts
376
- var MAX_ROWS = 500;
377
- var QUERY_TIMEOUT_MS = 6e4;
443
+ var MAX_RESULT_BYTES = 5 * 1024 * 1024;
444
+ var STATEMENT_TIMEOUT_SECONDS = 60;
378
445
  var inputSchema = z.object({
379
446
  toolUseIntent: z.string().optional().describe(
380
447
  "Brief description of what you intend to accomplish with this tool call"
@@ -388,7 +455,6 @@ var outputSchema = z.discriminatedUnion("success", [
388
455
  z.object({
389
456
  success: z.literal(true),
390
457
  rowCount: z.number(),
391
- truncated: z.boolean(),
392
458
  rows: z.array(z.record(z.string(), z.unknown()))
393
459
  }),
394
460
  z.object({
@@ -398,9 +464,12 @@ var outputSchema = z.discriminatedUnion("success", [
398
464
  ]);
399
465
  var executeQueryTool = new ConnectorTool({
400
466
  name: "executeQuery",
401
- description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
402
- Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
403
- Avoid loading large amounts of data; always include LIMIT in queries.`,
467
+ 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).
468
+ Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), sampling (LIMIT, SAMPLE), and analytical queries.
469
+ Memory guidance:
470
+ - 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).
471
+ - For full-dataset analysis, do the aggregation inside Snowflake (COUNT, SUM, GROUP BY, APPROX_TOP_K, HISTOGRAM) instead of returning raw rows.
472
+ - Exploration is iterative: start with a small LIMIT to inspect shape, then refine.`,
404
473
  inputSchema,
405
474
  outputSchema,
406
475
  async execute({ connectionId, sql }, connections) {
@@ -442,39 +511,43 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
442
511
  else resolve();
443
512
  });
444
513
  });
445
- const allRows = await new Promise(
446
- (resolve, reject) => {
447
- const timeoutId = setTimeout(() => {
448
- reject(
449
- new Error(
450
- "Snowflake query timeout: query exceeded 60 seconds"
451
- )
452
- );
453
- }, QUERY_TIMEOUT_MS);
514
+ try {
515
+ await new Promise((resolve, reject) => {
454
516
  conn.execute({
455
- sqlText: sql,
456
- complete: (err, _stmt, rows) => {
457
- clearTimeout(timeoutId);
517
+ sqlText: `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${STATEMENT_TIMEOUT_SECONDS}`,
518
+ complete: (err) => {
458
519
  if (err)
459
- reject(new Error(`Snowflake query failed: ${err.message}`));
460
- else resolve(rows ?? []);
520
+ reject(
521
+ new Error(
522
+ `Failed to set Snowflake statement timeout: ${err.message}`
523
+ )
524
+ );
525
+ else resolve();
461
526
  }
462
527
  });
528
+ });
529
+ const result = await executeWithSizeLimit(conn, sql, {
530
+ maxBytes: MAX_RESULT_BYTES
531
+ });
532
+ if (result.exceeded) {
533
+ return {
534
+ success: false,
535
+ 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)."
536
+ };
463
537
  }
464
- );
465
- conn.destroy((err) => {
466
- if (err)
467
- console.warn(
468
- `[connector-query] Snowflake destroy error: ${err.message}`
469
- );
470
- });
471
- const truncated = allRows.length > MAX_ROWS;
472
- return {
473
- success: true,
474
- rowCount: Math.min(allRows.length, MAX_ROWS),
475
- truncated,
476
- rows: allRows.slice(0, MAX_ROWS)
477
- };
538
+ return {
539
+ success: true,
540
+ rowCount: result.rows.length,
541
+ rows: result.rows
542
+ };
543
+ } finally {
544
+ conn.destroy((err) => {
545
+ if (err)
546
+ console.warn(
547
+ `[connector-query] Snowflake destroy error: ${err.message}`
548
+ );
549
+ });
550
+ }
478
551
  } catch (err) {
479
552
  const msg = err instanceof Error ? err.message : String(err);
480
553
  return { success: false, error: msg };
@@ -663,8 +736,8 @@ var parameters2 = {
663
736
 
664
737
  // ../connectors/src/connectors/snowflake-pat/tools/execute-query.ts
665
738
  import { z as z2 } from "zod";
666
- var MAX_ROWS2 = 500;
667
- var QUERY_TIMEOUT_MS2 = 6e4;
739
+ var MAX_ROWS = 500;
740
+ var QUERY_TIMEOUT_MS = 6e4;
668
741
  var inputSchema2 = z2.object({
669
742
  toolUseIntent: z2.string().optional().describe(
670
743
  "Brief description of what you intend to accomplish with this tool call"
@@ -688,7 +761,7 @@ var outputSchema2 = z2.discriminatedUnion("success", [
688
761
  ]);
689
762
  var executeQueryTool2 = new ConnectorTool({
690
763
  name: "executeQuery",
691
- description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS2} rows.
764
+ description: `Execute SQL against Snowflake. Returns up to ${MAX_ROWS} rows.
692
765
  Use for: schema exploration (SHOW DATABASES/SCHEMAS/TABLES, DESCRIBE TABLE, INFORMATION_SCHEMA), data sampling, analytical queries.
693
766
  Avoid loading large amounts of data; always include LIMIT in queries.`,
694
767
  inputSchema: inputSchema2,
@@ -734,7 +807,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
734
807
  "Snowflake query timeout: query exceeded 60 seconds"
735
808
  )
736
809
  );
737
- }, QUERY_TIMEOUT_MS2);
810
+ }, QUERY_TIMEOUT_MS);
738
811
  conn.execute({
739
812
  sqlText: sql,
740
813
  complete: (err, _stmt, rows) => {
@@ -752,12 +825,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
752
825
  `[connector-query] Snowflake destroy error: ${err.message}`
753
826
  );
754
827
  });
755
- const truncated = allRows.length > MAX_ROWS2;
828
+ const truncated = allRows.length > MAX_ROWS;
756
829
  return {
757
830
  success: true,
758
- rowCount: Math.min(allRows.length, MAX_ROWS2),
831
+ rowCount: Math.min(allRows.length, MAX_ROWS),
759
832
  truncated,
760
- rows: allRows.slice(0, MAX_ROWS2)
833
+ rows: allRows.slice(0, MAX_ROWS)
761
834
  };
762
835
  } catch (err) {
763
836
  const msg = err instanceof Error ? err.message : String(err);
@@ -1091,7 +1164,7 @@ var POSTGRES_DEFAULT_PORT = 5432;
1091
1164
 
1092
1165
  // ../connectors/src/connectors/postgresql/tools/execute-query.ts
1093
1166
  import { z as z3 } from "zod";
1094
- var MAX_ROWS3 = 500;
1167
+ var MAX_ROWS2 = 500;
1095
1168
  var CONNECT_TIMEOUT_MS = 1e4;
1096
1169
  var STATEMENT_TIMEOUT_MS = 6e4;
1097
1170
  var inputSchema3 = z3.object({
@@ -1115,7 +1188,7 @@ var outputSchema3 = z3.discriminatedUnion("success", [
1115
1188
  ]);
1116
1189
  var executeQueryTool3 = new ConnectorTool({
1117
1190
  name: "executeQuery",
1118
- description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS3} rows.
1191
+ description: `Execute SQL against PostgreSQL. Returns up to ${MAX_ROWS2} rows.
1119
1192
  Use for: schema exploration (information_schema), data sampling, analytical queries.
1120
1193
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1121
1194
  inputSchema: inputSchema3,
@@ -1153,12 +1226,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1153
1226
  STATEMENT_TIMEOUT_MS
1154
1227
  );
1155
1228
  const rows = result.rows;
1156
- const truncated = rows.length > MAX_ROWS3;
1229
+ const truncated = rows.length > MAX_ROWS2;
1157
1230
  return {
1158
1231
  success: true,
1159
- rowCount: Math.min(rows.length, MAX_ROWS3),
1232
+ rowCount: Math.min(rows.length, MAX_ROWS2),
1160
1233
  truncated,
1161
- rows: rows.slice(0, MAX_ROWS3)
1234
+ rows: rows.slice(0, MAX_ROWS2)
1162
1235
  };
1163
1236
  } finally {
1164
1237
  await pool.end();
@@ -1295,9 +1368,9 @@ var MYSQL_DEFAULT_PORT = 3306;
1295
1368
 
1296
1369
  // ../connectors/src/connectors/mysql/tools/execute-query.ts
1297
1370
  import { z as z4 } from "zod";
1298
- var MAX_ROWS4 = 500;
1371
+ var MAX_ROWS3 = 500;
1299
1372
  var CONNECT_TIMEOUT_MS2 = 1e4;
1300
- var QUERY_TIMEOUT_MS3 = 6e4;
1373
+ var QUERY_TIMEOUT_MS2 = 6e4;
1301
1374
  var inputSchema4 = z4.object({
1302
1375
  toolUseIntent: z4.string().optional().describe(
1303
1376
  "Brief description of what you intend to accomplish with this tool call"
@@ -1319,7 +1392,7 @@ var outputSchema4 = z4.discriminatedUnion("success", [
1319
1392
  ]);
1320
1393
  var executeQueryTool4 = new ConnectorTool({
1321
1394
  name: "executeQuery",
1322
- description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS4} rows.
1395
+ description: `Execute SQL against MySQL. Returns up to ${MAX_ROWS3} rows.
1323
1396
  Use for: schema exploration (information_schema), data sampling, analytical queries.
1324
1397
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1325
1398
  inputSchema: inputSchema4,
@@ -1352,16 +1425,16 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1352
1425
  try {
1353
1426
  const queryPromise = pool.query(sql);
1354
1427
  const timeoutPromise = new Promise(
1355
- (_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS3)
1428
+ (_, reject) => setTimeout(() => reject(new Error("Query timed out after 60 seconds")), QUERY_TIMEOUT_MS2)
1356
1429
  );
1357
1430
  const [rows] = await Promise.race([queryPromise, timeoutPromise]);
1358
1431
  const resultRows = Array.isArray(rows) ? rows : [];
1359
- const truncated = resultRows.length > MAX_ROWS4;
1432
+ const truncated = resultRows.length > MAX_ROWS3;
1360
1433
  return {
1361
1434
  success: true,
1362
- rowCount: Math.min(resultRows.length, MAX_ROWS4),
1435
+ rowCount: Math.min(resultRows.length, MAX_ROWS3),
1363
1436
  truncated,
1364
- rows: resultRows.slice(0, MAX_ROWS4)
1437
+ rows: resultRows.slice(0, MAX_ROWS3)
1365
1438
  };
1366
1439
  } finally {
1367
1440
  await pool.end();
@@ -1688,7 +1761,7 @@ var bigqueryOnboarding = new ConnectorOnboarding({
1688
1761
 
1689
1762
  // ../connectors/src/connectors/bigquery/tools/execute-query.ts
1690
1763
  import { z as z7 } from "zod";
1691
- var MAX_ROWS5 = 500;
1764
+ var MAX_ROWS4 = 500;
1692
1765
  var inputSchema7 = z7.object({
1693
1766
  toolUseIntent: z7.string().optional().describe(
1694
1767
  "Brief description of what you intend to accomplish with this tool call"
@@ -1712,7 +1785,7 @@ var outputSchema7 = z7.discriminatedUnion("success", [
1712
1785
  ]);
1713
1786
  var executeQueryTool5 = new ConnectorTool({
1714
1787
  name: "executeQuery",
1715
- description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS5} rows.
1788
+ description: `Execute SQL against BigQuery. Returns up to ${MAX_ROWS4} rows.
1716
1789
  Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
1717
1790
  Avoid loading large amounts of data; always include LIMIT in queries.`,
1718
1791
  inputSchema: inputSchema7,
@@ -1739,12 +1812,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
1739
1812
  const [job] = await bq.createQueryJob({ query: sql });
1740
1813
  const [rows] = await job.getQueryResults();
1741
1814
  const allRows = rows;
1742
- const truncated = allRows.length > MAX_ROWS5;
1815
+ const truncated = allRows.length > MAX_ROWS4;
1743
1816
  return {
1744
1817
  success: true,
1745
- rowCount: Math.min(allRows.length, MAX_ROWS5),
1818
+ rowCount: Math.min(allRows.length, MAX_ROWS4),
1746
1819
  truncated,
1747
- rows: allRows.slice(0, MAX_ROWS5)
1820
+ rows: allRows.slice(0, MAX_ROWS4)
1748
1821
  };
1749
1822
  } catch (err) {
1750
1823
  const msg = err instanceof Error ? err.message : String(err);
@@ -2145,7 +2218,7 @@ var bigqueryOnboarding2 = new ConnectorOnboarding({
2145
2218
 
2146
2219
  // ../connectors/src/connectors/bigquery-oauth/tools/execute-query.ts
2147
2220
  import { z as z10 } from "zod";
2148
- var MAX_ROWS6 = 500;
2221
+ var MAX_ROWS5 = 500;
2149
2222
  var REQUEST_TIMEOUT_MS3 = 6e4;
2150
2223
  var cachedToken3 = null;
2151
2224
  async function getProxyToken3(config) {
@@ -2212,7 +2285,7 @@ function parseQueryResponse(data) {
2212
2285
  }
2213
2286
  var executeQueryTool6 = new ConnectorTool({
2214
2287
  name: "executeQuery",
2215
- description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS6} rows.
2288
+ description: `Execute SQL against BigQuery via OAuth. Returns up to ${MAX_ROWS5} rows.
2216
2289
  Use for: schema exploration (INFORMATION_SCHEMA), data sampling, analytical queries.
2217
2290
  Avoid loading large amounts of data; always include LIMIT in queries.`,
2218
2291
  inputSchema: inputSchema10,
@@ -2245,7 +2318,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2245
2318
  body: JSON.stringify({
2246
2319
  url: queryUrl,
2247
2320
  method: "POST",
2248
- body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS6 }
2321
+ body: { query: sql, useLegacySql: false, maxResults: MAX_ROWS5 }
2249
2322
  }),
2250
2323
  signal: controller.signal
2251
2324
  });
@@ -2255,12 +2328,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2255
2328
  return { success: false, error: errorMessage };
2256
2329
  }
2257
2330
  const rows = parseQueryResponse(data);
2258
- const truncated = rows.length > MAX_ROWS6;
2331
+ const truncated = rows.length > MAX_ROWS5;
2259
2332
  return {
2260
2333
  success: true,
2261
- rowCount: Math.min(rows.length, MAX_ROWS6),
2334
+ rowCount: Math.min(rows.length, MAX_ROWS5),
2262
2335
  truncated,
2263
- rows: rows.slice(0, MAX_ROWS6)
2336
+ rows: rows.slice(0, MAX_ROWS5)
2264
2337
  };
2265
2338
  } finally {
2266
2339
  clearTimeout(timeout);
@@ -2440,7 +2513,7 @@ var parameters7 = {
2440
2513
 
2441
2514
  // ../connectors/src/connectors/aws-athena/tools/execute-query.ts
2442
2515
  import { z as z11 } from "zod";
2443
- var MAX_ROWS7 = 500;
2516
+ var MAX_ROWS6 = 500;
2444
2517
  var POLL_INTERVAL_MS = 1e3;
2445
2518
  var POLL_TIMEOUT_MS = 12e4;
2446
2519
  var inputSchema11 = z11.object({
@@ -2464,7 +2537,7 @@ var outputSchema11 = z11.discriminatedUnion("success", [
2464
2537
  ]);
2465
2538
  var executeQueryTool7 = new ConnectorTool({
2466
2539
  name: "executeQuery",
2467
- description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS7} rows.
2540
+ description: `Execute SQL against AWS Athena. Returns up to ${MAX_ROWS6} rows.
2468
2541
  Use for: schema exploration (SHOW DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries on S3 data.
2469
2542
  Avoid loading large amounts of data; always include LIMIT in queries.`,
2470
2543
  inputSchema: inputSchema11,
@@ -2541,12 +2614,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
2541
2614
  });
2542
2615
  return obj;
2543
2616
  });
2544
- const truncated = dataRows.length > MAX_ROWS7;
2617
+ const truncated = dataRows.length > MAX_ROWS6;
2545
2618
  return {
2546
2619
  success: true,
2547
- rowCount: Math.min(dataRows.length, MAX_ROWS7),
2620
+ rowCount: Math.min(dataRows.length, MAX_ROWS6),
2548
2621
  truncated,
2549
- rows: dataRows.slice(0, MAX_ROWS7)
2622
+ rows: dataRows.slice(0, MAX_ROWS6)
2550
2623
  };
2551
2624
  } catch (err) {
2552
2625
  const msg = err instanceof Error ? err.message : String(err);
@@ -3461,7 +3534,7 @@ var parameters9 = {
3461
3534
 
3462
3535
  // ../connectors/src/connectors/redshift/tools/execute-query.ts
3463
3536
  import { z as z15 } from "zod";
3464
- var MAX_ROWS8 = 500;
3537
+ var MAX_ROWS7 = 500;
3465
3538
  var POLL_INTERVAL_MS2 = 1e3;
3466
3539
  var POLL_TIMEOUT_MS2 = 12e4;
3467
3540
  var inputSchema15 = z15.object({
@@ -3487,7 +3560,7 @@ var outputSchema15 = z15.discriminatedUnion("success", [
3487
3560
  ]);
3488
3561
  var executeQueryTool8 = new ConnectorTool({
3489
3562
  name: "executeQuery",
3490
- description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS8} rows.
3563
+ description: `Execute SQL against Amazon Redshift. Returns up to ${MAX_ROWS7} rows.
3491
3564
  Use for: schema exploration, data sampling, analytical queries.
3492
3565
  Avoid loading large amounts of data; always include LIMIT in queries.`,
3493
3566
  inputSchema: inputSchema15,
@@ -3566,12 +3639,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
3566
3639
  });
3567
3640
  return row;
3568
3641
  });
3569
- const truncated = allRows.length > MAX_ROWS8;
3642
+ const truncated = allRows.length > MAX_ROWS7;
3570
3643
  return {
3571
3644
  success: true,
3572
- rowCount: Math.min(allRows.length, MAX_ROWS8),
3645
+ rowCount: Math.min(allRows.length, MAX_ROWS7),
3573
3646
  truncated,
3574
- rows: allRows.slice(0, MAX_ROWS8)
3647
+ rows: allRows.slice(0, MAX_ROWS7)
3575
3648
  };
3576
3649
  } catch (err) {
3577
3650
  const msg = err instanceof Error ? err.message : String(err);
@@ -3792,7 +3865,7 @@ var parameters10 = {
3792
3865
 
3793
3866
  // ../connectors/src/connectors/databricks/tools/execute-query.ts
3794
3867
  import { z as z16 } from "zod";
3795
- var MAX_ROWS9 = 500;
3868
+ var MAX_ROWS8 = 500;
3796
3869
  var inputSchema16 = z16.object({
3797
3870
  toolUseIntent: z16.string().optional().describe(
3798
3871
  "Brief description of what you intend to accomplish with this tool call"
@@ -3814,7 +3887,7 @@ var outputSchema16 = z16.discriminatedUnion("success", [
3814
3887
  ]);
3815
3888
  var executeQueryTool9 = new ConnectorTool({
3816
3889
  name: "executeQuery",
3817
- description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS9} rows.
3890
+ description: `Execute SQL against Databricks. Returns up to ${MAX_ROWS8} rows.
3818
3891
  Use for: schema exploration (SHOW CATALOGS/DATABASES/TABLES, DESCRIBE TABLE), data sampling, analytical queries.
3819
3892
  Avoid loading large amounts of data; always include LIMIT in queries.`,
3820
3893
  inputSchema: inputSchema16,
@@ -3845,12 +3918,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
3845
3918
  runAsync: true
3846
3919
  });
3847
3920
  const allRows = await operation.fetchAll();
3848
- const truncated = allRows.length > MAX_ROWS9;
3921
+ const truncated = allRows.length > MAX_ROWS8;
3849
3922
  return {
3850
3923
  success: true,
3851
- rowCount: Math.min(allRows.length, MAX_ROWS9),
3924
+ rowCount: Math.min(allRows.length, MAX_ROWS8),
3852
3925
  truncated,
3853
- rows: allRows.slice(0, MAX_ROWS9)
3926
+ rows: allRows.slice(0, MAX_ROWS8)
3854
3927
  };
3855
3928
  } finally {
3856
3929
  if (operation) await operation.close().catch(() => {
@@ -10795,7 +10868,7 @@ var parameters29 = {
10795
10868
 
10796
10869
  // ../connectors/src/connectors/squadbase-db/tools/execute-query.ts
10797
10870
  import { z as z40 } from "zod";
10798
- var MAX_ROWS10 = 500;
10871
+ var MAX_ROWS9 = 500;
10799
10872
  var CONNECT_TIMEOUT_MS3 = 1e4;
10800
10873
  var STATEMENT_TIMEOUT_MS2 = 6e4;
10801
10874
  var inputSchema40 = z40.object({
@@ -10819,7 +10892,7 @@ var outputSchema40 = z40.discriminatedUnion("success", [
10819
10892
  ]);
10820
10893
  var executeQueryTool10 = new ConnectorTool({
10821
10894
  name: "executeQuery",
10822
- description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS10} rows.
10895
+ description: `Execute SQL against Squadbase DB (PostgreSQL). Returns up to ${MAX_ROWS9} rows.
10823
10896
  Use for: schema exploration (information_schema), data sampling, analytical queries.
10824
10897
  Avoid loading large amounts of data; always include LIMIT in queries.`,
10825
10898
  inputSchema: inputSchema40,
@@ -10848,12 +10921,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
10848
10921
  try {
10849
10922
  const result = await pool.query(sql);
10850
10923
  const rows = result.rows;
10851
- const truncated = rows.length > MAX_ROWS10;
10924
+ const truncated = rows.length > MAX_ROWS9;
10852
10925
  return {
10853
10926
  success: true,
10854
- rowCount: Math.min(rows.length, MAX_ROWS10),
10927
+ rowCount: Math.min(rows.length, MAX_ROWS9),
10855
10928
  truncated,
10856
- rows: rows.slice(0, MAX_ROWS10)
10929
+ rows: rows.slice(0, MAX_ROWS9)
10857
10930
  };
10858
10931
  } finally {
10859
10932
  await pool.end();
@@ -13627,8 +13700,8 @@ var parameters41 = {
13627
13700
 
13628
13701
  // ../connectors/src/connectors/clickhouse/tools/execute-query.ts
13629
13702
  import { z as z49 } from "zod";
13630
- var MAX_ROWS11 = 500;
13631
- var QUERY_TIMEOUT_MS4 = 6e4;
13703
+ var MAX_ROWS10 = 500;
13704
+ var QUERY_TIMEOUT_MS3 = 6e4;
13632
13705
  var inputSchema49 = z49.object({
13633
13706
  toolUseIntent: z49.string().optional().describe(
13634
13707
  "Brief description of what you intend to accomplish with this tool call"
@@ -13650,7 +13723,7 @@ var outputSchema49 = z49.discriminatedUnion("success", [
13650
13723
  ]);
13651
13724
  var executeQueryTool11 = new ConnectorTool({
13652
13725
  name: "executeQuery",
13653
- description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS11} rows.
13726
+ description: `Execute SQL against ClickHouse. Returns up to ${MAX_ROWS10} rows.
13654
13727
  Use for: schema exploration (SHOW DATABASES, SHOW TABLES, DESCRIBE TABLE), data sampling, analytical queries on large-scale columnar data.
13655
13728
  Avoid loading large amounts of data; always include LIMIT in queries.`,
13656
13729
  inputSchema: inputSchema49,
@@ -13678,7 +13751,7 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
13678
13751
  username,
13679
13752
  password: password || "",
13680
13753
  database: database || "default",
13681
- request_timeout: QUERY_TIMEOUT_MS4
13754
+ request_timeout: QUERY_TIMEOUT_MS3
13682
13755
  });
13683
13756
  try {
13684
13757
  const resultSet = await client.query({
@@ -13686,12 +13759,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
13686
13759
  format: "JSONEachRow"
13687
13760
  });
13688
13761
  const allRows = await resultSet.json();
13689
- const truncated = allRows.length > MAX_ROWS11;
13762
+ const truncated = allRows.length > MAX_ROWS10;
13690
13763
  return {
13691
13764
  success: true,
13692
- rowCount: Math.min(allRows.length, MAX_ROWS11),
13765
+ rowCount: Math.min(allRows.length, MAX_ROWS10),
13693
13766
  truncated,
13694
- rows: allRows.slice(0, MAX_ROWS11)
13767
+ rows: allRows.slice(0, MAX_ROWS10)
13695
13768
  };
13696
13769
  } finally {
13697
13770
  await client.close();
@@ -13847,7 +13920,7 @@ var parameters42 = {
13847
13920
  import { z as z50 } from "zod";
13848
13921
  var MAX_DOCUMENTS = 500;
13849
13922
  var CONNECT_TIMEOUT_MS4 = 1e4;
13850
- var QUERY_TIMEOUT_MS5 = 6e4;
13923
+ var QUERY_TIMEOUT_MS4 = 6e4;
13851
13924
  var inputSchema50 = z50.object({
13852
13925
  toolUseIntent: z50.string().optional().describe(
13853
13926
  "Brief description of what you intend to accomplish with this tool call"
@@ -13906,7 +13979,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
13906
13979
  const client = new MongoClient(connectionUrl, {
13907
13980
  connectTimeoutMS: CONNECT_TIMEOUT_MS4,
13908
13981
  serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS4,
13909
- socketTimeoutMS: QUERY_TIMEOUT_MS5
13982
+ socketTimeoutMS: QUERY_TIMEOUT_MS4
13910
13983
  });
13911
13984
  try {
13912
13985
  await client.connect();
@@ -13952,7 +14025,7 @@ For listing collections, use the aggregate tool with an empty pipeline on the sp
13952
14025
  import { z as z51 } from "zod";
13953
14026
  var MAX_DOCUMENTS2 = 500;
13954
14027
  var CONNECT_TIMEOUT_MS5 = 1e4;
13955
- var QUERY_TIMEOUT_MS6 = 6e4;
14028
+ var QUERY_TIMEOUT_MS5 = 6e4;
13956
14029
  var inputSchema51 = z51.object({
13957
14030
  toolUseIntent: z51.string().optional().describe(
13958
14031
  "Brief description of what you intend to accomplish with this tool call"
@@ -14003,7 +14076,7 @@ Common stages: $match (filter), $group (aggregate), $sort (order), $project (res
14003
14076
  const client = new MongoClient(connectionUrl, {
14004
14077
  connectTimeoutMS: CONNECT_TIMEOUT_MS5,
14005
14078
  serverSelectionTimeoutMS: CONNECT_TIMEOUT_MS5,
14006
- socketTimeoutMS: QUERY_TIMEOUT_MS6
14079
+ socketTimeoutMS: QUERY_TIMEOUT_MS5
14007
14080
  });
14008
14081
  try {
14009
14082
  await client.connect();
@@ -23232,7 +23305,7 @@ function redactJdbcUrl(jdbcUrl) {
23232
23305
  }
23233
23306
 
23234
23307
  // ../connectors/src/connectors/jdbc/tools/execute-query.ts
23235
- var MAX_ROWS12 = 500;
23308
+ var MAX_ROWS11 = 500;
23236
23309
  var CONNECT_TIMEOUT_MS7 = 1e4;
23237
23310
  var STATEMENT_TIMEOUT_MS3 = 6e4;
23238
23311
  var inputSchema82 = z82.object({
@@ -23258,7 +23331,7 @@ var outputSchema82 = z82.discriminatedUnion("success", [
23258
23331
  ]);
23259
23332
  var executeQueryTool12 = new ConnectorTool({
23260
23333
  name: "executeQuery",
23261
- description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS12} rows.
23334
+ description: `Execute a SQL query through the JDBC connector. Returns up to ${MAX_ROWS11} rows.
23262
23335
  Use for: schema exploration via \`information_schema\` (or USER_TABLES on Oracle), data sampling, analytical queries.
23263
23336
  The connector dispatches by JDBC URL prefix to the matching driver
23264
23337
  (PostgreSQL / Redshift / MySQL / MariaDB / SQL Server / Oracle), so use the dialect that matches the connection.
@@ -23299,9 +23372,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23299
23372
  const rows = result.rows;
23300
23373
  return {
23301
23374
  success: true,
23302
- rowCount: Math.min(rows.length, MAX_ROWS12),
23303
- truncated: rows.length > MAX_ROWS12,
23304
- rows: rows.slice(0, MAX_ROWS12)
23375
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23376
+ truncated: rows.length > MAX_ROWS11,
23377
+ rows: rows.slice(0, MAX_ROWS11)
23305
23378
  };
23306
23379
  }
23307
23380
  if (parsed.driver === "oracle") {
@@ -23316,9 +23389,9 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23316
23389
  const rows = result.rows;
23317
23390
  return {
23318
23391
  success: true,
23319
- rowCount: Math.min(rows.length, MAX_ROWS12),
23320
- truncated: rows.length > MAX_ROWS12,
23321
- rows: rows.slice(0, MAX_ROWS12)
23392
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23393
+ truncated: rows.length > MAX_ROWS11,
23394
+ rows: rows.slice(0, MAX_ROWS11)
23322
23395
  };
23323
23396
  }
23324
23397
  let tunnel;
@@ -23342,12 +23415,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23342
23415
  STATEMENT_TIMEOUT_MS3
23343
23416
  );
23344
23417
  const rows = result.rows;
23345
- const truncated = rows.length > MAX_ROWS12;
23418
+ const truncated = rows.length > MAX_ROWS11;
23346
23419
  return {
23347
23420
  success: true,
23348
- rowCount: Math.min(rows.length, MAX_ROWS12),
23421
+ rowCount: Math.min(rows.length, MAX_ROWS11),
23349
23422
  truncated,
23350
- rows: rows.slice(0, MAX_ROWS12)
23423
+ rows: rows.slice(0, MAX_ROWS11)
23351
23424
  };
23352
23425
  } finally {
23353
23426
  await pool2.end();
@@ -23368,12 +23441,12 @@ Always bound results: LIMIT for PG/MySQL/Redshift, TOP for SQL Server, FETCH FIR
23368
23441
  );
23369
23442
  const [rows] = await Promise.race([queryPromise, timeoutPromise]);
23370
23443
  const resultRows = Array.isArray(rows) ? rows : [];
23371
- const truncated = resultRows.length > MAX_ROWS12;
23444
+ const truncated = resultRows.length > MAX_ROWS11;
23372
23445
  return {
23373
23446
  success: true,
23374
- rowCount: Math.min(resultRows.length, MAX_ROWS12),
23447
+ rowCount: Math.min(resultRows.length, MAX_ROWS11),
23375
23448
  truncated,
23376
- rows: resultRows.slice(0, MAX_ROWS12)
23449
+ rows: resultRows.slice(0, MAX_ROWS11)
23377
23450
  };
23378
23451
  } finally {
23379
23452
  await pool.end();
@@ -24642,7 +24715,7 @@ var parameters70 = {
24642
24715
 
24643
24716
  // ../connectors/src/connectors/supabase/tools/execute-query.ts
24644
24717
  import { z as z86 } from "zod";
24645
- var MAX_ROWS13 = 500;
24718
+ var MAX_ROWS12 = 500;
24646
24719
  var CONNECT_TIMEOUT_MS8 = 1e4;
24647
24720
  var STATEMENT_TIMEOUT_MS4 = 6e4;
24648
24721
  var inputSchema86 = z86.object({
@@ -24668,7 +24741,7 @@ var outputSchema86 = z86.discriminatedUnion("success", [
24668
24741
  ]);
24669
24742
  var executeQueryTool13 = new ConnectorTool({
24670
24743
  name: "executeQuery",
24671
- description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS13} rows.
24744
+ description: `Execute SQL against a Supabase Postgres database. Returns up to ${MAX_ROWS12} rows.
24672
24745
  Use for: schema exploration (information_schema), data sampling, and analytical queries against Supabase tables.
24673
24746
  User tables live in the \`public\` schema by default; Supabase-managed metadata lives in \`auth\` and \`storage\`.
24674
24747
  Avoid loading large amounts of data; always include LIMIT in queries.`,
@@ -24698,12 +24771,12 @@ Avoid loading large amounts of data; always include LIMIT in queries.`,
24698
24771
  try {
24699
24772
  const result = await pool.query(sql);
24700
24773
  const rows = result.rows;
24701
- const truncated = rows.length > MAX_ROWS13;
24774
+ const truncated = rows.length > MAX_ROWS12;
24702
24775
  return {
24703
24776
  success: true,
24704
- rowCount: Math.min(rows.length, MAX_ROWS13),
24777
+ rowCount: Math.min(rows.length, MAX_ROWS12),
24705
24778
  truncated,
24706
- rows: rows.slice(0, MAX_ROWS13)
24779
+ rows: rows.slice(0, MAX_ROWS12)
24707
24780
  };
24708
24781
  } finally {
24709
24782
  await pool.end();
@@ -25182,7 +25255,7 @@ var parameters72 = {
25182
25255
 
25183
25256
  // ../connectors/src/connectors/sqlserver/tools/execute-query.ts
25184
25257
  import { z as z88 } from "zod";
25185
- var MAX_ROWS14 = 500;
25258
+ var MAX_ROWS13 = 500;
25186
25259
  var inputSchema88 = z88.object({
25187
25260
  toolUseIntent: z88.string().optional().describe(
25188
25261
  "Brief description of what you intend to accomplish with this tool call"
@@ -25206,7 +25279,7 @@ var outputSchema88 = z88.discriminatedUnion("success", [
25206
25279
  ]);
25207
25280
  var executeQueryTool14 = new ConnectorTool({
25208
25281
  name: "executeQuery",
25209
- description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS14} rows.
25282
+ description: `Execute a T-SQL query against Microsoft SQL Server. Returns up to ${MAX_ROWS13} rows.
25210
25283
  Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
25211
25284
  SQL Server uses \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets (\`[schema].[table]\`).
25212
25285
  Avoid loading large amounts of data; always include \`TOP\` in queries.`,
@@ -25239,12 +25312,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
25239
25312
  const { rows } = await runMssqlQuery(parsed, sql, {
25240
25313
  tunnelParams: connectionParamsToRecord(connection2)
25241
25314
  });
25242
- const truncated = rows.length > MAX_ROWS14;
25315
+ const truncated = rows.length > MAX_ROWS13;
25243
25316
  return {
25244
25317
  success: true,
25245
- rowCount: Math.min(rows.length, MAX_ROWS14),
25318
+ rowCount: Math.min(rows.length, MAX_ROWS13),
25246
25319
  truncated,
25247
- rows: rows.slice(0, MAX_ROWS14)
25320
+ rows: rows.slice(0, MAX_ROWS13)
25248
25321
  };
25249
25322
  } catch (err) {
25250
25323
  let msg = err instanceof Error ? err.message : String(err);
@@ -25377,7 +25450,7 @@ var parameters73 = {
25377
25450
 
25378
25451
  // ../connectors/src/connectors/azure-sql/tools/execute-query.ts
25379
25452
  import { z as z89 } from "zod";
25380
- var MAX_ROWS15 = 500;
25453
+ var MAX_ROWS14 = 500;
25381
25454
  var inputSchema89 = z89.object({
25382
25455
  toolUseIntent: z89.string().optional().describe(
25383
25456
  "Brief description of what you intend to accomplish with this tool call"
@@ -25401,7 +25474,7 @@ var outputSchema89 = z89.discriminatedUnion("success", [
25401
25474
  ]);
25402
25475
  var executeQueryTool15 = new ConnectorTool({
25403
25476
  name: "executeQuery",
25404
- description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS15} rows.
25477
+ description: `Execute a T-SQL query against Azure SQL Database. Returns up to ${MAX_ROWS14} rows.
25405
25478
  Use for: schema exploration via \`INFORMATION_SCHEMA\`, data sampling, and analytical queries.
25406
25479
  Azure SQL is T-SQL: use \`TOP n\` instead of \`LIMIT n\`. Identifiers can be wrapped in square brackets.
25407
25480
  Avoid loading large amounts of data; always include \`TOP\` in queries.`,
@@ -25435,12 +25508,12 @@ Avoid loading large amounts of data; always include \`TOP\` in queries.`,
25435
25508
  forceEncrypt: true,
25436
25509
  tunnelParams: connectionParamsToRecord(connection2)
25437
25510
  });
25438
- const truncated = rows.length > MAX_ROWS15;
25511
+ const truncated = rows.length > MAX_ROWS14;
25439
25512
  return {
25440
25513
  success: true,
25441
- rowCount: Math.min(rows.length, MAX_ROWS15),
25514
+ rowCount: Math.min(rows.length, MAX_ROWS14),
25442
25515
  truncated,
25443
- rows: rows.slice(0, MAX_ROWS15)
25516
+ rows: rows.slice(0, MAX_ROWS14)
25444
25517
  };
25445
25518
  } catch (err) {
25446
25519
  let msg = err instanceof Error ? err.message : String(err);
@@ -25917,7 +25990,7 @@ var parameters75 = {
25917
25990
 
25918
25991
  // ../connectors/src/connectors/oracle/tools/execute-query.ts
25919
25992
  import { z as z92 } from "zod";
25920
- var MAX_ROWS16 = 500;
25993
+ var MAX_ROWS15 = 500;
25921
25994
  var inputSchema92 = z92.object({
25922
25995
  toolUseIntent: z92.string().optional().describe(
25923
25996
  "Brief description of what you intend to accomplish with this tool call"
@@ -25941,7 +26014,7 @@ var outputSchema92 = z92.discriminatedUnion("success", [
25941
26014
  ]);
25942
26015
  var executeQueryTool16 = new ConnectorTool({
25943
26016
  name: "executeQuery",
25944
- description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS16} rows.
26017
+ description: `Execute a query against an Oracle Database. Returns up to ${MAX_ROWS15} rows.
25945
26018
  Use for: schema exploration via \`USER_TABLES\` / \`USER_TAB_COLUMNS\` / \`ALL_TABLES\`, data sampling, and analytical queries.
25946
26019
  Oracle uses \`FETCH FIRST n ROWS ONLY\` (12c+) or \`ROWNUM\` for row limiting \u2014 there is no \`LIMIT\` keyword.
25947
26020
  Unquoted identifiers are stored upper-case (\`SELECT * FROM employees\` resolves to \`EMPLOYEES\`).
@@ -25976,12 +26049,12 @@ Do NOT terminate statements with a semicolon; the driver rejects trailing termin
25976
26049
  const { rows } = await runOracleQuery(parsed, cleanSql, {
25977
26050
  tunnelParams: connectionParamsToRecord(connection2)
25978
26051
  });
25979
- const truncated = rows.length > MAX_ROWS16;
26052
+ const truncated = rows.length > MAX_ROWS15;
25980
26053
  return {
25981
26054
  success: true,
25982
- rowCount: Math.min(rows.length, MAX_ROWS16),
26055
+ rowCount: Math.min(rows.length, MAX_ROWS15),
25983
26056
  truncated,
25984
- rows: rows.slice(0, MAX_ROWS16)
26057
+ rows: rows.slice(0, MAX_ROWS15)
25985
26058
  };
25986
26059
  } catch (err) {
25987
26060
  let msg = err instanceof Error ? err.message : String(err);
@@ -26000,7 +26073,7 @@ var oracleConnector = new ConnectorPlugin({
26000
26073
  description: "Connect to Oracle Database using a JDBC-style URL via the pure-JS Thin driver (no Oracle Instant Client required).",
26001
26074
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3iGEdzvGHncU5bYqFOROiV/9e7bdda7230d7ca6b34e7f6a862de876/oracle-icon.webp",
26002
26075
  parameters: parameters75,
26003
- releaseFlag: { dev1: true, dev2: false, prod: false },
26076
+ releaseFlag: { dev1: true, dev2: true, prod: true },
26004
26077
  categories: ["database"],
26005
26078
  onboarding: oracleOnboarding,
26006
26079
  systemPrompt: {