@waniwani/sdk 0.4.8 → 0.4.9-beta.10

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.
@@ -1,4 +1,5 @@
1
1
  import * as react from 'react';
2
+ import { RefObject } from 'react';
2
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
  import { ContentBlock } from '@modelcontextprotocol/sdk/types.js';
4
5
 
@@ -133,6 +134,11 @@ interface ChatCardProps extends ChatBaseProps {
133
134
  interface ChatHandle {
134
135
  /** Programmatically send a user message into the chat */
135
136
  sendMessage: (text: string) => void;
137
+ /**
138
+ * Send a user message and wait for the assistant response to complete.
139
+ * Returns the final assistant message. Useful for eval/testing flows.
140
+ */
141
+ sendMessageAndWait: (text: string) => Promise<unknown>;
136
142
  /** Scroll to the chat input, focus it, and show a highlight glow */
137
143
  focus: () => void;
138
144
  }
@@ -141,6 +147,26 @@ type ChatWidgetProps = ChatBarProps;
141
147
 
142
148
  declare const ChatBar: react.ForwardRefExoticComponent<ChatBarProps & react.RefAttributes<ChatHandle>>;
143
149
 
150
+ type EvalPanelProps = {
151
+ /** API endpoint to fetch sessions from
152
+ *
153
+ * @default "/api/waniwani"
154
+ */
155
+ api?: string;
156
+ /** Ref to the ChatCard or ChatBar so eval turns flow through the chat UI */
157
+ chatRef: RefObject<ChatHandle | null>;
158
+ };
159
+ /**
160
+ * Dev-only evaluation panel for replaying recorded sessions and asserting tool usage.
161
+ *
162
+ * This component is automatically tree-shaken from production builds —
163
+ * it returns `null` when `process.env.NODE_ENV === "production"`.
164
+ *
165
+ * To populate sessions, set `WANIWANI_EVAL=1` in your `.env` and add
166
+ * session files to `evals/sessions/`.
167
+ */
168
+ declare function EvalPanel(props: EvalPanelProps): react_jsx_runtime.JSX.Element | null;
169
+
144
170
  type ModelContextContentBlock = ContentBlock;
145
171
  type ModelContextUpdate = {
146
172
  content?: ModelContextContentBlock[];
@@ -202,4 +228,4 @@ declare const DARK_THEME: ChatTheme;
202
228
  declare function mergeTheme(userTheme?: ChatTheme): Required<ChatTheme>;
203
229
  declare function themeToCSSProperties(theme: Required<ChatTheme>): Record<string, string>;
204
230
 
205
- export { ChatBar, type ChatBarProps, type ChatBaseProps, ChatCard, type ChatCardProps, type ChatHandle, type ChatTheme, ChatBar as ChatWidget, type ChatWidgetProps, DARK_THEME, DEFAULT_THEME, type McpAppDisplayMode, McpAppFrame, type McpAppFrameProps, type SuggestionsConfig, mergeTheme, themeToCSSProperties };
231
+ export { ChatBar, type ChatBarProps, type ChatBaseProps, ChatCard, type ChatCardProps, type ChatHandle, type ChatTheme, ChatBar as ChatWidget, type ChatWidgetProps, DARK_THEME, DEFAULT_THEME, EvalPanel, type McpAppDisplayMode, McpAppFrame, type McpAppFrameProps, type SuggestionsConfig, mergeTheme, themeToCSSProperties };