bunnyquery 1.19.1 → 1.19.2

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
@@ -159,6 +159,7 @@ Mounts the widget. Returns the `BunnyQuery` object.
159
159
  | `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. |
160
160
  | `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. |
161
161
  | `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. |
162
+ | `reuseMcpToolList` | `boolean` | `false` | 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). Off unless `true`. Each reused turn's request and stored history row is about 31 to 34 KB larger. See `reuseMcpToolList` under `configureChatEngine`. |
162
163
  | `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. |
163
164
 
164
165
  ### Rebranding the widget
@@ -523,6 +524,7 @@ helpers. See the `.d.ts` shipped with `bunnyquery/engine`.
523
524
  | `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. |
524
525
  | `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. |
525
526
  | `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. |
527
+ | `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`; turn it on after one live OpenAI chat on a dev project has answered with it on. Details and costs under "MCP tool listing reuse" below. |
526
528
  | `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. |
527
529
  | `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. |
528
530
  | `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. |
@@ -542,6 +544,35 @@ from skapi-js 2.1.0 or newer instead. A host that injects only the old keys gets
542
544
  "No request transport" error naming the keys to use. The engine sends the secret's name as
543
545
  `secretName`, and every request names the project it runs against in `service` and `owner`.
544
546
 
547
+ **Answer mode.** A project may set how long the model thinks before a chat answer: the
548
+ `answer_mode` key of its `bq::settings` record (read through `configureProjectSettings`,
549
+ labelled **Answer mode** on the dashboard). `'fast'` sends effort `low` and `'thorough'`
550
+ sends effort `high` (OpenAI `reasoning.effort`, Claude `output_config.effort`). Absent, or
551
+ any other value, is **Standard**: nothing is added and the request is the same as before
552
+ the setting existed. The field is sent only to models known to accept it (OpenAI gpt-5.4
553
+ and newer; Claude Opus 4.5 and newer, Sonnet 4.6 and newer, Haiku 5.5 and newer, Fable,
554
+ Mythos) and only on chat turns, never on indexing passes. The barrel exports
555
+ `ANSWER_MODES`, `ANSWER_MODE_OPTIONS` (value, label, hint), `ANSWER_MODE_SETTING_LABEL`,
556
+ `normalizeAnswerMode`, `answerModeFrom`, `projectAnswerMode(serviceId)`,
557
+ `resolveAnswerMode(serviceId)` and `chatEffortFields(platform, model, mode)`.
558
+
559
+ **MCP tool listing reuse (OpenAI, off by default).** With `reuseMcpToolList: true` in
560
+ `configureChatEngine`, on an OpenAI chat turn sent by `ChatSession` the engine keeps the
561
+ `mcp_list_tools` item the response returned and puts it in the next turn's `input`, right
562
+ after the system message, so OpenAI does not ask the MCP server for its tools again (four
563
+ requests, about 0.6 s). Leave it off until one real OpenAI chat on a dev project has
564
+ answered with it on. The item is kept in memory only, per exact MCP server URL, signed-in
565
+ or anonymous, project and user; a page reload starts empty. If a turn that carried it
566
+ fails, the entry is dropped and the turn is not retried (its error shows as usual). An
567
+ error that names the item turns reuse off for that project in this browser (localStorage);
568
+ another malformed-request error (400, 422, `invalid_request_error`) turns it off for the
569
+ page; a rate limit, provider 5xx or network error drops only the entry. A listing that
570
+ contains `$CLIENT_SECRET`, `$ACCESS_TOKEN` or `$ID_TOKEN` is never stored (the server
571
+ substitutes those literals in request data). Cost when on: each reused turn's request body
572
+ and stored history row is about 31 to 34 KB larger, and history pages return it. Claude
573
+ turns, indexing passes, and direct calls to `callOpenAIWithPublicMcp` without its last
574
+ `turn` argument are not affected.
575
+
545
576
  ### Display and paging helpers
546
577
 
547
578
  Two shared transforms exist so that a second chat UI behaves identically to the