Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(assistant-ui): accept data-* attributes on button-slot props

Steven Enamakel255f2678e6d0
diff --git a/app/src/components/assistant-ui/elements/approval-card.tsx b/app/src/components/assistant-ui/elements/approval-card.tsx
index 742c9bb475..544dfa5b8b 100644
--- a/app/src/components/assistant-ui/elements/approval-card.tsx
+++ b/app/src/components/assistant-ui/elements/approval-card.tsx
@@ -30,6 +30,16 @@ import { cn } from '@/components/assistant-ui/lib/utils';
import { field, inkButton, paper } from './surfaces';
+/**
+ * A button-slot prop type that permits `data-analytics-id` / `data-testid`
+ * (and any other `data-*` attribute) on an object literal. Plain
+ * `ComponentProps<'button'>` fails TypeScript's excess-property check for a
+ * literal assigned to a typed prop (JSX itself allows any `data-*`
+ * attribute; a plain object literal does not inherit that allowance).
+ */
+type ButtonSlotProps = ComponentProps<'button'> & Record<`data-${string}`, string>;
+
+
export type ApprovalState = 'request' | 'running' | 'done' | 'denied';
export function ApprovalCard({
@@ -78,9 +88,9 @@ export function ApprovalCard({
runningLabel?: string;
deniedLabel?: string;
doneLabel?: string;
- allowOnceProps?: ComponentProps<'button'>;
- alwaysAllowProps?: ComponentProps<'button'>;
- denyProps?: ComponentProps<'button'>;
+ allowOnceProps?: ButtonSlotProps;
+ alwaysAllowProps?: ButtonSlotProps;
+ denyProps?: ButtonSlotProps;
}) {
return (
<div
diff --git a/app/src/components/assistant-ui/elements/elicitation-form.tsx b/app/src/components/assistant-ui/elements/elicitation-form.tsx
index d243d258cb..96547040b7 100644
--- a/app/src/components/assistant-ui/elements/elicitation-form.tsx
+++ b/app/src/components/assistant-ui/elements/elicitation-form.tsx
@@ -26,6 +26,16 @@ import { cn } from '@/components/assistant-ui/lib/utils';
import { field, inkButton, mono, paper } from './surfaces';
+/**
+ * A button-slot prop type that permits `data-analytics-id` / `data-testid`
+ * (and any other `data-*` attribute) on an object literal. Plain
+ * `ComponentProps<'button'>` fails TypeScript's excess-property check for a
+ * literal assigned to a typed prop (JSX itself allows any `data-*`
+ * attribute; a plain object literal does not inherit that allowance).
+ */
+type ButtonSlotProps = ComponentProps<'button'> & Record<`data-${string}`, string>;
+
+
export type ElicitationState = 'request' | 'accepted' | 'declined';
export interface ElicitationField {
@@ -77,8 +87,8 @@ export function ElicitationForm({
sendLabel?: string;
acceptedLabel?: (server: string) => string;
declinedLabel?: string;
- acceptProps?: ComponentProps<'button'>;
- declineProps?: ComponentProps<'button'>;
+ acceptProps?: ButtonSlotProps;
+ declineProps?: ButtonSlotProps;
}) {
return (
<div
diff --git a/app/src/components/assistant-ui/elements/permission-grant.tsx b/app/src/components/assistant-ui/elements/permission-grant.tsx
index d6b82a65fb..f29efa71f6 100644
--- a/app/src/components/assistant-ui/elements/permission-grant.tsx
+++ b/app/src/components/assistant-ui/elements/permission-grant.tsx
@@ -30,6 +30,16 @@ import { cn } from '@/components/assistant-ui/lib/utils';
import { field, inkButton, mono, paper } from './surfaces';
+/**
+ * A button-slot prop type that permits `data-analytics-id` / `data-testid`
+ * (and any other `data-*` attribute) on an object literal. Plain
+ * `ComponentProps<'button'>` fails TypeScript's excess-property check for a
+ * literal assigned to a typed prop (JSX itself allows any `data-*`
+ * attribute; a plain object literal does not inherit that allowance).
+ */
+type ButtonSlotProps = ComponentProps<'button'> & Record<`data-${string}`, string>;
+
+
export type GrantScope = 'session' | 'always' | 'denied';
export function PermissionGrant({
@@ -68,9 +78,9 @@ export function PermissionGrant({
pendingLabel?: string;
deniedLabel?: string;
grantedLabel?: (scope: GrantScope) => string;
- denyProps?: ComponentProps<'button'>;
- sessionProps?: ComponentProps<'button'>;
- alwaysProps?: ComponentProps<'button'>;
+ denyProps?: ButtonSlotProps;
+ sessionProps?: ButtonSlotProps;
+ alwaysProps?: ButtonSlotProps;
}) {
return (
<div