@designcrowd/library.brand-page 5.18.2 → 5.18.3-actionable-buttons-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/lib/src/{CreatedOnBrandCrowd-de-de-DB2oJ5vl.js → CreatedOnBrandCrowd-de-de-B27yG7Im.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-fbk0Gf2G.js → CreatedOnBrandCrowd-en-us-D-Qt-E8d.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-Ch4Q9__I.js → CreatedOnBrandCrowd-es-es-BQ1ZfmeW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-DaHJ6OMH.js → CreatedOnBrandCrowd-fr-ca-Cx3bWshs.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-DaHJ6OMH.js → CreatedOnBrandCrowd-fr-fr-Cx3bWshs.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-BgF8UCqy.js → CreatedOnBrandCrowd-pt-br-DBIvSND9.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-BgF8UCqy.js → CreatedOnBrandCrowd-pt-pt-DBIvSND9.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-j3rcGaGp.js → CreatedOnDcom-de-de-Dm_1xPJE.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Cx4eQPRU.js → CreatedOnDcom-en-us-Dx86ZBPI.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-D-1APCL9.js → CreatedOnDcom-es-es-FVsEih0c.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DAHdBw0D.js → CreatedOnDcom-fr-ca-wQ_ZXFlw.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BYAw2kXr.js → CreatedOnDcom-fr-fr-C17s3Cri.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CdSknjZg.js → CreatedOnDcom-pt-br-CIGrEeSH.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-DzyZ2j80.js → CreatedOnDcom-pt-pt-BGvzTd4W.js} +1 -1
- package/lib/src/brand-page-maker/composables/ai-chat/types.d.ts +3 -0
- package/lib/src/brand-page-maker/composables/ai-chat/ui-actions.d.ts +29 -0
- package/lib/src/brand-page-maker/composables/ai-chat/ui-actions.js +32 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +33 -7
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +1 -0
- package/lib/src/brand-page-maker/composables/useEventTracker.js +1 -0
- package/lib/src/{bundled-translations-CnareLWC.js → bundled-translations-B5Fkt3qd.js} +1 -1
- package/lib/src/{bundled-translations.de-DE-2Ys7epLO.js → bundled-translations.de-DE-DpdVePM9.js} +1 -1
- package/lib/src/bundled-translations.es-ES-BsIcrzZF.js +175 -0
- package/lib/src/bundled-translations.fr-CA-G1XCp2Qh.js +175 -0
- package/lib/src/bundled-translations.fr-FR-BdwLXOnB.js +175 -0
- package/lib/src/bundled-translations.pt-BR-Bvn5ePe7.js +175 -0
- package/lib/src/bundled-translations.pt-PT-CDtkb2k1.js +175 -0
- package/lib/src/bundles/bundled-translations.de-DE.json +2 -0
- package/lib/src/bundles/bundled-translations.es-ES.json +2 -0
- package/lib/src/bundles/bundled-translations.fr-CA.json +2 -0
- package/lib/src/bundles/bundled-translations.fr-FR.json +2 -0
- package/lib/src/bundles/bundled-translations.json +2 -0
- package/lib/src/bundles/bundled-translations.pt-BR.json +2 -0
- package/lib/src/bundles/bundled-translations.pt-PT.json +2 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +93 -19
- package/lib/src/css/library.brand-page-brandPage.min.css +93 -19
- package/lib/src/css/library.brand-page-designCom.min.css +93 -19
- package/lib/src/css/library.brand-page-preview.min.css +93 -19
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-mcvVokSM.js → lib-MtnS_D2m.js} +16357 -16221
- package/lib/src/plugins/google-maps-plugin/google-maps-plugin.d.ts +14 -2
- package/lib/src/plugins/google-maps-plugin/google-maps-plugin.js +43 -13
- package/package.json +2 -2
- package/src/brand-page-maker/components/ai-text-edit/AiActionButtons.vue +22 -7
- package/src/brand-page-maker/components/ai-text-edit/AiChatbox.vue +3 -0
- package/src/brand-page-maker/components/ai-text-edit/TextBubble.vue +7 -1
- package/src/brand-page-maker/components/ai-website-builder/AiWebsiteBuilder.vue +21 -1
- package/src/brand-page-maker/components/brandpage-settings/BrandPageSettings.vue +8 -0
- package/src/brand-page-maker/composables/ai-chat/types.ts +6 -0
- package/src/brand-page-maker/composables/ai-chat/ui-actions.test.ts +80 -0
- package/src/brand-page-maker/composables/ai-chat/ui-actions.ts +58 -0
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +287 -248
- package/src/brand-page-maker/composables/useEventTracker.ts +1 -0
- package/src/brand-page-maker/constants/i18n/constants.de-DE.json +2 -0
- package/src/brand-page-maker/constants/i18n/constants.es-ES.json +2 -0
- package/src/brand-page-maker/constants/i18n/constants.fr-CA.json +2 -0
- package/src/brand-page-maker/constants/i18n/constants.fr-FR.json +2 -0
- package/src/brand-page-maker/constants/i18n/constants.json +2 -0
- package/src/brand-page-maker/constants/i18n/constants.pt-BR.json +2 -0
- package/src/brand-page-maker/constants/i18n/constants.pt-PT.json +2 -0
- package/src/bundles/bundled-translations.de-DE.json +2 -0
- package/src/bundles/bundled-translations.es-ES.json +2 -0
- package/src/bundles/bundled-translations.fr-CA.json +2 -0
- package/src/bundles/bundled-translations.fr-FR.json +2 -0
- package/src/bundles/bundled-translations.json +2 -0
- package/src/bundles/bundled-translations.pt-BR.json +2 -0
- package/src/bundles/bundled-translations.pt-PT.json +2 -0
- package/src/plugins/google-maps-plugin/google-maps-plugin.ts +58 -18
- package/src/shared/content-settings/components/google-address-field/GoogleAddressField.vue +148 -15
- package/src/shared/font-family-selector/FontPicker.vue +91 -4
- package/lib/src/bundled-translations.es-ES-Cjp-G8rT.js +0 -175
- package/lib/src/bundled-translations.fr-CA-CsaW4Oae.js +0 -175
- package/lib/src/bundled-translations.fr-FR-DIT2dd8J.js +0 -175
- package/lib/src/bundled-translations.pt-BR-BamoBpDW.js +0 -175
- package/lib/src/bundled-translations.pt-PT-C9A4hY_e.js +0 -175
- package/lib/src/shared/content-settings/components/google-address-field/GoogleAddressField.mixin.d.ts +0 -54
- package/lib/src/shared/content-settings/components/google-address-field/GoogleAddressField.mixin.js +0 -67
- package/src/shared/content-settings/components/google-address-field/GoogleAddressField.mixin.ts +0 -84
|
@@ -44,7 +44,9 @@ import type {
|
|
|
44
44
|
ThreadMessage,
|
|
45
45
|
TextThreadMessage,
|
|
46
46
|
SendMessageOptions,
|
|
47
|
+
AgentAction,
|
|
47
48
|
} from './types';
|
|
49
|
+
import { partitionAiToolCalls } from './ui-actions';
|
|
48
50
|
|
|
49
51
|
const BUILD_TIMEOUT_MS = 600000;
|
|
50
52
|
|
|
@@ -454,7 +456,11 @@ export function useAiWebsiteBuilderChat(): UseAiChatResult {
|
|
|
454
456
|
const callApiBuildAsync = async (
|
|
455
457
|
userPrompt: string,
|
|
456
458
|
userMessageId: string,
|
|
457
|
-
): Promise<{
|
|
459
|
+
): Promise<{
|
|
460
|
+
text: string | null;
|
|
461
|
+
isError?: boolean;
|
|
462
|
+
actions?: AgentAction[];
|
|
463
|
+
}> => {
|
|
458
464
|
const connectionId = await ensureConnectedAsync();
|
|
459
465
|
const wsClient = activeBuildWsClient!;
|
|
460
466
|
|
|
@@ -525,297 +531,313 @@ export function useAiWebsiteBuilderChat(): UseAiChatResult {
|
|
|
525
531
|
});
|
|
526
532
|
}
|
|
527
533
|
|
|
528
|
-
return new Promise<{
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
settled = true;
|
|
551
|
-
finishBuild();
|
|
552
|
-
reject(new Error('Build timeout'));
|
|
553
|
-
}, BUILD_TIMEOUT_MS);
|
|
554
|
-
|
|
555
|
-
handler = (msg: WebSocketMessage) => {
|
|
556
|
-
if (settled) return;
|
|
557
|
-
|
|
558
|
-
try {
|
|
559
|
-
if (msg.buildId !== aiThreadStore.buildId) return;
|
|
560
|
-
|
|
561
|
-
if (isStopped.value) {
|
|
562
|
-
settled = true;
|
|
563
|
-
clearTimeout(timeout);
|
|
564
|
-
finishBuild();
|
|
565
|
-
resolve({ text: null });
|
|
566
|
-
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
534
|
+
return new Promise<{
|
|
535
|
+
text: string | null;
|
|
536
|
+
isError?: boolean;
|
|
537
|
+
actions?: AgentAction[];
|
|
538
|
+
}>((resolve, reject) => {
|
|
539
|
+
let settled = false;
|
|
540
|
+
let retryCount = 0;
|
|
541
|
+
let lastAiMessage: string | null = null;
|
|
542
|
+
let lastActions: AgentAction[] | undefined;
|
|
543
|
+
let handler: ((msg: WebSocketMessage) => void) | null = null;
|
|
544
|
+
// Vacant-slot queue scoped to this build session. Persists across
|
|
545
|
+
// retry rounds so a failed CREATE returns to its planned slot via
|
|
546
|
+
// a synthesised `move_before_content_id`.
|
|
547
|
+
const vacantSlots: VacantSlotMap = new Map();
|
|
548
|
+
|
|
549
|
+
const finishBuild = () => {
|
|
550
|
+
aiThreadStore.isBuildInProgress = false;
|
|
551
|
+
wsClient.setBuildActive(false);
|
|
552
|
+
wsClient.stopResponseHeartbeat();
|
|
553
|
+
|
|
554
|
+
if (handler) wsClient.offMessage(handler);
|
|
555
|
+
};
|
|
569
556
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
m.initialMessage = msg.message;
|
|
573
|
-
});
|
|
557
|
+
const timeout = setTimeout(() => {
|
|
558
|
+
if (settled) return;
|
|
574
559
|
|
|
575
|
-
|
|
576
|
-
|
|
560
|
+
settled = true;
|
|
561
|
+
finishBuild();
|
|
562
|
+
reject(new Error('Build timeout'));
|
|
563
|
+
}, BUILD_TIMEOUT_MS);
|
|
577
564
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (!m.planItems) m.planItems = msg.items as PlanItem[];
|
|
581
|
-
});
|
|
565
|
+
handler = (msg: WebSocketMessage) => {
|
|
566
|
+
if (settled) return;
|
|
582
567
|
|
|
583
|
-
|
|
584
|
-
|
|
568
|
+
try {
|
|
569
|
+
if (msg.buildId !== aiThreadStore.buildId) return;
|
|
585
570
|
|
|
586
|
-
|
|
587
|
-
|
|
571
|
+
if (isStopped.value) {
|
|
572
|
+
settled = true;
|
|
573
|
+
clearTimeout(timeout);
|
|
574
|
+
finishBuild();
|
|
575
|
+
resolve({ text: null });
|
|
588
576
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
m.completedItemIds = [
|
|
592
|
-
...(m.completedItemIds ?? []),
|
|
593
|
-
itemId,
|
|
594
|
-
];
|
|
595
|
-
}
|
|
596
|
-
});
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
597
579
|
|
|
598
|
-
|
|
599
|
-
|
|
580
|
+
if (msg.type === 'chat_started' && msg.message) {
|
|
581
|
+
withTypingMessage((m) => {
|
|
582
|
+
m.initialMessage = msg.message;
|
|
583
|
+
});
|
|
600
584
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
[]) as AiAssistantToolCall[];
|
|
604
|
-
const aiResponse: AiAssistantResponse = {
|
|
605
|
-
threadId: aiThreadStore.threadId || '',
|
|
606
|
-
toolCalls,
|
|
607
|
-
message: msg.message || null,
|
|
608
|
-
type: 'tool_calls',
|
|
609
|
-
totalPaidToolCalls: 0,
|
|
610
|
-
timestamp: Date.now(),
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
(async () => {
|
|
614
|
-
try {
|
|
615
|
-
// No tool calls = build cycle complete (success, max retries, or no retryable sections)
|
|
616
|
-
if (toolCalls.length === 0) {
|
|
617
|
-
// Defence-in-depth: a server_response with no toolCalls AND
|
|
618
|
-
// no message text is a degenerate response — it means the
|
|
619
|
-
// backend graph reached END without producing anything
|
|
620
|
-
// actionable. The server-side fix in stream_with_push now
|
|
621
|
-
// converts this to a build_error frame, but if a future
|
|
622
|
-
// regression slips through we must NOT show "Your website
|
|
623
|
-
// has been updated" — that hides real failures from users
|
|
624
|
-
// and from monitoring.
|
|
625
|
-
const hasMeaningfulMessage = Boolean(
|
|
626
|
-
aiResponse.message || lastAiMessage,
|
|
627
|
-
);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
628
587
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
),
|
|
634
|
-
{
|
|
635
|
-
tags: [
|
|
636
|
-
'feature:ai-website-builder',
|
|
637
|
-
'failure:degenerate_server_response',
|
|
638
|
-
],
|
|
639
|
-
customData: {
|
|
640
|
-
build_id: aiThreadStore.buildId ?? null,
|
|
641
|
-
thread_id: aiThreadStore.threadId ?? null,
|
|
642
|
-
},
|
|
643
|
-
},
|
|
644
|
-
);
|
|
645
|
-
settled = true;
|
|
646
|
-
clearTimeout(timeout);
|
|
647
|
-
finishBuild();
|
|
648
|
-
resolve({
|
|
649
|
-
text: 'Something went wrong while updating your website. Please try again.',
|
|
650
|
-
isError: true,
|
|
651
|
-
});
|
|
652
|
-
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
588
|
+
if (msg.type === 'plan_announced' && msg.items) {
|
|
589
|
+
withTypingMessage((m) => {
|
|
590
|
+
if (!m.planItems) m.planItems = msg.items as PlanItem[];
|
|
591
|
+
});
|
|
655
592
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
finishBuild();
|
|
659
|
-
await snapshotStore.refreshSnapshotAsync();
|
|
660
|
-
resolve({
|
|
661
|
-
text: aiResponse.message || lastAiMessage || '',
|
|
662
|
-
});
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
663
595
|
|
|
664
|
-
|
|
665
|
-
|
|
596
|
+
if (msg.type === 'item_complete' && msg.itemId) {
|
|
597
|
+
const itemId = msg.itemId;
|
|
666
598
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
vacantSlots,
|
|
673
|
-
);
|
|
599
|
+
withTypingMessage((m) => {
|
|
600
|
+
if (!m.completedItemIds?.includes(itemId)) {
|
|
601
|
+
m.completedItemIds = [...(m.completedItemIds ?? []), itemId];
|
|
602
|
+
}
|
|
603
|
+
});
|
|
674
604
|
|
|
675
|
-
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
676
607
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
608
|
+
if (msg.type === 'server_response') {
|
|
609
|
+
// CTA buttons (e.g. Upgrade) ride in toolCalls alongside page
|
|
610
|
+
// mutations, but they are presentation, not page edits. Split them
|
|
611
|
+
// so only real mutations reach the metadata-builder and the tool-
|
|
612
|
+
// result submission — a UI action must never be answered with a tool
|
|
613
|
+
// result (it isn't in the agent's conversation), or the next turn fails.
|
|
614
|
+
const { mutationToolCalls, actions: extractedActions } =
|
|
615
|
+
partitionAiToolCalls(
|
|
616
|
+
(msg.toolCalls || []) as AiAssistantToolCall[],
|
|
617
|
+
);
|
|
682
618
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
failedResults,
|
|
687
|
-
retryCount,
|
|
688
|
-
});
|
|
619
|
+
if (extractedActions.length) {
|
|
620
|
+
lastActions = extractedActions;
|
|
621
|
+
}
|
|
689
622
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
623
|
+
const toolCalls = mutationToolCalls;
|
|
624
|
+
const aiResponse: AiAssistantResponse = {
|
|
625
|
+
threadId: aiThreadStore.threadId || '',
|
|
626
|
+
toolCalls,
|
|
627
|
+
message: msg.message || null,
|
|
628
|
+
type: 'tool_calls',
|
|
629
|
+
totalPaidToolCalls: 0,
|
|
630
|
+
timestamp: Date.now(),
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
(async () => {
|
|
634
|
+
try {
|
|
635
|
+
// No tool calls = build cycle complete (success, max retries, or no retryable sections)
|
|
636
|
+
if (toolCalls.length === 0) {
|
|
637
|
+
// Defence-in-depth: a server_response with no toolCalls AND
|
|
638
|
+
// no message text is a degenerate response — it means the
|
|
639
|
+
// backend graph reached END without producing anything
|
|
640
|
+
// actionable. The server-side fix in stream_with_push now
|
|
641
|
+
// converts this to a build_error frame, but if a future
|
|
642
|
+
// regression slips through we must NOT show "Your website
|
|
643
|
+
// has been updated" — that hides real failures from users
|
|
644
|
+
// and from monitoring.
|
|
645
|
+
const hasMeaningfulMessage = Boolean(
|
|
646
|
+
aiResponse.message || lastAiMessage,
|
|
647
|
+
);
|
|
648
|
+
|
|
649
|
+
if (!hasMeaningfulMessage) {
|
|
650
|
+
raygunUtil.safeSendRaygunError(
|
|
651
|
+
new Error(
|
|
652
|
+
'AI build server_response had empty toolCalls and empty message',
|
|
653
|
+
),
|
|
693
654
|
{
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
655
|
+
tags: [
|
|
656
|
+
'feature:ai-website-builder',
|
|
657
|
+
'failure:degenerate_server_response',
|
|
658
|
+
],
|
|
659
|
+
customData: {
|
|
660
|
+
build_id: aiThreadStore.buildId ?? null,
|
|
661
|
+
thread_id: aiThreadStore.threadId ?? null,
|
|
662
|
+
},
|
|
699
663
|
},
|
|
700
664
|
);
|
|
701
|
-
|
|
702
|
-
if (failedResults.length === 0) {
|
|
703
665
|
settled = true;
|
|
704
666
|
clearTimeout(timeout);
|
|
705
667
|
finishBuild();
|
|
706
668
|
resolve({
|
|
707
|
-
text:
|
|
669
|
+
text: 'Something went wrong while updating your website. Please try again.',
|
|
670
|
+
isError: true,
|
|
708
671
|
});
|
|
709
672
|
|
|
710
673
|
return;
|
|
711
674
|
}
|
|
712
675
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
676
|
+
settled = true;
|
|
677
|
+
clearTimeout(timeout);
|
|
678
|
+
finishBuild();
|
|
679
|
+
await snapshotStore.refreshSnapshotAsync();
|
|
680
|
+
resolve({
|
|
681
|
+
text: aiResponse.message || lastAiMessage || '',
|
|
682
|
+
actions: lastActions,
|
|
683
|
+
});
|
|
717
684
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// Tool calls present — apply locally and submit results back
|
|
689
|
+
const { toolResults, aiMessage } = await applyToolCallsAsync(
|
|
690
|
+
aiResponse,
|
|
691
|
+
userMessageId,
|
|
692
|
+
vacantSlots,
|
|
693
|
+
);
|
|
694
|
+
|
|
695
|
+
lastAiMessage = aiMessage;
|
|
696
|
+
|
|
697
|
+
// Submit all tool results (success + failure) so the AI pipeline
|
|
698
|
+
// persists ToolMessages matching every tool_call in the conversation.
|
|
699
|
+
const failedResults = toolResults.filter(
|
|
700
|
+
(tr) => tr.success !== 'success',
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
aiLogger.log('tool submission for results', {
|
|
704
|
+
total: toolResults.length,
|
|
705
|
+
failed: failedResults.length,
|
|
706
|
+
failedResults,
|
|
707
|
+
retryCount,
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
const submitResult = await client.submitToolResultsBuildAsync(
|
|
711
|
+
aiThreadStore.threadId!,
|
|
712
|
+
{
|
|
713
|
+
toolCalls: toolResults,
|
|
714
|
+
agentType: AI_ASSISTANT_AGENT_TYPES.WEBSITE_BUILDER,
|
|
715
|
+
connectionId,
|
|
716
|
+
retryCount,
|
|
717
|
+
userPlan,
|
|
718
|
+
},
|
|
719
|
+
);
|
|
720
|
+
|
|
721
|
+
if (failedResults.length === 0) {
|
|
743
722
|
settled = true;
|
|
744
723
|
clearTimeout(timeout);
|
|
745
724
|
finishBuild();
|
|
746
725
|
resolve({
|
|
747
|
-
text:
|
|
748
|
-
|
|
726
|
+
text: aiMessage || 'Your website has been updated.',
|
|
727
|
+
actions: lastActions,
|
|
749
728
|
});
|
|
729
|
+
|
|
730
|
+
return;
|
|
750
731
|
}
|
|
751
|
-
})();
|
|
752
732
|
|
|
753
|
-
|
|
754
|
-
|
|
733
|
+
// Update buildId so the handler matches subsequent WS messages
|
|
734
|
+
if (submitResult.buildId) {
|
|
735
|
+
aiThreadStore.buildId = submitResult.buildId;
|
|
736
|
+
}
|
|
755
737
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
`AI build ${wsMsg.type}: ${wsMsg.code ?? wsMsg.error ?? 'unknown'}`,
|
|
780
|
-
),
|
|
781
|
-
{
|
|
782
|
-
tags: [
|
|
783
|
-
'feature:ai-website-builder',
|
|
784
|
-
'failure:websocket_error_received',
|
|
785
|
-
`frame_type:${wsMsg.type}`,
|
|
786
|
-
],
|
|
787
|
-
customData: {
|
|
788
|
-
code: wsMsg.code ?? null,
|
|
789
|
-
message: wsMsg.message ?? null,
|
|
790
|
-
error: wsMsg.error ?? null,
|
|
791
|
-
build_id: wsMsg.buildId ?? null,
|
|
792
|
-
thread_id: aiThreadStore.threadId ?? null,
|
|
738
|
+
// eslint-disable-next-line no-plusplus
|
|
739
|
+
retryCount++;
|
|
740
|
+
} catch (err) {
|
|
741
|
+
aiLogger.log('server_response apply error', { err });
|
|
742
|
+
// Client-side apply failure (metadata builder, tool-call parser,
|
|
743
|
+
// missing field, etc.) — server thinks the build succeeded but we
|
|
744
|
+
// couldn't materialise the changes. Mark the chat bubble as an
|
|
745
|
+
// error so the user sees the real outcome, and report to Raygun
|
|
746
|
+
// so the failure is visible in monitoring (the server didn't see it).
|
|
747
|
+
raygunUtil.safeSendRaygunError(
|
|
748
|
+
err instanceof Error
|
|
749
|
+
? err
|
|
750
|
+
: new Error('AI apply failed: non-Error thrown'),
|
|
751
|
+
{
|
|
752
|
+
tags: [
|
|
753
|
+
'feature:ai-website-builder',
|
|
754
|
+
'failure:apply_error',
|
|
755
|
+
'stage:client_apply',
|
|
756
|
+
],
|
|
757
|
+
customData: {
|
|
758
|
+
thread_id: aiThreadStore.threadId ?? null,
|
|
759
|
+
build_id: aiThreadStore.buildId ?? null,
|
|
760
|
+
},
|
|
793
761
|
},
|
|
762
|
+
);
|
|
763
|
+
settled = true;
|
|
764
|
+
clearTimeout(timeout);
|
|
765
|
+
finishBuild();
|
|
766
|
+
resolve({
|
|
767
|
+
text: "I couldn't apply those changes to your website. Please try again.",
|
|
768
|
+
isError: true,
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
})();
|
|
772
|
+
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
if (msg.type === 'server_error' || msg.type === 'build_error') {
|
|
777
|
+
settled = true;
|
|
778
|
+
clearTimeout(timeout);
|
|
779
|
+
finishBuild();
|
|
780
|
+
|
|
781
|
+
// Backend already reports the underlying pipeline failure to
|
|
782
|
+
// Raygun via its structured handler (stage:run_build /
|
|
783
|
+
// stage:section_builder / etc. with full Python traceback).
|
|
784
|
+
// We report the frontend's RECEIPT of the error frame as a
|
|
785
|
+
// separate signal — distinct tag, distinct grouping. This
|
|
786
|
+
// gives triangulation: both sides have entry → normal crash;
|
|
787
|
+
// frontend only → backend Raygun outage; backend only → WS
|
|
788
|
+
// frame didn't reach client (different bug shape).
|
|
789
|
+
const wsMsg = msg as {
|
|
790
|
+
type: string;
|
|
791
|
+
code?: string;
|
|
792
|
+
message?: string;
|
|
793
|
+
error?: string;
|
|
794
|
+
buildId?: string;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
raygunUtil.safeSendRaygunError(
|
|
798
|
+
new Error(
|
|
799
|
+
`AI build ${wsMsg.type}: ${wsMsg.code ?? wsMsg.error ?? 'unknown'}`,
|
|
800
|
+
),
|
|
801
|
+
{
|
|
802
|
+
tags: [
|
|
803
|
+
'feature:ai-website-builder',
|
|
804
|
+
'failure:websocket_error_received',
|
|
805
|
+
`frame_type:${wsMsg.type}`,
|
|
806
|
+
],
|
|
807
|
+
customData: {
|
|
808
|
+
code: wsMsg.code ?? null,
|
|
809
|
+
message: wsMsg.message ?? null,
|
|
810
|
+
error: wsMsg.error ?? null,
|
|
811
|
+
build_id: wsMsg.buildId ?? null,
|
|
812
|
+
thread_id: aiThreadStore.threadId ?? null,
|
|
794
813
|
},
|
|
795
|
-
|
|
814
|
+
},
|
|
815
|
+
);
|
|
796
816
|
|
|
797
|
-
|
|
817
|
+
resolve({ text: pickWsErrorMessage(msg), isError: true });
|
|
798
818
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
} catch (err) {
|
|
822
|
+
aiLogger.log('Unexpected error in WS message handler', {
|
|
823
|
+
err,
|
|
824
|
+
type: msg.type,
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
if (!settled) {
|
|
828
|
+
settled = true;
|
|
829
|
+
clearTimeout(timeout);
|
|
830
|
+
finishBuild();
|
|
831
|
+
resolve({
|
|
832
|
+
text: 'An error occurred during the build.',
|
|
833
|
+
isError: true,
|
|
805
834
|
});
|
|
806
|
-
|
|
807
|
-
if (!settled) {
|
|
808
|
-
settled = true;
|
|
809
|
-
clearTimeout(timeout);
|
|
810
|
-
finishBuild();
|
|
811
|
-
resolve({ text: 'An error occurred during the build.' });
|
|
812
|
-
}
|
|
813
835
|
}
|
|
814
|
-
}
|
|
836
|
+
}
|
|
837
|
+
};
|
|
815
838
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
);
|
|
839
|
+
wsClient.onMessage(handler);
|
|
840
|
+
});
|
|
819
841
|
} catch (err) {
|
|
820
842
|
aiThreadStore.isBuildInProgress = false;
|
|
821
843
|
wsClient.setBuildActive(false);
|
|
@@ -896,6 +918,18 @@ export function useAiWebsiteBuilderChat(): UseAiChatResult {
|
|
|
896
918
|
if (result.isError) {
|
|
897
919
|
threadItems.value[messageIndex].isError = true;
|
|
898
920
|
}
|
|
921
|
+
|
|
922
|
+
// Attach agent-driven actions (e.g. upgrade CTA) only on successful
|
|
923
|
+
// (non-error) responses. Suppressed for premium users client-side as
|
|
924
|
+
// a defence-in-depth guard (server also vetoes via eligibility logic).
|
|
925
|
+
if (
|
|
926
|
+
!result.isError &&
|
|
927
|
+
result.actions?.length &&
|
|
928
|
+
!userStore.hasPremiumSubscription
|
|
929
|
+
) {
|
|
930
|
+
(threadItems.value[messageIndex] as TextThreadMessage).actions =
|
|
931
|
+
result.actions;
|
|
932
|
+
}
|
|
899
933
|
} else {
|
|
900
934
|
threadItems.value[messageIndex].text =
|
|
901
935
|
'Failed to apply changes. Please try again.';
|
|
@@ -997,6 +1031,11 @@ export function useAiWebsiteBuilderChat(): UseAiChatResult {
|
|
|
997
1031
|
completedItemIds:
|
|
998
1032
|
(msg as TextThreadMessage).completedItemIds ?? [],
|
|
999
1033
|
}),
|
|
1034
|
+
...(msg.type === 'text' &&
|
|
1035
|
+
!msg.isTyping &&
|
|
1036
|
+
(msg as TextThreadMessage).actions?.length && {
|
|
1037
|
+
actions: (msg as TextThreadMessage).actions,
|
|
1038
|
+
}),
|
|
1000
1039
|
} as Record<string, unknown>,
|
|
1001
1040
|
};
|
|
1002
1041
|
});
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"modernDisplayName": "modern",
|
|
13
13
|
"uniqueDisplayName": "einzigartig",
|
|
14
14
|
"allFontStylesDisplayName": "Alle Schriftstile",
|
|
15
|
+
"searchFontsPlaceholder": "Schriftarten durchsuchen",
|
|
16
|
+
"noFontsFoundMessage": "Keine Schriftarten gefunden",
|
|
15
17
|
"settingsSaveSuccessMessage": "Einstellungen wurden erfolgreich gespeichert"
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"modernDisplayName": "moderna",
|
|
13
13
|
"uniqueDisplayName": "única",
|
|
14
14
|
"allFontStylesDisplayName": "Todos los estilos de fuente",
|
|
15
|
+
"searchFontsPlaceholder": "Busca fuentes",
|
|
16
|
+
"noFontsFoundMessage": "No se encontraron fuentes",
|
|
15
17
|
"settingsSaveSuccessMessage": "La configuración se ha guardado correctamente"
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"modernDisplayName": "Moderne",
|
|
13
13
|
"uniqueDisplayName": "Unique",
|
|
14
14
|
"allFontStylesDisplayName": "Tous les styles de police",
|
|
15
|
+
"searchFontsPlaceholder": "Rechercher des polices",
|
|
16
|
+
"noFontsFoundMessage": "Aucune police trouvée",
|
|
15
17
|
"settingsSaveSuccessMessage": "Paramètres enregistrés avec succès"
|
|
16
18
|
}
|
|
17
19
|
}
|