@athenaintel/react 0.6.3 → 0.6.6
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/index.cjs +421 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +421 -77
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16389,13 +16389,6 @@ const ThreadListItemPrimitiveRoot = forwardRef((props, ref) => {
|
|
|
16389
16389
|
return jsx(Primitive$1.div, { ...isMain ? { "data-active": "true", "aria-current": "true" } : null, ...props, ref });
|
|
16390
16390
|
});
|
|
16391
16391
|
ThreadListItemPrimitiveRoot.displayName = "ThreadListItemPrimitive.Root";
|
|
16392
|
-
const useThreadListItemArchive = () => {
|
|
16393
|
-
const aui = useAui();
|
|
16394
|
-
return useCallback(() => {
|
|
16395
|
-
aui.threadListItem().archive();
|
|
16396
|
-
}, [aui]);
|
|
16397
|
-
};
|
|
16398
|
-
const ThreadListItemPrimitiveArchive = createActionButton("ThreadListItemPrimitive.Archive", useThreadListItemArchive);
|
|
16399
16392
|
const useThreadListItemTrigger = () => {
|
|
16400
16393
|
const aui = useAui();
|
|
16401
16394
|
return useCallback(() => {
|
|
@@ -51879,7 +51872,7 @@ const HTML_REPLACEMENTS = {
|
|
|
51879
51872
|
function replaceUnsafeChar(ch) {
|
|
51880
51873
|
return HTML_REPLACEMENTS[ch];
|
|
51881
51874
|
}
|
|
51882
|
-
function escapeHtml(str) {
|
|
51875
|
+
function escapeHtml$1(str) {
|
|
51883
51876
|
if (HTML_ESCAPE_TEST_RE.test(str)) {
|
|
51884
51877
|
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
|
|
51885
51878
|
}
|
|
@@ -51976,7 +51969,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
51976
51969
|
__proto__: null,
|
|
51977
51970
|
arrayReplaceAt,
|
|
51978
51971
|
assign: assign$1,
|
|
51979
|
-
escapeHtml,
|
|
51972
|
+
escapeHtml: escapeHtml$1,
|
|
51980
51973
|
escapeRE: escapeRE$1,
|
|
51981
51974
|
fromCodePoint,
|
|
51982
51975
|
has,
|
|
@@ -52157,11 +52150,11 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
52157
52150
|
const default_rules = {};
|
|
52158
52151
|
default_rules.code_inline = function(tokens, idx, options, env, slf) {
|
|
52159
52152
|
const token = tokens[idx];
|
|
52160
|
-
return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
|
|
52153
|
+
return "<code" + slf.renderAttrs(token) + ">" + escapeHtml$1(token.content) + "</code>";
|
|
52161
52154
|
};
|
|
52162
52155
|
default_rules.code_block = function(tokens, idx, options, env, slf) {
|
|
52163
52156
|
const token = tokens[idx];
|
|
52164
|
-
return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml(tokens[idx].content) + "</code></pre>\n";
|
|
52157
|
+
return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml$1(tokens[idx].content) + "</code></pre>\n";
|
|
52165
52158
|
};
|
|
52166
52159
|
default_rules.fence = function(tokens, idx, options, env, slf) {
|
|
52167
52160
|
const token = tokens[idx];
|
|
@@ -52175,9 +52168,9 @@ default_rules.fence = function(tokens, idx, options, env, slf) {
|
|
|
52175
52168
|
}
|
|
52176
52169
|
let highlighted;
|
|
52177
52170
|
if (options.highlight) {
|
|
52178
|
-
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
|
|
52171
|
+
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml$1(token.content);
|
|
52179
52172
|
} else {
|
|
52180
|
-
highlighted = escapeHtml(token.content);
|
|
52173
|
+
highlighted = escapeHtml$1(token.content);
|
|
52181
52174
|
}
|
|
52182
52175
|
if (highlighted.indexOf("<pre") === 0) {
|
|
52183
52176
|
return highlighted + "\n";
|
|
@@ -52212,7 +52205,7 @@ default_rules.softbreak = function(tokens, idx, options) {
|
|
|
52212
52205
|
return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
|
52213
52206
|
};
|
|
52214
52207
|
default_rules.text = function(tokens, idx) {
|
|
52215
|
-
return escapeHtml(tokens[idx].content);
|
|
52208
|
+
return escapeHtml$1(tokens[idx].content);
|
|
52216
52209
|
};
|
|
52217
52210
|
default_rules.html_block = function(tokens, idx) {
|
|
52218
52211
|
return tokens[idx].content;
|
|
@@ -52230,7 +52223,7 @@ Renderer.prototype.renderAttrs = function renderAttrs(token) {
|
|
|
52230
52223
|
}
|
|
52231
52224
|
result = "";
|
|
52232
52225
|
for (i = 0, l = token.attrs.length; i < l; i++) {
|
|
52233
|
-
result += " " + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
|
|
52226
|
+
result += " " + escapeHtml$1(token.attrs[i][0]) + '="' + escapeHtml$1(token.attrs[i][1]) + '"';
|
|
52234
52227
|
}
|
|
52235
52228
|
return result;
|
|
52236
52229
|
};
|
|
@@ -60597,11 +60590,10 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
60597
60590
|
* See the LICENSE file in the root directory of this source tree.
|
|
60598
60591
|
*/
|
|
60599
60592
|
const __iconNode$J = [
|
|
60600
|
-
["
|
|
60601
|
-
["path", { d: "
|
|
60602
|
-
["path", { d: "M10 12h4", key: "a56b0p" }]
|
|
60593
|
+
["path", { d: "M12 5v14", key: "s699le" }],
|
|
60594
|
+
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
60603
60595
|
];
|
|
60604
|
-
const
|
|
60596
|
+
const ArrowDown = createLucideIcon("arrow-down", __iconNode$J);
|
|
60605
60597
|
/**
|
|
60606
60598
|
* @license lucide-react v0.575.0 - ISC
|
|
60607
60599
|
*
|
|
@@ -60609,10 +60601,10 @@ const Archive = createLucideIcon("archive", __iconNode$J);
|
|
|
60609
60601
|
* See the LICENSE file in the root directory of this source tree.
|
|
60610
60602
|
*/
|
|
60611
60603
|
const __iconNode$I = [
|
|
60612
|
-
["path", { d: "
|
|
60613
|
-
["path", { d: "
|
|
60604
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
60605
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
60614
60606
|
];
|
|
60615
|
-
const
|
|
60607
|
+
const ArrowRight = createLucideIcon("arrow-right", __iconNode$I);
|
|
60616
60608
|
/**
|
|
60617
60609
|
* @license lucide-react v0.575.0 - ISC
|
|
60618
60610
|
*
|
|
@@ -62363,14 +62355,21 @@ const EmailSearchToolUIImpl = ({
|
|
|
62363
62355
|
toolName,
|
|
62364
62356
|
badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
|
|
62365
62357
|
error: errorMsg,
|
|
62366
|
-
children: isComplete && emails.length > 0 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxs(
|
|
62367
|
-
|
|
62368
|
-
|
|
62369
|
-
|
|
62370
|
-
|
|
62371
|
-
|
|
62372
|
-
|
|
62373
|
-
|
|
62358
|
+
children: isComplete && emails.length > 0 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxs(
|
|
62359
|
+
"div",
|
|
62360
|
+
{
|
|
62361
|
+
className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"),
|
|
62362
|
+
children: [
|
|
62363
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
62364
|
+
/* @__PURE__ */ jsx("span", { className: "text-[12px] font-medium text-foreground", children: email.subject || "No subject" }),
|
|
62365
|
+
email.date && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: email.date })
|
|
62366
|
+
] }),
|
|
62367
|
+
email.from && /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: email.from }),
|
|
62368
|
+
email.snippet && /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-relaxed text-muted-foreground/80", children: truncate(email.snippet, 150) })
|
|
62369
|
+
]
|
|
62370
|
+
},
|
|
62371
|
+
i
|
|
62372
|
+
)) }) })
|
|
62374
62373
|
}
|
|
62375
62374
|
);
|
|
62376
62375
|
};
|
|
@@ -62538,7 +62537,17 @@ const CreateNotebookToolUI = memo(
|
|
|
62538
62537
|
CreateNotebookToolUI.displayName = "CreateNotebookToolUI";
|
|
62539
62538
|
function parsePythonResult(result) {
|
|
62540
62539
|
const data = normalizeResult(result);
|
|
62541
|
-
if (!data)
|
|
62540
|
+
if (!data)
|
|
62541
|
+
return {
|
|
62542
|
+
stdout: null,
|
|
62543
|
+
stderr: null,
|
|
62544
|
+
value: null,
|
|
62545
|
+
error: null,
|
|
62546
|
+
exception: null,
|
|
62547
|
+
imagePng: null,
|
|
62548
|
+
plotlyJson: null,
|
|
62549
|
+
createdAssets: []
|
|
62550
|
+
};
|
|
62542
62551
|
const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
|
|
62543
62552
|
const stdout = inner.stdout ?? null;
|
|
62544
62553
|
const stderr = inner.stderr ?? null;
|
|
@@ -62554,25 +62563,292 @@ function parsePythonResult(result) {
|
|
|
62554
62563
|
};
|
|
62555
62564
|
}
|
|
62556
62565
|
let imagePng = null;
|
|
62566
|
+
let plotlyJson = null;
|
|
62557
62567
|
if (inner.data && typeof inner.data === "object") {
|
|
62558
62568
|
imagePng = inner.data.png ?? null;
|
|
62559
62569
|
}
|
|
62560
|
-
if (
|
|
62570
|
+
if (Array.isArray(data.outputs)) {
|
|
62561
62571
|
for (const output of data.outputs) {
|
|
62562
62572
|
if (output && typeof output === "object") {
|
|
62563
62573
|
const mimeBundle = output.mime_bundle;
|
|
62564
62574
|
if (mimeBundle && typeof mimeBundle === "object") {
|
|
62565
|
-
const
|
|
62566
|
-
if (typeof
|
|
62567
|
-
|
|
62568
|
-
|
|
62575
|
+
const mb = mimeBundle;
|
|
62576
|
+
if (!plotlyJson && typeof mb["plotly+json"] === "string") {
|
|
62577
|
+
plotlyJson = mb["plotly+json"];
|
|
62578
|
+
}
|
|
62579
|
+
if (!imagePng && typeof mb["image/png"] === "string") {
|
|
62580
|
+
imagePng = mb["image/png"];
|
|
62569
62581
|
}
|
|
62570
62582
|
}
|
|
62571
62583
|
}
|
|
62572
62584
|
}
|
|
62573
62585
|
}
|
|
62574
62586
|
const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
|
|
62575
|
-
return { stdout, stderr, value, error: error2, exception, imagePng, createdAssets };
|
|
62587
|
+
return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
|
|
62588
|
+
}
|
|
62589
|
+
function getPlotly() {
|
|
62590
|
+
return window.Plotly;
|
|
62591
|
+
}
|
|
62592
|
+
let plotlyLoadPromise = null;
|
|
62593
|
+
function ensurePlotlyLoaded() {
|
|
62594
|
+
if (getPlotly()) return Promise.resolve();
|
|
62595
|
+
if (plotlyLoadPromise) return plotlyLoadPromise;
|
|
62596
|
+
plotlyLoadPromise = new Promise((resolve, reject) => {
|
|
62597
|
+
const script = document.createElement("script");
|
|
62598
|
+
script.src = "https://cdn.plot.ly/plotly-2.35.2.min.js";
|
|
62599
|
+
script.crossOrigin = "anonymous";
|
|
62600
|
+
script.onload = () => resolve();
|
|
62601
|
+
script.onerror = () => {
|
|
62602
|
+
plotlyLoadPromise = null;
|
|
62603
|
+
document.head.removeChild(script);
|
|
62604
|
+
reject(new Error("Failed to load Plotly"));
|
|
62605
|
+
};
|
|
62606
|
+
document.head.appendChild(script);
|
|
62607
|
+
});
|
|
62608
|
+
return plotlyLoadPromise;
|
|
62609
|
+
}
|
|
62610
|
+
const PlotlyChart = ({ json, height = 500 }) => {
|
|
62611
|
+
const chartRef = useRef(null);
|
|
62612
|
+
const [error2, setError] = useState(null);
|
|
62613
|
+
useEffect(() => {
|
|
62614
|
+
let cancelled = false;
|
|
62615
|
+
ensurePlotlyLoaded().then(() => {
|
|
62616
|
+
if (cancelled || !chartRef.current) return;
|
|
62617
|
+
const parsed = JSON.parse(json);
|
|
62618
|
+
const Plotly = getPlotly();
|
|
62619
|
+
if (!Plotly) return;
|
|
62620
|
+
Plotly.newPlot(
|
|
62621
|
+
chartRef.current,
|
|
62622
|
+
parsed.data || [],
|
|
62623
|
+
{ ...parsed.layout || {}, autosize: true, width: void 0, height: void 0 },
|
|
62624
|
+
{ responsive: true, displayModeBar: true, displaylogo: false, showLink: false }
|
|
62625
|
+
);
|
|
62626
|
+
}).catch((err) => {
|
|
62627
|
+
if (!cancelled) setError(err.message);
|
|
62628
|
+
});
|
|
62629
|
+
return () => {
|
|
62630
|
+
cancelled = true;
|
|
62631
|
+
if (chartRef.current) {
|
|
62632
|
+
const Plotly = getPlotly();
|
|
62633
|
+
if (Plotly) Plotly.purge(chartRef.current);
|
|
62634
|
+
}
|
|
62635
|
+
};
|
|
62636
|
+
}, [json]);
|
|
62637
|
+
if (error2) {
|
|
62638
|
+
return /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error2 });
|
|
62639
|
+
}
|
|
62640
|
+
return /* @__PURE__ */ jsx("div", { ref: chartRef, className: "w-full overflow-hidden", style: { height } });
|
|
62641
|
+
};
|
|
62642
|
+
const PlotlyChartSection = ({ json }) => {
|
|
62643
|
+
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
62644
|
+
return /* @__PURE__ */ jsxs(Fragment$2, { children: [
|
|
62645
|
+
/* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62646
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
62647
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
62648
|
+
/* @__PURE__ */ jsx(ChartColumn, { className: "size-3 text-muted-foreground" }),
|
|
62649
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Interactive chart" })
|
|
62650
|
+
] }),
|
|
62651
|
+
/* @__PURE__ */ jsx(
|
|
62652
|
+
"button",
|
|
62653
|
+
{
|
|
62654
|
+
type: "button",
|
|
62655
|
+
onClick: () => setIsFullscreen(true),
|
|
62656
|
+
className: "flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
|
|
62657
|
+
title: "View full screen",
|
|
62658
|
+
children: /* @__PURE__ */ jsx(Maximize2, { className: "size-3.5" })
|
|
62659
|
+
}
|
|
62660
|
+
)
|
|
62661
|
+
] }),
|
|
62662
|
+
/* @__PURE__ */ jsx(PlotlyChart, { json })
|
|
62663
|
+
] }),
|
|
62664
|
+
isFullscreen && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[9999] flex flex-col bg-background", children: [
|
|
62665
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-3 border-b border-border", children: [
|
|
62666
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
62667
|
+
/* @__PURE__ */ jsx(ChartColumn, { className: "size-4 text-muted-foreground" }),
|
|
62668
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Interactive chart" })
|
|
62669
|
+
] }),
|
|
62670
|
+
/* @__PURE__ */ jsx(
|
|
62671
|
+
"button",
|
|
62672
|
+
{
|
|
62673
|
+
type: "button",
|
|
62674
|
+
onClick: () => setIsFullscreen(false),
|
|
62675
|
+
className: "flex items-center justify-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
|
|
62676
|
+
title: "Close full screen",
|
|
62677
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-5" })
|
|
62678
|
+
}
|
|
62679
|
+
)
|
|
62680
|
+
] }),
|
|
62681
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 p-4", children: /* @__PURE__ */ jsx(PlotlyChart, { json, height: "100%" }) })
|
|
62682
|
+
] })
|
|
62683
|
+
] });
|
|
62684
|
+
};
|
|
62685
|
+
const SyntaxHighlightedCode = memo(({ code: code2 }) => {
|
|
62686
|
+
const highlighted = useMemo(() => highlightPython(code2), [code2]);
|
|
62687
|
+
return /* @__PURE__ */ jsx(
|
|
62688
|
+
"pre",
|
|
62689
|
+
{
|
|
62690
|
+
className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed font-mono",
|
|
62691
|
+
dangerouslySetInnerHTML: { __html: highlighted }
|
|
62692
|
+
}
|
|
62693
|
+
);
|
|
62694
|
+
});
|
|
62695
|
+
SyntaxHighlightedCode.displayName = "SyntaxHighlightedCode";
|
|
62696
|
+
const PY_KEYWORDS = /* @__PURE__ */ new Set([
|
|
62697
|
+
"False",
|
|
62698
|
+
"None",
|
|
62699
|
+
"True",
|
|
62700
|
+
"and",
|
|
62701
|
+
"as",
|
|
62702
|
+
"assert",
|
|
62703
|
+
"async",
|
|
62704
|
+
"await",
|
|
62705
|
+
"break",
|
|
62706
|
+
"class",
|
|
62707
|
+
"continue",
|
|
62708
|
+
"def",
|
|
62709
|
+
"del",
|
|
62710
|
+
"elif",
|
|
62711
|
+
"else",
|
|
62712
|
+
"except",
|
|
62713
|
+
"finally",
|
|
62714
|
+
"for",
|
|
62715
|
+
"from",
|
|
62716
|
+
"global",
|
|
62717
|
+
"if",
|
|
62718
|
+
"import",
|
|
62719
|
+
"in",
|
|
62720
|
+
"is",
|
|
62721
|
+
"lambda",
|
|
62722
|
+
"nonlocal",
|
|
62723
|
+
"not",
|
|
62724
|
+
"or",
|
|
62725
|
+
"pass",
|
|
62726
|
+
"raise",
|
|
62727
|
+
"return",
|
|
62728
|
+
"try",
|
|
62729
|
+
"while",
|
|
62730
|
+
"with",
|
|
62731
|
+
"yield"
|
|
62732
|
+
]);
|
|
62733
|
+
const PY_BUILTINS = /* @__PURE__ */ new Set([
|
|
62734
|
+
"print",
|
|
62735
|
+
"len",
|
|
62736
|
+
"range",
|
|
62737
|
+
"int",
|
|
62738
|
+
"str",
|
|
62739
|
+
"float",
|
|
62740
|
+
"list",
|
|
62741
|
+
"dict",
|
|
62742
|
+
"set",
|
|
62743
|
+
"tuple",
|
|
62744
|
+
"bool",
|
|
62745
|
+
"type",
|
|
62746
|
+
"isinstance",
|
|
62747
|
+
"enumerate",
|
|
62748
|
+
"zip",
|
|
62749
|
+
"map",
|
|
62750
|
+
"filter",
|
|
62751
|
+
"sorted",
|
|
62752
|
+
"reversed",
|
|
62753
|
+
"sum",
|
|
62754
|
+
"min",
|
|
62755
|
+
"max",
|
|
62756
|
+
"abs",
|
|
62757
|
+
"round",
|
|
62758
|
+
"open",
|
|
62759
|
+
"super",
|
|
62760
|
+
"property",
|
|
62761
|
+
"staticmethod",
|
|
62762
|
+
"classmethod",
|
|
62763
|
+
"display",
|
|
62764
|
+
"input",
|
|
62765
|
+
"format",
|
|
62766
|
+
"getattr",
|
|
62767
|
+
"setattr",
|
|
62768
|
+
"hasattr",
|
|
62769
|
+
"vars",
|
|
62770
|
+
"dir"
|
|
62771
|
+
]);
|
|
62772
|
+
function escapeHtml(s) {
|
|
62773
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
62774
|
+
}
|
|
62775
|
+
function highlightPython(code2) {
|
|
62776
|
+
const lines = code2.split("\n");
|
|
62777
|
+
return lines.map((line) => {
|
|
62778
|
+
const commentMatch = line.match(/^(\s*)(#.*)$/);
|
|
62779
|
+
if (commentMatch) {
|
|
62780
|
+
return `${escapeHtml(commentMatch[1])}<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(commentMatch[2])}</span>`;
|
|
62781
|
+
}
|
|
62782
|
+
let result = "";
|
|
62783
|
+
let i = 0;
|
|
62784
|
+
while (i < line.length) {
|
|
62785
|
+
if (line[i] === "#") {
|
|
62786
|
+
result += `<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(line.slice(i))}</span>`;
|
|
62787
|
+
break;
|
|
62788
|
+
}
|
|
62789
|
+
if (line.slice(i, i + 3) === '"""' || line.slice(i, i + 3) === "'''") {
|
|
62790
|
+
const quote = line.slice(i, i + 3);
|
|
62791
|
+
const end = line.indexOf(quote, i + 3);
|
|
62792
|
+
const str = end >= 0 ? line.slice(i, end + 3) : line.slice(i);
|
|
62793
|
+
result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
|
|
62794
|
+
i += str.length;
|
|
62795
|
+
continue;
|
|
62796
|
+
}
|
|
62797
|
+
if (line[i] === '"' || line[i] === "'") {
|
|
62798
|
+
const q = line[i];
|
|
62799
|
+
let j = i + 1;
|
|
62800
|
+
while (j < line.length && line[j] !== q) {
|
|
62801
|
+
if (line[j] === "\\") j++;
|
|
62802
|
+
j++;
|
|
62803
|
+
}
|
|
62804
|
+
const str = line.slice(i, j + 1);
|
|
62805
|
+
result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
|
|
62806
|
+
i = j + 1;
|
|
62807
|
+
continue;
|
|
62808
|
+
}
|
|
62809
|
+
if (/\d/.test(line[i]) && (i === 0 || /[\s(,=[\-+*/:!<>]/.test(line[i - 1]))) {
|
|
62810
|
+
const numMatch = line.slice(i).match(/^(\d+\.?\d*(?:[eE][+-]?\d+)?)/);
|
|
62811
|
+
if (numMatch) {
|
|
62812
|
+
result += `<span style="color:var(--aui-syn-number, #b5cea8)">${escapeHtml(numMatch[1])}</span>`;
|
|
62813
|
+
i += numMatch[1].length;
|
|
62814
|
+
continue;
|
|
62815
|
+
}
|
|
62816
|
+
}
|
|
62817
|
+
if (/[a-zA-Z_]/.test(line[i])) {
|
|
62818
|
+
const wordMatch = line.slice(i).match(/^[a-zA-Z_]\w*/);
|
|
62819
|
+
if (wordMatch) {
|
|
62820
|
+
const word = wordMatch[0];
|
|
62821
|
+
if (PY_KEYWORDS.has(word)) {
|
|
62822
|
+
result += `<span style="color:var(--aui-syn-keyword, #569cd6)">${escapeHtml(word)}</span>`;
|
|
62823
|
+
} else if (PY_BUILTINS.has(word)) {
|
|
62824
|
+
result += `<span style="color:var(--aui-syn-builtin, #dcdcaa)">${escapeHtml(word)}</span>`;
|
|
62825
|
+
} else if (line[i + word.length] === "(") {
|
|
62826
|
+
result += `<span style="color:var(--aui-syn-func, #dcdcaa)">${escapeHtml(word)}</span>`;
|
|
62827
|
+
} else {
|
|
62828
|
+
result += escapeHtml(word);
|
|
62829
|
+
}
|
|
62830
|
+
i += word.length;
|
|
62831
|
+
continue;
|
|
62832
|
+
}
|
|
62833
|
+
}
|
|
62834
|
+
if (line[i] === "@" && (i === 0 || /\s/.test(line[i - 1]))) {
|
|
62835
|
+
const decMatch = line.slice(i).match(/^@[\w.]+/);
|
|
62836
|
+
if (decMatch) {
|
|
62837
|
+
result += `<span style="color:var(--aui-syn-decorator, #569cd6)">${escapeHtml(decMatch[0])}</span>`;
|
|
62838
|
+
i += decMatch[0].length;
|
|
62839
|
+
continue;
|
|
62840
|
+
}
|
|
62841
|
+
}
|
|
62842
|
+
if (/[+\-*/%=<>!&|^~]/.test(line[i])) {
|
|
62843
|
+
result += `<span style="color:var(--aui-syn-op, #d4d4d4)">${escapeHtml(line[i])}</span>`;
|
|
62844
|
+
i++;
|
|
62845
|
+
continue;
|
|
62846
|
+
}
|
|
62847
|
+
result += escapeHtml(line[i]);
|
|
62848
|
+
i++;
|
|
62849
|
+
}
|
|
62850
|
+
return result;
|
|
62851
|
+
}).join("\n");
|
|
62576
62852
|
}
|
|
62577
62853
|
const RunPythonCodeToolUIImpl = ({
|
|
62578
62854
|
toolName,
|
|
@@ -62588,11 +62864,15 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62588
62864
|
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
62589
62865
|
const isComplete = (status == null ? void 0 : status.type) === "complete";
|
|
62590
62866
|
const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
|
|
62591
|
-
const parsed = useMemo(
|
|
62867
|
+
const parsed = useMemo(
|
|
62868
|
+
() => isComplete ? parsePythonResult(result) : null,
|
|
62869
|
+
[result, isComplete]
|
|
62870
|
+
);
|
|
62592
62871
|
const openAsset = useAssetPanelStore((s) => s.openAsset);
|
|
62593
62872
|
const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
|
|
62594
62873
|
const hasError = parsed && (parsed.error || parsed.exception);
|
|
62595
62874
|
const hasImage = parsed == null ? void 0 : parsed.imagePng;
|
|
62875
|
+
const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
|
|
62596
62876
|
return /* @__PURE__ */ jsxs(
|
|
62597
62877
|
ToolCard,
|
|
62598
62878
|
{
|
|
@@ -62602,7 +62882,7 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62602
62882
|
toolName,
|
|
62603
62883
|
error: errorMsg,
|
|
62604
62884
|
children: [
|
|
62605
|
-
code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(
|
|
62885
|
+
code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(SyntaxHighlightedCode, { code: code2 }) }),
|
|
62606
62886
|
isComplete && hasOutput && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62607
62887
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
|
|
62608
62888
|
/* @__PURE__ */ jsx(Terminal, { className: "size-3 text-muted-foreground" }),
|
|
@@ -62617,7 +62897,8 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62617
62897
|
] }),
|
|
62618
62898
|
/* @__PURE__ */ jsx("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md bg-destructive/5 p-2 text-[11px] leading-relaxed font-mono text-destructive/80", children: ((_a2 = parsed.exception) == null ? void 0 : _a2.traceback) ?? parsed.error })
|
|
62619
62899
|
] }),
|
|
62620
|
-
isComplete &&
|
|
62900
|
+
isComplete && hasPlotly && /* @__PURE__ */ jsx(PlotlyChartSection, { json: parsed.plotlyJson }),
|
|
62901
|
+
isComplete && hasImage && !hasPlotly && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62621
62902
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
|
|
62622
62903
|
/* @__PURE__ */ jsx(Image, { className: "size-3 text-muted-foreground" }),
|
|
62623
62904
|
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Generated image" })
|
|
@@ -62848,13 +63129,63 @@ const TooltipIconButton = forwardRef(
|
|
|
62848
63129
|
);
|
|
62849
63130
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
62850
63131
|
const EMPTY_MENTION_TOOLS = [];
|
|
63132
|
+
const DEFAULT_SUGGESTIONS = [
|
|
63133
|
+
{
|
|
63134
|
+
icon: Search,
|
|
63135
|
+
title: "Research a topic and draft a report",
|
|
63136
|
+
prompt: "Search the web for the latest developments in enterprise AI adoption, then create a document summarizing the key trends, market data, and strategic implications."
|
|
63137
|
+
},
|
|
63138
|
+
{
|
|
63139
|
+
icon: ChartColumn,
|
|
63140
|
+
title: "Analyze data and visualize insights",
|
|
63141
|
+
prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
|
|
63142
|
+
},
|
|
63143
|
+
{
|
|
63144
|
+
icon: Presentation,
|
|
63145
|
+
title: "Build a presentation from scratch",
|
|
63146
|
+
prompt: "Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps."
|
|
63147
|
+
},
|
|
63148
|
+
{
|
|
63149
|
+
icon: FileText,
|
|
63150
|
+
title: "Set up a structured spreadsheet",
|
|
63151
|
+
prompt: "Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage."
|
|
63152
|
+
}
|
|
63153
|
+
];
|
|
63154
|
+
const SuggestionCard = ({
|
|
63155
|
+
suggestion,
|
|
63156
|
+
index: index2
|
|
63157
|
+
}) => {
|
|
63158
|
+
const aui = useAui();
|
|
63159
|
+
const Icon2 = suggestion.icon;
|
|
63160
|
+
const handleClick2 = useCallback(() => {
|
|
63161
|
+
aui.thread().append({
|
|
63162
|
+
role: "user",
|
|
63163
|
+
content: [{ type: "text", text: suggestion.prompt }]
|
|
63164
|
+
});
|
|
63165
|
+
}, [aui, suggestion.prompt]);
|
|
63166
|
+
return /* @__PURE__ */ jsxs(
|
|
63167
|
+
"button",
|
|
63168
|
+
{
|
|
63169
|
+
type: "button",
|
|
63170
|
+
onClick: handleClick2,
|
|
63171
|
+
className: `fade-in slide-in-from-bottom-2 animate-in fill-mode-both group flex items-start gap-3 rounded-xl border border-border/60 bg-background p-3.5 text-left shadow-sm transition-all duration-150 hover:border-border hover:bg-muted/40 hover:shadow-md`,
|
|
63172
|
+
style: { animationDelay: `${100 + index2 * 75}ms` },
|
|
63173
|
+
children: [
|
|
63174
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary", children: /* @__PURE__ */ jsx(Icon2, { className: "size-4" }) }),
|
|
63175
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("span", { className: "text-[13px] font-medium leading-snug text-foreground", children: suggestion.title }) }),
|
|
63176
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground" })
|
|
63177
|
+
]
|
|
63178
|
+
}
|
|
63179
|
+
);
|
|
63180
|
+
};
|
|
62851
63181
|
const AthenaChat = ({
|
|
62852
63182
|
className,
|
|
62853
63183
|
welcomeMessage = "Hello there!",
|
|
62854
|
-
welcomeSubtext = "
|
|
63184
|
+
welcomeSubtext = "What can I help you with?",
|
|
62855
63185
|
maxWidth = "44rem",
|
|
62856
63186
|
toolUIs,
|
|
62857
|
-
mentionTools
|
|
63187
|
+
mentionTools,
|
|
63188
|
+
welcomeSuggestions = DEFAULT_SUGGESTIONS
|
|
62858
63189
|
}) => {
|
|
62859
63190
|
const tools = mentionTools ?? EMPTY_MENTION_TOOLS;
|
|
62860
63191
|
const mergedToolUIs = useMemo(() => ({
|
|
@@ -62867,43 +63198,59 @@ const AthenaChat = ({
|
|
|
62867
63198
|
() => () => /* @__PURE__ */ jsx(AssistantMessage, { toolUIs: mergedToolUIs }),
|
|
62868
63199
|
[mergedToolUIs]
|
|
62869
63200
|
);
|
|
62870
|
-
return /* @__PURE__ */
|
|
63201
|
+
return /* @__PURE__ */ jsxs(
|
|
62871
63202
|
ThreadPrimitiveRoot,
|
|
62872
63203
|
{
|
|
62873
63204
|
className: `aui-root aui-thread-root @container flex h-full flex-col bg-background ${className ?? ""}`,
|
|
62874
63205
|
style: { ["--thread-max-width"]: maxWidth, position: "relative" },
|
|
62875
|
-
children:
|
|
62876
|
-
|
|
62877
|
-
|
|
62878
|
-
|
|
62879
|
-
|
|
62880
|
-
|
|
62881
|
-
|
|
62882
|
-
|
|
62883
|
-
/* @__PURE__ */ jsx("
|
|
62884
|
-
|
|
62885
|
-
|
|
62886
|
-
|
|
62887
|
-
|
|
62888
|
-
|
|
62889
|
-
|
|
62890
|
-
|
|
63206
|
+
children: [
|
|
63207
|
+
/* @__PURE__ */ jsx(ThreadLoadingOverlay, {}),
|
|
63208
|
+
/* @__PURE__ */ jsxs(
|
|
63209
|
+
ThreadPrimitiveViewport,
|
|
63210
|
+
{
|
|
63211
|
+
turnAnchor: "top",
|
|
63212
|
+
className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
|
|
63213
|
+
children: [
|
|
63214
|
+
/* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
|
|
63215
|
+
/* @__PURE__ */ jsx("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200", children: welcomeMessage }),
|
|
63216
|
+
welcomeSubtext && /* @__PURE__ */ jsx("p", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-lg delay-75 duration-200", children: welcomeSubtext }),
|
|
63217
|
+
welcomeSuggestions.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2", children: welcomeSuggestions.map((s, i) => /* @__PURE__ */ jsx(SuggestionCard, { suggestion: s, index: i }, s.title)) })
|
|
63218
|
+
] }) }) }) }),
|
|
63219
|
+
/* @__PURE__ */ jsx(
|
|
63220
|
+
ThreadPrimitiveMessages,
|
|
63221
|
+
{
|
|
63222
|
+
components: {
|
|
63223
|
+
UserMessage,
|
|
63224
|
+
AssistantMessage: AssistantMessageComponent
|
|
63225
|
+
}
|
|
62891
63226
|
}
|
|
62892
|
-
|
|
62893
|
-
|
|
62894
|
-
|
|
62895
|
-
|
|
62896
|
-
|
|
62897
|
-
|
|
62898
|
-
|
|
63227
|
+
),
|
|
63228
|
+
/* @__PURE__ */ jsxs(ThreadPrimitiveViewportFooter, { className: "aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6", children: [
|
|
63229
|
+
/* @__PURE__ */ jsx(ThreadScrollToBottom, {}),
|
|
63230
|
+
/* @__PURE__ */ jsxs(ComposerPrimitiveRoot, { className: "aui-composer-root relative flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20", children: [
|
|
63231
|
+
/* @__PURE__ */ jsx(TiptapComposer, { tools }),
|
|
63232
|
+
/* @__PURE__ */ jsx(ComposerAction, {})
|
|
63233
|
+
] })
|
|
62899
63234
|
] })
|
|
62900
|
-
]
|
|
62901
|
-
|
|
62902
|
-
|
|
62903
|
-
|
|
63235
|
+
]
|
|
63236
|
+
}
|
|
63237
|
+
)
|
|
63238
|
+
]
|
|
62904
63239
|
}
|
|
62905
63240
|
);
|
|
62906
63241
|
};
|
|
63242
|
+
const ThreadLoadingOverlay = () => {
|
|
63243
|
+
const remoteId = useAthenaThreadId();
|
|
63244
|
+
const [timedOut, setTimedOut] = useState(false);
|
|
63245
|
+
useEffect(() => {
|
|
63246
|
+
if (!remoteId) return;
|
|
63247
|
+
setTimedOut(false);
|
|
63248
|
+
const timer = setTimeout(() => setTimedOut(true), 15e3);
|
|
63249
|
+
return () => clearTimeout(timer);
|
|
63250
|
+
}, [remoteId]);
|
|
63251
|
+
if (!remoteId || timedOut) return null;
|
|
63252
|
+
return /* @__PURE__ */ jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
|
|
63253
|
+
};
|
|
62907
63254
|
const ThreadScrollToBottom = () => /* @__PURE__ */ jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
62908
63255
|
TooltipIconButton,
|
|
62909
63256
|
{
|
|
@@ -63340,13 +63687,10 @@ function ThreadList({ className }) {
|
|
|
63340
63687
|
] });
|
|
63341
63688
|
}
|
|
63342
63689
|
function ThreadListItem() {
|
|
63343
|
-
return /* @__PURE__ */
|
|
63344
|
-
/* @__PURE__ */
|
|
63345
|
-
|
|
63346
|
-
|
|
63347
|
-
] }),
|
|
63348
|
-
/* @__PURE__ */ jsx(ThreadListItemPrimitiveArchive, { className: "hidden size-5 items-center justify-center rounded text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground group-hover:flex", children: /* @__PURE__ */ jsx(Archive, { className: "size-3" }) })
|
|
63349
|
-
] });
|
|
63690
|
+
return /* @__PURE__ */ jsx(ThreadListItemPrimitiveRoot, { className: "group", children: /* @__PURE__ */ jsxs(ThreadListItemPrimitiveTrigger, { className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors cursor-pointer text-muted-foreground hover:bg-muted/30 hover:text-foreground data-[active]:bg-muted/50 data-[active]:text-foreground", children: [
|
|
63691
|
+
/* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
|
|
63692
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: /* @__PURE__ */ jsx(ThreadListItemPrimitiveTitle, { fallback: "Untitled" }) })
|
|
63693
|
+
] }) });
|
|
63350
63694
|
}
|
|
63351
63695
|
function useAppendToComposer() {
|
|
63352
63696
|
const aui = useAui();
|