bunnyquery 1.15.1 → 1.15.4
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/bunnyquery.js +52 -9
- package/dist/engine.cjs +51 -8
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +34 -2
- package/dist/engine.d.ts +34 -2
- package/dist/engine.mjs +51 -8
- package/dist/engine.mjs.map +1 -1
- package/package.json +2 -3
- package/src/engine/budget.ts +2 -2
- package/src/engine/requests.ts +5 -4
- package/src/engine/session.ts +63 -6
package/dist/engine.d.mts
CHANGED
|
@@ -2283,8 +2283,8 @@ interface SseParser {
|
|
|
2283
2283
|
declare function createSseParser(): SseParser;
|
|
2284
2284
|
|
|
2285
2285
|
declare const MCP_NAME = "BunnyQuery";
|
|
2286
|
-
declare const DEFAULT_CLAUDE_MODEL = "claude-
|
|
2287
|
-
declare const DEFAULT_OPENAI_MODEL = "gpt-6
|
|
2286
|
+
declare const DEFAULT_CLAUDE_MODEL = "claude-haiku-5-5";
|
|
2287
|
+
declare const DEFAULT_OPENAI_MODEL = "gpt-6-luna";
|
|
2288
2288
|
/**
|
|
2289
2289
|
* THE two `stream` flags of a streamed chat turn, produced together or not at all.
|
|
2290
2290
|
*
|
|
@@ -4055,6 +4055,17 @@ declare class ChatSession {
|
|
|
4055
4055
|
/** Files this client has an index dispatch in flight for, by scoped path ->
|
|
4056
4056
|
* wall clock. See claimIndexRun. */
|
|
4057
4057
|
private _indexClaims;
|
|
4058
|
+
/** bgTaskQueue by the SAME scoped path the claims use -> how many entries
|
|
4059
|
+
* name that file. Derived from the array, never written to directly: see
|
|
4060
|
+
* _bgQueueIndex for when it is rebuilt and why that is exact. */
|
|
4061
|
+
private _bgQueueByFile;
|
|
4062
|
+
/** What _bgQueueByFile was built from: the array itself, its length and its
|
|
4063
|
+
* first and last entries. Equal stamp = equal contents (see _bgQueueIndex). */
|
|
4064
|
+
private _bgQueueStamp;
|
|
4065
|
+
/** How many times the index was rebuilt. Diagnostics and tests only: a
|
|
4066
|
+
* 3,000-file batch should build it a few thousand times at most (once per
|
|
4067
|
+
* push or settle), never once per claim. */
|
|
4068
|
+
_bgQueueIndexRebuilds: number;
|
|
4058
4069
|
constructor(host: ChatHost);
|
|
4059
4070
|
/** What the display layer needs to decide whether a run is finished. `keys` holds
|
|
4060
4071
|
* every file the server still has indexing work for; `checked` is false until the
|
|
@@ -4096,6 +4107,27 @@ declare class ChatSession {
|
|
|
4096
4107
|
/** Storage paths are project-relative, and one ChatSession serves every
|
|
4097
4108
|
* project, so a claim has to be scoped the way a stop is (_indexKeyOf). */
|
|
4098
4109
|
private _indexClaimKey;
|
|
4110
|
+
/**
|
|
4111
|
+
* bgTaskQueue as a map: scoped path (indexScopeKey(projectId, platform) +
|
|
4112
|
+
* '|' + storagePath, the key the claims and the stops use) -> entries.
|
|
4113
|
+
*
|
|
4114
|
+
* The array stays the source of truth because the engine does not own every
|
|
4115
|
+
* write to it: both hosts hand in their own array (the dashboard a Vue
|
|
4116
|
+
* reactive one it pushes to from the Files page and splices from its
|
|
4117
|
+
* fallback poller), and tests push to it directly. So the map is DERIVED, and
|
|
4118
|
+
* rebuilt when a cheap stamp says the array changed: its identity, its length,
|
|
4119
|
+
* its first and its last entry.
|
|
4120
|
+
*
|
|
4121
|
+
* Why that stamp is exact for this array: every write to bgTaskQueue is either
|
|
4122
|
+
* a push of a NEW entry object or a splice that removes one (nothing inserts
|
|
4123
|
+
* in the middle, replaces in place or re-pushes a removed entry). Under those
|
|
4124
|
+
* two operations, same length plus same last entry means the same contents:
|
|
4125
|
+
* a push changes the last entry unless that same push is removed again, and a
|
|
4126
|
+
* removal changes the length unless a push restores it, which changes the
|
|
4127
|
+
* last entry. The first entry is in the stamp as margin. A rebuild is one
|
|
4128
|
+
* pass over the array, paid once per change instead of once per claim.
|
|
4129
|
+
*/
|
|
4130
|
+
private _bgQueueIndex;
|
|
4099
4131
|
/**
|
|
4100
4132
|
* Take this file's indexing slot, or report that someone already has it.
|
|
4101
4133
|
*
|
package/dist/engine.d.ts
CHANGED
|
@@ -2283,8 +2283,8 @@ interface SseParser {
|
|
|
2283
2283
|
declare function createSseParser(): SseParser;
|
|
2284
2284
|
|
|
2285
2285
|
declare const MCP_NAME = "BunnyQuery";
|
|
2286
|
-
declare const DEFAULT_CLAUDE_MODEL = "claude-
|
|
2287
|
-
declare const DEFAULT_OPENAI_MODEL = "gpt-6
|
|
2286
|
+
declare const DEFAULT_CLAUDE_MODEL = "claude-haiku-5-5";
|
|
2287
|
+
declare const DEFAULT_OPENAI_MODEL = "gpt-6-luna";
|
|
2288
2288
|
/**
|
|
2289
2289
|
* THE two `stream` flags of a streamed chat turn, produced together or not at all.
|
|
2290
2290
|
*
|
|
@@ -4055,6 +4055,17 @@ declare class ChatSession {
|
|
|
4055
4055
|
/** Files this client has an index dispatch in flight for, by scoped path ->
|
|
4056
4056
|
* wall clock. See claimIndexRun. */
|
|
4057
4057
|
private _indexClaims;
|
|
4058
|
+
/** bgTaskQueue by the SAME scoped path the claims use -> how many entries
|
|
4059
|
+
* name that file. Derived from the array, never written to directly: see
|
|
4060
|
+
* _bgQueueIndex for when it is rebuilt and why that is exact. */
|
|
4061
|
+
private _bgQueueByFile;
|
|
4062
|
+
/** What _bgQueueByFile was built from: the array itself, its length and its
|
|
4063
|
+
* first and last entries. Equal stamp = equal contents (see _bgQueueIndex). */
|
|
4064
|
+
private _bgQueueStamp;
|
|
4065
|
+
/** How many times the index was rebuilt. Diagnostics and tests only: a
|
|
4066
|
+
* 3,000-file batch should build it a few thousand times at most (once per
|
|
4067
|
+
* push or settle), never once per claim. */
|
|
4068
|
+
_bgQueueIndexRebuilds: number;
|
|
4058
4069
|
constructor(host: ChatHost);
|
|
4059
4070
|
/** What the display layer needs to decide whether a run is finished. `keys` holds
|
|
4060
4071
|
* every file the server still has indexing work for; `checked` is false until the
|
|
@@ -4096,6 +4107,27 @@ declare class ChatSession {
|
|
|
4096
4107
|
/** Storage paths are project-relative, and one ChatSession serves every
|
|
4097
4108
|
* project, so a claim has to be scoped the way a stop is (_indexKeyOf). */
|
|
4098
4109
|
private _indexClaimKey;
|
|
4110
|
+
/**
|
|
4111
|
+
* bgTaskQueue as a map: scoped path (indexScopeKey(projectId, platform) +
|
|
4112
|
+
* '|' + storagePath, the key the claims and the stops use) -> entries.
|
|
4113
|
+
*
|
|
4114
|
+
* The array stays the source of truth because the engine does not own every
|
|
4115
|
+
* write to it: both hosts hand in their own array (the dashboard a Vue
|
|
4116
|
+
* reactive one it pushes to from the Files page and splices from its
|
|
4117
|
+
* fallback poller), and tests push to it directly. So the map is DERIVED, and
|
|
4118
|
+
* rebuilt when a cheap stamp says the array changed: its identity, its length,
|
|
4119
|
+
* its first and its last entry.
|
|
4120
|
+
*
|
|
4121
|
+
* Why that stamp is exact for this array: every write to bgTaskQueue is either
|
|
4122
|
+
* a push of a NEW entry object or a splice that removes one (nothing inserts
|
|
4123
|
+
* in the middle, replaces in place or re-pushes a removed entry). Under those
|
|
4124
|
+
* two operations, same length plus same last entry means the same contents:
|
|
4125
|
+
* a push changes the last entry unless that same push is removed again, and a
|
|
4126
|
+
* removal changes the length unless a push restores it, which changes the
|
|
4127
|
+
* last entry. The first entry is in the stamp as margin. A rebuild is one
|
|
4128
|
+
* pass over the array, paid once per change instead of once per claim.
|
|
4129
|
+
*/
|
|
4130
|
+
private _bgQueueIndex;
|
|
4099
4131
|
/**
|
|
4100
4132
|
* Take this file's indexing slot, or report that someone already has it.
|
|
4101
4133
|
*
|
package/dist/engine.mjs
CHANGED
|
@@ -1516,6 +1516,7 @@ var CONTEXT_WINDOW_BY_MODEL = {
|
|
|
1516
1516
|
"claude-fable-5-1": 1e6,
|
|
1517
1517
|
"claude-opus-5-5": 1e6,
|
|
1518
1518
|
"claude-sonnet-5-5": 1e6,
|
|
1519
|
+
"claude-haiku-5-5": 1e6,
|
|
1519
1520
|
"claude-fable-5": 1e6,
|
|
1520
1521
|
"claude-opus-5": 1e6,
|
|
1521
1522
|
"claude-opus-4-8": 1e6,
|
|
@@ -1561,6 +1562,7 @@ var MAX_OUTPUT_BY_MODEL = {
|
|
|
1561
1562
|
"claude-fable-5-1": 128e3,
|
|
1562
1563
|
"claude-opus-5-5": 128e3,
|
|
1563
1564
|
"claude-sonnet-5-5": 128e3,
|
|
1565
|
+
"claude-haiku-5-5": 128e3,
|
|
1564
1566
|
"claude-fable-5": 128e3,
|
|
1565
1567
|
"claude-opus-5": 128e3,
|
|
1566
1568
|
"claude-opus-4-8": 128e3,
|
|
@@ -2796,8 +2798,8 @@ var webToolsForChat = (platform, webAccess) => {
|
|
|
2796
2798
|
return [openaiWebSearchTool()] ;
|
|
2797
2799
|
};
|
|
2798
2800
|
var MCP_NAME = "BunnyQuery";
|
|
2799
|
-
var DEFAULT_CLAUDE_MODEL = "claude-
|
|
2800
|
-
var DEFAULT_OPENAI_MODEL = "gpt-6
|
|
2801
|
+
var DEFAULT_CLAUDE_MODEL = "claude-haiku-5-5";
|
|
2802
|
+
var DEFAULT_OPENAI_MODEL = "gpt-6-luna";
|
|
2801
2803
|
var mcpUrl = () => chatEngineConfig().mcpBaseUrl;
|
|
2802
2804
|
function withMcpParams(base, params) {
|
|
2803
2805
|
if (!base) return base;
|
|
@@ -4536,6 +4538,9 @@ var ChatSession = class {
|
|
|
4536
4538
|
this._liveIndexKey = "";
|
|
4537
4539
|
this._liveIndexAt = 0;
|
|
4538
4540
|
this._indexClaims = {};
|
|
4541
|
+
this._bgQueueByFile = null;
|
|
4542
|
+
this._bgQueueStamp = { arr: null, length: 0, first: void 0, last: void 0 };
|
|
4543
|
+
this._bgQueueIndexRebuilds = 0;
|
|
4539
4544
|
}
|
|
4540
4545
|
/** What the display layer needs to decide whether a run is finished. `keys` holds
|
|
4541
4546
|
* every file the server still has indexing work for; `checked` is false until the
|
|
@@ -4572,13 +4577,10 @@ var ChatSession = class {
|
|
|
4572
4577
|
*/
|
|
4573
4578
|
hasLiveIndexRun(storagePath) {
|
|
4574
4579
|
if (!storagePath) return false;
|
|
4575
|
-
var
|
|
4580
|
+
var scoped = this._indexClaimKey(storagePath);
|
|
4581
|
+
var claimed = this._indexClaims[scoped];
|
|
4576
4582
|
if (claimed && nowMs() - claimed < INDEX_DISPATCH_CLAIM_MS) return true;
|
|
4577
|
-
|
|
4578
|
-
for (var i = 0; i < this.bgTaskQueue.length; i++) {
|
|
4579
|
-
var e = this.bgTaskQueue[i];
|
|
4580
|
-
if (e && e.storagePath === storagePath && e.projectId === id.projectId && e.platform === id.platform) return true;
|
|
4581
|
-
}
|
|
4583
|
+
if (this._bgQueueIndex()[scoped] > 0) return true;
|
|
4582
4584
|
return this.state.messages.some(function(m) {
|
|
4583
4585
|
if (!m.isBackgroundTask || m.role !== "user" || m.isCancelled) return false;
|
|
4584
4586
|
if (!(m.isPendingQueued || m.isPendingInProcess || m.isSendingToServer)) return false;
|
|
@@ -4591,6 +4593,47 @@ var ChatSession = class {
|
|
|
4591
4593
|
var id = this.host.getIdentity();
|
|
4592
4594
|
return indexScopeKey(id.projectId, id.platform) + "|" + storagePath;
|
|
4593
4595
|
}
|
|
4596
|
+
/**
|
|
4597
|
+
* bgTaskQueue as a map: scoped path (indexScopeKey(projectId, platform) +
|
|
4598
|
+
* '|' + storagePath, the key the claims and the stops use) -> entries.
|
|
4599
|
+
*
|
|
4600
|
+
* The array stays the source of truth because the engine does not own every
|
|
4601
|
+
* write to it: both hosts hand in their own array (the dashboard a Vue
|
|
4602
|
+
* reactive one it pushes to from the Files page and splices from its
|
|
4603
|
+
* fallback poller), and tests push to it directly. So the map is DERIVED, and
|
|
4604
|
+
* rebuilt when a cheap stamp says the array changed: its identity, its length,
|
|
4605
|
+
* its first and its last entry.
|
|
4606
|
+
*
|
|
4607
|
+
* Why that stamp is exact for this array: every write to bgTaskQueue is either
|
|
4608
|
+
* a push of a NEW entry object or a splice that removes one (nothing inserts
|
|
4609
|
+
* in the middle, replaces in place or re-pushes a removed entry). Under those
|
|
4610
|
+
* two operations, same length plus same last entry means the same contents:
|
|
4611
|
+
* a push changes the last entry unless that same push is removed again, and a
|
|
4612
|
+
* removal changes the length unless a push restores it, which changes the
|
|
4613
|
+
* last entry. The first entry is in the stamp as margin. A rebuild is one
|
|
4614
|
+
* pass over the array, paid once per change instead of once per claim.
|
|
4615
|
+
*/
|
|
4616
|
+
_bgQueueIndex() {
|
|
4617
|
+
var q = this.bgTaskQueue;
|
|
4618
|
+
var n = q ? q.length : 0;
|
|
4619
|
+
var first = n ? q[0] : void 0;
|
|
4620
|
+
var last = n ? q[n - 1] : void 0;
|
|
4621
|
+
var st = this._bgQueueStamp;
|
|
4622
|
+
if (this._bgQueueByFile && st.arr === q && st.length === n && st.first === first && st.last === last) {
|
|
4623
|
+
return this._bgQueueByFile;
|
|
4624
|
+
}
|
|
4625
|
+
var idx = {};
|
|
4626
|
+
for (var i = 0; i < n; i++) {
|
|
4627
|
+
var e = q[i];
|
|
4628
|
+
if (!e || !e.storagePath) continue;
|
|
4629
|
+
var k = indexScopeKey(e.projectId, e.platform) + "|" + e.storagePath;
|
|
4630
|
+
idx[k] = (idx[k] || 0) + 1;
|
|
4631
|
+
}
|
|
4632
|
+
this._bgQueueByFile = idx;
|
|
4633
|
+
this._bgQueueStamp = { arr: q, length: n, first, last };
|
|
4634
|
+
this._bgQueueIndexRebuilds++;
|
|
4635
|
+
return idx;
|
|
4636
|
+
}
|
|
4594
4637
|
/**
|
|
4595
4638
|
* Take this file's indexing slot, or report that someone already has it.
|
|
4596
4639
|
*
|