shadok-ai 0.20.56 → 0.20.58

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/README.md CHANGED
@@ -1098,6 +1098,59 @@ from the phone's *Linked devices* list too.
1098
1098
  reconnects. The same happens when a stored session finds no library at boot,
1099
1099
  because nothing is ever installed without an admin's click.
1100
1100
 
1101
+ ### Web widget (optional): a chat box on your site, one agent per visitor
1102
+
1103
+ A website adds one script tag; a chat box appears; a visitor who writes in it
1104
+ gets an agent of their own in an **External** group of this instance — the
1105
+ WhatsApp door's idea, for the plain web. Customer support on a public site, or
1106
+ an assistant inside a product.
1107
+
1108
+ **Set it up** from the External group's settings (the gear beside the group):
1109
+ *Add a web widget*, pick the profile visitors' agents run on, list the sites
1110
+ allowed to show the box, switch it on, and paste the snippet on the site:
1111
+
1112
+ ```html
1113
+ <script async src="https://your-cockpit.example/widget.js?id=wg_…"></script>
1114
+ ```
1115
+
1116
+ An instance holds as many widgets as you create. Several may open into one
1117
+ group, and then share its ceiling.
1118
+
1119
+ **Who a visitor is.** Anonymous, and recognised by their browser: the
1120
+ conversation continues on that browser and that site, nowhere else. The site
1121
+ may pass a little context before the box opens —
1122
+
1123
+ ```js
1124
+ window.shadokWidget = { context: { email: "ada@example.org", name: "Ada", plan: "team" } };
1125
+ ```
1126
+
1127
+ — which is handed to the agent as what the site **claims**, never as an
1128
+ identity: a value in a page's JavaScript proves nothing.
1129
+
1130
+ **What it costs, and its limits.** Nothing is created until the visitor sends
1131
+ a first message; then their conversation gets its own system account, like any
1132
+ conversation of an External group. Each widget has a ceiling — conversations
1133
+ held at once (200), new ones per hour (30), new ones per hour from one address
1134
+ (3) — and a refused visitor is told to come back later. Listing a site stops
1135
+ other sites from showing the box; it does not stop a program from writing to
1136
+ it, which is what the ceiling is for. There is no captcha: a program that
1137
+ changes address can fill an hour's allowance.
1138
+
1139
+ **What a visitor sees and can do.** The agent's answers, and a question the
1140
+ agent asks on purpose (as buttons). Never a tool call, never what a member
1141
+ types to the agent from the cockpit, and never a permission prompt — those are
1142
+ declined for them. A message that starts with a command name reaches the agent
1143
+ as text. No attachments yet.
1144
+
1145
+ **What the box cannot reach.** It is served by the cockpit's own host, so its
1146
+ page is sandboxed into an origin of its own: no cockpit cookie, no cockpit
1147
+ storage, and a socket that is not the cockpit's. The visitor's token is kept
1148
+ by the site's page — so a script running on that site can read that visitor's
1149
+ conversation, the same trust the site already has over what they type there.
1150
+
1151
+ Needs the multi-tenant deployment (External groups do), and HTTPS on the sites
1152
+ that embed it.
1153
+
1101
1154
  ### Running in Docker
1102
1155
 
1103
1156
  > Putting one instance online for someone else, on its own machine, behind a
@@ -0,0 +1,252 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="robots" content="noindex">
7
+ <title>Chat</title>
8
+ <style nonce="__CSP_NONCE__">
9
+ :root { --accent: #2b6cb0; --ink: #1a202c; --soft: #f1f3f5; --line: #dfe3e8; --mute: #6b7280; }
10
+ * { box-sizing: border-box; }
11
+ html, body { height: 100%; margin: 0; }
12
+ body { display: flex; flex-direction: column; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: #fff; }
13
+ header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--accent); color: #fff; font-weight: 600; }
14
+ header span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
15
+ header button { border: 0; background: transparent; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
16
+ #log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
17
+ .msg { max-width: 86%; padding: 8px 12px; border-radius: 14px; overflow-wrap: anywhere; }
18
+ .msg.me { align-self: flex-end; background: var(--accent); color: #fff; white-space: pre-wrap; border-bottom-right-radius: 4px; }
19
+ .msg.them { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
20
+ .msg.them > :first-child { margin-top: 0; }
21
+ .msg.them > :last-child { margin-bottom: 0; }
22
+ .msg.them pre { overflow-x: auto; background: #e6e9ed; padding: 8px; border-radius: 8px; }
23
+ .msg.them code { font-size: 13px; }
24
+ .msg.them a { color: var(--accent); }
25
+ .note { align-self: center; max-width: 90%; text-align: center; color: var(--mute); font-size: 13px; }
26
+ .dots { align-self: flex-start; color: var(--mute); letter-spacing: 3px; }
27
+ .ask { align-self: stretch; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
28
+ .ask p { margin: 0 0 4px; font-weight: 600; white-space: pre-wrap; }
29
+ .ask button, .ask label { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; font: inherit; cursor: pointer; }
30
+ .ask button:hover { border-color: var(--accent); }
31
+ .ask .go { align-self: flex-end; background: var(--accent); color: #fff; border-color: var(--accent); }
32
+ .ask input[type=text] { width: 100%; margin-top: 6px; }
33
+ #composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
34
+ textarea, input[type=text] { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 16px; }
35
+ textarea:focus, input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
36
+ #composer button { border: 0; border-radius: 10px; padding: 0 14px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
37
+ #composer button:disabled { opacity: .5; cursor: default; }
38
+ </style>
39
+ </head>
40
+ <body>
41
+ <header><span id="title">Chat</span><button type="button" id="close" aria-label="Close">&times;</button></header>
42
+ <div id="log" role="log" aria-live="polite"></div>
43
+ <div id="composer"><textarea id="box" rows="1" maxlength="4000" placeholder="Type a message…" aria-label="Message"></textarea><button type="button" id="send">Send</button></div>
44
+ <script nonce="__CSP_NONCE__" src="/widget/vendor/purify.js?v=__ASSET_V__"></script>
45
+ <script nonce="__CSP_NONCE__" src="/widget/vendor/marked.js?v=__ASSET_V__"></script>
46
+ <script nonce="__CSP_NONCE__">
47
+ (function () {
48
+ "use strict";
49
+ var WIDGET = "__WIDGET_ID__";
50
+ var TICKET = "__WIDGET_TICKET__";
51
+ var SOCKET = "__WIDGET_WS__";
52
+ var ORIGINS = __WIDGET_ORIGINS__;
53
+ var $ = function (id) { return document.getElementById(id); };
54
+ var log = $("log"), box = $("box"), send = $("send");
55
+ var parentOrigin = null, token = null, context = null, page = null;
56
+ var ws = null, ready = false, busy = false, dots = null, ask = null, retry = 0, over = false, started = false;
57
+
58
+ function toParent(msg) {
59
+ msg.shadokWidget = 1;
60
+ // Before the handshake the parent's origin is unknown and an opaque frame
61
+ // cannot name itself either: only a contentless hello goes out to "*".
62
+ window.parent.postMessage(msg, parentOrigin || "*");
63
+ }
64
+ function scroll() { log.scrollTop = log.scrollHeight; }
65
+ function add(cls, fill) {
66
+ var el = document.createElement("div");
67
+ el.className = cls;
68
+ fill(el);
69
+ log.insertBefore(el, dots && dots.parentNode === log ? dots : null);
70
+ scroll();
71
+ return el;
72
+ }
73
+ function mine(text) { add("msg me", function (el) { el.textContent = text; }); }
74
+ function theirs(markdown) {
75
+ add("msg them", function (el) {
76
+ // The agent's Markdown derives from whatever it read: sanitised, or shown
77
+ // as plain text when the sanitiser did not load. Never raw HTML.
78
+ if (window.DOMPurify && window.marked) {
79
+ el.innerHTML = window.DOMPurify.sanitize(window.marked.parse(markdown), { FORBID_TAGS: ["style", "form", "input", "button", "iframe"], FORBID_ATTR: ["style"] });
80
+ var links = el.querySelectorAll("a[href]");
81
+ for (var i = 0; i < links.length; i++) { links[i].target = "_blank"; links[i].rel = "noopener noreferrer"; }
82
+ } else el.textContent = markdown;
83
+ });
84
+ }
85
+ function note(text) { add("note", function (el) { el.textContent = text; }); }
86
+ function working(on) {
87
+ busy = on;
88
+ send.disabled = on || !ready || over;
89
+ if (on && !dots) { dots = document.createElement("div"); dots.className = "dots"; dots.textContent = "•••"; log.appendChild(dots); scroll(); }
90
+ if (!on && dots) { dots.remove(); dots = null; }
91
+ }
92
+ function clearAsk() { if (ask) { ask.remove(); ask = null; } }
93
+ function answer(payload) { payload.type = "answer"; ws.send(JSON.stringify(payload)); clearAsk(); working(true); }
94
+ function showAsk(m) {
95
+ clearAsk();
96
+ working(false);
97
+ send.disabled = true;
98
+ ask = add("ask", function (el) {
99
+ var q = document.createElement("p");
100
+ q.textContent = m.question || "";
101
+ el.appendChild(q);
102
+ var picked = {};
103
+ (m.options || []).forEach(function (o) {
104
+ if (o.text) {
105
+ var wrap = document.createElement("label");
106
+ wrap.textContent = o.label;
107
+ var input = document.createElement("input");
108
+ input.type = "text";
109
+ input.maxLength = 1000;
110
+ input.addEventListener("keydown", function (e) {
111
+ if (e.key === "Enter" && input.value.trim()) { e.preventDefault(); answer({ n: o.n, text: input.value.trim() }); }
112
+ });
113
+ wrap.appendChild(input);
114
+ el.appendChild(wrap);
115
+ return;
116
+ }
117
+ if (m.multi) {
118
+ var lab = document.createElement("label");
119
+ var cb = document.createElement("input");
120
+ cb.type = "checkbox";
121
+ cb.addEventListener("change", function () { picked[o.n] = cb.checked; });
122
+ lab.appendChild(cb);
123
+ lab.appendChild(document.createTextNode(" " + o.label));
124
+ el.appendChild(lab);
125
+ return;
126
+ }
127
+ var b = document.createElement("button");
128
+ b.type = "button";
129
+ b.textContent = o.label;
130
+ b.addEventListener("click", function () { answer({ n: o.n }); });
131
+ el.appendChild(b);
132
+ });
133
+ if (m.multi) {
134
+ var go = document.createElement("button");
135
+ go.type = "button";
136
+ go.className = "go";
137
+ go.textContent = "Send";
138
+ go.addEventListener("click", function () {
139
+ answer({ ns: Object.keys(picked).filter(function (k) { return picked[k]; }).map(Number) });
140
+ });
141
+ el.appendChild(go);
142
+ }
143
+ });
144
+ }
145
+ function closedForGood(text) {
146
+ over = true;
147
+ ready = false;
148
+ send.disabled = true;
149
+ box.disabled = true;
150
+ if (text) note(text);
151
+ }
152
+
153
+ function connect() {
154
+ if (over) return;
155
+ ws = new WebSocket(SOCKET);
156
+ ws.addEventListener("open", function () {
157
+ ws.send(JSON.stringify({ type: "hello", widget: WIDGET, ticket: TICKET, token: token || undefined }));
158
+ });
159
+ ws.addEventListener("message", function (e) {
160
+ var m;
161
+ try { m = JSON.parse(e.data); } catch (x) { return; }
162
+ switch (m.type) {
163
+ case "ready":
164
+ ready = true;
165
+ retry = 0;
166
+ send.disabled = busy;
167
+ if (m.title) { $("title").textContent = m.title; document.title = m.title; }
168
+ if (m.placeholder) box.placeholder = m.placeholder;
169
+ if (m.accent) document.documentElement.style.setProperty("--accent", m.accent);
170
+ if (!started) { started = true; if (m.welcome) theirs(m.welcome); }
171
+ break;
172
+ case "token":
173
+ token = m.token;
174
+ toParent({ type: "token", token: m.token });
175
+ break;
176
+ case "history":
177
+ // A reconnect replays what is already on screen: drawn once.
178
+ if (log.querySelector(".msg.me")) break;
179
+ (m.turns || []).forEach(function (t) { if (t.role === "visitor") mine(t.text); else theirs(t.text); });
180
+ break;
181
+ case "working": working(true); break;
182
+ case "text": theirs(m.markdown || ""); toParent({ type: "unread" }); break;
183
+ case "echo": mine(m.text || ""); break;
184
+ case "done": working(false); clearAsk(); break;
185
+ case "dialog": showAsk(m); toParent({ type: "unread" }); break;
186
+ case "notice": note(m.text || ""); break;
187
+ case "reload": reloadOnce(); break;
188
+ case "closed": closedForGood("This chat is not available right now."); break;
189
+ }
190
+ });
191
+ ws.addEventListener("close", function () {
192
+ ready = false;
193
+ working(false);
194
+ send.disabled = true;
195
+ if (over) return;
196
+ retry = Math.min(retry + 1, 6);
197
+ setTimeout(connect, 1000 * Math.pow(2, retry - 1));
198
+ });
199
+ }
200
+ // The ticket this page carries expired or was issued to another address: a
201
+ // reload gets a fresh one. Counted in the fragment (no storage here), so a
202
+ // server that keeps refusing cannot spin the frame for ever.
203
+ function reloadOnce() {
204
+ var n = parseInt((location.hash.match(/r=(\d+)/) || [])[1] || "0", 10);
205
+ if (n >= 3) return closedForGood("This chat is not available right now.");
206
+ over = true;
207
+ location.hash = "r=" + (n + 1);
208
+ location.reload();
209
+ }
210
+
211
+ // Not a form element: the sandbox has no `allow-forms`, and a sandboxed frame does
212
+ // not even dispatch `submit` — the message would silently never leave.
213
+ function submitMessage() {
214
+ var text = box.value.trim();
215
+ if (!text || !ready || busy || over) return;
216
+ var msg = { type: "message", text: text };
217
+ if (context || page) {
218
+ msg.context = {};
219
+ for (var k in context || {}) msg.context[k] = context[k];
220
+ if (page) msg.context.page = page;
221
+ }
222
+ ws.send(JSON.stringify(msg));
223
+ mine(text);
224
+ box.value = "";
225
+ working(true);
226
+ }
227
+ send.addEventListener("click", submitMessage);
228
+ box.addEventListener("keydown", function (e) {
229
+ if (e.key === "Enter" && !e.shiftKey && !e.isComposing) { e.preventDefault(); submitMessage(); }
230
+ });
231
+ $("close").addEventListener("click", function () { toParent({ type: "close" }); });
232
+
233
+ window.addEventListener("message", function (e) {
234
+ // Only the page that embeds us, and only if it is one of the widget's sites.
235
+ if (e.source !== window.parent || ORIGINS.indexOf(e.origin) < 0) return;
236
+ var m = e.data;
237
+ if (!m || m.shadokWidget !== 1) return;
238
+ if (m.type === "init") {
239
+ parentOrigin = e.origin;
240
+ if (typeof m.token === "string") token = m.token;
241
+ if (m.context && typeof m.context === "object") context = m.context;
242
+ if (typeof m.page === "string") page = m.page;
243
+ if (!ws) connect();
244
+ } else if (m.type === "context" && m.context && typeof m.context === "object") context = m.context;
245
+ else if (m.type === "shown") box.focus();
246
+ });
247
+ send.disabled = true;
248
+ toParent({ type: "hello" });
249
+ })();
250
+ </script>
251
+ </body>
252
+ </html>
@@ -0,0 +1,100 @@
1
+ /* shadok-ai web widget loader. Served by the instance as /widget.js?id=<widget>.
2
+ * Draws a launcher button and, on first open, the chat frame. Keeps the
3
+ * visitor's token in THIS page's storage (the frame has no storage of its own)
4
+ * and hands it to the frame once, in answer to its hello. */
5
+ (function () {
6
+ "use strict";
7
+ var ID = "__WIDGET_ID__";
8
+ var BASE = "__WIDGET_BASE__";
9
+ var ACCENT = "__WIDGET_ACCENT__";
10
+ var TITLE = "__WIDGET_TITLE__";
11
+ if (window.__shadokWidgetLoaded) return;
12
+ window.__shadokWidgetLoaded = true;
13
+ var KEY = "shadok-widget:" + ID;
14
+ var api = (window.shadokWidget = window.shadokWidget || {});
15
+ var context = clean(api.context);
16
+ var frame = null, panel = null, open = false, badge = null;
17
+
18
+ function clean(c) {
19
+ var out = {}, n = 0;
20
+ if (!c || typeof c !== "object") return null;
21
+ for (var k in c) if (typeof c[k] === "string" && /^[a-zA-Z0-9_]{1,32}$/.test(k) && n++ < 10) out[k] = c[k].slice(0, 200);
22
+ return n ? out : null;
23
+ }
24
+ function stored() { try { return window.localStorage.getItem(KEY); } catch (e) { return null; } }
25
+ function store(t) { try { window.localStorage.setItem(KEY, t); } catch (e) { /* private mode: this visit only */ } }
26
+ function post(msg) {
27
+ if (!frame || !frame.contentWindow) return;
28
+ msg.shadokWidget = 1;
29
+ // The frame's origin is opaque by design and cannot be named.
30
+ frame.contentWindow.postMessage(msg, "*");
31
+ }
32
+ function css(el, rules) { for (var k in rules) el.style[k] = rules[k]; return el; }
33
+ function narrow() { return window.innerWidth < 480; }
34
+ function place() {
35
+ if (!panel) return;
36
+ if (narrow()) css(panel, { right: "0", bottom: "0", width: "100%", height: "100%", borderRadius: "0" });
37
+ else css(panel, { right: "20px", bottom: "88px", width: "380px", height: "min(600px, calc(100% - 110px))", borderRadius: "14px" });
38
+ }
39
+ function build() {
40
+ panel = css(document.createElement("div"), {
41
+ position: "fixed", zIndex: "2147483000", background: "#fff", overflow: "hidden",
42
+ boxShadow: "0 12px 40px rgba(0,0,0,.25)", display: "none",
43
+ });
44
+ frame = css(document.createElement("iframe"), { width: "100%", height: "100%", border: "0" });
45
+ frame.title = TITLE;
46
+ frame.src = BASE + "/widget/frame?w=" + encodeURIComponent(ID);
47
+ panel.appendChild(frame);
48
+ document.body.appendChild(panel);
49
+ place();
50
+ }
51
+ function show(on) {
52
+ open = on;
53
+ if (on && !panel) build();
54
+ if (panel) panel.style.display = on ? "block" : "none";
55
+ if (on) { badge.style.display = "none"; post({ type: "shown" }); }
56
+ }
57
+ api.open = function () { show(true); };
58
+ api.close = function () { show(false); };
59
+ api.setContext = function (c) { context = clean(c); post({ type: "context", context: context || {} }); };
60
+
61
+ window.addEventListener("message", function (e) {
62
+ if (!frame || e.source !== frame.contentWindow) return;
63
+ var m = e.data;
64
+ if (!m || m.shadokWidget !== 1) return;
65
+ if (m.type === "hello") post({ type: "init", token: stored(), context: context, page: location.href.slice(0, 200) });
66
+ else if (m.type === "token" && typeof m.token === "string") store(m.token);
67
+ else if (m.type === "close") show(false);
68
+ else if (m.type === "unread" && !open) badge.style.display = "block";
69
+ });
70
+ window.addEventListener("resize", place);
71
+
72
+ function start() {
73
+ var button = css(document.createElement("button"), {
74
+ position: "fixed", right: "20px", bottom: "20px", zIndex: "2147483000", width: "56px", height: "56px",
75
+ borderRadius: "50%", border: "0", background: ACCENT, color: "#fff", cursor: "pointer",
76
+ boxShadow: "0 6px 20px rgba(0,0,0,.25)", padding: "0",
77
+ });
78
+ button.type = "button";
79
+ button.setAttribute("aria-label", TITLE);
80
+ var ns = "http://www.w3.org/2000/svg";
81
+ var svg = document.createElementNS(ns, "svg");
82
+ svg.setAttribute("viewBox", "0 0 24 24");
83
+ svg.setAttribute("width", "26");
84
+ svg.setAttribute("height", "26");
85
+ var path = document.createElementNS(ns, "path");
86
+ path.setAttribute("fill", "currentColor");
87
+ path.setAttribute("d", "M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z");
88
+ svg.appendChild(path);
89
+ button.appendChild(svg);
90
+ badge = css(document.createElement("span"), {
91
+ position: "absolute", top: "2px", right: "2px", width: "14px", height: "14px", borderRadius: "50%",
92
+ background: "#e53e3e", border: "2px solid #fff", display: "none",
93
+ });
94
+ button.appendChild(badge);
95
+ button.addEventListener("click", function () { show(!open); });
96
+ document.body.appendChild(button);
97
+ }
98
+ if (document.body) start();
99
+ else document.addEventListener("DOMContentLoaded", start);
100
+ })();
@@ -70,6 +70,8 @@ export declare function agentAccountName(sessionId: string): string;
70
70
  * door's configuration: an admin who re-points a door at another group must not
71
71
  * silently un-box the conversations that are already running.
72
72
  *
73
+ * - a web binding (a website visitor, through a widget) is always a guest's,
74
+ * for the reason a WhatsApp one is.
73
75
  * - a WhatsApp binding is always a guest's. That transport has no owner and no
74
76
  * operator side: "every DM is a guest's, including the admin's own".
75
77
  * - a Telegram binding is a guest's when it is a DM (`threadId` absent and a
@@ -96,6 +98,10 @@ export declare function guestConversationOf(ch: {
96
98
  account: string;
97
99
  id: string;
98
100
  } | null;
101
+ web?: {
102
+ widget: string;
103
+ visitor: string;
104
+ } | null;
99
105
  conversation?: string | null;
100
106
  } | null | undefined, dmOwner: number | null): string | null;
101
107
  /**
@@ -43,6 +43,8 @@ export function agentAccountName(sessionId) {
43
43
  * door's configuration: an admin who re-points a door at another group must not
44
44
  * silently un-box the conversations that are already running.
45
45
  *
46
+ * - a web binding (a website visitor, through a widget) is always a guest's,
47
+ * for the reason a WhatsApp one is.
46
48
  * - a WhatsApp binding is always a guest's. That transport has no owner and no
47
49
  * operator side: "every DM is a guest's, including the admin's own".
48
50
  * - a Telegram binding is a guest's when it is a DM (`threadId` absent and a
@@ -67,6 +69,11 @@ export function guestConversationOf(ch, dmOwner) {
67
69
  return `ag:${ch.conversation}`;
68
70
  if (ch.whatsapp)
69
71
  return `wa:${ch.whatsapp.account}:${ch.whatsapp.id}`;
72
+ // A web binding is always a guest's, like a WhatsApp one: the widget has no
73
+ // owner and no operator side. Any binding at all boxes — a malformed one
74
+ // included, since un-boxing a stranger is the direction that costs a wall.
75
+ if (ch.web)
76
+ return `web:${ch.web.widget}:${ch.web.visitor}`;
70
77
  const tg = ch.telegram;
71
78
  if (!tg || tg.threadId != null || !(tg.chatId > 0))
72
79
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"agent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CAAC;AAED;sEACsE;AACtE,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClF,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/C,CAAC"}
@@ -2,6 +2,7 @@ import { isCronPrompt } from "./crons.js";
2
2
  import { isWebhookPrompt } from "./webhooks.js";
3
3
  import { isAgentPrompt } from "./kinship.js";
4
4
  import { stripPromptMeta, parsePromptMeta, hasPromptMeta, markPromptMeta } from "./promptmeta.js";
5
+ import { stripContextBlock } from "./web-guests.js";
5
6
  import { stripLedgerBlock, hasLedgerBlock } from "./ledger.js";
6
7
  /** What a neutralised line is prefixed with. A visible backslash rather than an
7
8
  * invisible character: the agent and the person replaying it both see that
@@ -105,9 +106,13 @@ export function classifyUserLine(e) {
105
106
  // but FIRST recover who spoke, so a replayed Telegram message shows its
106
107
  // sender instead of the generic "pilot".
107
108
  const meta = parsePromptMeta(bare);
109
+ // A website visitor's prompt may carry, right under the header, what the
110
+ // site claimed about them. It is the agent's to read and not part of what
111
+ // the visitor wrote, so it goes too — only there, and only when well formed.
112
+ const shown = stripPromptMeta(bare);
108
113
  return {
109
114
  kind: "prompt",
110
- text: stripPromptMeta(bare),
115
+ text: meta?.platform === "widget" ? stripContextBlock(shown) : shown,
111
116
  ...(meta?.who ? { from: meta.who } : {}),
112
117
  ...(meta?.platform ? { origin: meta.platform } : {}),
113
118
  };
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-kind.js","sourceRoot":"","sources":["../src/prompt-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,E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