bunnyquery 1.15.4 → 1.16.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/README.md +71 -34
- package/bunnyquery.css +3 -1
- package/bunnyquery.js +27 -44
- package/dist/engine.cjs +4 -4
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +27 -36
- package/dist/engine.d.ts +27 -36
- package/dist/engine.mjs +4 -4
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/config.ts +39 -37
- package/src/engine/index.ts +1 -1
- package/src/engine/requests.ts +4 -4
- package/src/widget.css +3 -1
package/README.md
CHANGED
|
@@ -5,19 +5,30 @@ projects. Drop it into any web page and your users get a full chat experience:
|
|
|
5
5
|
account login/signup, conversation history, file & folder uploads, and a settings
|
|
6
6
|
panel, all talking to your project's **BunnyQuery** AI agent.
|
|
7
7
|
|
|
8
|
-
BunnyQuery is a standalone vanilla-JS port of the
|
|
9
|
-
|
|
8
|
+
BunnyQuery is a standalone vanilla-JS port of the [bunnyquery.com](https://www.bunnyquery.com)
|
|
9
|
+
dashboard chat. The **widget** ships as a single IIFE that exposes `window.BunnyQuery` plus one
|
|
10
10
|
stylesheet. Drop it in via `<script>`, no build step or framework required.
|
|
11
11
|
|
|
12
12
|
The package also exports the **framework-agnostic chat engine** that powers it
|
|
13
|
-
(`bunnyquery/engine`), the same DOM-free core the
|
|
13
|
+
(`bunnyquery/engine`), the same DOM-free core the bunnyquery.com dashboard chat consumes, so
|
|
14
14
|
you can build your own chat UI on top of it. See
|
|
15
15
|
[Importing the chat engine](#importing-the-chat-engine).
|
|
16
16
|
|
|
17
|
+
**Current release: 1.16.0** on [npm](https://www.npmjs.com/package/bunnyquery). The
|
|
18
|
+
release-by-release changelog is [HISTORY.md](HISTORY.md).
|
|
19
|
+
|
|
17
20
|
## Features
|
|
18
21
|
|
|
19
22
|
- **AI chat** against your project's configured agent (Claude or OpenAI under the
|
|
20
|
-
hood), with animated pending indicators and a background indexing queue.
|
|
23
|
+
hood), with animated pending indicators and a background indexing queue. A project
|
|
24
|
+
that never picked a model runs on Claude Haiku 5.5 or GPT-6 Luna.
|
|
25
|
+
- **Live replies**: the answer is painted into its bubble as the model writes it,
|
|
26
|
+
always. A host that owns its skapi instance can also have each piece delivered over
|
|
27
|
+
skapi's websocket the moment it is relayed (`liveStreaming`).
|
|
28
|
+
- **Grounded answers**: the agent answers only from the project's data, says so when
|
|
29
|
+
the data does not have it, and names the file and page an answer came from as
|
|
30
|
+
citation chips under the reply. The open web is off unless the project's owner
|
|
31
|
+
turns it on (`webAccess`).
|
|
21
32
|
- **Authentication**: email/password login, optional signup, password change,
|
|
22
33
|
email verification, account recovery, and "Sign in with Google".
|
|
23
34
|
- **Conversation history**: paginated, with "Fetching history…" indicators on
|
|
@@ -26,14 +37,18 @@ you can build your own chat UI on top of it. See
|
|
|
26
37
|
(uploading / failed / indexed), overflow collapsing for large batches, and a
|
|
27
38
|
prompt when an upload hits a file that already exists (skip / reindex only /
|
|
28
39
|
overwrite, with "apply to all remaining"). Images are read with vision/OCR,
|
|
29
|
-
large documents
|
|
30
|
-
|
|
31
|
-
and
|
|
40
|
+
large documents are read window by window in parallel lanes, spreadsheet rows
|
|
41
|
+
are stored by the server directly, PDF pages are read as text where they have
|
|
42
|
+
a text layer and rendered to page images where they do not, emails are read as
|
|
43
|
+
their headers, body and attachment text, and everything else extractable is
|
|
44
|
+
inlined as text. A file the signed-in user already uploaded (same name, same
|
|
45
|
+
size) is not uploaded or indexed again (`skipDuplicateFiles`). See
|
|
32
46
|
[Supported file types](#supported-file-types).
|
|
33
47
|
- **Background indexing**: an uploaded file is indexed in the background,
|
|
34
48
|
across as many passes as it takes. A file's passes collapse into a single
|
|
35
49
|
status row in the chat that can be expanded, and stopped: "Stop" cancels every
|
|
36
|
-
queued and running pass at once and ends the continuation chain
|
|
50
|
+
queued and running pass at once and ends the continuation chain, and its confirm
|
|
51
|
+
dialog can take every other file being indexed down with it.
|
|
37
52
|
- **Stop waiting**: a reply that is taking too long can be given up on. The
|
|
38
53
|
"Thinking" bubble carries a small x that cancels the running request on the
|
|
39
54
|
server, marks the question as cancelled, and lets the next message go out
|
|
@@ -142,8 +157,7 @@ Mounts the widget. Returns the `BunnyQuery` object.
|
|
|
142
157
|
| `allowAnonymous` | `boolean` | `null` | Open the chat with no login for visitors without an account. `null` follows the project's own "Allow anonymous users" setting (`getConnectionInfo().conf.require_login`); `true`/`false` pins it. |
|
|
143
158
|
| `webAccess` | `boolean` | `null` | Whether the chat's answers may reach the open web (Claude `web_fetch`, OpenAI `web_search`). The project's own **Web access for answers** switch on its Project Settings page (the `web_access` key of the project's `bq::settings` record, **off** unless the owner turned it on) is the **ceiling**, and this option may only restrict below it: `effective = projectSetting && webAccess !== false`. `null` or `true` follows the project; `false` turns the web off for this page whatever the project says; a value above the project setting has no effect. With the web off, answers come only from the project's files and database. Indexing is not affected. |
|
|
144
159
|
| `skipDuplicateFiles` | `boolean` | `null` | Whether a chat attachment the signed-in user **already uploaded** to this project (same stored file name, same size in bytes, same uploader, found from the file's `src::` record) is skipped: it is neither uploaded nor indexed again, the chip reads "already uploaded", and the message uses the stored copy's url. The project's **Skip duplicate files** setting (the `skip_duplicate_files` key of `bq::settings`, **on** unless the owner turned it off) is the **ceiling**, and this option may only restrict below it: `effective = projectSetting && skipDuplicateFiles !== false`. `null` or `true` follows the project; `false` lets this page re-upload duplicates; a value above the project setting has no effect. The check never blocks an upload: a failed lookup uploads as usual. |
|
|
145
|
-
| `liveStreaming` | `boolean` | `
|
|
146
|
-
| `liveStreamingRealtime` | `boolean` | `false` | Deliver streamed chunks over skapi's websocket instead of waiting for the next poll tick. Requires `liveStreaming`. Off unless you ask for it: skapi's `joinRealtime` **replaces** the connection's group, so for the length of a turn it takes the room out from under whatever else your app uses realtime for. Purely an accelerator; with it off the reply still streams, on the poll's cadence. |
|
|
160
|
+
| `liveStreaming` | `boolean` | `false` | Deliver the streamed reply over skapi's websocket as well as the poll, so each piece lands the moment the server relays it instead of on the next one-second poll tick. Streaming itself is not an option: the widget streams every reply whenever the page's `skapi-js` can carry skapi's half of the stream flag (it checks for `forwardRequestStream` and `forwardRequestFinalize`, or their older `clientSecretRequestStream` and `clientSecretRequestFinalize` names), and otherwise warns once and buffers. Off unless you ask for it: skapi's `joinRealtime` **replaces** the connection's group, so for the length of a turn it takes the room out from under whatever else your app uses realtime for. Purely an accelerator; with it off the reply still streams, on the poll's cadence. Before 1.16.0 this key meant "stream at all" and the socket was `liveStreamingRealtime`; that name is now ignored. |
|
|
147
161
|
|
|
148
162
|
### Rebranding the widget
|
|
149
163
|
|
|
@@ -185,7 +199,7 @@ BunnyQuery.logout();
|
|
|
185
199
|
|
|
186
200
|
> `init()` is idempotent: calling it twice logs a warning and returns the existing
|
|
187
201
|
> instance rather than re-mounting. On a successful mount it logs its version, e.g.
|
|
188
|
-
> `[bunnyquery] v1.
|
|
202
|
+
> `[bunnyquery] v1.16.0`.
|
|
189
203
|
|
|
190
204
|
See [HISTORY.md](HISTORY.md) for the release-by-release changelog.
|
|
191
205
|
|
|
@@ -219,27 +233,32 @@ picture** and **reads any text in it (OCR)**. Works on both Claude and OpenAI.
|
|
|
219
233
|
Only images referenced in the **most recent** message are inlined (older links
|
|
220
234
|
may have expired).
|
|
221
235
|
|
|
222
|
-
### 2. PDFs:
|
|
236
|
+
### 2. PDFs: text pages as text, the rest as page images
|
|
223
237
|
|
|
224
238
|
`.pdf`
|
|
225
239
|
|
|
226
|
-
PDF
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
A PDF is read two ways, page by page. A run of pages that carries a text layer
|
|
241
|
+
and no pictures or drawings is read **as text**, fifteen pages per window. Every
|
|
242
|
+
other page (a scan, a photo, a page with figures) is indexed **visually**: the
|
|
243
|
+
proxy worker renders a window of pages to images and injects them as image blocks
|
|
244
|
+
in the indexing message. That window is five pages on Claude and on the OpenAI
|
|
245
|
+
models that accept full-resolution images, and two on OpenAI's downsampled and
|
|
246
|
+
nano tiers. Tool-result images render on neither provider, which is why the pages
|
|
247
|
+
have to be in the message itself. Scanned PDFs work as well as digital ones, and a
|
|
248
|
+
born-digital PDF takes about a third of the passes it used to.
|
|
249
|
+
|
|
250
|
+
The worker advances the windows itself, off its renderer's true page count, and
|
|
251
|
+
reads several windows at once in parallel lanes sized to what the AI platform's
|
|
252
|
+
rate limits allow. Indexing a long document therefore does not depend on the
|
|
253
|
+
browser tab staying open, and does not depend on the model correctly declaring
|
|
254
|
+
itself finished. The verbatim text of every page (the text layer, or the model's
|
|
255
|
+
transcription of a scanned page) is stored with the file, so the agent can later
|
|
256
|
+
search it for an exact phrase or number and cite the page.
|
|
238
257
|
|
|
239
258
|
### 3. Large documents, spreadsheets & data: read window by window
|
|
240
259
|
|
|
241
260
|
```
|
|
242
|
-
.xls .xlsx .xlsm grids:
|
|
261
|
+
.xls .xlsx .xlsm grids: rows stored by the server directly, plus embedded photos
|
|
243
262
|
.ods OpenDocument sheets: character windows, plus photos
|
|
244
263
|
.csv .tsv .tab row-bounded windows with absolute row numbers
|
|
245
264
|
.doc .docx .docm word processor documents
|
|
@@ -268,6 +287,11 @@ the `readFileContent` tool. Pass `windowedIndexing: false` to `init()` to opt
|
|
|
268
287
|
out; engine consumers opt in via `configureChatEngine` (see
|
|
269
288
|
[Importing the chat engine](#importing-the-chat-engine)).
|
|
270
289
|
|
|
290
|
+
Spreadsheet rows take a shorter road still: the server reads the sheet and stores
|
|
291
|
+
one record per row itself, with no model call and no tokens spent on the rows.
|
|
292
|
+
Word, text and e-mail windows are read in parallel lanes like PDF pages, and a
|
|
293
|
+
project indexes up to three documents at once.
|
|
294
|
+
|
|
271
295
|
### 4. Everything else extractable: inlined as text server-side
|
|
272
296
|
|
|
273
297
|
The skapi proxy downloads the file, extracts its text **server-side**, and
|
|
@@ -318,9 +342,12 @@ chat message.
|
|
|
318
342
|
|
|
319
343
|
### 5. Anything else: a plain link
|
|
320
344
|
|
|
321
|
-
A file that is none of the above is handed to the model as a temporary link
|
|
322
|
-
|
|
323
|
-
via `web_search`
|
|
345
|
+
A file that is none of the above is handed to the model as a temporary link. The
|
|
346
|
+
model can open it only with its built-in web tool (**Claude** via `web_fetch`,
|
|
347
|
+
**OpenAI** via `web_search`), and those tools are attached only when the project's
|
|
348
|
+
**Web access for answers** switch is on, which it is not by default. With the web
|
|
349
|
+
off, such a file is indexed from its name and metadata alone; register an
|
|
350
|
+
[attachment parser plugin](#attachment-parser-plugins) to read it in the browser.
|
|
324
351
|
|
|
325
352
|
> A provider's web tool opens document/page-style URLs, but not necessarily a
|
|
326
353
|
> bare *data-file* download (e.g. a raw `.csv`/`.tsv` link). That is why those
|
|
@@ -433,8 +460,8 @@ The active theme is saved to `localStorage`, so a returning user keeps their cho
|
|
|
433
460
|
## Importing the chat engine
|
|
434
461
|
|
|
435
462
|
`bunnyquery.js` is the ready-made widget. Under it sits a **framework-agnostic,
|
|
436
|
-
DOM-free chat engine**, the same core that powers both this widget and the
|
|
437
|
-
|
|
463
|
+
DOM-free chat engine**, the same core that powers both this widget and the
|
|
464
|
+
bunnyquery.com dashboard chat. Import it from `bunnyquery/engine` when you want to build your own chat
|
|
438
465
|
UI (React, Vue, Svelte, vanilla…) while reusing the engine's message/queue/typewriter/
|
|
439
466
|
cache state machine, request builders, markdown-message composition, and prompts.
|
|
440
467
|
|
|
@@ -492,13 +519,12 @@ helpers. See the `.d.ts` shipped with `bunnyquery/engine`.
|
|
|
492
519
|
| `poll` | `number?` | Value attached as `poll` on every request. Omit it if your `forwardRequest` already resolves with the final body; pass `0` for the deployed `skapi-js@latest` (needed for the early ack + a manual `.poll()` handle that powers queued-send cancel, the widget's case). |
|
|
493
520
|
| `attachmentParsers` | `array?` | Client-side attachment parsers, registered at configure time. More can be added later with `registerAttachmentParser()`. See [Attachment parser plugins](#attachment-parser-plugins). |
|
|
494
521
|
| `windowedIndexing` | `boolean?` | Opt in to **server-driven** windowed indexing for text and grid files (see [file types](#supported-file-types)). Off by default in the engine; the widget passes it as `true`. The deployed skapi workers support it; only leave it off against a self-hosted worker that does not yet strip the `_skapi_window` directive, where it would reach the provider as an unknown body field and fail the call terminally with no retry. |
|
|
495
|
-
| `liveStreaming` | `boolean?` | Opt in to **live streaming** of chat turns. Off by default in the engine (the widget passes it as `true`), and the backend ships first: a streamed row settles with a status and NO body (the answer was the stream), so against a worker that does not relay, the turn reads back empty. Pair it with `forwardRequestFinalize` and `forwardRequestStream`, and gate it on `skapiSupportsStreaming(skapi)`. |
|
|
496
522
|
| `webAccess` | `boolean?` | Whether a chat turn may reach the open web: Claude's `web_fetch` and OpenAI's `web_search` are attached to a chat request only when this resolves to `true`. The project's own `web_access` setting (the `bq::settings` record, read through `configureProjectSettings`; **off** unless the project owner turned it on) is the **ceiling** and this option may only restrict below it: `effective = projectSetting && webAccess !== false`. Leave it out or pass `true` to follow the project; `false` turns the web off for your host; a value above the project setting has no effect. `webAccessEnabled(serviceId)` and `resolveWebAccess(serviceId, override?)` answer the resolved switch (sync from the cache, or awaiting the settings fetch; `override` is a per-call host value that restricts the same way). Indexing passes keep their tools regardless. Pass the same value to `buildChatSystemPrompt({ webAccess })` so the prompt matches the tool list. |
|
|
497
523
|
| `skipDuplicateFiles` | `boolean?` | Whether an attachment the signed-in user already uploaded to the project (same stored name, same size, same uploader) is skipped by `ChatSession`'s upload path: not uploaded, not indexed, the turn using the stored copy's url. The project's `skip_duplicate_files` setting (**on** unless the owner turned it off) is the **ceiling** and this option may only restrict: `effective = projectSetting && skipDuplicateFiles !== false`. The check runs only when the host implements the optional `findDuplicateUpload(file)` hook; `findDuplicateUpload(skapi, { name, size }, userId, { service? })` from the barrel is the ready-made implementation (an ends-with `getUniqueId` lookup narrowed to `src::<name>` and `src::.../<name>`, then the first record whose `data.size_bytes` and `user_id` match; it never throws, a failed lookup answers `null` and the file uploads as usual). `skipDuplicateFilesEnabled(serviceId)` and `resolveSkipDuplicateFiles(serviceId)` answer the resolved switch. |
|
|
498
|
-
| `forwardRequestFinalize` | `function?` | `skapi.forwardRequestFinalize`, bound to your Skapi instance. Stores the version of a streamed turn that history keeps (the engine sends the assembled provider body, so it reads back exactly like a buffered turn) and releases that request's chunks. Without it a streamed turn is never finalized and its row stays empty. |
|
|
499
|
-
| `forwardRequestStream` | `function?` | `skapi.forwardRequestStream`, bound to your Skapi instance. The **second half of the durability guarantee**: a row that settles while no poll is attached (closed tab, discarded background tab, slept device) is never finalized, so its answer stays in the chunk store and its history row is terminal and empty. Given the request id this drains that turn's chunks in one pass; the engine parses them exactly as it parses a live stream and finalizes what it read, so each row is recovered at most once. Without it the engine mints no recovery marker at all and
|
|
524
|
+
| `forwardRequestFinalize` | `function?` | `skapi.forwardRequestFinalize`, bound to your Skapi instance. Stores the version of a streamed turn that history keeps (the engine sends the assembled provider body, so it reads back exactly like a buffered turn) and releases that request's chunks. Without it a streamed turn is never finalized and its row stays empty. Together with `forwardRequestStream` it is what turns streaming on. |
|
|
525
|
+
| `forwardRequestStream` | `function?` | `skapi.forwardRequestStream`, bound to your Skapi instance. The **second half of the durability guarantee**: a row that settles while no poll is attached (closed tab, discarded background tab, slept device) is never finalized, so its answer stays in the chunk store and its history row is terminal and empty. Given the request id this drains that turn's chunks in one pass; the engine parses them exactly as it parses a live stream and finalizes what it read, so each row is recovered at most once. Without it the engine mints no recovery marker at all, and without the pair the engine does not stream. |
|
|
500
526
|
| `onLiveStreamUpdate` | `function?` | Observation hook for a streaming turn (`{ serverItemId, ownerKey, phase, text, thinkingText, toolNames, complete, errored }`). The engine already paints the answer text itself, so this is only for affordances it does not decide the presentation of. Never throw from it. |
|
|
501
|
-
| `
|
|
527
|
+
| `liveStreaming` | `boolean?` | Deliver streamed chunks over skapi's websocket as well. Off by default: `joinRealtime` replaces the connection's group for the length of a turn, so only a host that owns its skapi instance should opt in. Streaming itself has no key: the engine streams every chat turn whenever `forwardRequestFinalize` and `forwardRequestStream` are both handed over (`liveStreamingEnabled()`), and a host that wants buffered replies hands over neither. Before 1.16.0 this key meant "stream at all"; `liveStreamingRealtime` is now ignored. |
|
|
502
528
|
| `streamRecovery` | `boolean?` | Set `false` to force the read-back of already-streamed turns **off**, even though the chunk reader is injected. There is no need to set it to turn recovery on: injecting `forwardRequestStream` is what arms it. |
|
|
503
529
|
| `mintIndexDoneMarker` | `function?` | Write the durable "indexing finished" marker (`done::<path>`, reference `src::<path>`, table `__INDEXING__`) for the runs this client knows are complete. Best-effort, must never throw. Without it the engine falls back to inference. |
|
|
504
530
|
| `upsertIndexRunRecord` | `function?` | Create-or-update the per-file run record (`run::<path>`, reference `src::<path>`, table `__INDEXING__`), which is what lets chat rows and files-page badges paint without scanning background history. You implement the upsert (the records API has none) and the status precedence: `'working'` must never overwrite a terminal status. Without it the engine uses the legacy scan/probe path. |
|
|
@@ -529,6 +555,17 @@ widget rather than approximately:
|
|
|
529
555
|
state once a page of history collapses into a single indexing row. Implement
|
|
530
556
|
the optional `ChatHost.onHistoryLoaded` hook, measure your own box, and let
|
|
531
557
|
the loop page until the reader genuinely gained reachable content.
|
|
558
|
+
- **`citationsFor` / `citationLinkPart`** turn the retrieval note the engine keeps
|
|
559
|
+
for a reply (`retrievalNoteOfAnswer`) into the file-and-page citations the
|
|
560
|
+
widget shows under an answer; `answerUsedNoDataTool` says whether a reply read
|
|
561
|
+
no data at all.
|
|
562
|
+
- **`ChatSession.cancelPendingReply(msg, idx)`** is the "stop waiting" control:
|
|
563
|
+
handed the pending assistant bubble, it cancels the running request on the
|
|
564
|
+
server, marks the question cancelled and promotes the next queued message.
|
|
565
|
+
`cancelQueuedMessage` does the same for a message still in the queue.
|
|
566
|
+
- **`findDuplicateUpload`** and the `configureProjectSettings` reader back the
|
|
567
|
+
`skipDuplicateFiles` and `webAccess` switches; see the `configureChatEngine`
|
|
568
|
+
table above.
|
|
532
569
|
|
|
533
570
|
Other optional `ChatHost` hooks worth implementing: `deleteExistingFileRecord`
|
|
534
571
|
(so a reindex replaces the file's knowledge instead of duplicating it) and
|
package/bunnyquery.css
CHANGED
|
@@ -679,7 +679,9 @@
|
|
|
679
679
|
padding: 0.5rem 0 1rem;
|
|
680
680
|
font-size: 0.8rem;
|
|
681
681
|
color: var(--bq-muted);
|
|
682
|
-
|
|
682
|
+
/* a translucent band, not a solid one: the newest rows keep showing through
|
|
683
|
+
while the strip is up (mirrors agent.vue, 2026-10-21) */
|
|
684
|
+
background: linear-gradient(to bottom, color-mix(in srgb, var(--bq-paper) 78%, transparent) 70%, transparent);
|
|
683
685
|
}
|
|
684
686
|
/* initial first-page load: center it in the (empty) messages area. A full-box
|
|
685
687
|
overlay rather than a top strip, so it takes its height back - and it replaces
|
package/bunnyquery.js
CHANGED
|
@@ -204,11 +204,11 @@
|
|
|
204
204
|
function windowedIndexingEnabled() {
|
|
205
205
|
return _config?.windowedIndexing === true;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
return liveStreamingEnabled() && _config?.
|
|
207
|
+
function liveStreamingSocketEnabled() {
|
|
208
|
+
return liveStreamingEnabled() && _config?.liveStreaming === true;
|
|
209
209
|
}
|
|
210
210
|
function liveStreamingEnabled() {
|
|
211
|
-
return
|
|
211
|
+
return typeof resolveForwardRequestFinalize() === "function" && typeof resolveForwardRequestStream() === "function";
|
|
212
212
|
}
|
|
213
213
|
function underCeiling(projectSetting, option, override) {
|
|
214
214
|
if (!projectSetting) return false;
|
|
@@ -2717,7 +2717,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
2717
2717
|
function chatStreamWiring(queue) {
|
|
2718
2718
|
if (!liveStreamingEnabled()) return CHAT_STREAM_OFF;
|
|
2719
2719
|
if (isBgIndexingQueue(queue)) return CHAT_STREAM_OFF;
|
|
2720
|
-
return
|
|
2720
|
+
return liveStreamingSocketEnabled() ? CHAT_STREAM_ON_REALTIME : CHAT_STREAM_ON;
|
|
2721
2721
|
}
|
|
2722
2722
|
var VARIANT_IMAGE_DETAIL = "original";
|
|
2723
2723
|
var VARIANT_TEXT_VERBOSITY = "high";
|
|
@@ -9162,7 +9162,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
9162
9162
|
(function() {
|
|
9163
9163
|
var MCP_PROD = "https://mcp.broadwayinc.computer";
|
|
9164
9164
|
var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
|
|
9165
|
-
var BQ_VERSION = "1.
|
|
9165
|
+
var BQ_VERSION = "1.16.0" ;
|
|
9166
9166
|
var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
|
|
9167
9167
|
var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
9168
9168
|
var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
@@ -13826,25 +13826,20 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
13826
13826
|
// Server-driven windowed indexing; read at configureChatEngine time.
|
|
13827
13827
|
// Listed here so the defaults object is the full opt surface.
|
|
13828
13828
|
windowedIndexing: true,
|
|
13829
|
-
//
|
|
13830
|
-
//
|
|
13831
|
-
//
|
|
13832
|
-
//
|
|
13833
|
-
//
|
|
13834
|
-
//
|
|
13835
|
-
//
|
|
13836
|
-
|
|
13837
|
-
//
|
|
13838
|
-
//
|
|
13839
|
-
//
|
|
13840
|
-
//
|
|
13841
|
-
//
|
|
13842
|
-
|
|
13843
|
-
// simply stop. Only an embedder who knows their app does not use realtime
|
|
13844
|
-
// (or does not mind) can answer that, so only they can turn it on. It is
|
|
13845
|
-
// purely an accelerator: with it off the reply still streams, just on the
|
|
13846
|
-
// poll's cadence rather than as the text is relayed.
|
|
13847
|
-
liveStreamingRealtime: false
|
|
13829
|
+
// Deliver the streamed reply over skapi's WEBSOCKET as well as the poll.
|
|
13830
|
+
// OFF unless the embedder asks, because this widget runs on someone else's
|
|
13831
|
+
// page with someone else's skapi instance: skapi's joinRealtime REPLACES
|
|
13832
|
+
// the connection's group rather than adding to it, so for the length of a
|
|
13833
|
+
// turn this would take the room out from under whatever the host app uses
|
|
13834
|
+
// realtime for, and the host would see its own messages simply stop. Only
|
|
13835
|
+
// an embedder who knows their app does not use realtime (or does not mind)
|
|
13836
|
+
// can answer that, so only they can turn it on. Purely an accelerator: with
|
|
13837
|
+
// it off the reply still streams, on the poll's cadence.
|
|
13838
|
+
// Streaming itself is not an option: the widget streams whenever the page's
|
|
13839
|
+
// skapi-js can (see canStream in init) and buffers, with a warning, when it
|
|
13840
|
+
// cannot. Before 1.16.0 this key meant "stream at all" and the socket was
|
|
13841
|
+
// `liveStreamingRealtime`; that name is now ignored.
|
|
13842
|
+
liveStreaming: false
|
|
13848
13843
|
}, opts || {});
|
|
13849
13844
|
S.mountEl = mountEl;
|
|
13850
13845
|
clear(mountEl);
|
|
@@ -13857,11 +13852,9 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
13857
13852
|
S.booted = true;
|
|
13858
13853
|
console.log("[bunnyquery] v" + BQ_VERSION);
|
|
13859
13854
|
var canStream = skapiSupportsStreaming(S.skapi);
|
|
13860
|
-
|
|
13861
|
-
if (liveStreaming && !canStream) {
|
|
13862
|
-
liveStreaming = false;
|
|
13855
|
+
if (!canStream) {
|
|
13863
13856
|
console.warn(
|
|
13864
|
-
"[bunnyquery]
|
|
13857
|
+
"[bunnyquery] this page's skapi-js has neither forwardRequestStream/forwardRequestFinalize nor the older clientSecretRequestStream/clientSecretRequestFinalize, so skapi's half of the stream flag would be dropped and every reply would read back empty. Replies are buffered - update skapi-js to stream them."
|
|
13865
13858
|
);
|
|
13866
13859
|
}
|
|
13867
13860
|
configureProjectSettings(function(service) {
|
|
@@ -13908,22 +13901,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
13908
13901
|
// passed, and the project's setting is the ceiling the engine applies.
|
|
13909
13902
|
skipDuplicateFiles: typeof S.opts.skipDuplicateFiles === "boolean" ? S.opts.skipDuplicateFiles : void 0,
|
|
13910
13903
|
// ---- live streaming (mirrored in agent.vue's ai_agent.ts) --------
|
|
13911
|
-
//
|
|
13912
|
-
//
|
|
13913
|
-
//
|
|
13914
|
-
//
|
|
13915
|
-
//
|
|
13916
|
-
|
|
13917
|
-
// AND NO BODY on purpose). An embed against such a worker passes
|
|
13918
|
-
// liveStreaming: false. The widget takes it as an init opt because an
|
|
13919
|
-
// embed picks its own region, where agent.vue flips one module constant.
|
|
13920
|
-
// It also needs a skapi-js that supports `stream`/`onStream`, and the
|
|
13921
|
-
// page's pin is the EMBEDDER's, so the request is granted above by
|
|
13922
|
-
// skapiSupportsStreaming rather than taken on trust here.
|
|
13923
|
-
liveStreaming,
|
|
13924
|
-
// Requires liveStreaming, and cannot outlive it: the AND is what stops an
|
|
13925
|
-
// embedder turning on socket delivery for a reply that is not streamed.
|
|
13926
|
-
liveStreamingRealtime: liveStreaming && S.opts.liveStreamingRealtime === true
|
|
13904
|
+
// Streaming itself is not passed: the engine streams whenever the two
|
|
13905
|
+
// hooks below are handed over, which skapiEngineTransport does only when
|
|
13906
|
+
// canStream. What the embedder chooses is the socket: `liveStreaming` here
|
|
13907
|
+
// is the engine's socket-delivery key. ANDed with canStream so a page whose
|
|
13908
|
+
// SDK cannot stream never asks for a socket on a buffered reply.
|
|
13909
|
+
liveStreaming: canStream && S.opts.liveStreaming === true
|
|
13927
13910
|
// The transport: dispatch and history, plus the finalize hook that stores
|
|
13928
13911
|
// a streamed turn's kept version and the chunk reader that is the second
|
|
13929
13912
|
// half of the durability guarantee. The two optional hooks are handed
|
package/dist/engine.cjs
CHANGED
|
@@ -242,11 +242,11 @@ function resolveForwardRequestStream() {
|
|
|
242
242
|
function windowedIndexingEnabled() {
|
|
243
243
|
return _config?.windowedIndexing === true;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
return liveStreamingEnabled() && _config?.
|
|
245
|
+
function liveStreamingSocketEnabled() {
|
|
246
|
+
return liveStreamingEnabled() && _config?.liveStreaming === true;
|
|
247
247
|
}
|
|
248
248
|
function liveStreamingEnabled() {
|
|
249
|
-
return
|
|
249
|
+
return typeof resolveForwardRequestFinalize() === "function" && typeof resolveForwardRequestStream() === "function";
|
|
250
250
|
}
|
|
251
251
|
function underCeiling(projectSetting, option, override) {
|
|
252
252
|
if (!projectSetting) return false;
|
|
@@ -2839,7 +2839,7 @@ var CHAT_STREAM_ON_REALTIME = Object.freeze({
|
|
|
2839
2839
|
function chatStreamWiring(queue) {
|
|
2840
2840
|
if (!liveStreamingEnabled()) return CHAT_STREAM_OFF;
|
|
2841
2841
|
if (isBgIndexingQueue(queue)) return CHAT_STREAM_OFF;
|
|
2842
|
-
return
|
|
2842
|
+
return liveStreamingSocketEnabled() ? CHAT_STREAM_ON_REALTIME : CHAT_STREAM_ON;
|
|
2843
2843
|
}
|
|
2844
2844
|
var VARIANT_IMAGE_DETAIL = "original";
|
|
2845
2845
|
var VARIANT_TEXT_VERBOSITY = "high";
|