rift-ds 1.7.0 → 1.9.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/README.md +31 -8
- package/bin/rift-ds.mjs +142 -29
- package/bin/templates/chat/.env.chat.example +21 -0
- package/bin/templates/chat/app/api/chat/feedback/route.ts +12 -0
- package/bin/templates/chat/app/api/chat/followups/route.ts +23 -0
- package/bin/templates/chat/app/api/chat/guardrails.ts +18 -0
- package/bin/templates/chat/app/api/chat/route.ts +31 -0
- package/bin/templates/chat/components/chat/ChatMount.tsx +52 -0
- package/bin/templates/chat/components/chat/models.ts +29 -0
- package/chat/AssistantTurn.d.ts +5 -0
- package/chat/AssistantTurn.js +82 -0
- package/chat/ChatAgentPane.css +56 -0
- package/chat/ChatAgentPane.d.ts +24 -0
- package/chat/ChatAgentPane.js +28 -0
- package/chat/ChatArtifactCard.d.ts +13 -0
- package/chat/ChatArtifactCard.js +21 -0
- package/chat/ChatArtifactPane.d.ts +18 -0
- package/chat/ChatArtifactPane.js +43 -0
- package/chat/ChatLauncher.d.ts +64 -0
- package/chat/ChatLauncher.js +347 -0
- package/chat/ChatProvider.d.ts +55 -0
- package/chat/ChatProvider.js +196 -0
- package/chat/ChatTabs.d.ts +13 -0
- package/chat/ChatTabs.js +24 -0
- package/chat/ChatThreads.d.ts +26 -0
- package/chat/ChatThreads.js +55 -0
- package/chat/ChatWidget.css +1259 -0
- package/chat/ChatWidget.d.ts +115 -0
- package/chat/ChatWidget.js +709 -0
- package/chat/DemoWelcome.d.ts +13 -0
- package/chat/DemoWelcome.js +131 -0
- package/chat/FollowupSuggestions.d.ts +23 -0
- package/chat/FollowupSuggestions.js +34 -0
- package/chat/ResponseActions.d.ts +18 -0
- package/chat/ResponseActions.js +79 -0
- package/chat/TurnContent.d.ts +11 -0
- package/chat/TurnContent.js +19 -0
- package/chat/artifacts.d.ts +5 -0
- package/chat/artifacts.js +14 -0
- package/chat/context.d.ts +82 -0
- package/chat/context.js +29 -0
- package/chat/demo-agent-panes.d.ts +5 -0
- package/chat/demo-agent-panes.js +49 -0
- package/chat/demo-agent.d.ts +3 -0
- package/chat/demo-agent.js +28 -0
- package/chat/demo-artifacts.d.ts +6 -0
- package/chat/demo-artifacts.js +80 -0
- package/chat/demo-card-components.d.ts +48 -0
- package/chat/demo-card-components.js +66 -0
- package/chat/demo-cards.d.ts +32 -0
- package/chat/demo-cards.js +59 -0
- package/chat/demo-fixtures.d.ts +20 -0
- package/chat/demo-fixtures.js +113 -0
- package/chat/demo-script.d.ts +6 -0
- package/chat/demo-script.js +237 -0
- package/chat/demo.css +52 -0
- package/chat/demo.d.ts +10 -0
- package/chat/demo.js +28 -0
- package/chat/followups.d.ts +41 -0
- package/chat/followups.js +55 -0
- package/chat/greeting.d.ts +11 -0
- package/chat/greeting.js +21 -0
- package/chat/index.d.ts +37 -0
- package/chat/index.js +90 -0
- package/chat/placement.d.ts +48 -0
- package/chat/placement.js +39 -0
- package/chat/queries.d.ts +18 -0
- package/chat/queries.js +26 -0
- package/chat/registry.d.ts +25 -0
- package/chat/registry.js +9 -0
- package/chat/registry.json.d.ts +74 -0
- package/chat/registry.json.js +11 -0
- package/chat/server.d.ts +217 -0
- package/chat/server.js +488 -0
- package/chat/sim.d.ts +71 -0
- package/chat/sim.js +125 -0
- package/chat/starters.d.ts +15 -0
- package/chat/starters.js +38 -0
- package/chat/suggestions.d.ts +22 -0
- package/chat/suggestions.js +9 -0
- package/chat/threads.d.ts +73 -0
- package/chat/threads.js +270 -0
- package/chat/transport.d.ts +49 -0
- package/chat/transport.js +105 -0
- package/chat/types.d.ts +246 -0
- package/chat/types.js +18 -0
- package/chat/upstash.d.ts +63 -0
- package/chat/upstash.js +147 -0
- package/chat/useChat.d.ts +64 -0
- package/chat/useChat.js +241 -0
- package/cli/templates/chat/app/api/chat/feedback/route.d.ts +3 -0
- package/cli/templates/chat/app/api/chat/followups/route.d.ts +3 -0
- package/cli/templates/chat/app/api/chat/guardrails.d.ts +10 -0
- package/cli/templates/chat/app/api/chat/route.d.ts +4 -0
- package/cli/templates/chat/components/chat/ChatMount.d.ts +1 -0
- package/cli/templates/chat/components/chat/models.d.ts +11 -0
- package/components/AgentRail/AgentRail.css +14 -5
- package/components/AgentRail/AgentRail.d.ts +2 -0
- package/components/AgentRail/AgentRail.js +3 -2
- package/components/ArtifactCard/ArtifactCard.css +106 -0
- package/components/ArtifactCard/ArtifactCard.d.ts +27 -0
- package/components/ArtifactCard/ArtifactCard.js +29 -0
- package/components/ArtifactPanel/ArtifactPanel.css +159 -0
- package/components/ArtifactPanel/ArtifactPanel.d.ts +70 -0
- package/components/ArtifactPanel/ArtifactPanel.js +131 -0
- package/components/ShaderField/ShaderField.d.ts +3 -2
- package/components/ShaderField/useShaderField.d.ts +2 -1
- package/components/ShaderField/useShaderField.js +6 -6
- package/components/ThreadPanel/ThreadPanel.css +87 -33
- package/components/ThreadPanel/ThreadPanel.js +21 -10
- package/components/registry.json +16 -0
- package/components/registry.json.d.ts +16 -0
- package/components/registry.json.js +1 -1
- package/fonts/material-symbols.css +2 -1
- package/index.d.ts +2 -0
- package/index.js +4 -0
- package/package.json +39 -2
- package/tokens/presets/coral.css +18 -2
- package/tokens/presets/forest.css +18 -2
- package/tokens/presets/gold.css +18 -2
- package/tokens/presets/mono.css +18 -2
- package/tokens/presets/pink.css +18 -2
- package/tokens/presets/terminal.css +18 -2
- package/tokens/presets/violet.css +18 -2
- package/tokens/presets/warm.css +18 -2
- package/tokens/presets/zest.css +18 -2
- package/tokens/registry.json +6 -0
- package/tokens/registry.json.d.ts +6 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +10 -0
- package/tokens/tokens-light.css +10 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AgentRailProfile, AgentRailTab } from '../components/AgentRail/AgentRail';
|
|
3
|
+
import { MentionSource } from '../components/Mention/Mention';
|
|
4
|
+
import { ChatThreadsProps } from './ChatThreads';
|
|
5
|
+
import { ChatModelOption, Starter } from './types';
|
|
6
|
+
/** A rail slot: the widget's own panel, or a render prop for a custom one. */
|
|
7
|
+
export type RailSlot = boolean | ((ctx: {
|
|
8
|
+
overlay: boolean;
|
|
9
|
+
close: () => void;
|
|
10
|
+
}) => ReactNode);
|
|
11
|
+
/** What the built-in agent pane shows. */
|
|
12
|
+
export interface ChatAgentOptions {
|
|
13
|
+
/** The agent's portrait block. Defaults to the widget's title with a "Connected" status. A profile with neither `avatar` nor `avatarSrc` wears a PixelAvatar seeded by the widget's title, the mark the header toggle wears. */
|
|
14
|
+
profile?: AgentRailProfile;
|
|
15
|
+
/** The panes, in display order. */
|
|
16
|
+
tabs: AgentRailTab[];
|
|
17
|
+
/** Open the pane at mount, where the panel is wide enough to seat it inline. Off by default: the header button opens it. */
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Props owned by ChatWidget itself. */
|
|
21
|
+
export interface ChatWidgetProps {
|
|
22
|
+
/** Show the expand toggle. A host whose stage is always a takeover hides it. */
|
|
23
|
+
fullscreenEnabled?: boolean;
|
|
24
|
+
/** Show the header's close button. A host that seats the chat as the page
|
|
25
|
+
itself rather than as a panel over one has nothing to close back to,
|
|
26
|
+
so it turns this off. */
|
|
27
|
+
closeEnabled?: boolean;
|
|
28
|
+
/** Show the header's Chat position menu (dock right, dock left, floating). Off by default: a host turns it on only when it implements the seats the menu offers, as ChatLauncher does. */
|
|
29
|
+
placementEnabled?: boolean;
|
|
30
|
+
/** Narrow insets for phone-width hosts. */
|
|
31
|
+
compact?: boolean;
|
|
32
|
+
/** The host is a phone viewport, where the soft keyboard will claim the
|
|
33
|
+
lower half of the screen the moment the composer is focused. The
|
|
34
|
+
welcome screen stacks instead of centring the composer: greeting in
|
|
35
|
+
the middle of the empty thread, starters directly above the composer,
|
|
36
|
+
composer pinned to the bottom from the first paint. */
|
|
37
|
+
phone?: boolean;
|
|
38
|
+
/** The header brand name. */
|
|
39
|
+
title?: string;
|
|
40
|
+
/** The composer's placeholder text. */
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
/** Show the conversation starters on the welcome screen. */
|
|
43
|
+
showStarters?: boolean;
|
|
44
|
+
/** The header mark's image src; null (the default) shows the name alone. */
|
|
45
|
+
logo?: string | null;
|
|
46
|
+
/** The welcome screen's line under the greeting. */
|
|
47
|
+
tagline?: string;
|
|
48
|
+
/** The conversation starters: a few pre-written questions. Each must fit the chip budget (SUGGESTION_MAX_CHARS); one that does not is dropped rather than clipped. */
|
|
49
|
+
starters?: Starter[];
|
|
50
|
+
/** Keys the starters' staged reveal: a new key replays the generation beat, the same key shows the set standing. A host whose starters follow the page passes the pathname. */
|
|
51
|
+
startersKey?: string;
|
|
52
|
+
/** Replaces the composer's leading actions (the model picker). */
|
|
53
|
+
composerActions?: ReactNode;
|
|
54
|
+
/** The models the picker offers. The pick rides on each send as a wire value; the server resolves it. Omit for no picker. */
|
|
55
|
+
models?: ChatModelOption[];
|
|
56
|
+
/** The picker's selection before the server has reported its default. Defaults to the first model. */
|
|
57
|
+
defaultModel?: string;
|
|
58
|
+
/** The one line a locked model shows in place of its description. */
|
|
59
|
+
lockedModelDescription?: string;
|
|
60
|
+
/** Let the visitor attach files: an attach button, paste, drop anywhere
|
|
61
|
+
on the chat, and long pastes folded into a tile. Files are read in the
|
|
62
|
+
browser for previews; what reaches the transport is names and kinds. */
|
|
63
|
+
fileAttachments?: boolean;
|
|
64
|
+
/** Most files the visitor may queue on one message. */
|
|
65
|
+
maxAttachments?: number;
|
|
66
|
+
/** Largest file the visitor may queue, in bytes. */
|
|
67
|
+
maxAttachmentBytes?: number;
|
|
68
|
+
/** What the visitor can reference while typing: one source per trigger
|
|
69
|
+
character, drawn as tags in the composer and in the sent bubble. */
|
|
70
|
+
mentions?: MentionSource[];
|
|
71
|
+
/** A session-history rail. `true` seats the built-in ChatThreads over the
|
|
72
|
+
provider's thread lifecycle; a render prop seats your own. Wide hosts
|
|
73
|
+
seat it as an inline left rail, narrow ones summon it from a header
|
|
74
|
+
hamburger as a slide-over sheet behind a scrim. */
|
|
75
|
+
threads?: RailSlot;
|
|
76
|
+
/** Props for the built-in threads rail when `threads` is `true`. */
|
|
77
|
+
threadsProps?: Omit<ChatThreadsProps, 'overlay' | 'close'>;
|
|
78
|
+
/** An open-sessions tab strip as its own row under the header. `true` seats the built-in ChatTabs; a node seats your own. */
|
|
79
|
+
tabs?: boolean | ReactNode;
|
|
80
|
+
/** A companion rail on the trailing edge, the mirror of `threads`: a render prop for your own pane, seated inline on a wide host and raised as a bottom sheet from a header button on a narrow one. For the built-in pane pass `agent` instead. */
|
|
81
|
+
aside?: (ctx: {
|
|
82
|
+
overlay: boolean;
|
|
83
|
+
close: () => void;
|
|
84
|
+
}) => ReactNode;
|
|
85
|
+
/** The built-in agent pane: who the agent is and what it has been doing. Seated like `aside`. */
|
|
86
|
+
agent?: ChatAgentOptions;
|
|
87
|
+
/** Seat the artifact panel: a reply that carries an artifact draws a tile in the thread, and the tile (or the header's artifact button) opens the artifact beside the conversation on a wide host and as a bottom sheet on a narrow one. The trailing seat holds one panel at a time, so an open artifact stands in for the agent pane. Off, none of it exists: no header button, no tile, no panel. */
|
|
88
|
+
artifacts?: boolean;
|
|
89
|
+
/** The composer's context note, naming what the chat is looking at. Omit for none. */
|
|
90
|
+
contextLabel?: string | null;
|
|
91
|
+
/** A widget slot on the welcome screen, under the composer and its
|
|
92
|
+
starters. It takes any content and keeps its natural height, so the
|
|
93
|
+
composer rides up by half of it instead of holding dead centre: the
|
|
94
|
+
empty chat reads as a home page rather than a blank prompt. It leaves
|
|
95
|
+
with the first message, like the rest of the welcome dressing. */
|
|
96
|
+
widgets?: ReactNode;
|
|
97
|
+
/** How the widget slot takes its room. `fit` keeps the welcome screen to
|
|
98
|
+
one viewport: the widgets hold their height and the composer rides up
|
|
99
|
+
to make room. `scroll` turns the welcome screen into a page: the
|
|
100
|
+
greeting and composer take the opening of the viewport, the widgets
|
|
101
|
+
run on below the fold, and the whole welcome scrolls as one. */
|
|
102
|
+
widgetsLayout?: 'fit' | 'scroll';
|
|
103
|
+
/** How wide the widget slot runs. `column` holds it to the composer's
|
|
104
|
+
bounding box; `wide` lets it run past them, for a dashboard. */
|
|
105
|
+
widgetsWidth?: 'column' | 'wide';
|
|
106
|
+
/** The quiet line pinned to the widget's floor: what the chat is and where its policy lives. */
|
|
107
|
+
disclaimer?: ReactNode;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The composed chat: header, thread, composer, starters, disclaimer, and the
|
|
111
|
+
* optional rails, filling whatever container hosts it (ChatLauncher's panel,
|
|
112
|
+
* a stage card, a whole page). It reads all of its state from ChatProvider,
|
|
113
|
+
* so the conversation is the same object wherever it shows.
|
|
114
|
+
*/
|
|
115
|
+
export declare function ChatWidget({ fullscreenEnabled, closeEnabled, placementEnabled, compact, phone, title, placeholder, showStarters, logo, tagline, starters: startersInput, startersKey, composerActions, models, defaultModel, lockedModelDescription, fileAttachments, maxAttachments, maxAttachmentBytes, mentions, threads, threadsProps, tabs, aside, agent, artifacts, contextLabel, widgets, widgetsLayout, widgetsWidth, disclaimer, }: ChatWidgetProps): import("react").JSX.Element;
|