@candor-ui/react 1.5.0 → 1.8.0
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/adapters/ag-ui.d.ts +24 -24
- package/dist/adapters/ai-sdk.d.ts +6 -6
- package/dist/adapters/claude-agent-sdk.d.ts +51 -34
- package/dist/adapters/claude-agent-sdk.js +46 -2
- package/dist/adapters/claude-agent-server.d.ts +34 -34
- package/dist/adapters/use-ag-ui.d.ts +6 -6
- package/dist/adapters/use-ag-ui.js +14 -2
- package/dist/adapters/use-candor-chat.d.ts +1 -1
- package/dist/adapters/use-candor-chat.js +1 -1
- package/dist/adapters/use-claude-agent.d.ts +10 -10
- package/dist/adapters/use-claude-agent.js +1 -1
- package/dist/blocks/copy-field.d.ts +1 -1
- package/dist/blocks/copy-field.js +1 -1
- package/dist/blocks/degraded-panel.d.ts +5 -5
- package/dist/blocks/locale.d.ts +6 -6
- package/dist/blocks/locked.d.ts +8 -8
- package/dist/blocks/relative-time.d.ts +6 -6
- package/dist/blocks/status-dot.d.ts +3 -3
- package/dist/blocks/step-list.d.ts +3 -3
- package/dist/blocks/streaming-text.d.ts +3 -3
- package/dist/chat/agent-avatar.d.ts +4 -4
- package/dist/chat/ai-disclosure.d.ts +5 -5
- package/dist/chat/ai-disclosure.js +1 -1
- package/dist/chat/attachment-preview.d.ts +6 -6
- package/dist/chat/attachment-preview.js +1 -1
- package/dist/chat/card-registry.js +1 -1
- package/dist/chat/citation.d.ts +3 -3
- package/dist/chat/citation.js +3 -3
- package/dist/chat/composer.d.ts +37 -20
- package/dist/chat/composer.js +13 -6
- package/dist/chat/context-meter.d.ts +1 -1
- package/dist/chat/context-meter.js +1 -1
- package/dist/chat/entity-chip.d.ts +3 -3
- package/dist/chat/entity-chip.js +1 -1
- package/dist/chat/folded-turns.d.ts +11 -6
- package/dist/chat/folded-turns.js +2 -2
- package/dist/chat/message-actions.d.ts +6 -6
- package/dist/chat/message-actions.js +1 -1
- package/dist/chat/message-content.d.ts +13 -7
- package/dist/chat/message-content.js +10 -5
- package/dist/chat/message.d.ts +64 -37
- package/dist/chat/message.js +17 -11
- package/dist/chat/payload.d.ts +4 -4
- package/dist/chat/payload.js +2 -2
- package/dist/chat/permission-prompt.d.ts +23 -23
- package/dist/chat/prompt-suggestions.d.ts +4 -4
- package/dist/chat/prompt-suggestions.js +1 -1
- package/dist/chat/reasoning.d.ts +3 -3
- package/dist/chat/reasoning.js +1 -1
- package/dist/chat/thread-divider.d.ts +3 -3
- package/dist/chat/thread-event.d.ts +10 -5
- package/dist/chat/thread-event.js +3 -2
- package/dist/chat/thread.d.ts +23 -7
- package/dist/chat/thread.js +28 -5
- package/dist/chat/tool-call.d.ts +2 -2
- package/dist/chat/tool-call.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/chat.d.ts +42 -42
- package/dist/lib/know.d.ts +14 -12
- package/dist/lib/mcp-input.d.ts +316 -0
- package/dist/lib/mcp-input.js +369 -0
- package/dist/lib/render-prop.d.ts +4 -4
- package/dist/lib/safe-markdown.d.ts +1 -1
- package/dist/lib/status.d.ts +21 -0
- package/dist/lib/status.js +17 -0
- package/dist/lib/use-shortcut.d.ts +1 -1
- package/dist/lib/use-virtual-list.d.ts +6 -6
- package/dist/styles.css +4 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.js +1 -1
- package/package.json +1 -1
|
@@ -6,11 +6,11 @@ import * as React from "react";
|
|
|
6
6
|
*/
|
|
7
7
|
export type RenderProp = {
|
|
8
8
|
/** Base UI's way to render as another element; the same as `asChild` with that element as the child. */
|
|
9
|
-
render?: React.ReactElement;
|
|
9
|
+
render?: React.ReactElement | undefined;
|
|
10
10
|
/** Base UI's flag for a button rendered as another element; shadcn adds it with `render`. Radix doesn't need it. */
|
|
11
|
-
nativeButton?: boolean;
|
|
11
|
+
nativeButton?: boolean | undefined;
|
|
12
12
|
};
|
|
13
13
|
export declare function withRender<P extends {
|
|
14
|
-
asChild?: boolean;
|
|
15
|
-
children?: React.ReactNode;
|
|
14
|
+
asChild?: boolean | undefined;
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
16
|
}>({ render, nativeButton: _nativeButton, ...props }: P & RenderProp): P;
|
|
@@ -4,7 +4,7 @@ import type { InlineNode, MessageBlock } from "./chat.js";
|
|
|
4
4
|
* unless `headings` is set, when `#`, `##` and `###` (and deeper, as level 3) become heading blocks.
|
|
5
5
|
*/
|
|
6
6
|
export declare function markdownBlocks(text: string, { headings }?: {
|
|
7
|
-
headings?: boolean;
|
|
7
|
+
headings?: boolean | undefined;
|
|
8
8
|
}): MessageBlock[];
|
|
9
9
|
/** `code`, **strong**, *em* and links (as text). Everything else stays literal. */
|
|
10
10
|
export declare function inline(text: string): InlineNode[];
|
package/dist/lib/status.d.ts
CHANGED
|
@@ -34,3 +34,24 @@ export declare const statusTone: {
|
|
|
34
34
|
readonly skipped: "outline";
|
|
35
35
|
};
|
|
36
36
|
export declare function isTerminal(status: RunStatus): status is "succeeded" | "failed" | "cancelled" | "skipped";
|
|
37
|
+
/** The machine or worker a run is on, when the app can't reach it. */
|
|
38
|
+
export type HostOffline = {
|
|
39
|
+
/** The host's name as the app knows it: "Build runner 3", "Priya’s laptop". Left out, it's "The host". */
|
|
40
|
+
host?: string | undefined;
|
|
41
|
+
/** When the app lost contact. */
|
|
42
|
+
since?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Whether a run can be called alive. "live": heard from recently, or the app doesn't track it. "stale": running, but
|
|
46
|
+
* nothing heard for longer than `staleAfter`, so it may have stopped. "offline": its host can't be reached.
|
|
47
|
+
* "unchecked": there's no clock yet (rendering on the server), so freshness isn't claimed either way. "settled": it
|
|
48
|
+
* has finished, so silence is expected. Only a running run goes stale: a queued or waiting one is quiet by design.
|
|
49
|
+
*/
|
|
50
|
+
export type RunLiveness = "live" | "stale" | "offline" | "unchecked" | "settled";
|
|
51
|
+
/** Two minutes: the default silence after which a running run is no longer called running. */
|
|
52
|
+
export declare const STALE_AFTER = 120000;
|
|
53
|
+
export declare function runLiveness(run: {
|
|
54
|
+
status: RunStatus;
|
|
55
|
+
lastHeardAt?: Date | string | undefined;
|
|
56
|
+
hostOffline?: HostOffline | undefined;
|
|
57
|
+
}, now: number | null, staleAfter?: number): RunLiveness;
|
package/dist/lib/status.js
CHANGED
|
@@ -33,3 +33,20 @@ export const statusTone = {
|
|
|
33
33
|
export function isTerminal(status) {
|
|
34
34
|
return status === "succeeded" || status === "failed" || status === "cancelled" || status === "skipped";
|
|
35
35
|
}
|
|
36
|
+
/** Two minutes: the default silence after which a running run is no longer called running. */
|
|
37
|
+
export const STALE_AFTER = 120_000;
|
|
38
|
+
export function runLiveness(run, now, staleAfter = STALE_AFTER) {
|
|
39
|
+
if (isTerminal(run.status))
|
|
40
|
+
return "settled";
|
|
41
|
+
if (run.hostOffline)
|
|
42
|
+
return "offline";
|
|
43
|
+
if (run.status !== "running" || run.lastHeardAt === undefined)
|
|
44
|
+
return "live";
|
|
45
|
+
const heard = new Date(run.lastHeardAt).getTime();
|
|
46
|
+
// An unreadable time ("", "10:42") is no evidence the run is alive.
|
|
47
|
+
if (Number.isNaN(heard))
|
|
48
|
+
return "stale";
|
|
49
|
+
if (now === null)
|
|
50
|
+
return "unchecked";
|
|
51
|
+
return now - heard > staleAfter ? "stale" : "live";
|
|
52
|
+
}
|
|
@@ -11,5 +11,5 @@ export declare function comboKeys(combo: string): string[];
|
|
|
11
11
|
* the person is typing in a field, so "?" still types a question mark.
|
|
12
12
|
*/
|
|
13
13
|
export declare function useShortcut(combo: string, handler: (e: KeyboardEvent) => void, { enabled }?: {
|
|
14
|
-
enabled?: boolean;
|
|
14
|
+
enabled?: boolean | undefined;
|
|
15
15
|
}): void;
|
|
@@ -27,13 +27,13 @@ export declare function useVirtualList({ enabled, count, keyOf, scroller, estima
|
|
|
27
27
|
count: number;
|
|
28
28
|
keyOf: (index: number) => React.Key;
|
|
29
29
|
scroller: React.RefObject<HTMLElement | null>;
|
|
30
|
-
estimate?: number;
|
|
31
|
-
overscan?: number;
|
|
32
|
-
initial?: number;
|
|
30
|
+
estimate?: number | undefined;
|
|
31
|
+
overscan?: number | undefined;
|
|
32
|
+
initial?: number | undefined;
|
|
33
33
|
/** Which end to show before the scroller is measured: "end" for a thread (newest last), "start" for a list. Defaults to "end". */
|
|
34
|
-
anchor?: "start" | "end";
|
|
34
|
+
anchor?: "start" | "end" | undefined;
|
|
35
35
|
/** The gap between items, in pixels, read once the scroller is measured (e.g. from the list's computed `row-gap`). */
|
|
36
|
-
gap?: () => number;
|
|
36
|
+
gap?: (() => number) | undefined;
|
|
37
37
|
/** The key of an item to keep rendered, such as the one holding focus. */
|
|
38
|
-
pin?: string | null;
|
|
38
|
+
pin?: string | null | undefined;
|
|
39
39
|
}): VirtualList;
|
package/dist/styles.css
CHANGED
|
@@ -238,6 +238,9 @@
|
|
|
238
238
|
* (--primary, --background…), everything else by its --cd-* name. A brand theme
|
|
239
239
|
* is just such a file.
|
|
240
240
|
*
|
|
241
|
+
* Font: Inter when the font-inter item is installed (styles/candor-font-inter.css),
|
|
242
|
+
* else the system's sans-serif. Point --cd-font at your own font to use it instead.
|
|
243
|
+
*
|
|
241
244
|
* Density: data-density="compact" on <html> (or any container) tightens type for
|
|
242
245
|
* dense apps: 14px conversation text and 13px body and label text, with a narrower
|
|
243
246
|
* thread and sidebar.
|
|
@@ -476,7 +479,7 @@
|
|
|
476
479
|
|
|
477
480
|
@layer base {
|
|
478
481
|
* {
|
|
479
|
-
@apply border-border outline-ring/
|
|
482
|
+
@apply border-border outline-ring/80;
|
|
480
483
|
}
|
|
481
484
|
body {
|
|
482
485
|
@apply bg-background text-foreground font-sans text-sm;
|
package/dist/ui/button.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ declare const buttonVariants: (props?: ({
|
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Button(allProps: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
9
9
|
/** Render the child element (a link, say) with the button's styles instead of a <button>. */
|
|
10
|
-
asChild?: boolean;
|
|
10
|
+
asChild?: boolean | undefined;
|
|
11
11
|
} & RenderProp): React.JSX.Element;
|
|
12
12
|
export { Button, buttonVariants };
|
package/dist/ui/button.js
CHANGED
|
@@ -7,7 +7,7 @@ import { withRender } from "../lib/render-prop.js";
|
|
|
7
7
|
import { cn } from "../lib/utils.js";
|
|
8
8
|
// The accent fills the one primary act, the radius is the theme's
|
|
9
9
|
// --cd-radius-button, and buttons press down slightly on :active.
|
|
10
|
-
const buttonVariants = cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-button text-sm font-medium whitespace-nowrap outline-none select-none transition-[background-color,color,border-color,box-shadow,transform,opacity] duration-150 ease-standard active:scale-[0.98] focus-visible:ring-[3px] focus-visible:ring-ring/
|
|
10
|
+
const buttonVariants = cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-button text-sm font-medium whitespace-nowrap outline-none select-none transition-[background-color,color,border-color,box-shadow,transform,opacity] duration-150 ease-standard active:scale-[0.98] focus-visible:ring-[3px] focus-visible:ring-ring/80 disabled:pointer-events-none disabled:opacity-45 data-[locked]:cursor-not-allowed data-[locked]:opacity-45 data-[locked]:active:scale-100 aria-invalid:ring-destructive/25 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
13
|
default: "bg-primary text-primary-foreground hover:bg-primary-hover",
|
package/package.json
CHANGED