bunnyquery 1.20.1 → 1.21.3
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 +67 -10
- package/bunnyquery.css +49 -0
- package/bunnyquery.js +3907 -1555
- package/dist/engine.cjs +3822 -1497
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +1478 -701
- package/dist/engine.d.ts +1478 -701
- package/dist/engine.mjs +3805 -1494
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/citations.ts +12 -0
- package/src/engine/config.ts +91 -15
- package/src/engine/errors.ts +38 -0
- package/src/engine/history.ts +71 -11
- package/src/engine/host.ts +51 -4
- package/src/engine/index.ts +38 -9
- package/src/engine/prompts/chat_system_prompt.ts +3 -3
- package/src/engine/prompts/indexing_system_prompt.ts +3 -3
- package/src/engine/prompts/indexing_user_message.ts +20 -0
- package/src/engine/reconciler.ts +594 -0
- package/src/engine/requests.ts +97 -11
- package/src/engine/retrieval_memory.ts +21 -6
- package/src/engine/session.ts +3600 -1433
- package/src/widget.css +34 -0
- package/styles/chat.css +15 -0
- package/src/engine/findings.ts +0 -305
package/README.md
CHANGED
|
@@ -165,10 +165,11 @@ Mounts the widget. Returns the `BunnyQuery` object.
|
|
|
165
165
|
| `hostDomain` | `string` | `null` | db-CDN host for temporary file URLs. Defaults to `skapi.app` (dev) / `skapi.com` (prod). |
|
|
166
166
|
| `attachmentParsers` | `array` | `null` | Client-side attachment parsers. See [Attachment parser plugins](#attachment-parser-plugins). |
|
|
167
167
|
| `windowedIndexing` | `boolean` | `true` | Server-driven windowed indexing for text and grid files (see [file types](#supported-file-types)). Pass `false` to fall back to agent-driven paging, which keeps the traversal inside the model's turn budget and the tab open. |
|
|
168
|
+
| `workerIndexEndings` | `boolean` | `false` | The worker writes the ending (done marker, run status) of a file read in one pass, such as an image, so closing or opening a page mid-pass cannot leave it 'working' or mark it "the page was closed". Turn on only once the skapi workers in your region carry the 2026-11-25 change. |
|
|
168
169
|
| `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. |
|
|
169
170
|
| `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. |
|
|
170
171
|
| `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, and a stored copy that finished indexing or is still being indexed) 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. A stored copy whose indexing failed or was cancelled is not a duplicate, so the file uploads as usual. The check never blocks an upload: a failed lookup, or one slower than 15 seconds, uploads as usual. |
|
|
171
|
-
| `reuseMcpToolList` | `boolean` | `
|
|
172
|
+
| `reuseMcpToolList` | `boolean` | `true` | OpenAI chat turns only: reuse the MCP tool listing OpenAI returned on an earlier turn of this page, so OpenAI does not fetch it again (about 0.6 s per turn). On unless `false`. Each reused turn's request and stored history row is about 31 to 34 KB larger. See `reuseMcpToolList` under `configureChatEngine`. |
|
|
172
173
|
| `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`), 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. |
|
|
173
174
|
| `statusPush` | `boolean` | `false` | Indexing status over skapi's websocket: each indexing pass asks the server for status messages, its poll then reads once a minute while they arrive and at once when one names it, and the chat re-reads its history when the socket reconnects. Off unless you ask for it, because it keeps a websocket open on your page's skapi instance (your own realtime callback never sees these messages). Needs skapi-js 2.5.0 or newer; with an older one it stays off. Purely an accelerator: every status on screen still comes from reading the request. |
|
|
174
175
|
|
|
@@ -246,6 +247,14 @@ picture** and **reads any text in it (OCR)**. Works on both Claude and OpenAI.
|
|
|
246
247
|
Only images referenced in the **most recent** message are inlined (older links
|
|
247
248
|
may have expired).
|
|
248
249
|
|
|
250
|
+
When an image file is indexed, the model transcribes every character at whatever
|
|
251
|
+
angle it sits and reports how the text is turned (`text_rotation`). With the
|
|
252
|
+
2026-11-25 skapi worker, a photo whose orientation tag or format the AI would
|
|
253
|
+
misread (a sideways phone photo, a `.tif` or `.bmp` scan) goes out as an upright
|
|
254
|
+
converted copy, a photo whose text is still turned gets one second look turned
|
|
255
|
+
upright, and the transcription is stored as the file's page text, so a search for
|
|
256
|
+
a serial or part number finds the photo. This applies to new and re-indexed files.
|
|
257
|
+
|
|
249
258
|
### 2. PDFs: text pages as text, the rest as page images
|
|
250
259
|
|
|
251
260
|
`.pdf`
|
|
@@ -272,7 +281,7 @@ search it for an exact phrase or number and cite the page.
|
|
|
272
281
|
|
|
273
282
|
```
|
|
274
283
|
.xls .xlsx .xlsm grids: rows stored by the server directly, plus embedded photos
|
|
275
|
-
.ods OpenDocument sheets:
|
|
284
|
+
.ods OpenDocument sheets: rows stored by the server, like .xlsx
|
|
276
285
|
.csv .tsv .tab row-bounded windows with absolute row numbers
|
|
277
286
|
.doc .docx .docm word processor documents
|
|
278
287
|
.ppt .pptx .pptm slide decks
|
|
@@ -305,6 +314,12 @@ one record per row itself, with no model call and no tokens spent on the rows.
|
|
|
305
314
|
Word, text and e-mail windows are read in parallel lanes like PDF pages, and a
|
|
306
315
|
project indexes up to three documents at once.
|
|
307
316
|
|
|
317
|
+
A document whose pages are pictures (a scanned `.hwpx`, `.hwp`, `.docx`, `.pptx`,
|
|
318
|
+
`.odt` and so on, with no text or only a title) is read like a scanned PDF: with
|
|
319
|
+
the 2026-11-25 skapi worker, each page-sized picture is shown to the model as a
|
|
320
|
+
page, and its transcription is stored as that page's text. This applies to new and
|
|
321
|
+
re-indexed files.
|
|
322
|
+
|
|
308
323
|
### 4. Everything else extractable: inlined as text server-side
|
|
309
324
|
|
|
310
325
|
The skapi proxy downloads the file, extracts its text **server-side**, and
|
|
@@ -534,9 +549,10 @@ helpers. See the `.d.ts` shipped with `bunnyquery/engine`.
|
|
|
534
549
|
| `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). |
|
|
535
550
|
| `attachmentParsers` | `array?` | Client-side attachment parsers, registered at configure time. More can be added later with `registerAttachmentParser()`. See [Attachment parser plugins](#attachment-parser-plugins). |
|
|
536
551
|
| `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. |
|
|
552
|
+
| `workerIndexEndings` | `boolean?` | The worker writes the done marker and run status of a single-pass indexing file (an image, or any file not rendered, windowed or paged), and the engine no longer marks such a run "Indexing stopped ... (the page was closed)". The engine always sends the request flag (`index_end` on the file's `_skapi_file_urls` entry; older workers ignore it); this switch only stops the client-side "lost" verdict. Off unless `true`: with a worker that predates it, a page closed mid-pass would leave the run 'working'. bunnyquery.com turns it on. |
|
|
537
553
|
| `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. |
|
|
538
554
|
| `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?, timeoutMs? })` from the barrel is the ready-made implementation, and bunnyquery.com uses it too: an ends-with `getUniqueId` lookup narrowed to `src::<name>` and `src::.../<name>`, then the first record whose `data.size_bytes` and `user_id` match AND whose stored copy finished indexing (`done::<path>` exists) or is still being indexed (its `run::<path>` record is `working` and started less than `RUN_RECORD_WORKING_STALE_MS`, 6 hours, ago). The match carries `indexing: 'done' | 'running'`. A copy whose indexing failed or was cancelled is not a match. It never throws and answers within `timeoutMs` (default `DUPLICATE_LOOKUP_TIMEOUT_MS`, 15 seconds): a failed or slow lookup answers `null` and the file uploads as usual. `skipDuplicateFilesEnabled(serviceId)` and `resolveSkipDuplicateFiles(serviceId)` answer the resolved switch. |
|
|
539
|
-
| `reuseMcpToolList` | `boolean?` | OpenAI chat turns sent by `ChatSession` only: keep the `mcp_list_tools` item a response returned and send it in the next turn's `input`, so OpenAI skips the MCP tool handshake (about 0.6 s). **Off** unless `true
|
|
555
|
+
| `reuseMcpToolList` | `boolean?` | OpenAI chat turns sent by `ChatSession` only: keep the `mcp_list_tools` item a response returned and send it in the next turn's `input`, so OpenAI skips the MCP tool handshake (about 0.6 s). **Off** unless `true` (the widget and bunnyquery.com turn it on; verified live on an OpenAI project 2026-11-25). Details and costs under "MCP tool listing reuse" below. |
|
|
540
556
|
| `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. |
|
|
541
557
|
| `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. |
|
|
542
558
|
| `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. |
|
|
@@ -545,11 +561,15 @@ helpers. See the `.d.ts` shipped with `bunnyquery/engine`.
|
|
|
545
561
|
| `onRequestStatus` | `function?` | `skapi.onRequestStatus`, bound to the host's skapi instance (skapi-js 2.5.0+). Required for `statusPush`. |
|
|
546
562
|
| `isRequestStatusLive` | `function?` | `skapi.isRequestStatusLive`, bound to the host's skapi instance (skapi-js 2.5.0+). |
|
|
547
563
|
| `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. |
|
|
548
|
-
| `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. |
|
|
549
|
-
| `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. |
|
|
564
|
+
| `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. May return a promise that rejects when the write failed (not when the marker is already there): the engine then writes it again, up to 5 times. Without it the engine falls back to inference. |
|
|
565
|
+
| `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. May return a promise that rejects when the write failed: the engine then writes it again, up to 5 times. Without it the engine uses the legacy scan/probe path. |
|
|
550
566
|
| `csrHistoryItemLookup` | `function?` | Single-item `csr-poll` point lookup. Used by `ChatSession.hydrateCompactItems` to fetch a compact history stub's real body when an indexing row is expanded, and to settle every indexing pass (each file's first pass and the passes the worker runs in parallel): with it, each 10-second check of the indexing queue lists the finished passes and reads each one once by id, so a pass shows within about 10 seconds of finishing instead of waiting for the passes ahead of it to be polled one at a time. Without it stubs keep their server-extracted heads and indexing passes are polled as before. |
|
|
551
567
|
| `listIndexPasses` | `function?` | `(service, storagePath) => Promise<string[]>`: the request ids of one file's indexing passes, read from the `pass::<storagePath>#<request id>` records the indexing worker writes as each pass starts (`getUniqueId` with the prefix `pass::<storagePath>#`, every page). With it and `csrHistoryItemLookup`, the chat history fetches the conversation only: a file's row comes from its `run::` record, says "Fetching status" until the indexing queue has answered and then Indexing, Queued, Indexed, Indexing failed or Indexing cancelled, and opening the row loads its steps ten at a time with a Load more button. Without it the history pages the indexing queue as before. |
|
|
552
568
|
| `readIndexProgress` | `function?` | `(service, storagePath) => Promise<{ pages_saved, pages_total } \| null>`: reads a document's `prog::<storagePath>` record, which the MCP keeps up to date while the document's pages are saved. Asked by the 10-second check of the indexing queue for files still being indexed; a row then shows "175 of 530 pages" beside its passes. Without it a row shows passes only. |
|
|
569
|
+
| `forwardRequestStatus` | `function?` | `skapi.forwardRequestStatus`, bound to the host's skapi instance (skapi-js 2.7.0+). With it and `forwardRequestRead`, the engine's reconciler follows every waiting chat turn and indexing pass with one batch status read per look (100 ids a call) instead of one poll each, and shows a queued turn running when the server says so. Without them the engine keeps its polls. |
|
|
570
|
+
| `forwardRequestRead` | `function?` | `skapi.forwardRequestRead` (skapi-js 2.7.0+): one request as an envelope that always carries its status. Read once per item that turned terminal; a streamed turn is read from its chunk cursor until `final_seq`, then finalized with `ifAbsent`. |
|
|
571
|
+
| `forwardRequestQueueCounters` | `function?` | `skapi.forwardRequestQueueCounters` (skapi-js 2.7.0+): the tiny counter rows of the queues with waiting items, read on every look; the batch status read runs only when a counter moved, on a trigger (tab shown, wake, online, socket back), or once a minute. Without it every look reads the statuses. |
|
|
572
|
+
| `refreshRecords` | `function?` | `(projectId) => void`: indexing of that project settled and none is left in the page's queue, so a records view should refresh. Called with no chat view too, in one tab only. |
|
|
553
573
|
| `saveSearchFinding` | `function?` | `(finding) => Promise`: saves where a hard chat search found its answer (3+ tool calls, a cited file page) as a record in table `search_findings`: `unique_id` `find::<path>#p<page>`, `reference` `src::<path>` (a re-index removes it), the source file's own access group, and normalized tags from the question's key words and the search terms; when the page already has one, merge the new tags into it. The chat prompt checks these first and then reads the page itself, so a finding is a pointer, never a cached answer. Without it nothing is saved. |
|
|
554
574
|
|
|
555
575
|
**Removed config keys.** `clientSecretRequest`, `clientSecretRequestHistory`,
|
|
@@ -571,12 +591,12 @@ Mythos) and only on chat turns, never on indexing passes. The barrel exports
|
|
|
571
591
|
`normalizeAnswerMode`, `answerModeFrom`, `projectAnswerMode(serviceId)`,
|
|
572
592
|
`resolveAnswerMode(serviceId)` and `chatEffortFields(platform, model, mode)`.
|
|
573
593
|
|
|
574
|
-
**MCP tool listing reuse (OpenAI, off by default).** With `reuseMcpToolList: true` in
|
|
594
|
+
**MCP tool listing reuse (OpenAI, off by default in the engine, on in the widget).** With `reuseMcpToolList: true` in
|
|
575
595
|
`configureChatEngine`, on an OpenAI chat turn sent by `ChatSession` the engine keeps the
|
|
576
596
|
`mcp_list_tools` item the response returned and puts it in the next turn's `input`, right
|
|
577
597
|
after the system message, so OpenAI does not ask the MCP server for its tools again (four
|
|
578
|
-
requests, about 0.6 s).
|
|
579
|
-
|
|
598
|
+
requests, about 0.6 s). Verified on a live OpenAI chat on 2026-11-25: the next turn sent only
|
|
599
|
+
`initialize` before its first tool call. The item is kept in memory only, per exact MCP server URL, signed-in
|
|
580
600
|
or anonymous, project and user; a page reload starts empty. If a turn that carried it
|
|
581
601
|
fails, the entry is dropped and the turn is not retried (its error shows as usual). An
|
|
582
602
|
error that names the item turns reuse off for that project in this browser (localStorage);
|
|
@@ -635,6 +655,41 @@ the user is waiting on keep polling deliberately, so their results still land in
|
|
|
635
655
|
the cache. Server-side work is untouched either way, so pausing drops traffic,
|
|
636
656
|
never progress.
|
|
637
657
|
|
|
658
|
+
**The reconciler.** Everything the chat shows as unfinished (chat turns, indexing
|
|
659
|
+
passes, by request id) is followed by one timer chain per page: every 3 seconds while
|
|
660
|
+
the tab is visible and anything is waiting (once a minute while status messages
|
|
661
|
+
arrive), once a minute while hidden only for an indexing chain the browser drives, and
|
|
662
|
+
at once when the user comes back (tab shown, the computer awake, the network or the
|
|
663
|
+
socket back, the chat reopened). A look that fails on the way changes nothing on screen
|
|
664
|
+
and sets `state.reconnecting` (retried after 1, 2, 4 ... 30 seconds); a lost sign-in sets
|
|
665
|
+
`state.signInNeeded` until `ChatSession.noteSignedIn()`. A send whose answer was lost is
|
|
666
|
+
found by its client reference and never sent twice; one the server never received reads
|
|
667
|
+
"Not sent. Retry?" and `ChatSession.retryNotSent(msg)` sends it again on the user's
|
|
668
|
+
click. Side effects (the next pass of a file, run:: and done:: records, finalize) run in
|
|
669
|
+
one tab (`navigator.locks`), and count as done only when they worked: a failed write is
|
|
670
|
+
tried again (up to 5 times), so `mintIndexDoneMarker` and `upsertIndexRunRecord` should
|
|
671
|
+
return a promise that rejects when the write failed. Opening the chat view is a return:
|
|
672
|
+
the host reads the first page every time the view opens (`loadHistory`), merged by id.
|
|
673
|
+
An indexing chain the browser drives is kept in localStorage until it ends, so a reload
|
|
674
|
+
carries on with its next pass. Hosts tell the engine about a view opening
|
|
675
|
+
(`noteViewOpened()`), passes they push to `bgTaskQueue` (`noteBgQueueChanged()`, right
|
|
676
|
+
after the push) and the files whose run:: record says working
|
|
677
|
+
(`syncFileRuns(projectId, paths, info)`, `info[path] = { owner, filename }` from the
|
|
678
|
+
record, with the optional `ChatHost.recheckFileRuns(projectId, paths)` to re-read those
|
|
679
|
+
records). A run of the signed-in user's own whose browser chain was lost is closed as an
|
|
680
|
+
error once its queue is idle. With
|
|
681
|
+
the batch reads the engine follows `bgTaskQueue` with or without a chat view, so a host's
|
|
682
|
+
own poller of that queue stands down while `ChatSession.followsBackgroundQueue()` is true.
|
|
683
|
+
Items sent under another identity (signed out, another account) are left as they are
|
|
684
|
+
until that user signs in again. Both chat views show those two states in the same words,
|
|
685
|
+
"Reconnecting..." and "Sign in to see the latest answers." (class `bq-chat-status`).
|
|
686
|
+
A page that draws indexing state from the background queue without a chat view (a
|
|
687
|
+
files page) watches it on the same chain: `ChatSession.watchIndexQueue({ identity,
|
|
688
|
+
wantsConfirm, runsOpen, recheckRuns })` reads it at once, on every return, on a status
|
|
689
|
+
message about it, every 8 seconds while it holds work and every 2.5 seconds while the
|
|
690
|
+
page waits for a second look, and puts the answer in `state.indexQueues[projectId]`
|
|
691
|
+
(`stop()` when the page goes). `awaitIndexingDrained` reads the queue the same way.
|
|
692
|
+
|
|
638
693
|
## OAuth & redirects
|
|
639
694
|
|
|
640
695
|
BunnyQuery connects to your AI agent through an MCP OAuth server
|
|
@@ -647,8 +702,10 @@ needed; just make sure the page that hosts the widget is a stable, reachable URL
|
|
|
647
702
|
Once granted, the connection is kept alive **silently**. When the stored grant
|
|
648
703
|
ages out, BunnyQuery refreshes it through the OAuth `refresh_token` flow with no
|
|
649
704
|
redirect, so an embedded widget never yanks the host page away mid-chat. It also
|
|
650
|
-
refreshes on tab focus, because returning to a
|
|
651
|
-
expired would otherwise disconnect the next
|
|
705
|
+
refreshes on tab focus when the grant has aged out, because returning to a
|
|
706
|
+
backgrounded tab after the grant expired would otherwise disconnect the next
|
|
707
|
+
message. Nothing on return waits for that refresh: the chat reads its answers with
|
|
708
|
+
the skapi sign-in alone. The full redirect is only a
|
|
652
709
|
boot-time fallback for when the silent path cannot refresh.
|
|
653
710
|
|
|
654
711
|
## Notes
|
package/bunnyquery.css
CHANGED
|
@@ -696,6 +696,39 @@
|
|
|
696
696
|
padding: 0;
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
+
/* "Reconnecting..." / "Sign in to see the latest answers." between the list and
|
|
700
|
+
the composer. The shared look (text size and colour) is .bq-chat-status in
|
|
701
|
+
styles/chat.css, which comes later in bunnyquery.css and wins over the plain
|
|
702
|
+
fallback here. Widget-only layout: zero height in flow, like the history bar
|
|
703
|
+
above, so the note coming and going never moves the list; its strip overlays
|
|
704
|
+
the bottom of the list instead. */
|
|
705
|
+
.bq-chat-status {
|
|
706
|
+
font-size: 0.75rem;
|
|
707
|
+
color: var(--bq-muted);
|
|
708
|
+
}
|
|
709
|
+
.bq-chat > .bq-chat-status {
|
|
710
|
+
position: relative;
|
|
711
|
+
z-index: 2;
|
|
712
|
+
flex-shrink: 0;
|
|
713
|
+
height: 0;
|
|
714
|
+
margin: 0;
|
|
715
|
+
padding: 0;
|
|
716
|
+
border: 0;
|
|
717
|
+
background: none;
|
|
718
|
+
overflow: visible;
|
|
719
|
+
pointer-events: none;
|
|
720
|
+
}
|
|
721
|
+
.bq-chat > .bq-chat-status[hidden] { display: none; }
|
|
722
|
+
.bq-chat-status-inner {
|
|
723
|
+
position: absolute;
|
|
724
|
+
left: 0;
|
|
725
|
+
right: 0;
|
|
726
|
+
bottom: 0;
|
|
727
|
+
padding: 0.9rem 1.25rem 0.3rem;
|
|
728
|
+
text-align: center;
|
|
729
|
+
background: linear-gradient(to top, color-mix(in srgb, var(--bq-paper) 85%, transparent) 60%, transparent);
|
|
730
|
+
}
|
|
731
|
+
|
|
699
732
|
/* "admin hasn't set up the agent" / disabled overlay */
|
|
700
733
|
.bq-disabled-overlay {
|
|
701
734
|
position: absolute;
|
|
@@ -1084,6 +1117,7 @@
|
|
|
1084
1117
|
@media (max-width: 600px) {
|
|
1085
1118
|
/* .bq-meta { padding: 0.75rem; } */
|
|
1086
1119
|
.bq-input-row { flex-direction: column; padding: 0.65rem 0.75rem 0.75rem; }
|
|
1120
|
+
.bq-chat-status-inner { padding-left: 0.75rem; padding-right: 0.75rem; }
|
|
1087
1121
|
.bq-input-wrap { width: 100%; flex: 0 0 auto; }
|
|
1088
1122
|
.bq-input-row .btn { width: 100%; }
|
|
1089
1123
|
/* `flex-basis: 100%` on these two means FULL WIDTH only while the row is a
|
|
@@ -1258,6 +1292,21 @@
|
|
|
1258
1292
|
font-style: italic;
|
|
1259
1293
|
clear: both;
|
|
1260
1294
|
}
|
|
1295
|
+
/* ---- connection note ----------------------------------------------------*/
|
|
1296
|
+
/* The reconciler's two flags (engine state.reconnecting, state.signInNeeded) as one
|
|
1297
|
+
short line by the composer: "Reconnecting..." or "Sign in to see the latest
|
|
1298
|
+
answers.". The LOOK only, shared by both chat clients; where it sits is each
|
|
1299
|
+
client's own layout (agent.vue: a line of the composer row; the widget: a
|
|
1300
|
+
zero-height strip over the bottom of the list, widget.css). Never a colour that
|
|
1301
|
+
reads as an error: nothing on screen is wrong, it is only not being refreshed
|
|
1302
|
+
right now. */
|
|
1303
|
+
.bq-chat-status {
|
|
1304
|
+
font-size: 0.7rem;
|
|
1305
|
+
font-style: italic;
|
|
1306
|
+
line-height: 1.3;
|
|
1307
|
+
text-align: center;
|
|
1308
|
+
color: var(--bq-muted);
|
|
1309
|
+
}
|
|
1261
1310
|
/* ---- citations + the no-source mark -------------------------------------*/
|
|
1262
1311
|
/* Under an answer that read something: one chip per cited file (and page, in
|
|
1263
1312
|
the label only). The chips are the ordinary stored-file link chips
|