@athenaintel/react 0.9.7 → 0.9.8
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/README.md +20 -0
- package/dist/index.cjs +43 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +34 -6
- package/dist/index.js +44 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -72,7 +72,9 @@ 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.
|
|
75
|
+
/** Suggestion cards shown on the welcome screen. Pass `[]` to hide.
|
|
76
|
+
* For workflow launchers outside AthenaChat, use `useSendMessage()`.
|
|
77
|
+
*/
|
|
76
78
|
welcomeSuggestions?: WelcomeSuggestion[];
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -212,7 +214,7 @@ export declare interface AthenaRuntimeConfig {
|
|
|
212
214
|
export declare interface AthenaTheme {
|
|
213
215
|
/** Brand / accent color. Send button, active states, focus ring, spinner. */
|
|
214
216
|
primary?: string;
|
|
215
|
-
/** Text color on primary background. */
|
|
217
|
+
/** Text color on primary background. Set this with `primary` when you change contrast significantly. */
|
|
216
218
|
primaryForeground?: string;
|
|
217
219
|
/** Page / panel background. */
|
|
218
220
|
background?: string;
|
|
@@ -258,11 +260,11 @@ export declare interface AthenaTheme {
|
|
|
258
260
|
sidebarWidth?: string;
|
|
259
261
|
/** User message bubble background. Falls back to muted. */
|
|
260
262
|
userBubble?: string;
|
|
261
|
-
/** User message bubble text color. Falls back to foreground. */
|
|
263
|
+
/** User message bubble text color. Falls back to foreground. Set this when `userBubble` is dark or saturated. */
|
|
262
264
|
userBubbleForeground?: string;
|
|
263
265
|
/** User message bubble border radius. e.g. '1rem', '0.5rem'. */
|
|
264
266
|
userBubbleRadius?: string;
|
|
265
|
-
/** Assistant message text color. Falls back to foreground. */
|
|
267
|
+
/** Assistant message text color. Falls back to foreground. Set this when `assistantBubble` reduces contrast. */
|
|
266
268
|
assistantForeground?: string;
|
|
267
269
|
/** Assistant message bubble background. Transparent by default. */
|
|
268
270
|
assistantBubble?: string;
|
|
@@ -428,7 +430,7 @@ export declare interface ParentBridgeState {
|
|
|
428
430
|
token: string | null;
|
|
429
431
|
/** Sync server chat URL provided by the Marathon wrapper. */
|
|
430
432
|
apiUrl: string | null;
|
|
431
|
-
/**
|
|
433
|
+
/** Athena backend URL provided by the Marathon wrapper. */
|
|
432
434
|
backendUrl: string | null;
|
|
433
435
|
/** Athena frontend origin provided by the parent wrapper. */
|
|
434
436
|
appUrl: string | null;
|
|
@@ -470,6 +472,14 @@ declare interface ScopeRegistryEntry {
|
|
|
470
472
|
fetchStates: Map<string, FetchState>;
|
|
471
473
|
}
|
|
472
474
|
|
|
475
|
+
export declare interface SendMessageOptions {
|
|
476
|
+
/**
|
|
477
|
+
* Replace the current composer text before sending.
|
|
478
|
+
* Defaults to `true`.
|
|
479
|
+
*/
|
|
480
|
+
replace?: boolean;
|
|
481
|
+
}
|
|
482
|
+
|
|
473
483
|
declare interface SourceContext {
|
|
474
484
|
scope: MenuScope;
|
|
475
485
|
query: string;
|
|
@@ -831,7 +841,10 @@ export declare interface UploadProgress {
|
|
|
831
841
|
}
|
|
832
842
|
|
|
833
843
|
/**
|
|
834
|
-
* Hook to programmatically append text to the composer.
|
|
844
|
+
* Hook to programmatically append text to the composer without sending it.
|
|
845
|
+
*
|
|
846
|
+
* Use `useSendMessage()` for workflow shortcuts or other UI that should
|
|
847
|
+
* immediately submit a prompt.
|
|
835
848
|
*
|
|
836
849
|
* Usage:
|
|
837
850
|
* const append = useAppendToComposer();
|
|
@@ -938,6 +951,21 @@ export declare function useQuote(): QuoteContextValue;
|
|
|
938
951
|
/** Trigger a re-fetch of the thread list. No-op outside of thread list mode. */
|
|
939
952
|
export declare function useRefreshThreadList(): (() => void) | null;
|
|
940
953
|
|
|
954
|
+
/**
|
|
955
|
+
* Hook to programmatically send a user message from anywhere inside AthenaProvider.
|
|
956
|
+
*
|
|
957
|
+
* This is intended for custom workflow buttons, sidebar shortcuts, or other UI
|
|
958
|
+
* that lives outside the AthenaChat thread tree. Unlike `aui.thread().append()`,
|
|
959
|
+
* this uses the provider-scoped composer runtime and does not depend on
|
|
960
|
+
* ThreadPrimitive context.
|
|
961
|
+
*
|
|
962
|
+
* Usage:
|
|
963
|
+
* const sendMessage = useSendMessage();
|
|
964
|
+
* await sendMessage("Run the quarterly workflow");
|
|
965
|
+
* await sendMessage("Add this follow-up", { replace: false });
|
|
966
|
+
*/
|
|
967
|
+
export declare function useSendMessage(): (text: string, options?: SendMessageOptions) => Promise<void>;
|
|
968
|
+
|
|
941
969
|
export declare type ViewMode = 'tabs' | 'tiled';
|
|
942
970
|
|
|
943
971
|
export declare const WebSearchToolUI: ToolCallMessagePartComponent;
|
package/dist/index.js
CHANGED
|
@@ -16473,8 +16473,16 @@ const DEFAULT_ATHENA_ENVIRONMENT = "production";
|
|
|
16473
16473
|
const DEFAULT_API_URL = ATHENA_ENVIRONMENT_URLS.production.apiUrl;
|
|
16474
16474
|
const DEFAULT_BACKEND_URL = ATHENA_ENVIRONMENT_URLS.production.backendUrl;
|
|
16475
16475
|
const DEFAULT_APP_URL = ATHENA_ENVIRONMENT_URLS.production.appUrl;
|
|
16476
|
-
const
|
|
16476
|
+
const MARATHON_APP_PORT = "8082";
|
|
16477
|
+
const SPACES_PATHNAME = "dashboard/spaces/";
|
|
16477
16478
|
const normalizeBaseUrl = (url) => url.replace(/\/+$/, "");
|
|
16479
|
+
const createUrlWithFallback = (url, fallbackUrl) => {
|
|
16480
|
+
try {
|
|
16481
|
+
return new URL(`${normalizeBaseUrl(url)}/`);
|
|
16482
|
+
} catch {
|
|
16483
|
+
return new URL(`${normalizeBaseUrl(fallbackUrl)}/`);
|
|
16484
|
+
}
|
|
16485
|
+
};
|
|
16478
16486
|
const getHostname = (value) => {
|
|
16479
16487
|
if (!value) return null;
|
|
16480
16488
|
try {
|
|
@@ -16496,7 +16504,7 @@ const deriveWorkspaceAppUrl = ({
|
|
|
16496
16504
|
if (!((_a2 = match2 == null ? void 0 : match2.groups) == null ? void 0 : _a2.prefix) || !match2.groups.domain) {
|
|
16497
16505
|
return null;
|
|
16498
16506
|
}
|
|
16499
|
-
return `${parsedUrl.protocol}//${match2.groups.prefix}
|
|
16507
|
+
return `${parsedUrl.protocol}//${match2.groups.prefix}--${MARATHON_APP_PORT}.${match2.groups.domain}`;
|
|
16500
16508
|
} catch {
|
|
16501
16509
|
return null;
|
|
16502
16510
|
}
|
|
@@ -16545,7 +16553,7 @@ function createAthenaSpacesUrl({
|
|
|
16545
16553
|
assetIds,
|
|
16546
16554
|
sessionId
|
|
16547
16555
|
}) {
|
|
16548
|
-
const url = new URL(SPACES_PATHNAME,
|
|
16556
|
+
const url = new URL(SPACES_PATHNAME, createUrlWithFallback(appUrl, DEFAULT_APP_URL));
|
|
16549
16557
|
if (assetIds) {
|
|
16550
16558
|
const normalizedAssetIds = (Array.isArray(assetIds) ? assetIds : [assetIds]).map((assetId) => assetId.trim()).filter((assetId) => assetId.length > 0);
|
|
16551
16559
|
if (normalizedAssetIds.length > 0) {
|
|
@@ -20607,7 +20615,9 @@ const toolMessageSchema = objectType({
|
|
|
20607
20615
|
type: literalType("tool"),
|
|
20608
20616
|
content: toolMessageContentSchema,
|
|
20609
20617
|
tool_call_id: stringType(),
|
|
20610
|
-
name
|
|
20618
|
+
// Some backend/tool result flows omit the tool name entirely.
|
|
20619
|
+
// The converter already treats toolName as optional, so accept that shape.
|
|
20620
|
+
name: nullableToOptionalString,
|
|
20611
20621
|
artifact: anyType().optional(),
|
|
20612
20622
|
status: enumType(["success", "error"]),
|
|
20613
20623
|
additional_kwargs: recordType(stringType(), unknownType()).optional()
|
|
@@ -20774,7 +20784,9 @@ async function listThreads(backendUrl, auth, opts = {}) {
|
|
|
20774
20784
|
body: JSON.stringify({
|
|
20775
20785
|
limit: opts.limit ?? 50,
|
|
20776
20786
|
offset: opts.offset ?? 0,
|
|
20777
|
-
|
|
20787
|
+
// Default to the full recent-conversations set unless a caller
|
|
20788
|
+
// explicitly asks to hide triggered/background sessions.
|
|
20789
|
+
exclude_triggered: opts.exclude_triggered ?? false
|
|
20778
20790
|
})
|
|
20779
20791
|
});
|
|
20780
20792
|
if (!res.ok) {
|
|
@@ -24805,9 +24817,9 @@ function AthenaProvider({
|
|
|
24805
24817
|
const configuredAppUrl = (config2 == null ? void 0 : config2.appUrl) ?? appUrl;
|
|
24806
24818
|
const bridge = useParentBridge();
|
|
24807
24819
|
const effectiveToken = configuredToken !== void 0 ? configuredToken : bridge.token;
|
|
24808
|
-
const effectiveApiUrl = configuredApiUrl ?? bridge.apiUrl ?? environmentUrls.apiUrl
|
|
24809
|
-
const effectiveBackendUrl = configuredBackendUrl ?? bridge.backendUrl ?? environmentUrls.backendUrl
|
|
24810
|
-
const effectiveAppUrl = configuredAppUrl ?? bridge.appUrl ?? deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl }) ?? environmentUrls.appUrl
|
|
24820
|
+
const effectiveApiUrl = configuredApiUrl ?? bridge.apiUrl ?? environmentUrls.apiUrl;
|
|
24821
|
+
const effectiveBackendUrl = configuredBackendUrl ?? bridge.backendUrl ?? environmentUrls.backendUrl;
|
|
24822
|
+
const effectiveAppUrl = configuredAppUrl ?? bridge.appUrl ?? deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl }) ?? environmentUrls.appUrl;
|
|
24811
24823
|
if (!bridge.ready) {
|
|
24812
24824
|
return null;
|
|
24813
24825
|
}
|
|
@@ -60768,7 +60780,7 @@ const TiptapComposer = ({ tools = [] }) => {
|
|
|
60768
60780
|
composerRuntime.send();
|
|
60769
60781
|
}
|
|
60770
60782
|
editor2.commands.clearContent();
|
|
60771
|
-
}, [aui, composerRuntime, clearAttachments, clearQuote]);
|
|
60783
|
+
}, [aui, composerRuntime, clearAttachments, clearQuote, appUrl]);
|
|
60772
60784
|
const handleSubmitRef = useRef(handleSubmit);
|
|
60773
60785
|
handleSubmitRef.current = handleSubmit;
|
|
60774
60786
|
const editor = useEditor({
|
|
@@ -63940,6 +63952,23 @@ const ComposerDropZone = ({
|
|
|
63940
63952
|
}
|
|
63941
63953
|
);
|
|
63942
63954
|
};
|
|
63955
|
+
function useSendMessage() {
|
|
63956
|
+
const aui = useAui();
|
|
63957
|
+
return useCallback(
|
|
63958
|
+
async (text2, options) => {
|
|
63959
|
+
if (!text2.trim()) return;
|
|
63960
|
+
const composer = aui.composer();
|
|
63961
|
+
const currentText = composer.getState().text;
|
|
63962
|
+
const shouldReplace = (options == null ? void 0 : options.replace) ?? true;
|
|
63963
|
+
composer.setText(
|
|
63964
|
+
shouldReplace || !currentText ? text2 : `${currentText}
|
|
63965
|
+
${text2}`
|
|
63966
|
+
);
|
|
63967
|
+
await composer.send();
|
|
63968
|
+
},
|
|
63969
|
+
[aui]
|
|
63970
|
+
);
|
|
63971
|
+
}
|
|
63943
63972
|
const EMPTY_MENTION_TOOLS = [];
|
|
63944
63973
|
function QuotePostMessageBridge() {
|
|
63945
63974
|
useQuoteFromPostMessage();
|
|
@@ -63971,14 +64000,11 @@ const SuggestionCard = ({
|
|
|
63971
64000
|
suggestion,
|
|
63972
64001
|
index: index2
|
|
63973
64002
|
}) => {
|
|
63974
|
-
const aui = useAui();
|
|
63975
64003
|
const Icon2 = suggestion.icon;
|
|
64004
|
+
const sendMessage = useSendMessage();
|
|
63976
64005
|
const handleClick2 = useCallback(() => {
|
|
63977
|
-
|
|
63978
|
-
|
|
63979
|
-
content: [{ type: "text", text: suggestion.prompt }]
|
|
63980
|
-
});
|
|
63981
|
-
}, [aui, suggestion.prompt]);
|
|
64006
|
+
void sendMessage(suggestion.prompt);
|
|
64007
|
+
}, [sendMessage, suggestion.prompt]);
|
|
63982
64008
|
return /* @__PURE__ */ jsxs(
|
|
63983
64009
|
"button",
|
|
63984
64010
|
{
|
|
@@ -64125,7 +64151,7 @@ const ComposerSendWithQuote = () => {
|
|
|
64125
64151
|
editor == null ? void 0 : editor.clear();
|
|
64126
64152
|
clearQuote();
|
|
64127
64153
|
clearAttachments();
|
|
64128
|
-
}, [aui, quote, attachments, isUploading, clearQuote, clearAttachments, editorRef]);
|
|
64154
|
+
}, [aui, quote, attachments, isUploading, clearQuote, clearAttachments, editorRef, appUrl]);
|
|
64129
64155
|
if (hasExtras) {
|
|
64130
64156
|
return /* @__PURE__ */ jsx(
|
|
64131
64157
|
TooltipIconButton,
|
|
@@ -64767,6 +64793,7 @@ export {
|
|
|
64767
64793
|
useParentAuth,
|
|
64768
64794
|
useParentBridge,
|
|
64769
64795
|
useQuote,
|
|
64770
|
-
useRefreshThreadList
|
|
64796
|
+
useRefreshThreadList,
|
|
64797
|
+
useSendMessage
|
|
64771
64798
|
};
|
|
64772
64799
|
//# sourceMappingURL=index.js.map
|