mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-18 00:03:11 +00:00
chore: publish the chat sdk as @windmill-labs/chat-sdk (#11686)
* chore: publish the chat sdk as @windmill-labs/chat-sdk * chore: publish the chat sdk with a dedicated npm token * chore: publish the chat sdk with npm trusted publishing
This commit is contained in:
@@ -18,16 +18,19 @@ jobs:
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
publish_chat_sdk:
|
||||
runs-on: ubicloud-standard-8
|
||||
# Published by npm trusted publishing (OIDC), which npm accepts only from
|
||||
# GitHub-hosted runners and npm >= 11.5.1: keep both, there is no token to fall back on.
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: "20.x"
|
||||
node-version: "24.x"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
- run: cd chat-sdk && npm ci && npm run build && npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
publish_cli:
|
||||
runs-on: ubicloud-standard-8
|
||||
steps:
|
||||
|
||||
+14
-14
@@ -1,21 +1,21 @@
|
||||
# windmill-chat
|
||||
# @windmill-labs/chat-sdk
|
||||
|
||||
Build a chat interface on a Windmill flow deployed in **chat mode**, from any frontend
|
||||
or from a Windmill raw app. The library is headless: it runs the flow, follows the
|
||||
answer as it streams, keeps the conversation history, and hands you state to render.
|
||||
|
||||
```
|
||||
npm install windmill-chat
|
||||
npm install @windmill-labs/chat-sdk
|
||||
```
|
||||
|
||||
No runtime dependencies. Optional peers: `react` for `windmill-chat/react`, `ai` for
|
||||
`windmill-chat/ai-sdk`, `@assistant-ui/react` for `windmill-chat/assistant-ui`.
|
||||
No runtime dependencies. Optional peers: `react` for `@windmill-labs/chat-sdk/react`, `ai` for
|
||||
`@windmill-labs/chat-sdk/ai-sdk`, `@assistant-ui/react` for `@windmill-labs/chat-sdk/assistant-ui`.
|
||||
|
||||
| You build the UI with | Import | You get |
|
||||
|---|---|---|
|
||||
| Vercel AI SDK `useChat`, AI Elements | `windmill-chat/ai-sdk` | a `ChatTransport`: `useChat({ transport })`, nothing else changes |
|
||||
| assistant-ui | `windmill-chat/assistant-ui` | a runtime for `AssistantRuntimeProvider`, threads included |
|
||||
| Your own components | `windmill-chat/react` or `windmill-chat` | a hook / a store with messages, status and actions |
|
||||
| Vercel AI SDK `useChat`, AI Elements | `@windmill-labs/chat-sdk/ai-sdk` | a `ChatTransport`: `useChat({ transport })`, nothing else changes |
|
||||
| assistant-ui | `@windmill-labs/chat-sdk/assistant-ui` | a runtime for `AssistantRuntimeProvider`, threads included |
|
||||
| Your own components | `@windmill-labs/chat-sdk/react` or `@windmill-labs/chat-sdk` | a hook / a store with messages, status and actions |
|
||||
|
||||
## The flow
|
||||
|
||||
@@ -31,7 +31,7 @@ so an AI agent step remembers earlier turns. The answer is:
|
||||
|
||||
```tsx
|
||||
import { useChat } from '@ai-sdk/react'
|
||||
import { createWindmillChatTransport } from 'windmill-chat/ai-sdk'
|
||||
import { createWindmillChatTransport } from '@windmill-labs/chat-sdk/ai-sdk'
|
||||
|
||||
const transport = createWindmillChatTransport({
|
||||
baseUrl: 'https://app.windmill.dev',
|
||||
@@ -65,7 +65,7 @@ explanatory error.
|
||||
|
||||
```tsx
|
||||
import { AssistantRuntimeProvider } from '@assistant-ui/react'
|
||||
import { useWindmillRuntime } from 'windmill-chat/assistant-ui'
|
||||
import { useWindmillRuntime } from '@windmill-labs/chat-sdk/assistant-ui'
|
||||
|
||||
export function Support() {
|
||||
const runtime = useWindmillRuntime({ baseUrl, workspace, flowPath, token })
|
||||
@@ -84,7 +84,7 @@ through `Reasoning`. It takes the same options as `useWindmillChat` below.
|
||||
## React
|
||||
|
||||
```tsx
|
||||
import { useWindmillChat } from 'windmill-chat/react'
|
||||
import { useWindmillChat } from '@windmill-labs/chat-sdk/react'
|
||||
|
||||
export function Support() {
|
||||
const chat = useWindmillChat({
|
||||
@@ -155,7 +155,7 @@ change, and returns the unsubscribe function. That is the Svelte store contract,
|
||||
`$chat` works as is; other frameworks wrap it in a few lines.
|
||||
|
||||
```ts
|
||||
import { createChat } from 'windmill-chat'
|
||||
import { createChat } from '@windmill-labs/chat-sdk'
|
||||
|
||||
const chat = createChat({ baseUrl, workspace, flowPath, token })
|
||||
chat.subscribe((state) => render(state))
|
||||
@@ -164,7 +164,7 @@ await chat.sendMessage('Hello')
|
||||
|
||||
```svelte
|
||||
<script>
|
||||
import { createChat } from 'windmill-chat'
|
||||
import { createChat } from '@windmill-labs/chat-sdk'
|
||||
const chat = createChat({ flowPath: 'f/support/assistant' })
|
||||
</script>
|
||||
|
||||
@@ -331,8 +331,8 @@ custom integrations.
|
||||
## For AI coding agents
|
||||
|
||||
When asked to add a chat over a Windmill flow: the flow must be deployed with chat mode
|
||||
on. Pick the entry point from the table at the top (`useChat` → `windmill-chat/ai-sdk`,
|
||||
assistant-ui → `windmill-chat/assistant-ui`, otherwise `windmill-chat/react`). Inside a
|
||||
on. Pick the entry point from the table at the top (`useChat` → `@windmill-labs/chat-sdk/ai-sdk`,
|
||||
assistant-ui → `@windmill-labs/chat-sdk/assistant-ui`, otherwise `@windmill-labs/chat-sdk/react`). Inside a
|
||||
Windmill raw app pass only `flowPath`. Elsewhere pass `baseUrl`, `workspace` and a
|
||||
`token`; for a public page use a token scoped to `jobs:run:flows:<flowPath>` and leave
|
||||
`history` at its default. Render `role`, `content`, `pending`, `success` and
|
||||
|
||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "windmill-chat",
|
||||
"name": "@windmill-labs/chat-sdk",
|
||||
"version": "1.830.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "windmill-chat",
|
||||
"name": "@windmill-labs/chat-sdk",
|
||||
"version": "1.830.0",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "windmill-chat",
|
||||
"name": "@windmill-labs/chat-sdk",
|
||||
"description": "Build chat interfaces on Windmill flows deployed in chat mode, from any frontend or raw app",
|
||||
"version": "1.830.0",
|
||||
"author": "Ruben Fiszel",
|
||||
|
||||
Generated
+4
-4
@@ -6747,16 +6747,16 @@ Apply it to customer data, internal notes and anything else a viewer of the demo
|
||||
|
||||
### Chat UIs over a flow in chat mode
|
||||
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add \`windmill-chat\` to \`package.json\` and use it directly, it detects the app's Windmill and credential.
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add \`@windmill-labs/chat-sdk\` to \`package.json\` and use it directly, it detects the app's Windmill and credential.
|
||||
|
||||
\`\`\`tsx
|
||||
import { useWindmillChat } from 'windmill-chat/react'
|
||||
import { useWindmillChat } from '@windmill-labs/chat-sdk/react'
|
||||
|
||||
const chat = useWindmillChat({ flowPath: 'f/support/assistant' })
|
||||
// chat.messages ({ role, content, pending, success, tool? }), chat.status, chat.sendMessage(text), chat.stop()
|
||||
\`\`\`
|
||||
|
||||
\`windmill-chat/ai-sdk\` gives a \`ChatTransport\` for the Vercel AI SDK's \`useChat\`, \`windmill-chat/assistant-ui\` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs \`jobs:run\` in its frontend SDK scopes, plus \`flow_conversations:write\` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
\`@windmill-labs/chat-sdk/ai-sdk\` gives a \`ChatTransport\` for the Vercel AI SDK's \`useChat\`, \`@windmill-labs/chat-sdk/assistant-ui\` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs \`jobs:run\` in its frontend SDK scopes, plus \`flow_conversations:write\` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
|
||||
## Backend runnables
|
||||
|
||||
@@ -6916,7 +6916,7 @@ def main(user_id: str):
|
||||
7. **Mark sensitive UI with \`data-wm-no-record\`** — it is what keeps that data out of a recorded demo; passwords are handled for you.
|
||||
8. **Reach for \`backendAsync\` + \`waitJob\`** for long work — never a hand-written job-polling runnable.
|
||||
9. **Deploy what a path runnable points at** — a path runnable aimed at a draft fails at runtime; tell the user what needs deploying.
|
||||
10. **Use \`windmill-chat\` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
10. **Use \`@windmill-labs/chat-sdk\` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
`,
|
||||
"triggers": `---
|
||||
name: triggers
|
||||
|
||||
@@ -1024,16 +1024,16 @@ Apply it to customer data, internal notes and anything else a viewer of the demo
|
||||
|
||||
### Chat UIs over a flow in chat mode
|
||||
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add \`windmill-chat\` to \`package.json\` and use it directly, it detects the app's Windmill and credential.
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add \`@windmill-labs/chat-sdk\` to \`package.json\` and use it directly, it detects the app's Windmill and credential.
|
||||
|
||||
\`\`\`tsx
|
||||
import { useWindmillChat } from 'windmill-chat/react'
|
||||
import { useWindmillChat } from '@windmill-labs/chat-sdk/react'
|
||||
|
||||
const chat = useWindmillChat({ flowPath: 'f/support/assistant' })
|
||||
// chat.messages ({ role, content, pending, success, tool? }), chat.status, chat.sendMessage(text), chat.stop()
|
||||
\`\`\`
|
||||
|
||||
\`windmill-chat/ai-sdk\` gives a \`ChatTransport\` for the Vercel AI SDK's \`useChat\`, \`windmill-chat/assistant-ui\` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs \`jobs:run\` in its frontend SDK scopes, plus \`flow_conversations:write\` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
\`@windmill-labs/chat-sdk/ai-sdk\` gives a \`ChatTransport\` for the Vercel AI SDK's \`useChat\`, \`@windmill-labs/chat-sdk/assistant-ui\` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs \`jobs:run\` in its frontend SDK scopes, plus \`flow_conversations:write\` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
|
||||
## Backend runnables
|
||||
|
||||
@@ -1182,7 +1182,7 @@ def main(user_id: str):
|
||||
7. **Mark sensitive UI with \`data-wm-no-record\`** — it is what keeps that data out of a recorded demo; passwords are handled for you.
|
||||
8. **Reach for \`backendAsync\` + \`waitJob\`** for long work — never a hand-written job-polling runnable.
|
||||
9. **Deploy what a path runnable points at** — a path runnable aimed at a draft fails at runtime; tell the user what needs deploying.
|
||||
10. **Use \`windmill-chat\` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
10. **Use \`@windmill-labs/chat-sdk\` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
`;
|
||||
|
||||
export const PIPELINE_BASE = `# Data pipeline authoring
|
||||
|
||||
@@ -378,16 +378,16 @@ Apply it to customer data, internal notes and anything else a viewer of the demo
|
||||
|
||||
### Chat UIs over a flow in chat mode
|
||||
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add `windmill-chat` to `package.json` and use it directly, it detects the app's Windmill and credential.
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add `@windmill-labs/chat-sdk` to `package.json` and use it directly, it detects the app's Windmill and credential.
|
||||
|
||||
```tsx
|
||||
import { useWindmillChat } from 'windmill-chat/react'
|
||||
import { useWindmillChat } from '@windmill-labs/chat-sdk/react'
|
||||
|
||||
const chat = useWindmillChat({ flowPath: 'f/support/assistant' })
|
||||
// chat.messages ({ role, content, pending, success, tool? }), chat.status, chat.sendMessage(text), chat.stop()
|
||||
```
|
||||
|
||||
`windmill-chat/ai-sdk` gives a `ChatTransport` for the Vercel AI SDK's `useChat`, `windmill-chat/assistant-ui` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs `jobs:run` in its frontend SDK scopes, plus `flow_conversations:write` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
`@windmill-labs/chat-sdk/ai-sdk` gives a `ChatTransport` for the Vercel AI SDK's `useChat`, `@windmill-labs/chat-sdk/assistant-ui` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs `jobs:run` in its frontend SDK scopes, plus `flow_conversations:write` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
|
||||
## Backend runnables
|
||||
|
||||
@@ -547,4 +547,4 @@ def main(user_id: str):
|
||||
7. **Mark sensitive UI with `data-wm-no-record`** — it is what keeps that data out of a recorded demo; passwords are handled for you.
|
||||
8. **Reach for `backendAsync` + `waitJob`** for long work — never a hand-written job-polling runnable.
|
||||
9. **Deploy what a path runnable points at** — a path runnable aimed at a draft fails at runtime; tell the user what needs deploying.
|
||||
10. **Use `windmill-chat` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
10. **Use `@windmill-labs/chat-sdk` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
|
||||
@@ -139,16 +139,16 @@ Apply it to customer data, internal notes and anything else a viewer of the demo
|
||||
|
||||
### Chat UIs over a flow in chat mode
|
||||
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add `windmill-chat` to `package.json` and use it directly, it detects the app's Windmill and credential.
|
||||
A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add `@windmill-labs/chat-sdk` to `package.json` and use it directly, it detects the app's Windmill and credential.
|
||||
|
||||
```tsx
|
||||
import { useWindmillChat } from 'windmill-chat/react'
|
||||
import { useWindmillChat } from '@windmill-labs/chat-sdk/react'
|
||||
|
||||
const chat = useWindmillChat({ flowPath: 'f/support/assistant' })
|
||||
// chat.messages ({ role, content, pending, success, tool? }), chat.status, chat.sendMessage(text), chat.stop()
|
||||
```
|
||||
|
||||
`windmill-chat/ai-sdk` gives a `ChatTransport` for the Vercel AI SDK's `useChat`, `windmill-chat/assistant-ui` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs `jobs:run` in its frontend SDK scopes, plus `flow_conversations:write` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
`@windmill-labs/chat-sdk/ai-sdk` gives a `ChatTransport` for the Vercel AI SDK's `useChat`, `@windmill-labs/chat-sdk/assistant-ui` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs `jobs:run` in its frontend SDK scopes, plus `flow_conversations:write` for the conversation sidebar; without them the chat keeps history in the browser.
|
||||
|
||||
## Backend runnables
|
||||
|
||||
@@ -319,4 +319,4 @@ def main(user_id: str):
|
||||
7. **Mark sensitive UI with `data-wm-no-record`** — it is what keeps that data out of a recorded demo; passwords are handled for you.
|
||||
8. **Reach for `backendAsync` + `waitJob`** for long work — never a hand-written job-polling runnable.
|
||||
9. **Deploy what a path runnable points at** — a path runnable aimed at a draft fails at runtime; tell the user what needs deploying.
|
||||
10. **Use `windmill-chat` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
10. **Use `@windmill-labs/chat-sdk` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
|
||||
|
||||
Reference in New Issue
Block a user