@vantageos/mosaic-blocks 0.5.12-alpha → 0.5.14-alpha
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/README.md +5 -3
- package/dist/index.cjs +183 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +247 -2
- package/dist/index.d.ts +247 -2
- package/dist/index.js +182 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Menu } from '@base-ui/react/menu';
|
|
|
27
27
|
import { AlertDialog } from '@base-ui/react/alert-dialog';
|
|
28
28
|
|
|
29
29
|
// src/version.ts
|
|
30
|
-
var version = "0.5.
|
|
30
|
+
var version = "0.5.14-alpha";
|
|
31
31
|
function Placeholder({ label = "mosaic-blocks placeholder" }) {
|
|
32
32
|
return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
|
|
33
33
|
}
|
|
@@ -12657,7 +12657,187 @@ function MosaicApiKeyPanel(props) {
|
|
|
12657
12657
|
] });
|
|
12658
12658
|
}
|
|
12659
12659
|
MosaicApiKeyPanel.displayName = "MosaicApiKeyPanel";
|
|
12660
|
+
var agentChatRootVariants = cva([
|
|
12661
|
+
"flex min-h-0 w-full flex-1 flex-col gap-2 overflow-hidden rounded-lg border border-border bg-card"
|
|
12662
|
+
]);
|
|
12663
|
+
function cn80(...classes) {
|
|
12664
|
+
return classes.filter(Boolean).join(" ");
|
|
12665
|
+
}
|
|
12666
|
+
function formatPayload2(value) {
|
|
12667
|
+
if (typeof value === "string") {
|
|
12668
|
+
return value;
|
|
12669
|
+
}
|
|
12670
|
+
try {
|
|
12671
|
+
return JSON.stringify(value, null, 2);
|
|
12672
|
+
} catch {
|
|
12673
|
+
return String(value);
|
|
12674
|
+
}
|
|
12675
|
+
}
|
|
12676
|
+
function renderApprovalPrompt(part, decisions, onDecide) {
|
|
12677
|
+
const { approval } = part;
|
|
12678
|
+
const decision = decisions[approval.requestId];
|
|
12679
|
+
const renderArguments = /* @__PURE__ */ jsx(
|
|
12680
|
+
"pre",
|
|
12681
|
+
{
|
|
12682
|
+
"data-slot": "agent-chat-approval-arguments",
|
|
12683
|
+
className: "max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground",
|
|
12684
|
+
children: formatPayload2(part.input)
|
|
12685
|
+
}
|
|
12686
|
+
);
|
|
12687
|
+
const sharedProps = {
|
|
12688
|
+
toolName: part.toolName,
|
|
12689
|
+
toolNameLabel: approval.approvalLabels.toolNameLabel,
|
|
12690
|
+
promptTitle: approval.approvalLabels.promptTitle,
|
|
12691
|
+
renderArguments
|
|
12692
|
+
};
|
|
12693
|
+
if (decision === "approved" || decision === "denied") {
|
|
12694
|
+
const decisionMessage = decision === "approved" ? approval.approvalLabels.approvedMessage : approval.approvalLabels.deniedMessage;
|
|
12695
|
+
const respondedProps = {
|
|
12696
|
+
...sharedProps,
|
|
12697
|
+
status: "responded",
|
|
12698
|
+
decision,
|
|
12699
|
+
decisionMessage
|
|
12700
|
+
};
|
|
12701
|
+
return /* @__PURE__ */ jsx(MosaicApprovalPrompt, { ...respondedProps });
|
|
12702
|
+
}
|
|
12703
|
+
const pendingProps = {
|
|
12704
|
+
...sharedProps,
|
|
12705
|
+
status: "pending",
|
|
12706
|
+
approveButtonLabel: approval.approvalLabels.approveButtonLabel,
|
|
12707
|
+
denyButtonLabel: approval.approvalLabels.denyButtonLabel,
|
|
12708
|
+
onApprove: () => onDecide({ requestId: approval.requestId, optionId: approval.approveOptionId }, "approved"),
|
|
12709
|
+
onDeny: () => onDecide({ requestId: approval.requestId, optionId: approval.denyOptionId }, "denied")
|
|
12710
|
+
};
|
|
12711
|
+
return /* @__PURE__ */ jsx(MosaicApprovalPrompt, { ...pendingProps });
|
|
12712
|
+
}
|
|
12713
|
+
function toRenderPart(part, decisions, onDecide) {
|
|
12714
|
+
if (part.type !== "tool") {
|
|
12715
|
+
return part;
|
|
12716
|
+
}
|
|
12717
|
+
if (part.state === "approval-requested") {
|
|
12718
|
+
return {
|
|
12719
|
+
type: "tool",
|
|
12720
|
+
toolCallId: part.toolCallId,
|
|
12721
|
+
toolName: part.toolName,
|
|
12722
|
+
input: part.input,
|
|
12723
|
+
state: "approval-requested",
|
|
12724
|
+
renderApproval: () => renderApprovalPrompt(part, decisions, onDecide)
|
|
12725
|
+
};
|
|
12726
|
+
}
|
|
12727
|
+
switch (part.state) {
|
|
12728
|
+
case "input-streaming":
|
|
12729
|
+
return {
|
|
12730
|
+
type: "tool",
|
|
12731
|
+
toolCallId: part.toolCallId,
|
|
12732
|
+
toolName: part.toolName,
|
|
12733
|
+
input: part.input,
|
|
12734
|
+
state: "input-streaming"
|
|
12735
|
+
};
|
|
12736
|
+
case "output-available":
|
|
12737
|
+
return {
|
|
12738
|
+
type: "tool",
|
|
12739
|
+
toolCallId: part.toolCallId,
|
|
12740
|
+
toolName: part.toolName,
|
|
12741
|
+
input: part.input,
|
|
12742
|
+
state: "output-available",
|
|
12743
|
+
output: part.output
|
|
12744
|
+
};
|
|
12745
|
+
case "output-denied":
|
|
12746
|
+
return {
|
|
12747
|
+
type: "tool",
|
|
12748
|
+
toolCallId: part.toolCallId,
|
|
12749
|
+
toolName: part.toolName,
|
|
12750
|
+
input: part.input,
|
|
12751
|
+
state: "output-denied"
|
|
12752
|
+
};
|
|
12753
|
+
case "output-error":
|
|
12754
|
+
return {
|
|
12755
|
+
type: "tool",
|
|
12756
|
+
toolCallId: part.toolCallId,
|
|
12757
|
+
toolName: part.toolName,
|
|
12758
|
+
input: part.input,
|
|
12759
|
+
state: "output-error",
|
|
12760
|
+
errorText: part.errorText
|
|
12761
|
+
};
|
|
12762
|
+
}
|
|
12763
|
+
}
|
|
12764
|
+
function MosaicAgentChat(props) {
|
|
12765
|
+
const {
|
|
12766
|
+
messages,
|
|
12767
|
+
renderText,
|
|
12768
|
+
reasoningLabel,
|
|
12769
|
+
reasoningStreamingLabel,
|
|
12770
|
+
toolStatusLabels,
|
|
12771
|
+
scrollToBottomLabel,
|
|
12772
|
+
composerValue,
|
|
12773
|
+
onComposerValueChange,
|
|
12774
|
+
textareaAriaLabel,
|
|
12775
|
+
placeholder,
|
|
12776
|
+
onApprovalResponse,
|
|
12777
|
+
sessionId,
|
|
12778
|
+
onResumeSession,
|
|
12779
|
+
disabled = false,
|
|
12780
|
+
className,
|
|
12781
|
+
ref
|
|
12782
|
+
} = props;
|
|
12783
|
+
const [decisions, setDecisions] = useState({});
|
|
12784
|
+
const resumedSessionIdRef = useRef(void 0);
|
|
12785
|
+
useEffect(() => {
|
|
12786
|
+
if (!sessionId || !onResumeSession) {
|
|
12787
|
+
return;
|
|
12788
|
+
}
|
|
12789
|
+
if (resumedSessionIdRef.current === sessionId) {
|
|
12790
|
+
return;
|
|
12791
|
+
}
|
|
12792
|
+
resumedSessionIdRef.current = sessionId;
|
|
12793
|
+
onResumeSession(sessionId);
|
|
12794
|
+
}, [sessionId, onResumeSession]);
|
|
12795
|
+
function handleDecide(payload, decision) {
|
|
12796
|
+
setDecisions((previous) => ({ ...previous, [payload.requestId]: decision }));
|
|
12797
|
+
onApprovalResponse(payload);
|
|
12798
|
+
}
|
|
12799
|
+
return /* @__PURE__ */ jsxs("div", { ref, "data-slot": "agent-chat", className: cn80(agentChatRootVariants(), className), children: [
|
|
12800
|
+
/* @__PURE__ */ jsx(MosaicChatThread, { scrollToBottomLabel, children: messages.map((message) => /* @__PURE__ */ jsx(
|
|
12801
|
+
MosaicChatMessage,
|
|
12802
|
+
{
|
|
12803
|
+
messageRole: message.messageRole,
|
|
12804
|
+
parts: message.parts.map((part) => toRenderPart(part, decisions, handleDecide)),
|
|
12805
|
+
renderText,
|
|
12806
|
+
reasoningLabel,
|
|
12807
|
+
reasoningStreamingLabel,
|
|
12808
|
+
toolStatusLabels
|
|
12809
|
+
},
|
|
12810
|
+
message.id
|
|
12811
|
+
)) }),
|
|
12812
|
+
props.status === "responding" ? /* @__PURE__ */ jsx(
|
|
12813
|
+
MosaicChatComposer,
|
|
12814
|
+
{
|
|
12815
|
+
status: "responding",
|
|
12816
|
+
value: composerValue,
|
|
12817
|
+
onValueChange: onComposerValueChange,
|
|
12818
|
+
textareaAriaLabel,
|
|
12819
|
+
placeholder,
|
|
12820
|
+
disabled,
|
|
12821
|
+
onStop: props.onStop,
|
|
12822
|
+
stopButtonAriaLabel: props.stopButtonAriaLabel
|
|
12823
|
+
}
|
|
12824
|
+
) : /* @__PURE__ */ jsx(
|
|
12825
|
+
MosaicChatComposer,
|
|
12826
|
+
{
|
|
12827
|
+
status: "idle",
|
|
12828
|
+
value: composerValue,
|
|
12829
|
+
onValueChange: onComposerValueChange,
|
|
12830
|
+
textareaAriaLabel,
|
|
12831
|
+
placeholder,
|
|
12832
|
+
disabled,
|
|
12833
|
+
onSubmit: props.onSubmit,
|
|
12834
|
+
sendButtonAriaLabel: props.sendButtonAriaLabel
|
|
12835
|
+
}
|
|
12836
|
+
)
|
|
12837
|
+
] });
|
|
12838
|
+
}
|
|
12839
|
+
MosaicAgentChat.displayName = "MosaicAgentChat";
|
|
12660
12840
|
|
|
12661
|
-
export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicApiKeyPanel, MosaicAppSidebar, MosaicApprovalPrompt, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDropdownMenu, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMemberList, MosaicMemoryCard, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTemplateCard, MosaicTemplateGallery, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicToolToggleList, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|
|
12841
|
+
export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentChat, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicApiKeyPanel, MosaicAppSidebar, MosaicApprovalPrompt, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDropdownMenu, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMemberList, MosaicMemoryCard, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTemplateCard, MosaicTemplateGallery, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicToolToggleList, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, agentChatRootVariants, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|
|
12662
12842
|
//# sourceMappingURL=index.js.map
|
|
12663
12843
|
//# sourceMappingURL=index.js.map
|