@boldare/askdare 0.2.0-rc.1 → 0.2.0-rc.2

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @boldare/askdare
2
2
 
3
+ ## 0.2.0-rc.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 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).
8
+ - 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.
9
+
10
+ ### Patch Changes
11
+
12
+ - 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.
13
+ - 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.
14
+ - 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.
15
+
3
16
  ## 0.2.0-rc.1
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -38,7 +38,7 @@ export const bots = [
38
38
 
39
39
  ## What you get
40
40
 
41
- [![What it does: answers from your documents with citations, your own tools, images and PDFs, voice input, secure by default, and no database.](https://raw.githubusercontent.com/boldare/askdare/main/.github/assets/askdare-features.png)](https://askdare.vercel.app/#features)
41
+ [![What it does: answers from your documents with citations, your own tools, images and PDFs, voice input, and secure by default. New in 0.2: the chat inside your own page with React, thumbs-up and thumbs-down ratings of answers, observability with OpenTelemetry, and chat events for analytics. No database.](https://raw.githubusercontent.com/boldare/askdare/main/.github/assets/askdare-features.png)](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
- 'You are the assistant on our website. Answer briefly and politely.',
917
- 'If you do not know something, say so.',
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 that site to allowedOrigins and paste:\n <script src="https://<your app>/api/chat/widget.js?bot=${botId}" async><\/script>`);
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}`);