@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
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import { runsMaterialize, StatewireThread, useStatewireSendCommand, useStatewire
|
|
|
33
33
|
import { useAuiState } from "@assistant-ui/store";
|
|
34
34
|
import * as ReactDOM from "react-dom";
|
|
35
35
|
import ReactDOM__default, { flushSync } from "react-dom";
|
|
36
|
-
const version$1 = "0.12.
|
|
36
|
+
const version$1 = "0.12.1";
|
|
37
37
|
const packageJson = {
|
|
38
38
|
version: version$1
|
|
39
39
|
};
|
|
@@ -61963,6 +61963,27 @@ const getToolkitDisplayInfo = (id) => {
|
|
|
61963
61963
|
icon: (info == null ? void 0 : info.icon) ?? "Package"
|
|
61964
61964
|
};
|
|
61965
61965
|
};
|
|
61966
|
+
function runActivityKey(parts) {
|
|
61967
|
+
const last = parts[parts.length - 1];
|
|
61968
|
+
if (last === void 0 || last === null || typeof last !== "object") return null;
|
|
61969
|
+
const tail = last;
|
|
61970
|
+
const type = typeof tail["type"] === "string" ? tail["type"] : "unknown";
|
|
61971
|
+
if (type === "text" || type === "reasoning") return null;
|
|
61972
|
+
const argsText = typeof tail["argsText"] === "string" ? tail["argsText"].length : 0;
|
|
61973
|
+
const settled = tail["result"] === void 0 ? 0 : 1;
|
|
61974
|
+
return `${parts.length}:${type}:${argsText}:${settled}`;
|
|
61975
|
+
}
|
|
61976
|
+
const RUN_ACTIVITY_STALL_SECONDS = 30;
|
|
61977
|
+
const RUN_ACTIVITY_COUNTER_SECONDS = 5;
|
|
61978
|
+
function runActivityLabel(seconds) {
|
|
61979
|
+
if (seconds >= RUN_ACTIVITY_STALL_SECONDS) {
|
|
61980
|
+
return `Still working — nothing new for ${seconds}s`;
|
|
61981
|
+
}
|
|
61982
|
+
if (seconds >= RUN_ACTIVITY_COUNTER_SECONDS) {
|
|
61983
|
+
return `Working · ${seconds}s`;
|
|
61984
|
+
}
|
|
61985
|
+
return "Working";
|
|
61986
|
+
}
|
|
61966
61987
|
function QuotePostMessageBridge() {
|
|
61967
61988
|
useQuoteFromPostMessage();
|
|
61968
61989
|
return null;
|
|
@@ -62338,6 +62359,34 @@ const AthenaMessageEmptyIndicator = ({
|
|
|
62338
62359
|
if (hasParts || !isRunning) return null;
|
|
62339
62360
|
return /* @__PURE__ */ jsx(EmptyComponent2, { status: { type: "running" } });
|
|
62340
62361
|
};
|
|
62362
|
+
const AthenaMessageActivityIndicator = () => {
|
|
62363
|
+
const isRunning = useAuiState$1((s) => {
|
|
62364
|
+
var _a3;
|
|
62365
|
+
return ((_a3 = s.message.status) == null ? void 0 : _a3.type) === "running";
|
|
62366
|
+
});
|
|
62367
|
+
const activityKey = useAuiState$1((s) => runActivityKey(s.message.parts));
|
|
62368
|
+
const [seconds, setSeconds] = useState(0);
|
|
62369
|
+
useEffect(() => {
|
|
62370
|
+
setSeconds(0);
|
|
62371
|
+
if (!isRunning || activityKey === null) return;
|
|
62372
|
+
const startedAt = Date.now();
|
|
62373
|
+
const timer = setInterval(() => {
|
|
62374
|
+
setSeconds(Math.floor((Date.now() - startedAt) / 1e3));
|
|
62375
|
+
}, 1e3);
|
|
62376
|
+
return () => clearInterval(timer);
|
|
62377
|
+
}, [isRunning, activityKey]);
|
|
62378
|
+
if (!isRunning || activityKey === null) return null;
|
|
62379
|
+
const stalled = seconds >= RUN_ACTIVITY_STALL_SECONDS;
|
|
62380
|
+
return /* @__PURE__ */ jsxs("div", { className: "aui-run-activity mt-2 flex items-center gap-2 px-1 text-[12px] text-muted-foreground", children: [
|
|
62381
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", "aria-hidden": true, children: [
|
|
62382
|
+
/* @__PURE__ */ jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-current [animation-delay:0ms]" }),
|
|
62383
|
+
/* @__PURE__ */ jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-current [animation-delay:150ms]" }),
|
|
62384
|
+
/* @__PURE__ */ jsx("span", { className: "size-1.5 animate-bounce rounded-full bg-current [animation-delay:300ms]" })
|
|
62385
|
+
] }),
|
|
62386
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: stalled ? "text-amber-600 dark:text-amber-400" : void 0, children: runActivityLabel(seconds) }),
|
|
62387
|
+
/* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", children: stalled ? "Assistant is still working; nothing new for over thirty seconds." : "Assistant is working." })
|
|
62388
|
+
] });
|
|
62389
|
+
};
|
|
62341
62390
|
const AthenaReasoningPart = ({
|
|
62342
62391
|
text: text2,
|
|
62343
62392
|
status,
|
|
@@ -62458,7 +62507,8 @@ const AthenaAssistantMessage = ({
|
|
|
62458
62507
|
ReasoningComponent: effectiveReasoningComponent
|
|
62459
62508
|
}
|
|
62460
62509
|
),
|
|
62461
|
-
/* @__PURE__ */ jsx(SuperGroupingFinalText, { TextComponent })
|
|
62510
|
+
/* @__PURE__ */ jsx(SuperGroupingFinalText, { TextComponent }),
|
|
62511
|
+
/* @__PURE__ */ jsx(AthenaMessageActivityIndicator, {})
|
|
62462
62512
|
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
62463
62513
|
/* @__PURE__ */ jsx(AthenaMessageEmptyIndicator, { EmptyComponent: EmptyComponent2 }),
|
|
62464
62514
|
/* @__PURE__ */ jsx(MessagePrimitive.GroupedParts, { groupBy: noToolGrouping, children: ({ part }) => {
|
|
@@ -62483,7 +62533,8 @@ const AthenaAssistantMessage = ({
|
|
|
62483
62533
|
default:
|
|
62484
62534
|
return null;
|
|
62485
62535
|
}
|
|
62486
|
-
} })
|
|
62536
|
+
} }),
|
|
62537
|
+
/* @__PURE__ */ jsx(AthenaMessageActivityIndicator, {})
|
|
62487
62538
|
] }) }),
|
|
62488
62539
|
/* @__PURE__ */ jsx(MessageError, {})
|
|
62489
62540
|
] }) }),
|