@runtypelabs/persona 3.10.1 → 3.12.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.
package/dist/index.d.cts CHANGED
@@ -1177,6 +1177,13 @@ type AgentWidgetScrollToBottomFeature = {
1177
1177
  label?: string;
1178
1178
  };
1179
1179
  type AgentWidgetToolCallCollapsedMode = "tool-call" | "tool-name" | "tool-preview";
1180
+ /**
1181
+ * Animation mode applied to tool call header text while the tool is running.
1182
+ * Character-by-character modes (`shimmer`, `shimmer-color`, `rainbow`) wrap each
1183
+ * character in a span with staggered `animation-delay`. `pulse` applies to the
1184
+ * entire text container. Honors `prefers-reduced-motion`.
1185
+ */
1186
+ type AgentWidgetToolCallLoadingAnimation = "none" | "pulse" | "shimmer" | "shimmer-color" | "rainbow";
1180
1187
  type AgentWidgetToolCallDisplayFeature = {
1181
1188
  /**
1182
1189
  * Controls what collapsed tool call rows show in their header/summary area.
@@ -1190,6 +1197,8 @@ type AgentWidgetToolCallDisplayFeature = {
1190
1197
  activePreview?: boolean;
1191
1198
  /**
1192
1199
  * Optional CSS min-height applied to active collapsed tool call rows.
1200
+ * @default undefined (no min-height)
1201
+ * @example "100px"
1193
1202
  */
1194
1203
  activeMinHeight?: string;
1195
1204
  /**
@@ -1208,6 +1217,16 @@ type AgentWidgetToolCallDisplayFeature = {
1208
1217
  * @default true
1209
1218
  */
1210
1219
  expandable?: boolean;
1220
+ /**
1221
+ * Animation mode applied to the tool call header text while the tool is active.
1222
+ * - "none" — static text, no animation
1223
+ * - "pulse" — opacity pulse on the entire header text
1224
+ * - "shimmer" — monochrome opacity sweep per character
1225
+ * - "shimmer-color" — color gradient sweep per character
1226
+ * - "rainbow" — rainbow color cycle per character
1227
+ * @default "none"
1228
+ */
1229
+ loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
1211
1230
  };
1212
1231
  type AgentWidgetReasoningDisplayFeature = {
1213
1232
  /**
@@ -1230,6 +1249,17 @@ type AgentWidgetReasoningDisplayFeature = {
1230
1249
  * @default true
1231
1250
  */
1232
1251
  expandable?: boolean;
1252
+ /**
1253
+ * Animation mode applied to the reasoning header text while reasoning is active.
1254
+ * Reuses the same modes as tool call animations.
1255
+ * - "none" — static text, no animation
1256
+ * - "pulse" — opacity pulse on the entire header text
1257
+ * - "shimmer" — monochrome opacity sweep per character
1258
+ * - "shimmer-color" — color gradient sweep per character
1259
+ * - "rainbow" — rainbow color cycle per character
1260
+ * @default "none"
1261
+ */
1262
+ loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
1233
1263
  };
1234
1264
  type AgentWidgetFeatureFlags = {
1235
1265
  showReasoning?: boolean;
@@ -1788,22 +1818,39 @@ type AgentWidgetApprovalConfig = {
1788
1818
  type AgentWidgetToolCallConfig = {
1789
1819
  /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
1790
1820
  shadow?: string;
1821
+ /** Background color of the tool call bubble container. */
1791
1822
  backgroundColor?: string;
1823
+ /** Border color of the tool call bubble container. */
1792
1824
  borderColor?: string;
1825
+ /** Border width of the tool call bubble container (CSS value, e.g. `"1px"`). */
1793
1826
  borderWidth?: string;
1827
+ /** Border radius of the tool call bubble container (CSS value, e.g. `"12px"`). */
1794
1828
  borderRadius?: string;
1829
+ /** Background color of the collapsed header row. */
1795
1830
  headerBackgroundColor?: string;
1831
+ /** Text color of the collapsed header row (tool name / summary). */
1796
1832
  headerTextColor?: string;
1833
+ /** Horizontal padding of the collapsed header row (CSS value). */
1797
1834
  headerPaddingX?: string;
1835
+ /** Vertical padding of the collapsed header row (CSS value). */
1798
1836
  headerPaddingY?: string;
1837
+ /** Background color of the expanded content area. */
1799
1838
  contentBackgroundColor?: string;
1839
+ /** Text color of the expanded content area. */
1800
1840
  contentTextColor?: string;
1841
+ /** Horizontal padding of the expanded content area (CSS value). */
1801
1842
  contentPaddingX?: string;
1843
+ /** Vertical padding of the expanded content area (CSS value). */
1802
1844
  contentPaddingY?: string;
1845
+ /** Background color of code blocks (arguments / result) in the expanded area. */
1803
1846
  codeBlockBackgroundColor?: string;
1847
+ /** Border color of code blocks in the expanded area. */
1804
1848
  codeBlockBorderColor?: string;
1849
+ /** Text color of code blocks in the expanded area. */
1805
1850
  codeBlockTextColor?: string;
1851
+ /** Color of the expand/collapse toggle icon. */
1806
1852
  toggleTextColor?: string;
1853
+ /** Color of section labels ("Arguments", "Result", "Activity") in the expanded area. */
1807
1854
  labelTextColor?: string;
1808
1855
  /**
1809
1856
  * Override the collapsed summary row content for a tool call bubble.
@@ -1817,6 +1864,14 @@ type AgentWidgetToolCallConfig = {
1817
1864
  collapsedMode: AgentWidgetToolCallCollapsedMode;
1818
1865
  isActive: boolean;
1819
1866
  config: AgentWidgetConfig;
1867
+ /** Static elapsed time snapshot, e.g. "2.6s". */
1868
+ elapsed: string;
1869
+ /**
1870
+ * Returns a `<span>` whose text content is automatically updated every
1871
+ * 100ms by the widget's global timer. Place it anywhere in your returned
1872
+ * HTMLElement to get a live-ticking duration display.
1873
+ */
1874
+ createElapsedElement: () => HTMLElement;
1820
1875
  }) => HTMLElement | string | null;
1821
1876
  /**
1822
1877
  * Override the lightweight collapsed preview content shown for active tool rows.
@@ -1839,6 +1894,47 @@ type AgentWidgetToolCallConfig = {
1839
1894
  defaultSummary: string;
1840
1895
  config: AgentWidgetConfig;
1841
1896
  }) => HTMLElement | string | null;
1897
+ /**
1898
+ * Template string for the header text while a tool call is active (running).
1899
+ *
1900
+ * **Placeholders:** `{toolName}` (tool name), `{duration}` (live-updating elapsed time).
1901
+ *
1902
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — parsed at render time and
1903
+ * applied as styled `<span>` elements. Works with all animation modes.
1904
+ *
1905
+ * When not set, falls back to the current `collapsedMode` behavior.
1906
+ * @example "Calling {toolName}... ~{duration}~"
1907
+ * @example "**Searching** *{toolName}*..."
1908
+ */
1909
+ activeTextTemplate?: string;
1910
+ /**
1911
+ * Template string for the header text when a tool call is complete.
1912
+ *
1913
+ * **Placeholders:** `{toolName}` (tool name), `{duration}` (final elapsed time).
1914
+ *
1915
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — same syntax as `activeTextTemplate`.
1916
+ *
1917
+ * When not set, falls back to the existing "Used tool for X seconds" text.
1918
+ * @example "Finished {toolName} ~{duration}~"
1919
+ */
1920
+ completeTextTemplate?: string;
1921
+ /**
1922
+ * Primary color for shimmer-color animation mode.
1923
+ * Defaults to the current text color.
1924
+ */
1925
+ loadingAnimationColor?: string;
1926
+ /**
1927
+ * Secondary/end color for shimmer-color animation mode.
1928
+ * Creates a gradient sweep between `loadingAnimationColor` and this color.
1929
+ * @default "#3b82f6"
1930
+ */
1931
+ loadingAnimationSecondaryColor?: string;
1932
+ /**
1933
+ * Duration of one full animation cycle in milliseconds.
1934
+ * Applies to pulse, shimmer, shimmer-color, and rainbow modes.
1935
+ * @default 2000
1936
+ */
1937
+ loadingAnimationDuration?: number;
1842
1938
  };
1843
1939
  type AgentWidgetReasoningConfig = {
1844
1940
  /**
@@ -1852,6 +1948,14 @@ type AgentWidgetReasoningConfig = {
1852
1948
  previewText: string;
1853
1949
  isActive: boolean;
1854
1950
  config: AgentWidgetConfig;
1951
+ /** Static elapsed time snapshot, e.g. "2.6s". */
1952
+ elapsed: string;
1953
+ /**
1954
+ * Returns a `<span>` whose text content is automatically updated every
1955
+ * 100ms by the widget's global timer. Place it anywhere in your returned
1956
+ * HTMLElement to get a live-ticking duration display.
1957
+ */
1958
+ createElapsedElement: () => HTMLElement;
1855
1959
  }) => HTMLElement | string | null;
1856
1960
  /**
1857
1961
  * Override the lightweight collapsed preview content shown for active reasoning rows.
@@ -1864,6 +1968,45 @@ type AgentWidgetReasoningConfig = {
1864
1968
  isActive: boolean;
1865
1969
  config: AgentWidgetConfig;
1866
1970
  }) => HTMLElement | string | null;
1971
+ /**
1972
+ * Template string for the header text while reasoning is active (streaming).
1973
+ *
1974
+ * **Placeholders:** `{duration}` (live-updating elapsed time).
1975
+ *
1976
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — parsed at render time.
1977
+ *
1978
+ * When not set, falls back to the default "Thinking..." text.
1979
+ * @example "Thinking... ~{duration}~"
1980
+ */
1981
+ activeTextTemplate?: string;
1982
+ /**
1983
+ * Template string for the header text when reasoning is complete.
1984
+ *
1985
+ * **Placeholders:** `{duration}` (final elapsed time).
1986
+ *
1987
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — same syntax as `activeTextTemplate`.
1988
+ *
1989
+ * When not set, falls back to the default "Thought for X seconds" text.
1990
+ * @example "Thought for ~{duration}~"
1991
+ */
1992
+ completeTextTemplate?: string;
1993
+ /**
1994
+ * Primary color for shimmer-color animation mode.
1995
+ * Defaults to the current text color.
1996
+ */
1997
+ loadingAnimationColor?: string;
1998
+ /**
1999
+ * Secondary/end color for shimmer-color animation mode.
2000
+ * Creates a gradient sweep between `loadingAnimationColor` and this color.
2001
+ * @default "#3b82f6"
2002
+ */
2003
+ loadingAnimationSecondaryColor?: string;
2004
+ /**
2005
+ * Duration of one full animation cycle in milliseconds.
2006
+ * Applies to pulse, shimmer, shimmer-color, and rainbow modes.
2007
+ * @default 2000
2008
+ */
2009
+ loadingAnimationDuration?: number;
1867
2010
  };
1868
2011
  type AgentWidgetSuggestionChipsConfig = {
1869
2012
  fontFamily?: "sans-serif" | "serif" | "mono";
package/dist/index.d.ts CHANGED
@@ -1177,6 +1177,13 @@ type AgentWidgetScrollToBottomFeature = {
1177
1177
  label?: string;
1178
1178
  };
1179
1179
  type AgentWidgetToolCallCollapsedMode = "tool-call" | "tool-name" | "tool-preview";
1180
+ /**
1181
+ * Animation mode applied to tool call header text while the tool is running.
1182
+ * Character-by-character modes (`shimmer`, `shimmer-color`, `rainbow`) wrap each
1183
+ * character in a span with staggered `animation-delay`. `pulse` applies to the
1184
+ * entire text container. Honors `prefers-reduced-motion`.
1185
+ */
1186
+ type AgentWidgetToolCallLoadingAnimation = "none" | "pulse" | "shimmer" | "shimmer-color" | "rainbow";
1180
1187
  type AgentWidgetToolCallDisplayFeature = {
1181
1188
  /**
1182
1189
  * Controls what collapsed tool call rows show in their header/summary area.
@@ -1190,6 +1197,8 @@ type AgentWidgetToolCallDisplayFeature = {
1190
1197
  activePreview?: boolean;
1191
1198
  /**
1192
1199
  * Optional CSS min-height applied to active collapsed tool call rows.
1200
+ * @default undefined (no min-height)
1201
+ * @example "100px"
1193
1202
  */
1194
1203
  activeMinHeight?: string;
1195
1204
  /**
@@ -1208,6 +1217,16 @@ type AgentWidgetToolCallDisplayFeature = {
1208
1217
  * @default true
1209
1218
  */
1210
1219
  expandable?: boolean;
1220
+ /**
1221
+ * Animation mode applied to the tool call header text while the tool is active.
1222
+ * - "none" — static text, no animation
1223
+ * - "pulse" — opacity pulse on the entire header text
1224
+ * - "shimmer" — monochrome opacity sweep per character
1225
+ * - "shimmer-color" — color gradient sweep per character
1226
+ * - "rainbow" — rainbow color cycle per character
1227
+ * @default "none"
1228
+ */
1229
+ loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
1211
1230
  };
1212
1231
  type AgentWidgetReasoningDisplayFeature = {
1213
1232
  /**
@@ -1230,6 +1249,17 @@ type AgentWidgetReasoningDisplayFeature = {
1230
1249
  * @default true
1231
1250
  */
1232
1251
  expandable?: boolean;
1252
+ /**
1253
+ * Animation mode applied to the reasoning header text while reasoning is active.
1254
+ * Reuses the same modes as tool call animations.
1255
+ * - "none" — static text, no animation
1256
+ * - "pulse" — opacity pulse on the entire header text
1257
+ * - "shimmer" — monochrome opacity sweep per character
1258
+ * - "shimmer-color" — color gradient sweep per character
1259
+ * - "rainbow" — rainbow color cycle per character
1260
+ * @default "none"
1261
+ */
1262
+ loadingAnimation?: AgentWidgetToolCallLoadingAnimation;
1233
1263
  };
1234
1264
  type AgentWidgetFeatureFlags = {
1235
1265
  showReasoning?: boolean;
@@ -1788,22 +1818,39 @@ type AgentWidgetApprovalConfig = {
1788
1818
  type AgentWidgetToolCallConfig = {
1789
1819
  /** Box-shadow for tool-call bubbles; overrides `theme.toolBubbleShadow` when set. */
1790
1820
  shadow?: string;
1821
+ /** Background color of the tool call bubble container. */
1791
1822
  backgroundColor?: string;
1823
+ /** Border color of the tool call bubble container. */
1792
1824
  borderColor?: string;
1825
+ /** Border width of the tool call bubble container (CSS value, e.g. `"1px"`). */
1793
1826
  borderWidth?: string;
1827
+ /** Border radius of the tool call bubble container (CSS value, e.g. `"12px"`). */
1794
1828
  borderRadius?: string;
1829
+ /** Background color of the collapsed header row. */
1795
1830
  headerBackgroundColor?: string;
1831
+ /** Text color of the collapsed header row (tool name / summary). */
1796
1832
  headerTextColor?: string;
1833
+ /** Horizontal padding of the collapsed header row (CSS value). */
1797
1834
  headerPaddingX?: string;
1835
+ /** Vertical padding of the collapsed header row (CSS value). */
1798
1836
  headerPaddingY?: string;
1837
+ /** Background color of the expanded content area. */
1799
1838
  contentBackgroundColor?: string;
1839
+ /** Text color of the expanded content area. */
1800
1840
  contentTextColor?: string;
1841
+ /** Horizontal padding of the expanded content area (CSS value). */
1801
1842
  contentPaddingX?: string;
1843
+ /** Vertical padding of the expanded content area (CSS value). */
1802
1844
  contentPaddingY?: string;
1845
+ /** Background color of code blocks (arguments / result) in the expanded area. */
1803
1846
  codeBlockBackgroundColor?: string;
1847
+ /** Border color of code blocks in the expanded area. */
1804
1848
  codeBlockBorderColor?: string;
1849
+ /** Text color of code blocks in the expanded area. */
1805
1850
  codeBlockTextColor?: string;
1851
+ /** Color of the expand/collapse toggle icon. */
1806
1852
  toggleTextColor?: string;
1853
+ /** Color of section labels ("Arguments", "Result", "Activity") in the expanded area. */
1807
1854
  labelTextColor?: string;
1808
1855
  /**
1809
1856
  * Override the collapsed summary row content for a tool call bubble.
@@ -1817,6 +1864,14 @@ type AgentWidgetToolCallConfig = {
1817
1864
  collapsedMode: AgentWidgetToolCallCollapsedMode;
1818
1865
  isActive: boolean;
1819
1866
  config: AgentWidgetConfig;
1867
+ /** Static elapsed time snapshot, e.g. "2.6s". */
1868
+ elapsed: string;
1869
+ /**
1870
+ * Returns a `<span>` whose text content is automatically updated every
1871
+ * 100ms by the widget's global timer. Place it anywhere in your returned
1872
+ * HTMLElement to get a live-ticking duration display.
1873
+ */
1874
+ createElapsedElement: () => HTMLElement;
1820
1875
  }) => HTMLElement | string | null;
1821
1876
  /**
1822
1877
  * Override the lightweight collapsed preview content shown for active tool rows.
@@ -1839,6 +1894,47 @@ type AgentWidgetToolCallConfig = {
1839
1894
  defaultSummary: string;
1840
1895
  config: AgentWidgetConfig;
1841
1896
  }) => HTMLElement | string | null;
1897
+ /**
1898
+ * Template string for the header text while a tool call is active (running).
1899
+ *
1900
+ * **Placeholders:** `{toolName}` (tool name), `{duration}` (live-updating elapsed time).
1901
+ *
1902
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — parsed at render time and
1903
+ * applied as styled `<span>` elements. Works with all animation modes.
1904
+ *
1905
+ * When not set, falls back to the current `collapsedMode` behavior.
1906
+ * @example "Calling {toolName}... ~{duration}~"
1907
+ * @example "**Searching** *{toolName}*..."
1908
+ */
1909
+ activeTextTemplate?: string;
1910
+ /**
1911
+ * Template string for the header text when a tool call is complete.
1912
+ *
1913
+ * **Placeholders:** `{toolName}` (tool name), `{duration}` (final elapsed time).
1914
+ *
1915
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — same syntax as `activeTextTemplate`.
1916
+ *
1917
+ * When not set, falls back to the existing "Used tool for X seconds" text.
1918
+ * @example "Finished {toolName} ~{duration}~"
1919
+ */
1920
+ completeTextTemplate?: string;
1921
+ /**
1922
+ * Primary color for shimmer-color animation mode.
1923
+ * Defaults to the current text color.
1924
+ */
1925
+ loadingAnimationColor?: string;
1926
+ /**
1927
+ * Secondary/end color for shimmer-color animation mode.
1928
+ * Creates a gradient sweep between `loadingAnimationColor` and this color.
1929
+ * @default "#3b82f6"
1930
+ */
1931
+ loadingAnimationSecondaryColor?: string;
1932
+ /**
1933
+ * Duration of one full animation cycle in milliseconds.
1934
+ * Applies to pulse, shimmer, shimmer-color, and rainbow modes.
1935
+ * @default 2000
1936
+ */
1937
+ loadingAnimationDuration?: number;
1842
1938
  };
1843
1939
  type AgentWidgetReasoningConfig = {
1844
1940
  /**
@@ -1852,6 +1948,14 @@ type AgentWidgetReasoningConfig = {
1852
1948
  previewText: string;
1853
1949
  isActive: boolean;
1854
1950
  config: AgentWidgetConfig;
1951
+ /** Static elapsed time snapshot, e.g. "2.6s". */
1952
+ elapsed: string;
1953
+ /**
1954
+ * Returns a `<span>` whose text content is automatically updated every
1955
+ * 100ms by the widget's global timer. Place it anywhere in your returned
1956
+ * HTMLElement to get a live-ticking duration display.
1957
+ */
1958
+ createElapsedElement: () => HTMLElement;
1855
1959
  }) => HTMLElement | string | null;
1856
1960
  /**
1857
1961
  * Override the lightweight collapsed preview content shown for active reasoning rows.
@@ -1864,6 +1968,45 @@ type AgentWidgetReasoningConfig = {
1864
1968
  isActive: boolean;
1865
1969
  config: AgentWidgetConfig;
1866
1970
  }) => HTMLElement | string | null;
1971
+ /**
1972
+ * Template string for the header text while reasoning is active (streaming).
1973
+ *
1974
+ * **Placeholders:** `{duration}` (live-updating elapsed time).
1975
+ *
1976
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — parsed at render time.
1977
+ *
1978
+ * When not set, falls back to the default "Thinking..." text.
1979
+ * @example "Thinking... ~{duration}~"
1980
+ */
1981
+ activeTextTemplate?: string;
1982
+ /**
1983
+ * Template string for the header text when reasoning is complete.
1984
+ *
1985
+ * **Placeholders:** `{duration}` (final elapsed time).
1986
+ *
1987
+ * **Inline formatting:** `~dim~`, `*italic*`, `**bold**` — same syntax as `activeTextTemplate`.
1988
+ *
1989
+ * When not set, falls back to the default "Thought for X seconds" text.
1990
+ * @example "Thought for ~{duration}~"
1991
+ */
1992
+ completeTextTemplate?: string;
1993
+ /**
1994
+ * Primary color for shimmer-color animation mode.
1995
+ * Defaults to the current text color.
1996
+ */
1997
+ loadingAnimationColor?: string;
1998
+ /**
1999
+ * Secondary/end color for shimmer-color animation mode.
2000
+ * Creates a gradient sweep between `loadingAnimationColor` and this color.
2001
+ * @default "#3b82f6"
2002
+ */
2003
+ loadingAnimationSecondaryColor?: string;
2004
+ /**
2005
+ * Duration of one full animation cycle in milliseconds.
2006
+ * Applies to pulse, shimmer, shimmer-color, and rainbow modes.
2007
+ * @default 2000
2008
+ */
2009
+ loadingAnimationDuration?: number;
1867
2010
  };
1868
2011
  type AgentWidgetSuggestionChipsConfig = {
1869
2012
  fontFamily?: "sans-serif" | "serif" | "mono";