@xinghunm/ai-chat 1.0.1 → 1.1.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/index.d.mts +39 -7
- package/dist/index.d.ts +39 -7
- package/dist/index.js +605 -217
- package/dist/index.mjs +625 -233
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -72,6 +72,7 @@ interface PlanSingleSelectQuestion extends PlanQuestionBase {
|
|
|
72
72
|
*/
|
|
73
73
|
interface PlanMultiSelectQuestion extends PlanQuestionBase {
|
|
74
74
|
kind: 'multi_select';
|
|
75
|
+
allowOther?: boolean;
|
|
75
76
|
options: PlanQuestionOption[];
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
@@ -102,25 +103,57 @@ interface PlanBooleanQuestion extends PlanQuestionBase {
|
|
|
102
103
|
*/
|
|
103
104
|
type PlanQuestion = PlanSingleSelectQuestion | PlanMultiSelectQuestion | PlanTextQuestion | PlanNumberQuestion | PlanBooleanQuestion;
|
|
104
105
|
type PlanQuestionnaireStatus = 'expired' | 'failed';
|
|
106
|
+
/**
|
|
107
|
+
* Merge behavior applied when a keyed structured block is patched repeatedly.
|
|
108
|
+
*/
|
|
109
|
+
type ChatBlockMergePolicy = 'append' | 'replace' | 'ignore-duplicate';
|
|
105
110
|
/**
|
|
106
111
|
* Structured question form emitted for plan-mode clarification flows.
|
|
107
112
|
*/
|
|
108
113
|
interface PlanQuestionnaire {
|
|
109
114
|
questionnaireId: string;
|
|
115
|
+
/**
|
|
116
|
+
* Stable key used to identify the same logical questionnaire across streaming patches.
|
|
117
|
+
* When present, questionnaires are merged by `blockKey` instead of `questionnaireId`.
|
|
118
|
+
*/
|
|
119
|
+
blockKey?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Merge strategy used when another questionnaire with the same key arrives.
|
|
122
|
+
*
|
|
123
|
+
* - `append`: keep appending questionnaires even if the key matches.
|
|
124
|
+
* - `replace`: replace the existing keyed questionnaire with the latest one.
|
|
125
|
+
* - `ignore-duplicate`: keep the first keyed questionnaire and ignore later duplicates.
|
|
126
|
+
*/
|
|
127
|
+
mergePolicy?: ChatBlockMergePolicy;
|
|
110
128
|
title?: string;
|
|
111
129
|
description?: string;
|
|
112
130
|
submitLabel?: string;
|
|
113
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Single question rendered by the questionnaire card.
|
|
133
|
+
*/
|
|
134
|
+
question: PlanQuestion;
|
|
114
135
|
answers?: Partial<Record<string, PlanQuestionnaireAnswerValue>>;
|
|
115
136
|
status?: PlanQuestionnaireStatus;
|
|
116
137
|
statusMessage?: string;
|
|
117
138
|
}
|
|
139
|
+
interface PlanQuestionSubmissionDetail {
|
|
140
|
+
questionId: string;
|
|
141
|
+
kind: PlanQuestion['kind'];
|
|
142
|
+
value?: PlanQuestionnaireAnswerValue;
|
|
143
|
+
selectedOptionValues?: string[];
|
|
144
|
+
otherValue?: string;
|
|
145
|
+
}
|
|
118
146
|
/**
|
|
119
147
|
* Submission payload emitted by a questionnaire card.
|
|
120
148
|
*/
|
|
121
149
|
interface PlanQuestionnaireSubmission {
|
|
122
150
|
questionnaireId: string;
|
|
151
|
+
/**
|
|
152
|
+
* Stable questionnaire block key forwarded from the rendered card when available.
|
|
153
|
+
*/
|
|
154
|
+
blockKey?: string;
|
|
123
155
|
answers: Record<string, PlanQuestionnaireAnswerValue>;
|
|
156
|
+
details?: Record<string, PlanQuestionSubmissionDetail>;
|
|
124
157
|
content: string;
|
|
125
158
|
sourceMessageId?: string;
|
|
126
159
|
}
|
|
@@ -168,10 +201,6 @@ interface ResultSummary {
|
|
|
168
201
|
headline: string;
|
|
169
202
|
details: string[];
|
|
170
203
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Merge behavior applied when a keyed custom block is patched repeatedly.
|
|
173
|
-
*/
|
|
174
|
-
type ChatCustomBlockMergePolicy = 'append' | 'replace' | 'ignore-duplicate';
|
|
175
204
|
/**
|
|
176
205
|
* Extensible custom block rendered by a consumer-provided block renderer.
|
|
177
206
|
*/
|
|
@@ -191,7 +220,7 @@ interface ChatCustomBlock {
|
|
|
191
220
|
* - `replace`: replace the existing keyed block with the latest one.
|
|
192
221
|
* - `ignore-duplicate`: keep the first keyed block and ignore later duplicates.
|
|
193
222
|
*/
|
|
194
|
-
mergePolicy?:
|
|
223
|
+
mergePolicy?: ChatBlockMergePolicy;
|
|
195
224
|
}
|
|
196
225
|
/**
|
|
197
226
|
* Structured assistant block variants rendered by the chat thread.
|
|
@@ -387,6 +416,9 @@ interface AiChatLabels {
|
|
|
387
416
|
questionnaireSubmitted?: string;
|
|
388
417
|
questionnaireValidationPrefix?: string;
|
|
389
418
|
questionnaireSubmitFailed?: string;
|
|
419
|
+
questionnaireMultiSelectHint?: string;
|
|
420
|
+
questionnaireOtherOptionLabel?: string;
|
|
421
|
+
questionnaireOtherPlaceholder?: string;
|
|
390
422
|
}
|
|
391
423
|
/**
|
|
392
424
|
* Default English label values used when no labels are provided.
|
|
@@ -621,4 +653,4 @@ declare const useChatContext: () => ChatContextValue;
|
|
|
621
653
|
*/
|
|
622
654
|
declare const useChatStore: <T>(selector: (state: ChatStore) => T) => T;
|
|
623
655
|
|
|
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 };
|
|
656
|
+
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 PlanQuestionSubmissionDetail, type PlanQuestionnaire, type PlanQuestionnaireSubmission, type ResultSummary, type TransformChatStreamPacket, createDefaultChatTransport, useChatContext, useChatStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ interface PlanSingleSelectQuestion extends PlanQuestionBase {
|
|
|
72
72
|
*/
|
|
73
73
|
interface PlanMultiSelectQuestion extends PlanQuestionBase {
|
|
74
74
|
kind: 'multi_select';
|
|
75
|
+
allowOther?: boolean;
|
|
75
76
|
options: PlanQuestionOption[];
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
@@ -102,25 +103,57 @@ interface PlanBooleanQuestion extends PlanQuestionBase {
|
|
|
102
103
|
*/
|
|
103
104
|
type PlanQuestion = PlanSingleSelectQuestion | PlanMultiSelectQuestion | PlanTextQuestion | PlanNumberQuestion | PlanBooleanQuestion;
|
|
104
105
|
type PlanQuestionnaireStatus = 'expired' | 'failed';
|
|
106
|
+
/**
|
|
107
|
+
* Merge behavior applied when a keyed structured block is patched repeatedly.
|
|
108
|
+
*/
|
|
109
|
+
type ChatBlockMergePolicy = 'append' | 'replace' | 'ignore-duplicate';
|
|
105
110
|
/**
|
|
106
111
|
* Structured question form emitted for plan-mode clarification flows.
|
|
107
112
|
*/
|
|
108
113
|
interface PlanQuestionnaire {
|
|
109
114
|
questionnaireId: string;
|
|
115
|
+
/**
|
|
116
|
+
* Stable key used to identify the same logical questionnaire across streaming patches.
|
|
117
|
+
* When present, questionnaires are merged by `blockKey` instead of `questionnaireId`.
|
|
118
|
+
*/
|
|
119
|
+
blockKey?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Merge strategy used when another questionnaire with the same key arrives.
|
|
122
|
+
*
|
|
123
|
+
* - `append`: keep appending questionnaires even if the key matches.
|
|
124
|
+
* - `replace`: replace the existing keyed questionnaire with the latest one.
|
|
125
|
+
* - `ignore-duplicate`: keep the first keyed questionnaire and ignore later duplicates.
|
|
126
|
+
*/
|
|
127
|
+
mergePolicy?: ChatBlockMergePolicy;
|
|
110
128
|
title?: string;
|
|
111
129
|
description?: string;
|
|
112
130
|
submitLabel?: string;
|
|
113
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Single question rendered by the questionnaire card.
|
|
133
|
+
*/
|
|
134
|
+
question: PlanQuestion;
|
|
114
135
|
answers?: Partial<Record<string, PlanQuestionnaireAnswerValue>>;
|
|
115
136
|
status?: PlanQuestionnaireStatus;
|
|
116
137
|
statusMessage?: string;
|
|
117
138
|
}
|
|
139
|
+
interface PlanQuestionSubmissionDetail {
|
|
140
|
+
questionId: string;
|
|
141
|
+
kind: PlanQuestion['kind'];
|
|
142
|
+
value?: PlanQuestionnaireAnswerValue;
|
|
143
|
+
selectedOptionValues?: string[];
|
|
144
|
+
otherValue?: string;
|
|
145
|
+
}
|
|
118
146
|
/**
|
|
119
147
|
* Submission payload emitted by a questionnaire card.
|
|
120
148
|
*/
|
|
121
149
|
interface PlanQuestionnaireSubmission {
|
|
122
150
|
questionnaireId: string;
|
|
151
|
+
/**
|
|
152
|
+
* Stable questionnaire block key forwarded from the rendered card when available.
|
|
153
|
+
*/
|
|
154
|
+
blockKey?: string;
|
|
123
155
|
answers: Record<string, PlanQuestionnaireAnswerValue>;
|
|
156
|
+
details?: Record<string, PlanQuestionSubmissionDetail>;
|
|
124
157
|
content: string;
|
|
125
158
|
sourceMessageId?: string;
|
|
126
159
|
}
|
|
@@ -168,10 +201,6 @@ interface ResultSummary {
|
|
|
168
201
|
headline: string;
|
|
169
202
|
details: string[];
|
|
170
203
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Merge behavior applied when a keyed custom block is patched repeatedly.
|
|
173
|
-
*/
|
|
174
|
-
type ChatCustomBlockMergePolicy = 'append' | 'replace' | 'ignore-duplicate';
|
|
175
204
|
/**
|
|
176
205
|
* Extensible custom block rendered by a consumer-provided block renderer.
|
|
177
206
|
*/
|
|
@@ -191,7 +220,7 @@ interface ChatCustomBlock {
|
|
|
191
220
|
* - `replace`: replace the existing keyed block with the latest one.
|
|
192
221
|
* - `ignore-duplicate`: keep the first keyed block and ignore later duplicates.
|
|
193
222
|
*/
|
|
194
|
-
mergePolicy?:
|
|
223
|
+
mergePolicy?: ChatBlockMergePolicy;
|
|
195
224
|
}
|
|
196
225
|
/**
|
|
197
226
|
* Structured assistant block variants rendered by the chat thread.
|
|
@@ -387,6 +416,9 @@ interface AiChatLabels {
|
|
|
387
416
|
questionnaireSubmitted?: string;
|
|
388
417
|
questionnaireValidationPrefix?: string;
|
|
389
418
|
questionnaireSubmitFailed?: string;
|
|
419
|
+
questionnaireMultiSelectHint?: string;
|
|
420
|
+
questionnaireOtherOptionLabel?: string;
|
|
421
|
+
questionnaireOtherPlaceholder?: string;
|
|
390
422
|
}
|
|
391
423
|
/**
|
|
392
424
|
* Default English label values used when no labels are provided.
|
|
@@ -621,4 +653,4 @@ declare const useChatContext: () => ChatContextValue;
|
|
|
621
653
|
*/
|
|
622
654
|
declare const useChatStore: <T>(selector: (state: ChatStore) => T) => T;
|
|
623
655
|
|
|
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 };
|
|
656
|
+
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 PlanQuestionSubmissionDetail, type PlanQuestionnaire, type PlanQuestionnaireSubmission, type ResultSummary, type TransformChatStreamPacket, createDefaultChatTransport, useChatContext, useChatStore };
|