grain-tools 0.10.15 → 0.10.17

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
@@ -12728,7 +12728,7 @@ const useAppStore = create$3((set2, get2) => ({
12728
12728
  chartsEnabled: false,
12729
12729
  mcpEnabled: false,
12730
12730
  mcpEntitled: false,
12731
- grainServiceInstalled: true,
12731
+ grainServiceSetup: "registered",
12732
12732
  mcpSafeMode: true,
12733
12733
  activeConnectorType: null,
12734
12734
  activeConnectionId: null,
@@ -12818,7 +12818,7 @@ const useAppStore = create$3((set2, get2) => ({
12818
12818
  "filterResultsByActiveFile",
12819
12819
  "mcpEnabled",
12820
12820
  "mcpEntitled",
12821
- "grainServiceInstalled",
12821
+ "grainServiceSetup",
12822
12822
  "mcpSafeMode",
12823
12823
  "activeConnectorType",
12824
12824
  "activeConnectionId",
@@ -73197,6 +73197,10 @@ const DENSITY_HEIGHTS = {
73197
73197
  normal: { row: 35, header: 42 },
73198
73198
  comfortable: { row: 45, header: 52 }
73199
73199
  };
73200
+ const NUMERIC_TYPE = /^(unsigned\s+|signed\s+)?(u?(tiny|small|medium|big|huge)?int(eger)?\d*|decimal|numeric|number|double|float\d*|real|long|short|byte|money)(\s+(precision|unsigned|signed))?\s*(\(\s*\d+\s*(,\s*\d+\s*)?\))?$/i;
73201
+ function isNumericColumnType(type) {
73202
+ return Boolean(type && NUMERIC_TYPE.test(type.trim()));
73203
+ }
73200
73204
  const DataGrid = reactExports.forwardRef(function DataGrid2({
73201
73205
  theme: theme2,
73202
73206
  data,
@@ -73431,6 +73435,7 @@ const DataGrid = reactExports.forwardRef(function DataGrid2({
73431
73435
  return p2.data[col.name];
73432
73436
  return void 0;
73433
73437
  },
73438
+ ...isNumericColumnType(col.type) ? { cellClass: "sp-num-cell", headerClass: "ag-right-aligned-header" } : {},
73434
73439
  cellClassRules: {
73435
73440
  "sp-range-cell": (p2) => isInRange(p2.rowIndex ?? 0, index + 1)
73436
73441
  },
@@ -146829,6 +146834,7 @@ function getFormInitialData(connection) {
146829
146834
  delete formData["type"];
146830
146835
  delete formData["builtIn"];
146831
146836
  delete formData["hasPassword"];
146837
+ delete formData["draft"];
146832
146838
  return formData;
146833
146839
  }
146834
146840
  function schemaHasPasswordField(schema) {
@@ -146867,9 +146873,10 @@ function schemaForConnectionMode(schema, connectorId, mode) {
146867
146873
  }
146868
146874
  };
146869
146875
  }
146876
+ const UNREACHABLE_MESSAGE = "Can't reach Grain. Start Grain and try again.";
146870
146877
  const ConnectionsManager = ({ initialAdd = false, onSubpageChange }) => {
146871
146878
  const { callServerTool, isReady, mode, sendMessage, onMessage } = useHostContext();
146872
- const grainServiceInstalled = useAppStore((state) => state.grainServiceInstalled);
146879
+ const grainServiceSetup = useAppStore((state) => state.grainServiceSetup);
146873
146880
  const supportsActiveConnection = mode === "vscode";
146874
146881
  const trackUi = useTrackUi();
146875
146882
  reactExports.useEffect(() => {
@@ -147101,7 +147108,8 @@ const ConnectionsManager = ({ initialAdd = false, onSubpageChange }) => {
147101
147108
  const profileToSave = {
147102
147109
  ...formData,
147103
147110
  type: typeToSave,
147104
- id: connection?.id ?? `conn_${Date.now()}`
147111
+ id: connection?.id ?? `conn_${Date.now()}`,
147112
+ ...connection?.draft ? { draft: false } : {}
147105
147113
  };
147106
147114
  if (isEditing2 && profileToSave["password"] === "") {
147107
147115
  delete profileToSave["password"];
@@ -147377,10 +147385,30 @@ const ConnectionsManager = ({ initialAdd = false, onSubpageChange }) => {
147377
147385
  }
147378
147386
  return null;
147379
147387
  };
147388
+ const renderUnreachableActions = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { marginTop: 12, display: "flex", gap: 8 }, children: [
147389
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "sp-btn", onClick: fetchData, children: "Retry" }),
147390
+ mode === "vscode" && /* @__PURE__ */ jsxRuntimeExports.jsx(
147391
+ "button",
147392
+ {
147393
+ className: "sp-btn",
147394
+ onClick: () => sendMessage?.(grainServiceSetup === "not-set-up" ? "setUpGrain" : "startGrain"),
147395
+ children: grainServiceSetup === "not-set-up" ? "Set up Grain" : "Start Grain"
147396
+ }
147397
+ )
147398
+ ] });
147399
+ const renderUnreachableState = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sp-conn-empty", children: [
147400
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: UNREACHABLE_MESSAGE }),
147401
+ renderUnreachableActions()
147402
+ ] });
147380
147403
  const renderConnectionForm = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sp-detail", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sp-conn-detail-body", children: [
147381
147404
  renderToast(),
147382
- !selectedType && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sp-conn-form-section", children: "Database Type" }),
147383
- !selectedType && ["local", "server"].map((group) => {
147405
+ !selectedType && connectors.length === 0 && connectionsUnreachable && renderUnreachableState(),
147406
+ !selectedType && connectors.length === 0 && !connectionsUnreachable && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sp-conn-empty", children: [
147407
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No database types are available." }),
147408
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "sp-btn", onClick: fetchData, children: "Retry" }) })
147409
+ ] }),
147410
+ !selectedType && connectors.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sp-conn-form-section", children: "Database Type" }),
147411
+ !selectedType && connectors.length > 0 && ["local", "server"].map((group) => {
147384
147412
  const groupConnectors = connectors.filter((c) => getConnectorGroup(c.id) === group);
147385
147413
  if (groupConnectors.length === 0) {
147386
147414
  return null;
@@ -147557,11 +147585,8 @@ const ConnectionsManager = ({ initialAdd = false, onSubpageChange }) => {
147557
147585
  gap: "12px"
147558
147586
  },
147559
147587
  children: connections.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sp-conn-empty", style: { gridColumn: "1 / -1" }, children: [
147560
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: connectionsUnreachable ? "Can't reach Grain. Start Grain and try again." : "No connections configured." }),
147561
- connectionsUnreachable && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { marginTop: 12, display: "flex", gap: 8 }, children: [
147562
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "sp-btn", onClick: fetchData, children: "Retry" }),
147563
- mode === "vscode" && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "sp-btn", onClick: () => sendMessage?.("startGrain"), children: grainServiceInstalled ? "Start Grain" : "Set up Grain" })
147564
- ] }),
147588
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: connectionsUnreachable ? UNREACHABLE_MESSAGE : "No connections configured." }),
147589
+ connectionsUnreachable && renderUnreachableActions(),
147565
147590
  mode === "vscode" && !connectionsUnreachable && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
147566
147591
  "button",
147567
147592
  {
@@ -147638,7 +147663,8 @@ const ConnectionsManager = ({ initialAdd = false, onSubpageChange }) => {
147638
147663
  },
147639
147664
  children: [
147640
147665
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sp-dot sp-dot-${status}` }),
147641
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "var(--sp-muted-fg)" }, children: statusLabel }),
147666
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "var(--sp-muted-fg)" }, children: c.draft ? "Needs setup" : statusLabel }),
147667
+ c.draft && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-pill", children: "Draft" }),
147642
147668
  isActive && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-pill", style: { marginLeft: "auto" }, children: "Active" })
147643
147669
  ]
147644
147670
  }
@@ -147662,7 +147688,8 @@ const ConnectionsManager = ({ initialAdd = false, onSubpageChange }) => {
147662
147688
  meta: selectedConnection && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
147663
147689
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-conn-type-badge", children: selectedConnection.type }),
147664
147690
  supportsActiveConnection && activeConnectionId === selectedConnection.id && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-conn-active-badge", children: "Active" }),
147665
- selectedConnection.builtIn && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-conn-built-in-label", children: "Built-in" })
147691
+ selectedConnection.builtIn && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-conn-built-in-label", children: "Built-in" }),
147692
+ selectedConnection.draft && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sp-conn-built-in-label", children: "Draft" })
147666
147693
  ] }),
147667
147694
  actions: isFormOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: closeForm, "aria-label": "Cancel", children: "Cancel" }) : selectedConnection && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
147668
147695
  supportsActiveConnection && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -172062,6 +172089,12 @@ body.vscode-high-contrast .ag-theme-quartz {
172062
172089
  outline: none !important;
172063
172090
  }
172064
172091
 
172092
+ .sp-num-cell {
172093
+ justify-content: flex-end;
172094
+ text-align: right;
172095
+ font-variant-numeric: tabular-nums;
172096
+ }
172097
+
172065
172098
  .sp-null {
172066
172099
  color: var(--sp-muted-fg);
172067
172100
  font-style: italic;