@sqlrooms/ai 0.24.21 → 0.24.22

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.
@@ -1,7 +1,10 @@
1
+ import * as arrow from 'apache-arrow';
1
2
  type QueryToolResultProps = {
2
3
  title: string;
3
4
  sqlQuery: string;
5
+ /** Provided in case the query result is already an arrow table */
6
+ arrowTable?: arrow.Table;
4
7
  };
5
- export declare function QueryToolResult({ title, sqlQuery }: QueryToolResultProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function QueryToolResult(props: QueryToolResultProps): import("react/jsx-runtime").JSX.Element;
6
9
  export {};
7
10
  //# sourceMappingURL=QueryToolResult.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryToolResult.d.ts","sourceRoot":"","sources":["../../../src/components/tools/QueryToolResult.tsx"],"names":[],"mappings":"AAIA,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAE,oBAAoB,2CA0BtE"}
1
+ {"version":3,"file":"QueryToolResult.d.ts","sourceRoot":"","sources":["../../../src/components/tools/QueryToolResult.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;CAC1B,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CA2C1D"}
@@ -2,8 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { DataTableModal } from '@sqlrooms/data-table';
3
3
  import { Button, CopyButton, useDisclosure } from '@sqlrooms/ui';
4
4
  import { TableIcon } from 'lucide-react';
5
- export function QueryToolResult({ title, sqlQuery }) {
5
+ export function QueryToolResult(props) {
6
+ const { title, sqlQuery } = props;
6
7
  const tableModal = useDisclosure();
7
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "text-muted-foreground bg-muted relative max-h-[150px] w-full overflow-auto rounded-md p-2 font-mono text-xs", children: [_jsx("pre", { className: "whitespace-pre-wrap break-words pr-8", children: sqlQuery }), _jsx("div", { className: "absolute right-1 top-1", children: _jsx(CopyButton, { text: sqlQuery, variant: "ghost", size: "icon", className: "h-6 w-6", ariaLabel: "Copy SQL" }) })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: tableModal.onOpen, children: [_jsx(TableIcon, { className: "h-4 w-4" }), _jsx("h3", { className: "ml-1 text-xs", children: "Show Query Result" })] }) }), _jsx(DataTableModal, { title: title, query: sqlQuery, tableModal: tableModal })] }));
8
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "text-muted-foreground bg-muted relative max-h-[150px] w-full overflow-auto rounded-md p-2 font-mono text-xs", children: [_jsx("pre", { className: "whitespace-pre-wrap break-words pr-8", children: sqlQuery }), _jsx("div", { className: "absolute right-1 top-1", children: _jsx(CopyButton, { text: sqlQuery, variant: "ghost", size: "icon", className: "h-6 w-6", ariaLabel: "Copy SQL" }) })] }), _jsx("div", { className: "flex items-center gap-2", children: _jsxs(Button, { variant: "ghost", size: "xs", onClick: tableModal.onOpen, children: [_jsx(TableIcon, { className: "h-4 w-4" }), _jsx("h3", { className: "text-xs", children: "Show Query Result" })] }) }), 'arrowTable' in props ? (props.arrowTable ? (_jsx(DataTableModal, { title: title, arrowTable: props.arrowTable, tableModal: tableModal })) : (_jsx("div", { className: "p-4 text-xs", children: "No data" }))) : (_jsx(DataTableModal, { title: title, query: sqlQuery, tableModal: tableModal }))] }));
8
9
  }
9
10
  //# sourceMappingURL=QueryToolResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryToolResult.js","sourceRoot":"","sources":["../../../src/components/tools/QueryToolResult.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAOvC,MAAM,UAAU,eAAe,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAuB;IACrE,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,OAAO,CACL,8BACE,eAAK,SAAS,EAAC,6GAA6G,aAC1H,cAAK,SAAS,EAAC,sCAAsC,YAAE,QAAQ,GAAO,EACtE,cAAK,SAAS,EAAC,wBAAwB,YACrC,KAAC,UAAU,IACT,IAAI,EAAE,QAAQ,EACd,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,SAAS,EACnB,SAAS,EAAC,UAAU,GACpB,GACE,IACF,EACN,cAAK,SAAS,EAAC,yBAAyB,YACtC,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,UAAU,CAAC,MAAM,aAC1D,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,EACjC,aAAI,SAAS,EAAC,cAAc,kCAAuB,IAC5C,GACL,EAEN,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAI,IACxE,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import {DataTableModal} from '@sqlrooms/data-table';\nimport {Button, CopyButton, useDisclosure} from '@sqlrooms/ui';\nimport {TableIcon} from 'lucide-react';\n\ntype QueryToolResultProps = {\n title: string;\n sqlQuery: string;\n};\n\nexport function QueryToolResult({title, sqlQuery}: QueryToolResultProps) {\n const tableModal = useDisclosure();\n return (\n <>\n <div className=\"text-muted-foreground bg-muted relative max-h-[150px] w-full overflow-auto rounded-md p-2 font-mono text-xs\">\n <pre className=\"whitespace-pre-wrap break-words pr-8\">{sqlQuery}</pre>\n <div className=\"absolute right-1 top-1\">\n <CopyButton\n text={sqlQuery}\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-6 w-6\"\n ariaLabel=\"Copy SQL\"\n />\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button variant=\"ghost\" size=\"sm\" onClick={tableModal.onOpen}>\n <TableIcon className=\"h-4 w-4\" />\n <h3 className=\"ml-1 text-xs\">Show Query Result</h3>\n </Button>\n </div>\n\n <DataTableModal title={title} query={sqlQuery} tableModal={tableModal} />\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"QueryToolResult.js","sourceRoot":"","sources":["../../../src/components/tools/QueryToolResult.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AASvC,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAChC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,OAAO,CACL,8BACE,eAAK,SAAS,EAAC,6GAA6G,aAC1H,cAAK,SAAS,EAAC,sCAAsC,YAAE,QAAQ,GAAO,EACtE,cAAK,SAAS,EAAC,wBAAwB,YACrC,KAAC,UAAU,IACT,IAAI,EAAE,QAAQ,EACd,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,SAAS,EACnB,SAAS,EAAC,UAAU,GACpB,GACE,IACF,EACN,cAAK,SAAS,EAAC,yBAAyB,YACtC,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,UAAU,CAAC,MAAM,aAC1D,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,GAAG,EACjC,aAAI,SAAS,EAAC,SAAS,kCAAuB,IACvC,GACL,EAEL,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,CACvB,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CACjB,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,UAAU,EAAE,UAAU,GACtB,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,aAAa,wBAAc,CAC3C,CACF,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,QAAQ,EACf,UAAU,EAAE,UAAU,GACtB,CACH,IACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import {DataTableModal} from '@sqlrooms/data-table';\nimport {Button, CopyButton, useDisclosure} from '@sqlrooms/ui';\nimport * as arrow from 'apache-arrow';\nimport {TableIcon} from 'lucide-react';\n\ntype QueryToolResultProps = {\n title: string;\n sqlQuery: string;\n /** Provided in case the query result is already an arrow table */\n arrowTable?: arrow.Table;\n};\n\nexport function QueryToolResult(props: QueryToolResultProps) {\n const {title, sqlQuery} = props;\n const tableModal = useDisclosure();\n return (\n <>\n <div className=\"text-muted-foreground bg-muted relative max-h-[150px] w-full overflow-auto rounded-md p-2 font-mono text-xs\">\n <pre className=\"whitespace-pre-wrap break-words pr-8\">{sqlQuery}</pre>\n <div className=\"absolute right-1 top-1\">\n <CopyButton\n text={sqlQuery}\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-6 w-6\"\n ariaLabel=\"Copy SQL\"\n />\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button variant=\"ghost\" size=\"xs\" onClick={tableModal.onOpen}>\n <TableIcon className=\"h-4 w-4\" />\n <h3 className=\"text-xs\">Show Query Result</h3>\n </Button>\n </div>\n\n {'arrowTable' in props ? (\n props.arrowTable ? (\n <DataTableModal\n title={title}\n arrowTable={props.arrowTable}\n tableModal={tableModal}\n />\n ) : (\n <div className=\"p-4 text-xs\">No data</div>\n )\n ) : (\n <DataTableModal\n title={title}\n query={sqlQuery}\n tableModal={tableModal}\n />\n )}\n </>\n );\n}\n"]}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Displays a compact, reusable popover with a warning icon and error details.
3
+ * Intended for tool rendering/processing errors to keep UIs consistent.
4
+ *
5
+ * The popover is controllable to optimize performance by only rendering the
6
+ * JsonMonacoEditor when the popover is actually open.
7
+ */
8
+ export interface ToolErrorMessageProps {
9
+ /**
10
+ * Error object or message to display inside the popover body.
11
+ */
12
+ error?: unknown;
13
+ /**
14
+ * Optional structured details to render in a Monaco JSON editor.
15
+ */
16
+ details?: string | object;
17
+ /**
18
+ * Header text shown at the top of the popover.
19
+ * Defaults to "Tool rendering error".
20
+ */
21
+ title?: string;
22
+ /**
23
+ * Label shown next to the warning icon in the trigger button.
24
+ * Defaults to "Tool rendering failed".
25
+ */
26
+ triggerLabel?: string;
27
+ /**
28
+ * Alignment of the popover content relative to its trigger.
29
+ * Defaults to "start".
30
+ */
31
+ align?: 'start' | 'center' | 'end';
32
+ /**
33
+ * Height for the embedded editor when details are provided.
34
+ * Defaults to 300px.
35
+ */
36
+ editorHeightPx?: number;
37
+ }
38
+ export declare function ToolErrorMessage(props: ToolErrorMessageProps): import("react/jsx-runtime").JSX.Element;
39
+ //# sourceMappingURL=ToolErrorMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/components/tools/ToolErrorMessage.tsx"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAkD5D"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { JsonMonacoEditor } from '@sqlrooms/monaco-editor';
3
+ import { Button, Popover, PopoverContent, PopoverTrigger, useDisclosure, } from '@sqlrooms/ui';
4
+ import { TriangleAlertIcon } from 'lucide-react';
5
+ export function ToolErrorMessage(props) {
6
+ const title = props.title ?? 'Tool rendering error';
7
+ const triggerLabel = props.triggerLabel ?? 'Tool rendering failed';
8
+ const align = props.align ?? 'start';
9
+ const errorText = props.error != null ? String(props.error) : '';
10
+ const editorHeightPx = props.editorHeightPx ?? 300;
11
+ const hasDetails = props.details != null;
12
+ const popoverOpen = useDisclosure();
13
+ return (_jsxs(Popover, { open: popoverOpen.isOpen, onOpenChange: popoverOpen.onToggle, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { className: "w-fit", variant: "ghost", size: "xs", children: _jsxs("p", { className: "flex items-center gap-2 text-xs text-orange-500", children: [_jsx(TriangleAlertIcon, {}), triggerLabel] }) }) }), _jsx(PopoverContent, { align: align, style: { width: '600px', maxWidth: '80%' }, children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: "border-b text-sm font-medium text-orange-500", children: title }), errorText ? (_jsx("div", { className: "whitespace-pre-wrap font-mono text-xs text-orange-500", children: errorText })) : null, hasDetails && popoverOpen.isOpen ? (_jsx("div", { className: "w-full overflow-hidden rounded-md border", style: { height: editorHeightPx }, children: _jsx(JsonMonacoEditor, { value: props.details, readOnly: true, options: {
14
+ lineNumbers: 'off',
15
+ minimap: { enabled: false },
16
+ scrollBeyondLastLine: false,
17
+ wordWrap: 'on',
18
+ } }) })) : null] }) })] }));
19
+ }
20
+ //# sourceMappingURL=ToolErrorMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolErrorMessage.js","sourceRoot":"","sources":["../../../src/components/tools/ToolErrorMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,MAAM,EACN,OAAO,EACP,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAwC/C,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,sBAAsB,CAAC;IACpD,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,IAAI,uBAAuB,CAAC;IACnE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC;IACrC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,IAAI,GAAG,CAAC;IACnD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC;IACzC,MAAM,WAAW,GAAG,aAAa,EAAE,CAAC;IAEpC,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,QAAQ,aACnE,KAAC,cAAc,IAAC,OAAO,kBACrB,KAAC,MAAM,IAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,YACjD,aAAG,SAAS,EAAC,iDAAiD,aAC5D,KAAC,iBAAiB,KAAG,EACpB,YAAY,IACX,GACG,GACM,EACjB,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAC,YACpE,eAAK,SAAS,EAAC,qBAAqB,aAClC,cAAK,SAAS,EAAC,8CAA8C,YAC1D,KAAK,GACF,EACL,SAAS,CAAC,CAAC,CAAC,CACX,cAAK,SAAS,EAAC,uDAAuD,YACnE,SAAS,GACN,CACP,CAAC,CAAC,CAAC,IAAI,EACP,UAAU,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAClC,cACE,SAAS,EAAC,0CAA0C,EACpD,KAAK,EAAE,EAAC,MAAM,EAAE,cAAc,EAAC,YAE/B,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,CAAC,OAAiD,EAC9D,QAAQ,EAAE,IAAI,EACd,OAAO,EAAE;oCACP,WAAW,EAAE,KAAK;oCAClB,OAAO,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC;oCACzB,oBAAoB,EAAE,KAAK;oCAC3B,QAAQ,EAAE,IAAI;iCACf,GACD,GACE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,GACS,IACT,CACX,CAAC;AACJ,CAAC","sourcesContent":["import {JsonMonacoEditor} from '@sqlrooms/monaco-editor';\nimport {\n Button,\n Popover,\n PopoverContent,\n PopoverTrigger,\n useDisclosure,\n} from '@sqlrooms/ui';\nimport {TriangleAlertIcon} from 'lucide-react';\n\n/**\n * Displays a compact, reusable popover with a warning icon and error details.\n * Intended for tool rendering/processing errors to keep UIs consistent.\n *\n * The popover is controllable to optimize performance by only rendering the\n * JsonMonacoEditor when the popover is actually open.\n */\nexport interface ToolErrorMessageProps {\n /**\n * Error object or message to display inside the popover body.\n */\n error?: unknown;\n /**\n * Optional structured details to render in a Monaco JSON editor.\n */\n details?: string | object;\n /**\n * Header text shown at the top of the popover.\n * Defaults to \"Tool rendering error\".\n */\n title?: string;\n /**\n * Label shown next to the warning icon in the trigger button.\n * Defaults to \"Tool rendering failed\".\n */\n triggerLabel?: string;\n /**\n * Alignment of the popover content relative to its trigger.\n * Defaults to \"start\".\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Height for the embedded editor when details are provided.\n * Defaults to 300px.\n */\n editorHeightPx?: number;\n}\n\nexport function ToolErrorMessage(props: ToolErrorMessageProps) {\n const title = props.title ?? 'Tool rendering error';\n const triggerLabel = props.triggerLabel ?? 'Tool rendering failed';\n const align = props.align ?? 'start';\n const errorText = props.error != null ? String(props.error) : '';\n const editorHeightPx = props.editorHeightPx ?? 300;\n const hasDetails = props.details != null;\n const popoverOpen = useDisclosure();\n\n return (\n <Popover open={popoverOpen.isOpen} onOpenChange={popoverOpen.onToggle}>\n <PopoverTrigger asChild>\n <Button className=\"w-fit\" variant=\"ghost\" size=\"xs\">\n <p className=\"flex items-center gap-2 text-xs text-orange-500\">\n <TriangleAlertIcon />\n {triggerLabel}\n </p>\n </Button>\n </PopoverTrigger>\n <PopoverContent align={align} style={{width: '600px', maxWidth: '80%'}}>\n <div className=\"flex flex-col gap-2\">\n <div className=\"border-b text-sm font-medium text-orange-500\">\n {title}\n </div>\n {errorText ? (\n <div className=\"whitespace-pre-wrap font-mono text-xs text-orange-500\">\n {errorText}\n </div>\n ) : null}\n {hasDetails && popoverOpen.isOpen ? (\n <div\n className=\"w-full overflow-hidden rounded-md border\"\n style={{height: editorHeightPx}}\n >\n <JsonMonacoEditor\n value={props.details as unknown as object | string | undefined}\n readOnly={true}\n options={{\n lineNumbers: 'off',\n minimap: {enabled: false},\n scrollBeyondLastLine: false,\n wordWrap: 'on',\n }}\n />\n </div>\n ) : null}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolResult.d.ts","sourceRoot":"","sources":["../../../src/components/tools/ToolResult.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAC,cAAc,EAAC,MAAM,IAAI,CAAC;AAElC,KAAK,eAAe,GAAG;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyFhD,CAAC"}
1
+ {"version":3,"file":"ToolResult.d.ts","sourceRoot":"","sources":["../../../src/components/tools/ToolResult.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAC,cAAc,EAAC,MAAM,IAAI,CAAC;AAGlC,KAAK,eAAe,GAAG;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqEhD,CAAC"}
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { JsonMonacoEditor } from '@sqlrooms/monaco-editor';
3
- import { Button, useDisclosure } from '@sqlrooms/ui';
4
- import { TriangleAlertIcon } from 'lucide-react';
2
+ import { useDisclosure } from '@sqlrooms/ui';
5
3
  import { useStoreWithAi } from '../../AiSlice';
6
4
  import { MessageContainer } from '../MessageContainer';
7
5
  import { ToolCallErrorBoundary } from './ToolResultErrorBoundary';
6
+ import { ToolErrorMessage } from './ToolErrorMessage';
8
7
  export const ToolResult = ({ toolInvocation, additionalData, isCompleted, errorMessage, }) => {
9
8
  const { isOpen: showDetails, onToggle: toggleShowDetails } = useDisclosure(false);
10
9
  const { toolName, args, state } = toolInvocation;
@@ -25,11 +24,6 @@ export const ToolResult = ({ toolInvocation, additionalData, isCompleted, errorM
25
24
  llmResult,
26
25
  additionalData,
27
26
  isCompleted,
28
- }, children: [_jsx("div", { className: "text-sm text-gray-500", children: reason && _jsx("span", { children: reason }) }), ToolComponent && isSuccess && isCompleted && (_jsx(ToolCallErrorBoundary, { children: typeof ToolComponent === 'function' ? (_jsx(ToolComponent, { ...llmResult, ...additionalData })) : (ToolComponent) })), isCompleted && (errorMessage || !isSuccess) && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Button, { className: "w-fit", variant: "ghost", size: "xs", onClick: () => toggleShowDetails(), children: _jsxs("p", { className: "flex items-center gap-2 text-xs text-orange-500", children: [_jsx(TriangleAlertIcon, {}), "Tool call failed"] }) }), showDetails && (_jsx("div", { className: "h-[300px] w-full overflow-hidden rounded-md border", children: _jsx(JsonMonacoEditor, { value: toolInvocation, readOnly: true, options: {
29
- lineNumbers: 'off',
30
- minimap: { enabled: false },
31
- scrollBeyondLastLine: false,
32
- wordWrap: 'on',
33
- } }) }))] }))] }));
27
+ }, children: [_jsx("div", { className: "text-sm text-gray-500", children: reason && _jsx("span", { children: reason }) }), ToolComponent && isSuccess && isCompleted && (_jsx(ToolCallErrorBoundary, { children: typeof ToolComponent === 'function' ? (_jsx(ToolComponent, { ...llmResult, ...additionalData })) : (ToolComponent) })), isCompleted && (errorMessage || !isSuccess) && (_jsx(ToolErrorMessage, { error: errorMessage ?? 'Tool call failed', details: toolInvocation, title: "Tool call error", triggerLabel: "Tool call failed", editorHeightPx: 300 }))] }));
34
28
  };
35
29
  //# sourceMappingURL=ToolResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolResult.js","sourceRoot":"","sources":["../../../src/components/tools/ToolResult.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAUhE,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EACpD,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE,EAAE;IACH,MAAM,EAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAC,GACtD,aAAa,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC,GAAG,cAAc,CAAC;IAC/C,MAAM,SAAS,GAAG,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpE,6CAA6C;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAElC,MAAM,aAAa,GAAG,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7C,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CACrC,CAAC;IAEF,+CAA+C;IAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAmB,CAAC;IAExC,6DAA6D;IAC7D,MAAM,SAAS,GACb,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,SAAS,IAAI,SAAS;QACtB,SAAS,CAAC,OAAO,KAAK,IAAI,CAAC;IAE7B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,cAAK,SAAS,EAAC,uBAAuB,YAAE,IAAI,GAAO,CACpD,CAAC,CAAC,CAAC,CACF,MAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE;YACP,QAAQ;YACR,IAAI;YACJ,SAAS;YACT,cAAc;YACd,WAAW;SACZ,aAED,cAAK,SAAS,EAAC,uBAAuB,YACnC,MAAM,IAAI,yBAAO,MAAM,GAAQ,GAC5B,EACL,aAAa,IAAI,SAAS,IAAI,WAAW,IAAI,CAC5C,KAAC,qBAAqB,cACnB,OAAO,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,CACrC,KAAC,aAAa,OACP,SAAqC,KACrC,cAA0C,GAC/C,CACH,CAAC,CAAC,CAAC,CACF,aAAa,CACd,GACqB,CACzB,EACA,WAAW,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,IAAI,CAC9C,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,MAAM,IACL,SAAS,EAAC,OAAO,EACjB,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,YAElC,aAAG,SAAS,EAAC,iDAAiD,aAC5D,KAAC,iBAAiB,KAAG,wBAEnB,GACG,EACR,WAAW,IAAI,CACd,cAAK,SAAS,EAAC,oDAAoD,YACjE,KAAC,gBAAgB,IACf,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,IAAI,EACd,OAAO,EAAE;gCACP,WAAW,EAAE,KAAK;gCAClB,OAAO,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC;gCACzB,oBAAoB,EAAE,KAAK;gCAC3B,QAAQ,EAAE,IAAI;6BACf,GACD,GACE,CACP,IACG,CACP,IACgB,CACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {JsonMonacoEditor} from '@sqlrooms/monaco-editor';\nimport {Button, useDisclosure} from '@sqlrooms/ui';\nimport {TriangleAlertIcon} from 'lucide-react';\nimport React from 'react';\nimport {useStoreWithAi} from '../../AiSlice';\nimport {MessageContainer} from '../MessageContainer';\nimport {ToolCallErrorBoundary} from './ToolResultErrorBoundary';\nimport {ToolInvocation} from 'ai';\n\ntype ToolResultProps = {\n toolInvocation: ToolInvocation;\n additionalData: unknown;\n isCompleted: boolean;\n errorMessage?: string;\n};\n\nexport const ToolResult: React.FC<ToolResultProps> = ({\n toolInvocation,\n additionalData,\n isCompleted,\n errorMessage,\n}) => {\n const {isOpen: showDetails, onToggle: toggleShowDetails} =\n useDisclosure(false);\n\n const {toolName, args, state} = toolInvocation;\n const llmResult = state === 'result' ? toolInvocation.result : null;\n\n // show reason text before tool call complete\n const text = args.reasoning || '';\n\n const ToolComponent = useStoreWithAi((state) =>\n state.ai.findToolComponent(toolName),\n );\n\n // check if args has a property called 'reason'\n const reason = args.reasoning as string;\n\n // check if llmResult is an object and has a success property\n const isSuccess =\n typeof llmResult === 'object' &&\n llmResult !== null &&\n 'success' in llmResult &&\n llmResult.success === true;\n\n return !isCompleted ? (\n <div className=\"text-sm text-gray-500\">{text}</div>\n ) : (\n <MessageContainer\n isSuccess={isSuccess}\n type={toolName}\n content={{\n toolName,\n args,\n llmResult,\n additionalData,\n isCompleted,\n }}\n >\n <div className=\"text-sm text-gray-500\">\n {reason && <span>{reason}</span>}\n </div>\n {ToolComponent && isSuccess && isCompleted && (\n <ToolCallErrorBoundary>\n {typeof ToolComponent === 'function' ? (\n <ToolComponent\n {...(llmResult as Record<string, unknown>)}\n {...(additionalData as Record<string, unknown>)}\n />\n ) : (\n ToolComponent\n )}\n </ToolCallErrorBoundary>\n )}\n {isCompleted && (errorMessage || !isSuccess) && (\n <div className=\"flex flex-col gap-2\">\n <Button\n className=\"w-fit\"\n variant=\"ghost\"\n size=\"xs\"\n onClick={() => toggleShowDetails()}\n >\n <p className=\"flex items-center gap-2 text-xs text-orange-500\">\n <TriangleAlertIcon />\n Tool call failed\n </p>\n </Button>\n {showDetails && (\n <div className=\"h-[300px] w-full overflow-hidden rounded-md border\">\n <JsonMonacoEditor\n value={toolInvocation}\n readOnly={true}\n options={{\n lineNumbers: 'off',\n minimap: {enabled: false},\n scrollBeyondLastLine: false,\n wordWrap: 'on',\n }}\n />\n </div>\n )}\n </div>\n )}\n </MessageContainer>\n );\n};\n"]}
1
+ {"version":3,"file":"ToolResult.js","sourceRoot":"","sources":["../../../src/components/tools/ToolResult.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAS,aAAa,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AASpD,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EACpD,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE,EAAE;IACH,MAAM,EAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAC,GACtD,aAAa,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC,GAAG,cAAc,CAAC;IAC/C,MAAM,SAAS,GAAG,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpE,6CAA6C;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAElC,MAAM,aAAa,GAAG,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7C,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CACrC,CAAC;IAEF,+CAA+C;IAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAmB,CAAC;IAExC,6DAA6D;IAC7D,MAAM,SAAS,GACb,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,SAAS,IAAI,SAAS;QACtB,SAAS,CAAC,OAAO,KAAK,IAAI,CAAC;IAE7B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,cAAK,SAAS,EAAC,uBAAuB,YAAE,IAAI,GAAO,CACpD,CAAC,CAAC,CAAC,CACF,MAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE;YACP,QAAQ;YACR,IAAI;YACJ,SAAS;YACT,cAAc;YACd,WAAW;SACZ,aAED,cAAK,SAAS,EAAC,uBAAuB,YACnC,MAAM,IAAI,yBAAO,MAAM,GAAQ,GAC5B,EACL,aAAa,IAAI,SAAS,IAAI,WAAW,IAAI,CAC5C,KAAC,qBAAqB,cACnB,OAAO,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,CACrC,KAAC,aAAa,OACP,SAAqC,KACrC,cAA0C,GAC/C,CACH,CAAC,CAAC,CAAC,CACF,aAAa,CACd,GACqB,CACzB,EACA,WAAW,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,IAAI,CAC9C,KAAC,gBAAgB,IACf,KAAK,EAAE,YAAY,IAAI,kBAAkB,EACzC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAC,iBAAiB,EACvB,YAAY,EAAC,kBAAkB,EAC/B,cAAc,EAAE,GAAG,GACnB,CACH,IACgB,CACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {Button, useDisclosure} from '@sqlrooms/ui';\nimport React from 'react';\nimport {useStoreWithAi} from '../../AiSlice';\nimport {MessageContainer} from '../MessageContainer';\nimport {ToolCallErrorBoundary} from './ToolResultErrorBoundary';\nimport {ToolInvocation} from 'ai';\nimport {ToolErrorMessage} from './ToolErrorMessage';\n\ntype ToolResultProps = {\n toolInvocation: ToolInvocation;\n additionalData: unknown;\n isCompleted: boolean;\n errorMessage?: string;\n};\n\nexport const ToolResult: React.FC<ToolResultProps> = ({\n toolInvocation,\n additionalData,\n isCompleted,\n errorMessage,\n}) => {\n const {isOpen: showDetails, onToggle: toggleShowDetails} =\n useDisclosure(false);\n\n const {toolName, args, state} = toolInvocation;\n const llmResult = state === 'result' ? toolInvocation.result : null;\n\n // show reason text before tool call complete\n const text = args.reasoning || '';\n\n const ToolComponent = useStoreWithAi((state) =>\n state.ai.findToolComponent(toolName),\n );\n\n // check if args has a property called 'reason'\n const reason = args.reasoning as string;\n\n // check if llmResult is an object and has a success property\n const isSuccess =\n typeof llmResult === 'object' &&\n llmResult !== null &&\n 'success' in llmResult &&\n llmResult.success === true;\n\n return !isCompleted ? (\n <div className=\"text-sm text-gray-500\">{text}</div>\n ) : (\n <MessageContainer\n isSuccess={isSuccess}\n type={toolName}\n content={{\n toolName,\n args,\n llmResult,\n additionalData,\n isCompleted,\n }}\n >\n <div className=\"text-sm text-gray-500\">\n {reason && <span>{reason}</span>}\n </div>\n {ToolComponent && isSuccess && isCompleted && (\n <ToolCallErrorBoundary>\n {typeof ToolComponent === 'function' ? (\n <ToolComponent\n {...(llmResult as Record<string, unknown>)}\n {...(additionalData as Record<string, unknown>)}\n />\n ) : (\n ToolComponent\n )}\n </ToolCallErrorBoundary>\n )}\n {isCompleted && (errorMessage || !isSuccess) && (\n <ToolErrorMessage\n error={errorMessage ?? 'Tool call failed'}\n details={toolInvocation}\n title=\"Tool call error\"\n triggerLabel=\"Tool call failed\"\n editorHeightPx={300}\n />\n )}\n </MessageContainer>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolResultErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/tools/ToolResultErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAEvC,qBAAa,qBAAsB,SAAQ,KAAK,CAAC,SAAS,CACxD;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAC,EAC3C;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAC,CACnC;gBACa,KAAK,EAAE;QAAC,QAAQ,EAAE,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAC;IAK9D,MAAM,CAAC,wBAAwB;;;IAI/B,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAM9B,MAAM;CAYP"}
1
+ {"version":3,"file":"ToolResultErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/tools/ToolResultErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAEvC,qBAAa,qBAAsB,SAAQ,KAAK,CAAC,SAAS,CACxD;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAC,EAC3C;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAC,CACnC;gBACa,KAAK,EAAE;QAAC,QAAQ,EAAE,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAC;IAK9D,MAAM,CAAC,wBAAwB;;;IAI/B,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAM9B,MAAM;CAOP"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ToolErrorMessage } from './ToolErrorMessage';
2
3
  import React from 'react';
3
4
  export class ToolCallErrorBoundary extends React.Component {
4
5
  constructor(props) {
@@ -15,7 +16,7 @@ export class ToolCallErrorBoundary extends React.Component {
15
16
  }
16
17
  render() {
17
18
  if (this.state.hasError) {
18
- return (_jsxs("div", { className: "text-danger text-sm text-red-500", children: ["Failed to render tool component. Please try again or contact support.", _jsx("pre", { children: JSON.stringify(this.state.error, null, 2) })] }));
19
+ return _jsx(ToolErrorMessage, { error: this.state.error });
19
20
  }
20
21
  return this.props.children;
21
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ToolResultErrorBoundary.js","sourceRoot":"","sources":["../../../src/components/tools/ToolResultErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,MAAM,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAGhD;IACC,YAAY,KAAkD;QAC5D,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,wBAAwB;QAC7B,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;IAC1B,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,CACL,eAAK,SAAS,EAAC,kCAAkC,sFAE/C,wBAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,GAAO,IAClD,CACP,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import React, {ReactNode} from 'react';\n\nexport class ToolCallErrorBoundary extends React.Component<\n {children: ReactNode; onError?: () => void},\n {hasError: boolean; error?: Error}\n> {\n constructor(props: {children: ReactNode; onError?: () => void}) {\n super(props);\n this.state = {hasError: false};\n }\n\n static getDerivedStateFromError() {\n return {hasError: true};\n }\n\n componentDidCatch(error: Error) {\n console.error('Tool call component error:', error);\n this.setState({error});\n this.props.onError?.();\n }\n\n render() {\n if (this.state.hasError) {\n return (\n <div className=\"text-danger text-sm text-red-500\">\n Failed to render tool component. Please try again or contact support.\n <pre>{JSON.stringify(this.state.error, null, 2)}</pre>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"]}
1
+ {"version":3,"file":"ToolResultErrorBoundary.js","sourceRoot":"","sources":["../../../src/components/tools/ToolResultErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,MAAM,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAGhD;IACC,YAAY,KAAkD;QAC5D,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,wBAAwB;QAC7B,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;IAC1B,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,KAAC,gBAAgB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import {ToolErrorMessage} from './ToolErrorMessage';\nimport React, {ReactNode} from 'react';\n\nexport class ToolCallErrorBoundary extends React.Component<\n {children: ReactNode; onError?: () => void},\n {hasError: boolean; error?: Error}\n> {\n constructor(props: {children: ReactNode; onError?: () => void}) {\n super(props);\n this.state = {hasError: false};\n }\n\n static getDerivedStateFromError() {\n return {hasError: true};\n }\n\n componentDidCatch(error: Error) {\n console.error('Tool call component error:', error);\n this.setState({error});\n this.props.onError?.();\n }\n\n render() {\n if (this.state.hasError) {\n return <ToolErrorMessage error={this.state.error} />;\n }\n\n return this.props.children;\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -19,4 +19,5 @@ export * from './components/session/SessionActions';
19
19
  export * from './components/session/SessionDropdown';
20
20
  export * from './components/session/SessionTitle';
21
21
  export * from './components/session/SessionType';
22
+ export * from './components/tools/ToolErrorMessage';
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAElD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAElD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC"}
package/dist/index.js CHANGED
@@ -17,4 +17,5 @@ export * from './components/session/SessionActions';
17
17
  export * from './components/session/SessionDropdown';
18
18
  export * from './components/session/SessionTitle';
19
19
  export * from './components/session/SessionType';
20
+ export * from './components/tools/ToolErrorMessage';
20
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAElD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n AiSliceConfig,\n createAiSlice,\n useStoreWithAi,\n createDefaultAiConfig,\n} from './AiSlice';\n\nexport type {AiSliceState} from './AiSlice';\nexport {QueryControls} from './components/QueryControls';\nexport {AnalysisResultsContainer} from './components/AnalysisResultsContainer';\nexport {AnalysisResult} from './components/AnalysisResult';\nexport {useScrollToBottom} from './hooks/useScrollToBottom';\nexport type {AiSliceTool} from './AiSlice';\nexport {QueryToolResult} from './components/tools/QueryToolResult';\nexport {getDefaultInstructions} from './analysis';\n\nexport * from './components/ModelSelector';\nexport * from './components/SessionControls';\nexport * from './components/QueryControls';\nexport * from './components/session/DeleteSessionDialog';\nexport * from './components/session/SessionActions';\nexport * from './components/session/SessionDropdown';\nexport * from './components/session/SessionTitle';\nexport * from './components/session/SessionType';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAElD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n AiSliceConfig,\n createAiSlice,\n useStoreWithAi,\n createDefaultAiConfig,\n} from './AiSlice';\n\nexport type {AiSliceState} from './AiSlice';\nexport {QueryControls} from './components/QueryControls';\nexport {AnalysisResultsContainer} from './components/AnalysisResultsContainer';\nexport {AnalysisResult} from './components/AnalysisResult';\nexport {useScrollToBottom} from './hooks/useScrollToBottom';\nexport type {AiSliceTool} from './AiSlice';\nexport {QueryToolResult} from './components/tools/QueryToolResult';\nexport {getDefaultInstructions} from './analysis';\n\nexport * from './components/ModelSelector';\nexport * from './components/SessionControls';\nexport * from './components/QueryControls';\nexport * from './components/session/DeleteSessionDialog';\nexport * from './components/session/SessionActions';\nexport * from './components/session/SessionDropdown';\nexport * from './components/session/SessionTitle';\nexport * from './components/session/SessionType';\nexport * from './components/tools/ToolErrorMessage';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/ai",
3
- "version": "0.24.21",
3
+ "version": "0.24.22",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -22,13 +22,13 @@
22
22
  "@openassistant/core": "0.5.17",
23
23
  "@openassistant/utils": "0.5.17",
24
24
  "@paralleldrive/cuid2": "^2.2.2",
25
- "@sqlrooms/data-table": "0.24.21",
26
- "@sqlrooms/duckdb": "0.24.21",
27
- "@sqlrooms/monaco-editor": "0.24.21",
28
- "@sqlrooms/room-config": "0.24.21",
29
- "@sqlrooms/room-shell": "0.24.21",
30
- "@sqlrooms/ui": "0.24.21",
31
- "@sqlrooms/utils": "0.24.21",
25
+ "@sqlrooms/data-table": "0.24.22",
26
+ "@sqlrooms/duckdb": "0.24.22",
27
+ "@sqlrooms/monaco-editor": "0.24.22",
28
+ "@sqlrooms/room-config": "0.24.22",
29
+ "@sqlrooms/room-shell": "0.24.22",
30
+ "@sqlrooms/ui": "0.24.22",
31
+ "@sqlrooms/utils": "0.24.22",
32
32
  "ai": "^4.3.19",
33
33
  "immer": "^10.1.1",
34
34
  "lucide-react": "^0.475.0",
@@ -48,5 +48,5 @@
48
48
  "typecheck": "tsc --noEmit",
49
49
  "typedoc": "typedoc"
50
50
  },
51
- "gitHead": "f9ab9f80a5362213c7cb257496c50e305ebd6a81"
51
+ "gitHead": "bc633cde7574270b679cb6c3d9ce9b496a634133"
52
52
  }