grain-tools 0.10.3 → 0.10.7

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/mcp-app.html CHANGED
@@ -147468,6 +147468,69 @@ function getConnectorGroup(id) {
147468
147468
  function CloseIcon({ size = 10 }) {
147469
147469
  return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.708.708L7.293 8l-3.647 3.646.708.707L8 8.707z" }) });
147470
147470
  }
147471
+ const OPTIONAL_DRIVERS = [
147472
+ {
147473
+ connectorType: "snowflake",
147474
+ dependency: "snowflake-sdk",
147475
+ capability: "Snowflake connections",
147476
+ title: "Snowflake support is required",
147477
+ guidance: "Grain can download and verify Snowflake support for you. Nothing needs installing by hand.",
147478
+ messageTokens: ["snowflake-sdk", "snowflake sdk", "sdk is not available"]
147479
+ },
147480
+ {
147481
+ connectorType: "mysql",
147482
+ dependency: "mysql2",
147483
+ capability: "MySQL connections",
147484
+ title: "MySQL support is required",
147485
+ guidance: "Grain can download and verify the MySQL driver for you. Nothing needs installing by hand.",
147486
+ messageTokens: ["mysql2"]
147487
+ },
147488
+ {
147489
+ connectorType: "mssql",
147490
+ dependency: "mssql",
147491
+ capability: "SQL Server connections",
147492
+ title: "SQL Server support is required",
147493
+ guidance: "Grain can download and verify the SQL Server driver for you. Nothing needs installing by hand.",
147494
+ messageTokens: ["'mssql'", "find module 'mssql", 'cannot find module "mssql']
147495
+ },
147496
+ {
147497
+ connectorType: "bigquery",
147498
+ dependency: "@google-cloud/bigquery",
147499
+ capability: "BigQuery connections",
147500
+ title: "BigQuery support is required",
147501
+ guidance: "Grain can download and verify the BigQuery driver for you. Nothing needs installing by hand.",
147502
+ messageTokens: ["@google-cloud/bigquery"]
147503
+ },
147504
+ {
147505
+ connectorType: "sqlite",
147506
+ dependency: "sql.js",
147507
+ capability: "SQLite connections",
147508
+ title: "SQLite support is required",
147509
+ guidance: "Grain can download and verify the SQLite driver for you. Nothing needs installing by hand.",
147510
+ messageTokens: ["sql.js"]
147511
+ },
147512
+ {
147513
+ connectorType: "postgres",
147514
+ dependency: "pg",
147515
+ capability: "PostgreSQL connections",
147516
+ title: "PostgreSQL support is required",
147517
+ guidance: "Grain can download and verify the PostgreSQL driver for you. Nothing needs installing by hand.",
147518
+ // Quoted specifiers, not the bare name: `pg` is two characters and the matchers are
147519
+ // plain substring tests, so a bare token would claim any message containing those
147520
+ // letters (`/pgdata/…`, `PGPASSWORD`, `pg-format`) — and matchOptionalDriverByMessage
147521
+ // returns the first match in array order, so it could shadow other drivers too.
147522
+ messageTokens: ["'pg'", '"pg"']
147523
+ }
147524
+ ];
147525
+ new Set(
147526
+ OPTIONAL_DRIVERS.map((driver) => driver.dependency)
147527
+ );
147528
+ function matchOptionalDriverByMessage(message) {
147529
+ const lower = message.toLowerCase();
147530
+ return OPTIONAL_DRIVERS.find(
147531
+ (spec) => spec.messageTokens.some((token) => lower.includes(token.toLowerCase()))
147532
+ );
147533
+ }
147471
147534
  function errorText(e2) {
147472
147535
  return e2 instanceof Error ? e2.message : String(e2);
147473
147536
  }
@@ -147507,29 +147570,20 @@ function TestElapsed({ since }) {
147507
147570
  "s"
147508
147571
  ] });
147509
147572
  }
147510
- const OPTIONAL_DEPENDENCY_ADVICE = [
147511
- {
147512
- dependency: "snowflake-sdk",
147513
- installCommand: "npm install snowflake-sdk",
147514
- title: "Snowflake support is required",
147515
- guidance: "Snowflake connections require optional Snowflake SDK support, but the SDK is not available in this extension runtime."
147516
- }
147517
- ];
147518
147573
  const CONNECTOR_GROUP_LABELS = {
147519
147574
  local: "Local files",
147520
147575
  server: "Servers & warehouses"
147521
147576
  };
147522
147577
  function getOptionalDependencyAdvice(message) {
147523
- const lowerMessage = message.toLowerCase();
147524
- return OPTIONAL_DEPENDENCY_ADVICE.find((advice) => {
147525
- if (message.includes(advice.dependency)) {
147526
- return true;
147527
- }
147528
- if (advice.dependency === "snowflake-sdk") {
147529
- return lowerMessage.includes("snowflake sdk") || lowerMessage.includes("sdk is not available");
147530
- }
147531
- return false;
147532
- }) ?? null;
147578
+ const spec = matchOptionalDriverByMessage(message);
147579
+ if (!spec) {
147580
+ return null;
147581
+ }
147582
+ return {
147583
+ dependency: spec.dependency,
147584
+ title: spec.title,
147585
+ guidance: spec.guidance
147586
+ };
147533
147587
  }
147534
147588
  function getOptionalDependencyDetails(message) {
147535
147589
  return message.replace(/^Connection Test Failed:\s*/i, "").replace(/^Error:\s*/i, "").trim();
@@ -147961,8 +148015,7 @@ const ConnectionsManager = ({ initialAdd = false }) => {
147961
148015
  };
147962
148016
  const handleInstallOptionalDependency = (advice) => {
147963
148017
  sendMessage("installOptionalDependency", {
147964
- dependency: advice.dependency,
147965
- installCommand: advice.installCommand
148018
+ dependency: advice.dependency
147966
148019
  });
147967
148020
  };
147968
148021
  const openAddForm = () => {