@athenaintel/react 0.18.0 → 0.19.0

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.
Files changed (101) hide show
  1. package/README.md +106 -4
  2. package/dist/SuperGroupingCard-BsWbHyV_.js +795 -0
  3. package/dist/SuperGroupingCard-BsWbHyV_.js.map +1 -0
  4. package/dist/SuperGroupingCard-CRRFUgjN.cjs +794 -0
  5. package/dist/SuperGroupingCard-CRRFUgjN.cjs.map +1 -0
  6. package/dist/chat/StatewireApprovalCard.d.ts +59 -2
  7. package/dist/chat/StatewireClientToolBridge.d.ts +3 -3
  8. package/dist/chat/StatewireQueuedMessages.d.ts +105 -6
  9. package/dist/chat/statewire-approval.d.ts +1 -1
  10. package/dist/chat/statewire-client-tools.d.ts +15 -21
  11. package/dist/chat/super-grouping/CollapsibleGroup.d.ts +52 -11
  12. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +78 -21
  13. package/dist/chat/super-grouping/activity-timeline.d.ts +91 -0
  14. package/dist/chat/super-grouping/grouping-function.d.ts +13 -10
  15. package/dist/chat/super-grouping/index.d.ts +12 -0
  16. package/dist/chat/super-grouping/toolkit-map.d.ts +8 -1
  17. package/dist/chat/use-statewire-approval-request.d.ts +44 -0
  18. package/dist/chat-ui/header/conversation-history-panel.d.ts +11 -1
  19. package/dist/chat-ui/index.d.ts +7 -1
  20. package/dist/chat-ui/mentions/suggestions/shims.d.ts +0 -4
  21. package/dist/chat-ui/messages/runtime-message.d.ts +2 -3
  22. package/dist/chat-ui/messages/statewire-continue-run.d.ts +48 -7
  23. package/dist/chat-ui/messages/user-edit-composer.d.ts +5 -2
  24. package/dist/chat-ui/statewire.d.ts +19 -0
  25. package/dist/chat-ui/thread/chat-thread-shell.d.ts +7 -1
  26. package/dist/chat-ui/thread/statewire-history-edge.d.ts +52 -0
  27. package/dist/chat-ui-statewire.cjs +25 -0
  28. package/dist/chat-ui-statewire.cjs.map +1 -0
  29. package/dist/chat-ui-statewire.js +25 -0
  30. package/dist/chat-ui-statewire.js.map +1 -0
  31. package/dist/chat-ui.cjs +174 -357
  32. package/dist/chat-ui.cjs.map +1 -1
  33. package/dist/chat-ui.js +173 -355
  34. package/dist/chat-ui.js.map +1 -1
  35. package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
  36. package/dist/diagnostics/errors.d.ts +4 -0
  37. package/dist/index.cjs +2222 -5183
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.ts +21 -6
  40. package/dist/index.js +4193 -7151
  41. package/dist/index.js.map +1 -1
  42. package/dist/misc-tool-uis-B2e0Okkn.cjs +43 -0
  43. package/dist/misc-tool-uis-B2e0Okkn.cjs.map +1 -0
  44. package/dist/misc-tool-uis-gAiQw0Yl.js +44 -0
  45. package/dist/misc-tool-uis-gAiQw0Yl.js.map +1 -0
  46. package/dist/provider/AthenaProvider.d.ts +4 -2
  47. package/dist/provider/config.d.ts +9 -2
  48. package/dist/provider/statewire-window-context.d.ts +12 -0
  49. package/dist/runtime/statewire-auth-headers.d.ts +38 -0
  50. package/dist/runtime/statewire-lifecycle.d.ts +25 -0
  51. package/dist/runtime/statewire-session-key.d.ts +13 -0
  52. package/dist/runtime/useAthenaStatewireRuntime.d.ts +36 -5
  53. package/dist/statewire-continue-run-D34gS7_1.js +132 -0
  54. package/dist/statewire-continue-run-D34gS7_1.js.map +1 -0
  55. package/dist/statewire-continue-run-nE9VCKUh.cjs +131 -0
  56. package/dist/statewire-continue-run-nE9VCKUh.cjs.map +1 -0
  57. package/dist/statewire-history-edge-C8uyTEjX.cjs +1711 -0
  58. package/dist/statewire-history-edge-C8uyTEjX.cjs.map +1 -0
  59. package/dist/statewire-history-edge-CPohUKMt.js +1712 -0
  60. package/dist/statewire-history-edge-CPohUKMt.js.map +1 -0
  61. package/dist/styles.css +1 -1
  62. package/dist/super-grouping.cjs +22 -0
  63. package/dist/super-grouping.cjs.map +1 -0
  64. package/dist/super-grouping.js +22 -0
  65. package/dist/super-grouping.js.map +1 -0
  66. package/dist/threads/mint-thread-id.d.ts +8 -0
  67. package/dist/threads/statewire-thread-list.d.ts +20 -4
  68. package/dist/tool-fallback-DkQ3DLkn.js +4281 -0
  69. package/dist/tool-fallback-DkQ3DLkn.js.map +1 -0
  70. package/dist/tool-fallback-kfhpJQZa.cjs +4297 -0
  71. package/dist/tool-fallback-kfhpJQZa.cjs.map +1 -0
  72. package/dist/tools/index.d.ts +14 -0
  73. package/dist/tools/misc-tool-uis.d.ts +2 -0
  74. package/dist/tools/primitives.d.ts +41 -0
  75. package/dist/tools/tool-fallback.d.ts +78 -6
  76. package/dist/tools/tool-icons.d.ts +10 -0
  77. package/dist/tools/tool-uis.d.ts +1 -23
  78. package/dist/tools.cjs +41 -0
  79. package/dist/tools.cjs.map +1 -0
  80. package/dist/tools.js +41 -0
  81. package/dist/tools.js.map +1 -0
  82. package/dist/trash-2-B5OaNAL7.cjs +5096 -0
  83. package/dist/trash-2-B5OaNAL7.cjs.map +1 -0
  84. package/dist/trash-2-CCwSURL-.js +5081 -0
  85. package/dist/trash-2-CCwSURL-.js.map +1 -0
  86. package/dist/{use-rest-conversation-history-Dm0rdQgT.cjs → use-rest-conversation-history-Cm8qMRxp.cjs} +445 -5406
  87. package/dist/use-rest-conversation-history-Cm8qMRxp.cjs.map +1 -0
  88. package/dist/{use-rest-conversation-history-Bs5qn5G3.js → use-rest-conversation-history-veDZS-oL.js} +491 -5452
  89. package/dist/use-rest-conversation-history-veDZS-oL.js.map +1 -0
  90. package/dist/wrench-BEf72cyP.cjs +417 -0
  91. package/dist/wrench-BEf72cyP.cjs.map +1 -0
  92. package/dist/wrench-CbrOlVYm.js +418 -0
  93. package/dist/wrench-CbrOlVYm.js.map +1 -0
  94. package/dist/x-Dfd2NzK0.cjs +42 -0
  95. package/dist/x-Dfd2NzK0.cjs.map +1 -0
  96. package/dist/x-_DntAa_a.js +43 -0
  97. package/dist/x-_DntAa_a.js.map +1 -0
  98. package/package.json +29 -11
  99. package/dist/chat/super-grouping/tool-status-labels.d.ts +0 -1
  100. package/dist/use-rest-conversation-history-Bs5qn5G3.js.map +0 -1
  101. package/dist/use-rest-conversation-history-Dm0rdQgT.cjs.map +0 -1
@@ -0,0 +1,91 @@
1
+ /**
2
+ * The assistant turn's activity timeline — the one derivation of "what did
3
+ * this turn do, and how did each step end" behind the grouped
4
+ * ("conversational") view on every surface: the SDK's `AthenaChat`, Olympus's
5
+ * Spaces chat, and the Chrome extension. Pure functions over assistant-ui
6
+ * message parts; `SuperGroupingCard` renders them.
7
+ *
8
+ * Step states come from the shared classifier (`classifyToolResult`) plus the
9
+ * approval outcomes a part carries (`approval`, `interrupt`, a rejection
10
+ * result), so a call that reads as failed, paused, or rejected on one surface
11
+ * cannot read as a green check on another. Copy comes from the shared tool
12
+ * display registry (`toolStatusLabel`).
13
+ */
14
+ import type { MessageStatus, ThreadAssistantMessagePart } from '@assistant-ui/react';
15
+ import { type ToolStatusLabelState } from '@athenaintel/agent-runtime';
16
+ import type { GroupingFunction } from './grouping-function';
17
+ export type ActivityToolState = ToolStatusLabelState;
18
+ export type ActivityItem = {
19
+ kind: 'reasoning';
20
+ text: string;
21
+ state: 'running' | 'complete';
22
+ } | {
23
+ kind: 'tool';
24
+ toolName: string;
25
+ state: ActivityToolState;
26
+ };
27
+ /** The turn as a whole: still working, parked on the person, ended in error, or done. */
28
+ export type ActivityPhase = 'running' | 'waiting' | 'complete' | 'error';
29
+ type ToolCallPart = Extract<ThreadAssistantMessagePart, {
30
+ type: 'tool-call';
31
+ }>;
32
+ export interface ActivityTimelineOptions {
33
+ /**
34
+ * Tools whose unresolved call means the turn is waiting on the person even
35
+ * without an interrupt or approval on the part (the Chrome extension's
36
+ * device plan approval, which the tool UI itself collects).
37
+ */
38
+ waitingTools?: ReadonlySet<string>;
39
+ /**
40
+ * Tools whose result is an application payload relayed verbatim (the Chrome
41
+ * extension's page JavaScript), so a `success: false` flag counts only with
42
+ * an error detail — see `classifyToolResult`'s `passThroughPayload`.
43
+ */
44
+ passThroughTools?: ReadonlySet<string>;
45
+ }
46
+ /** How one tool call ended (or is going), reading the approval fields before the result. */
47
+ export declare function getActivityToolState(part: ToolCallPart, messageStatus: MessageStatus | undefined, { waitingTools, passThroughTools }?: ActivityTimelineOptions): ActivityToolState;
48
+ /**
49
+ * The compact reasoning/tool timeline in the order the parts streamed.
50
+ *
51
+ * A reasoning part is still streaming only while it is the final part of a
52
+ * running message — once any later part appears, the thought has settled.
53
+ * Settled reasoning parts with no text are dropped so the list never shows an
54
+ * empty thinking row.
55
+ */
56
+ export declare function buildActivityTimeline(content: readonly ThreadAssistantMessagePart[] | undefined, messageStatus: MessageStatus | undefined, options?: ActivityTimelineOptions): ActivityItem[];
57
+ /** Number of tool calls in the timeline. */
58
+ export declare function countActivityTools(timeline: readonly ActivityItem[]): number;
59
+ /**
60
+ * The turn's phase. Waiting on the person wins over everything (a host can
61
+ * also assert it — Olympus's allotment store knows about `ask`), then the
62
+ * message's own status.
63
+ */
64
+ export declare function resolveActivityPhase(status: MessageStatus | undefined, timeline: readonly ActivityItem[], { waitingForInput }?: {
65
+ waitingForInput?: boolean;
66
+ }): ActivityPhase;
67
+ /**
68
+ * The status-row copy for one step. `resolveToolDisplayName` lets a host with
69
+ * a richer tool catalog name tools the shared registry has no entry for.
70
+ */
71
+ export declare function getActivityItemLabel(item: ActivityItem, resolveToolDisplayName?: (toolName: string) => string | undefined): string;
72
+ /** The collapsed-card summary of a finished turn. */
73
+ export declare function getActivitySummary(timeline: readonly ActivityItem[]): string;
74
+ /** The part shape the final-text read needs; any message role's parts satisfy it. */
75
+ export type FinalTextPart = {
76
+ readonly type: string;
77
+ readonly text?: string;
78
+ };
79
+ /**
80
+ * The visible answer of a grouped turn: the text after the final tool call,
81
+ * or all of it when the turn never called a tool. Intermediate text (before
82
+ * or between tool calls) stays available in the details panel.
83
+ */
84
+ export declare function getFinalText(content: readonly FinalTextPart[] | undefined): string | null;
85
+ /**
86
+ * Keep the final answer out of the details panel: it renders below the card
87
+ * (`SuperGroupingFinalText`), so the details grouping drops every text part
88
+ * after the last tool call and any group that becomes empty.
89
+ */
90
+ export declare function excludeFinalTextFromGroups(grouping: GroupingFunction): GroupingFunction;
91
+ export {};
@@ -1,19 +1,22 @@
1
1
  import type { GetToolGroupKey } from './toolkit-map';
2
- type AnyPart = {
2
+ /** The part shape grouping needs; assistant-ui's `ThreadAssistantMessagePart` satisfies it. */
3
+ export type GroupablePart = {
3
4
  type: string;
4
5
  toolName?: string;
5
6
  };
6
- type MessagePartGroup = {
7
+ /** One group `MessagePrimitive.Unstable_PartsGrouped` renders through its `Group` component. */
8
+ export type MessagePartGroup = {
7
9
  groupKey: string | undefined;
8
10
  indices: number[];
9
11
  };
12
+ /** The grouping contract `MessagePrimitive.Unstable_PartsGrouped` consumes. */
13
+ export type GroupingFunction = (parts: readonly GroupablePart[]) => MessagePartGroup[];
10
14
  /**
11
- * Ported from Olympus `toolBasedGroupingFunction` in
12
- * `olympus/src/utils/assistantGrouping.ts`. Groups adjacent parts by their
13
- * toolkit group key, lets reasoning parts join the active group, and pulls
14
- * text parts into a group when both surrounding tool-call groups share the
15
- * same key. Returns the group descriptor that `MessagePrimitive.Unstable_PartsGrouped`
16
- * consumes.
15
+ * Groups adjacent parts by their toolkit group key: reasoning parts join the
16
+ * open group, and a text part joins when the tool calls on both sides of it
17
+ * share a key. Every `getToolGroupKey` call sees the open group's key and the
18
+ * set of tools the message called, so a tool shared by several toolkits can
19
+ * resolve to the one actually in play (Olympus attributes shared citation
20
+ * tools to the enabled toolkit that way).
17
21
  */
18
- export declare const createToolBasedGroupingFunction: (getToolGroupKey: GetToolGroupKey) => (parts: readonly AnyPart[]) => MessagePartGroup[];
19
- export {};
22
+ export declare const createToolBasedGroupingFunction: (getToolGroupKey: GetToolGroupKey) => GroupingFunction;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@athenaintel/react/super-grouping` — the grouped ("conversational") view of
3
+ * an assistant turn: the activity card, its per-toolkit collapsible blocks,
4
+ * the timeline derivation behind them, and the tool-based grouping function.
5
+ * A lean entry so hosts with their own thread (Olympus, the Chrome extension)
6
+ * mount it from source without the SDK's composer stack.
7
+ */
8
+ export { type ActivityItem, type ActivityPhase, type ActivityTimelineOptions, type ActivityToolState, buildActivityTimeline, countActivityTools, excludeFinalTextFromGroups, type FinalTextPart, getActivityItemLabel, getActivitySummary, getActivityToolState, getFinalText, resolveActivityPhase, } from './activity-timeline';
9
+ export { CollapsibleGroup, type CollapsibleGroupProps, DEFAULT_TOOLKIT_THEME, SuperGroupingProvider, TOOLKIT_THEMES, type ToolkitTheme, } from './CollapsibleGroup';
10
+ export { createToolBasedGroupingFunction, type GroupablePart, type GroupingFunction, type MessagePartGroup, } from './grouping-function';
11
+ export { resetRememberedExpansionsForTests, SuperGroupingCard, type SuperGroupingCardProps, SuperGroupingFinalText, useActivityExpansion, } from './SuperGroupingCard';
12
+ export { defaultGetToolGroupKey, type GetToolGroupKey, type ToolGroupKeyOptions } from './toolkit-map';
@@ -1,6 +1,12 @@
1
1
  export type ToolGroupKeyOptions = {
2
2
  /** Display name of the surrounding group, when one is already open. */
3
3
  preferredGroupKey?: string;
4
+ /**
5
+ * Distinct tool names the message called. Hosts with a toolkit catalog use
6
+ * it to attribute a tool shared by several toolkits to the one the message
7
+ * leans on; the default map ignores it.
8
+ */
9
+ calledToolNames?: ReadonlySet<string>;
4
10
  };
5
11
  /**
6
12
  * Default `getToolGroupKey` implementation used by the SDK's tool grouping.
@@ -8,7 +14,8 @@ export type ToolGroupKeyOptions = {
8
14
  * is ungrouped or unknown. Context-only tools inherit the surrounding group
9
15
  * and are otherwise ungrouped.
10
16
  *
11
- * Override per-app by passing `getToolGroupKey` to `<AthenaChat>`.
17
+ * Override per-app by passing `getToolGroupKey` (or a whole `groupingFunction`) to
18
+ * `SuperGroupingCard`.
12
19
  */
13
20
  export declare const defaultGetToolGroupKey: (toolName: string, options?: ToolGroupKeyOptions) => string | undefined;
14
21
  export type GetToolGroupKey = (toolName: string, options?: ToolGroupKeyOptions) => string | undefined;
@@ -0,0 +1,44 @@
1
+ import type { StatewireThread } from '@assistant-ui/react-statewire';
2
+ import { type AbandonedInputRequest, type HitlApprovalPayload, type PendingActionRequest } from '@athenaintel/agent-runtime';
3
+ /** Selects which pending interrupt an approval surface answers. */
4
+ export type StatewireInterruptPredicate = (request: StatewireThread.InputRequestState) => request is StatewireThread.CustomInputRequest;
5
+ export interface UseStatewireApprovalRequestOptions {
6
+ /**
7
+ * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`
8
+ * (client-tool parks excluded — the client-tool bridge owns those, and a
9
+ * generic resume would corrupt the parked tool call).
10
+ */
11
+ interruptPredicate?: StatewireInterruptPredicate;
12
+ /**
13
+ * How long a sent decision keeps the actions locked when no resume run ever
14
+ * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.
15
+ */
16
+ pendingResumeGraceMs?: number;
17
+ }
18
+ export interface StatewireApprovalRequest<TValue> {
19
+ /** The pending interrupt this surface answers, if any. */
20
+ request: StatewireThread.CustomInputRequest | undefined;
21
+ requestId: string | undefined;
22
+ /** The payload narrowed to the Athena HITL approval shape, or `null`. */
23
+ hitl: HitlApprovalPayload | null;
24
+ /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */
25
+ actionRequests: PendingActionRequest[];
26
+ /** An interrupt a non-resume dispatch dropped — the "approval was cancelled" notice. */
27
+ abandonedInterrupt: AbandonedInputRequest | undefined;
28
+ /** True after a resume until the request identity changes (or recovery fires). */
29
+ pending: boolean;
30
+ /** Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`. */
31
+ resume: (value: TValue) => void;
32
+ }
33
+ /**
34
+ * The headless half of every statewire approval surface: selects the pending
35
+ * interrupt from the runs projection, narrows its payload, reads the
36
+ * host-published abandoned interrupts, and wires the shared optimistic resume
37
+ * lock to the thread's `run/input` command. `StatewireApprovalCard` renders
38
+ * over it; hosts with their own decision UI (per-lane subagent cards) build
39
+ * on it directly so the selection and lock semantics cannot drift.
40
+ *
41
+ * Requires a statewire aui scope (throws outside one, like every
42
+ * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.
43
+ */
44
+ export declare function useStatewireApprovalRequest<TValue extends StatewireThread.InputResponse = Record<string, string>>(options?: UseStatewireApprovalRequestOptions): StatewireApprovalRequest<TValue>;
@@ -23,5 +23,15 @@ export interface ConversationHistoryPanelProps {
23
23
  hasNextPage?: boolean;
24
24
  isFetchingNextPage?: boolean;
25
25
  onLoadMore?: () => void;
26
+ /**
27
+ * The pointer has rested on a conversation row for `hoverIntentDelayMs`:
28
+ * the user is likely to open it next. Hosts wake and pre-dial the thread
29
+ * here so the click lands on a warm instance with its hello in hand.
30
+ */
31
+ onHoverIntent?: (threadId: string) => void;
32
+ /** The pointer left a row whose intent had fired. */
33
+ onHoverIntentEnd?: (threadId: string) => void;
34
+ /** Dwell before a hover counts as intent; a pass-through never fires. */
35
+ hoverIntentDelayMs?: number;
26
36
  }
27
- export declare function ConversationHistoryPanel({ conversations, activeThreadId, search, onSearchChange, activityFilter, onActivityFilterChange, originFilter, onOriginFilterChange, onSelect, onNewChat, onRefresh, onArchive, onSetReadState, isLoading, isRefreshing, hasNextPage, isFetchingNextPage, onLoadMore, }: ConversationHistoryPanelProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function ConversationHistoryPanel({ conversations, activeThreadId, search, onSearchChange, activityFilter, onActivityFilterChange, originFilter, onOriginFilterChange, onSelect, onNewChat, onRefresh, onArchive, onSetReadState, isLoading, isRefreshing, hasNextPage, isFetchingNextPage, onLoadMore, onHoverIntent, onHoverIntentEnd, hoverIntentDelayMs, }: ConversationHistoryPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,8 @@ export { ChatThreadShell } from "./thread/chat-thread-shell";
11
11
  export type { ChatThreadMessageComponents, ChatThreadShellProps, } from "./thread/chat-thread-shell";
12
12
  export { ChatComposerDock } from "./thread/chat-composer-dock";
13
13
  export type { ChatComposerDockProps } from "./thread/chat-composer-dock";
14
+ export { HISTORY_EDGE_NEAR_MARGIN_PX, HistoryEdgeRow, type HistoryEdgeRowProps, StatewireHistoryEdge, type StatewireHistoryEdgeProps, THREAD_VIEWPORT_ATTR, } from "./thread/statewire-history-edge";
15
+ export { StatewireToolOutputsContext, useStatewireToolOutputs, } from "../provider/statewire-window-context";
14
16
  export { ComposerSendOrStop } from "./thread/composer-send-or-stop";
15
17
  export type { ComposerSendOrStopComponents, ComposerSendOrStopProps, ComposerStopControls, ComposerSubmitHandle, } from "./thread/composer-send-or-stop";
16
18
  export { ChatHeader, ChatHeaderActions, ChatHeaderIdentity, ChatHeaderRoot, } from './header/chat-header';
@@ -38,4 +40,8 @@ export { TextShimmerLoader, ThreadRunningIndicator, } from "./messages/running-i
38
40
  export { SignInCard, SignInConsent, SignInFallbackSection, SignInSecondaryButton, SignInSelect, SignInTextField, } from "./auth/sign-in-card";
39
41
  export { RuntimeMessageCard, type RuntimeMessageCardProps } from "./messages/runtime-message";
40
42
  export { ContinuePill } from "./messages/continue-pill";
41
- export { StatewireContinueRunAffordance, StatewireContinueRunButton, type StatewireContinueRunButtonProps, StatewireRunEndedFooter, type StatewireRunEndedFooterProps, } from "./messages/statewire-continue-run";
43
+ export { type ReadStatewireTailEnding, StatewireContinueRunAffordance, StatewireContinueRunButton, type StatewireContinueRunButtonProps, StatewireRunEndedFooter, type StatewireRunEndedFooterActionsContext, type StatewireRunEndedFooterProps, type StatewireTailEnding, } from "./messages/statewire-continue-run";
44
+ export { StatewireApprovalCard, type StatewireApprovalCardProps, type StatewireApprovalRequestContext, } from "../chat/StatewireApprovalCard";
45
+ export { type StatewireApprovalRequest, type StatewireInterruptPredicate, type UseStatewireApprovalRequestOptions, useStatewireApprovalRequest, } from "../chat/use-statewire-approval-request";
46
+ export { StatewireQueuedMessages, type StatewireQueueEditorContext, type StatewireQueueEvent, type StatewireQueueRowContentContext, type StatewireQueuedMessagesProps, } from "../chat/StatewireQueuedMessages";
47
+ export { HITL_PENDING_RESUME_GRACE_MS } from "@athenaintel/agent-runtime";
@@ -13,7 +13,3 @@ export declare const useDebugMenuStore: () => {
13
13
  export declare function Spinner({ className }: {
14
14
  className?: string;
15
15
  }): import("react/jsx-runtime").JSX.Element;
16
- export declare const toast: {
17
- error: (msg: string) => void;
18
- success: (msg: string) => void;
19
- };
@@ -7,12 +7,11 @@
7
7
  * from the same {@link AthenaRuntimeMessage} so the taxonomy cannot drift.
8
8
  */
9
9
  import { type AthenaRuntimeMessage } from "@athenaintel/agent-runtime";
10
- import type { FC, ReactNode } from "react";
11
- export interface RuntimeMessageCardProps {
10
+ import type { ComponentPropsWithoutRef, FC, ReactNode } from "react";
11
+ export interface RuntimeMessageCardProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "role"> {
12
12
  message: AthenaRuntimeMessage;
13
13
  /** An inline affordance (e.g. a Continue button) rendered inside the card. */
14
14
  action?: ReactNode;
15
- className?: string;
16
15
  }
17
16
  /**
18
17
  * The status row for a runtime ending. For `stopped` / `paused` / `failed` it
@@ -1,4 +1,6 @@
1
- import type { ReactElement } from "react";
1
+ import { type ThreadMessage } from "@assistant-ui/react";
2
+ import { type AthenaRuntimeMessageKind, type DeepAgentThreadStatus } from "@athenaintel/agent-runtime";
3
+ import type { ReactElement, ReactNode } from "react";
2
4
  export interface StatewireContinueRunButtonProps {
3
5
  /**
4
6
  * Also offer Continue while the thread projects `ready`. An old snapshot
@@ -6,6 +8,14 @@ export interface StatewireContinueRunButtonProps {
6
8
  * continuable; the marker row that mounts this button knows that.
7
9
  */
8
10
  allowReadyFallback?: boolean;
11
+ /**
12
+ * Called as the continue dispatches (after the pill's exit animation) —
13
+ * the host's telemetry hook. Receives the settled status and live run id.
14
+ */
15
+ onContinue?: (context: {
16
+ status: DeepAgentThreadStatus;
17
+ runId: string | null;
18
+ }) => void;
9
19
  }
10
20
  /**
11
21
  * Dispatches the bare `run/continue` for the live Statewire thread — the
@@ -14,10 +24,12 @@ export interface StatewireContinueRunButtonProps {
14
24
  * optimistic running-flip (the pill unmounts once the dispatch is accepted)
15
25
  * and routes rejections to the runtime's shared `onError` policy.
16
26
  *
17
- * Requires `capabilities.continue` on the host thread and a statewire aui
18
- * scope (throws outside one, like every `useStatewire*` hook).
27
+ * Gated on the LIVE thread status, never on the persisted marker: markers live
28
+ * in the transcript forever, while continuability is a property of the
29
+ * current run state. Requires `capabilities.continue` on the host thread and
30
+ * a statewire aui scope (throws outside one, like every `useStatewire*` hook).
19
31
  */
20
- export declare function StatewireContinueRunButton({ allowReadyFallback, }?: StatewireContinueRunButtonProps): ReactElement | null;
32
+ export declare function StatewireContinueRunButton({ allowReadyFallback, onContinue, }?: StatewireContinueRunButtonProps): ReactElement | null;
21
33
  /**
22
34
  * Recovery affordance for the latest persisted stopped/failed run marker,
23
35
  * for the `runtimeMessageAction` slot of `createAssistantMessage`.
@@ -27,15 +39,44 @@ export declare function StatewireContinueRunButton({ allowReadyFallback, }?: Sta
27
39
  * legacy runtimes where they would throw.
28
40
  */
29
41
  export declare function StatewireContinueRunAffordance(): ReactElement | null;
42
+ /** The ending a transcript row paints, as the footer needs to know it. */
43
+ export interface StatewireTailEnding {
44
+ kind: AthenaRuntimeMessageKind;
45
+ /** A send-now cancellation: kept in the data, painted as nothing. */
46
+ silent: boolean;
47
+ }
48
+ /** Reads the runtime ending (marker or handoff) a message row renders, if any. */
49
+ export type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;
50
+ export interface StatewireRunEndedFooterActionsContext {
51
+ /** The live settled status the footer describes. */
52
+ status: "stopped" | "error";
53
+ /** The ending the tail row renders, when it renders one (silent markers read as none). */
54
+ tailEndingKind: AthenaRuntimeMessageKind | null;
55
+ }
30
56
  export interface StatewireRunEndedFooterProps {
31
57
  /** Merged onto the recovery card's default classes. */
32
58
  className?: string;
59
+ /**
60
+ * How the host's assistant row paints the transcript tail. The default reads
61
+ * the runtime ending only (a persisted marker or handoff); a host whose row
62
+ * also styles an assistant-ui error status as a failed ending passes a
63
+ * reader that reports it, so the footer never doubles that row's recovery.
64
+ */
65
+ readTailEnding?: ReadStatewireTailEnding;
66
+ /**
67
+ * The recovery controls. The default renders Continue unless the tail row
68
+ * (a marker of another kind) already carries it; hosts with richer recovery
69
+ * (Retry + Continue) supply their own and decide ownership from the context.
70
+ */
71
+ renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;
33
72
  }
34
73
  /**
35
74
  * Recovery row for a settled run whose persisted ending is no longer the
36
75
  * transcript tail — rendered after the messages (`renderMessages`). Rewinds,
37
76
  * compaction, and older snapshots can all leave the durable run state
38
- * recoverable without a marker row that owns the action. Renders nothing on
39
- * legacy (non-statewire) threads.
77
+ * recoverable without a marker row that owns the action. The failure copy
78
+ * comes from the replicated run error (`runs.error.message`) — the same text
79
+ * the marker would have carried. Renders nothing on legacy (non-statewire)
80
+ * threads.
40
81
  */
41
- export declare function StatewireRunEndedFooter({ className, }?: StatewireRunEndedFooterProps): ReactElement | null;
82
+ export declare function StatewireRunEndedFooter({ className, readTailEnding, renderActions, }?: StatewireRunEndedFooterProps): ReactElement | null;
@@ -2,7 +2,10 @@ import type { FC } from "react";
2
2
  /**
3
3
  * Rendered in place of a user message while it is being edited (entered via
4
4
  * the action bar's Edit control, which seeds this composer with the message
5
- * text). Sending submits the message-scoped composer, which the Statewire
6
- * runtime maps to a `run/edit` rewind; Escape/Cancel exits edit mode.
5
+ * text). Sending leaves as a `run/edit` anchored on the host's own parent of
6
+ * the message (`useDeepAgentMessageEditSubmit`) on a windowed wire the
7
+ * lane's `anchorBefore` at the window edge — so the rewind is never rejected
8
+ * `wrong-anchor` the way the library's converted-message anchor is after a
9
+ * chunked assistant turn; Escape/Cancel exits edit mode.
7
10
  */
8
11
  export declare const UserEditComposer: FC;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The statewire chat surfaces every Athena host mounts — the HITL approval
3
+ * card, the queued-messages tray, the continue affordances and the run-ended
4
+ * footer, with the runtime-message card and Continue pill they render — as a
5
+ * lean entry point. Hosts that already have their own composer and mention
6
+ * stack (Olympus) import this instead of the full `chat-ui` barrel, so the
7
+ * SDK's Tiptap and mention modules never enter their build graph.
8
+ *
9
+ * Published as the `@athenaintel/react/chat-ui/statewire` sub-path.
10
+ */
11
+ export { StatewireApprovalCard, type StatewireApprovalCardProps, type StatewireApprovalRequestContext, } from "../chat/StatewireApprovalCard";
12
+ export { type StatewireApprovalRequest, type StatewireInterruptPredicate, type UseStatewireApprovalRequestOptions, useStatewireApprovalRequest, } from "../chat/use-statewire-approval-request";
13
+ export { StatewireQueuedMessages, type StatewireQueueEditorContext, type StatewireQueueEvent, type StatewireQueueRowContentContext, type StatewireQueuedMessagesProps, } from "../chat/StatewireQueuedMessages";
14
+ export { HistoryEdgeRow, type HistoryEdgeRowProps, StatewireHistoryEdge, type StatewireHistoryEdgeProps, } from "./thread/statewire-history-edge";
15
+ export { StatewireToolOutputsContext, useStatewireToolOutputs, } from "../provider/statewire-window-context";
16
+ export { ContinuePill } from "./messages/continue-pill";
17
+ export { RuntimeMessageCard, type RuntimeMessageCardProps } from "./messages/runtime-message";
18
+ export { type ReadStatewireTailEnding, StatewireContinueRunAffordance, StatewireContinueRunButton, type StatewireContinueRunButtonProps, StatewireRunEndedFooter, type StatewireRunEndedFooterActionsContext, type StatewireRunEndedFooterProps, type StatewireTailEnding, } from "./messages/statewire-continue-run";
19
+ export { HITL_PENDING_RESUME_GRACE_MS } from "@athenaintel/agent-runtime";
@@ -31,6 +31,12 @@ export interface ChatThreadShellProps {
31
31
  viewportOverlay?: ReactNode;
32
32
  /** Empty-thread state, rendered via ThreadPrimitive.Empty when provided. */
33
33
  welcome?: ReactNode;
34
+ /**
35
+ * Rendered inside the message column right above the messages — the
36
+ * windowed wire's history edge (`StatewireHistoryEdge`): the "N earlier
37
+ * messages" row that pages older history in and fetches cut tool outputs.
38
+ */
39
+ beforeMessages?: ReactNode;
34
40
  /** Message renderers for ThreadPrimitive.Messages. */
35
41
  components: ChatThreadMessageComponents;
36
42
  /**
@@ -106,4 +112,4 @@ export interface ChatThreadShellProps {
106
112
  * layout, scroll behaviour, and empty/running states stay identical across
107
113
  * surfaces so fixes land once.
108
114
  */
109
- export declare function ChatThreadShell({ overlay, header, banners, viewportOverlay, welcome, components, renderMessages, belowViewport, composer, panelClassName, maxWidth, turnAnchor, viewportClassName, contentClassName, runningIndicator, scrollToBottom, viewportFooter, viewportFooterClassName, readOnly, }: ChatThreadShellProps): import("react/jsx-runtime").JSX.Element;
115
+ export declare function ChatThreadShell({ overlay, header, banners, viewportOverlay, welcome, beforeMessages, components, renderMessages, belowViewport, composer, panelClassName, maxWidth, turnAnchor, viewportClassName, contentClassName, runningIndicator, scrollToBottom, viewportFooter, viewportFooterClassName, readOnly, }: ChatThreadShellProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { type DeepAgentHistoryLoadEvent, type DeepAgentToolOutputStore } from "@athenaintel/agent-runtime";
2
+ import type { FC } from "react";
3
+ /** The attribute `ChatThreadShell` stamps on the scroll viewport. */
4
+ export declare const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
5
+ /**
6
+ * How far above the viewport the edge row counts as near: the row sits above
7
+ * the first loaded message, so reaching it means the user has scrolled past
8
+ * everything loaded and the next page should already be on its way.
9
+ */
10
+ export declare const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;
11
+ export interface HistoryEdgeRowProps {
12
+ /** Messages older than the loaded window the server still holds. */
13
+ olderCount: number;
14
+ /** A page of older history is in flight. */
15
+ loading: boolean;
16
+ onLoadOlder: () => void;
17
+ className?: string;
18
+ /** The row element, for the viewport observer. */
19
+ rowRef?: (element: HTMLElement | null) => void;
20
+ }
21
+ /**
22
+ * The top edge of the LOADED history on a windowed wire: how many older
23
+ * messages the server still holds, a manual way to load the next page, and
24
+ * the in-flight state. Renders nothing when the whole transcript is loaded
25
+ * (or the wire is not windowed).
26
+ */
27
+ export declare const HistoryEdgeRow: FC<HistoryEdgeRowProps>;
28
+ export interface StatewireHistoryEdgeProps {
29
+ /**
30
+ * The thread's tool-output store (the one its converter substitutes from).
31
+ * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass
32
+ * the store they gave `useDeepAgentRuntime({ toolOutputs })`.
33
+ */
34
+ toolOutputs?: DeepAgentToolOutputStore;
35
+ className?: string;
36
+ /** A `history/load` settled (telemetry). */
37
+ onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;
38
+ }
39
+ /**
40
+ * The client half of the windowed wire for a DOM thread — mounted once per
41
+ * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s
42
+ * `beforeMessages` slot):
43
+ *
44
+ * - renders the "N earlier messages" edge row and loads the next page when
45
+ * the row comes near the viewport (scrolling up) or on its button, keeping
46
+ * the reading position when the page lands above the view;
47
+ * - fetches cut tool outputs whole for the rendered cards, so they re-render
48
+ * complete through the converter (`toolOutputs`).
49
+ *
50
+ * Inert on a wire that is not windowed: no row, no reads.
51
+ */
52
+ export declare const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const statewireHistoryEdge = require("./statewire-history-edge-C8uyTEjX.cjs");
4
+ const statewireContinueRun = require("./statewire-continue-run-nE9VCKUh.cjs");
5
+ require("./trash-2-B5OaNAL7.cjs");
6
+ require("react");
7
+ require("@assistant-ui/tap");
8
+ require("statewire");
9
+ require("@assistant-ui/react-statewire");
10
+ require("@assistant-ui/store");
11
+ require("@assistant-ui/core");
12
+ exports.ContinuePill = statewireHistoryEdge.ContinuePill;
13
+ exports.HITL_PENDING_RESUME_GRACE_MS = statewireHistoryEdge.HITL_PENDING_RESUME_GRACE_MS;
14
+ exports.HistoryEdgeRow = statewireHistoryEdge.HistoryEdgeRow;
15
+ exports.RuntimeMessageCard = statewireHistoryEdge.RuntimeMessageCard;
16
+ exports.StatewireApprovalCard = statewireHistoryEdge.StatewireApprovalCard;
17
+ exports.StatewireHistoryEdge = statewireHistoryEdge.StatewireHistoryEdge;
18
+ exports.StatewireQueuedMessages = statewireHistoryEdge.StatewireQueuedMessages;
19
+ exports.StatewireToolOutputsContext = statewireHistoryEdge.StatewireToolOutputsContext;
20
+ exports.useStatewireApprovalRequest = statewireHistoryEdge.useStatewireApprovalRequest;
21
+ exports.useStatewireToolOutputs = statewireHistoryEdge.useStatewireToolOutputs;
22
+ exports.StatewireContinueRunAffordance = statewireContinueRun.StatewireContinueRunAffordance;
23
+ exports.StatewireContinueRunButton = statewireContinueRun.StatewireContinueRunButton;
24
+ exports.StatewireRunEndedFooter = statewireContinueRun.StatewireRunEndedFooter;
25
+ //# sourceMappingURL=chat-ui-statewire.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-ui-statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,25 @@
1
+ import { C, H, a, R, S, b, c, d, u, e } from "./statewire-history-edge-CPohUKMt.js";
2
+ import { S as S2, a as a2, b as b2 } from "./statewire-continue-run-D34gS7_1.js";
3
+ import "./trash-2-CCwSURL-.js";
4
+ import "react";
5
+ import "@assistant-ui/tap";
6
+ import "statewire";
7
+ import "@assistant-ui/react-statewire";
8
+ import "@assistant-ui/store";
9
+ import "@assistant-ui/core";
10
+ export {
11
+ C as ContinuePill,
12
+ H as HITL_PENDING_RESUME_GRACE_MS,
13
+ a as HistoryEdgeRow,
14
+ R as RuntimeMessageCard,
15
+ S as StatewireApprovalCard,
16
+ S2 as StatewireContinueRunAffordance,
17
+ a2 as StatewireContinueRunButton,
18
+ b as StatewireHistoryEdge,
19
+ c as StatewireQueuedMessages,
20
+ b2 as StatewireRunEndedFooter,
21
+ d as StatewireToolOutputsContext,
22
+ u as useStatewireApprovalRequest,
23
+ e as useStatewireToolOutputs
24
+ };
25
+ //# sourceMappingURL=chat-ui-statewire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-ui-statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}