@runtypelabs/persona 4.4.1 → 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.
@@ -2133,25 +2133,74 @@ type AgentWidgetArtifactsFeature = {
2133
2133
  /**
2134
2134
  * How the transcript scrolls while an assistant response streams in.
2135
2135
  *
2136
- * - `"follow"` (default): keep the newest content pinned to the bottom of the
2137
- * viewport, pausing when the user scrolls up and resuming when they return
2138
- * to the bottom.
2139
- * - `"anchor-top"`: on send, scroll the user's message near the top of the
2140
- * viewport and hold it there while the response streams in beneath it
2141
- * (ChatGPT-style). The transcript never auto-scrolls during streaming.
2136
+ * - `"anchor-top"` (default): on send, scroll the user's message near the top
2137
+ * of the viewport and hold it there while the response streams in beneath it
2138
+ * (ChatGPT-style). When a turn has no user send to anchor to (a proactive
2139
+ * greeting, an injected assistant message, a resubmit, or first-load
2140
+ * streaming), it falls back to `"follow"` for that turn so content never
2141
+ * streams in off-screen.
2142
+ * - `"follow"`: keep the newest content pinned to the bottom of the viewport,
2143
+ * pausing when the user scrolls up and resuming when they return to the
2144
+ * bottom. This was the default before 4.x.
2142
2145
  * - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
2143
2146
  * way back to the latest content.
2144
2147
  */
2145
2148
  type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
2149
+ /**
2150
+ * Where the transcript lands when a *saved* conversation is reopened (restored
2151
+ * from the storage adapter / `initialMessages`), as opposed to a fresh send.
2152
+ *
2153
+ * - `"bottom"` (default): jump to the absolute end of the transcript, matching
2154
+ * the historical behavior.
2155
+ * - `"last-user-turn"`: pin the last user message near the top of the viewport
2156
+ * (the last point the reader was actively driving the conversation) so a long
2157
+ * restored thread opens at a readable place rather than at the very bottom.
2158
+ */
2159
+ type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
2146
2160
  type AgentWidgetScrollBehaviorFeature = {
2147
- /** Scroll behavior during streamed responses. @default "follow" */
2161
+ /** Scroll behavior during streamed responses. @default "anchor-top" */
2148
2162
  mode?: AgentWidgetScrollMode;
2149
2163
  /**
2150
2164
  * Gap (px) kept between the anchored user message and the top of the
2151
- * viewport in `"anchor-top"` mode.
2165
+ * viewport in `"anchor-top"` mode. Also used as the gap for
2166
+ * `restorePosition: "last-user-turn"`.
2152
2167
  * @default 16
2153
2168
  */
2154
2169
  anchorTopOffset?: number;
2170
+ /**
2171
+ * Where to land when a saved conversation reopens. Additive and opt-in: the
2172
+ * default preserves the historical "jump to the bottom" behavior.
2173
+ * @default "bottom"
2174
+ */
2175
+ restorePosition?: AgentWidgetScrollRestorePosition;
2176
+ /**
2177
+ * When true, interactions beyond text selection — keyboard navigation
2178
+ * (PageUp/PageDown/Home/End/arrows) inside the transcript and focusing a
2179
+ * link or other interactive element within it — also pause auto-follow in
2180
+ * `"follow"` mode. Treats "the reader is doing something here" as intent to
2181
+ * stay put, not just "the reader dragged a selection". Opt-in; default keeps
2182
+ * only the existing wheel/scroll/selection triggers.
2183
+ * @default false
2184
+ */
2185
+ pauseOnInteraction?: boolean;
2186
+ /**
2187
+ * When true, the scroll-to-bottom affordance also surfaces new-content and
2188
+ * still-streaming activity while the reader is pinned away from the latest
2189
+ * content in `"anchor-top"` mode. Lets the reader know a response is arriving
2190
+ * offscreen below. Defaults on alongside the `"anchor-top"` default; set
2191
+ * `false` to keep the count + streaming hint silent while pinned.
2192
+ * @default true
2193
+ */
2194
+ showActivityWhilePinned?: boolean;
2195
+ /**
2196
+ * When true, Persona maintains a visually-hidden `aria-live="polite"` region
2197
+ * that announces important transcript events — a response starting, a
2198
+ * response finishing, and "N new messages below" while the reader is scrolled
2199
+ * away — at a comfortable cadence (never token-by-token). Opt-in so existing
2200
+ * embeds don't suddenly gain screen-reader announcements.
2201
+ * @default false
2202
+ */
2203
+ announce?: boolean;
2155
2204
  };
2156
2205
  type AgentWidgetScrollToBottomFeature = {
2157
2206
  /**
@@ -2133,25 +2133,74 @@ type AgentWidgetArtifactsFeature = {
2133
2133
  /**
2134
2134
  * How the transcript scrolls while an assistant response streams in.
2135
2135
  *
2136
- * - `"follow"` (default): keep the newest content pinned to the bottom of the
2137
- * viewport, pausing when the user scrolls up and resuming when they return
2138
- * to the bottom.
2139
- * - `"anchor-top"`: on send, scroll the user's message near the top of the
2140
- * viewport and hold it there while the response streams in beneath it
2141
- * (ChatGPT-style). The transcript never auto-scrolls during streaming.
2136
+ * - `"anchor-top"` (default): on send, scroll the user's message near the top
2137
+ * of the viewport and hold it there while the response streams in beneath it
2138
+ * (ChatGPT-style). When a turn has no user send to anchor to (a proactive
2139
+ * greeting, an injected assistant message, a resubmit, or first-load
2140
+ * streaming), it falls back to `"follow"` for that turn so content never
2141
+ * streams in off-screen.
2142
+ * - `"follow"`: keep the newest content pinned to the bottom of the viewport,
2143
+ * pausing when the user scrolls up and resuming when they return to the
2144
+ * bottom. This was the default before 4.x.
2142
2145
  * - `"none"`: never auto-scroll; the scroll-to-bottom affordance is the only
2143
2146
  * way back to the latest content.
2144
2147
  */
2145
2148
  type AgentWidgetScrollMode = "follow" | "anchor-top" | "none";
2149
+ /**
2150
+ * Where the transcript lands when a *saved* conversation is reopened (restored
2151
+ * from the storage adapter / `initialMessages`), as opposed to a fresh send.
2152
+ *
2153
+ * - `"bottom"` (default): jump to the absolute end of the transcript, matching
2154
+ * the historical behavior.
2155
+ * - `"last-user-turn"`: pin the last user message near the top of the viewport
2156
+ * (the last point the reader was actively driving the conversation) so a long
2157
+ * restored thread opens at a readable place rather than at the very bottom.
2158
+ */
2159
+ type AgentWidgetScrollRestorePosition = "bottom" | "last-user-turn";
2146
2160
  type AgentWidgetScrollBehaviorFeature = {
2147
- /** Scroll behavior during streamed responses. @default "follow" */
2161
+ /** Scroll behavior during streamed responses. @default "anchor-top" */
2148
2162
  mode?: AgentWidgetScrollMode;
2149
2163
  /**
2150
2164
  * Gap (px) kept between the anchored user message and the top of the
2151
- * viewport in `"anchor-top"` mode.
2165
+ * viewport in `"anchor-top"` mode. Also used as the gap for
2166
+ * `restorePosition: "last-user-turn"`.
2152
2167
  * @default 16
2153
2168
  */
2154
2169
  anchorTopOffset?: number;
2170
+ /**
2171
+ * Where to land when a saved conversation reopens. Additive and opt-in: the
2172
+ * default preserves the historical "jump to the bottom" behavior.
2173
+ * @default "bottom"
2174
+ */
2175
+ restorePosition?: AgentWidgetScrollRestorePosition;
2176
+ /**
2177
+ * When true, interactions beyond text selection — keyboard navigation
2178
+ * (PageUp/PageDown/Home/End/arrows) inside the transcript and focusing a
2179
+ * link or other interactive element within it — also pause auto-follow in
2180
+ * `"follow"` mode. Treats "the reader is doing something here" as intent to
2181
+ * stay put, not just "the reader dragged a selection". Opt-in; default keeps
2182
+ * only the existing wheel/scroll/selection triggers.
2183
+ * @default false
2184
+ */
2185
+ pauseOnInteraction?: boolean;
2186
+ /**
2187
+ * When true, the scroll-to-bottom affordance also surfaces new-content and
2188
+ * still-streaming activity while the reader is pinned away from the latest
2189
+ * content in `"anchor-top"` mode. Lets the reader know a response is arriving
2190
+ * offscreen below. Defaults on alongside the `"anchor-top"` default; set
2191
+ * `false` to keep the count + streaming hint silent while pinned.
2192
+ * @default true
2193
+ */
2194
+ showActivityWhilePinned?: boolean;
2195
+ /**
2196
+ * When true, Persona maintains a visually-hidden `aria-live="polite"` region
2197
+ * that announces important transcript events — a response starting, a
2198
+ * response finishing, and "N new messages below" while the reader is scrolled
2199
+ * away — at a comfortable cadence (never token-by-token). Opt-in so existing
2200
+ * embeds don't suddenly gain screen-reader announcements.
2201
+ * @default false
2202
+ */
2203
+ announce?: boolean;
2155
2204
  };
2156
2205
  type AgentWidgetScrollToBottomFeature = {
2157
2206
  /**