@athenaintel/react 0.6.2 → 0.6.5
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 +383 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +383 -74
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ export declare interface AthenaChatProps {
|
|
|
72
72
|
toolUIs?: Record<string, ToolCallMessagePartComponent>;
|
|
73
73
|
/** Mention tools available in the composer. */
|
|
74
74
|
mentionTools?: MentionTool[];
|
|
75
|
+
/** Suggestion cards shown on the welcome screen. Pass `[]` to hide. */
|
|
76
|
+
welcomeSuggestions?: WelcomeSuggestion[];
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export declare interface AthenaConfig {
|
|
@@ -750,4 +752,10 @@ export declare type ViewMode = 'tabs' | 'tiled';
|
|
|
750
752
|
|
|
751
753
|
export declare const WebSearchToolUI: ToolCallMessagePartComponent;
|
|
752
754
|
|
|
755
|
+
export declare interface WelcomeSuggestion {
|
|
756
|
+
icon: React.ElementType;
|
|
757
|
+
title: string;
|
|
758
|
+
prompt: string;
|
|
759
|
+
}
|
|
760
|
+
|
|
753
761
|
export { }
|
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(() => {
|
|
@@ -20688,7 +20681,7 @@ async function archiveThread(backendUrl, auth, threadId) {
|
|
|
20688
20681
|
}
|
|
20689
20682
|
const DEFAULT_API_URL = "https://sync.athenaintel.com/api/chat";
|
|
20690
20683
|
const DEFAULT_BACKEND_URL = "https://api.athenaintel.com/api/assistant-ui";
|
|
20691
|
-
const DEFAULT_MODEL = "claude-
|
|
20684
|
+
const DEFAULT_MODEL = "claude-opus-4-6-thinking-max-fast";
|
|
20692
20685
|
const DEFAULT_AGENT = "athena_assist_agent";
|
|
20693
20686
|
const ATHENA_TRACKING_ID_KEY = "_athena_tracking_id";
|
|
20694
20687
|
const safeStringify = (value) => {
|
|
@@ -20972,7 +20965,7 @@ const useAthenaRuntime = (config2) => {
|
|
|
20972
20965
|
agent: agent2,
|
|
20973
20966
|
model,
|
|
20974
20967
|
effort_dial_duration: -1,
|
|
20975
|
-
plan_mode_enabled:
|
|
20968
|
+
plan_mode_enabled: false,
|
|
20976
20969
|
workbench,
|
|
20977
20970
|
knowledge_base: knowledgeBase,
|
|
20978
20971
|
...systemPrompt ? { system_prompt: systemPrompt } : {}
|
|
@@ -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
|
*
|
|
@@ -61306,6 +61298,7 @@ const TOOL_META = {
|
|
|
61306
61298
|
execute_presentation_code: { displayName: "Generating slides", icon: Monitor },
|
|
61307
61299
|
// Code & Data
|
|
61308
61300
|
run_python_code: { displayName: "Running analysis", icon: Code },
|
|
61301
|
+
// Debug: temporarily log all tool names hitting the fallback
|
|
61309
61302
|
run_sql_query_tool: { displayName: "Querying data", icon: Database },
|
|
61310
61303
|
create_database: { displayName: "Setting up database", icon: Database },
|
|
61311
61304
|
run_database_sql: { displayName: "Querying database", icon: Database },
|
|
@@ -62363,14 +62356,21 @@ const EmailSearchToolUIImpl = ({
|
|
|
62363
62356
|
toolName,
|
|
62364
62357
|
badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
|
|
62365
62358
|
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
|
-
|
|
62359
|
+
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(
|
|
62360
|
+
"div",
|
|
62361
|
+
{
|
|
62362
|
+
className: cn("flex flex-col gap-0.5 py-2", i === 0 && "pt-0"),
|
|
62363
|
+
children: [
|
|
62364
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
62365
|
+
/* @__PURE__ */ jsx("span", { className: "text-[12px] font-medium text-foreground", children: email.subject || "No subject" }),
|
|
62366
|
+
email.date && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: email.date })
|
|
62367
|
+
] }),
|
|
62368
|
+
email.from && /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: email.from }),
|
|
62369
|
+
email.snippet && /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-relaxed text-muted-foreground/80", children: truncate(email.snippet, 150) })
|
|
62370
|
+
]
|
|
62371
|
+
},
|
|
62372
|
+
i
|
|
62373
|
+
)) }) })
|
|
62374
62374
|
}
|
|
62375
62375
|
);
|
|
62376
62376
|
};
|
|
@@ -62538,7 +62538,17 @@ const CreateNotebookToolUI = memo(
|
|
|
62538
62538
|
CreateNotebookToolUI.displayName = "CreateNotebookToolUI";
|
|
62539
62539
|
function parsePythonResult(result) {
|
|
62540
62540
|
const data = normalizeResult(result);
|
|
62541
|
-
if (!data)
|
|
62541
|
+
if (!data)
|
|
62542
|
+
return {
|
|
62543
|
+
stdout: null,
|
|
62544
|
+
stderr: null,
|
|
62545
|
+
value: null,
|
|
62546
|
+
error: null,
|
|
62547
|
+
exception: null,
|
|
62548
|
+
imagePng: null,
|
|
62549
|
+
plotlyJson: null,
|
|
62550
|
+
createdAssets: []
|
|
62551
|
+
};
|
|
62542
62552
|
const inner = typeof data.result === "object" && data.result !== null ? data.result : data;
|
|
62543
62553
|
const stdout = inner.stdout ?? null;
|
|
62544
62554
|
const stderr = inner.stderr ?? null;
|
|
@@ -62554,11 +62564,243 @@ function parsePythonResult(result) {
|
|
|
62554
62564
|
};
|
|
62555
62565
|
}
|
|
62556
62566
|
let imagePng = null;
|
|
62567
|
+
let plotlyJson = null;
|
|
62557
62568
|
if (inner.data && typeof inner.data === "object") {
|
|
62558
62569
|
imagePng = inner.data.png ?? null;
|
|
62559
62570
|
}
|
|
62571
|
+
if (Array.isArray(data.outputs)) {
|
|
62572
|
+
for (const output of data.outputs) {
|
|
62573
|
+
if (output && typeof output === "object") {
|
|
62574
|
+
const mimeBundle = output.mime_bundle;
|
|
62575
|
+
if (mimeBundle && typeof mimeBundle === "object") {
|
|
62576
|
+
const mb = mimeBundle;
|
|
62577
|
+
if (!plotlyJson && typeof mb["plotly+json"] === "string") {
|
|
62578
|
+
plotlyJson = mb["plotly+json"];
|
|
62579
|
+
}
|
|
62580
|
+
if (!imagePng && typeof mb["image/png"] === "string") {
|
|
62581
|
+
imagePng = mb["image/png"];
|
|
62582
|
+
}
|
|
62583
|
+
}
|
|
62584
|
+
}
|
|
62585
|
+
}
|
|
62586
|
+
}
|
|
62560
62587
|
const createdAssets = Array.isArray(data.created_assets) ? data.created_assets : [];
|
|
62561
|
-
return { stdout, stderr, value, error: error2, exception, imagePng, createdAssets };
|
|
62588
|
+
return { stdout, stderr, value, error: error2, exception, imagePng, plotlyJson, createdAssets };
|
|
62589
|
+
}
|
|
62590
|
+
let plotlyLoadPromise = null;
|
|
62591
|
+
function ensurePlotlyLoaded() {
|
|
62592
|
+
if (window.Plotly) return Promise.resolve();
|
|
62593
|
+
if (plotlyLoadPromise) return plotlyLoadPromise;
|
|
62594
|
+
plotlyLoadPromise = new Promise((resolve, reject) => {
|
|
62595
|
+
const script = document.createElement("script");
|
|
62596
|
+
script.src = "https://cdn.plot.ly/plotly-2.35.2.min.js";
|
|
62597
|
+
script.onload = () => resolve();
|
|
62598
|
+
script.onerror = () => {
|
|
62599
|
+
plotlyLoadPromise = null;
|
|
62600
|
+
reject(new Error("Failed to load Plotly"));
|
|
62601
|
+
};
|
|
62602
|
+
document.head.appendChild(script);
|
|
62603
|
+
});
|
|
62604
|
+
return plotlyLoadPromise;
|
|
62605
|
+
}
|
|
62606
|
+
const PlotlyChart = ({ json }) => {
|
|
62607
|
+
const chartRef = useRef(null);
|
|
62608
|
+
const [error2, setError] = useState(null);
|
|
62609
|
+
useEffect(() => {
|
|
62610
|
+
let cancelled = false;
|
|
62611
|
+
ensurePlotlyLoaded().then(() => {
|
|
62612
|
+
if (cancelled || !chartRef.current) return;
|
|
62613
|
+
const parsed = JSON.parse(json);
|
|
62614
|
+
const Plotly = window.Plotly;
|
|
62615
|
+
Plotly.newPlot(
|
|
62616
|
+
chartRef.current,
|
|
62617
|
+
parsed.data || [],
|
|
62618
|
+
{ ...parsed.layout || {}, autosize: true, width: void 0, height: void 0 },
|
|
62619
|
+
{ responsive: true, displayModeBar: true, displaylogo: false, showLink: false }
|
|
62620
|
+
);
|
|
62621
|
+
}).catch((err) => {
|
|
62622
|
+
if (!cancelled) setError(err.message);
|
|
62623
|
+
});
|
|
62624
|
+
return () => {
|
|
62625
|
+
cancelled = true;
|
|
62626
|
+
if (chartRef.current) {
|
|
62627
|
+
const Plotly = window.Plotly;
|
|
62628
|
+
if (Plotly == null ? void 0 : Plotly.purge) Plotly.purge(chartRef.current);
|
|
62629
|
+
}
|
|
62630
|
+
};
|
|
62631
|
+
}, [json]);
|
|
62632
|
+
if (error2) {
|
|
62633
|
+
return /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error2 });
|
|
62634
|
+
}
|
|
62635
|
+
return /* @__PURE__ */ jsx("div", { ref: chartRef, className: "w-full overflow-hidden", style: { height: 500 } });
|
|
62636
|
+
};
|
|
62637
|
+
const SyntaxHighlightedCode = memo(({ code: code2 }) => {
|
|
62638
|
+
const highlighted = useMemo(() => highlightPython(code2), [code2]);
|
|
62639
|
+
return /* @__PURE__ */ jsx(
|
|
62640
|
+
"pre",
|
|
62641
|
+
{
|
|
62642
|
+
className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed font-mono",
|
|
62643
|
+
dangerouslySetInnerHTML: { __html: highlighted }
|
|
62644
|
+
}
|
|
62645
|
+
);
|
|
62646
|
+
});
|
|
62647
|
+
SyntaxHighlightedCode.displayName = "SyntaxHighlightedCode";
|
|
62648
|
+
const PY_KEYWORDS = /* @__PURE__ */ new Set([
|
|
62649
|
+
"False",
|
|
62650
|
+
"None",
|
|
62651
|
+
"True",
|
|
62652
|
+
"and",
|
|
62653
|
+
"as",
|
|
62654
|
+
"assert",
|
|
62655
|
+
"async",
|
|
62656
|
+
"await",
|
|
62657
|
+
"break",
|
|
62658
|
+
"class",
|
|
62659
|
+
"continue",
|
|
62660
|
+
"def",
|
|
62661
|
+
"del",
|
|
62662
|
+
"elif",
|
|
62663
|
+
"else",
|
|
62664
|
+
"except",
|
|
62665
|
+
"finally",
|
|
62666
|
+
"for",
|
|
62667
|
+
"from",
|
|
62668
|
+
"global",
|
|
62669
|
+
"if",
|
|
62670
|
+
"import",
|
|
62671
|
+
"in",
|
|
62672
|
+
"is",
|
|
62673
|
+
"lambda",
|
|
62674
|
+
"nonlocal",
|
|
62675
|
+
"not",
|
|
62676
|
+
"or",
|
|
62677
|
+
"pass",
|
|
62678
|
+
"raise",
|
|
62679
|
+
"return",
|
|
62680
|
+
"try",
|
|
62681
|
+
"while",
|
|
62682
|
+
"with",
|
|
62683
|
+
"yield"
|
|
62684
|
+
]);
|
|
62685
|
+
const PY_BUILTINS = /* @__PURE__ */ new Set([
|
|
62686
|
+
"print",
|
|
62687
|
+
"len",
|
|
62688
|
+
"range",
|
|
62689
|
+
"int",
|
|
62690
|
+
"str",
|
|
62691
|
+
"float",
|
|
62692
|
+
"list",
|
|
62693
|
+
"dict",
|
|
62694
|
+
"set",
|
|
62695
|
+
"tuple",
|
|
62696
|
+
"bool",
|
|
62697
|
+
"type",
|
|
62698
|
+
"isinstance",
|
|
62699
|
+
"enumerate",
|
|
62700
|
+
"zip",
|
|
62701
|
+
"map",
|
|
62702
|
+
"filter",
|
|
62703
|
+
"sorted",
|
|
62704
|
+
"reversed",
|
|
62705
|
+
"sum",
|
|
62706
|
+
"min",
|
|
62707
|
+
"max",
|
|
62708
|
+
"abs",
|
|
62709
|
+
"round",
|
|
62710
|
+
"open",
|
|
62711
|
+
"super",
|
|
62712
|
+
"property",
|
|
62713
|
+
"staticmethod",
|
|
62714
|
+
"classmethod",
|
|
62715
|
+
"display",
|
|
62716
|
+
"input",
|
|
62717
|
+
"format",
|
|
62718
|
+
"getattr",
|
|
62719
|
+
"setattr",
|
|
62720
|
+
"hasattr",
|
|
62721
|
+
"vars",
|
|
62722
|
+
"dir"
|
|
62723
|
+
]);
|
|
62724
|
+
function escapeHtml(s) {
|
|
62725
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
62726
|
+
}
|
|
62727
|
+
function highlightPython(code2) {
|
|
62728
|
+
const lines = code2.split("\n");
|
|
62729
|
+
return lines.map((line) => {
|
|
62730
|
+
const commentMatch = line.match(/^(\s*)(#.*)$/);
|
|
62731
|
+
if (commentMatch) {
|
|
62732
|
+
return `${escapeHtml(commentMatch[1])}<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(commentMatch[2])}</span>`;
|
|
62733
|
+
}
|
|
62734
|
+
let result = "";
|
|
62735
|
+
let i = 0;
|
|
62736
|
+
while (i < line.length) {
|
|
62737
|
+
if (line[i] === "#") {
|
|
62738
|
+
result += `<span style="color:var(--aui-syn-comment, #6a9955)">${escapeHtml(line.slice(i))}</span>`;
|
|
62739
|
+
break;
|
|
62740
|
+
}
|
|
62741
|
+
if (line.slice(i, i + 3) === '"""' || line.slice(i, i + 3) === "'''") {
|
|
62742
|
+
const quote = line.slice(i, i + 3);
|
|
62743
|
+
const end = line.indexOf(quote, i + 3);
|
|
62744
|
+
const str = end >= 0 ? line.slice(i, end + 3) : line.slice(i);
|
|
62745
|
+
result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
|
|
62746
|
+
i += str.length;
|
|
62747
|
+
continue;
|
|
62748
|
+
}
|
|
62749
|
+
if (line[i] === '"' || line[i] === "'") {
|
|
62750
|
+
const q = line[i];
|
|
62751
|
+
let j = i + 1;
|
|
62752
|
+
while (j < line.length && line[j] !== q) {
|
|
62753
|
+
if (line[j] === "\\") j++;
|
|
62754
|
+
j++;
|
|
62755
|
+
}
|
|
62756
|
+
const str = line.slice(i, j + 1);
|
|
62757
|
+
result += `<span style="color:var(--aui-syn-string, #ce9178)">${escapeHtml(str)}</span>`;
|
|
62758
|
+
i = j + 1;
|
|
62759
|
+
continue;
|
|
62760
|
+
}
|
|
62761
|
+
if (/\d/.test(line[i]) && (i === 0 || /[\s(,=[\-+*/:!<>]/.test(line[i - 1]))) {
|
|
62762
|
+
const numMatch = line.slice(i).match(/^(\d+\.?\d*(?:[eE][+-]?\d+)?)/);
|
|
62763
|
+
if (numMatch) {
|
|
62764
|
+
result += `<span style="color:var(--aui-syn-number, #b5cea8)">${escapeHtml(numMatch[1])}</span>`;
|
|
62765
|
+
i += numMatch[1].length;
|
|
62766
|
+
continue;
|
|
62767
|
+
}
|
|
62768
|
+
}
|
|
62769
|
+
if (/[a-zA-Z_]/.test(line[i])) {
|
|
62770
|
+
const wordMatch = line.slice(i).match(/^[a-zA-Z_]\w*/);
|
|
62771
|
+
if (wordMatch) {
|
|
62772
|
+
const word = wordMatch[0];
|
|
62773
|
+
if (PY_KEYWORDS.has(word)) {
|
|
62774
|
+
result += `<span style="color:var(--aui-syn-keyword, #569cd6)">${escapeHtml(word)}</span>`;
|
|
62775
|
+
} else if (PY_BUILTINS.has(word)) {
|
|
62776
|
+
result += `<span style="color:var(--aui-syn-builtin, #dcdcaa)">${escapeHtml(word)}</span>`;
|
|
62777
|
+
} else if (line[i + word.length] === "(") {
|
|
62778
|
+
result += `<span style="color:var(--aui-syn-func, #dcdcaa)">${escapeHtml(word)}</span>`;
|
|
62779
|
+
} else {
|
|
62780
|
+
result += escapeHtml(word);
|
|
62781
|
+
}
|
|
62782
|
+
i += word.length;
|
|
62783
|
+
continue;
|
|
62784
|
+
}
|
|
62785
|
+
}
|
|
62786
|
+
if (line[i] === "@" && (i === 0 || /\s/.test(line[i - 1]))) {
|
|
62787
|
+
const decMatch = line.slice(i).match(/^@[\w.]+/);
|
|
62788
|
+
if (decMatch) {
|
|
62789
|
+
result += `<span style="color:var(--aui-syn-decorator, #569cd6)">${escapeHtml(decMatch[0])}</span>`;
|
|
62790
|
+
i += decMatch[0].length;
|
|
62791
|
+
continue;
|
|
62792
|
+
}
|
|
62793
|
+
}
|
|
62794
|
+
if (/[+\-*/%=<>!&|^~]/.test(line[i])) {
|
|
62795
|
+
result += `<span style="color:var(--aui-syn-op, #d4d4d4)">${escapeHtml(line[i])}</span>`;
|
|
62796
|
+
i++;
|
|
62797
|
+
continue;
|
|
62798
|
+
}
|
|
62799
|
+
result += escapeHtml(line[i]);
|
|
62800
|
+
i++;
|
|
62801
|
+
}
|
|
62802
|
+
return result;
|
|
62803
|
+
}).join("\n");
|
|
62562
62804
|
}
|
|
62563
62805
|
const RunPythonCodeToolUIImpl = ({
|
|
62564
62806
|
toolName,
|
|
@@ -62574,11 +62816,15 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62574
62816
|
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
62575
62817
|
const isComplete = (status == null ? void 0 : status.type) === "complete";
|
|
62576
62818
|
const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? status.error : null;
|
|
62577
|
-
const parsed = useMemo(
|
|
62819
|
+
const parsed = useMemo(
|
|
62820
|
+
() => isComplete ? parsePythonResult(result) : null,
|
|
62821
|
+
[result, isComplete]
|
|
62822
|
+
);
|
|
62578
62823
|
const openAsset = useAssetPanelStore((s) => s.openAsset);
|
|
62579
62824
|
const hasOutput = parsed && (parsed.stdout || parsed.stderr || parsed.value);
|
|
62580
62825
|
const hasError = parsed && (parsed.error || parsed.exception);
|
|
62581
62826
|
const hasImage = parsed == null ? void 0 : parsed.imagePng;
|
|
62827
|
+
const hasPlotly = parsed == null ? void 0 : parsed.plotlyJson;
|
|
62582
62828
|
return /* @__PURE__ */ jsxs(
|
|
62583
62829
|
ToolCard,
|
|
62584
62830
|
{
|
|
@@ -62588,7 +62834,7 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62588
62834
|
toolName,
|
|
62589
62835
|
error: errorMsg,
|
|
62590
62836
|
children: [
|
|
62591
|
-
code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(
|
|
62837
|
+
code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(SyntaxHighlightedCode, { code: code2 }) }),
|
|
62592
62838
|
isComplete && hasOutput && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62593
62839
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1", children: [
|
|
62594
62840
|
/* @__PURE__ */ jsx(Terminal, { className: "size-3 text-muted-foreground" }),
|
|
@@ -62603,7 +62849,14 @@ const RunPythonCodeToolUIImpl = ({
|
|
|
62603
62849
|
] }),
|
|
62604
62850
|
/* @__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 })
|
|
62605
62851
|
] }),
|
|
62606
|
-
isComplete &&
|
|
62852
|
+
isComplete && hasPlotly && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62853
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
|
|
62854
|
+
/* @__PURE__ */ jsx(ChartColumn, { className: "size-3 text-muted-foreground" }),
|
|
62855
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Interactive chart" })
|
|
62856
|
+
] }),
|
|
62857
|
+
/* @__PURE__ */ jsx(PlotlyChart, { json: parsed.plotlyJson })
|
|
62858
|
+
] }),
|
|
62859
|
+
isComplete && hasImage && !hasPlotly && /* @__PURE__ */ jsxs("div", { className: "border-t border-border/40 px-4 py-2.5", children: [
|
|
62607
62860
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
|
|
62608
62861
|
/* @__PURE__ */ jsx(Image, { className: "size-3 text-muted-foreground" }),
|
|
62609
62862
|
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Generated image" })
|
|
@@ -62834,13 +63087,63 @@ const TooltipIconButton = forwardRef(
|
|
|
62834
63087
|
);
|
|
62835
63088
|
TooltipIconButton.displayName = "TooltipIconButton";
|
|
62836
63089
|
const EMPTY_MENTION_TOOLS = [];
|
|
63090
|
+
const DEFAULT_SUGGESTIONS = [
|
|
63091
|
+
{
|
|
63092
|
+
icon: Search,
|
|
63093
|
+
title: "Research a topic and draft a report",
|
|
63094
|
+
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."
|
|
63095
|
+
},
|
|
63096
|
+
{
|
|
63097
|
+
icon: ChartColumn,
|
|
63098
|
+
title: "Analyze data and visualize insights",
|
|
63099
|
+
prompt: "Generate a sample quarterly sales dataset across 4 product categories, then create an interactive chart showing revenue trends and category performance over time."
|
|
63100
|
+
},
|
|
63101
|
+
{
|
|
63102
|
+
icon: Presentation,
|
|
63103
|
+
title: "Build a presentation from scratch",
|
|
63104
|
+
prompt: "Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps."
|
|
63105
|
+
},
|
|
63106
|
+
{
|
|
63107
|
+
icon: FileText,
|
|
63108
|
+
title: "Set up a structured spreadsheet",
|
|
63109
|
+
prompt: "Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage."
|
|
63110
|
+
}
|
|
63111
|
+
];
|
|
63112
|
+
const SuggestionCard = ({
|
|
63113
|
+
suggestion,
|
|
63114
|
+
index: index2
|
|
63115
|
+
}) => {
|
|
63116
|
+
const aui = useAui();
|
|
63117
|
+
const Icon2 = suggestion.icon;
|
|
63118
|
+
const handleClick2 = useCallback(() => {
|
|
63119
|
+
aui.thread().append({
|
|
63120
|
+
role: "user",
|
|
63121
|
+
content: [{ type: "text", text: suggestion.prompt }]
|
|
63122
|
+
});
|
|
63123
|
+
}, [aui, suggestion.prompt]);
|
|
63124
|
+
return /* @__PURE__ */ jsxs(
|
|
63125
|
+
"button",
|
|
63126
|
+
{
|
|
63127
|
+
type: "button",
|
|
63128
|
+
onClick: handleClick2,
|
|
63129
|
+
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`,
|
|
63130
|
+
style: { animationDelay: `${100 + index2 * 75}ms` },
|
|
63131
|
+
children: [
|
|
63132
|
+
/* @__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" }) }),
|
|
63133
|
+
/* @__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 }) }),
|
|
63134
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "mt-0.5 size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground" })
|
|
63135
|
+
]
|
|
63136
|
+
}
|
|
63137
|
+
);
|
|
63138
|
+
};
|
|
62837
63139
|
const AthenaChat = ({
|
|
62838
63140
|
className,
|
|
62839
63141
|
welcomeMessage = "Hello there!",
|
|
62840
|
-
welcomeSubtext = "
|
|
63142
|
+
welcomeSubtext = "What can I help you with?",
|
|
62841
63143
|
maxWidth = "44rem",
|
|
62842
63144
|
toolUIs,
|
|
62843
|
-
mentionTools
|
|
63145
|
+
mentionTools,
|
|
63146
|
+
welcomeSuggestions = DEFAULT_SUGGESTIONS
|
|
62844
63147
|
}) => {
|
|
62845
63148
|
const tools = mentionTools ?? EMPTY_MENTION_TOOLS;
|
|
62846
63149
|
const mergedToolUIs = useMemo(() => ({
|
|
@@ -62853,43 +63156,52 @@ const AthenaChat = ({
|
|
|
62853
63156
|
() => () => /* @__PURE__ */ jsx(AssistantMessage, { toolUIs: mergedToolUIs }),
|
|
62854
63157
|
[mergedToolUIs]
|
|
62855
63158
|
);
|
|
62856
|
-
return /* @__PURE__ */
|
|
63159
|
+
return /* @__PURE__ */ jsxs(
|
|
62857
63160
|
ThreadPrimitiveRoot,
|
|
62858
63161
|
{
|
|
62859
63162
|
className: `aui-root aui-thread-root @container flex h-full flex-col bg-background ${className ?? ""}`,
|
|
62860
63163
|
style: { ["--thread-max-width"]: maxWidth, position: "relative" },
|
|
62861
|
-
children:
|
|
62862
|
-
|
|
62863
|
-
|
|
62864
|
-
|
|
62865
|
-
|
|
62866
|
-
|
|
62867
|
-
|
|
62868
|
-
|
|
62869
|
-
/* @__PURE__ */ jsx("
|
|
62870
|
-
|
|
62871
|
-
|
|
62872
|
-
|
|
62873
|
-
|
|
62874
|
-
|
|
62875
|
-
|
|
62876
|
-
|
|
63164
|
+
children: [
|
|
63165
|
+
/* @__PURE__ */ jsx(ThreadLoadingOverlay, {}),
|
|
63166
|
+
/* @__PURE__ */ jsxs(
|
|
63167
|
+
ThreadPrimitiveViewport,
|
|
63168
|
+
{
|
|
63169
|
+
turnAnchor: "top",
|
|
63170
|
+
className: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
|
|
63171
|
+
children: [
|
|
63172
|
+
/* @__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: [
|
|
63173
|
+
/* @__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 }),
|
|
63174
|
+
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 }),
|
|
63175
|
+
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 }, i)) })
|
|
63176
|
+
] }) }) }) }),
|
|
63177
|
+
/* @__PURE__ */ jsx(
|
|
63178
|
+
ThreadPrimitiveMessages,
|
|
63179
|
+
{
|
|
63180
|
+
components: {
|
|
63181
|
+
UserMessage,
|
|
63182
|
+
AssistantMessage: AssistantMessageComponent
|
|
63183
|
+
}
|
|
62877
63184
|
}
|
|
62878
|
-
|
|
62879
|
-
|
|
62880
|
-
|
|
62881
|
-
|
|
62882
|
-
|
|
62883
|
-
|
|
62884
|
-
|
|
63185
|
+
),
|
|
63186
|
+
/* @__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: [
|
|
63187
|
+
/* @__PURE__ */ jsx(ThreadScrollToBottom, {}),
|
|
63188
|
+
/* @__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: [
|
|
63189
|
+
/* @__PURE__ */ jsx(TiptapComposer, { tools }),
|
|
63190
|
+
/* @__PURE__ */ jsx(ComposerAction, {})
|
|
63191
|
+
] })
|
|
62885
63192
|
] })
|
|
62886
|
-
]
|
|
62887
|
-
|
|
62888
|
-
|
|
62889
|
-
|
|
63193
|
+
]
|
|
63194
|
+
}
|
|
63195
|
+
)
|
|
63196
|
+
]
|
|
62890
63197
|
}
|
|
62891
63198
|
);
|
|
62892
63199
|
};
|
|
63200
|
+
const ThreadLoadingOverlay = () => {
|
|
63201
|
+
const remoteId = useAthenaThreadId();
|
|
63202
|
+
if (!remoteId) return null;
|
|
63203
|
+
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" }) }) });
|
|
63204
|
+
};
|
|
62893
63205
|
const ThreadScrollToBottom = () => /* @__PURE__ */ jsx(ThreadPrimitiveScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
62894
63206
|
TooltipIconButton,
|
|
62895
63207
|
{
|
|
@@ -63326,13 +63638,10 @@ function ThreadList({ className }) {
|
|
|
63326
63638
|
] });
|
|
63327
63639
|
}
|
|
63328
63640
|
function ThreadListItem() {
|
|
63329
|
-
return /* @__PURE__ */
|
|
63330
|
-
/* @__PURE__ */
|
|
63331
|
-
|
|
63332
|
-
|
|
63333
|
-
] }),
|
|
63334
|
-
/* @__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" }) })
|
|
63335
|
-
] });
|
|
63641
|
+
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: [
|
|
63642
|
+
/* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5 shrink-0" }),
|
|
63643
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: /* @__PURE__ */ jsx(ThreadListItemPrimitiveTitle, { fallback: "Untitled" }) })
|
|
63644
|
+
] }) });
|
|
63336
63645
|
}
|
|
63337
63646
|
function useAppendToComposer() {
|
|
63338
63647
|
const aui = useAui();
|