@athenaintel/react 0.11.3 → 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/README.md CHANGED
@@ -56,19 +56,32 @@ If `config.appUrl` is omitted, the provider resolves it from the parent bridge o
56
56
 
57
57
  Use `trustedParentOrigins` when the SDK runs inside an iframe on a private-cloud or custom parent domain and you want to explicitly allow postMessage auth/config from that parent.
58
58
 
59
- ## Statewire Transport (opt-in)
59
+ ## Statewire Transport (default as of 0.12.0)
60
60
 
61
- The default chat transport is the legacy Iris `/api/chat` stream. Pass
62
- `transport: 'statewire'` to attach to the deep-agent statewire sync host
63
- instead the thread is hosted server-side and replicated live, so history,
64
- reconnect, and run scheduling come from the server snapshot:
61
+ Statewire is the default chat transport: the SDK attaches to the deep-agent
62
+ statewire sync host, so the thread is hosted server-side and replicated live —
63
+ history, reconnect, run scheduling, mid-run queueing, HITL approvals, and
64
+ client tools (for recognized SDK hosts, e.g. computer-asset `app_id`s) all
65
+ come from the server snapshot. Pass `transport: 'legacy'` to opt a deployment
66
+ back onto the legacy Iris `/api/chat` stream:
65
67
 
66
68
  ```tsx
67
- <AthenaProvider config={{ environment: 'staging', transport: 'statewire' }}>
69
+ <AthenaProvider config={{ environment: 'staging', transport: 'legacy' }}>
68
70
  <AthenaChat />
69
71
  </AthenaProvider>
70
72
  ```
71
73
 
74
+ **Migrating from ≤0.11.x (legacy default):**
75
+
76
+ - Threads are transport-scoped: conversations created on the legacy transport
77
+ are read-only from statewire (and vice versa). Users keep their history but
78
+ continue in new threads.
79
+ - The statewire runtime applies the deep-agent model default when no `model`
80
+ prop is set; pin `model` explicitly if you depended on the legacy default.
81
+ - The `agent` prop's legacy agent names are not honored on statewire; use
82
+ `collab_agent:<id>` refs (with `transport: 'statewire'` semantics) or the
83
+ default agent.
84
+
72
85
  The sync endpoint defaults to the effective `apiUrl` host + `/v2/threads`
73
86
  (e.g. staging resolves to `https://iris.stg.athenaintel.com/v2/threads`, the
74
87
  same statewire base the mobile app and Chrome extension ship); pass
@@ -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.11.3";
75
+ const version$1 = "0.12.1";
76
76
  const packageJson = {
77
77
  version: version$1
78
78
  };
@@ -12564,7 +12564,7 @@ const ATHENA_TRANSPORTS = {
12564
12564
  legacy: "legacy",
12565
12565
  statewire: "statewire"
12566
12566
  };
12567
- const DEFAULT_ATHENA_TRANSPORT = ATHENA_TRANSPORTS.legacy;
12567
+ const DEFAULT_ATHENA_TRANSPORT = ATHENA_TRANSPORTS.statewire;
12568
12568
  function resolveAthenaTransport({
12569
12569
  transport
12570
12570
  }) {
@@ -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
  ] }) }),