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/package.json
CHANGED
package/src/engine/config.ts
CHANGED
|
@@ -206,38 +206,29 @@ export interface ChatEngineConfig {
|
|
|
206
206
|
};
|
|
207
207
|
}) => void;
|
|
208
208
|
/**
|
|
209
|
-
*
|
|
209
|
+
* Deliver each relayed chunk over skapi's WEBSOCKET as well, so text lands as it
|
|
210
|
+
* is relayed instead of on the next poll tick. Off unless a host asks.
|
|
210
211
|
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* `
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* readers expect a parsed document, and the turn reads back as an empty
|
|
218
|
-
* answer. So it stays off until the worker is deployed, then flips per
|
|
219
|
-
* environment.
|
|
212
|
+
* Streaming itself is not a choice any more: the engine streams every chat turn
|
|
213
|
+
* whenever the host handed over the two streaming hooks below
|
|
214
|
+
* (`forwardRequestFinalize` and `forwardRequestStream`, or their deprecated
|
|
215
|
+
* names), and a host that wants buffered replies simply hands over neither. See
|
|
216
|
+
* liveStreamingEnabled(). This key only decides the TRANSPORT of a stream that is
|
|
217
|
+
* on anyway, so a host with no streaming hooks gets nothing from setting it.
|
|
220
218
|
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* history load shows the question with an empty answer.
|
|
225
|
-
*/
|
|
226
|
-
liveStreaming?: boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Also push each relayed chunk over skapi's websocket, so text lands as it is
|
|
229
|
-
* relayed instead of on the next poll tick. Requires `liveStreaming`.
|
|
230
|
-
*
|
|
231
|
-
* SEPARATE FROM `liveStreaming` ON PURPOSE, and off unless a host asks. It is a
|
|
232
|
-
* pure accelerator with a safe fallback, so the reason is not risk to the chat, it
|
|
233
|
-
* is what it does to the HOST'S OWN realtime: skapi's joinRealtime REPLACES the
|
|
219
|
+
* Off by default on purpose, and the reason is not risk to the chat (the socket
|
|
220
|
+
* is a pure accelerator with a safe fallback: the poll carries the read), it is
|
|
221
|
+
* what it does to the HOST'S OWN realtime. skapi's joinRealtime REPLACES the
|
|
234
222
|
* connection's group rather than adding to it, so for the length of a turn this
|
|
235
223
|
* takes the room. The dashboard owns its skapi instance and uses realtime for
|
|
236
224
|
* nothing else, so it opts in. The embeddable widget is handed the EMBEDDER'S
|
|
237
225
|
* instance and cannot know what their app does with it, so it stays off there
|
|
238
226
|
* unless the embedder turns it on.
|
|
227
|
+
*
|
|
228
|
+
* Until 1.16.0 this key meant "stream at all" and the socket was
|
|
229
|
+
* `liveStreamingRealtime`; that name is now ignored.
|
|
239
230
|
*/
|
|
240
|
-
|
|
231
|
+
liveStreaming?: boolean;
|
|
241
232
|
/**
|
|
242
233
|
* Whether a CHAT answer may reach the open web: Claude's `web_fetch` and
|
|
243
234
|
* OpenAI's `web_search` are attached to a chat request only when this
|
|
@@ -486,12 +477,23 @@ export function windowedIndexingEnabled(): boolean {
|
|
|
486
477
|
}
|
|
487
478
|
|
|
488
479
|
/** True when the consumer has opted in to live streaming of chat turns. */
|
|
489
|
-
|
|
490
|
-
|
|
480
|
+
/** Socket delivery of the stream: the host asked (`liveStreaming`) AND the turn streams. */
|
|
481
|
+
export function liveStreamingSocketEnabled(): boolean {
|
|
482
|
+
return liveStreamingEnabled() && _config?.liveStreaming === true;
|
|
491
483
|
}
|
|
492
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Does this host stream chat turns? Yes whenever it handed over BOTH streaming hooks
|
|
487
|
+
* (the finalize that stores a streamed answer onto its row, and the chunk reader),
|
|
488
|
+
* under either spelling. There is no separate switch: streaming is how the engine
|
|
489
|
+
* reads a reply, and the two hooks are the capability it needs (skapiSupportsStreaming
|
|
490
|
+
* explains why those two methods ARE the capability). A host that wants buffered
|
|
491
|
+
* replies hands over neither, which is also what both clients do when the page's
|
|
492
|
+
* skapi-js is too old to carry skapi's half of the stream flag.
|
|
493
|
+
*/
|
|
493
494
|
export function liveStreamingEnabled(): boolean {
|
|
494
|
-
return
|
|
495
|
+
return typeof resolveForwardRequestFinalize() === 'function'
|
|
496
|
+
&& typeof resolveForwardRequestStream() === 'function';
|
|
495
497
|
}
|
|
496
498
|
|
|
497
499
|
/**
|
|
@@ -565,17 +567,17 @@ export function resolveSkipDuplicateFiles(service?: string): Promise<boolean> {
|
|
|
565
567
|
/**
|
|
566
568
|
* True when a streamed turn whose answer never reached its row can be READ BACK.
|
|
567
569
|
*
|
|
568
|
-
* IT ASKS FOR THE READER
|
|
569
|
-
* POINT. "Should NEW turns stream?" and "can an ALREADY streamed row be recovered?"
|
|
570
|
+
* IT ASKS FOR THE READER ALONE, NOT FOR WHETHER NEW TURNS STREAM, AND THAT SPLIT IS
|
|
571
|
+
* THE WHOLE POINT. "Should NEW turns stream?" and "can an ALREADY streamed row be recovered?"
|
|
570
572
|
* are two different questions about two different sets of rows, and answering both
|
|
571
573
|
* with one flag strands the second set the moment the first answer changes.
|
|
572
574
|
*
|
|
573
575
|
* The failure, and it is not hypothetical - it is what turning the feature off
|
|
574
576
|
* does. A row streamed yesterday holds its answer in the chunk table and a status
|
|
575
|
-
* and no body on the row; only csr-finalize ever copies one onto it.
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
577
|
+
* and no body on the row; only csr-finalize ever copies one onto it. Take
|
|
578
|
+
* streaming away today (a host stops handing over the finalize hook, a client's
|
|
579
|
+
* skapiSupportsStreaming probe degrades the instance to buffered) and every one of
|
|
580
|
+
* those rows instantly becomes unmarked,
|
|
579
581
|
* unrecoverable and unreadable: the mapper emits no bubble for it, the recovery
|
|
580
582
|
* never looks at it, and its answer is unreachable with every byte of it still
|
|
581
583
|
* stored. Rolling a rendering flag back must not delete anybody's history.
|
|
@@ -606,8 +608,8 @@ export function streamRecoveryEnabled(): boolean {
|
|
|
606
608
|
|
|
607
609
|
/**
|
|
608
610
|
* Does a given skapi INSTANCE support the streaming half of the protocol? Ask this
|
|
609
|
-
* before
|
|
610
|
-
* answer is no.
|
|
611
|
+
* before handing the engine the two streaming hooks, and hand over neither (buffered
|
|
612
|
+
* replies) when the answer is no.
|
|
611
613
|
*
|
|
612
614
|
* THE FAILURE THIS PREVENTS, and it is the one the SDK's own docs call quiet. A
|
|
613
615
|
* streamed turn carries TWO `stream` flags: skapi's (relay the destination's bytes
|
|
@@ -626,8 +628,8 @@ export function streamRecoveryEnabled(): boolean {
|
|
|
626
628
|
* It lives in the ENGINE rather than in each client because the two clients are
|
|
627
629
|
* diffed against each other and this is precisely the kind of predicate that forks:
|
|
628
630
|
* the widget must ask it (init() takes the EMBEDDER's instance, and an embed page
|
|
629
|
-
* pins its own skapi-js version, so
|
|
630
|
-
*
|
|
631
|
+
* pins its own skapi-js version, so streaming is granted by this probe and never
|
|
632
|
+
* assumed) and agent.vue must ask it too (its instance is the repo's own, so
|
|
631
633
|
* only a stale node_modules or an unbuilt skapi-js can fail it - which is exactly
|
|
632
634
|
* the state a dev flipping the constant is most likely to be in, and a silently
|
|
633
635
|
* empty chat is the worst possible way to find out).
|
package/src/engine/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ export {
|
|
|
24
24
|
// empty bubble where it used to get none, which is strictly worse than the bug.
|
|
25
25
|
streamRecoveryEnabled,
|
|
26
26
|
// Whether a given skapi INSTANCE can carry skapi's half of the stream flag. Both
|
|
27
|
-
// clients gate
|
|
27
|
+
// clients gate the streaming hooks they hand over on it and degrade to buffered when it
|
|
28
28
|
// says no: an SDK too old to know the key drops it silently, leaving the
|
|
29
29
|
// destination streaming SSE into a buffered row that reads back empty.
|
|
30
30
|
skapiSupportsStreaming,
|
package/src/engine/requests.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { buildIndexingSystemPrompt, buildIndexingUserMessage, buildIndexingContinueMessage, buildIndexingRenderMessage, buildIndexingRenderContinueTemplate, buildIndexingWindowMessage } from './prompts';
|
|
18
18
|
import { isServerExtractable, isPagedReadFile, isImageVisionFile, isWindowedReadFile, makeExtractPlaceholder, makeRenderPlaceholder, makeWindowPlaceholder, RENDER_PAGES_PER_WINDOW, type ExtractDirective, type FileUrlDirective } from './office';
|
|
19
|
-
import { chatEngineConfig, resolveForwardRequest, resolveForwardRequestHistory, pollOpt, windowedIndexingEnabled, liveStreamingEnabled,
|
|
19
|
+
import { chatEngineConfig, resolveForwardRequest, resolveForwardRequestHistory, pollOpt, windowedIndexingEnabled, liveStreamingEnabled, liveStreamingSocketEnabled, resolveWebAccess } from './config';
|
|
20
20
|
// Output sizing lives in budget.ts so the request cap and the reserve the input
|
|
21
21
|
// budget subtracts cannot drift; getMaxOutputTokens also clamps per model.
|
|
22
22
|
import { getMaxOutputTokens, getModelContextWindow } from './budget';
|
|
@@ -228,7 +228,7 @@ const CHAT_STREAM_OFF: ChatStreamWiring = Object.freeze({
|
|
|
228
228
|
}) as ChatStreamWiring;
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
|
-
* Both stream flags for a CHAT turn,
|
|
231
|
+
* Both stream flags for a CHAT turn, on whenever the host handed over the streaming hooks.
|
|
232
232
|
*
|
|
233
233
|
* Chat turns only. Deliberately NOT called from:
|
|
234
234
|
* * the model LISTING calls (listClaudeModels / listOpenAIModels) - plain GETs
|
|
@@ -258,9 +258,9 @@ export function chatStreamWiring(queue?: string): ChatStreamWiring {
|
|
|
258
258
|
if (!liveStreamingEnabled()) return CHAT_STREAM_OFF;
|
|
259
259
|
if (isBgIndexingQueue(queue)) return CHAT_STREAM_OFF;
|
|
260
260
|
// Socket delivery is a separate opt-in from streaming itself: see
|
|
261
|
-
//
|
|
261
|
+
// the `liveStreaming` key in config.ts for why a host that does not own its skapi instance
|
|
262
262
|
// should leave it off.
|
|
263
|
-
return
|
|
263
|
+
return liveStreamingSocketEnabled() ? CHAT_STREAM_ON_REALTIME : CHAT_STREAM_ON;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
// Resolve the per-image `detail` for OpenAI. The version match tolerates a
|
package/src/widget.css
CHANGED
|
@@ -674,7 +674,9 @@
|
|
|
674
674
|
padding: 0.5rem 0 1rem;
|
|
675
675
|
font-size: 0.8rem;
|
|
676
676
|
color: var(--bq-muted);
|
|
677
|
-
|
|
677
|
+
/* a translucent band, not a solid one: the newest rows keep showing through
|
|
678
|
+
while the strip is up (mirrors agent.vue, 2026-10-21) */
|
|
679
|
+
background: linear-gradient(to bottom, color-mix(in srgb, var(--bq-paper) 78%, transparent) 70%, transparent);
|
|
678
680
|
}
|
|
679
681
|
/* initial first-page load: center it in the (empty) messages area. A full-box
|
|
680
682
|
overlay rather than a top strip, so it takes its height back - and it replaces
|