@agents24/chat-react 0.2.0 → 0.3.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/types.d.ts CHANGED
@@ -80,13 +80,30 @@ export type ChatUiBlocksPart = {
80
80
  errorText?: string | null;
81
81
  raw: Record<string, unknown>;
82
82
  };
83
+ export type ChatHitlKind = "tool_review" | "mcp_auth" | "user_approval" | "app_data_permission";
84
+ export type ChatHitlAction = "approve" | "reject" | "connect" | "skip";
85
+ export type ChatHitlStatus = "pending" | "resolved" | "expired" | "cancelled" | "invalidated";
86
+ export type ChatHitlResolution = {
87
+ action?: ChatHitlAction | null;
88
+ outcome?: string | null;
89
+ reason?: string | null;
90
+ resolvedAt?: string | null;
91
+ resolver?: {
92
+ principalType?: string | null;
93
+ principalId?: string | null;
94
+ } | null;
95
+ };
83
96
  export type ChatHitlPart = {
84
97
  id: string;
85
98
  type: "hitl";
86
99
  kind: "hitl";
87
- hitl: Record<string, unknown>;
88
- interruptId?: string | null;
89
- hitlKind?: string | null;
100
+ interruptId: string;
101
+ hitlKind: ChatHitlKind;
102
+ message: string;
103
+ allowedActions: ChatHitlAction[];
104
+ status: ChatHitlStatus;
105
+ presentation: Record<string, unknown>;
106
+ resolution?: ChatHitlResolution | null;
90
107
  raw: Record<string, unknown>;
91
108
  };
92
109
  export type ChatErrorPart = {
@@ -235,21 +252,21 @@ export type ChatSubmitMessage = {
235
252
  state?: Record<string, unknown>;
236
253
  [key: string]: unknown;
237
254
  };
238
- export type ChatHitlDecisionType = "approve" | "edit" | "reject" | "respond" | "connect" | string;
239
- export type ChatHitlResumeDecision = {
240
- type: ChatHitlDecisionType;
241
- action_id?: string | null;
242
- message?: string;
243
- response?: string;
244
- edited_action?: Record<string, unknown>;
245
- [key: string]: unknown;
246
- };
247
255
  export type ChatHitlResumeInput = {
248
256
  runId: string;
249
257
  interruptId: string;
250
- decisions: ChatHitlResumeDecision[];
258
+ action: ChatHitlAction;
259
+ comment?: string;
251
260
  client?: Record<string, unknown>;
252
261
  };
262
+ export type ChatHitlResumeResult = {
263
+ run_id: string;
264
+ thread_id?: string | null;
265
+ interrupt_id: string;
266
+ run_status: string;
267
+ resolution_status: string;
268
+ idempotent: boolean;
269
+ };
253
270
  export type ChatMcpAuthStartInput = {
254
271
  runId: string;
255
272
  interruptId?: string | null;
@@ -296,11 +313,7 @@ export type ChatTransport = {
296
313
  file: File;
297
314
  signal?: AbortSignal;
298
315
  }) => Promise<ChatAttachment>;
299
- resumeHitl?: (input: ChatHitlResumeInput) => Promise<{
300
- run_id?: string;
301
- status?: string;
302
- thread_id?: string | null;
303
- }>;
316
+ resumeHitl?: (input: ChatHitlResumeInput) => Promise<ChatHitlResumeResult>;
304
317
  startMcpAuth?: (input: ChatMcpAuthStartInput) => Promise<ChatMcpAuthStartResult>;
305
318
  subscribeThreadEvents?: (input: {
306
319
  cursor?: number | null;
@@ -346,8 +359,13 @@ export type ChatController = {
346
359
  copiedMessageId: string | null;
347
360
  lastThinkingDurationMs: number | null;
348
361
  activeRunId: string | null;
362
+ pendingHitl: ChatHitlPart | null;
363
+ isResolvingHitl: boolean;
349
364
  handleSubmit: (message: ChatSubmitMessage) => Promise<void>;
350
365
  attachRun: (runId: string, threadId?: string | null) => Promise<void>;
366
+ resumeHitl: (input: Omit<ChatHitlResumeInput, "runId"> & {
367
+ runId?: string;
368
+ }) => Promise<ChatHitlResumeResult>;
351
369
  handleStop: () => void;
352
370
  handleCopy: (content: string, messageId: string) => void;
353
371
  handleLike: (msg: ChatMessage) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- import type { ChatHitlPart, ChatMessage, ChatPart } from "../types";
3
- import { type McpConnectRequiredStatus } from "./mcp-connect-required-card";
2
+ import type { ChatHitlAction, ChatHitlPart, ChatMessage, ChatPart } from "../types";
3
+ import type { McpConnectRequiredStatus } from "./mcp-connect-required-card";
4
4
  export type AgentChatPartActionState = {
5
5
  status?: McpConnectRequiredStatus | string;
6
6
  error?: string | null;
@@ -9,7 +9,7 @@ export type AgentResponseTimelineProps = {
9
9
  getHitlActionState?: (part: ChatHitlPart) => AgentChatPartActionState | undefined;
10
10
  isLoading?: boolean;
11
11
  message: ChatMessage;
12
- onHitlAction?: (part: ChatHitlPart, decision: string) => void;
12
+ onHitlAction?: (part: ChatHitlPart, action: ChatHitlAction, comment?: string) => void;
13
13
  renderPart?: (part: ChatPart, message: ChatMessage) => React.ReactNode;
14
14
  };
15
15
  declare function DefaultPartRow({ activeToolId, getHitlActionState, isLoading, message, onHitlAction, part, }: {