@miiflow/assistant-ui 0.5.2 → 0.9.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.
Files changed (42) hide show
  1. package/dist/{WelcomeScreen-D32Tsu6G.d.ts → WelcomeScreen-CVxniqqK.d.ts} +39 -9
  2. package/dist/{avatar-CAmTN1L7.d.ts → avatar-DnLePg72.d.ts} +2 -2
  3. package/dist/branding-NieTEGQf.d.ts +32 -0
  4. package/dist/chunk-ERJKVQQT.js +132 -0
  5. package/dist/chunk-ERJKVQQT.js.map +1 -0
  6. package/dist/chunk-IUCKTDTZ.js +2 -0
  7. package/dist/chunk-IUCKTDTZ.js.map +1 -0
  8. package/dist/chunk-NG4HKXYB.js +2 -0
  9. package/dist/chunk-NG4HKXYB.js.map +1 -0
  10. package/dist/chunk-NKLA5PPB.js +2 -0
  11. package/dist/chunk-NKLA5PPB.js.map +1 -0
  12. package/dist/chunk-QECTWT2H.js +2 -0
  13. package/dist/chunk-QECTWT2H.js.map +1 -0
  14. package/dist/client/index.d.ts +68 -4
  15. package/dist/client/index.js +7 -5
  16. package/dist/client/index.js.map +1 -1
  17. package/dist/composer/index.d.ts +180 -0
  18. package/dist/composer/index.js +2 -0
  19. package/dist/composer/index.js.map +1 -0
  20. package/dist/context/index.d.ts +16 -3
  21. package/dist/context/index.js +1 -1
  22. package/dist/hooks/index.d.ts +2 -2
  23. package/dist/hooks/index.js +1 -1
  24. package/dist/index.d.ts +18 -6
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/{message-D3D59U_Q.d.ts → message-D2ElX5k7.d.ts} +5 -4
  28. package/dist/primitives/index.d.ts +3 -3
  29. package/dist/{streaming-Q8hp5ev4.d.ts → streaming-B_u_jno6.d.ts} +77 -124
  30. package/dist/styled/index.d.ts +246 -73
  31. package/dist/styled/index.js +1 -1
  32. package/dist/styles-no-preflight.css +1 -1
  33. package/dist/styles.css +1 -1
  34. package/dist/types-DeHbndy0.d.ts +48 -0
  35. package/package.json +20 -3
  36. package/dist/branding-SzYU4ncD.d.ts +0 -18
  37. package/dist/chunk-NSTK5EUQ.js +0 -2
  38. package/dist/chunk-NSTK5EUQ.js.map +0 -1
  39. package/dist/chunk-OCKHJ4WO.js +0 -2
  40. package/dist/chunk-OCKHJ4WO.js.map +0 -1
  41. package/dist/chunk-VDFIXLNO.js +0 -20
  42. package/dist/chunk-VDFIXLNO.js.map +0 -1
@@ -18,9 +18,14 @@ interface StreamingOptions {
18
18
  onError?: (error: Error) => void;
19
19
  }
20
20
  /**
21
- * Extended chunk types for agentic streaming
21
+ * Extended chunk types for agentic streaming.
22
+ *
23
+ * `subtask` / `progress` / structured `planning` chunks are retained for
24
+ * historical messages persisted before the unified-ReAct migration. New
25
+ * streams emit `planning` only as plain text (enter_plan_mode / exit_plan_mode)
26
+ * and route sub-agent work through the `subagent` chunk type.
22
27
  */
23
- type ChunkType = "content" | "thinking" | "tool" | "observation" | "answer" | "planning" | "subtask" | "progress" | "wave_start" | "wave_complete" | "parallel_subtask_start" | "parallel_subtask_complete" | "multi_agent_planning" | "multi_agent_planning_complete" | "subagent_start" | "subagent_complete" | "subagent_failed" | "synthesis" | "clarification_needed" | "visualization" | "media" | "subagent" | "file_operation" | "terminal" | "search_results" | "web_operation" | "claude_text" | "claude_thinking";
28
+ type ChunkType = "content" | "thinking" | "tool" | "observation" | "answer" | "planning" | "subtask" | "progress" | "clarification_needed" | "tool_approval_needed" | "visualization" | "media" | "artifact" | "subagent" | "suggested_action_created";
24
29
  /**
25
30
  * Subtask data structure for Plan & Execute mode
26
31
  */
@@ -56,105 +61,15 @@ interface ProgressData {
56
61
  percentage: number;
57
62
  waveNumber?: number;
58
63
  }
59
- interface WaveData {
60
- waveNumber: number;
61
- subtaskIds: number[];
62
- parallelCount: number;
63
- totalWaves: number;
64
- startTime?: number;
65
- executionTime?: number;
66
- success?: boolean;
67
- completedIds?: number[];
68
- }
69
- interface ParallelSubtaskData {
70
- subtaskId: number;
71
- waveNumber: number;
72
- description?: string;
73
- success?: boolean;
74
- result?: string;
75
- error?: string;
76
- executionTime?: number;
77
- }
78
- interface SubagentInfo {
79
- id?: string;
80
- name: string;
81
- role?: string;
82
- task?: string;
83
- status: "pending" | "running" | "completed" | "failed";
84
- result?: string;
85
- error?: string;
86
- executionTime?: number;
87
- }
88
- interface SearchResultItem {
89
- filePath: string;
90
- lineNumber?: number;
91
- snippet?: string;
92
- }
93
64
  interface SubagentChunkData {
94
65
  subagentId: string;
95
66
  subagentType: string;
96
- description: string;
97
67
  prompt?: string;
98
68
  status: "running" | "completed" | "failed";
99
69
  result?: string;
100
70
  durationMs?: number;
101
71
  nestedChunks: StreamingChunk[];
102
72
  }
103
- interface FileOperationChunkData {
104
- toolUseId: string;
105
- operation: "read" | "write" | "edit";
106
- filePath: string;
107
- status: "pending" | "completed" | "error";
108
- content?: string;
109
- totalLines?: number;
110
- language?: string;
111
- oldString?: string;
112
- newString?: string;
113
- error?: string;
114
- durationMs?: number;
115
- }
116
- interface TerminalChunkData {
117
- toolUseId: string;
118
- command: string;
119
- description?: string;
120
- status: "running" | "completed" | "failed";
121
- stdout?: string;
122
- stderr?: string;
123
- exitCode?: number;
124
- durationMs?: number;
125
- }
126
- interface SearchResultsChunkData {
127
- toolUseId: string;
128
- tool: "glob" | "grep";
129
- pattern: string;
130
- path?: string;
131
- status: "pending" | "completed" | "error";
132
- results: SearchResultItem[];
133
- totalCount: number;
134
- error?: string;
135
- durationMs?: number;
136
- }
137
- interface WebOperationChunkData {
138
- toolUseId: string;
139
- operation: "search" | "fetch";
140
- query?: string;
141
- url?: string;
142
- status: "pending" | "completed" | "error";
143
- results?: string;
144
- content?: string;
145
- error?: string;
146
- durationMs?: number;
147
- }
148
- interface ClaudeToolChunkData {
149
- toolUseId: string;
150
- toolName: string;
151
- toolDescription?: string;
152
- toolInput?: Record<string, unknown>;
153
- status: "pending" | "completed" | "error";
154
- content?: string;
155
- isError?: boolean;
156
- durationMs?: number;
157
- }
158
73
  interface ClarificationData {
159
74
  question: string;
160
75
  options?: string[];
@@ -166,6 +81,15 @@ interface ClarificationData {
166
81
  subagentRole?: string;
167
82
  toolCallId?: string;
168
83
  }
84
+ interface ToolApprovalData {
85
+ toolName: string;
86
+ toolDescription: string;
87
+ toolInputs: Record<string, unknown>;
88
+ toolSchema?: Record<string, unknown>;
89
+ toolCallId?: string;
90
+ /** Human-readable tool identity surfaced in the approval eyebrow (e.g. "Yahoo Finance · Stock Basic Info"). Falls back to toolName when omitted. */
91
+ toolLabel?: string;
92
+ }
169
93
  type VisualizationType = "chart" | "table" | "card" | "kpi" | "code_preview" | "form";
170
94
  type ChartDataType = "line" | "bar" | "pie" | "area" | "scatter" | "composed";
171
95
  interface ChartSeries {
@@ -191,7 +115,7 @@ interface ChartVisualizationData {
191
115
  xAxis?: ChartAxis;
192
116
  yAxis?: ChartAxis;
193
117
  }
194
- type TableColumnType = "string" | "number" | "currency" | "date" | "badge" | "link" | "boolean" | "progress";
118
+ type TableColumnType = "string" | "number" | "currency" | "date" | "badge" | "link" | "boolean" | "progress" | "media";
195
119
  interface TableColumn {
196
120
  key: string;
197
121
  label: string;
@@ -227,14 +151,15 @@ interface KpiMetric {
227
151
  value: string | number;
228
152
  unit?: string;
229
153
  trend?: "up" | "down" | "neutral";
230
- change?: string;
154
+ change?: string | number;
231
155
  changeLabel?: string;
232
156
  sparkline?: number[];
233
157
  color?: string;
158
+ prominence?: "primary" | "secondary";
234
159
  }
235
160
  interface KpiVisualizationData {
236
161
  metrics: KpiMetric[];
237
- layout?: "row" | "grid";
162
+ layout?: "row" | "grid" | "bento";
238
163
  }
239
164
  interface CodePreviewVisualizationData {
240
165
  code: string;
@@ -312,6 +237,37 @@ interface MediaChunkData {
312
237
  toolName?: string;
313
238
  };
314
239
  }
240
+ /**
241
+ * Artifact chunk — a tool-produced file (PDF, HTML, ...) persisted server-side.
242
+ *
243
+ * The backend emits the chunk twice per artifact: first with
244
+ * `status: "pending"` (before rendering) so the frontend can show a skeleton
245
+ * card, then again with `status: "ready"` (URL + size populated) or
246
+ * `status: "failed"` (errorMessage populated). Consumers should key by `id`
247
+ * and replace state on the second chunk.
248
+ *
249
+ * `url` is a stable proxy URL (`/assistant/artifacts/<id>/download/`) — the
250
+ * backend re-signs on every request, so it does not expire mid-session. It is
251
+ * `null` while status is pending/failed.
252
+ */
253
+ type ArtifactStatus = "pending" | "ready" | "failed";
254
+ interface ArtifactChunkData {
255
+ id: string;
256
+ kind: "pdf" | "html" | string;
257
+ title: string;
258
+ description?: string;
259
+ status?: ArtifactStatus;
260
+ url: string | null;
261
+ mimetype?: string;
262
+ sizeBytes?: number;
263
+ pageCount?: number;
264
+ createdAt?: string;
265
+ errorMessage?: string;
266
+ context?: {
267
+ orchestratorType?: string;
268
+ toolName?: string;
269
+ };
270
+ }
315
271
  /**
316
272
  * Extended streaming chunk with full agentic support
317
273
  */
@@ -328,33 +284,14 @@ interface StreamingChunk {
328
284
  subtaskData?: SubTaskData;
329
285
  planData?: PlanData;
330
286
  progress?: ProgressData;
331
- isReplan?: boolean;
332
- waveData?: WaveData;
333
- parallelSubtaskData?: ParallelSubtaskData;
334
- waveNumber?: number;
335
- isParallel?: boolean;
336
- isMultiAgent?: boolean;
337
- subagentInfo?: SubagentInfo;
338
- subagentAllocations?: {
339
- name: string;
340
- focus: string;
341
- query?: string;
342
- }[];
343
- replanAttempt?: number;
344
- maxReplans?: number;
345
- failureReason?: string;
346
- isSynthesis?: boolean;
347
- orchestrator?: "react" | "plan_execute" | "claude_agent_sdk";
287
+ orchestrator?: "react" | "plan_execute";
348
288
  parentSubtaskId?: number;
349
289
  subagentData?: SubagentChunkData;
350
- fileOperationData?: FileOperationChunkData;
351
- terminalData?: TerminalChunkData;
352
- searchResultsData?: SearchResultsChunkData;
353
- webOperationData?: WebOperationChunkData;
354
- claudeToolData?: ClaudeToolChunkData;
355
290
  clarificationData?: ClarificationData;
291
+ toolApprovalData?: ToolApprovalData;
356
292
  visualizationData?: VisualizationChunkData;
357
293
  mediaData?: MediaChunkData;
294
+ artifactData?: ArtifactChunkData;
358
295
  toolUseId?: string;
359
296
  }
360
297
  /**
@@ -365,16 +302,15 @@ interface StreamingMessage {
365
302
  textContent: string;
366
303
  previousMessageId?: string;
367
304
  chunks?: StreamingChunk[];
368
- orchestratorType?: "react" | "plan_execute" | "claude_agent_sdk";
305
+ orchestratorType?: "react" | "plan_execute";
369
306
  executionPlan?: PlanData;
370
- isParallelExecution?: boolean;
371
- waveData?: Record<number, WaveData>;
372
- currentWaveNumber?: number;
373
307
  suggestedActions?: FollowupAction[];
374
308
  activeSubagents?: Map<string, SubagentChunkData>;
375
309
  pendingClarification?: ClarificationData;
310
+ pendingToolApproval?: ToolApprovalData;
376
311
  visualizations?: VisualizationChunkData[];
377
312
  medias?: MediaChunkData[];
313
+ artifacts?: ArtifactChunkData[];
378
314
  }
379
315
  /**
380
316
  * Follow-up action suggested by AI
@@ -386,12 +322,19 @@ interface FollowupAction {
386
322
  context: Record<string, unknown>;
387
323
  }
388
324
  type EventStatus = "pending" | "running" | "completed" | "failed";
389
- type EventType = "thinking" | "planning" | "tool" | "observation" | "subtask";
325
+ type EventType = "thinking" | "planning" | "tool" | "observation" | "subtask" | "subagent";
390
326
  interface BaseEvent {
391
327
  id: string;
392
328
  type: EventType;
393
329
  status: EventStatus;
394
330
  timestamp?: number;
331
+ /**
332
+ * Elapsed wall-clock duration for this event in seconds. Populated by
333
+ * `convertTimelineToEvents` from pairwise timeline timestamps; left
334
+ * undefined for live streaming chunks (no per-chunk arrival time is
335
+ * carried through the stream).
336
+ */
337
+ durationSeconds?: number;
395
338
  }
396
339
  interface ThinkingEvent extends BaseEvent {
397
340
  type: "thinking";
@@ -423,7 +366,17 @@ interface SubtaskEvent extends BaseEvent {
423
366
  error?: string;
424
367
  children?: Event[];
425
368
  }
426
- type Event = ThinkingEvent | PlanningEvent | ToolEvent | ObservationEvent | SubtaskEvent;
369
+ /**
370
+ * Sub-assistant dispatch event. Rendered inline in the parent's reasoning
371
+ * timeline at the position the dispatch was issued. Carries the full
372
+ * SubagentChunkData so the renderer can show name, status, and the
373
+ * streaming result without a separate lookup.
374
+ */
375
+ interface SubagentEvent extends BaseEvent {
376
+ type: "subagent";
377
+ subagentData: SubagentChunkData;
378
+ }
379
+ type Event = ThinkingEvent | PlanningEvent | ToolEvent | ObservationEvent | SubtaskEvent | SubagentEvent;
427
380
  type VisualizationActionEvent = {
428
381
  type: "form_submit";
429
382
  action: string;
@@ -436,4 +389,4 @@ type VisualizationActionEvent = {
436
389
  action: string;
437
390
  };
438
391
 
439
- export type { VisualizationType as A, WebOperationChunkData as B, ClarificationData as C, Event as E, FormVisualizationData as F, KpiVisualizationData as K, MediaChunkData as M, ObservationEvent as O, PlanData as P, StreamingChunk as S, TableVisualizationData as T, VisualizationChunkData as V, WaveData as W, StreamChunk as a, StreamingOptions as b, StreamingState as c, VisualizationActionEvent as d, ChartVisualizationData as e, VisualizationConfig as f, CardVisualizationData as g, CodePreviewVisualizationData as h, EventStatus as i, ChunkType as j, ClaudeToolChunkData as k, EventType as l, FileOperationChunkData as m, FollowupAction as n, ParallelSubtaskData as o, PlanningEvent as p, ProgressData as q, SearchResultsChunkData as r, StreamingMessage as s, SubTaskData as t, SubagentChunkData as u, SubagentInfo as v, SubtaskEvent as w, TerminalChunkData as x, ThinkingEvent as y, ToolEvent as z };
392
+ export type { ArtifactChunkData as A, CardVisualizationData as C, Event as E, FollowupAction as F, KpiVisualizationData as K, MediaChunkData as M, ObservationEvent as O, PlanData as P, StreamChunk as S, TableVisualizationData as T, VisualizationActionEvent as V, ArtifactStatus as a, ChartVisualizationData as b, ChunkType as c, ClarificationData as d, CodePreviewVisualizationData as e, EventStatus as f, EventType as g, FormVisualizationData as h, PlanningEvent as i, ProgressData as j, StreamingChunk as k, StreamingMessage as l, StreamingOptions as m, StreamingState as n, SubTaskData as o, SubagentChunkData as p, SubtaskEvent as q, ThinkingEvent as r, ToolApprovalData as s, ToolEvent as t, VisualizationChunkData as u, VisualizationConfig as v, VisualizationType as w };