@athenaintel/react 0.12.0 → 0.12.1
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/chat/run-activity.d.ts +18 -0
- package/dist/index.cjs +54 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +54 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run-liveness key for a streaming assistant message.
|
|
3
|
+
*
|
|
4
|
+
* A tool card's spinner says "this call is running"; nothing says the RUN is
|
|
5
|
+
* still alive once parts exist — a stalled stream and a busy one look
|
|
6
|
+
* identical. The activity key summarizes the message tail: it is `null` when
|
|
7
|
+
* no liveness row should show (no parts yet, or a text/reasoning tail that
|
|
8
|
+
* already animates on its own), and otherwise changes whenever anything
|
|
9
|
+
* streams into the tail part — so an elapsed timer keyed on it measures
|
|
10
|
+
* "time since the stream last moved", not just "time since the call began".
|
|
11
|
+
*/
|
|
12
|
+
export declare function runActivityKey(parts: ReadonlyArray<unknown>): string | null;
|
|
13
|
+
/** Seconds without any streamed change before the row flips to a stall tone. */
|
|
14
|
+
export declare const RUN_ACTIVITY_STALL_SECONDS = 30;
|
|
15
|
+
/** Seconds before the row starts showing its elapsed counter. */
|
|
16
|
+
export declare const RUN_ACTIVITY_COUNTER_SECONDS = 5;
|
|
17
|
+
/** The row's label for a given number of seconds since the stream last moved. */
|
|
18
|
+
export declare function runActivityLabel(seconds: number): string;
|
package/dist/index.cjs
CHANGED
|
@@ -72,7 +72,7 @@ function _interopNamespaceDefault(e) {
|
|
|
72
72
|
}
|
|
73
73
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
74
74
|
const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
|
|
75
|
-
const version$1 = "0.12.
|
|
75
|
+
const version$1 = "0.12.1";
|
|
76
76
|
const packageJson = {
|
|
77
77
|
version: version$1
|
|
78
78
|
};
|
|
@@ -62002,6 +62002,27 @@ const getToolkitDisplayInfo = (id) => {
|
|
|
62002
62002
|
icon: (info == null ? void 0 : info.icon) ?? "Package"
|
|
62003
62003
|
};
|
|
62004
62004
|
};
|
|
62005
|
+
function runActivityKey(parts) {
|
|
62006
|
+
const last = parts[parts.length - 1];
|
|
62007
|
+
if (last === void 0 || last === null || typeof last !== "object") return null;
|
|
62008
|
+
const tail = last;
|
|
62009
|
+
const type = typeof tail["type"] === "string" ? tail["type"] : "unknown";
|
|
62010
|
+
if (type === "text" || type === "reasoning") return null;
|
|
62011
|
+
const argsText = typeof tail["argsText"] === "string" ? tail["argsText"].length : 0;
|
|
62012
|
+
const settled = tail["result"] === void 0 ? 0 : 1;
|
|
62013
|
+
return `${parts.length}:${type}:${argsText}:${settled}`;
|
|
62014
|
+
}
|
|
62015
|
+
const RUN_ACTIVITY_STALL_SECONDS = 30;
|
|
62016
|
+
const RUN_ACTIVITY_COUNTER_SECONDS = 5;
|
|
62017
|
+
function runActivityLabel(seconds) {
|
|
62018
|
+
if (seconds >= RUN_ACTIVITY_STALL_SECONDS) {
|
|
62019
|
+
return `Still working — nothing new for ${seconds}s`;
|
|
62020
|
+
}
|
|
62021
|
+
if (seconds >= RUN_ACTIVITY_COUNTER_SECONDS) {
|
|
62022
|
+
return `Working · ${seconds}s`;
|
|
62023
|
+
}
|
|
62024
|
+
return "Working";
|
|
62025
|
+
}
|
|
62005
62026
|
function QuotePostMessageBridge() {
|
|
62006
62027
|
useQuoteFromPostMessage();
|
|
62007
62028
|
return null;
|
|
@@ -62377,6 +62398,34 @@ const AthenaMessageEmptyIndicator = ({
|
|
|
62377
62398
|
if (hasParts || !isRunning) return null;
|
|
62378
62399
|
return /* @__PURE__ */ jsxRuntime.jsx(EmptyComponent2, { status: { type: "running" } });
|
|
62379
62400
|
};
|
|
62401
|
+
const AthenaMessageActivityIndicator = () => {
|
|
62402
|
+
const isRunning = react$1.useAuiState((s) => {
|
|
62403
|
+
var _a3;
|
|
62404
|
+
return ((_a3 = s.message.status) == null ? void 0 : _a3.type) === "running";
|
|
62405
|
+
});
|
|
62406
|
+
const activityKey = react$1.useAuiState((s) => runActivityKey(s.message.parts));
|
|
62407
|
+
const [seconds, setSeconds] = React.useState(0);
|
|
62408
|
+
React.useEffect(() => {
|
|
62409
|
+
setSeconds(0);
|
|
62410
|
+
if (!isRunning || activityKey === null) return;
|
|
62411
|
+
const startedAt = Date.now();
|
|
62412
|
+
const timer = setInterval(() => {
|
|
62413
|
+
setSeconds(Math.floor((Date.now() - startedAt) / 1e3));
|
|
62414
|
+
}, 1e3);
|
|
62415
|
+
return () => clearInterval(timer);
|
|
62416
|
+
}, [isRunning, activityKey]);
|
|
62417
|
+
if (!isRunning || activityKey === null) return null;
|
|
62418
|
+
const stalled = seconds >= RUN_ACTIVITY_STALL_SECONDS;
|
|
62419
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-run-activity mt-2 flex items-center gap-2 px-1 text-[12px] text-muted-foreground", children: [
|
|
62420
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", "aria-hidden": true, children: [
|
|
62421
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-current [animation-delay:0ms]" }),
|
|
62422
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-current [animation-delay:150ms]" }),
|
|
62423
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-current [animation-delay:300ms]" })
|
|
62424
|
+
] }),
|
|
62425
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: stalled ? "text-amber-600 dark:text-amber-400" : void 0, children: runActivityLabel(seconds) }),
|
|
62426
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-live": "polite", className: "sr-only", children: stalled ? "Assistant is still working; nothing new for over thirty seconds." : "Assistant is working." })
|
|
62427
|
+
] });
|
|
62428
|
+
};
|
|
62380
62429
|
const AthenaReasoningPart = ({
|
|
62381
62430
|
text: text2,
|
|
62382
62431
|
status,
|
|
@@ -62497,7 +62546,8 @@ const AthenaAssistantMessage = ({
|
|
|
62497
62546
|
ReasoningComponent: effectiveReasoningComponent
|
|
62498
62547
|
}
|
|
62499
62548
|
),
|
|
62500
|
-
/* @__PURE__ */ jsxRuntime.jsx(SuperGroupingFinalText, { TextComponent })
|
|
62549
|
+
/* @__PURE__ */ jsxRuntime.jsx(SuperGroupingFinalText, { TextComponent }),
|
|
62550
|
+
/* @__PURE__ */ jsxRuntime.jsx(AthenaMessageActivityIndicator, {})
|
|
62501
62551
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
62502
62552
|
/* @__PURE__ */ jsxRuntime.jsx(AthenaMessageEmptyIndicator, { EmptyComponent: EmptyComponent2 }),
|
|
62503
62553
|
/* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePrimitive.GroupedParts, { groupBy: noToolGrouping, children: ({ part }) => {
|
|
@@ -62522,7 +62572,8 @@ const AthenaAssistantMessage = ({
|
|
|
62522
62572
|
default:
|
|
62523
62573
|
return null;
|
|
62524
62574
|
}
|
|
62525
|
-
} })
|
|
62575
|
+
} }),
|
|
62576
|
+
/* @__PURE__ */ jsxRuntime.jsx(AthenaMessageActivityIndicator, {})
|
|
62526
62577
|
] }) }),
|
|
62527
62578
|
/* @__PURE__ */ jsxRuntime.jsx(MessageError, {})
|
|
62528
62579
|
] }) }),
|