@syntrologie/adapt-chatbot 2.25.1 → 2.26.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/dist/ChatAssistantLit.d.ts +41 -4
- package/dist/ChatAssistantLit.d.ts.map +1 -1
- package/dist/ChatAssistantLit.js +6 -4
- package/dist/chunk-O7RWNUVU.js +11000 -0
- package/dist/chunk-O7RWNUVU.js.map +7 -0
- package/dist/{chunk-V6TY7KAL.js → chunk-UVKRO5ER.js} +6 -1
- package/dist/editor-lit.js +1 -1
- package/dist/runtime.js +2 -2
- package/dist/schema.d.ts +98 -10
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +43 -4
- package/dist/schema.js.map +2 -2
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-FI7F22ED.js +0 -3331
- package/dist/chunk-FI7F22ED.js.map +0 -7
- /package/dist/{chunk-V6TY7KAL.js.map → chunk-UVKRO5ER.js.map} +0 -0
|
@@ -2,11 +2,33 @@
|
|
|
2
2
|
* Adaptive Chatbot — Lit Mountable
|
|
3
3
|
*
|
|
4
4
|
* Thin wrapper that mounts <syntro-chat> from @syntrologie/chat with an
|
|
5
|
-
*
|
|
5
|
+
* AgUiTransport pointed at the adaptive AG-UI streaming endpoint.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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.
|
|
10
32
|
*/
|
|
11
33
|
import '@syntrologie/chat';
|
|
12
34
|
import type { ChatbotConfig, ChatbotWidgetRuntime } from './types.js';
|
|
@@ -15,6 +37,21 @@ export interface ChatAssistantLitProps {
|
|
|
15
37
|
runtime: ChatbotWidgetRuntime;
|
|
16
38
|
tileId?: string;
|
|
17
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>;
|
|
18
55
|
export declare const ChatAssistantLitMountable: {
|
|
19
56
|
mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
|
|
20
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatAssistantLit.d.ts","sourceRoot":"","sources":["../src/ChatAssistantLit.ts"],"names":[],"mappings":"AAAA
|
|
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;CA2LpE,CAAC"}
|
package/dist/ChatAssistantLit.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ChatAssistantLitMountable
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
ChatAssistantLitMountable,
|
|
3
|
+
acquireTurnstileToken
|
|
4
|
+
} from "./chunk-O7RWNUVU.js";
|
|
5
|
+
import "./chunk-UVKRO5ER.js";
|
|
5
6
|
export {
|
|
6
|
-
ChatAssistantLitMountable
|
|
7
|
+
ChatAssistantLitMountable,
|
|
8
|
+
acquireTurnstileToken
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=ChatAssistantLit.js.map
|