bunnyquery 1.15.5 → 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.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/dist/engine.d.mts
CHANGED
|
@@ -254,38 +254,29 @@ interface ChatEngineConfig {
|
|
|
254
254
|
};
|
|
255
255
|
}) => void;
|
|
256
256
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* is
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* `clientSecretRequestFinalize`): without it a streamed turn is never
|
|
271
|
-
* finalized, so its row keeps a status and no body forever and a later
|
|
272
|
-
* history load shows the question with an empty answer.
|
|
273
|
-
*/
|
|
274
|
-
liveStreaming?: boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Also push each relayed chunk over skapi's websocket, so text lands as it is
|
|
277
|
-
* relayed instead of on the next poll tick. Requires `liveStreaming`.
|
|
278
|
-
*
|
|
279
|
-
* SEPARATE FROM `liveStreaming` ON PURPOSE, and off unless a host asks. It is a
|
|
280
|
-
* pure accelerator with a safe fallback, so the reason is not risk to the chat, it
|
|
281
|
-
* is what it does to the HOST'S OWN realtime: skapi's joinRealtime REPLACES the
|
|
257
|
+
* Deliver each relayed chunk over skapi's WEBSOCKET as well, so text lands as it
|
|
258
|
+
* is relayed instead of on the next poll tick. Off unless a host asks.
|
|
259
|
+
*
|
|
260
|
+
* Streaming itself is not a choice any more: the engine streams every chat turn
|
|
261
|
+
* whenever the host handed over the two streaming hooks below
|
|
262
|
+
* (`forwardRequestFinalize` and `forwardRequestStream`, or their deprecated
|
|
263
|
+
* names), and a host that wants buffered replies simply hands over neither. See
|
|
264
|
+
* liveStreamingEnabled(). This key only decides the TRANSPORT of a stream that is
|
|
265
|
+
* on anyway, so a host with no streaming hooks gets nothing from setting it.
|
|
266
|
+
*
|
|
267
|
+
* Off by default on purpose, and the reason is not risk to the chat (the socket
|
|
268
|
+
* is a pure accelerator with a safe fallback: the poll carries the read), it is
|
|
269
|
+
* what it does to the HOST'S OWN realtime. skapi's joinRealtime REPLACES the
|
|
282
270
|
* connection's group rather than adding to it, so for the length of a turn this
|
|
283
271
|
* takes the room. The dashboard owns its skapi instance and uses realtime for
|
|
284
272
|
* nothing else, so it opts in. The embeddable widget is handed the EMBEDDER'S
|
|
285
273
|
* instance and cannot know what their app does with it, so it stays off there
|
|
286
274
|
* unless the embedder turns it on.
|
|
275
|
+
*
|
|
276
|
+
* Until 1.16.0 this key meant "stream at all" and the socket was
|
|
277
|
+
* `liveStreamingRealtime`; that name is now ignored.
|
|
287
278
|
*/
|
|
288
|
-
|
|
279
|
+
liveStreaming?: boolean;
|
|
289
280
|
/**
|
|
290
281
|
* Whether a CHAT answer may reach the open web: Claude's `web_fetch` and
|
|
291
282
|
* OpenAI's `web_search` are attached to a chat request only when this
|
|
@@ -443,17 +434,17 @@ declare function resolveSkipDuplicateFiles(service?: string): Promise<boolean>;
|
|
|
443
434
|
/**
|
|
444
435
|
* True when a streamed turn whose answer never reached its row can be READ BACK.
|
|
445
436
|
*
|
|
446
|
-
* IT ASKS FOR THE READER
|
|
447
|
-
* POINT. "Should NEW turns stream?" and "can an ALREADY streamed row be recovered?"
|
|
437
|
+
* IT ASKS FOR THE READER ALONE, NOT FOR WHETHER NEW TURNS STREAM, AND THAT SPLIT IS
|
|
438
|
+
* THE WHOLE POINT. "Should NEW turns stream?" and "can an ALREADY streamed row be recovered?"
|
|
448
439
|
* are two different questions about two different sets of rows, and answering both
|
|
449
440
|
* with one flag strands the second set the moment the first answer changes.
|
|
450
441
|
*
|
|
451
442
|
* The failure, and it is not hypothetical - it is what turning the feature off
|
|
452
443
|
* does. A row streamed yesterday holds its answer in the chunk table and a status
|
|
453
|
-
* and no body on the row; only csr-finalize ever copies one onto it.
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
444
|
+
* and no body on the row; only csr-finalize ever copies one onto it. Take
|
|
445
|
+
* streaming away today (a host stops handing over the finalize hook, a client's
|
|
446
|
+
* skapiSupportsStreaming probe degrades the instance to buffered) and every one of
|
|
447
|
+
* those rows instantly becomes unmarked,
|
|
457
448
|
* unrecoverable and unreadable: the mapper emits no bubble for it, the recovery
|
|
458
449
|
* never looks at it, and its answer is unreachable with every byte of it still
|
|
459
450
|
* stored. Rolling a rendering flag back must not delete anybody's history.
|
|
@@ -478,8 +469,8 @@ declare function resolveSkipDuplicateFiles(service?: string): Promise<boolean>;
|
|
|
478
469
|
declare function streamRecoveryEnabled(): boolean;
|
|
479
470
|
/**
|
|
480
471
|
* Does a given skapi INSTANCE support the streaming half of the protocol? Ask this
|
|
481
|
-
* before
|
|
482
|
-
* answer is no.
|
|
472
|
+
* before handing the engine the two streaming hooks, and hand over neither (buffered
|
|
473
|
+
* replies) when the answer is no.
|
|
483
474
|
*
|
|
484
475
|
* THE FAILURE THIS PREVENTS, and it is the one the SDK's own docs call quiet. A
|
|
485
476
|
* streamed turn carries TWO `stream` flags: skapi's (relay the destination's bytes
|
|
@@ -498,8 +489,8 @@ declare function streamRecoveryEnabled(): boolean;
|
|
|
498
489
|
* It lives in the ENGINE rather than in each client because the two clients are
|
|
499
490
|
* diffed against each other and this is precisely the kind of predicate that forks:
|
|
500
491
|
* the widget must ask it (init() takes the EMBEDDER's instance, and an embed page
|
|
501
|
-
* pins its own skapi-js version, so
|
|
502
|
-
*
|
|
492
|
+
* pins its own skapi-js version, so streaming is granted by this probe and never
|
|
493
|
+
* assumed) and agent.vue must ask it too (its instance is the repo's own, so
|
|
503
494
|
* only a stale node_modules or an unbuilt skapi-js can fail it - which is exactly
|
|
504
495
|
* the state a dev flipping the constant is most likely to be in, and a silently
|
|
505
496
|
* empty chat is the worst possible way to find out).
|
package/dist/engine.d.ts
CHANGED
|
@@ -254,38 +254,29 @@ interface ChatEngineConfig {
|
|
|
254
254
|
};
|
|
255
255
|
}) => void;
|
|
256
256
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* is
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* `clientSecretRequestFinalize`): without it a streamed turn is never
|
|
271
|
-
* finalized, so its row keeps a status and no body forever and a later
|
|
272
|
-
* history load shows the question with an empty answer.
|
|
273
|
-
*/
|
|
274
|
-
liveStreaming?: boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Also push each relayed chunk over skapi's websocket, so text lands as it is
|
|
277
|
-
* relayed instead of on the next poll tick. Requires `liveStreaming`.
|
|
278
|
-
*
|
|
279
|
-
* SEPARATE FROM `liveStreaming` ON PURPOSE, and off unless a host asks. It is a
|
|
280
|
-
* pure accelerator with a safe fallback, so the reason is not risk to the chat, it
|
|
281
|
-
* is what it does to the HOST'S OWN realtime: skapi's joinRealtime REPLACES the
|
|
257
|
+
* Deliver each relayed chunk over skapi's WEBSOCKET as well, so text lands as it
|
|
258
|
+
* is relayed instead of on the next poll tick. Off unless a host asks.
|
|
259
|
+
*
|
|
260
|
+
* Streaming itself is not a choice any more: the engine streams every chat turn
|
|
261
|
+
* whenever the host handed over the two streaming hooks below
|
|
262
|
+
* (`forwardRequestFinalize` and `forwardRequestStream`, or their deprecated
|
|
263
|
+
* names), and a host that wants buffered replies simply hands over neither. See
|
|
264
|
+
* liveStreamingEnabled(). This key only decides the TRANSPORT of a stream that is
|
|
265
|
+
* on anyway, so a host with no streaming hooks gets nothing from setting it.
|
|
266
|
+
*
|
|
267
|
+
* Off by default on purpose, and the reason is not risk to the chat (the socket
|
|
268
|
+
* is a pure accelerator with a safe fallback: the poll carries the read), it is
|
|
269
|
+
* what it does to the HOST'S OWN realtime. skapi's joinRealtime REPLACES the
|
|
282
270
|
* connection's group rather than adding to it, so for the length of a turn this
|
|
283
271
|
* takes the room. The dashboard owns its skapi instance and uses realtime for
|
|
284
272
|
* nothing else, so it opts in. The embeddable widget is handed the EMBEDDER'S
|
|
285
273
|
* instance and cannot know what their app does with it, so it stays off there
|
|
286
274
|
* unless the embedder turns it on.
|
|
275
|
+
*
|
|
276
|
+
* Until 1.16.0 this key meant "stream at all" and the socket was
|
|
277
|
+
* `liveStreamingRealtime`; that name is now ignored.
|
|
287
278
|
*/
|
|
288
|
-
|
|
279
|
+
liveStreaming?: boolean;
|
|
289
280
|
/**
|
|
290
281
|
* Whether a CHAT answer may reach the open web: Claude's `web_fetch` and
|
|
291
282
|
* OpenAI's `web_search` are attached to a chat request only when this
|
|
@@ -443,17 +434,17 @@ declare function resolveSkipDuplicateFiles(service?: string): Promise<boolean>;
|
|
|
443
434
|
/**
|
|
444
435
|
* True when a streamed turn whose answer never reached its row can be READ BACK.
|
|
445
436
|
*
|
|
446
|
-
* IT ASKS FOR THE READER
|
|
447
|
-
* POINT. "Should NEW turns stream?" and "can an ALREADY streamed row be recovered?"
|
|
437
|
+
* IT ASKS FOR THE READER ALONE, NOT FOR WHETHER NEW TURNS STREAM, AND THAT SPLIT IS
|
|
438
|
+
* THE WHOLE POINT. "Should NEW turns stream?" and "can an ALREADY streamed row be recovered?"
|
|
448
439
|
* are two different questions about two different sets of rows, and answering both
|
|
449
440
|
* with one flag strands the second set the moment the first answer changes.
|
|
450
441
|
*
|
|
451
442
|
* The failure, and it is not hypothetical - it is what turning the feature off
|
|
452
443
|
* does. A row streamed yesterday holds its answer in the chunk table and a status
|
|
453
|
-
* and no body on the row; only csr-finalize ever copies one onto it.
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
444
|
+
* and no body on the row; only csr-finalize ever copies one onto it. Take
|
|
445
|
+
* streaming away today (a host stops handing over the finalize hook, a client's
|
|
446
|
+
* skapiSupportsStreaming probe degrades the instance to buffered) and every one of
|
|
447
|
+
* those rows instantly becomes unmarked,
|
|
457
448
|
* unrecoverable and unreadable: the mapper emits no bubble for it, the recovery
|
|
458
449
|
* never looks at it, and its answer is unreachable with every byte of it still
|
|
459
450
|
* stored. Rolling a rendering flag back must not delete anybody's history.
|
|
@@ -478,8 +469,8 @@ declare function resolveSkipDuplicateFiles(service?: string): Promise<boolean>;
|
|
|
478
469
|
declare function streamRecoveryEnabled(): boolean;
|
|
479
470
|
/**
|
|
480
471
|
* Does a given skapi INSTANCE support the streaming half of the protocol? Ask this
|
|
481
|
-
* before
|
|
482
|
-
* answer is no.
|
|
472
|
+
* before handing the engine the two streaming hooks, and hand over neither (buffered
|
|
473
|
+
* replies) when the answer is no.
|
|
483
474
|
*
|
|
484
475
|
* THE FAILURE THIS PREVENTS, and it is the one the SDK's own docs call quiet. A
|
|
485
476
|
* streamed turn carries TWO `stream` flags: skapi's (relay the destination's bytes
|
|
@@ -498,8 +489,8 @@ declare function streamRecoveryEnabled(): boolean;
|
|
|
498
489
|
* It lives in the ENGINE rather than in each client because the two clients are
|
|
499
490
|
* diffed against each other and this is precisely the kind of predicate that forks:
|
|
500
491
|
* the widget must ask it (init() takes the EMBEDDER's instance, and an embed page
|
|
501
|
-
* pins its own skapi-js version, so
|
|
502
|
-
*
|
|
492
|
+
* pins its own skapi-js version, so streaming is granted by this probe and never
|
|
493
|
+
* assumed) and agent.vue must ask it too (its instance is the repo's own, so
|
|
503
494
|
* only a stale node_modules or an unbuilt skapi-js can fail it - which is exactly
|
|
504
495
|
* the state a dev flipping the constant is most likely to be in, and a silently
|
|
505
496
|
* empty chat is the worst possible way to find out).
|
package/dist/engine.mjs
CHANGED
|
@@ -240,11 +240,11 @@ function resolveForwardRequestStream() {
|
|
|
240
240
|
function windowedIndexingEnabled() {
|
|
241
241
|
return _config?.windowedIndexing === true;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
return liveStreamingEnabled() && _config?.
|
|
243
|
+
function liveStreamingSocketEnabled() {
|
|
244
|
+
return liveStreamingEnabled() && _config?.liveStreaming === true;
|
|
245
245
|
}
|
|
246
246
|
function liveStreamingEnabled() {
|
|
247
|
-
return
|
|
247
|
+
return typeof resolveForwardRequestFinalize() === "function" && typeof resolveForwardRequestStream() === "function";
|
|
248
248
|
}
|
|
249
249
|
function underCeiling(projectSetting, option, override) {
|
|
250
250
|
if (!projectSetting) return false;
|
|
@@ -2837,7 +2837,7 @@ var CHAT_STREAM_ON_REALTIME = Object.freeze({
|
|
|
2837
2837
|
function chatStreamWiring(queue) {
|
|
2838
2838
|
if (!liveStreamingEnabled()) return CHAT_STREAM_OFF;
|
|
2839
2839
|
if (isBgIndexingQueue(queue)) return CHAT_STREAM_OFF;
|
|
2840
|
-
return
|
|
2840
|
+
return liveStreamingSocketEnabled() ? CHAT_STREAM_ON_REALTIME : CHAT_STREAM_ON;
|
|
2841
2841
|
}
|
|
2842
2842
|
var VARIANT_IMAGE_DETAIL = "original";
|
|
2843
2843
|
var VARIANT_TEXT_VERBOSITY = "high";
|