@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.cjs
CHANGED
|
@@ -16407,13 +16407,6 @@ const ThreadListItemPrimitiveRoot = React.forwardRef((props, ref) => {
|
|
|
16407
16407
|
return jsxRuntime.jsx(Primitive$1.div, { ...isMain ? { "data-active": "true", "aria-current": "true" } : null, ...props, ref });
|
|
16408
16408
|
});
|
|
16409
16409
|
ThreadListItemPrimitiveRoot.displayName = "ThreadListItemPrimitive.Root";
|
|
16410
|
-
const useThreadListItemArchive = () => {
|
|
16411
|
-
const aui = useAui();
|
|
16412
|
-
return React.useCallback(() => {
|
|
16413
|
-
aui.threadListItem().archive();
|
|
16414
|
-
}, [aui]);
|
|
16415
|
-
};
|
|
16416
|
-
const ThreadListItemPrimitiveArchive = createActionButton("ThreadListItemPrimitive.Archive", useThreadListItemArchive);
|
|
16417
16410
|
const useThreadListItemTrigger = () => {
|
|
16418
16411
|
const aui = useAui();
|
|
16419
16412
|
return React.useCallback(() => {
|
|
@@ -51897,7 +51890,7 @@ const HTML_REPLACEMENTS = {
|
|
|
51897
51890
|
function replaceUnsafeChar(ch) {
|
|
51898
51891
|
return HTML_REPLACEMENTS[ch];
|
|
51899
51892
|
}
|
|
51900
|
-
function escapeHtml(str) {
|
|
51893
|
+
function escapeHtml$1(str) {
|
|
51901
51894
|
if (HTML_ESCAPE_TEST_RE.test(str)) {
|
|
51902
51895
|
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
|
|
51903
51896
|
}
|
|
@@ -51994,7 +51987,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
51994
51987
|
__proto__: null,
|
|
51995
51988
|
arrayReplaceAt,
|
|
51996
51989
|
assign: assign$1,
|
|
51997
|
-
escapeHtml,
|
|
51990
|
+
escapeHtml: escapeHtml$1,
|
|
51998
51991
|
escapeRE: escapeRE$1,
|
|
51999
51992
|
fromCodePoint,
|
|
52000
51993
|
has,
|
|
@@ -52175,11 +52168,11 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
52175
52168
|
const default_rules = {};
|
|
52176
52169
|
default_rules.code_inline = function(tokens, idx, options, env, slf) {
|
|
52177
52170
|
const token = tokens[idx];
|
|
52178
|
-
return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
|
|
52171
|
+
return "<code" + slf.renderAttrs(token) + ">" + escapeHtml$1(token.content) + "</code>";
|
|
52179
52172
|
};
|
|
52180
52173
|
default_rules.code_block = function(tokens, idx, options, env, slf) {
|
|
52181
52174
|
const token = tokens[idx];
|
|
52182
|
-
return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml(tokens[idx].content) + "</code></pre>\n";
|
|
52175
|
+
return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml$1(tokens[idx].content) + "</code></pre>\n";
|
|
52183
52176
|
};
|
|
52184
52177
|
default_rules.fence = function(tokens, idx, options, env, slf) {
|
|
52185
52178
|
const token = tokens[idx];
|
|
@@ -52193,9 +52186,9 @@ default_rules.fence = function(tokens, idx, options, env, slf) {
|
|
|
52193
52186
|
}
|
|
52194
52187
|
let highlighted;
|
|
52195
52188
|
if (options.highlight) {
|
|
52196
|
-
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
|
|
52189
|
+
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml$1(token.content);
|
|
52197
52190
|
} else {
|
|
52198
|
-
highlighted = escapeHtml(token.content);
|
|
52191
|
+
highlighted = escapeHtml$1(token.content);
|
|
52199
52192
|
}
|
|
52200
52193
|
if (highlighted.indexOf("<pre") === 0) {
|
|
52201
52194
|
return highlighted + "\n";
|
|
@@ -52230,7 +52223,7 @@ default_rules.softbreak = function(tokens, idx, options) {
|
|
|
52230
52223
|
return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
|
52231
52224
|
};
|
|
52232
52225
|
default_rules.text = function(tokens, idx) {
|
|
52233
|
-
return escapeHtml(tokens[idx].content);
|
|
52226
|
+
return escapeHtml$1(tokens[idx].content);
|
|
52234
52227
|
};
|
|
52235
52228
|
default_rules.html_block = function(tokens, idx) {
|
|
52236
52229
|
return tokens[idx].content;
|
|
@@ -52248,7 +52241,7 @@ Renderer.prototype.renderAttrs = function renderAttrs(token) {
|
|
|
52248
52241
|
}
|
|
52249
52242
|
result = "";
|
|
52250
52243
|
for (i = 0, l = token.attrs.length; i < l; i++) {
|
|
52251
|
-
result += " " + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
|
|
52244
|
+
result += " " + escapeHtml$1(token.attrs[i][0]) + '="' + escapeHtml$1(token.attrs[i][1]) + '"';
|
|
52252
52245
|
}
|
|
52253
52246
|
return result;
|
|
52254
52247
|
};
|
|
@@ -60615,11 +60608,10 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
60615
60608
|
* See the LICENSE file in the root directory of this source tree.
|
|
60616
60609
|
*/
|
|
60617
60610
|
const __iconNode$J = [
|
|
60618
|
-
["
|
|
60619
|
-
["path", { d: "
|
|
60620
|
-
["path", { d: "M10 12h4", key: "a56b0p" }]
|
|
60611
|
+
["path", { d: "M12 5v14", key: "s699le" }],
|
|
60612
|
+
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
60621
60613
|
];
|
|
60622
|
-
const
|
|
60614
|
+
const ArrowDown = createLucideIcon("arrow-down", __iconNode$J);
|
|
60623
60615
|
/**
|
|
60624
60616
|
* @license lucide-react v0.575.0 - ISC
|
|
60625
60617
|
*
|
|
@@ -60627,10 +60619,10 @@ const Archive = createLucideIcon("archive", __iconNode$J);
|
|
|
60627
60619
|
* See the LICENSE file in the root directory of this source tree.
|
|
60628
60620
|
*/
|
|
60629
60621
|
const __iconNode$I = [
|
|
60630
|
-
["path", { d: "
|
|
60631
|
-
["path", { d: "
|
|
60622
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
60623
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
60632
60624
|
];
|
|
60633
|
-
const
|
|
60625
|
+
const ArrowRight = createLucideIcon("arrow-right", __iconNode$I);
|
|
60634
60626
|
/**
|
|
60635
60627
|
* @license lucide-react v0.575.0 - ISC
|
|
60636
60628
|
*
|
|
@@ -62381,14 +62373,21 @@ const EmailSearchToolUIImpl = ({
|
|
|
62381
62373
|
toolName,
|
|
62382
62374
|
badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
|
|
62383
62375
|
error: errorMsg,
|
|
62384
|
-
children: isComplete && emails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62385
|
-
|
|
62386
|
-
|
|
62387
|
-
|
|
62388
|
-
|
|
62389
|
-
|
|
62390
|
-
|
|
62391
|
-
|
|
62376
|
+
children: isComplete && emails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62377
|
+
"div",
|
|
62378
|
+
{
|
|
62379
|
+
className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"),
|
|
62380
|
+
children: [
|
|
62381
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
62382
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[12px] font-medium text-foreground", children: email.subject || "No subject" }),
|
|
62383
|
+
email.date && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: email.date })
|
|
62384
|
+
] }),
|
|
62385
|
+
email.from && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-muted-foreground", children: email.from }),
|
|
62386
|
+
email.snippet && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-relaxed text-muted-foreground/80", children: truncate(email.snippet, 150) })
|
|
62387
|
+
]
|
|
62388
|
+
},
|
|
62389
|
+
i
|
|
62390
|
+
)) }) })
|
|
62392
62391
|
}
|
|
62393
62392
|
);
|
|
62394
62393
|
};
|
|
@@ -62556,7 +62555,17 @@ const CreateNotebookToolUI = React.memo(
|
|
|
62556
62555
|
CreateNotebookToolUI.displayName = "CreateNotebookToolUI";
|
|
62557
62556
|
function parsePythonResult(result) {
|
|
62558
62557
|
const data = normalizeResult(result);
|
|
62559
|
-
if (!data)
|
|
62558
|
+
if (!data)
|
|
62559
|
+
return {
|
|
62560
|
+
stdout: null,
|
|
62561
|
+
stderr: null,
|
|
62562
|
+
value: null,
|
|
62563
|
+
error: null,
|
|
62564
|
+
exception: null,
|
|
62565
|
+
imagePng: null,
|
|
62566
|
+
plotlyJson: null,
|
|
62567
|
+
createdAssets: []
|
|
62568
|
+
};
|
|
62560
62569
|
const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
|
|
62561
62570
|
const stdout = inner.stdout ?? null;
|
|
62562
62571
|
const stderr = inner.stderr ?? null;
|
|
@@ -62572,25 +62581,292 @@ function parsePythonResult(result) {
|
|
|
62572
62581
|
};
|
|
62573
62582
|
}
|
|
62574
62583
|
let imagePng = null;
|
|
62584
|
+
let plotlyJson = null;
|
|
62575
62585
|
if (inner.data && typeof inner.data === "object") {
|
|
62576
62586
|
imagePng = inner.data.png ?? null;
|
|
62577
62587
|
}
|
|
62578
|
-
if (
|
|
62588
|
+
if (Array.isArray(data.outputs)) {
|
|
62579
62589
|
for (const output of data.outputs) {
|
|
62580
62590
|
if (output && typeof output === "object") {
|
|
62581
62591
|
const mimeBundle = output.mime_bundle;
|
|
62582
62592
|
if (mimeBundle && typeof mimeBundle === "object") {
|
|
62583
|
-
const
|
|
62584
|
-
if (typeof
|
|
62585
|
-
|
|
62586
|
-
|
|
62593
|
+
const mb = mimeBundle;
|
|
62594
|
+
if (!plotlyJson && typeof mb["plotly+json"] === "string") {
|
|
62595
|
+
plotlyJson = mb["plotly+json"];
|
|
62596
|
+
}
|
|
62597
|
+
if (!imagePng && typeof mb["image/png"] === "string") {
|
|
62598
|
+
imagePng = mb["image/png"];
|
|
62587
62599
|
}
|
|
62588
62600
|
}
|
|
62589
62601
|
}
|
|
62590
62602
|
}
|
|
62591
62603
|
}
|
|
62592
62604
|
const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
|
|
62593
|
-
return { stdout, stderr, value, error: error2, exception, imagePng, createdAssets };
|
|
62605
|
+
return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
|
|
62606
|
+
}
|
|
62607
|
+
function getPlotly() {
|
|
62608
|
+
return window.Plotly;
|
|
62609
|
+
}
|
|
62610
|
+
let plotlyLoadPromise = null;
|
|
62611
|
+
function ensurePlotlyLoaded() {
|
|
62612
|
+
if (getPlotly()) return Promise.resolve();
|
|
62613
|
+
if (plotlyLoadPromise) return plotlyLoadPromise;
|
|
62614
|
+
plotlyLoadPromise = new Promise((resolve, reject) => {
|
|
62615
|
+
const script = document.createElement("script");
|
|
62616
|
+
script.src = "https://cdn.plot.ly/plotly-2.35.2.min.js";
|
|
62617
|
+
script.crossOrigin = "anonymous";
|
|
62618
|
+
script.onload = () => resolve();
|
|
62619
|
+
script.onerror = () => {
|
|
62620
|
+
plotlyLoadPromise = null;
|
|
62621
|
+
document.head.removeChild(script);
|
|
62622
|
+
reject(new Error("Failed to load Plotly"));
|
|
62623
|
+
};
|
|
62624
|
+
document.head.appendChild(script);
|
|
62625
|
+
});
|
|
62626
|
+
return plotlyLoadPromise;
|
|
62627
|
+
}
|
|
62628
|
+
const PlotlyChart = ({ json, height = 500 }) => {
|
|
62629
|
+
const chartRef = React.useRef(null);
|
|
62630
|
+
const [error2, setError] = React.useState(null);
|
|
62631
|
+
React.useEffect(() => {
|
|
62632
|
+
let cancelled = false;
|
|
62633
|
+
ensurePlotlyLoaded().then(() => {
|
|
62634
|
+
if (cancelled || !chartRef.current) return;
|
|
62635
|
+
const parsed = JSON.parse(json);
|
|
62636
|
+
const Plotly = getPlotly();
|
|
62637
|
+
if (!Plotly) return;
|
|
62638
|
+
Plotly.newPlot(
|
|
62639
|
+
chartRef.current,
|
|
62640
|
+
parsed.data || [],
|
|
62641
|
+
{ ...parsed.layout || {}, autosize: true, width: void 0, height: void 0 },
|
|
62642
|
+
{ responsive: true, displayModeBar: true, displaylogo: false, showLink: false }
|
|
62643
|
+
);
|
|
62644
|
+
}).catch((err) => {
|
|
62645
|
+
if (!cancelled) setError(err.message);
|
|
62646
|
+
});
|
|
62647
|
+
return () => {
|
|
62648
|
+
cancelled = true;
|
|
62649
|
+
if (chartRef.current) {
|
|
62650
|
+
const Plotly = getPlotly();
|
|
62651
|
+
if (Plotly) Plotly.purge(chartRef.current);
|
|
62652
|
+
}
|
|
62653
|
+
};
|
|
62654
|
+
}, [json]);
|
|
62655
|
+
if (error2) {
|
|
62656
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: error2 });
|
|
62657
|
+
}
|
|
62658
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: chartRef, className: "w-full overflow-hidden", style: { height } });
|
|
62659
|
+
};
|
|
62660
|
+
const PlotlyChartSection = ({ json }) => {
|
|
62661
|
+
const [isFullscreen, setIsFullscreen] = React.useState(false);
|
|
62662
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
62663
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62664
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
62665
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
62666
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChartColumn, { className: "size-3 text-muted-foreground" }),
|
|
62667
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Interactive chart" })
|
|
62668
|
+
] }),
|
|
62669
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
62670
|
+
"button",
|
|
62671
|
+
{
|
|
62672
|
+
type: "button",
|
|
62673
|
+
onClick: () => setIsFullscreen(true),
|
|
62674
|
+
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",
|
|
62675
|
+
title: "View full screen",
|
|
62676
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Maximize2, { className: "size-3.5" })
|
|
62677
|
+
}
|
|
62678
|
+
)
|
|
62679
|
+
] }),
|
|
62680
|
+
/* @__PURE__ */ jsxRuntime.jsx(PlotlyChart, { json })
|
|
62681
|
+
] }),
|
|
62682
|
+
isFullscreen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-[9999] flex flex-col bg-background", children: [
|
|
62683
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-3 border-b border-border", children: [
|
|
62684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
62685
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChartColumn, { className: "size-4 text-muted-foreground" }),
|
|
62686
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Interactive chart" })
|
|
62687
|
+
] }),
|
|
62688
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
62689
|
+
"button",
|
|
62690
|
+
{
|
|
62691
|
+
type: "button",
|
|
62692
|
+
onClick: () => setIsFullscreen(false),
|
|
62693
|
+
className: "flex items-center justify-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
|
|
62694
|
+
title: "Close full screen",
|
|
62695
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(X, { className: "size-5" })
|
|
62696
|
+
}
|
|
62697
|
+
)
|
|
62698
|
+
] }),
|
|
62699
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 p-4", children: /* @__PURE__ */ jsxRuntime.jsx(PlotlyChart, { json, height: "100%" }) })
|
|
62700
|
+
] })
|
|
62701
|
+
] });
|
|
62702
|
+
};
|
|
62703
|
+
const SyntaxHighlightedCode = React.memo(({ code: code2 }) => {
|
|
62704
|
+
const highlighted = React.useMemo(() => highlightPython(code2), [code2]);
|
|
62705
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
62706
|
+
"pre",
|
|
62707
|
+
{
|
|
62708
|
+
className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed font-mono",
|
|
62709
|
+
dangerouslySetInnerHTML: { __html: highlighted }
|
|
62710
|
+
}
|
|
62711
|
+
);
|
|
62712
|
+
});
|
|
62713
|
+
SyntaxHighlightedCode.displayName = "SyntaxHighlightedCode";
|
|
62714
|
+
const PY_KEYWORDS = /* @__PURE__ */ new Set([
|
|
62715
|
+
"False",
|
|
62716
|
+
"None",
|
|
62717
|
+
"True",
|
|
62718
|
+
"and",
|
|
62719
|
+
"as",
|
|
62720
|
+
"assert",
|
|
62721
|
+
"async",
|
|
62722
|
+
"await",
|
|
62723
|
+
"break",
|
|
62724
|
+
"class",
|
|
62725
|
+
"continue",
|
|
62726
|
+
"def",
|
|
62727
|
+
"del",
|
|
62728
|
+
"elif",
|
|
62729
|
+
"else",
|
|
62730
|
+
"except",
|
|
62731
|
+
"finally",
|
|
62732
|
+
"for",
|
|
62733
|
+
"from",
|
|
62734
|
+
"global",
|
|
62735
|
+
"if",
|
|
62736
|
+
"import",
|
|
62737
|
+
"in",
|
|
62738
|
+
"is",
|
|
62739
|
+
"lambda",
|
|
62740
|
+
"nonlocal",
|
|
62741
|
+
"not",
|
|
62742
|
+
"or",
|
|
62743
|
+
"pass",
|
|
62744
|
+
"raise",
|
|
62745
|
+
"return",
|
|
62746
|
+
"try",
|
|
62747
|
+
"while",
|
|
62748
|
+
"with",
|
|
62749
|
+
"yield"
|
|
62750
|
+
]);
|
|
62751
|
+
const PY_BUILTINS = /* @__PURE__ */ new Set([
|
|
62752
|
+
"print",
|
|
62753
|
+
"len",
|
|
62754
|
+
"range",
|
|
62755
|
+
"int",
|
|
62756
|
+
"str",
|
|
62757
|
+
"float",
|
|
62758
|
+
"list",
|
|
62759
|
+
"dict",
|
|
62760
|
+
"set",
|
|
62761
|
+
"tuple",
|
|
62762
|
+
"bool",
|
|
62763
|
+
"type",
|
|
62764
|
+
"isinstance",
|
|
62765
|
+
"enumerate",
|
|
62766
|
+
"zip",
|
|
62767
|
+
"map",
|
|
62768
|
+
"filter",
|
|
62769
|
+
"sorted",
|
|
62770
|
+
"reversed",
|
|
62771
|
+
"sum",
|
|
62772
|
+
"min",
|
|
62773
|
+
"max",
|
|
62774
|
+
"abs",
|
|
62775
|
+
"round",
|
|
62776
|
+
"open",
|
|
62777
|
+
"super",
|
|
62778
|
+
"property",
|
|
62779
|
+
"staticmethod",
|
|
62780
|
+
"classmethod",
|
|
62781
|
+
"display",
|
|
62782
|
+
"input",
|
|
62783
|
+
"format",
|
|
62784
|
+
"getattr",
|
|
62785
|
+
"setattr",
|
|
62786
|
+
"hasattr",
|
|
62787
|
+
"vars",
|
|
62788
|
+
"dir"
|
|
62789
|
+
]);
|
|
62790
|
+
function escapeHtml(s) {
|
|
62791
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
62792
|
+
}
|
|
62793
|
+
function highlightPython(code2) {
|
|
62794
|
+
const lines = code2.split("\n");
|
|
62795
|
+
return lines.map((line) => {
|
|
62796
|
+
const commentMatch = line.match(/^(\s*)(#.*)$/);
|
|
62797
|
+
if (commentMatch) {
|
|
62798
|
+
return `${escapeHtml(commentMatch[1])}<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(commentMatch[2])}</span>`;
|
|
62799
|
+
}
|
|
62800
|
+
let result = "";
|
|
62801
|
+
let i = 0;
|
|
62802
|
+
while (i < line.length) {
|
|
62803
|
+
if (line[i] === "#") {
|
|
62804
|
+
result += `<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(line.slice(i))}</span>`;
|
|
62805
|
+
break;
|
|
62806
|
+
}
|
|
62807
|
+
if (line.slice(i, i + 3) === '"""' || line.slice(i, i + 3) === "'''") {
|
|
62808
|
+
const quote = line.slice(i, i + 3);
|
|
62809
|
+
const end = line.indexOf(quote, i + 3);
|
|
62810
|
+
const str = end >= 0 ? line.slice(i, end + 3) : line.slice(i);
|
|
62811
|
+
result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
|
|
62812
|
+
i += str.length;
|
|
62813
|
+
continue;
|
|
62814
|
+
}
|
|
62815
|
+
if (line[i] === '"' || line[i] === "'") {
|
|
62816
|
+
const q = line[i];
|
|
62817
|
+
let j = i + 1;
|
|
62818
|
+
while (j < line.length && line[j] !== q) {
|
|
62819
|
+
if (line[j] === "\\") j++;
|
|
62820
|
+
j++;
|
|
62821
|
+
}
|
|
62822
|
+
const str = line.slice(i, j + 1);
|
|
62823
|
+
result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
|
|
62824
|
+
i = j + 1;
|
|
62825
|
+
continue;
|
|
62826
|
+
}
|
|
62827
|
+
if (/\d/.test(line[i]) && (i === 0 || /[\s(,=[\-+*/:!<>]/.test(line[i - 1]))) {
|
|
62828
|
+
const numMatch = line.slice(i).match(/^(\d+\.?\d*(?:[eE][+-]?\d+)?)/);
|
|
62829
|
+
if (numMatch) {
|
|
62830
|
+
result += `<span style="color:var(--aui-syn-number, #b5cea8)">${escapeHtml(numMatch[1])}</span>`;
|
|
62831
|
+
i += numMatch[1].length;
|
|
62832
|
+
continue;
|
|
62833
|
+
}
|
|
62834
|
+
}
|
|
62835
|
+
if (/[a-zA-Z_]/.test(line[i])) {
|
|
62836
|
+
const wordMatch = line.slice(i).match(/^[a-zA-Z_]\w*/);
|
|
62837
|
+
if (wordMatch) {
|
|
62838
|
+
const word = wordMatch[0];
|
|
62839
|
+
if (PY_KEYWORDS.has(word)) {
|
|
62840
|
+
result += `<span style="color:var(--aui-syn-keyword, #569cd6)">${escapeHtml(word)}</span>`;
|
|
62841
|
+
} else if (PY_BUILTINS.has(word)) {
|
|
62842
|
+
result += `<span style="color:var(--aui-syn-builtin, #dcdcaa)">${escapeHtml(word)}</span>`;
|
|
62843
|
+
} else if (line[i + word.length] === "(") {
|
|
62844
|
+
result += `<span style="color:var(--aui-syn-func, #dcdcaa)">${escapeHtml(word)}</span>`;
|
|
62845
|
+
} else {
|
|
62846
|
+
result += escapeHtml(word);
|
|
62847
|
+
}
|
|
62848
|
+
i += word.length;
|
|
62849
|
+
continue;
|
|
62850
|
+
}
|
|
62851
|
+
}
|
|
62852
|
+
if (line[i] === "@" && (i === 0 || /\s/.test(line[i - 1]))) {
|
|
62853
|
+
const decMatch = line.slice(i).match(/^@[\w.]+/);
|
|
62854
|
+
if (decMatch) {
|
|
62855
|
+
result += `<span style="color:var(--aui-syn-decorator, #569cd6)">${escapeHtml(decMatch[0])}</span>`;
|
|
62856
|
+
i += decMatch[0].length;
|
|
62857
|
+
continue;
|
|
62858
|
+
}
|
|
62859
|
+
}
|
|
62860
|
+
if (/[+\-*/%=<>!&|^~]/.test(line[i])) {
|
|
62861
|
+
result += `<span style="color:var(--aui-syn-op, #d4d4d4)">${escapeHtml(line[i])}</span>`;
|
|
62862
|
+
i++;
|
|
62863
|
+
continue;
|
|
62864
|
+
}
|
|
62865
|
+
result += escapeHtml(line[i]);
|
|
62866
|
+
i++;
|
|
62867
|
+
}
|
|
62868
|
+
return result;
|
|
62869
|
+
}).join("\n");
|
|
62594
62870
|
}
|
|
62595
62871
|
const RunPythonCodeToolUIImpl = ({
|
|
62596
62872
|
toolName,
|
|
@@ -62606,11 +62882,15 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62606
62882
|
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
62607
62883
|
const isComplete = (status == null ? void 0 : status.type) === "complete";
|
|
62608
62884
|
const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
|
|
62609
|
-
const parsed = React.useMemo(
|
|
62885
|
+
const parsed = React.useMemo(
|
|
62886
|
+
() => isComplete ? parsePythonResult(result) : null,
|
|
62887
|
+
[result, isComplete]
|
|
62888
|
+
);
|
|
62610
62889
|
const openAsset = useAssetPanelStore((s) => s.openAsset);
|
|
62611
62890
|
const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
|
|
62612
62891
|
const hasError = parsed && (parsed.error || parsed.exception);
|
|
62613
62892
|
const hasImage = parsed == null ? void 0 : parsed.imagePng;
|
|
62893
|
+
const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
|
|
62614
62894
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62615
62895
|
ToolCard,
|
|
62616
62896
|
{
|
|
@@ -62620,7 +62900,7 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62620
62900
|
toolName,
|
|
62621
62901
|
error: errorMsg,
|
|
62622
62902
|
children: [
|
|
62623
|
-
code2 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
62903
|
+
code2 && /* @__PURE__ */ jsxRuntime.jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsxRuntime.jsx(SyntaxHighlightedCode, { code: code2 }) }),
|
|
62624
62904
|
isComplete && hasOutput && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62625
62905
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
|
|
62626
62906
|
/* @__PURE__ */ jsxRuntime.jsx(Terminal, { className: "size-3 text-muted-foreground" }),
|
|
@@ -62635,7 +62915,8 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62635
62915
|
] }),
|
|
62636
62916
|
/* @__PURE__ */ jsxRuntime.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 })
|
|
62637
62917
|
] }),
|
|
62638
|
-
isComplete &&
|
|
62918
|
+
isComplete && hasPlotly && /* @__PURE__ */ jsxRuntime.jsx(PlotlyChartSection, { json: parsed.plotlyJson }),
|
|
62919
|
+
isComplete && hasImage && !hasPlotly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62639
62920
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
|
|
62640
62921
|
/* @__PURE__ */ jsxRuntime.jsx(Image, { className: "size-3 text-muted-foreground" }),
|
|
62641
62922
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Generated image" })
|
|
@@ -62866,13 +63147,63 @@ const TooltipIconButton = React.forwardRef(
|
|
|
62866
63147
|
);
|
|
62867
63148
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
62868
63149
|
const EMPTY_MENTION_TOOLS = [];
|
|
63150
|
+
const DEFAULT_SUGGESTIONS = [
|
|
63151
|
+
{
|
|
63152
|
+
icon: Search,
|
|
63153
|
+
title: "Research a topic and draft a report",
|
|
63154
|
+
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."
|
|
63155
|
+
},
|
|
63156
|
+
{
|
|
63157
|
+
icon: ChartColumn,
|
|
63158
|
+
title: "Analyze data and visualize insights",
|
|
63159
|
+
prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
|
|
63160
|
+
},
|
|
63161
|
+
{
|
|
63162
|
+
icon: Presentation,
|
|
63163
|
+
title: "Build a presentation from scratch",
|
|
63164
|
+
prompt: "Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps."
|
|
63165
|
+
},
|
|
63166
|
+
{
|
|
63167
|
+
icon: FileText,
|
|
63168
|
+
title: "Set up a structured spreadsheet",
|
|
63169
|
+
prompt: "Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage."
|
|
63170
|
+
}
|
|
63171
|
+
];
|
|
63172
|
+
const SuggestionCard = ({
|
|
63173
|
+
suggestion,
|
|
63174
|
+
index: index2
|
|
63175
|
+
}) => {
|
|
63176
|
+
const aui = useAui();
|
|
63177
|
+
const Icon2 = suggestion.icon;
|
|
63178
|
+
const handleClick2 = React.useCallback(() => {
|
|
63179
|
+
aui.thread().append({
|
|
63180
|
+
role: "user",
|
|
63181
|
+
content: [{ type: "text", text: suggestion.prompt }]
|
|
63182
|
+
});
|
|
63183
|
+
}, [aui, suggestion.prompt]);
|
|
63184
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
63185
|
+
"button",
|
|
63186
|
+
{
|
|
63187
|
+
type: "button",
|
|
63188
|
+
onClick: handleClick2,
|
|
63189
|
+
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`,
|
|
63190
|
+
style: { animationDelay: `${100 + index2 * 75}ms` },
|
|
63191
|
+
children: [
|
|
63192
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Icon2, { className: "size-4" }) }),
|
|
63193
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-medium leading-snug text-foreground", children: suggestion.title }) }),
|
|
63194
|
+
/* @__PURE__ */ jsxRuntime.jsx(ArrowRight, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground" })
|
|
63195
|
+
]
|
|
63196
|
+
}
|
|
63197
|
+
);
|
|
63198
|
+
};
|
|
62869
63199
|
const AthenaChat = ({
|
|
62870
63200
|
className,
|
|
62871
63201
|
welcomeMessage = "Hello there!",
|
|
62872
|
-
welcomeSubtext = "
|
|
63202
|
+
welcomeSubtext = "What can I help you with?",
|
|
62873
63203
|
maxWidth = "44rem",
|
|
62874
63204
|
toolUIs,
|
|
62875
|
-
mentionTools
|
|
63205
|
+
mentionTools,
|
|
63206
|
+
welcomeSuggestions = DEFAULT_SUGGESTIONS
|
|
62876
63207
|
}) => {
|
|
62877
63208
|
const tools = mentionTools ?? EMPTY_MENTION_TOOLS;
|
|
62878
63209
|
const mergedToolUIs = React.useMemo(() => ({
|
|
@@ -62885,43 +63216,59 @@ const AthenaChat = ({
|
|
|
62885
63216
|
() => () => /* @__PURE__ */ jsxRuntime.jsx(AssistantMessage, { toolUIs: mergedToolUIs }),
|
|
62886
63217
|
[mergedToolUIs]
|
|
62887
63218
|
);
|
|
62888
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
63219
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
62889
63220
|
ThreadPrimitiveRoot,
|
|
62890
63221
|
{
|
|
62891
63222
|
className: `aui-root aui-thread-root @container flex h-full flex-col bg-background ${className ?? ""}`,
|
|
62892
63223
|
style: { ["--thread-max-width"]: maxWidth, position: "relative" },
|
|
62893
|
-
children:
|
|
62894
|
-
|
|
62895
|
-
|
|
62896
|
-
|
|
62897
|
-
|
|
62898
|
-
|
|
62899
|
-
|
|
62900
|
-
|
|
62901
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
62902
|
-
|
|
62903
|
-
|
|
62904
|
-
|
|
62905
|
-
|
|
62906
|
-
|
|
62907
|
-
|
|
62908
|
-
|
|
63224
|
+
children: [
|
|
63225
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThreadLoadingOverlay, {}),
|
|
63226
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
63227
|
+
ThreadPrimitiveViewport,
|
|
63228
|
+
{
|
|
63229
|
+
turnAnchor: "top",
|
|
63230
|
+
className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
|
|
63231
|
+
children: [
|
|
63232
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-thread-welcome-message flex size-full flex-col justify-center px-4", children: [
|
|
63233
|
+
/* @__PURE__ */ jsxRuntime.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 }),
|
|
63234
|
+
welcomeSubtext && /* @__PURE__ */ jsxRuntime.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 }),
|
|
63235
|
+
welcomeSuggestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2", children: welcomeSuggestions.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(SuggestionCard, { suggestion: s, index: i }, s.title)) })
|
|
63236
|
+
] }) }) }) }),
|
|
63237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
63238
|
+
ThreadPrimitiveMessages,
|
|
63239
|
+
{
|
|
63240
|
+
components: {
|
|
63241
|
+
UserMessage,
|
|
63242
|
+
AssistantMessage: AssistantMessageComponent
|
|
63243
|
+
}
|
|
62909
63244
|
}
|
|
62910
|
-
|
|
62911
|
-
|
|
62912
|
-
|
|
62913
|
-
|
|
62914
|
-
|
|
62915
|
-
|
|
62916
|
-
|
|
63245
|
+
),
|
|
63246
|
+
/* @__PURE__ */ jsxRuntime.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: [
|
|
63247
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThreadScrollToBottom, {}),
|
|
63248
|
+
/* @__PURE__ */ jsxRuntime.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: [
|
|
63249
|
+
/* @__PURE__ */ jsxRuntime.jsx(TiptapComposer, { tools }),
|
|
63250
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComposerAction, {})
|
|
63251
|
+
] })
|
|
62917
63252
|
] })
|
|
62918
|
-
]
|
|
62919
|
-
|
|
62920
|
-
|
|
62921
|
-
|
|
63253
|
+
]
|
|
63254
|
+
}
|
|
63255
|
+
)
|
|
63256
|
+
]
|
|
62922
63257
|
}
|
|
62923
63258
|
);
|
|
62924
63259
|
};
|
|
63260
|
+
const ThreadLoadingOverlay = () => {
|
|
63261
|
+
const remoteId = useAthenaThreadId();
|
|
63262
|
+
const [timedOut, setTimedOut] = React.useState(false);
|
|
63263
|
+
React.useEffect(() => {
|
|
63264
|
+
if (!remoteId) return;
|
|
63265
|
+
setTimedOut(false);
|
|
63266
|
+
const timer = setTimeout(() => setTimedOut(true), 15e3);
|
|
63267
|
+
return () => clearTimeout(timer);
|
|
63268
|
+
}, [remoteId]);
|
|
63269
|
+
if (!remoteId || timedOut) return null;
|
|
63270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" }) }) });
|
|
63271
|
+
};
|
|
62925
63272
|
const ThreadScrollToBottom = () => /* @__PURE__ */ jsxRuntime.jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
62926
63273
|
TooltipIconButton,
|
|
62927
63274
|
{
|
|
@@ -63358,13 +63705,10 @@ function ThreadList({ className }) {
|
|
|
63358
63705
|
] });
|
|
63359
63706
|
}
|
|
63360
63707
|
function ThreadListItem() {
|
|
63361
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
63362
|
-
/* @__PURE__ */ jsxRuntime.
|
|
63363
|
-
|
|
63364
|
-
|
|
63365
|
-
] }),
|
|
63366
|
-
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Archive, { className: "size-3" }) })
|
|
63367
|
-
] });
|
|
63708
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ThreadListItemPrimitiveRoot, { className: "group", children: /* @__PURE__ */ jsxRuntime.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: [
|
|
63709
|
+
/* @__PURE__ */ jsxRuntime.jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
|
|
63710
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ThreadListItemPrimitiveTitle, { fallback: "Untitled" }) })
|
|
63711
|
+
] }) });
|
|
63368
63712
|
}
|
|
63369
63713
|
function useAppendToComposer() {
|
|
63370
63714
|
const aui = useAui();
|