@agent-native/toolkit 0.198.4 → 0.198.5
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/app/agentkit/react/components.d.ts +4 -2
- package/dist/app/agentkit/react/components.d.ts.map +1 -1
- package/dist/app/agentkit/react/components.js +12 -6
- package/dist/app/agentkit/react/components.js.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.d.ts.map +1 -1
- package/dist/app/chat/AgentKitAssistantChat.js +22 -12
- package/dist/app/chat/AgentKitAssistantChat.js.map +1 -1
- package/dist/composer/PromptComposer.d.ts +3 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -1
- package/dist/composer/PromptComposer.js +2 -2
- package/dist/composer/PromptComposer.js.map +1 -1
- package/dist/composer/TiptapComposer.d.ts +4 -1
- package/dist/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/composer/TiptapComposer.js +8 -4
- package/dist/composer/TiptapComposer.js.map +1 -1
- package/package.json +3 -3
- package/src/app/agentkit/react/components.interaction.spec.tsx +93 -0
- package/src/app/agentkit/react/components.spec.tsx +1 -2
- package/src/app/agentkit/react/components.tsx +29 -4
- package/src/app/agentkit/react/composer-context.spec.tsx +7 -0
- package/src/app/chat/AgentKitAssistantChat.spec.tsx +38 -1
- package/src/app/chat/AgentKitAssistantChat.tsx +32 -11
- package/src/composer/PromptComposer.tsx +7 -0
- package/src/composer/TiptapComposer.spec.ts +26 -4
- package/src/composer/TiptapComposer.tsx +12 -3
|
@@ -888,6 +888,8 @@ export interface TiptapComposerProps {
|
|
|
888
888
|
contextControlsDisabled?: boolean;
|
|
889
889
|
/** Prevent submission without making the editable surface lose focus. */
|
|
890
890
|
submissionDisabled?: boolean;
|
|
891
|
+
/** Disable only the send control while the submission is being accepted. */
|
|
892
|
+
sendButtonDisabled?: boolean;
|
|
891
893
|
/** Prevent submission while a host request is in flight. */
|
|
892
894
|
submitting?: boolean;
|
|
893
895
|
/** Override the generic document attachment cap for a multipart host. */
|
|
@@ -916,6 +918,7 @@ export interface TiptapComposerProps {
|
|
|
916
918
|
) => void | Promise<void>;
|
|
917
919
|
/** Return false to stop a submit before it enters the chat runtime. */
|
|
918
920
|
onBeforeSubmit?: () => boolean | Promise<boolean>;
|
|
921
|
+
onSubmissionPendingChange?: (pending: boolean) => void;
|
|
919
922
|
/** Scope where a failed submission should be recovered after the host forks. */
|
|
920
923
|
getSubmitFailureDraftScope?: () => string | null;
|
|
921
924
|
/**
|
|
@@ -2547,6 +2550,7 @@ export function TiptapComposer({
|
|
|
2547
2550
|
disabled = false,
|
|
2548
2551
|
contextControlsDisabled = false,
|
|
2549
2552
|
submissionDisabled = false,
|
|
2553
|
+
sendButtonDisabled = false,
|
|
2550
2554
|
submitting = false,
|
|
2551
2555
|
maxDocumentAttachmentBytes = MAX_DOCUMENT_ATTACHMENT_BYTES,
|
|
2552
2556
|
documentAttachmentLimitLabel = "PDFs",
|
|
@@ -2558,6 +2562,7 @@ export function TiptapComposer({
|
|
|
2558
2562
|
initialTextKey,
|
|
2559
2563
|
onSubmit,
|
|
2560
2564
|
onBeforeSubmit,
|
|
2565
|
+
onSubmissionPendingChange,
|
|
2561
2566
|
getSubmitFailureDraftScope,
|
|
2562
2567
|
clearOnSubmit = true,
|
|
2563
2568
|
clearOnSubmitImmediately = false,
|
|
@@ -4243,7 +4248,6 @@ export function TiptapComposer({
|
|
|
4243
4248
|
slotReferencesRef.current.length > 0);
|
|
4244
4249
|
const canPreserveFollowUp =
|
|
4245
4250
|
preserveFollowUp &&
|
|
4246
|
-
clearedBeforePreflight &&
|
|
4247
4251
|
!isForkRecovery &&
|
|
4248
4252
|
hasFollowUp &&
|
|
4249
4253
|
(currentDraft === null ||
|
|
@@ -4330,6 +4334,7 @@ export function TiptapComposer({
|
|
|
4330
4334
|
|
|
4331
4335
|
if (onBeforeSubmit) {
|
|
4332
4336
|
submitInFlightRef.current = true;
|
|
4337
|
+
onSubmissionPendingChange?.(true);
|
|
4333
4338
|
try {
|
|
4334
4339
|
const shouldSubmit = await onBeforeSubmit();
|
|
4335
4340
|
if (!shouldSubmit) {
|
|
@@ -4351,6 +4356,7 @@ export function TiptapComposer({
|
|
|
4351
4356
|
return false;
|
|
4352
4357
|
} finally {
|
|
4353
4358
|
submitInFlightRef.current = false;
|
|
4359
|
+
onSubmissionPendingChange?.(false);
|
|
4354
4360
|
}
|
|
4355
4361
|
}
|
|
4356
4362
|
if (
|
|
@@ -4498,6 +4504,7 @@ export function TiptapComposer({
|
|
|
4498
4504
|
submitInFlightRef.current = true;
|
|
4499
4505
|
let locallySubmitted = false;
|
|
4500
4506
|
let settled = false;
|
|
4507
|
+
onSubmissionPendingChange?.(true);
|
|
4501
4508
|
const clearSubmittedComposer = () => {
|
|
4502
4509
|
if (clearOnSubmit) {
|
|
4503
4510
|
clearComposerDraft(submittingDraftKey, submittingDraftSnapshot);
|
|
@@ -4575,7 +4582,7 @@ export function TiptapComposer({
|
|
|
4575
4582
|
);
|
|
4576
4583
|
} catch (error) {
|
|
4577
4584
|
if (locallySubmitted) {
|
|
4578
|
-
restoreSubmittedDraft();
|
|
4585
|
+
restoreSubmittedDraft(true);
|
|
4579
4586
|
return true;
|
|
4580
4587
|
}
|
|
4581
4588
|
restoreSubmittedDraft(true);
|
|
@@ -4593,6 +4600,7 @@ export function TiptapComposer({
|
|
|
4593
4600
|
} finally {
|
|
4594
4601
|
settled = true;
|
|
4595
4602
|
submitInFlightRef.current = false;
|
|
4603
|
+
onSubmissionPendingChange?.(false);
|
|
4596
4604
|
}
|
|
4597
4605
|
|
|
4598
4606
|
if (!isCurrentDraftScope()) {
|
|
@@ -4685,6 +4693,7 @@ export function TiptapComposer({
|
|
|
4685
4693
|
clearOnSubmitImmediately,
|
|
4686
4694
|
getSubmitFailureDraftScope,
|
|
4687
4695
|
onBeforeSubmit,
|
|
4696
|
+
onSubmissionPendingChange,
|
|
4688
4697
|
extractComposerPayload,
|
|
4689
4698
|
syncComposerState,
|
|
4690
4699
|
updateSlotReferences,
|
|
@@ -5391,7 +5400,7 @@ export function TiptapComposer({
|
|
|
5391
5400
|
<button
|
|
5392
5401
|
type="button"
|
|
5393
5402
|
onClick={() => void submitComposer("immediate")}
|
|
5394
|
-
disabled={!canSend}
|
|
5403
|
+
disabled={!canSend || sendButtonDisabled}
|
|
5395
5404
|
aria-label={
|
|
5396
5405
|
submitting ? t("common.loading") : sendButtonTooltip
|
|
5397
5406
|
}
|