Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,29 @@ jobs:
mkdir -p "$RUNNER_TEMP/c" && cd "$RUNNER_TEMP/c"
npm init -y >/dev/null && npm pkg set type=module >/dev/null
npm install "$TARBALL"
node -e 'import("@corbits/react-ui").then((m) => { for (const n of ["Button", "ChatThread", "Badge"]) if (typeof m[n] !== "function") throw new Error("missing export: " + n); })'
# One runtime export from each module the chat family puts in
# src/index.ts, so a dropped `export *` line fails here and not in a
# consumer's build. lib/conversation.js is types only and has none.
# A forwardRef component is an object, so presence is the check.
node --input-type=module -e '
const m = await import("@corbits/react-ui");
const names = [
"Button", "Badge",
"usePromptInput", "useResizable", "useTabs", "useTabDrag", "useCopy",
"useHistoryWindow", "useReadingPosition", "useAttachments",
"useFileDrop", "useMediaViewer",
"groupActivity", "mediaKindOf", "checkAttachments", "matchPromptTokens",
"Conversation", "ConversationDivider", "ConversationEarlier",
"ConversationMap", "ConversationThread",
"PromptInput", "PromptInputToolbar", "Panel", "PanelTabs",
"Tool", "ToolApproval", "ToolGroup", "Reasoning", "Activity",
"Message", "MessageFold", "MessageActions", "MessageReactions",
"MessageReplies", "Attachments", "AttachmentDropZone",
"GeneratedImages", "Sources", "MediaViewer",
];
const missing = names.filter((n) => m[n] === undefined);
if (missing.length) throw new Error("missing exports: " + missing.join(", "));
'

policy-check:
if: github.event_name == 'pull_request'
Expand Down
210 changes: 162 additions & 48 deletions README.md

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions e2e/approval-card.spec.ts

This file was deleted.

23 changes: 0 additions & 23 deletions e2e/chat-thread.spec.ts

This file was deleted.

59 changes: 0 additions & 59 deletions e2e/fixtures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { useEffect, useLayoutEffect, useRef, useState, Profiler } from "react";
import type { ReactNode } from "react";

import {
ApprovalCard,
AuthLayout,
Button,
ChatThread,
Conversation,
ConversationContent,
ConversationEmptyState,
Expand All @@ -18,8 +16,6 @@ import {
ThemeProvider,
ThemeToggle,
ThinkingMark,
type ApprovalRequest,
type ChatMessage,
type ConversationScrollPolicy,
useConversation,
PromptInput,
Expand Down Expand Up @@ -98,13 +94,6 @@ import {
DialogTitle,
} from "@corbits/react-ui/ui/dialog";

const REQUEST: ApprovalRequest = {
id: "req-1",
headline: "Post to #sales (Slack)",
requestedBy: "Scout",
details: [{ label: "Message", value: "Q3 numbers are in." }],
};

const GROUPS: CommandPaletteGroup[] = [
{
id: "pages",
Expand All @@ -126,21 +115,6 @@ function useEventLog() {
};
}

function Approval({ state }: { state: "idle" | "approving" }) {
const { log, record } = useEventLog();
return (
<>
<ApprovalCard
request={REQUEST}
state={state}
onApprove={() => record("approve")}
onReject={() => record("reject")}
/>
{log}
</>
);
}

function Palette() {
const [open, setOpen] = useState(false);
const [query, setQuery] = useState("");
Expand All @@ -164,32 +138,6 @@ function Palette() {
);
}

const CHAT: ChatMessage[] = [
{
id: "m1",
role: "user",
createdAt: "2026-01-01T09:00:00Z",
parts: [{ type: "text", text: "What changed today?" }],
},
{
id: "m2",
role: "agent",
createdAt: "2026-01-01T09:00:04Z",
parts: [
{ type: "reasoning", text: "Check the commit log first." },
{
type: "tool",
toolCallId: "t1",
toolName: "git__log",
label: "Read today's commits",
state: "done",
output: "3 commits",
},
{ type: "text", text: "Three commits landed today." },
],
},
];

function SelectField() {
const [value, setValue] = useState("a");
const { log, record } = useEventLog();
Expand Down Expand Up @@ -1692,14 +1640,7 @@ function ConversationThreadScenario() {

export const scenarios: Record<string, () => ReactNode> = {
smoke: () => <Button>Ready</Button>,
"approval-card": () => <Approval state="idle" />,
"approval-card-busy": () => <Approval state="approving" />,
"command-palette": () => <Palette />,
"chat-thread": () => (
<div style={{ display: "flex", flexDirection: "column", height: 480 }}>
<ChatThread messages={CHAT} identity={{ name: "Scout" }} />
</div>
),
select: () => <SelectField />,
"filter-chip": () => <Chip />,
"dictation-denied": () => <DictationStatusLine state="denied" />,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/use-attachments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "react";
import { createRoot } from "react-dom/client";

import type { PartFile } from "../lib/chat-parts.js";
import type { PartFile } from "../lib/conversation.js";
import type { AttachmentData } from "../ui/attachments.js";
import {
useAttachments,
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/use-controllable-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ const isProduction =
/**
* The controlled-or-uncontrolled resolution every prop pair shaped like
* `open`/`onOpenChange` needs: track state internally, but defer to `value`
* whenever the caller supplies one. `useDismissablePopover`, `ToolBlock` and
* `ToolNarrative` each want exactly this and previously each wrote their own
* ternary for it; this is the one place it lives now.
* whenever the caller supplies one. Every such pair resolves through here
* rather than writing its own ternary.
*
* The returned setter accepts a value or a React-style updater
* (`setOpen((prev) => !prev)`), same as `useState`.
Expand Down
24 changes: 0 additions & 24 deletions src/hooks/use-delayed-autofocus.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export * from "./blocks/login/auth-layout.js";
export * from "./blocks/login/login-form.js";
export * from "./hooks/use-command-palette-navigation.js";
export * from "./hooks/use-controllable-state.js";
export * from "./hooks/use-delayed-autofocus.js";
export * from "./hooks/use-dismissable-popover.js";
export * from "./hooks/use-list-selection.js";
export * from "./hooks/use-prefers-reduced-motion.js";
Expand All @@ -32,8 +31,6 @@ export * from "./hooks/use-file-drop.js";
export * from "./hooks/use-media-viewer.js";
export * from "./lib/artifact.js";
export * from "./lib/chart-palette.js";
export * from "./lib/chat-message.js";
export * from "./lib/chat-parts.js";
export * from "./lib/metrics.js";
export * from "./lib/now-item.js";
export * from "./lib/relative-time.js";
Expand All @@ -47,9 +44,7 @@ export * from "./lib/conversation-activity.js";
export * from "./lib/media-kind.js";
export * from "./lib/attachment-limits.js";
export * from "./lib/prompt-tokens.js";
export * from "./ui/agent-turn.js";
export * from "./ui/animated-number.js";
export * from "./ui/approval-card.js";
export * from "./ui/artifact-body.js";
export * from "./ui/artifact-notice.js";
export * from "./ui/avatar.js";
Expand All @@ -62,10 +57,6 @@ export * from "./ui/button.js";
export * from "./ui/card.js";
export * from "./ui/category-bars.js";
export * from "./ui/chart-frame.js";
export * from "./ui/chat-composer.js";
export * from "./ui/chat-input.js";
export * from "./ui/chat-panel.js";
export * from "./ui/chat-thread.js";
export * from "./ui/checkbox.js";
export * from "./ui/compare-body.js";
export * from "./ui/confirm-button.js";
Expand All @@ -88,19 +79,15 @@ export * from "./ui/library-page-header.js";
export * from "./ui/list-detail.js";
export * from "./ui/live-run-banner.js";
export * from "./ui/live-status-line.js";
export * from "./ui/message-bubble.js";
export * from "./ui/mic-button.js";
export * from "./ui/notifications-bell.js";
export * from "./ui/now-cards.js";
export * from "./ui/page-panel.js";
export * from "./ui/page-shell.js";
export * from "./ui/parts-renderer.js";
export * from "./ui/profile-card.js";
export * from "./ui/progress-checklist.js";
export * from "./ui/provider-mark.js";
export * from "./ui/quick-reply-chips.js";
export * from "./ui/quote-card.js";
export * from "./ui/reasoning-block.js";
export * from "./ui/research-body.js";
export * from "./ui/rich-empty-state.js";
export * from "./ui/run-now-button.js";
Expand Down Expand Up @@ -129,8 +116,6 @@ export * from "./ui/thinking-label.js";
export * from "./ui/thinking-mark.js";
export * from "./ui/time-series-chart.js";
export * from "./ui/token-mosaic.js";
export * from "./ui/tool-block.js";
export * from "./ui/tool-narrative.js";
export * from "./ui/tool-picker.js";
export * from "./ui/top-bar.js";
export * from "./ui/trace-waterfall.js";
Expand Down
Loading
Loading