@runtypelabs/persona 4.4.2 → 4.5.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.
@@ -2059,25 +2059,74 @@ type AgentWidgetArtifactsFeature = {
2059
2059
  /**
2060
2060
  * How the transcript scrolls while an assistant response streams in.
2061
2061
  *
2062
- * - `"follow"` (default): keep the newest content pinned to the bottom of the
2063
- * viewport, pausing when the user scrolls up and resuming when they return
2064
- * to the bottom.
2065
- * - `"anchor-top"`: on send, scroll the user's message near the top of the
2066
- * viewport and hold it there while the response streams in beneath it
2067
- * (ChatGPT-style). The transcript never auto-scrolls during streaming.
2062
+ * - `"anchor-top"` (default): on send, scroll the user's message near the top
2063
+ * of the viewport and hold it there while the response streams in beneath it
2064
+ * (ChatGPT-style). When a turn has no user send to anchor to (a proactive
2065
+ * greeting, an injected assistant message, a resubmit, or first-load
2066
+ * streaming), it falls back to `"follow"` for that turn so content never
2067
+ * streams in off-screen.
2068
+ * - `"follow"`: keep the newest content pinned to the bottom of the viewport,
2069
+ * pausing when the user scrolls up and resuming when they return to the
2070
+ * bottom. This was the default before 4.x.
2068
2071
  * - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
2069
2072
  * way back to the latest content.
2070
2073
  */
2071
2074
  type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
2075
+ /**
2076
+ * Where the transcript lands when a *saved* conversation is reopened (restored
2077
+ * from the storage adapter / `initialMessages`), as opposed to a fresh send.
2078
+ *
2079
+ * - `"bottom"` (default): jump to the absolute end of the transcript, matching
2080
+ * the historical behavior.
2081
+ * - `"last-user-turn"`: pin the last user message near the top of the viewport
2082
+ * (the last point the reader was actively driving the conversation) so a long
2083
+ * restored thread opens at a readable place rather than at the very bottom.
2084
+ */
2085
+ type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
2072
2086
  type AgentWidgetScrollBehaviorFeature = {
2073
- /** Scroll behavior during streamed responses. @default "follow" */
2087
+ /** Scroll behavior during streamed responses. @default "anchor-top" */
2074
2088
  mode?: AgentWidgetScrollMode;
2075
2089
  /**
2076
2090
  * Gap (px) kept between the anchored user message and the top of the
2077
- * viewport in `"anchor-top"` mode.
2091
+ * viewport in `"anchor-top"` mode. Also used as the gap for
2092
+ * `restorePosition: "last-user-turn"`.
2078
2093
  * @default 16
2079
2094
  */
2080
2095
  anchorTopOffset?: number;
2096
+ /**
2097
+ * Where to land when a saved conversation reopens. Additive and opt-in: the
2098
+ * default preserves the historical "jump to the bottom" behavior.
2099
+ * @default "bottom"
2100
+ */
2101
+ restorePosition?: AgentWidgetScrollRestorePosition;
2102
+ /**
2103
+ * When true, interactions beyond text selection — keyboard navigation
2104
+ * (PageUp/PageDown/Home/End/arrows) inside the transcript and focusing a
2105
+ * link or other interactive element within it — also pause auto-follow in
2106
+ * `"follow"` mode. Treats "the reader is doing something here" as intent to
2107
+ * stay put, not just "the reader dragged a selection". Opt-in; default keeps
2108
+ * only the existing wheel/scroll/selection triggers.
2109
+ * @default false
2110
+ */
2111
+ pauseOnInteraction?: boolean;
2112
+ /**
2113
+ * When true, the scroll-to-bottom affordance also surfaces new-content and
2114
+ * still-streaming activity while the reader is pinned away from the latest
2115
+ * content in `"anchor-top"` mode. Lets the reader know a response is arriving
2116
+ * offscreen below. Defaults on alongside the `"anchor-top"` default; set
2117
+ * `false` to keep the count + streaming hint silent while pinned.
2118
+ * @default true
2119
+ */
2120
+ showActivityWhilePinned?: boolean;
2121
+ /**
2122
+ * When true, Persona maintains a visually-hidden `aria-live="polite"` region
2123
+ * that announces important transcript events — a response starting, a
2124
+ * response finishing, and "N new messages below" while the reader is scrolled
2125
+ * away — at a comfortable cadence (never token-by-token). Opt-in so existing
2126
+ * embeds don't suddenly gain screen-reader announcements.
2127
+ * @default false
2128
+ */
2129
+ announce?: boolean;
2081
2130
  };
2082
2131
  type AgentWidgetScrollToBottomFeature = {
2083
2132
  /**
@@ -2059,25 +2059,74 @@ type AgentWidgetArtifactsFeature = {
2059
2059
  /**
2060
2060
  * How the transcript scrolls while an assistant response streams in.
2061
2061
  *
2062
- * - `"follow"` (default): keep the newest content pinned to the bottom of the
2063
- * viewport, pausing when the user scrolls up and resuming when they return
2064
- * to the bottom.
2065
- * - `"anchor-top"`: on send, scroll the user's message near the top of the
2066
- * viewport and hold it there while the response streams in beneath it
2067
- * (ChatGPT-style). The transcript never auto-scrolls during streaming.
2062
+ * - `"anchor-top"` (default): on send, scroll the user's message near the top
2063
+ * of the viewport and hold it there while the response streams in beneath it
2064
+ * (ChatGPT-style). When a turn has no user send to anchor to (a proactive
2065
+ * greeting, an injected assistant message, a resubmit, or first-load
2066
+ * streaming), it falls back to `"follow"` for that turn so content never
2067
+ * streams in off-screen.
2068
+ * - `"follow"`: keep the newest content pinned to the bottom of the viewport,
2069
+ * pausing when the user scrolls up and resuming when they return to the
2070
+ * bottom. This was the default before 4.x.
2068
2071
  * - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
2069
2072
  * way back to the latest content.
2070
2073
  */
2071
2074
  type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
2075
+ /**
2076
+ * Where the transcript lands when a *saved* conversation is reopened (restored
2077
+ * from the storage adapter / `initialMessages`), as opposed to a fresh send.
2078
+ *
2079
+ * - `"bottom"` (default): jump to the absolute end of the transcript, matching
2080
+ * the historical behavior.
2081
+ * - `"last-user-turn"`: pin the last user message near the top of the viewport
2082
+ * (the last point the reader was actively driving the conversation) so a long
2083
+ * restored thread opens at a readable place rather than at the very bottom.
2084
+ */
2085
+ type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
2072
2086
  type AgentWidgetScrollBehaviorFeature = {
2073
- /** Scroll behavior during streamed responses. @default "follow" */
2087
+ /** Scroll behavior during streamed responses. @default "anchor-top" */
2074
2088
  mode?: AgentWidgetScrollMode;
2075
2089
  /**
2076
2090
  * Gap (px) kept between the anchored user message and the top of the
2077
- * viewport in `"anchor-top"` mode.
2091
+ * viewport in `"anchor-top"` mode. Also used as the gap for
2092
+ * `restorePosition: "last-user-turn"`.
2078
2093
  * @default 16
2079
2094
  */
2080
2095
  anchorTopOffset?: number;
2096
+ /**
2097
+ * Where to land when a saved conversation reopens. Additive and opt-in: the
2098
+ * default preserves the historical "jump to the bottom" behavior.
2099
+ * @default "bottom"
2100
+ */
2101
+ restorePosition?: AgentWidgetScrollRestorePosition;
2102
+ /**
2103
+ * When true, interactions beyond text selection — keyboard navigation
2104
+ * (PageUp/PageDown/Home/End/arrows) inside the transcript and focusing a
2105
+ * link or other interactive element within it — also pause auto-follow in
2106
+ * `"follow"` mode. Treats "the reader is doing something here" as intent to
2107
+ * stay put, not just "the reader dragged a selection". Opt-in; default keeps
2108
+ * only the existing wheel/scroll/selection triggers.
2109
+ * @default false
2110
+ */
2111
+ pauseOnInteraction?: boolean;
2112
+ /**
2113
+ * When true, the scroll-to-bottom affordance also surfaces new-content and
2114
+ * still-streaming activity while the reader is pinned away from the latest
2115
+ * content in `"anchor-top"` mode. Lets the reader know a response is arriving
2116
+ * offscreen below. Defaults on alongside the `"anchor-top"` default; set
2117
+ * `false` to keep the count + streaming hint silent while pinned.
2118
+ * @default true
2119
+ */
2120
+ showActivityWhilePinned?: boolean;
2121
+ /**
2122
+ * When true, Persona maintains a visually-hidden `aria-live="polite"` region
2123
+ * that announces important transcript events — a response starting, a
2124
+ * response finishing, and "N new messages below" while the reader is scrolled
2125
+ * away — at a comfortable cadence (never token-by-token). Opt-in so existing
2126
+ * embeds don't suddenly gain screen-reader announcements.
2127
+ * @default false
2128
+ */
2129
+ announce?: boolean;
2081
2130
  };
2082
2131
  type AgentWidgetScrollToBottomFeature = {
2083
2132
  /**