Commit c3581d5
feat(appkit): add Genie plugin for AI/BI space integration (#108)
* feat(appkit): add Genie plugin for AI/BI space integration
Add a new Genie plugin that provides an opinionated chat API powered by
Databricks AI/BI Genie spaces. Users configure named space aliases in
plugin config, and the backend resolves aliases to actual space IDs.
Key design:
- Single SSE endpoint: POST /api/genie/:alias/messages
- Always executes as user (OBO) via asUser(req)
- SSE event flow: message_start → status (×N) → message_result → query_result (×N)
- Space alias abstraction keeps space IDs out of URLs and client code
- No cache/retry (chat is stateful and non-idempotent)
- Configurable timeout (default 2min, 0 for indefinite)
Also fixes pre-existing ajv type resolution issue in shared package
where pnpm hoisting caused TypeScript to resolve ajv@6 types instead
of the declared ajv@8 dependency.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* fix(shared): handle ajv v6/v8 ErrorObject type differences
Cast error entries to `any` when mapping validation errors so the code
works regardless of which ajv version TypeScript resolves (v6 has
`dataPath`, v8 has `instancePath`).
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* docs: regenerate API docs for genie plugin export
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* fix(appkit): copy genie manifest.json to dist during build
Add genie manifest.json to tsdown copy config so it's available at
runtime when loading from the built dist/ output.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(appkit): add conversation history endpoint to Genie plugin
SSE endpoint (GET /api/genie/:alias/conversations/:conversationId)
that replays full conversation history reusing existing event types,
enabling page refresh without losing chat state.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* fix(appkit): simplify genie plugin imports per PR feedback
Use top-level @databricks/sdk-experimental export for Time/TimeUnits
and import createLogger from logging index instead of direct file path.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* docs(appkit): add @internal to genie export and document plugin in plugins.md
Add @internal JSDoc to genie const to exclude it from generated API
docs. Add Genie plugin section to plugins.md covering configuration,
endpoints, SSE events, and programmatic usage.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* docs: remove Variable.genie from generated API docs sidebar and index
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(genie): add SSE reconnection support via stable streamId
Pass deterministic streamId values to StreamManager so clients can
reconnect and replay missed events using Last-Event-ID. Also adds a
default bufferSize of 100 to the Genie stream settings.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(genie): default spaces config from DATABRICKS_GENIE_SPACE_ID env var
Make the `spaces` config optional. When omitted, fall back to
{ default: DATABRICKS_GENIE_SPACE_ID }. If the env var is also unset,
routes gracefully 404 instead of crashing at startup.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* refactor(genie): extract pollWaiter to simplify _handleSendMessage
Replace manual concurrency code (statusQueue, notifyGenerator,
waiterDone, waiterError, IIFE promise chain) with a reusable
pollWaiter async generator that bridges callback-based
waiter.wait({ onProgress }) into a for-await-of loop.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(genie): use client-provided requestId query param as SSE streamId
Replace conversation-derived stream IDs with a client-provided
?requestId=<uuid> query param, enabling reliable SSE reconnection.
Falls back to crypto.randomUUID() when not provided.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(appkit-ui): add Genie chat React components (#116)
* feat(appkit-ui): add Genie chat React components and dev-playground demo
Add plug-and-play React components for Genie AI/BI chat:
- useGenieChat hook: manages SSE streaming, conversation persistence
via URL params, and history replay on page refresh
- GenieChat: all-in-one component wiring hook + UI
- GenieChatMessage: renders messages with markdown (via marked),
avatars, and collapsible SQL query attachments
- GenieChatMessageList: scrollable message list with auto-scroll,
loading skeletons, and streaming status indicator
- GenieChatInput: textarea with Enter-to-send and auto-resize
Also adds Genie demo page to dev-playground at /genie and fixes
conversation history ordering in the backend (reverse to chronological).
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* fix(appkit-ui): address Genie chat UI review feedback
- Rename GENIE_SPACE_ID to DATABRICKS_GENIE_SPACE_ID in env and code
- Hide textarea scrollbar; only show overflow-y when content exceeds max height
- Skip rendering empty assistant bubbles during loading, show only the spinner
- Remove shadow from nested SQL query cards to fix corner shadow artifacts
- Move "New conversation" button to top-right of chat widget
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* docs: add Genie component documentation with examples
Extend the doc generator to scan genie, multi-genie, and chat component
directories. Add JSDoc descriptions to all Genie components and props,
create usage examples for GenieChat and MultiGenieChat, and generate
8 new doc pages under a "Genie components" sidebar category.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(genie): send requestId query param from frontend for SSE reconnection
Generate a UUID per request in useGenieChat and pass it as ?requestId
to the sendMessage and loadHistory SSE endpoints. This allows the server
to use a stable streamId for reconnection and missed-event replay.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
---------
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* Refactor Genie into Genie connector (#145)
* feat(appkit-ui): add Genie chat React components and dev-playground demo
Add plug-and-play React components for Genie AI/BI chat:
- useGenieChat hook: manages SSE streaming, conversation persistence
via URL params, and history replay on page refresh
- GenieChat: all-in-one component wiring hook + UI
- GenieChatMessage: renders messages with markdown (via marked),
avatars, and collapsible SQL query attachments
- GenieChatMessageList: scrollable message list with auto-scroll,
loading skeletons, and streaming status indicator
- GenieChatInput: textarea with Enter-to-send and auto-resize
Also adds Genie demo page to dev-playground at /genie and fixes
conversation history ordering in the backend (reverse to chronological).
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* fix(appkit-ui): address Genie chat UI review feedback
- Rename GENIE_SPACE_ID to DATABRICKS_GENIE_SPACE_ID in env and code
- Hide textarea scrollbar; only show overflow-y when content exceeds max height
- Skip rendering empty assistant bubbles during loading, show only the spinner
- Remove shadow from nested SQL query cards to fix corner shadow artifacts
- Move "New conversation" button to top-right of chat widget
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* docs: add Genie component documentation with examples
Extend the doc generator to scan genie, multi-genie, and chat component
directories. Add JSDoc descriptions to all Genie components and props,
create usage examples for GenieChat and MultiGenieChat, and generate
8 new doc pages under a "Genie components" sidebar category.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* feat(genie): send requestId query param from frontend for SSE reconnection
Generate a UUID per request in useGenieChat and pass it as ?requestId
to the sendMessage and loadHistory SSE endpoints. This allows the server
to use a stable streamId for reconnection and missed-event replay.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* chore: genie connector
* refactor(genie): replace sendMessage with streaming implementation
The old non-streaming sendMessage (returning Promise<GenieMessageResponse>)
is replaced by the streaming version (returning AsyncGenerator<GenieStreamEvent>).
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
---------
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
Co-authored-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
* chore: remove crypto/index.ts
* refactor: move shared Genie types to packages/shared
Move GenieStreamEvent, GenieMessageResponse, and GenieAttachmentResponse
to the shared package to eliminate duplication between appkit and
appkit-ui, ensuring both sides stay in sync.
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
* chore: colocate poll-waiter test with its source
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
---------
Signed-off-by: Jorge Calvar <jorge.calvar@databricks.com>
Co-authored-by: MarioCadenas <MarioCadenas@users.noreply.github.com>1 parent c3f6524 commit c3581d5
45 files changed
Lines changed: 3487 additions & 72 deletions
File tree
- apps/dev-playground
- client/src
- routes
- server
- docs
- docs/api/appkit-ui/genie
- src/components/DocExample
- static/appkit-ui
- packages
- appkit-ui
- src/react
- genie
- appkit
- src
- connectors
- genie
- plugins
- genie
- tests
- template
- tools
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
73 | 86 | | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
84 | 101 | | |
| 102 | + | |
85 | 103 | | |
86 | 104 | | |
87 | 105 | | |
| |||
93 | 111 | | |
94 | 112 | | |
95 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
96 | 117 | | |
| 118 | + | |
97 | 119 | | |
98 | 120 | | |
99 | 121 | | |
| |||
106 | 128 | | |
107 | 129 | | |
108 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
109 | 134 | | |
| 135 | + | |
110 | 136 | | |
111 | 137 | | |
112 | 138 | | |
| |||
117 | 143 | | |
118 | 144 | | |
119 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
120 | 149 | | |
| 150 | + | |
121 | 151 | | |
122 | 152 | | |
123 | 153 | | |
| |||
128 | 158 | | |
129 | 159 | | |
130 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
131 | 164 | | |
| 165 | + | |
132 | 166 | | |
133 | 167 | | |
134 | 168 | | |
| |||
140 | 174 | | |
141 | 175 | | |
142 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
143 | 180 | | |
| 181 | + | |
144 | 182 | | |
145 | 183 | | |
146 | 184 | | |
| |||
177 | 215 | | |
178 | 216 | | |
179 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
180 | 226 | | |
181 | 227 | | |
182 | 228 | | |
| |||
220 | 266 | | |
221 | 267 | | |
222 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
223 | 272 | | |
| 273 | + | |
224 | 274 | | |
225 | 275 | | |
226 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
166 | 185 | | |
167 | 186 | | |
168 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments