@blocksdiy/react-common 1.36.2 → 1.38.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/components/agent-chat.d.ts +22 -22
- package/dist/components/agent-chat.d.ts.map +1 -1
- package/dist/components/new-agent-chat.d.ts +30 -11
- package/dist/components/new-agent-chat.d.ts.map +1 -1
- package/dist/components/new-agent-chat.js +115 -12
- package/dist/iframe-communication/bridge-provider.d.ts +1 -1
- package/dist/iframe-communication/bridge-provider.d.ts.map +1 -1
- package/dist/iframe-communication/iframe-bridge-provider.d.ts +1 -1
- package/dist/iframe-communication/iframe-bridge-provider.d.ts.map +1 -1
- package/dist/iframe-communication/platform-bridge-provider.d.ts +2 -2
- package/dist/iframe-communication/platform-bridge-provider.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -80,34 +80,34 @@ export interface ToolCardProps {
|
|
|
80
80
|
size?: string;
|
|
81
81
|
variant?: string;
|
|
82
82
|
}
|
|
83
|
-
export declare function ToolCard({ asChild, render, defaultOpen, open: controlledOpen, onOpenChange, size, variant, ...props }: React.ComponentProps<"div"> & ToolCardProps): import("react
|
|
83
|
+
export declare function ToolCard({ asChild, render, defaultOpen, open: controlledOpen, onOpenChange, size, variant, ...props }: React.ComponentProps<"div"> & ToolCardProps): import("react").JSX.Element;
|
|
84
84
|
export interface ToolHeaderProps {
|
|
85
85
|
asChild?: boolean;
|
|
86
86
|
render?: RenderProp;
|
|
87
87
|
collapseTrigger?: ReactNode;
|
|
88
88
|
}
|
|
89
|
-
export declare function ToolHeader({ asChild, render, collapseTrigger, children, ...props }: React.ComponentProps<"div"> & ToolHeaderProps): import("react
|
|
89
|
+
export declare function ToolHeader({ asChild, render, collapseTrigger, children, ...props }: React.ComponentProps<"div"> & ToolHeaderProps): import("react").JSX.Element;
|
|
90
90
|
export interface ToolTitleProps {
|
|
91
91
|
asChild?: boolean;
|
|
92
92
|
render?: RenderProp;
|
|
93
93
|
status?: ReactNode;
|
|
94
94
|
}
|
|
95
|
-
export declare function ToolTitle({ asChild, render, status, children, ...props }: React.ComponentProps<"div"> & ToolTitleProps): import("react
|
|
95
|
+
export declare function ToolTitle({ asChild, render, status, children, ...props }: React.ComponentProps<"div"> & ToolTitleProps): import("react").JSX.Element;
|
|
96
96
|
export interface ToolActionsProps {
|
|
97
97
|
asChild?: boolean;
|
|
98
98
|
render?: RenderProp;
|
|
99
99
|
}
|
|
100
|
-
export declare function ToolActions({ asChild, render, ...props }: React.ComponentProps<"div"> & ToolActionsProps): import("react
|
|
100
|
+
export declare function ToolActions({ asChild, render, ...props }: React.ComponentProps<"div"> & ToolActionsProps): import("react").JSX.Element;
|
|
101
101
|
export interface ToolCollapseTriggerProps {
|
|
102
102
|
asChild?: boolean;
|
|
103
103
|
render?: RenderProp;
|
|
104
104
|
}
|
|
105
|
-
export declare function ToolCollapseTrigger({ asChild, render, onClick, ...props }: React.ComponentProps<"button"> & ToolCollapseTriggerProps): import("react
|
|
105
|
+
export declare function ToolCollapseTrigger({ asChild, render, onClick, ...props }: React.ComponentProps<"button"> & ToolCollapseTriggerProps): import("react").JSX.Element;
|
|
106
106
|
export interface ToolContentProps {
|
|
107
107
|
asChild?: boolean;
|
|
108
108
|
render?: RenderProp;
|
|
109
109
|
}
|
|
110
|
-
export declare function ToolContent({ asChild, render, ...props }: React.ComponentProps<"div"> & ToolContentProps): import("react
|
|
110
|
+
export declare function ToolContent({ asChild, render, ...props }: React.ComponentProps<"div"> & ToolContentProps): import("react").JSX.Element;
|
|
111
111
|
export interface AgentChatData {
|
|
112
112
|
agent: {
|
|
113
113
|
title?: string;
|
|
@@ -142,7 +142,7 @@ export interface AgentChatRootProps {
|
|
|
142
142
|
useDynamicUI?: boolean;
|
|
143
143
|
}
|
|
144
144
|
export type ResolvedAgentChatConfig = Pick<AgentChatRootProps, "agentChatData" | "shortTermMemory" | "useDynamicUI">;
|
|
145
|
-
export declare const AgentChatRoot: ({ appId, token, agentChatId, children, chatId, noPersistency, defaultThreadId, chatContext, chatContextFiles, agentChatData, memoryEnabled, shortTermMemory, useDynamicUI, }: AgentChatRootProps) => import("react
|
|
145
|
+
export declare const AgentChatRoot: ({ appId, token, agentChatId, children, chatId, noPersistency, defaultThreadId, chatContext, chatContextFiles, agentChatData, memoryEnabled, shortTermMemory, useDynamicUI, }: AgentChatRootProps) => import("react").JSX.Element | null;
|
|
146
146
|
export interface AgentChatVoiceContextValue {
|
|
147
147
|
isConnected: boolean;
|
|
148
148
|
isConnecting: boolean;
|
|
@@ -162,84 +162,84 @@ export declare const useAgentChatVoice: () => AgentChatVoiceContextValue;
|
|
|
162
162
|
export interface AgentChatVoiceProps {
|
|
163
163
|
children?: ReactNode;
|
|
164
164
|
}
|
|
165
|
-
export declare function AgentChatVoice({ children }: AgentChatVoiceProps): import("react
|
|
165
|
+
export declare function AgentChatVoice({ children }: AgentChatVoiceProps): import("react").JSX.Element;
|
|
166
166
|
export interface AgentChatMessageProps {
|
|
167
167
|
message: MessageItem;
|
|
168
168
|
index: number;
|
|
169
169
|
}
|
|
170
|
-
export declare function AgentChatMessage({ message, index, ...props }: React.ComponentProps<"div"> & AgentChatMessageProps): import("react
|
|
170
|
+
export declare function AgentChatMessage({ message, index, ...props }: React.ComponentProps<"div"> & AgentChatMessageProps): import("react").JSX.Element;
|
|
171
171
|
export interface AgentChatMessagesProps {
|
|
172
172
|
asChild?: boolean;
|
|
173
173
|
render?: RenderProp;
|
|
174
174
|
autoScroll?: boolean;
|
|
175
175
|
scrollAreaClassName?: string;
|
|
176
176
|
}
|
|
177
|
-
export declare function AgentChatMessages({ asChild, render, autoScroll, scrollAreaClassName, ...props }: React.ComponentProps<"div"> & AgentChatMessagesProps): import("react
|
|
177
|
+
export declare function AgentChatMessages({ asChild, render, autoScroll, scrollAreaClassName, ...props }: React.ComponentProps<"div"> & AgentChatMessagesProps): import("react").JSX.Element;
|
|
178
178
|
export interface AgentChatThinkingProps {
|
|
179
179
|
asChild?: boolean;
|
|
180
180
|
render?: RenderProp;
|
|
181
181
|
}
|
|
182
|
-
export declare function AgentChatThinking({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatThinkingProps): import("react
|
|
182
|
+
export declare function AgentChatThinking({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatThinkingProps): import("react").JSX.Element | null;
|
|
183
183
|
export interface AgentChatFetchingProps {
|
|
184
184
|
asChild?: boolean;
|
|
185
185
|
render?: RenderProp;
|
|
186
186
|
}
|
|
187
|
-
export declare function AgentChatFetching({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatFetchingProps): import("react
|
|
187
|
+
export declare function AgentChatFetching({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatFetchingProps): import("react").JSX.Element | null;
|
|
188
188
|
export interface AgentChatInputProps {
|
|
189
189
|
asChild?: boolean;
|
|
190
190
|
render?: RenderProp;
|
|
191
191
|
onSubmit?: (e: React.FormEvent<HTMLTextAreaElement>) => void;
|
|
192
192
|
acceptFiles?: boolean;
|
|
193
193
|
}
|
|
194
|
-
export declare function AgentChatInput({ asChild, render, onChange, onKeyDown, onPaste, onDragOver, onDragLeave, onDrop, onSubmit, acceptFiles, ...props }: React.ComponentProps<"textarea"> & AgentChatInputProps): import("react
|
|
194
|
+
export declare function AgentChatInput({ asChild, render, onChange, onKeyDown, onPaste, onDragOver, onDragLeave, onDrop, onSubmit, acceptFiles, ...props }: React.ComponentProps<"textarea"> & AgentChatInputProps): import("react").JSX.Element;
|
|
195
195
|
export interface AgentChatSendTriggerProps {
|
|
196
196
|
asChild?: boolean;
|
|
197
197
|
render?: RenderProp;
|
|
198
198
|
}
|
|
199
|
-
export declare function AgentChatSendTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatSendTriggerProps): import("react
|
|
199
|
+
export declare function AgentChatSendTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatSendTriggerProps): import("react").JSX.Element;
|
|
200
200
|
export interface AgentChatAttachmentTriggerProps {
|
|
201
201
|
asChild?: boolean;
|
|
202
202
|
render?: RenderProp;
|
|
203
203
|
accept?: string;
|
|
204
204
|
multiple?: boolean;
|
|
205
205
|
}
|
|
206
|
-
export declare function AgentChatAttachmentTrigger({ asChild, render, onClick, disabled, accept, multiple, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentTriggerProps): import("react
|
|
206
|
+
export declare function AgentChatAttachmentTrigger({ asChild, render, onClick, disabled, accept, multiple, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentTriggerProps): import("react").JSX.Element;
|
|
207
207
|
export interface AgentChatAttachmentProps {
|
|
208
208
|
attachment: Attachment;
|
|
209
209
|
asChild?: boolean;
|
|
210
210
|
render?: RenderProp;
|
|
211
211
|
}
|
|
212
|
-
export declare function AgentChatAttachment({ attachment, asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatAttachmentProps): import("react
|
|
212
|
+
export declare function AgentChatAttachment({ attachment, asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatAttachmentProps): import("react").JSX.Element;
|
|
213
213
|
export interface AgentChatAttachmentRemoveProps {
|
|
214
214
|
attachment: Attachment;
|
|
215
215
|
asChild?: boolean;
|
|
216
216
|
render?: RenderProp;
|
|
217
217
|
}
|
|
218
|
-
export declare function AgentChatAttachmentRemove({ attachment, asChild, render, onClick, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentRemoveProps): import("react
|
|
218
|
+
export declare function AgentChatAttachmentRemove({ attachment, asChild, render, onClick, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentRemoveProps): import("react").JSX.Element;
|
|
219
219
|
export interface AgentChatVoiceStartTriggerProps {
|
|
220
220
|
asChild?: boolean;
|
|
221
221
|
render?: RenderProp;
|
|
222
222
|
}
|
|
223
|
-
export declare function AgentChatVoiceStartTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatVoiceStartTriggerProps): import("react
|
|
223
|
+
export declare function AgentChatVoiceStartTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatVoiceStartTriggerProps): import("react").JSX.Element;
|
|
224
224
|
export interface AgentChatVoiceEndTriggerProps {
|
|
225
225
|
asChild?: boolean;
|
|
226
226
|
render?: RenderProp;
|
|
227
227
|
}
|
|
228
|
-
export declare function AgentChatVoiceEndTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatVoiceEndTriggerProps): import("react
|
|
228
|
+
export declare function AgentChatVoiceEndTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatVoiceEndTriggerProps): import("react").JSX.Element;
|
|
229
229
|
export interface AgentChatVoiceMuteTriggerProps {
|
|
230
230
|
asChild?: boolean;
|
|
231
231
|
render?: RenderProp;
|
|
232
232
|
}
|
|
233
|
-
export declare function AgentChatVoiceMuteTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatVoiceMuteTriggerProps): import("react
|
|
233
|
+
export declare function AgentChatVoiceMuteTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatVoiceMuteTriggerProps): import("react").JSX.Element;
|
|
234
234
|
export interface AgentChatVoiceStatusProps {
|
|
235
235
|
asChild?: boolean;
|
|
236
236
|
render?: RenderProp;
|
|
237
237
|
}
|
|
238
|
-
export declare function AgentChatVoiceStatus({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatVoiceStatusProps): import("react
|
|
238
|
+
export declare function AgentChatVoiceStatus({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatVoiceStatusProps): import("react").JSX.Element;
|
|
239
239
|
export interface AgentChatVoiceVolumeProps {
|
|
240
240
|
asChild?: boolean;
|
|
241
241
|
render?: RenderProp;
|
|
242
242
|
}
|
|
243
|
-
export declare function AgentChatVoiceVolume({ asChild, render, style, ...props }: React.ComponentProps<"div"> & AgentChatVoiceVolumeProps): import("react
|
|
243
|
+
export declare function AgentChatVoiceVolume({ asChild, render, style, ...props }: React.ComponentProps<"div"> & AgentChatVoiceVolumeProps): import("react").JSX.Element;
|
|
244
244
|
export {};
|
|
245
245
|
//# sourceMappingURL=agent-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat.d.ts","sourceRoot":"","sources":["../../src/components/agent-chat.tsx"],"names":[],"mappings":"AASA,OAAO,EAAiB,SAAS,EAAE,cAAc,EAAwD,MAAM,OAAO,CAAC;AAEvH,OAAO,EAAgB,KAAK,gBAAgB,EAA4B,MAAM,yBAAyB,CAAC;AACxG,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAYzE,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAqBD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,IAAI,CAAC;AACzC,KAAK,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,qBAAqB,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAE3D,UAAU,eAAe;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,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8B,+BAmBjE;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAe,EACf,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,yBAAyB,+BAuBzD;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAe,EACf,MAAM,EACN,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,yBAAyB,+BAmBzD"}
|
|
@@ -61,6 +61,14 @@ export interface AgentChatContextValue {
|
|
|
61
61
|
renderToolCall: ReturnType<typeof useRenderToolCall>;
|
|
62
62
|
sendMessage: (message: Omit<UserMessage, "id" | "role">) => Promise<void>;
|
|
63
63
|
sendFromInputs: () => Promise<void>;
|
|
64
|
+
/** Resumes a run parked on a server-side interrupt. Rejects if the resume fails. */
|
|
65
|
+
/** Resolves false when a run was already in flight, so nothing was sent. */
|
|
66
|
+
resolveInterrupt: (resume: unknown) => Promise<boolean>;
|
|
67
|
+
/** Answers one parked card; resumes once every card of the turn is answered. */
|
|
68
|
+
answerInterrupt: (answer: {
|
|
69
|
+
toolCallId: string;
|
|
70
|
+
answer: unknown;
|
|
71
|
+
}) => Promise<void>;
|
|
64
72
|
stopGeneration: () => void;
|
|
65
73
|
addAttachments: (attachments: Attachment[]) => void;
|
|
66
74
|
removeAttachment: (url: string) => void;
|
|
@@ -95,62 +103,73 @@ export interface AgentChatRootProps {
|
|
|
95
103
|
* `agent-self-modify` flag) — never in the published app.
|
|
96
104
|
*/
|
|
97
105
|
selfEditEnabled?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Set by a chat surface that carries renderers for the server-declared pauses
|
|
108
|
+
* (`ask_user` and `ask-component-…`). The backend offers those tools ONLY when
|
|
109
|
+
* this is true, and then strips their browser-side predecessors.
|
|
110
|
+
*
|
|
111
|
+
* It must originate in the surface's own component, not here: this package ships
|
|
112
|
+
* with the platform and is identical everywhere, while each app carries its own
|
|
113
|
+
* frozen copy of the chat component — and that copy is the only thing that differs
|
|
114
|
+
* between an app that can draw these pauses and one that cannot.
|
|
115
|
+
*/
|
|
116
|
+
supportsServerInterrupt?: boolean;
|
|
98
117
|
}
|
|
99
|
-
export declare const AgentChatRoot: ({ ...props }: AgentChatRootProps) => import("react
|
|
118
|
+
export declare const AgentChatRoot: ({ ...props }: AgentChatRootProps) => import("react").JSX.Element | null;
|
|
100
119
|
export interface AgentChatMessageProps {
|
|
101
120
|
message: Message;
|
|
102
121
|
index: number;
|
|
103
122
|
}
|
|
104
|
-
export declare function AgentChatMessage({ message, index, ...props }: React.ComponentProps<"div"> & AgentChatMessageProps): import("react
|
|
123
|
+
export declare function AgentChatMessage({ message, index, ...props }: React.ComponentProps<"div"> & AgentChatMessageProps): import("react").JSX.Element | null;
|
|
105
124
|
export interface AgentChatMessageGroupProps {
|
|
106
125
|
messageGroup: {
|
|
107
126
|
messageIds: string[];
|
|
108
127
|
role: "assistant" | "user";
|
|
109
128
|
};
|
|
110
129
|
}
|
|
111
|
-
export declare function AgentChatMessageGroup({ messageGroup, ...props }: React.ComponentProps<"div"> & AgentChatMessageGroupProps): import("react
|
|
130
|
+
export declare function AgentChatMessageGroup({ messageGroup, ...props }: React.ComponentProps<"div"> & AgentChatMessageGroupProps): import("react").JSX.Element;
|
|
112
131
|
export interface AgentChatMessagesProps {
|
|
113
132
|
scrollAreaClassName?: string;
|
|
114
133
|
}
|
|
115
|
-
export declare function AgentChatMessages({ scrollAreaClassName, ...props }: React.ComponentProps<"div"> & AgentChatMessagesProps): import("react
|
|
134
|
+
export declare function AgentChatMessages({ scrollAreaClassName, ...props }: React.ComponentProps<"div"> & AgentChatMessagesProps): import("react").JSX.Element;
|
|
116
135
|
export interface AgentChatThinkingProps {
|
|
117
136
|
asChild?: boolean;
|
|
118
137
|
render?: RenderProp;
|
|
119
138
|
}
|
|
120
|
-
export declare function AgentChatThinking({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatThinkingProps): import("react
|
|
139
|
+
export declare function AgentChatThinking({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatThinkingProps): import("react").JSX.Element | null;
|
|
121
140
|
export interface AgentChatFetchingProps {
|
|
122
141
|
asChild?: boolean;
|
|
123
142
|
render?: RenderProp;
|
|
124
143
|
}
|
|
125
|
-
export declare function AgentChatFetching({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatFetchingProps): import("react
|
|
144
|
+
export declare function AgentChatFetching({ asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatFetchingProps): import("react").JSX.Element | null;
|
|
126
145
|
export interface AgentChatInputProps {
|
|
127
146
|
asChild?: boolean;
|
|
128
147
|
render?: RenderProp;
|
|
129
148
|
onSubmit?: (e: React.FormEvent<HTMLTextAreaElement>) => void;
|
|
130
149
|
}
|
|
131
|
-
export declare function AgentChatInput({ asChild, render, onChange, onKeyDown, onPaste, onDragOver, onDragLeave, onDrop, onSubmit, ...props }: React.ComponentProps<"textarea"> & AgentChatInputProps): import("react
|
|
150
|
+
export declare function AgentChatInput({ asChild, render, onChange, onKeyDown, onPaste, onDragOver, onDragLeave, onDrop, onSubmit, ...props }: React.ComponentProps<"textarea"> & AgentChatInputProps): import("react").JSX.Element;
|
|
132
151
|
export interface AgentChatSendTriggerProps {
|
|
133
152
|
asChild?: boolean;
|
|
134
153
|
render?: RenderProp;
|
|
135
154
|
}
|
|
136
|
-
export declare function AgentChatSendTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatSendTriggerProps): import("react
|
|
155
|
+
export declare function AgentChatSendTrigger({ asChild, render, onClick, disabled, ...props }: React.ComponentProps<"button"> & AgentChatSendTriggerProps): import("react").JSX.Element;
|
|
137
156
|
export interface AgentChatAttachmentTriggerProps {
|
|
138
157
|
asChild?: boolean;
|
|
139
158
|
render?: RenderProp;
|
|
140
159
|
accept?: string;
|
|
141
160
|
multiple?: boolean;
|
|
142
161
|
}
|
|
143
|
-
export declare function AgentChatAttachmentTrigger({ asChild, render, onClick, disabled, accept, multiple, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentTriggerProps): import("react
|
|
162
|
+
export declare function AgentChatAttachmentTrigger({ asChild, render, onClick, disabled, accept, multiple, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentTriggerProps): import("react").JSX.Element;
|
|
144
163
|
export interface AgentChatAttachmentProps {
|
|
145
164
|
attachment: Attachment;
|
|
146
165
|
asChild?: boolean;
|
|
147
166
|
render?: RenderProp;
|
|
148
167
|
}
|
|
149
|
-
export declare function AgentChatAttachment({ attachment, asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatAttachmentProps): import("react
|
|
168
|
+
export declare function AgentChatAttachment({ attachment, asChild, render, ...props }: React.ComponentProps<"div"> & AgentChatAttachmentProps): import("react").JSX.Element;
|
|
150
169
|
export interface AgentChatAttachmentRemoveProps {
|
|
151
170
|
attachment: Attachment;
|
|
152
171
|
asChild?: boolean;
|
|
153
172
|
render?: RenderProp;
|
|
154
173
|
}
|
|
155
|
-
export declare function AgentChatAttachmentRemove({ attachment, asChild, render, onClick, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentRemoveProps): import("react
|
|
174
|
+
export declare function AgentChatAttachmentRemove({ attachment, asChild, render, onClick, ...props }: React.ComponentProps<"button"> & AgentChatAttachmentRemoveProps): import("react").JSX.Element;
|
|
156
175
|
//# sourceMappingURL=new-agent-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-agent-chat.d.ts","sourceRoot":"","sources":["../../src/components/new-agent-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,WAAW,EAAE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AAO,EACP,QAAQ,EACR,MAAM,EACN,QAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,+BAA+B,+BAmElE;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,OAAe,EACf,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,wBAAwB,+BAWxD;AAED,MAAM,WAAW,8BAA8B;IAC7C,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,yBAAyB,CAAC,EACxC,UAAU,EACV,OAAe,EACf,MAAM,EACN,OAAO,EACP,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,8BAA8B,+BAgBjE"}
|
|
@@ -26,9 +26,7 @@ const generateId = (length = 10) => {
|
|
|
26
26
|
.toString(36)
|
|
27
27
|
.substring(2, 2 + length);
|
|
28
28
|
};
|
|
29
|
-
// Assistant tool calls with no matching ToolMessage
|
|
30
|
-
// frontend tools (e.g. user-choice) reach this state; backend tools resolve in
|
|
31
|
-
// the same run. Used to auto-skip dangling answer UIs when the user types past.
|
|
29
|
+
// Assistant tool calls with no matching ToolMessage.
|
|
32
30
|
const _collectPendingToolCalls = (messages) => {
|
|
33
31
|
const toolMessageIds = new Set();
|
|
34
32
|
for (const m of messages) {
|
|
@@ -49,6 +47,35 @@ const _collectPendingToolCalls = (messages) => {
|
|
|
49
47
|
}
|
|
50
48
|
return pending;
|
|
51
49
|
};
|
|
50
|
+
// Message order IS the order of the interrupt's `action_requests`, so decisions
|
|
51
|
+
// pair with them by index and need no ids. Matched by name rather than by "has no
|
|
52
|
+
// local handler", so a backend tool merely mid-flight is never taken for a pause.
|
|
53
|
+
const _SERVER_PAUSE_TOOL_NAME = "ask_user";
|
|
54
|
+
const _SERVER_PAUSE_TOOL_PREFIX = "ask-component-";
|
|
55
|
+
const _isServerPause = (toolCall) => toolCall.function.name === _SERVER_PAUSE_TOOL_NAME || toolCall.function.name.startsWith(_SERVER_PAUSE_TOOL_PREFIX);
|
|
56
|
+
// ONE assistant message's pauses, never the transcript's: the server batches a
|
|
57
|
+
// turn's pauses into a single interrupt requiring exactly one decision each, and a
|
|
58
|
+
// transcript can also hold pauses from a run that died before parking. Counting
|
|
59
|
+
// those raises the count check — permanently, since the checkpoint never advances.
|
|
60
|
+
const _collectServerPauses = (messages) => {
|
|
61
|
+
const answered = new Set();
|
|
62
|
+
for (const m of messages) {
|
|
63
|
+
if (m.role === "tool" && "toolCallId" in m && typeof m.toolCallId === "string") {
|
|
64
|
+
answered.add(m.toolCallId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
68
|
+
const m = messages[i];
|
|
69
|
+
if (m.role !== "assistant" || !("toolCalls" in m) || !m.toolCalls) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const pauses = m.toolCalls.filter((toolCall) => !answered.has(toolCall.id) && _isServerPause(toolCall));
|
|
73
|
+
if (pauses.length > 0) {
|
|
74
|
+
return pauses;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return [];
|
|
78
|
+
};
|
|
52
79
|
// CopilotKit 1.60.x: `connectAgent()` awaits every replayed HITL tool call's
|
|
53
80
|
// handler before resolving `isAvailable`, and a `useHumanInTheLoop` handler
|
|
54
81
|
// only resolves on `respond()` — so a transcript replayed with an unanswered
|
|
@@ -281,6 +308,7 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
281
308
|
});
|
|
282
309
|
return groups;
|
|
283
310
|
}, [copilotMessages]);
|
|
311
|
+
const interruptAnswersRef = useRef(new Map());
|
|
284
312
|
// Mirror `currentThreadId` onto the agent instance — the `<CopilotKit>`
|
|
285
313
|
// prop only feeds React context, but `agent.threadId` is what hits the
|
|
286
314
|
// wire and the LangGraph checkpoint. `<CopilotChat>` does this for you;
|
|
@@ -292,6 +320,9 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
292
320
|
if (copilotAgent && currentThreadId) {
|
|
293
321
|
copilotAgent.threadId = currentThreadId;
|
|
294
322
|
}
|
|
323
|
+
// Carrying answers across a thread swap would pair them with another
|
|
324
|
+
// conversation's pause.
|
|
325
|
+
interruptAnswersRef.current.clear();
|
|
295
326
|
}, [copilotAgent, currentThreadId]);
|
|
296
327
|
const [prompt, setPrompt] = useState("");
|
|
297
328
|
const [attachments, setAttachments] = useState([]);
|
|
@@ -302,9 +333,9 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
302
333
|
// CopilotKit reports `isLoading` during connect/replay as well as real runs.
|
|
303
334
|
// Only expose thinking once the bootstrap connect phase has completed.
|
|
304
335
|
const isThinking = isAgentRunning && !isFetchingMessages;
|
|
305
|
-
const runAgentWithRetry = useCallback(async (agentToRun, messageCountAtRunStart) => {
|
|
336
|
+
const runAgentWithRetry = useCallback(async (agentToRun, messageCountAtRunStart, forwardedProps) => {
|
|
306
337
|
if (agentToRun.isRunning) {
|
|
307
|
-
return;
|
|
338
|
+
return false;
|
|
308
339
|
}
|
|
309
340
|
const runAgentAndThrowError = async () => {
|
|
310
341
|
let runEventError;
|
|
@@ -317,7 +348,7 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
317
348
|
},
|
|
318
349
|
});
|
|
319
350
|
try {
|
|
320
|
-
await copilotkit.runAgent({ agent: agentToRun });
|
|
351
|
+
await copilotkit.runAgent({ agent: agentToRun, forwardedProps });
|
|
321
352
|
if (runEventError) {
|
|
322
353
|
throw runEventError;
|
|
323
354
|
}
|
|
@@ -334,18 +365,75 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
334
365
|
const status = getAgentRunErrorStatus(error);
|
|
335
366
|
if (status !== undefined && status >= 500 && status < 600 && !hasAgentStartedResponding) {
|
|
336
367
|
await runAgentAndThrowError();
|
|
337
|
-
return;
|
|
368
|
+
return true;
|
|
338
369
|
}
|
|
339
370
|
throw error;
|
|
340
371
|
}
|
|
372
|
+
return true;
|
|
341
373
|
}, [copilotkit]);
|
|
342
|
-
const sendMessage = useCallback((message) => {
|
|
374
|
+
const sendMessage = useCallback(async (message) => {
|
|
343
375
|
if (!canSendMessage || !copilotAgent || copilotAgent.isRunning) {
|
|
344
|
-
return
|
|
376
|
+
return;
|
|
345
377
|
}
|
|
346
378
|
copilotAgent.addMessage({ ...message, id: generateId(), role: "user" });
|
|
347
|
-
|
|
379
|
+
await runAgentWithRetry(copilotAgent, copilotAgent.messages.length);
|
|
348
380
|
}, [canSendMessage, copilotAgent, runAgentWithRetry]);
|
|
381
|
+
// Not sourced from `useInterrupt`: that hook only hands `resolve` to its own
|
|
382
|
+
// `render`, which it skips whenever nothing is pending — so after a reload there
|
|
383
|
+
// is no way to obtain it. `runAgentWithRetry`'s `isRunning` guard makes a
|
|
384
|
+
// double-click a no-op rather than a duplicate resume.
|
|
385
|
+
const resolveInterrupt = useCallback(async (resume) => {
|
|
386
|
+
if (!copilotAgent) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
return runAgentWithRetry(copilotAgent, copilotAgent.messages.length, { command: { resume } });
|
|
390
|
+
}, [copilotAgent, runAgentWithRetry]);
|
|
391
|
+
// Resumes only once EVERY pause of the turn has an answer: a short decisions list
|
|
392
|
+
// fails `HumanInTheLoopMiddleware`'s count check, and the checkpoint never
|
|
393
|
+
// advances, so every later answer fails identically.
|
|
394
|
+
const answerInterrupt = useCallback(async ({ toolCallId, answer }) => {
|
|
395
|
+
if (!copilotAgent) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const pauses = _collectServerPauses(copilotAgent.messages);
|
|
399
|
+
// Thrown, never returned: a caller resets its submitting state on a rejection,
|
|
400
|
+
// while a silent return leaves the card locked with the answer discarded.
|
|
401
|
+
if (!pauses.some((toolCall) => toolCall.id === toolCallId)) {
|
|
402
|
+
throw new Error(`answerInterrupt: ${toolCallId} is not a pending pause of this turn`);
|
|
403
|
+
}
|
|
404
|
+
const answers = interruptAnswersRef.current;
|
|
405
|
+
answers.set(toolCallId, answer);
|
|
406
|
+
const unanswered = pauses.filter((toolCall) => !answers.has(toolCall.id));
|
|
407
|
+
if (unanswered.length > 0) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const decisions = pauses.map((toolCall) => ({
|
|
411
|
+
type: "respond",
|
|
412
|
+
// `?? null` because a component may call `respond()` with no payload, and
|
|
413
|
+
// `JSON.stringify(undefined)` drops the key, which raises server-side.
|
|
414
|
+
message: JSON.stringify(answers.get(toolCall.id) ?? null),
|
|
415
|
+
}));
|
|
416
|
+
const sent = new Map(answers);
|
|
417
|
+
answers.clear();
|
|
418
|
+
const restore = () => sent.forEach((value, id) => answers.set(id, value));
|
|
419
|
+
let resumed = false;
|
|
420
|
+
try {
|
|
421
|
+
// Every answer goes back, not just this call's, or a resume that never
|
|
422
|
+
// happened discards the rest of the turn's cards with it.
|
|
423
|
+
resumed = await resolveInterrupt({ decisions });
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
restore();
|
|
427
|
+
throw error;
|
|
428
|
+
}
|
|
429
|
+
if (!resumed) {
|
|
430
|
+
// A run was already in flight, so nothing was sent: `isThinking` lags
|
|
431
|
+
// `agent.isRunning` by a commit, which leaves `respond` live for a moment
|
|
432
|
+
// after a run starts.
|
|
433
|
+
restore();
|
|
434
|
+
throw new Error("answerInterrupt: a run was already in flight; answer kept for retry");
|
|
435
|
+
}
|
|
436
|
+
}, [copilotAgent, resolveInterrupt]);
|
|
349
437
|
const stopGeneration = useCallback(() => {
|
|
350
438
|
copilotStopGeneration();
|
|
351
439
|
copilotAgent?.abortRun?.();
|
|
@@ -526,8 +614,13 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
526
614
|
// resolve the parked Promise itself — it lingers in memory until page
|
|
527
615
|
// reload. Acceptable: one closure per skip, cleared on refresh, no
|
|
528
616
|
// functional impact.
|
|
617
|
+
//
|
|
618
|
+
// Only tool calls THIS frontend answers. A `getTool` miss means the tool runs
|
|
619
|
+
// on the backend (`useRenderTool` registers a renderer, not a tool), so an
|
|
620
|
+
// unanswered one is a parked graph — faking its result would tell the server
|
|
621
|
+
// the question was answered and it would never resume.
|
|
529
622
|
if (copilotAgent) {
|
|
530
|
-
const pending = _collectPendingToolCalls(copilotAgent.messages);
|
|
623
|
+
const pending = _collectPendingToolCalls(copilotAgent.messages).filter((toolCall) => Boolean(copilotkit.getTool({ toolName: toolCall.function.name })));
|
|
531
624
|
for (const toolCall of pending) {
|
|
532
625
|
copilotAgent.addMessage({
|
|
533
626
|
id: generateId(),
|
|
@@ -574,6 +667,8 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
|
|
|
574
667
|
attachments,
|
|
575
668
|
sendMessage,
|
|
576
669
|
sendFromInputs,
|
|
670
|
+
resolveInterrupt,
|
|
671
|
+
answerInterrupt,
|
|
577
672
|
stopGeneration,
|
|
578
673
|
addAttachments,
|
|
579
674
|
removeAttachment,
|
|
@@ -597,7 +692,7 @@ export const AgentChatRoot = ({ ...props
|
|
|
597
692
|
// memoryEnabled = false,
|
|
598
693
|
// shortTermMemory,
|
|
599
694
|
}) => {
|
|
600
|
-
const { appId, token, children, agentId, agentHarness, useAgentBlockDirectChat, agentChatId, componentIds, chatId, defaultThreadId, noPersistency, chatContext, chatContextFiles, selfEditEnabled, } = props;
|
|
695
|
+
const { appId, token, children, agentId, agentHarness, useAgentBlockDirectChat, agentChatId, componentIds, chatId, defaultThreadId, noPersistency, chatContext, chatContextFiles, selfEditEnabled, supportsServerInterrupt, } = props;
|
|
601
696
|
const socketId = websocketsService.getSocketId();
|
|
602
697
|
const headers = useMemo(() => ({
|
|
603
698
|
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
@@ -610,6 +705,12 @@ export const AgentChatRoot = ({ ...props
|
|
|
610
705
|
const [agentChatBlock, setAgentChatBlock] = useState(null);
|
|
611
706
|
const [agentBlock, setAgentBlock] = useState(null);
|
|
612
707
|
const [components, setComponents] = useState([]);
|
|
708
|
+
// Chat components reach the backend nowhere else on the direct-chat path.
|
|
709
|
+
// Withheld unless this surface can render a server-parked one, so an older surface
|
|
710
|
+
// keeps its browser-side pause and pays no extra block fetch.
|
|
711
|
+
const serverInterruptComponentIds = useMemo(() => supportsServerInterrupt
|
|
712
|
+
? components.filter((component) => component.userInterrupt).map((component) => component.id)
|
|
713
|
+
: [], [components, supportsServerInterrupt]);
|
|
613
714
|
const chatContextStr = chatContext == null ? undefined : typeof chatContext === "string" ? chatContext : JSON.stringify(chatContext);
|
|
614
715
|
const getAgentChatBlock = useCallback(async () => {
|
|
615
716
|
if (!agentChatId) {
|
|
@@ -692,6 +793,8 @@ export const AgentChatRoot = ({ ...props
|
|
|
692
793
|
chatContext: chatContextStr,
|
|
693
794
|
chatContextFiles,
|
|
694
795
|
...(selfEditEnabled ? { selfEditEnabled: true } : {}),
|
|
796
|
+
...(supportsServerInterrupt ? { supportsServerInterrupt: true } : {}),
|
|
797
|
+
...(serverInterruptComponentIds.length ? { serverInterruptComponentIds } : {}),
|
|
695
798
|
},
|
|
696
799
|
// Explicit false: when undefined, CopilotKit auto-enables its inspector
|
|
697
800
|
// devtools on localhost hostnames.
|
|
@@ -22,7 +22,7 @@ export type BridgeState<TApi extends Methods> = {
|
|
|
22
22
|
} & BridgeData<TApi>;
|
|
23
23
|
export declare function BridgeProvider({ children }: {
|
|
24
24
|
children: ReactNode;
|
|
25
|
-
}): import("react
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
26
|
export declare function useBridgeState<TApi extends Methods>(hookName?: string, providerName?: string): BridgeState<TApi>;
|
|
27
27
|
export {};
|
|
28
28
|
//# sourceMappingURL=bridge-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/bridge-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAiB,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE5E,KAAK,iBAAiB,CAAC,IAAI,IAAI;IAAE,GAAG,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAC/D,KAAK,eAAe,GAAG;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AACxD,KAAK,mBAAmB,GAAG;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhE,KAAK,UAAU,CAAC,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAExF,MAAM,MAAM,WAAW,CAAC,IAAI,SAAS,OAAO,IAAI;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,mBAAmB,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACzC,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1C,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AAIrB,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE
|
|
1
|
+
{"version":3,"file":"bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/bridge-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAiB,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE5E,KAAK,iBAAiB,CAAC,IAAI,IAAI;IAAE,GAAG,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAC/D,KAAK,eAAe,GAAG;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AACxD,KAAK,mBAAmB,GAAG;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhE,KAAK,UAAU,CAAC,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAExF,MAAM,MAAM,WAAW,CAAC,IAAI,SAAS,OAAO,IAAI;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,mBAAmB,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACzC,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1C,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AAIrB,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BA+BnE;AAED,wBAAgB,cAAc,CAAC,IAAI,SAAS,OAAO,EAAE,QAAQ,SAAmB,EAAE,YAAY,SAAmB,qBAOhH"}
|
|
@@ -9,7 +9,7 @@ import { IframeApi, PlatformApi } from "./types.js";
|
|
|
9
9
|
export declare function IframeBridgeProvider({ iframeApi, children }: {
|
|
10
10
|
iframeApi: IframeApi;
|
|
11
11
|
children: ReactNode;
|
|
12
|
-
}): import("react
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
13
|
/**
|
|
14
14
|
* Hook for iframe-side code to access the platform's api and connection state.
|
|
15
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/iframe-bridge-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE
|
|
1
|
+
{"version":3,"file":"iframe-bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/iframe-bridge-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAM1G;AAED;;;;;GAKG;AACH,wBAAgB,WAAW;;;;EAyD1B"}
|
|
@@ -9,7 +9,7 @@ import type { IframeApi, PlatformApi } from "./types.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function PlatformBridgeProvider({ children }: {
|
|
11
11
|
children: ReactNode;
|
|
12
|
-
}): import("react
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
13
|
type PlatformBridgeIframeProps = {
|
|
14
14
|
platformApi: PlatformApi;
|
|
15
15
|
} & Omit<React.IframeHTMLAttributes<HTMLIFrameElement>, "ref" | "allow">;
|
|
@@ -19,7 +19,7 @@ type PlatformBridgeIframeProps = {
|
|
|
19
19
|
*
|
|
20
20
|
* Accepts all standard `<iframe>` HTML attributes (`src`, `className`, `allow`, etc.).
|
|
21
21
|
*/
|
|
22
|
-
export declare function PlatformBridgeIframe({ platformApi, ...iframeProps }: PlatformBridgeIframeProps): import("react
|
|
22
|
+
export declare function PlatformBridgeIframe({ platformApi, ...iframeProps }: PlatformBridgeIframeProps): import("react").JSX.Element;
|
|
23
23
|
/**
|
|
24
24
|
* Hook for platform-side code to interact with the iframe.
|
|
25
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/platform-bridge-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE
|
|
1
|
+
{"version":3,"file":"platform-bridge-provider.d.ts","sourceRoot":"","sources":["../../src/iframe-communication/platform-bridge-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAE3E;AAED,KAAK,yBAAyB,GAAG;IAAE,WAAW,EAAE,WAAW,CAAA;CAAE,GAAG,IAAI,CAClE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,KAAK,GAAG,OAAO,CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,EAAE,yBAAyB,+BA2E9F;AAED;;;;GAIG;AACH,wBAAgB,SAAS;;;;EAQxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocksdiy/react-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React common",
|
|
6
6
|
"keywords": [],
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"@radix-ui/react-slot": "^1.2.3",
|
|
37
37
|
"@vapi-ai/web": "^2.5.2",
|
|
38
38
|
"penpal": "^7.0.6",
|
|
39
|
-
"react": "^19.2.
|
|
39
|
+
"react": "^19.2.8",
|
|
40
40
|
"use-stick-to-bottom": "1.1.4",
|
|
41
|
-
"@blocksdiy/blocks-client-api": "1.
|
|
41
|
+
"@blocksdiy/blocks-client-api": "1.5.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/react": "^19.2.
|
|
44
|
+
"@types/react": "^19.2.18",
|
|
45
45
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
46
46
|
"eslint-plugin-react": "^7.37.5",
|
|
47
47
|
"eslint-plugin-react-hooks": "^7.0.1",
|