Skip to content

Commit 28f1384

Browse files
committed
Add @databricks/appkit-chat-server package
Chat server plugin for AppKit providing: - Streaming chat via AI SDK (createUIMessageStream / streamText) - Optional PostgreSQL persistence (chat history, messages, votes) - Session management via x-forwarded-user headers or custom getSession - Agent backend support (wire to appkit-agent's stream API) - Stream resumption via in-memory stream cache - Chat access control (public/private visibility) - Feedback (thumbs up/down) and title generation Adapted from databricks/appkit commit 7dba405 (chatUI plugin), with internal imports replaced by @databricks/appkit peer dependency and a simplified token-based auth provider.
1 parent 80ce1a0 commit 28f1384

30 files changed

+8106
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: appkit-chat-server
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "integrations/appkit-chat-server/**"
9+
- ".github/workflows/appkit-chat-server.yml"
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
- ready_for_review
16+
paths:
17+
- "integrations/appkit-chat-server/**"
18+
- ".github/workflows/appkit-chat-server.yml"
19+
workflow_dispatch:
20+
21+
defaults:
22+
run:
23+
working-directory: integrations/appkit-chat-server
24+
25+
jobs:
26+
test:
27+
runs-on: ubuntu-latest
28+
name: "test (node: ${{ matrix.node-version }})"
29+
strategy:
30+
matrix:
31+
node-version: ["20", "22"]
32+
timeout-minutes: 10
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Install pnpm
38+
uses: pnpm/action-setup@v4
39+
with:
40+
version: 10
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: ${{ matrix.node-version }}
46+
cache: "pnpm"
47+
cache-dependency-path: integrations/appkit-chat-server/pnpm-lock.yaml
48+
49+
- name: Install dependencies
50+
run: pnpm install --frozen-lockfile
51+
52+
- name: Run tests
53+
run: pnpm run test
54+
55+
typecheck:
56+
runs-on: ubuntu-latest
57+
name: typecheck
58+
timeout-minutes: 10
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Install pnpm
64+
uses: pnpm/action-setup@v4
65+
with:
66+
version: 10
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: "20"
72+
cache: "pnpm"
73+
cache-dependency-path: integrations/appkit-chat-server/pnpm-lock.yaml
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Run typecheck
79+
run: pnpm run typecheck
80+
81+
format:
82+
runs-on: ubuntu-latest
83+
name: format
84+
timeout-minutes: 10
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v4
88+
89+
- name: Install pnpm
90+
uses: pnpm/action-setup@v4
91+
with:
92+
version: 10
93+
94+
- name: Setup Node.js
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: "20"
98+
cache: "pnpm"
99+
cache-dependency-path: integrations/appkit-chat-server/pnpm-lock.yaml
100+
101+
- name: Install dependencies
102+
run: pnpm install --frozen-lockfile
103+
104+
- name: Check formatting
105+
run: pnpm run format:check
106+
107+
build:
108+
runs-on: ubuntu-latest
109+
name: build
110+
timeout-minutes: 10
111+
steps:
112+
- name: Checkout code
113+
uses: actions/checkout@v4
114+
115+
- name: Install pnpm
116+
uses: pnpm/action-setup@v4
117+
with:
118+
version: 10
119+
120+
- name: Setup Node.js
121+
uses: actions/setup-node@v4
122+
with:
123+
node-version: "20"
124+
cache: "pnpm"
125+
cache-dependency-path: integrations/appkit-chat-server/pnpm-lock.yaml
126+
127+
- name: Install dependencies
128+
run: pnpm install --frozen-lockfile
129+
130+
- name: Build package
131+
run: pnpm run build
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Release @databricks/appkit-chat-server
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
production:
7+
description: "Publish to npm? (If unchecked, will publish with --tag next)"
8+
required: true
9+
default: false
10+
type: boolean
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
id-token: write
18+
contents: write
19+
environment:
20+
name: ${{ inputs.production && 'npm' || 'npm-next' }}
21+
url: https://www.npmjs.com/package/@databricks/appkit-chat-server
22+
defaults:
23+
run:
24+
working-directory: integrations/appkit-chat-server
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: 10
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: "20"
36+
registry-url: "https://registry.npmjs.org"
37+
cache: "pnpm"
38+
cache-dependency-path: integrations/appkit-chat-server/pnpm-lock.yaml
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Get package version
44+
id: get-version
45+
run: |
46+
PKG_VERSION=$(node -p "require('./package.json').version")
47+
echo "version=$PKG_VERSION" >> $GITHUB_OUTPUT
48+
49+
- name: Clean
50+
run: pnpm run clean
51+
52+
- name: Build
53+
run: pnpm run build
54+
55+
- name: Test
56+
run: pnpm run test
57+
58+
- name: Typecheck
59+
run: pnpm run typecheck
60+
61+
- name: Publish to npm
62+
if: inputs.production
63+
run: pnpm publish --access public --provenance --no-git-checks
64+
65+
- name: Publish to npm (next tag)
66+
if: ${{ !inputs.production }}
67+
run: pnpm publish --access public --tag next --provenance --no-git-checks
68+
69+
- name: Wait for registry propagation
70+
run: sleep 15
71+
72+
- name: Smoke test (production)
73+
if: inputs.production
74+
run: |
75+
PKG_VERSION=${{ steps.get-version.outputs.version }}
76+
mkdir -p /tmp/smoke-test
77+
cd /tmp/smoke-test
78+
npm install @databricks/appkit-chat-server@$PKG_VERSION
79+
INSTALLED_VERSION=$(node -p "require('./node_modules/@databricks/appkit-chat-server/package.json').version")
80+
echo "Expected: $PKG_VERSION"
81+
echo "Installed: $INSTALLED_VERSION"
82+
if [ "$PKG_VERSION" != "$INSTALLED_VERSION" ]; then
83+
echo "Version mismatch!"
84+
exit 1
85+
fi
86+
echo "Smoke test passed!"
87+
88+
- name: Smoke test (next tag)
89+
if: ${{ !inputs.production }}
90+
run: |
91+
mkdir -p /tmp/smoke-test
92+
cd /tmp/smoke-test
93+
npm install @databricks/appkit-chat-server@next
94+
INSTALLED_VERSION=$(node -p "require('./node_modules/@databricks/appkit-chat-server/package.json').version")
95+
echo "Installed @next version: $INSTALLED_VERSION"
96+
echo "Smoke test passed!"
97+
98+
- name: Generate package link
99+
run: |
100+
PKG_VERSION=${{ steps.get-version.outputs.version }}
101+
if [ "${{ inputs.production }}" == "true" ]; then
102+
LINK="https://www.npmjs.com/package/@databricks/appkit-chat-server/v/$PKG_VERSION"
103+
echo "## :rocket: Package Released" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
echo "**@databricks/appkit-chat-server v$PKG_VERSION** has been published to npm!" >> $GITHUB_STEP_SUMMARY
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
echo ":link: [$LINK]($LINK)" >> $GITHUB_STEP_SUMMARY
108+
else
109+
LINK="https://www.npmjs.com/package/@databricks/appkit-chat-server?activeTab=versions"
110+
echo "## :test_tube: Package Released (next tag)" >> $GITHUB_STEP_SUMMARY
111+
echo "" >> $GITHUB_STEP_SUMMARY
112+
echo "**@databricks/appkit-chat-server v$PKG_VERSION** has been published to npm with --tag next!" >> $GITHUB_STEP_SUMMARY
113+
echo "" >> $GITHUB_STEP_SUMMARY
114+
echo ":link: [$LINK]($LINK)" >> $GITHUB_STEP_SUMMARY
115+
fi
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"name": "@databricks/appkit-chat-server",
3+
"version": "0.1.0",
4+
"description": "Chat server plugin for Databricks AppKit — streaming chat with history, persistence, session management, and agent backend support",
5+
"type": "module",
6+
"main": "./dist/index.cjs",
7+
"module": "./dist/index.js",
8+
"types": "./dist/index.d.ts",
9+
"exports": {
10+
".": {
11+
"import": {
12+
"types": "./dist/index.d.ts",
13+
"default": "./dist/index.js"
14+
},
15+
"require": {
16+
"types": "./dist/index.d.cts",
17+
"default": "./dist/index.cjs"
18+
}
19+
}
20+
},
21+
"files": [
22+
"dist",
23+
"README.md",
24+
"LICENSE",
25+
"NOTICE"
26+
],
27+
"scripts": {
28+
"build": "tsdown",
29+
"dev": "tsdown --watch",
30+
"clean": "rm -rf dist",
31+
"test": "vitest run",
32+
"test:watch": "vitest",
33+
"typecheck": "tsc --noEmit",
34+
"lint": "eslint 'src/**/*.ts'",
35+
"format": "prettier --write 'src/**/*.ts'",
36+
"format:check": "prettier --check 'src/**/*.ts'"
37+
},
38+
"engines": {
39+
"node": ">=20.0.0"
40+
},
41+
"peerDependencies": {
42+
"@databricks/appkit": ">=0.21.0",
43+
"express": ">=4.0.0",
44+
"pg": ">=8.0.0"
45+
},
46+
"peerDependenciesMeta": {
47+
"pg": {
48+
"optional": true
49+
}
50+
},
51+
"dependencies": {
52+
"@databricks/ai-sdk-provider": "^0.5.1",
53+
"ai": "^6.0.70",
54+
"drizzle-orm": "^0.38.0",
55+
"zod": "^4.3.5"
56+
},
57+
"devDependencies": {
58+
"@databricks/appkit": "^0.21.0",
59+
"@types/express": "^4.17.25",
60+
"@types/node": "^22.0.0",
61+
"@types/pg": "^8.16.0",
62+
"prettier": "^3.0.0",
63+
"tsdown": "^0.9.0",
64+
"typescript": "^5.4.0",
65+
"vitest": "^4.0.18"
66+
},
67+
"author": {
68+
"name": "Databricks",
69+
"email": "agent-feedback@databricks.com"
70+
},
71+
"repository": {
72+
"type": "git",
73+
"url": "https://github.com/databricks/databricks-ai-bridge.git",
74+
"directory": "integrations/appkit-chat-server"
75+
},
76+
"homepage": "https://github.com/databricks/databricks-ai-bridge/tree/main/integrations/appkit-chat-server",
77+
"bugs": {
78+
"url": "https://github.com/databricks/databricks-ai-bridge/issues"
79+
},
80+
"keywords": [
81+
"databricks",
82+
"appkit",
83+
"chat",
84+
"streaming",
85+
"ai",
86+
"persistence",
87+
"server"
88+
],
89+
"license": "Databricks License",
90+
"pnpm": {
91+
"onlyBuiltDependencies": [
92+
"@databricks/appkit",
93+
"esbuild",
94+
"protobufjs",
95+
"rolldown"
96+
]
97+
}
98+
}

0 commit comments

Comments
 (0)