research-agent-ui 0.1.219 → 0.1.221
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 +282 -256
- package/dist/app/QwkSearchProviders.d.ts +7 -1
- package/dist/components/SearchConfig/focusModes.d.ts +9 -0
- package/dist/components/SpotlightPalette/SpotlightPalette.d.ts +5 -0
- package/dist/components/SpotlightPalette/index.d.ts +11 -0
- package/dist/components/SpotlightPalette/spotlightItems.d.ts +67 -0
- package/dist/components/SpotlightPalette/spotlightLinks.d.ts +19 -0
- package/dist/components/SpotlightPalette/spotlightMatch.d.ts +63 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -2
- package/dist/{src-Dw-I2aQq.js → src-CbrPcNiL.js} +2358 -1729
- package/dist/src-DovU4N4Y.cjs +51 -0
- package/dist/workspace.cjs +1 -1
- package/dist/workspace.mjs +58 -58
- package/package.json +11 -11
- package/dist/src-DLcDVXya.cjs +0 -51
package/README.md
CHANGED
|
@@ -20,259 +20,285 @@
|
|
|
20
20
|
</p>
|
|
21
21
|
<!-- template-git-repo:badges:end -->
|
|
22
22
|
|
|
23
|
-
# research-agent-ui
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
The QwkSearch app UI: conversation window, article reader, search config,
|
|
27
|
-
file uploads, chat history — plus the app shell (providers, app dock, cookie
|
|
28
|
-
banner, the research/docs view switch) that assembles them into a whole app.
|
|
29
|
-
Includes the shadcn primitives and icons the components depend on, so it can be
|
|
30
|
-
dropped into a Next.js app with a single dependency.
|
|
31
|
-
|
|
32
|
-

|
|
33
|
-
|
|
34
|
-
## Two entry points: with and without the editor
|
|
35
|
-
|
|
36
|
-
The package ships the same app twice, and the only difference is whether the
|
|
37
|
-
REASON document editor and its file sidebar come along:
|
|
38
|
-
|
|
39
|
-
| Import from | You get | Extra dependencies |
|
|
40
|
-
| --- | --- | --- |
|
|
41
|
-
| `research-agent-ui` | Chat, search, article reader, app shell | none |
|
|
42
|
-
| `research-agent-ui/workspace` | All of the above **plus** the REASON editor, document tree, and file sidebar | `react-reason-editor`, `react-reason-editor-sidebar` |
|
|
43
|
-
|
|
44
|
-
`research-agent-ui/workspace` re-exports everything the root entry does, so a
|
|
45
|
-
host that wants documents imports from that one path rather than mixing the
|
|
46
|
-
two. Going the other way, the root entry's import graph never reaches
|
|
47
|
-
`react-reason-editor` — the editor's (large) dependency tree stays out of a
|
|
48
|
-
chat-only consumer's bundle entirely. `test/entryBoundaries.test.ts` enforces
|
|
49
|
-
that in both directions.
|
|
50
|
-
|
|
51
|
-
The two editor packages are declared as **optional** peer dependencies:
|
|
52
|
-
installing `research-agent-ui` on its own is enough for the chat-only build,
|
|
53
|
-
and package managers will not warn about the missing peers.
|
|
54
|
-
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
23
|
+
# research-agent-ui
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
The QwkSearch app UI: conversation window, article reader, search config,
|
|
27
|
+
file uploads, chat history — plus the app shell (providers, app dock, cookie
|
|
28
|
+
banner, the research/docs view switch) that assembles them into a whole app.
|
|
29
|
+
Includes the shadcn primitives and icons the components depend on, so it can be
|
|
30
|
+
dropped into a Next.js app with a single dependency.
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
## Two entry points: with and without the editor
|
|
35
|
+
|
|
36
|
+
The package ships the same app twice, and the only difference is whether the
|
|
37
|
+
REASON document editor and its file sidebar come along:
|
|
38
|
+
|
|
39
|
+
| Import from | You get | Extra dependencies |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `research-agent-ui` | Chat, search, article reader, app shell | none |
|
|
42
|
+
| `research-agent-ui/workspace` | All of the above **plus** the REASON editor, document tree, and file sidebar | `react-reason-editor`, `react-reason-editor-sidebar` |
|
|
43
|
+
|
|
44
|
+
`research-agent-ui/workspace` re-exports everything the root entry does, so a
|
|
45
|
+
host that wants documents imports from that one path rather than mixing the
|
|
46
|
+
two. Going the other way, the root entry's import graph never reaches
|
|
47
|
+
`react-reason-editor` — the editor's (large) dependency tree stays out of a
|
|
48
|
+
chat-only consumer's bundle entirely. `test/entryBoundaries.test.ts` enforces
|
|
49
|
+
that in both directions.
|
|
50
|
+
|
|
51
|
+
The two editor packages are declared as **optional** peer dependencies:
|
|
52
|
+
installing `research-agent-ui` on its own is enough for the chat-only build,
|
|
53
|
+
and package managers will not warn about the missing peers.
|
|
54
|
+
|
|
55
|
+
## Spotlight search
|
|
56
|
+
|
|
57
|
+
`QwkSearchProviders` mounts a macOS-Spotlight-style command palette over the
|
|
58
|
+
whole app. <kbd>Ctrl</kbd> <kbd>Space</kbd> opens it (Cmd-Space belongs to
|
|
59
|
+
macOS), or call `openSpotlight()` from your own chrome. Typing searches past
|
|
60
|
+
chats, app pages, settings sections and actions at once, with "ask the research
|
|
61
|
+
agent this" pinned to the top; a leading letter scopes the search to one source
|
|
62
|
+
— `c ` chats, `t ` pages, `s ` settings, `a ` actions, `w ` ask — and
|
|
63
|
+
<kbd>Tab</kbd> cycles between them.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { QwkSearchProviders, openSpotlight } from 'research-agent-ui';
|
|
67
|
+
|
|
68
|
+
<QwkSearchProviders authClient={authClient} showSpotlight> {/* the default */}
|
|
69
|
+
<YourApp />
|
|
70
|
+
</QwkSearchProviders>;
|
|
71
|
+
|
|
72
|
+
// …and from a button somewhere in your own chrome:
|
|
73
|
+
<button onClick={() => openSpotlight()}>Search everything</button>;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Rows that open a chat or a settings section go through `onOpenChat` /
|
|
77
|
+
`onOpenSettings` first, so a host rendering chats inline handles them without
|
|
78
|
+
navigating; returning anything but `true` falls back to `/c/<id>` and
|
|
79
|
+
`/settings/<section>`.
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
### The whole app in one component
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// Chat only — no editor, no sidebar.
|
|
87
|
+
import { QwkSearchApp } from 'research-agent-ui';
|
|
88
|
+
|
|
89
|
+
export default function Page() {
|
|
90
|
+
return (
|
|
91
|
+
<QwkSearchApp
|
|
92
|
+
authClient={myAuthClient}
|
|
93
|
+
config={{ appName: 'MyApp', footerLinks: myLinks }}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
// The same app, with documents.
|
|
101
|
+
import { QwkSearchWorkspaceApp } from 'research-agent-ui/workspace';
|
|
102
|
+
|
|
103
|
+
export default function Page() {
|
|
104
|
+
return (
|
|
105
|
+
<QwkSearchWorkspaceApp
|
|
106
|
+
authClient={myAuthClient}
|
|
107
|
+
config={{ appName: 'MyApp', footerLinks: myLinks }}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`QwkSearchProviders` is the same shell without a page inside it, for hosts that
|
|
114
|
+
render their own routes within the app chrome. It accepts a `ChromeProvider` to
|
|
115
|
+
mount app-owned context (a settings modal, say) inside the stack, and
|
|
116
|
+
`showDock` / `showCookieConsent` / `showToaster` to opt out of individual
|
|
117
|
+
pieces.
|
|
118
|
+
|
|
119
|
+
### Composing the pieces yourself
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import {
|
|
123
|
+
ChatProvider,
|
|
124
|
+
SessionProvider,
|
|
125
|
+
ExtractPanelProvider,
|
|
126
|
+
ChatWindow,
|
|
127
|
+
configureResearchAgentUI,
|
|
128
|
+
} from 'research-agent-ui';
|
|
129
|
+
|
|
130
|
+
configureResearchAgentUI({
|
|
131
|
+
appName: 'MyApp',
|
|
132
|
+
getAutoMediaSearch: () => true,
|
|
133
|
+
// ...see ResearchAgentUIConfig for the full list of overridable values
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
function App() {
|
|
137
|
+
return (
|
|
138
|
+
<SessionProvider authClient={myAuthClient}>
|
|
139
|
+
<ExtractPanelProvider>
|
|
140
|
+
<ChatProvider>
|
|
141
|
+
<ChatWindow />
|
|
142
|
+
</ChatProvider>
|
|
143
|
+
</ExtractPanelProvider>
|
|
144
|
+
</SessionProvider>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Storybook
|
|
150
|
+
|
|
151
|
+
Individual UI pieces can be browsed in isolation with [Storybook](https://storybook.js.org/).
|
|
152
|
+
Stories render against **mock data only** (see `src/stories/mocks.ts`) — no API,
|
|
153
|
+
auth session, or chat backend is required, so you can develop and review the
|
|
154
|
+
chat components (message header with timestamp/copy/edit actions, search
|
|
155
|
+
progress, follow-up suggestions, file & pasted-content cards) on their own.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# from packages/research-agent-ui
|
|
159
|
+
bun run storybook # dev server on http://localhost:6006
|
|
160
|
+
bun run build-storybook # static build → storybook-static/
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
A light/dark toggle in the toolbar switches between the two token palettes
|
|
164
|
+
(mirrored from the host app's `globals.css` in `.storybook/preview.css`). Add
|
|
165
|
+
new stories next to their component as `*.stories.tsx`.
|
|
166
|
+
|
|
167
|
+
## API Routes (`research-agent-ui/api`)
|
|
168
|
+
|
|
169
|
+
All 25 Next.js route handlers are exported from the `research-agent-ui/api`
|
|
170
|
+
subpath as factory functions. Each factory accepts a **deps** object that
|
|
171
|
+
injects your app's database, auth helpers, and other services, so the same
|
|
172
|
+
handler logic works in any Next.js project without hard-coding any imports.
|
|
173
|
+
|
|
174
|
+
### How it works
|
|
175
|
+
|
|
176
|
+
The route logic lives in `packages/research-agent-ui/src/api/handlers/`.
|
|
177
|
+
Your app's `app/api/agent/*/route.ts` files become thin wrappers that call
|
|
178
|
+
the factory and re-export the HTTP method handlers.
|
|
179
|
+
|
|
180
|
+
### Step 1 — install / workspace link
|
|
181
|
+
|
|
182
|
+
If you are in this monorepo, `research-agent-ui` is already linked via the
|
|
183
|
+
`workspace:*` protocol. For an external project, install the published
|
|
184
|
+
package:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm install research-agent-ui
|
|
188
|
+
# or
|
|
189
|
+
bun add research-agent-ui
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Step 2 — create your route files
|
|
193
|
+
|
|
194
|
+
For each API path, create a `route.ts` that calls the matching factory and
|
|
195
|
+
passes in your app's dependencies. Every factory is named
|
|
196
|
+
`create<RouteName>Handler` and is exported from `research-agent-ui/api`.
|
|
197
|
+
|
|
198
|
+
#### Example: `app/api/agent/chats/route.ts`
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { createChatsHandler } from "research-agent-ui/api";
|
|
202
|
+
import { getDB } from "@/lib/database";
|
|
203
|
+
import { chats, messages } from "@/lib/database/schema";
|
|
204
|
+
import { requireUserId } from "@/lib/auth/session";
|
|
205
|
+
|
|
206
|
+
const handler = createChatsHandler({
|
|
207
|
+
getDB,
|
|
208
|
+
requireUserId,
|
|
209
|
+
schema: { chats, messages },
|
|
210
|
+
});
|
|
211
|
+
export const { GET, DELETE } = handler;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Example: `app/api/agent/article-followups/route.ts`
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
import { createArticleFollowupsHandler } from "research-agent-ui/api";
|
|
218
|
+
import { getUserId } from "@/lib/auth/session";
|
|
219
|
+
import { getDB } from "@/lib/database";
|
|
220
|
+
import { user as userSchema } from "@/lib/database/schema";
|
|
221
|
+
import { getEnv } from "@/lib/env";
|
|
222
|
+
|
|
223
|
+
export const POST = createArticleFollowupsHandler({
|
|
224
|
+
getUserId,
|
|
225
|
+
requireUserId: async () => {
|
|
226
|
+
const id = await getUserId();
|
|
227
|
+
if (!id) throw new Error("Unauthorized");
|
|
228
|
+
return id;
|
|
229
|
+
},
|
|
230
|
+
getDB,
|
|
231
|
+
userSchema,
|
|
232
|
+
getEnv,
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### All available factories and their dep shapes
|
|
237
|
+
|
|
238
|
+
| Factory | File | Required deps |
|
|
239
|
+
|---|---|---|
|
|
240
|
+
| `createArticleFollowupsHandler` | `article-followups` | `getUserId`, `requireUserId`, `getDB`, `userSchema`, `getEnv` |
|
|
241
|
+
| `createArticleQAHandler` | `article-qa` | `getUserId`, `requireUserId`, `getDB`, `userSchema`, `getEnv` |
|
|
242
|
+
| `createChatsHandler` | `chats` | `getDB`, `requireUserId`, `schema.chats`, `schema.messages` |
|
|
243
|
+
| `createChatByIdHandler` | `chats/[id]` | `getDB`, `requireUserId`, `schema.chats`, `schema.messages` |
|
|
244
|
+
| `createChatsSearchHandler` | `chats/search` | `getDB`, `requireUserId`, `schema.chats`, `schema.messages` |
|
|
245
|
+
| `createChatsShareHandler` | `chats/share` | `getDB`, `requireUserId`, `schema.chats`, `schema.messages` |
|
|
246
|
+
| `createMessagesHandler` | `messages` | `getDB`, `requireUserId`, `messagesSchema` |
|
|
247
|
+
| `createProvidersHandler` | `providers` | `getSession` |
|
|
248
|
+
| `createProviderByIdHandler` | `providers/[id]` | _(none)_ |
|
|
249
|
+
| `createProviderModelsHandler` | `providers/[id]/models` | _(none)_ |
|
|
250
|
+
| `createMCPServersHandler` | `mcpservers` | `configManager`, `getConfiguredMCPServers` |
|
|
251
|
+
| `createMCPServerByIdHandler` | `mcpservers/[id]` | `configManager`, `getConfiguredMCPServers` |
|
|
252
|
+
| `createMCPServerToggleHandler` | `mcpservers/[id]/toggle` | `configManager`, `getConfiguredMCPServers` |
|
|
253
|
+
| `createSearchHandler` | `search` | `searxngDomain?` (default: `https://search.qwksearch.com`) |
|
|
254
|
+
| `createDiscoverHandler` | `discover` | _(none)_ |
|
|
255
|
+
| `createAutocompleteHandler` | `autocomplete` | _(none)_ |
|
|
256
|
+
| `createSuggestionsHandler` | `suggestions` | _(none)_ |
|
|
257
|
+
| `createAgentsHandler` | `agents` | `getUserId`, `requireUserId`, `getDB`, `userSchema`, `getEnv` |
|
|
258
|
+
| `createRewriteHandler` | `rewrite` | `getEnv`, `generateText`, `createGroq` |
|
|
259
|
+
| `createVoiceHandler` | `voice` | `getUserId`, `checkTTSRateLimit`, `generateSpeech` |
|
|
260
|
+
| `createTranscriptHandler` | `transcript` | `getCloudflareContext` |
|
|
261
|
+
| `createTestModelsHandler` | `test-models` | _(none)_ |
|
|
262
|
+
| `createValidateOpenRouterHandler` | `validate-openrouter` | `validateOpenRouterModels` |
|
|
263
|
+
|
|
264
|
+
### Dep type definitions
|
|
265
|
+
|
|
266
|
+
All dep interfaces are exported from `research-agent-ui/api`:
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
import type {
|
|
270
|
+
ArticleDeps,
|
|
271
|
+
ChatsDeps,
|
|
272
|
+
MessagesDeps,
|
|
273
|
+
ProvidersDeps,
|
|
274
|
+
MCPServersDeps,
|
|
275
|
+
SearchDeps,
|
|
276
|
+
VoiceDeps,
|
|
277
|
+
TranscriptDeps,
|
|
278
|
+
RewriteDeps,
|
|
279
|
+
ValidateOpenRouterDeps,
|
|
280
|
+
AgentsDeps,
|
|
281
|
+
} from "research-agent-ui/api";
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### The chat route
|
|
285
|
+
|
|
286
|
+
`POST /api/agent/chat` is not migrated into this package because it delegates
|
|
287
|
+
to a full `handleChatRequest` orchestrator that is app-specific (streaming,
|
|
288
|
+
search integration, database writes). Keep it directly in your app:
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
// app/api/agent/chat/route.ts
|
|
292
|
+
import { handleChatRequest } from "@/lib/chat";
|
|
293
|
+
|
|
294
|
+
export const runtime = "nodejs";
|
|
295
|
+
export const dynamic = "force-dynamic";
|
|
296
|
+
export const POST = handleChatRequest;
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Configuration
|
|
300
|
+
|
|
301
|
+
`configureResearchAgentUI` overrides app-specific values (branding strings,
|
|
302
|
+
the Google API key used by the Drive picker, and the auto-media-search
|
|
303
|
+
toggle) that would otherwise couple this package to a specific app. See
|
|
304
|
+
`ResearchAgentUIConfig` in `src/config.ts` for the full list.
|
|
@@ -45,5 +45,11 @@ export interface QwkSearchProvidersProps {
|
|
|
45
45
|
showCookieConsent?: boolean;
|
|
46
46
|
/** Render the `sonner` toaster. Default true. */
|
|
47
47
|
showToaster?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Mount the Ctrl-Space spotlight palette. Default true. Turn it off in a
|
|
50
|
+
* shell that already binds that chord (a VS Code webview, say, where the
|
|
51
|
+
* host may want the keystroke for itself).
|
|
52
|
+
*/
|
|
53
|
+
showSpotlight?: boolean;
|
|
48
54
|
}
|
|
49
|
-
export declare function QwkSearchProviders({ children, authClient, config, googleOneTap, docsEnabled, ChromeProvider, showDock, showCookieConsent, showToaster, }: QwkSearchProvidersProps): import("react").JSX.Element;
|
|
55
|
+
export declare function QwkSearchProviders({ children, authClient, config, googleOneTap, docsEnabled, ChromeProvider, showDock, showCookieConsent, showToaster, showSpotlight, }: QwkSearchProvidersProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface FocusMode {
|
|
3
|
+
/** The value stored in chat state and sent with a search request. */
|
|
4
|
+
key: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const focusModes: FocusMode[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Opens the spotlight palette from anywhere in the tree, without threading
|
|
2
|
+
* state through props. A no-op if the palette is not mounted. */
|
|
3
|
+
export declare function openSpotlight(): void;
|
|
4
|
+
export declare function SpotlightPalette(): import("react").JSX.Element;
|
|
5
|
+
export default SpotlightPalette;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The Ctrl-Space spotlight palette — a single bar that searches
|
|
3
|
+
* chats, pages, settings and actions, and asks the research agent anything
|
|
4
|
+
* that matches none of them.
|
|
5
|
+
*/
|
|
6
|
+
export { SpotlightPalette, openSpotlight } from './SpotlightPalette';
|
|
7
|
+
export { buildActionItems, buildChatItems, buildPageItems, buildSearchItem, buildSettingItems, } from './spotlightItems';
|
|
8
|
+
export type { SpotlightContext, SpotlightIcon, SpotlightItem, } from './spotlightItems';
|
|
9
|
+
export { matchSpotlight, parsePrefix, prefixForSource, SPOTLIGHT_PREFIXES, } from './spotlightMatch';
|
|
10
|
+
export type { SpotlightMatch, SpotlightMatchable, SpotlightPrefix, SpotlightSource, } from './spotlightMatch';
|
|
11
|
+
export { SPOTLIGHT_LINKS, type SpotlightLink } from './spotlightLinks';
|