@xinghunm/ai-chat 0.4.0 → 1.0.1
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/index.d.mts +82 -12
- package/dist/index.d.ts +82 -12
- package/dist/index.js +636 -143
- package/dist/index.mjs +651 -158
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -101,6 +101,7 @@ interface PlanBooleanQuestion extends PlanQuestionBase {
|
|
|
101
101
|
* Supported question variants in a plan questionnaire.
|
|
102
102
|
*/
|
|
103
103
|
type PlanQuestion = PlanSingleSelectQuestion | PlanMultiSelectQuestion | PlanTextQuestion | PlanNumberQuestion | PlanBooleanQuestion;
|
|
104
|
+
type PlanQuestionnaireStatus = 'expired' | 'failed';
|
|
104
105
|
/**
|
|
105
106
|
* Structured question form emitted for plan-mode clarification flows.
|
|
106
107
|
*/
|
|
@@ -111,6 +112,8 @@ interface PlanQuestionnaire {
|
|
|
111
112
|
submitLabel?: string;
|
|
112
113
|
questions: PlanQuestion[];
|
|
113
114
|
answers?: Partial<Record<string, PlanQuestionnaireAnswerValue>>;
|
|
115
|
+
status?: PlanQuestionnaireStatus;
|
|
116
|
+
statusMessage?: string;
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
116
119
|
* Submission payload emitted by a questionnaire card.
|
|
@@ -129,6 +132,13 @@ interface ExecutionConfirmationSubmission {
|
|
|
129
132
|
content: string;
|
|
130
133
|
sourceMessageId?: string;
|
|
131
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Context metadata provided to custom structured submission handlers.
|
|
137
|
+
*/
|
|
138
|
+
interface ChatSubmissionContext {
|
|
139
|
+
sessionId?: string;
|
|
140
|
+
mode: ChatAgentMode;
|
|
141
|
+
}
|
|
132
142
|
/**
|
|
133
143
|
* Summary item used by structured assistant cards to describe parameter changes.
|
|
134
144
|
*/
|
|
@@ -142,22 +152,47 @@ interface ChatParameterSummaryItem {
|
|
|
142
152
|
*/
|
|
143
153
|
interface ExecutionProposal {
|
|
144
154
|
proposalId: string;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
resourceKey: string;
|
|
156
|
+
resourceName: string;
|
|
157
|
+
executorName?: string;
|
|
148
158
|
parameterSummary: ChatParameterSummaryItem[];
|
|
149
159
|
warnings?: string[];
|
|
150
160
|
requiresConfirmation: true;
|
|
151
161
|
}
|
|
152
162
|
/**
|
|
153
|
-
* Structured result summary emitted after a
|
|
163
|
+
* Structured result summary emitted after a task has started or completed.
|
|
154
164
|
*/
|
|
155
165
|
interface ResultSummary {
|
|
156
|
-
|
|
166
|
+
summaryId: string;
|
|
157
167
|
status: 'completed' | 'failed' | 'running' | 'pending';
|
|
158
168
|
headline: string;
|
|
159
169
|
details: string[];
|
|
160
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Merge behavior applied when a keyed custom block is patched repeatedly.
|
|
173
|
+
*/
|
|
174
|
+
type ChatCustomBlockMergePolicy = 'append' | 'replace' | 'ignore-duplicate';
|
|
175
|
+
/**
|
|
176
|
+
* Extensible custom block rendered by a consumer-provided block renderer.
|
|
177
|
+
*/
|
|
178
|
+
interface ChatCustomBlock {
|
|
179
|
+
type: 'custom';
|
|
180
|
+
kind: string;
|
|
181
|
+
data: unknown;
|
|
182
|
+
/**
|
|
183
|
+
* Stable key used to identify the same logical block across streaming patches.
|
|
184
|
+
* When present, keyed custom blocks are merged by `blockKey` regardless of `kind`.
|
|
185
|
+
*/
|
|
186
|
+
blockKey?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Merge strategy used when another custom block with the same key arrives.
|
|
189
|
+
*
|
|
190
|
+
* - `append`: keep appending blocks even if the key matches.
|
|
191
|
+
* - `replace`: replace the existing keyed block with the latest one.
|
|
192
|
+
* - `ignore-duplicate`: keep the first keyed block and ignore later duplicates.
|
|
193
|
+
*/
|
|
194
|
+
mergePolicy?: ChatCustomBlockMergePolicy;
|
|
195
|
+
}
|
|
161
196
|
/**
|
|
162
197
|
* Structured assistant block variants rendered by the chat thread.
|
|
163
198
|
*/
|
|
@@ -180,11 +215,7 @@ type ChatMessageBlock = {
|
|
|
180
215
|
} | {
|
|
181
216
|
type: 'questionnaire';
|
|
182
217
|
questionnaire: PlanQuestionnaire;
|
|
183
|
-
} |
|
|
184
|
-
type: 'custom';
|
|
185
|
-
kind: string;
|
|
186
|
-
data: unknown;
|
|
187
|
-
};
|
|
218
|
+
} | ChatCustomBlock;
|
|
188
219
|
/**
|
|
189
220
|
* Supported message body render orders for mixed text and structured blocks.
|
|
190
221
|
*/
|
|
@@ -279,6 +310,14 @@ interface ChatMessageBlockRendererProps {
|
|
|
279
310
|
* Optional renderer used for custom block variants.
|
|
280
311
|
*/
|
|
281
312
|
type ChatMessageBlockRenderer = (props: ChatMessageBlockRendererProps) => ReactNode;
|
|
313
|
+
/**
|
|
314
|
+
* Optional application-provided handler that intercepts questionnaire submissions.
|
|
315
|
+
*/
|
|
316
|
+
type ChatQuestionnaireSubmitHandler = (submission: PlanQuestionnaireSubmission, context: ChatSubmissionContext) => Promise<boolean | void> | boolean | void;
|
|
317
|
+
/**
|
|
318
|
+
* Optional application-provided handler that intercepts confirmation submissions.
|
|
319
|
+
*/
|
|
320
|
+
type ChatConfirmationSubmitHandler = (submission: ExecutionConfirmationSubmission, context: ChatSubmissionContext) => Promise<boolean | void> | boolean | void;
|
|
282
321
|
interface ChatModel {
|
|
283
322
|
id: string;
|
|
284
323
|
object: string;
|
|
@@ -336,10 +375,18 @@ interface AiChatLabels {
|
|
|
336
375
|
attachmentLimitNotice?: string;
|
|
337
376
|
userRoleLabel?: string;
|
|
338
377
|
assistantRoleLabel?: string;
|
|
378
|
+
expandMessageAriaLabel?: string;
|
|
379
|
+
collapseMessageAriaLabel?: string;
|
|
380
|
+
expandComposerAriaLabel?: string;
|
|
381
|
+
collapseComposerAriaLabel?: string;
|
|
339
382
|
stoppedResponse?: string;
|
|
340
383
|
assistantStreamingAriaLabel?: string;
|
|
341
384
|
networkError?: string;
|
|
342
385
|
genericError?: string;
|
|
386
|
+
questionnaireSubmitting?: string;
|
|
387
|
+
questionnaireSubmitted?: string;
|
|
388
|
+
questionnaireValidationPrefix?: string;
|
|
389
|
+
questionnaireSubmitFailed?: string;
|
|
343
390
|
}
|
|
344
391
|
/**
|
|
345
392
|
* Default English label values used when no labels are provided.
|
|
@@ -353,6 +400,10 @@ interface AiChatProviderBaseProps {
|
|
|
353
400
|
labels?: AiChatLabels;
|
|
354
401
|
/** Optional renderer used to extend message blocks with app-specific UI. */
|
|
355
402
|
renderMessageBlock?: ChatMessageBlockRenderer;
|
|
403
|
+
/** Optional handler used to intercept questionnaire submissions before the default send flow. */
|
|
404
|
+
handleQuestionnaireSubmit?: ChatQuestionnaireSubmitHandler;
|
|
405
|
+
/** Optional handler used to intercept confirmation submissions before the default send flow. */
|
|
406
|
+
handleConfirmationSubmit?: ChatConfirmationSubmitHandler;
|
|
356
407
|
/** Optional render order used for mixed text and structured message blocks. */
|
|
357
408
|
messageRenderOrder?: ChatMessageRenderOrder;
|
|
358
409
|
/**
|
|
@@ -416,6 +467,17 @@ interface DefaultChatTransportEndpoints {
|
|
|
416
467
|
/** Relative path used to request stream termination. */
|
|
417
468
|
terminate?: string;
|
|
418
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Tool execution policy applied to outgoing stream requests.
|
|
472
|
+
*/
|
|
473
|
+
interface ChatToolExecutionPolicy {
|
|
474
|
+
/** Enables tool execution headers for the stream request. */
|
|
475
|
+
enabled?: boolean;
|
|
476
|
+
/** Marks the request as requiring explicit approval before tool execution. */
|
|
477
|
+
approvalRequired?: boolean;
|
|
478
|
+
/** Approval timeout in seconds, forwarded when approval is enabled. */
|
|
479
|
+
approvalTimeoutSec?: number;
|
|
480
|
+
}
|
|
419
481
|
/**
|
|
420
482
|
* Options for the built-in HTTP transport adapter.
|
|
421
483
|
*/
|
|
@@ -424,6 +486,8 @@ interface CreateDefaultChatTransportOptions {
|
|
|
424
486
|
apiBaseUrl: string;
|
|
425
487
|
/** Authorization header value forwarded to the backend. */
|
|
426
488
|
authToken: string;
|
|
489
|
+
/** Optional tool execution policy translated into stream request headers. */
|
|
490
|
+
toolExecutionPolicy?: ChatToolExecutionPolicy;
|
|
427
491
|
/** Optional extra headers appended to each streaming chat completion request. */
|
|
428
492
|
streamHeaders?: Record<string, string>;
|
|
429
493
|
/** Optional transformer used to normalize custom stream packets. */
|
|
@@ -436,7 +500,7 @@ interface CreateDefaultChatTransportOptions {
|
|
|
436
500
|
/**
|
|
437
501
|
* Creates the built-in transport backed by the current HTTP chat API.
|
|
438
502
|
*/
|
|
439
|
-
declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, streamHeaders, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
|
|
503
|
+
declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, toolExecutionPolicy, streamHeaders, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
|
|
440
504
|
|
|
441
505
|
declare const ChatThread: () => _emotion_react_jsx_runtime.JSX.Element;
|
|
442
506
|
|
|
@@ -466,6 +530,8 @@ interface ChatComposerViewProps {
|
|
|
466
530
|
plan: string;
|
|
467
531
|
agent: string;
|
|
468
532
|
};
|
|
533
|
+
expandComposerAriaLabel: string;
|
|
534
|
+
collapseComposerAriaLabel: string;
|
|
469
535
|
onValueChange: (value: string) => void;
|
|
470
536
|
onPickImages: (files: FileList | File[]) => void;
|
|
471
537
|
onPasteImages: (files: File[]) => void;
|
|
@@ -529,6 +595,10 @@ interface ChatContextValue {
|
|
|
529
595
|
retryRef: MutableRefObject<() => Promise<void>>;
|
|
530
596
|
/** Optional block renderer used to extend message rendering with custom block types. */
|
|
531
597
|
renderMessageBlock?: ChatMessageBlockRenderer;
|
|
598
|
+
/** Optional handler used to intercept questionnaire submissions before the default send flow. */
|
|
599
|
+
handleQuestionnaireSubmit?: ChatQuestionnaireSubmitHandler;
|
|
600
|
+
/** Optional handler used to intercept confirmation submissions before the default send flow. */
|
|
601
|
+
handleConfirmationSubmit?: ChatConfirmationSubmitHandler;
|
|
532
602
|
/** Optional render order used for mixed text and structured message blocks. */
|
|
533
603
|
messageRenderOrder?: ChatMessageRenderOrder;
|
|
534
604
|
/** Optional packet transformer used by the legacy default adapter. */
|
|
@@ -551,4 +621,4 @@ declare const useChatContext: () => ChatContextValue;
|
|
|
551
621
|
*/
|
|
552
622
|
declare const useChatStore: <T>(selector: (state: ChatStore) => T) => T;
|
|
553
623
|
|
|
554
|
-
export { AiChat, type AiChatLabels, type AiChatProps, AiChatProvider, type AiChatProviderProps, CHAT_AGENT_MODES, CHAT_MESSAGE_RENDER_ORDERS, type ChatAgentMode, ChatComposer, type ChatComposerViewProps, ChatConversationList, type ChatImageAttachment, type ChatMessage, type ChatMessageBlock, type ChatMessageBlockRenderer, type ChatMessageBlockRendererProps, type ChatMessageRenderOrder, type ChatMessageStatus, type ChatModel, type ChatRole, type ChatSession, type ChatStreamMessagePatch, type ChatStreamPacketTransformArgs, type ChatStreamPacketUpdate, ChatThread, type ChatTransport, type ChatTransportStartStreamArgs, type CreateDefaultChatTransportOptions, DEFAULT_AI_CHAT_LABELS, DEFAULT_CHAT_AGENT_MODE, type DefaultChatTransportEndpoints, type ExecutionConfirmationSubmission, type ExecutionProposal, type PlanQuestionnaire, type PlanQuestionnaireSubmission, type ResultSummary, type TransformChatStreamPacket, createDefaultChatTransport, useChatContext, useChatStore };
|
|
624
|
+
export { AiChat, type AiChatLabels, type AiChatProps, AiChatProvider, type AiChatProviderProps, CHAT_AGENT_MODES, CHAT_MESSAGE_RENDER_ORDERS, type ChatAgentMode, ChatComposer, type ChatComposerViewProps, type ChatConfirmationSubmitHandler, ChatConversationList, type ChatImageAttachment, type ChatMessage, type ChatMessageBlock, type ChatMessageBlockRenderer, type ChatMessageBlockRendererProps, type ChatMessageRenderOrder, type ChatMessageStatus, type ChatModel, type ChatParameterSummaryItem, type ChatQuestionnaireSubmitHandler, type ChatRole, type ChatSession, type ChatStreamMessagePatch, type ChatStreamPacketTransformArgs, type ChatStreamPacketUpdate, type ChatSubmissionContext, ChatThread, type ChatToolExecutionPolicy, type ChatTransport, type ChatTransportStartStreamArgs, type CreateDefaultChatTransportOptions, DEFAULT_AI_CHAT_LABELS, DEFAULT_CHAT_AGENT_MODE, type DefaultChatTransportEndpoints, type ExecutionConfirmationSubmission, type ExecutionProposal, type PlanQuestionOption, type PlanQuestionnaire, type PlanQuestionnaireSubmission, type ResultSummary, type TransformChatStreamPacket, createDefaultChatTransport, useChatContext, useChatStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ interface PlanBooleanQuestion extends PlanQuestionBase {
|
|
|
101
101
|
* Supported question variants in a plan questionnaire.
|
|
102
102
|
*/
|
|
103
103
|
type PlanQuestion = PlanSingleSelectQuestion | PlanMultiSelectQuestion | PlanTextQuestion | PlanNumberQuestion | PlanBooleanQuestion;
|
|
104
|
+
type PlanQuestionnaireStatus = 'expired' | 'failed';
|
|
104
105
|
/**
|
|
105
106
|
* Structured question form emitted for plan-mode clarification flows.
|
|
106
107
|
*/
|
|
@@ -111,6 +112,8 @@ interface PlanQuestionnaire {
|
|
|
111
112
|
submitLabel?: string;
|
|
112
113
|
questions: PlanQuestion[];
|
|
113
114
|
answers?: Partial<Record<string, PlanQuestionnaireAnswerValue>>;
|
|
115
|
+
status?: PlanQuestionnaireStatus;
|
|
116
|
+
statusMessage?: string;
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
116
119
|
* Submission payload emitted by a questionnaire card.
|
|
@@ -129,6 +132,13 @@ interface ExecutionConfirmationSubmission {
|
|
|
129
132
|
content: string;
|
|
130
133
|
sourceMessageId?: string;
|
|
131
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Context metadata provided to custom structured submission handlers.
|
|
137
|
+
*/
|
|
138
|
+
interface ChatSubmissionContext {
|
|
139
|
+
sessionId?: string;
|
|
140
|
+
mode: ChatAgentMode;
|
|
141
|
+
}
|
|
132
142
|
/**
|
|
133
143
|
* Summary item used by structured assistant cards to describe parameter changes.
|
|
134
144
|
*/
|
|
@@ -142,22 +152,47 @@ interface ChatParameterSummaryItem {
|
|
|
142
152
|
*/
|
|
143
153
|
interface ExecutionProposal {
|
|
144
154
|
proposalId: string;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
resourceKey: string;
|
|
156
|
+
resourceName: string;
|
|
157
|
+
executorName?: string;
|
|
148
158
|
parameterSummary: ChatParameterSummaryItem[];
|
|
149
159
|
warnings?: string[];
|
|
150
160
|
requiresConfirmation: true;
|
|
151
161
|
}
|
|
152
162
|
/**
|
|
153
|
-
* Structured result summary emitted after a
|
|
163
|
+
* Structured result summary emitted after a task has started or completed.
|
|
154
164
|
*/
|
|
155
165
|
interface ResultSummary {
|
|
156
|
-
|
|
166
|
+
summaryId: string;
|
|
157
167
|
status: 'completed' | 'failed' | 'running' | 'pending';
|
|
158
168
|
headline: string;
|
|
159
169
|
details: string[];
|
|
160
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Merge behavior applied when a keyed custom block is patched repeatedly.
|
|
173
|
+
*/
|
|
174
|
+
type ChatCustomBlockMergePolicy = 'append' | 'replace' | 'ignore-duplicate';
|
|
175
|
+
/**
|
|
176
|
+
* Extensible custom block rendered by a consumer-provided block renderer.
|
|
177
|
+
*/
|
|
178
|
+
interface ChatCustomBlock {
|
|
179
|
+
type: 'custom';
|
|
180
|
+
kind: string;
|
|
181
|
+
data: unknown;
|
|
182
|
+
/**
|
|
183
|
+
* Stable key used to identify the same logical block across streaming patches.
|
|
184
|
+
* When present, keyed custom blocks are merged by `blockKey` regardless of `kind`.
|
|
185
|
+
*/
|
|
186
|
+
blockKey?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Merge strategy used when another custom block with the same key arrives.
|
|
189
|
+
*
|
|
190
|
+
* - `append`: keep appending blocks even if the key matches.
|
|
191
|
+
* - `replace`: replace the existing keyed block with the latest one.
|
|
192
|
+
* - `ignore-duplicate`: keep the first keyed block and ignore later duplicates.
|
|
193
|
+
*/
|
|
194
|
+
mergePolicy?: ChatCustomBlockMergePolicy;
|
|
195
|
+
}
|
|
161
196
|
/**
|
|
162
197
|
* Structured assistant block variants rendered by the chat thread.
|
|
163
198
|
*/
|
|
@@ -180,11 +215,7 @@ type ChatMessageBlock = {
|
|
|
180
215
|
} | {
|
|
181
216
|
type: 'questionnaire';
|
|
182
217
|
questionnaire: PlanQuestionnaire;
|
|
183
|
-
} |
|
|
184
|
-
type: 'custom';
|
|
185
|
-
kind: string;
|
|
186
|
-
data: unknown;
|
|
187
|
-
};
|
|
218
|
+
} | ChatCustomBlock;
|
|
188
219
|
/**
|
|
189
220
|
* Supported message body render orders for mixed text and structured blocks.
|
|
190
221
|
*/
|
|
@@ -279,6 +310,14 @@ interface ChatMessageBlockRendererProps {
|
|
|
279
310
|
* Optional renderer used for custom block variants.
|
|
280
311
|
*/
|
|
281
312
|
type ChatMessageBlockRenderer = (props: ChatMessageBlockRendererProps) => ReactNode;
|
|
313
|
+
/**
|
|
314
|
+
* Optional application-provided handler that intercepts questionnaire submissions.
|
|
315
|
+
*/
|
|
316
|
+
type ChatQuestionnaireSubmitHandler = (submission: PlanQuestionnaireSubmission, context: ChatSubmissionContext) => Promise<boolean | void> | boolean | void;
|
|
317
|
+
/**
|
|
318
|
+
* Optional application-provided handler that intercepts confirmation submissions.
|
|
319
|
+
*/
|
|
320
|
+
type ChatConfirmationSubmitHandler = (submission: ExecutionConfirmationSubmission, context: ChatSubmissionContext) => Promise<boolean | void> | boolean | void;
|
|
282
321
|
interface ChatModel {
|
|
283
322
|
id: string;
|
|
284
323
|
object: string;
|
|
@@ -336,10 +375,18 @@ interface AiChatLabels {
|
|
|
336
375
|
attachmentLimitNotice?: string;
|
|
337
376
|
userRoleLabel?: string;
|
|
338
377
|
assistantRoleLabel?: string;
|
|
378
|
+
expandMessageAriaLabel?: string;
|
|
379
|
+
collapseMessageAriaLabel?: string;
|
|
380
|
+
expandComposerAriaLabel?: string;
|
|
381
|
+
collapseComposerAriaLabel?: string;
|
|
339
382
|
stoppedResponse?: string;
|
|
340
383
|
assistantStreamingAriaLabel?: string;
|
|
341
384
|
networkError?: string;
|
|
342
385
|
genericError?: string;
|
|
386
|
+
questionnaireSubmitting?: string;
|
|
387
|
+
questionnaireSubmitted?: string;
|
|
388
|
+
questionnaireValidationPrefix?: string;
|
|
389
|
+
questionnaireSubmitFailed?: string;
|
|
343
390
|
}
|
|
344
391
|
/**
|
|
345
392
|
* Default English label values used when no labels are provided.
|
|
@@ -353,6 +400,10 @@ interface AiChatProviderBaseProps {
|
|
|
353
400
|
labels?: AiChatLabels;
|
|
354
401
|
/** Optional renderer used to extend message blocks with app-specific UI. */
|
|
355
402
|
renderMessageBlock?: ChatMessageBlockRenderer;
|
|
403
|
+
/** Optional handler used to intercept questionnaire submissions before the default send flow. */
|
|
404
|
+
handleQuestionnaireSubmit?: ChatQuestionnaireSubmitHandler;
|
|
405
|
+
/** Optional handler used to intercept confirmation submissions before the default send flow. */
|
|
406
|
+
handleConfirmationSubmit?: ChatConfirmationSubmitHandler;
|
|
356
407
|
/** Optional render order used for mixed text and structured message blocks. */
|
|
357
408
|
messageRenderOrder?: ChatMessageRenderOrder;
|
|
358
409
|
/**
|
|
@@ -416,6 +467,17 @@ interface DefaultChatTransportEndpoints {
|
|
|
416
467
|
/** Relative path used to request stream termination. */
|
|
417
468
|
terminate?: string;
|
|
418
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Tool execution policy applied to outgoing stream requests.
|
|
472
|
+
*/
|
|
473
|
+
interface ChatToolExecutionPolicy {
|
|
474
|
+
/** Enables tool execution headers for the stream request. */
|
|
475
|
+
enabled?: boolean;
|
|
476
|
+
/** Marks the request as requiring explicit approval before tool execution. */
|
|
477
|
+
approvalRequired?: boolean;
|
|
478
|
+
/** Approval timeout in seconds, forwarded when approval is enabled. */
|
|
479
|
+
approvalTimeoutSec?: number;
|
|
480
|
+
}
|
|
419
481
|
/**
|
|
420
482
|
* Options for the built-in HTTP transport adapter.
|
|
421
483
|
*/
|
|
@@ -424,6 +486,8 @@ interface CreateDefaultChatTransportOptions {
|
|
|
424
486
|
apiBaseUrl: string;
|
|
425
487
|
/** Authorization header value forwarded to the backend. */
|
|
426
488
|
authToken: string;
|
|
489
|
+
/** Optional tool execution policy translated into stream request headers. */
|
|
490
|
+
toolExecutionPolicy?: ChatToolExecutionPolicy;
|
|
427
491
|
/** Optional extra headers appended to each streaming chat completion request. */
|
|
428
492
|
streamHeaders?: Record<string, string>;
|
|
429
493
|
/** Optional transformer used to normalize custom stream packets. */
|
|
@@ -436,7 +500,7 @@ interface CreateDefaultChatTransportOptions {
|
|
|
436
500
|
/**
|
|
437
501
|
* Creates the built-in transport backed by the current HTTP chat API.
|
|
438
502
|
*/
|
|
439
|
-
declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, streamHeaders, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
|
|
503
|
+
declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, toolExecutionPolicy, streamHeaders, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
|
|
440
504
|
|
|
441
505
|
declare const ChatThread: () => _emotion_react_jsx_runtime.JSX.Element;
|
|
442
506
|
|
|
@@ -466,6 +530,8 @@ interface ChatComposerViewProps {
|
|
|
466
530
|
plan: string;
|
|
467
531
|
agent: string;
|
|
468
532
|
};
|
|
533
|
+
expandComposerAriaLabel: string;
|
|
534
|
+
collapseComposerAriaLabel: string;
|
|
469
535
|
onValueChange: (value: string) => void;
|
|
470
536
|
onPickImages: (files: FileList | File[]) => void;
|
|
471
537
|
onPasteImages: (files: File[]) => void;
|
|
@@ -529,6 +595,10 @@ interface ChatContextValue {
|
|
|
529
595
|
retryRef: MutableRefObject<() => Promise<void>>;
|
|
530
596
|
/** Optional block renderer used to extend message rendering with custom block types. */
|
|
531
597
|
renderMessageBlock?: ChatMessageBlockRenderer;
|
|
598
|
+
/** Optional handler used to intercept questionnaire submissions before the default send flow. */
|
|
599
|
+
handleQuestionnaireSubmit?: ChatQuestionnaireSubmitHandler;
|
|
600
|
+
/** Optional handler used to intercept confirmation submissions before the default send flow. */
|
|
601
|
+
handleConfirmationSubmit?: ChatConfirmationSubmitHandler;
|
|
532
602
|
/** Optional render order used for mixed text and structured message blocks. */
|
|
533
603
|
messageRenderOrder?: ChatMessageRenderOrder;
|
|
534
604
|
/** Optional packet transformer used by the legacy default adapter. */
|
|
@@ -551,4 +621,4 @@ declare const useChatContext: () => ChatContextValue;
|
|
|
551
621
|
*/
|
|
552
622
|
declare const useChatStore: <T>(selector: (state: ChatStore) => T) => T;
|
|
553
623
|
|
|
554
|
-
export { AiChat, type AiChatLabels, type AiChatProps, AiChatProvider, type AiChatProviderProps, CHAT_AGENT_MODES, CHAT_MESSAGE_RENDER_ORDERS, type ChatAgentMode, ChatComposer, type ChatComposerViewProps, ChatConversationList, type ChatImageAttachment, type ChatMessage, type ChatMessageBlock, type ChatMessageBlockRenderer, type ChatMessageBlockRendererProps, type ChatMessageRenderOrder, type ChatMessageStatus, type ChatModel, type ChatRole, type ChatSession, type ChatStreamMessagePatch, type ChatStreamPacketTransformArgs, type ChatStreamPacketUpdate, ChatThread, type ChatTransport, type ChatTransportStartStreamArgs, type CreateDefaultChatTransportOptions, DEFAULT_AI_CHAT_LABELS, DEFAULT_CHAT_AGENT_MODE, type DefaultChatTransportEndpoints, type ExecutionConfirmationSubmission, type ExecutionProposal, type PlanQuestionnaire, type PlanQuestionnaireSubmission, type ResultSummary, type TransformChatStreamPacket, createDefaultChatTransport, useChatContext, useChatStore };
|
|
624
|
+
export { AiChat, type AiChatLabels, type AiChatProps, AiChatProvider, type AiChatProviderProps, CHAT_AGENT_MODES, CHAT_MESSAGE_RENDER_ORDERS, type ChatAgentMode, ChatComposer, type ChatComposerViewProps, type ChatConfirmationSubmitHandler, ChatConversationList, type ChatImageAttachment, type ChatMessage, type ChatMessageBlock, type ChatMessageBlockRenderer, type ChatMessageBlockRendererProps, type ChatMessageRenderOrder, type ChatMessageStatus, type ChatModel, type ChatParameterSummaryItem, type ChatQuestionnaireSubmitHandler, type ChatRole, type ChatSession, type ChatStreamMessagePatch, type ChatStreamPacketTransformArgs, type ChatStreamPacketUpdate, type ChatSubmissionContext, ChatThread, type ChatToolExecutionPolicy, type ChatTransport, type ChatTransportStartStreamArgs, type CreateDefaultChatTransportOptions, DEFAULT_AI_CHAT_LABELS, DEFAULT_CHAT_AGENT_MODE, type DefaultChatTransportEndpoints, type ExecutionConfirmationSubmission, type ExecutionProposal, type PlanQuestionOption, type PlanQuestionnaire, type PlanQuestionnaireSubmission, type ResultSummary, type TransformChatStreamPacket, createDefaultChatTransport, useChatContext, useChatStore };
|