@boldare/askdare 0.2.0-rc.1 → 0.2.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/CHANGELOG.md +55 -0
- package/README.md +3 -3
- package/dist/cli.js +14 -9
- package/dist/next.js +8 -8
- package/dist/react.d.ts +121 -78
- package/dist/react.js +121 -9
- package/dist/ui/askdare.css +16 -1
- package/dist/ui/avatar.tsx +1 -1
- package/dist/ui/chat.tsx +1 -1
- package/dist/ui/confirm.tsx +18 -3
- package/dist/ui/context.ts +1 -1
- package/dist/ui/feedback.tsx +1 -1
- package/dist/ui/footer.tsx +1 -1
- package/dist/ui/header.tsx +1 -1
- package/dist/ui/icons.tsx +1 -1
- package/dist/ui/index.ts +1 -1
- package/dist/ui/message.tsx +1 -1
- package/dist/ui/panel.tsx +9 -3
- package/dist/ui/welcome.tsx +1 -1
- package/docs/cli.md +2 -2
- package/docs/configuration.md +2 -0
- package/docs/deployment.md +27 -0
- package/docs/embedding.md +1 -1
- package/docs/events.md +183 -0
- package/docs/getting-started.md +8 -2
- package/docs/observability.md +6 -0
- package/docs/privacy.md +1 -0
- package/docs/react.md +1 -0
- package/docs/styling.md +1 -0
- package/docs/troubleshooting.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @boldare/askdare
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1a1659f: New command `npx @boldare/askdare add ui`: copies the source of the chat's default look (React components and their stylesheet) into `components/askdare`, or the folder given with `--dir`, so you can change it freely. It never overwrites files. The copy imports only `@boldare/askdare/react`, and you switch to it by changing one import of `DefaultChat`.
|
|
8
|
+
- ac878e6: The page can now hear what happens in the chat, for analytics such as GA4 or a GTM `dataLayer`: `askdare('on', type, listener)` with the script tag, or `onEvent` on `Root` in React. Events cover the chat opening and closing, messages sent, answers received, ratings, errors and starting over. They carry metadata only, such as counts, durations and outcomes, and never message text. See the "Chat events" guide (ADR-0013).
|
|
9
|
+
- 9bd1b16: Visitors' ratings of answers reach `createChatHandler({ onFeedback })`: 👍, 👎 with an optional comment, or the rating taken back, with the conversation and answer IDs for your own review. Each answer carries an encrypted rating handle in `message.end` and in the history, bound to the visitor or signed-in user, and `POST /feedback` accepts a rating only from them. A bot turns ratings off with `widget.feedback: false`. askdare stores no ratings.
|
|
10
|
+
- 05076dc: The chat shows 👍 and 👎 under each answer when `createChatHandler` has `onFeedback`. After a 👎 it asks "What went wrong?" with an optional comment, a second click takes a rating back, and the browser remembers the visitor's ratings across reloads. New text keys `feedback.*` (English and Polish) and parts `feedback`, `feedback-button`, `feedback-comment` and its children. In your own React markup, use `FeedbackButton` and `actions.rate`. See the new Answer ratings guide.
|
|
11
|
+
- d789913: The config that `npx @boldare/askdare init` writes now reads three optional environment variables. `ASKDARE_INSTRUCTIONS` and `ASKDARE_GREETING` replace the bot's default instructions and greeting, and `ASKDARE_ALLOWED_ORIGINS` lists the other sites that may embed the chat, comma-separated. Blank values fall back to the defaults, and trailing slashes are dropped from origins. Without the variables the bot behaves as before. The starter's Vercel button asks for the instructions and greeting, and its Heroku `app.json` offers all three.
|
|
12
|
+
- 48ddabf: New entry `@boldare/askdare/react`: the chat inside a page of your own Next.js app, without an iframe. `Root` runs one bot's chat, `DefaultChat` is the widget's look ready to place, and the hooks (`useChat`, `useChatState`, `useMessage`) and primitives (`Messages`, `MessageList`, `Message`, `MessageText`, `Composer`, `Input`, `Send` and the rest) let you write your own markup on the same parts and tokens. `getChatConfig({ bots, bot })` from `@boldare/askdare/next` gives a Server Component the public configuration to pass to `Root`. React 19 is a new optional peer dependency; the script-tag widget needs nothing new. The chat talks only to its own origin, and a page that renders it shares its scripts' access to the conversation: on sites that run scripts they don't trust, keep the iframe widget.
|
|
13
|
+
- 94a1e30: `createChatHandler({ onUsage })` reports every chat turn once its answer has streamed, failed turns included: the tokens it used (input, cached and cache-write input, output and reasoning), the model that answered, how long it took and which tools it called, with pseudonyms instead of IDs and never any message text. Use it for cost tracking and tracing. `onError` may now be async too, and a hook that throws no longer reaches the request: askdare logs its error's name instead.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 7c9fb36: Source links under an answer are checked like links inside it: only `http`, `https` and `mailto` URLs become links, and anything else shows as plain text. Before, they relied on the protocol validator alone.
|
|
18
|
+
- 66da550: The README links to askdare.vercel.app/deploy, where the one-click deploy of the starter takes about five minutes.
|
|
19
|
+
- c0c1a7f: docs: the one-click deploy takes about five minutes, and askdare.vercel.app/deploy makes the `CHAT_SECRET` for the Vercel form.
|
|
20
|
+
- 45ef7de: Fixes in the chat inside a page and its default look:
|
|
21
|
+
|
|
22
|
+
- An answer or a transcript returns focus to the message field only when focus was in the chat or nowhere, never from the page's own fields, and without scrolling the page. `actions.focus()` still always moves it.
|
|
23
|
+
- Ratings of one answer go out one at a time: quick 👍 then 👎 ends with what the server took, and a failed one goes back to the last rating it confirmed.
|
|
24
|
+
- A comment after 👎 stays in its form until it is sent, so a failed send no longer loses the text.
|
|
25
|
+
- No new dictation starts while the last one is being transcribed.
|
|
26
|
+
- `<Root>` unmounting stops the answer being streamed and the uploads still running.
|
|
27
|
+
- `Composer`: an `onSubmit` that calls `preventDefault()` takes the message over, Enter in the `Input` goes through `onSubmit` too, and an `onPaste` that prevents the default keeps the files out.
|
|
28
|
+
- Escape outside the chat is left to the page also with `headingLevel={1}`, and Escape that a handler already used is ignored. The question before a new conversation is modal only in the iframe.
|
|
29
|
+
- The default look's stylesheet styles only the chat inside `DefaultChat`, never a headless chat in the same document.
|
|
30
|
+
- The rating buttons and the question after 👎 scroll into view at the end of the conversation, and messages no longer re-render on every change of the chat.
|
|
31
|
+
- 9540d46: The README's "What you get" picture now shows what 0.2 adds: the chat inside your own page with React, ratings of answers, observability with OpenTelemetry, and chat events for analytics.
|
|
32
|
+
- 1c45e8a: With reduced motion, the launcher icon no longer turns as it swaps between chat and close.
|
|
33
|
+
- 8608d69: Starting a new conversation now shows that it is working: the question stays open while the old conversation is deleted, with its icon turning and its buttons waiting. Before, nothing visible happened until the server answered.
|
|
34
|
+
- 8d81c46: The floating chat opens with a livelier animation and now animates out when it closes; the launcher icon turns between chat and close, and phones slide the full-screen chat up. Reduced motion still turns all of it off.
|
|
35
|
+
- eb7b7aa: The chat window is built with Preact 11.2. It looks and works the same.
|
|
36
|
+
|
|
37
|
+
## 0.2.0-rc.3
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 66da550: The README links to askdare.vercel.app/deploy, where the one-click deploy of the starter takes about five minutes.
|
|
42
|
+
- c0c1a7f: docs: the one-click deploy takes about five minutes, and askdare.vercel.app/deploy makes the `CHAT_SECRET` for the Vercel form.
|
|
43
|
+
- 1c45e8a: With reduced motion, the launcher icon no longer turns as it swaps between chat and close.
|
|
44
|
+
|
|
45
|
+
## 0.2.0-rc.2
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- ac878e6: The page can now hear what happens in the chat, for analytics such as GA4 or a GTM `dataLayer`: `askdare('on', type, listener)` with the script tag, or `onEvent` on `Root` in React. Events cover the chat opening and closing, messages sent, answers received, ratings, errors and starting over. They carry metadata only, such as counts, durations and outcomes, and never message text. See the "Chat events" guide (ADR-0013).
|
|
50
|
+
- d789913: The config that `npx @boldare/askdare init` writes now reads three optional environment variables. `ASKDARE_INSTRUCTIONS` and `ASKDARE_GREETING` replace the bot's default instructions and greeting, and `ASKDARE_ALLOWED_ORIGINS` lists the other sites that may embed the chat, comma-separated. Blank values fall back to the defaults, and trailing slashes are dropped from origins. Without the variables the bot behaves as before. The starter's Vercel button asks for the instructions and greeting, and its Heroku `app.json` offers all three.
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- 9540d46: The README's "What you get" picture now shows what 0.2 adds: the chat inside your own page with React, ratings of answers, observability with OpenTelemetry, and chat events for analytics.
|
|
55
|
+
- 8608d69: Starting a new conversation now shows that it is working: the question stays open while the old conversation is deleted, with its icon turning and its buttons waiting. Before, nothing visible happened until the server answered.
|
|
56
|
+
- 8d81c46: The floating chat opens with a livelier animation and now animates out when it closes; the launcher icon turns between chat and close, and phones slide the full-screen chat up. Reduced motion still turns all of it off.
|
|
57
|
+
|
|
3
58
|
## 0.2.0-rc.1
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Dare to ask.** An AI chatbot for any website, served by your Next.js app on the official OpenAI SDK. One route, one script tag, no database.
|
|
6
6
|
|
|
7
|
-
**[Live demo](https://askdare.vercel.app)** · **[Documentation](https://askdare.vercel.app/docs)** · [GitHub](https://github.com/boldare/askdare) · [Changelog](https://github.com/boldare/askdare/blob/main/packages/askdare/CHANGELOG.md)
|
|
7
|
+
**[Live demo](https://askdare.vercel.app)** · **[Deploy in 5 minutes](https://askdare.vercel.app/deploy)** · **[Documentation](https://askdare.vercel.app/docs)** · [GitHub](https://github.com/boldare/askdare) · [Changelog](https://github.com/boldare/askdare/blob/main/packages/askdare/CHANGELOG.md)
|
|
8
8
|
|
|
9
9
|
## Three steps
|
|
10
10
|
|
|
@@ -38,7 +38,7 @@ export const bots = [
|
|
|
38
38
|
|
|
39
39
|
## What you get
|
|
40
40
|
|
|
41
|
-
[](https://askdare.vercel.app/#features)
|
|
42
42
|
|
|
43
43
|
[Knowledge base](https://askdare.vercel.app/docs/knowledge-base) · [Tools](https://askdare.vercel.app/docs/tools) · [Attachments](https://askdare.vercel.app/docs/attachments) · [Voice input](https://askdare.vercel.app/docs/voice-input) · [The chat inside your page (React)](https://askdare.vercel.app/docs/react) · [Answer ratings](https://askdare.vercel.app/docs/feedback) · [Security](https://github.com/boldare/askdare/blob/main/THREAT_MODEL.md)
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ The guides are on [askdare.vercel.app/docs](https://askdare.vercel.app/docs), wi
|
|
|
54
54
|
|
|
55
55
|
- **Start:** [Getting started](https://askdare.vercel.app/docs/getting-started) · [Embedding the chat](https://askdare.vercel.app/docs/embedding) · [Command line](https://askdare.vercel.app/docs/cli)
|
|
56
56
|
- **Look and language:** [Themes](https://askdare.vercel.app/docs/themes) · [Styling](https://askdare.vercel.app/docs/styling) · [Texts](https://askdare.vercel.app/docs/texts) · [The chat inside your page (React)](https://askdare.vercel.app/docs/react)
|
|
57
|
-
- **Going live:** [Deployment](https://askdare.vercel.app/docs/deployment) · [Going-public checklist](https://askdare.vercel.app/docs/going-public) · [Costs](https://askdare.vercel.app/docs/costs) · [Observability](https://askdare.vercel.app/docs/observability) · [Answer ratings](https://askdare.vercel.app/docs/feedback) · [Privacy](https://askdare.vercel.app/docs/privacy)
|
|
57
|
+
- **Going live:** [Deployment](https://askdare.vercel.app/docs/deployment) · [Going-public checklist](https://askdare.vercel.app/docs/going-public) · [Costs](https://askdare.vercel.app/docs/costs) · [Observability](https://askdare.vercel.app/docs/observability) · [Chat events](https://askdare.vercel.app/docs/events) · [Answer ratings](https://askdare.vercel.app/docs/feedback) · [Privacy](https://askdare.vercel.app/docs/privacy)
|
|
58
58
|
- **Reference:** [Configuration](https://askdare.vercel.app/docs/configuration) · [Troubleshooting](https://askdare.vercel.app/docs/troubleshooting) · [Support matrix](https://askdare.vercel.app/docs/support)
|
|
59
59
|
- **AI coding agents:** `llms.txt` and the `askdare` skill ship in the package ([how to use them](https://askdare.vercel.app/docs/getting-started#working-with-an-ai-coding-agent))
|
|
60
60
|
|
package/dist/cli.js
CHANGED
|
@@ -906,24 +906,29 @@ const BOT_ID = /^[a-z0-9][a-z0-9-]{0,47}$/;
|
|
|
906
906
|
function configTemplate(botId) {
|
|
907
907
|
return `import { defineBot } from '@boldare/askdare';
|
|
908
908
|
|
|
909
|
+
// Other sites that may embed the chat, comma-separated, e.g. https://www.example.com.
|
|
910
|
+
const allowedOrigins = (process.env.ASKDARE_ALLOWED_ORIGINS ?? '')
|
|
911
|
+
.split(',')
|
|
912
|
+
.map((origin) => origin.trim().replace(/\\/+$/, ''))
|
|
913
|
+
.filter(Boolean);
|
|
914
|
+
|
|
909
915
|
export const bots = [
|
|
910
916
|
defineBot({
|
|
911
917
|
id: '${botId}',
|
|
912
918
|
// Required: a current OpenAI model your project may use. Set ASKDARE_MODEL in .env.local.
|
|
913
919
|
model: process.env.ASKDARE_MODEL ?? '',
|
|
920
|
+
// Optional ASKDARE_INSTRUCTIONS and ASKDARE_GREETING replace the defaults below. Where they are
|
|
921
|
+
// set, as after a one-click deploy, change them there: they win over this file.
|
|
914
922
|
instructions: ({ locale }) =>
|
|
915
923
|
[
|
|
916
|
-
|
|
917
|
-
|
|
924
|
+
process.env.ASKDARE_INSTRUCTIONS?.trim() ||
|
|
925
|
+
'You are the assistant on our website. Answer briefly and politely. If you do not know something, say so.',
|
|
918
926
|
\`Reply in the language of the visitor's message; default to \${locale}.\`,
|
|
919
|
-
].join('
|
|
920
|
-
security: {
|
|
921
|
-
// Other sites that may embed the chat, e.g. ['https://www.example.com'].
|
|
922
|
-
allowedOrigins: [],
|
|
923
|
-
},
|
|
927
|
+
].join('\\n\\n'),
|
|
928
|
+
security: { allowedOrigins },
|
|
924
929
|
widget: {
|
|
925
930
|
locale: 'auto',
|
|
926
|
-
greeting: 'Hi! How can I help?',
|
|
931
|
+
greeting: process.env.ASKDARE_GREETING?.trim() || 'Hi! How can I help?',
|
|
927
932
|
theme: 'aura', // aura, halo, sage or care
|
|
928
933
|
},
|
|
929
934
|
// Knowledge base, tools, attachments, voice and limits: see node_modules/@boldare/askdare/docs.
|
|
@@ -1088,7 +1093,7 @@ async function init(options) {
|
|
|
1088
1093
|
if (empty.length > 0) steps.push(`In .env.local, set ${empty.join(", ")}.`);
|
|
1089
1094
|
if (script === "manual") steps.push(`Load the chat on your pages, e.g. in the root layout's <body>:\n ${SCRIPT_IMPORT}\n ${scriptTag(botId)}`);
|
|
1090
1095
|
steps.push(`Start the app (${runScript(project, "dev")}), then check it: npx @boldare/askdare doctor`);
|
|
1091
|
-
steps.push(`To embed the chat on another site, add
|
|
1096
|
+
steps.push(`To embed the chat on another site, add it to ASKDARE_ALLOWED_ORIGINS in .env.local (comma-separated) and paste:\n <script src="https://<your app>/api/chat/widget.js?bot=${botId}" async><\/script>`);
|
|
1092
1097
|
print("\nNext:");
|
|
1093
1098
|
steps.forEach((step, index) => {
|
|
1094
1099
|
print(` ${index + 1}. ${step}`);
|