@vantageos/mosaic-blocks 0.5.12-alpha → 0.5.13-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 +4 -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 +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
## 1. Hero & Positioning
|
|
12
12
|
|
|
13
|
-
`@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides
|
|
13
|
+
`@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides 133 opinionated, fully-typed UI components that integrate natively with:
|
|
14
14
|
|
|
15
15
|
- **Clerk** — auth sign-in/up flows, org switcher, RBAC, webhook sync
|
|
16
16
|
- **Convex** — real-time data binding ready
|
|
@@ -169,7 +169,7 @@ For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 1
|
|
|
169
169
|
|
|
170
170
|
## 6. Component Catalogue Summary
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
133 exported `Mosaic*` components across 9 sections (156 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
|
|
173
173
|
|
|
174
174
|
> There is **no "Debate" section**. No `Mosaic*` debate component (room/timer/participant) is exported by this package — despite the "absorbed from anydebate" origin story below, the debate UI was never ported. If you need debate-room UI, it does not exist here yet.
|
|
175
175
|
|
|
@@ -470,7 +470,8 @@ This package follows [Semantic Versioning](https://semver.org/). While in alpha
|
|
|
470
470
|
|
|
471
471
|
| Version | Status | Notes |
|
|
472
472
|
|---|---|---|
|
|
473
|
-
| `0.5.
|
|
473
|
+
| `0.5.13-alpha` | Current | 133 exported `Mosaic*` components — adds `MosaicAgentChat` (presentational session harness: send a turn, resume a session, forward approval responses to the agent runtime) |
|
|
474
|
+
| `0.5.12-alpha` | Historical | 132 exported `Mosaic*` components — adds `MosaicApiKeyPanel` (presentational BYOK panel: idle/validating/valid/invalid, no storage, no network) — superseded by the Current row above |
|
|
474
475
|
| `0.5.11-alpha` | Historical | 131 exported `Mosaic*` components — guard fix only, no new component: `readme-matches-exports.test.ts` now exempts Historical rows by their Status column (structural), not by wording — superseded by the Current row above |
|
|
475
476
|
| `0.5.10-alpha` | Historical | 131 exported `Mosaic*` components, adds `MosaicToolToggleList` (per-tool switch + approval-level selector) — superseded by the Current row above |
|
|
476
477
|
| `0.5.9-alpha` | Historical | 130 exported `Mosaic*` components — adds `MosaicApprovalPrompt` (tool-call approve/deny) — superseded by the Current row above |
|
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ function _interopNamespace(e) {
|
|
|
46
46
|
var React28__namespace = /*#__PURE__*/_interopNamespace(React28);
|
|
47
47
|
|
|
48
48
|
// src/version.ts
|
|
49
|
-
var version = "0.5.
|
|
49
|
+
var version = "0.5.13-alpha";
|
|
50
50
|
function Placeholder({ label = "mosaic-blocks placeholder" }) {
|
|
51
51
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
|
|
52
52
|
}
|
|
@@ -12676,6 +12676,186 @@ function MosaicApiKeyPanel(props) {
|
|
|
12676
12676
|
] });
|
|
12677
12677
|
}
|
|
12678
12678
|
MosaicApiKeyPanel.displayName = "MosaicApiKeyPanel";
|
|
12679
|
+
var agentChatRootVariants = classVarianceAuthority.cva([
|
|
12680
|
+
"flex min-h-0 w-full flex-1 flex-col gap-2 overflow-hidden rounded-lg border border-border bg-card"
|
|
12681
|
+
]);
|
|
12682
|
+
function cn80(...classes) {
|
|
12683
|
+
return classes.filter(Boolean).join(" ");
|
|
12684
|
+
}
|
|
12685
|
+
function formatPayload2(value) {
|
|
12686
|
+
if (typeof value === "string") {
|
|
12687
|
+
return value;
|
|
12688
|
+
}
|
|
12689
|
+
try {
|
|
12690
|
+
return JSON.stringify(value, null, 2);
|
|
12691
|
+
} catch {
|
|
12692
|
+
return String(value);
|
|
12693
|
+
}
|
|
12694
|
+
}
|
|
12695
|
+
function renderApprovalPrompt(part, decisions, onDecide) {
|
|
12696
|
+
const { approval } = part;
|
|
12697
|
+
const decision = decisions[approval.requestId];
|
|
12698
|
+
const renderArguments = /* @__PURE__ */ jsxRuntime.jsx(
|
|
12699
|
+
"pre",
|
|
12700
|
+
{
|
|
12701
|
+
"data-slot": "agent-chat-approval-arguments",
|
|
12702
|
+
className: "max-h-56 overflow-auto rounded bg-muted/30 p-2 font-mono text-[11px] leading-5 text-muted-foreground",
|
|
12703
|
+
children: formatPayload2(part.input)
|
|
12704
|
+
}
|
|
12705
|
+
);
|
|
12706
|
+
const sharedProps = {
|
|
12707
|
+
toolName: part.toolName,
|
|
12708
|
+
toolNameLabel: approval.approvalLabels.toolNameLabel,
|
|
12709
|
+
promptTitle: approval.approvalLabels.promptTitle,
|
|
12710
|
+
renderArguments
|
|
12711
|
+
};
|
|
12712
|
+
if (decision === "approved" || decision === "denied") {
|
|
12713
|
+
const decisionMessage = decision === "approved" ? approval.approvalLabels.approvedMessage : approval.approvalLabels.deniedMessage;
|
|
12714
|
+
const respondedProps = {
|
|
12715
|
+
...sharedProps,
|
|
12716
|
+
status: "responded",
|
|
12717
|
+
decision,
|
|
12718
|
+
decisionMessage
|
|
12719
|
+
};
|
|
12720
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MosaicApprovalPrompt, { ...respondedProps });
|
|
12721
|
+
}
|
|
12722
|
+
const pendingProps = {
|
|
12723
|
+
...sharedProps,
|
|
12724
|
+
status: "pending",
|
|
12725
|
+
approveButtonLabel: approval.approvalLabels.approveButtonLabel,
|
|
12726
|
+
denyButtonLabel: approval.approvalLabels.denyButtonLabel,
|
|
12727
|
+
onApprove: () => onDecide({ requestId: approval.requestId, optionId: approval.approveOptionId }, "approved"),
|
|
12728
|
+
onDeny: () => onDecide({ requestId: approval.requestId, optionId: approval.denyOptionId }, "denied")
|
|
12729
|
+
};
|
|
12730
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MosaicApprovalPrompt, { ...pendingProps });
|
|
12731
|
+
}
|
|
12732
|
+
function toRenderPart(part, decisions, onDecide) {
|
|
12733
|
+
if (part.type !== "tool") {
|
|
12734
|
+
return part;
|
|
12735
|
+
}
|
|
12736
|
+
if (part.state === "approval-requested") {
|
|
12737
|
+
return {
|
|
12738
|
+
type: "tool",
|
|
12739
|
+
toolCallId: part.toolCallId,
|
|
12740
|
+
toolName: part.toolName,
|
|
12741
|
+
input: part.input,
|
|
12742
|
+
state: "approval-requested",
|
|
12743
|
+
renderApproval: () => renderApprovalPrompt(part, decisions, onDecide)
|
|
12744
|
+
};
|
|
12745
|
+
}
|
|
12746
|
+
switch (part.state) {
|
|
12747
|
+
case "input-streaming":
|
|
12748
|
+
return {
|
|
12749
|
+
type: "tool",
|
|
12750
|
+
toolCallId: part.toolCallId,
|
|
12751
|
+
toolName: part.toolName,
|
|
12752
|
+
input: part.input,
|
|
12753
|
+
state: "input-streaming"
|
|
12754
|
+
};
|
|
12755
|
+
case "output-available":
|
|
12756
|
+
return {
|
|
12757
|
+
type: "tool",
|
|
12758
|
+
toolCallId: part.toolCallId,
|
|
12759
|
+
toolName: part.toolName,
|
|
12760
|
+
input: part.input,
|
|
12761
|
+
state: "output-available",
|
|
12762
|
+
output: part.output
|
|
12763
|
+
};
|
|
12764
|
+
case "output-denied":
|
|
12765
|
+
return {
|
|
12766
|
+
type: "tool",
|
|
12767
|
+
toolCallId: part.toolCallId,
|
|
12768
|
+
toolName: part.toolName,
|
|
12769
|
+
input: part.input,
|
|
12770
|
+
state: "output-denied"
|
|
12771
|
+
};
|
|
12772
|
+
case "output-error":
|
|
12773
|
+
return {
|
|
12774
|
+
type: "tool",
|
|
12775
|
+
toolCallId: part.toolCallId,
|
|
12776
|
+
toolName: part.toolName,
|
|
12777
|
+
input: part.input,
|
|
12778
|
+
state: "output-error",
|
|
12779
|
+
errorText: part.errorText
|
|
12780
|
+
};
|
|
12781
|
+
}
|
|
12782
|
+
}
|
|
12783
|
+
function MosaicAgentChat(props) {
|
|
12784
|
+
const {
|
|
12785
|
+
messages,
|
|
12786
|
+
renderText,
|
|
12787
|
+
reasoningLabel,
|
|
12788
|
+
reasoningStreamingLabel,
|
|
12789
|
+
toolStatusLabels,
|
|
12790
|
+
scrollToBottomLabel,
|
|
12791
|
+
composerValue,
|
|
12792
|
+
onComposerValueChange,
|
|
12793
|
+
textareaAriaLabel,
|
|
12794
|
+
placeholder,
|
|
12795
|
+
onApprovalResponse,
|
|
12796
|
+
sessionId,
|
|
12797
|
+
onResumeSession,
|
|
12798
|
+
disabled = false,
|
|
12799
|
+
className,
|
|
12800
|
+
ref
|
|
12801
|
+
} = props;
|
|
12802
|
+
const [decisions, setDecisions] = React28.useState({});
|
|
12803
|
+
const resumedSessionIdRef = React28.useRef(void 0);
|
|
12804
|
+
React28.useEffect(() => {
|
|
12805
|
+
if (!sessionId || !onResumeSession) {
|
|
12806
|
+
return;
|
|
12807
|
+
}
|
|
12808
|
+
if (resumedSessionIdRef.current === sessionId) {
|
|
12809
|
+
return;
|
|
12810
|
+
}
|
|
12811
|
+
resumedSessionIdRef.current = sessionId;
|
|
12812
|
+
onResumeSession(sessionId);
|
|
12813
|
+
}, [sessionId, onResumeSession]);
|
|
12814
|
+
function handleDecide(payload, decision) {
|
|
12815
|
+
setDecisions((previous) => ({ ...previous, [payload.requestId]: decision }));
|
|
12816
|
+
onApprovalResponse(payload);
|
|
12817
|
+
}
|
|
12818
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, "data-slot": "agent-chat", className: cn80(agentChatRootVariants(), className), children: [
|
|
12819
|
+
/* @__PURE__ */ jsxRuntime.jsx(MosaicChatThread, { scrollToBottomLabel, children: messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12820
|
+
MosaicChatMessage,
|
|
12821
|
+
{
|
|
12822
|
+
messageRole: message.messageRole,
|
|
12823
|
+
parts: message.parts.map((part) => toRenderPart(part, decisions, handleDecide)),
|
|
12824
|
+
renderText,
|
|
12825
|
+
reasoningLabel,
|
|
12826
|
+
reasoningStreamingLabel,
|
|
12827
|
+
toolStatusLabels
|
|
12828
|
+
},
|
|
12829
|
+
message.id
|
|
12830
|
+
)) }),
|
|
12831
|
+
props.status === "responding" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12832
|
+
MosaicChatComposer,
|
|
12833
|
+
{
|
|
12834
|
+
status: "responding",
|
|
12835
|
+
value: composerValue,
|
|
12836
|
+
onValueChange: onComposerValueChange,
|
|
12837
|
+
textareaAriaLabel,
|
|
12838
|
+
placeholder,
|
|
12839
|
+
disabled,
|
|
12840
|
+
onStop: props.onStop,
|
|
12841
|
+
stopButtonAriaLabel: props.stopButtonAriaLabel
|
|
12842
|
+
}
|
|
12843
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
12844
|
+
MosaicChatComposer,
|
|
12845
|
+
{
|
|
12846
|
+
status: "idle",
|
|
12847
|
+
value: composerValue,
|
|
12848
|
+
onValueChange: onComposerValueChange,
|
|
12849
|
+
textareaAriaLabel,
|
|
12850
|
+
placeholder,
|
|
12851
|
+
disabled,
|
|
12852
|
+
onSubmit: props.onSubmit,
|
|
12853
|
+
sendButtonAriaLabel: props.sendButtonAriaLabel
|
|
12854
|
+
}
|
|
12855
|
+
)
|
|
12856
|
+
] });
|
|
12857
|
+
}
|
|
12858
|
+
MosaicAgentChat.displayName = "MosaicAgentChat";
|
|
12679
12859
|
|
|
12680
12860
|
Object.defineProperty(exports, "Accordion", {
|
|
12681
12861
|
enumerable: true,
|
|
@@ -12695,6 +12875,7 @@ exports.MosaicAdaptiveGrid = MosaicAdaptiveGrid;
|
|
|
12695
12875
|
exports.MosaicAdaptiveModal = MosaicAdaptiveModal;
|
|
12696
12876
|
exports.MosaicAdaptiveNavigation = MosaicAdaptiveNavigation;
|
|
12697
12877
|
exports.MosaicAgentCard = MosaicAgentCard;
|
|
12878
|
+
exports.MosaicAgentChat = MosaicAgentChat;
|
|
12698
12879
|
exports.MosaicAgentComposer = MosaicAgentComposer;
|
|
12699
12880
|
exports.MosaicAgentComposerDesktop = MosaicAgentComposerDesktop;
|
|
12700
12881
|
exports.MosaicAgentComposerMobile = MosaicAgentComposerMobile;
|
|
@@ -12818,6 +12999,7 @@ exports.MosaicTooltipTrigger = MosaicTooltipTrigger;
|
|
|
12818
12999
|
exports.MosaicUrlScraper = MosaicUrlScraper;
|
|
12819
13000
|
exports.MosaicUserButton = MosaicUserButton;
|
|
12820
13001
|
exports.Placeholder = Placeholder;
|
|
13002
|
+
exports.agentChatRootVariants = agentChatRootVariants;
|
|
12821
13003
|
exports.badgeVariants = badgeVariants;
|
|
12822
13004
|
exports.buttonVariants = buttonVariants;
|
|
12823
13005
|
exports.chatMessageBubbleVariants = chatMessageBubbleVariants;
|