@syntrologie/adapt-chatbot 2.8.0-canary.25 → 2.8.0-canary.250

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.
Files changed (44) hide show
  1. package/dist/ChatAssistantLit.d.ts +58 -0
  2. package/dist/ChatAssistantLit.d.ts.map +1 -0
  3. package/dist/ChatAssistantLit.js +10 -0
  4. package/dist/ChatAssistantLit.js.map +7 -0
  5. package/dist/cdn.d.ts +2 -6
  6. package/dist/cdn.d.ts.map +1 -1
  7. package/dist/chunk-MHK4WRSD.js +10987 -0
  8. package/dist/chunk-MHK4WRSD.js.map +7 -0
  9. package/dist/chunk-UVKRO5ER.js +13 -0
  10. package/dist/chunk-UVKRO5ER.js.map +7 -0
  11. package/dist/editor-lit.d.ts +37 -0
  12. package/dist/editor-lit.d.ts.map +1 -0
  13. package/dist/editor-lit.js +134 -0
  14. package/dist/editor-lit.js.map +7 -0
  15. package/dist/runtime-lit.d.ts +8 -0
  16. package/dist/runtime-lit.d.ts.map +1 -0
  17. package/dist/runtime.d.ts +1 -3
  18. package/dist/runtime.d.ts.map +1 -1
  19. package/dist/runtime.js +29 -30
  20. package/dist/runtime.js.map +7 -0
  21. package/dist/schema.d.ts +105 -7
  22. package/dist/schema.d.ts.map +1 -1
  23. package/dist/schema.js +68 -31
  24. package/dist/schema.js.map +7 -0
  25. package/dist/types.d.ts +17 -29
  26. package/dist/types.d.ts.map +1 -1
  27. package/package.json +37 -19
  28. package/dist/ChatAssistant.d.ts +0 -18
  29. package/dist/ChatAssistant.d.ts.map +0 -1
  30. package/dist/ChatAssistant.js +0 -178
  31. package/dist/actionParser.d.ts +0 -15
  32. package/dist/actionParser.d.ts.map +0 -1
  33. package/dist/actionParser.js +0 -52
  34. package/dist/apiClient.d.ts +0 -23
  35. package/dist/apiClient.d.ts.map +0 -1
  36. package/dist/apiClient.js +0 -51
  37. package/dist/cdn.js +0 -37
  38. package/dist/editor.d.ts +0 -17
  39. package/dist/editor.d.ts.map +0 -1
  40. package/dist/editor.js +0 -36
  41. package/dist/types.js +0 -6
  42. package/dist/useChat.d.ts +0 -25
  43. package/dist/useChat.d.ts.map +0 -1
  44. package/dist/useChat.js +0 -106
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Adaptive Chatbot — Lit Mountable
3
+ *
4
+ * Thin wrapper that mounts <syntro-chat> from @syntrologie/chat with an
5
+ * AgUiTransport pointed at the adaptive AG-UI streaming endpoint.
6
+ *
7
+ * Four pieces this mountable owns:
8
+ *
9
+ * 1. SDK token plumbing. The chat backend (`/api/adaptive/*`) is identified
10
+ * by the workspace's `syn_*` SDK token. The token lives on
11
+ * `window.__SYNTRO_CONFIG__.token` (set by runtime-config.js) — we read
12
+ * it at mount time and forward it via `Authorization: Bearer` header.
13
+ *
14
+ * 2. Cloudflare Turnstile bot-check token. When `TURNSTILE_SITEKEY` is set
15
+ * (hardcoded at the top of this file — operator updates after running
16
+ * terraform apply on cloudflare/turnstile in the infra repo), the
17
+ * widget dynamically loads Cloudflare's Turnstile JS, renders an
18
+ * invisible widget, and acquires a token before the first message.
19
+ * The token is forwarded via `CF-Turnstile-Token` header.
20
+ * If sitekey is empty (default), this step is skipped entirely.
21
+ *
22
+ * 3. Fallback card. If the first agent run fails (Cloudflare Turnstile
23
+ * bot-check failure, CORS / network error, or a server-side rejection),
24
+ * swap the chat UI for a per-customer fallback card built from
25
+ * `props.fallback`. The end-user is redirected to the customer's normal
26
+ * support path instead of seeing a raw error.
27
+ *
28
+ * 4. A2UI passthrough. AG-UI CUSTOM events carrying A2UI payloads
29
+ * (createSurface, updateDataModel, …) get forwarded to
30
+ * `runtime.actions.applyBatch` so tiles can render server-driven UI
31
+ * inside the chat surface.
32
+ */
33
+ import '@syntrologie/chat';
34
+ import type { ChatbotConfig, ChatbotWidgetRuntime } from './types.js';
35
+ export interface ChatAssistantLitProps {
36
+ config: ChatbotConfig;
37
+ runtime: ChatbotWidgetRuntime;
38
+ tileId?: string;
39
+ }
40
+ /**
41
+ * Acquire a Cloudflare Turnstile token. Returns null when:
42
+ * • TURNSTILE_SITEKEY is empty (Turnstile disabled at build time)
43
+ * • the script fails to load (customer CSP blocks Cloudflare, etc.)
44
+ * • the render callback doesn't fire within TURNSTILE_ACQUIRE_TIMEOUT_MS
45
+ * • Cloudflare returns an error-callback (e.g., rate-limited, bad sitekey)
46
+ *
47
+ * When null is returned, the widget proceeds WITHOUT a Turnstile token.
48
+ * If backend enforcement is on, the request 403s and the fallback card
49
+ * renders via the existing failure-detection path. If enforcement is off,
50
+ * the request succeeds.
51
+ *
52
+ * Exported for tests; the production code path goes through `mount()`.
53
+ */
54
+ export declare function acquireTurnstileToken(): Promise<string | null>;
55
+ export declare const ChatAssistantLitMountable: {
56
+ mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
57
+ };
58
+ //# sourceMappingURL=ChatAssistantLit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatAssistantLit.d.ts","sourceRoot":"","sources":["../src/ChatAssistantLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,aAAa,EAAmB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqGD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkDpE;AAiGD,eAAO,MAAM,yBAAyB;qBACnB,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CA6JpE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import {
2
+ ChatAssistantLitMountable,
3
+ acquireTurnstileToken
4
+ } from "./chunk-MHK4WRSD.js";
5
+ import "./chunk-UVKRO5ER.js";
6
+ export {
7
+ ChatAssistantLitMountable,
8
+ acquireTurnstileToken
9
+ };
10
+ //# sourceMappingURL=ChatAssistantLit.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/dist/cdn.d.ts CHANGED
@@ -4,11 +4,7 @@
4
4
  * This module is bundled for CDN delivery and self-registers with the global
5
5
  * SynOS app registry when loaded dynamically via the AppLoader.
6
6
  */
7
- import ChatbotEditor from './editor';
8
- /**
9
- * App manifest for registry registration.
10
- * Follows the AppManifest interface expected by AppLoader/AppRegistry.
11
- */
7
+ import { ChatbotEditorLit } from './editor-lit';
12
8
  export declare const manifest: {
13
9
  id: string;
14
10
  version: string;
@@ -29,7 +25,7 @@ export declare const manifest: {
29
25
  }[];
30
26
  };
31
27
  editor: {
32
- component: typeof ChatbotEditor;
28
+ component: typeof ChatbotEditorLit;
33
29
  panel: {
34
30
  title: string;
35
31
  icon: string;
package/dist/cdn.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,aAA8B,MAAM,UAAU,CAAC;AAGtD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAapB,CAAC;AAaF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBpB,CAAC;AAaF,eAAe,QAAQ,CAAC"}