bunnyquery 1.21.13 → 1.21.14
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 +13 -0
- package/bunnyquery.css +6 -0
- package/bunnyquery.js +313 -13
- package/dist/engine.cjs +282 -11
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +68 -1
- package/dist/engine.d.ts +68 -1
- package/dist/engine.mjs +279 -12
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/activity.ts +253 -0
- package/src/engine/index.ts +3 -0
- package/src/engine/prompts/chat_system_prompt.ts +1 -1
- package/src/engine/session.ts +5 -0
- package/src/engine/sse.ts +110 -3
- package/styles/chat.css +6 -0
package/README.md
CHANGED
|
@@ -666,6 +666,19 @@ widget rather than approximately:
|
|
|
666
666
|
for a reply (`retrievalNoteOfAnswer`) into the file-and-page citations the
|
|
667
667
|
widget shows under an answer; `answerUsedNoDataTool` says whether a reply read
|
|
668
668
|
no data at all.
|
|
669
|
+
- **`chatActivityLine(msg, now?, lang?)`** is the progress line under a waiting
|
|
670
|
+
turn: "Reading your question", "Searching your files for "oil leak"",
|
|
671
|
+
"Reading BP-252.pdf", "Looking at what it found", "Writing the answer". The
|
|
672
|
+
engine records the step from the live stream (the tool the model called, its
|
|
673
|
+
input, whether it answered) and the sentence moves on every
|
|
674
|
+
`CHAT_ACTIVITY_ROTATE_MS` (4 seconds) while a step lasts, looping its list, so
|
|
675
|
+
call it again about once a second and update only the text. It returns the
|
|
676
|
+
sentence without dots: draw your animated dot trail right after it. `lang` is a
|
|
677
|
+
BCP 47 tag such as `navigator.language`; `ko` picks Korean, anything else
|
|
678
|
+
English. The widget and bunnyquery.com show it in a chat turn's own waiting
|
|
679
|
+
bubble (not on indexing rows), as a `span.bq-activity-text` before the
|
|
680
|
+
`.bq-loader` dots. A turn that does not stream shows the thinking sentences,
|
|
681
|
+
timed from when the bubble was first drawn.
|
|
669
682
|
- **`ChatSession.cancelPendingReply(msg, idx)`** is the "stop waiting" control:
|
|
670
683
|
handed the pending assistant bubble, it cancels the running request on the
|
|
671
684
|
server, marks the question cancelled and promotes the next queued message.
|
package/bunnyquery.css
CHANGED
|
@@ -1236,6 +1236,12 @@
|
|
|
1236
1236
|
.bq-message.is-assistant:not(.is-error):not(.is-cancelled):not(.bq-index-pass) .bq-bubble:has(> .bq-loader) > .bq-loader {
|
|
1237
1237
|
vertical-align: middle;
|
|
1238
1238
|
}
|
|
1239
|
+
/* The waiting turn's progress line ("Searching your files for ..."): a sentence
|
|
1240
|
+
from the engine (chatActivityLine) sitting right before the dot trail, so the
|
|
1241
|
+
dots read as its ending. Middle-aligned with the inline bunny like the dots. */
|
|
1242
|
+
.bq-bubble > .bq-activity-text {
|
|
1243
|
+
vertical-align: middle;
|
|
1244
|
+
}
|
|
1239
1245
|
/* The dot-trail cycles '.', '..', '...', so left to itself it is a box that
|
|
1240
1246
|
changes width three times every 1.2s: the bubble pulsed with it, and the
|
|
1241
1247
|
stop-waiting control that follows the dots moved each time, which made it hard
|
package/bunnyquery.js
CHANGED
|
@@ -1008,7 +1008,7 @@ Extracted content of attached office files (read inline below; do NOT fetch thei
|
|
|
1008
1008
|
const indexGroupLiteral = typeof g === "number" ? String(g) : g === "public" || g === "private" || g === "authorized" || g === "admin" ? `"${g}"` : '"authorized"';
|
|
1009
1009
|
const reindexHint = canUpload === false ? `asking the project's owner to re-index that file` : `re-indexing that file (attach the same file again and choose to reindex it)`;
|
|
1010
1010
|
const groundingRules = `ANSWER ONLY FROM THE DATA. Every fact you state about this project's data - a name, a number, a date, a status, what a document says, whether something exists - must come from one of four places: a tool result returned in THIS conversation, a file or image attached to it (including one you read through its attachment link), the project description at the end of this prompt, or what the user told you themselves in this chat. Your general knowledge, the open internet and a plausible guess are NOT sources. Never use them to answer a question about the user's data, to fill a gap in it, or to complete a record that came back partial. A value that is not in what you retrieved is unknown: say it is not in the data instead of supplying a likely one.
|
|
1011
|
-
FILES IN ANOTHER LANGUAGE. The files may be written in another language than the question (a Russian or English manual asked about in Korean). When searches in the question's language find nothing, or searchText reports query_language_mismatch, search again with the question's key terms translated into the language the files
|
|
1011
|
+
FILES IN ANOTHER LANGUAGE. The files may be written in another language than the question, in another alphabet or in the same one (a Russian or English manual asked about in Korean, German documents asked about in English). When searches in the question's language find nothing, or searchText reports query_language_mismatch (its text_language names the files' language), search again with the question's key terms translated into the language the files' TEXT is in: searchText names that language for each file ("its text is in German"; only when it cannot tell, the alphabet, "Latin script, e.g. English"), and earlier hits show it; passing the question as the DOCUMENTS rule says lets searchText tell the question's language; a file NAME can be in another language than its text (a "\u0420\u042D" manual written in English), so go by the text. One or two short queries of the main terms (e.g. "oil leak", "gearbox"), and if the first translation finds nothing, try the other likely language (English is the most common for technical manuals), before concluding anything.
|
|
1012
1012
|
WHEN THE DATA DOES NOT HAVE IT, SAY SO. Once you have searched the way these rules require (in the files' language too) and nothing answers the question, tell the user plainly, in their language, that this project's data does not contain it, and say what you searched (the tables, files or terms) so they can tell missing data from a missed search. Do not answer from memory instead, and do not turn a missing answer into a general explanation of the topic. Offer what would let you answer it: ${canUpload === false ? `another name or file to look under, or asking the project's owner to add it` : `the document to upload, or another name or file to look under`}.
|
|
1013
1013
|
A CODE, NUMBER OR EXACT QUOTE THAT searchText DID NOT FIND (an identifier or a quote, not a topic or how-to question, which follows FILES IN ANOTHER LANGUAGE first): when it answers search_complete with no hit, and what its message says was NOT searched has been checked as it says (the skipped_without_page_text files; the records ONLY when the value could be a spreadsheet cell or a row, and then with ONE filtered getRecords on that value, never by paging through a whole table), keep the answer short. The text read from photos, scans and other images IS in the page text searchText covered, so a code, serial or phrase asked about a photo needs no records read: say plainly that it was not found, name what was searched (the file, and its pages when you searched only some of them, or files_searched files and total_pages_searched pages), and when a recently uploaded file or a photo should hold it, suggest ${reindexHint}, since small or handwritten characters can be misread at indexing. Never present a different file as the match, and never guess the value.
|
|
1014
1014
|
KEEP WHAT THE DATA SAYS APART FROM WHAT YOU WORKED OUT. A total you computed, a comparison, a trend, an interpretation or a recommendation is yours, not the data's: label it as such ("calculated from...", "this suggests...") and name the rows or files it was made from. Never present an estimate, an assumption or an inference as something the data states.
|
|
@@ -4454,6 +4454,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4454
4454
|
var error = null;
|
|
4455
4455
|
var stopReason = null;
|
|
4456
4456
|
var toolCalls = [];
|
|
4457
|
+
var argBuf = {};
|
|
4457
4458
|
var malformedFrames = 0;
|
|
4458
4459
|
var malformedToolJson = 0;
|
|
4459
4460
|
var message = null;
|
|
@@ -4576,7 +4577,10 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4576
4577
|
type: block.type
|
|
4577
4578
|
};
|
|
4578
4579
|
if (typeof block.server_name === "string") call.serverName = block.server_name;
|
|
4580
|
+
if (typeof block.id === "string" && block.id) call.id = block.id;
|
|
4579
4581
|
toolCalls.push(call);
|
|
4582
|
+
} else if (block && typeof block.type === "string") {
|
|
4583
|
+
markClaudeCallsDone(block);
|
|
4580
4584
|
}
|
|
4581
4585
|
return;
|
|
4582
4586
|
}
|
|
@@ -4600,6 +4604,10 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4600
4604
|
var j = numberOr(ev.index, -1);
|
|
4601
4605
|
var s = j >= 0 ? blocks.get(j) : void 0;
|
|
4602
4606
|
if (s && s.sawJson) finishToolJson(s);
|
|
4607
|
+
if (s && s.block && s.block.input && typeof s.block.input === "object") {
|
|
4608
|
+
var sc = callAt(j);
|
|
4609
|
+
if (sc) sc.input = s.block.input;
|
|
4610
|
+
}
|
|
4603
4611
|
return;
|
|
4604
4612
|
}
|
|
4605
4613
|
if (type === "message_delta") {
|
|
@@ -4660,6 +4668,34 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4660
4668
|
malformedToolJson++;
|
|
4661
4669
|
}
|
|
4662
4670
|
}
|
|
4671
|
+
function callAt(index) {
|
|
4672
|
+
for (var k = toolCalls.length - 1; k >= 0; k--) {
|
|
4673
|
+
if (toolCalls[k].index === index) return toolCalls[k];
|
|
4674
|
+
}
|
|
4675
|
+
return null;
|
|
4676
|
+
}
|
|
4677
|
+
function markClaudeCallsDone(block) {
|
|
4678
|
+
var t = block.type;
|
|
4679
|
+
if (/tool_result$/.test(t)) {
|
|
4680
|
+
var ref = typeof block.tool_use_id === "string" ? block.tool_use_id : "";
|
|
4681
|
+
for (var k = 0; k < toolCalls.length; k++) {
|
|
4682
|
+
if (ref && toolCalls[k].id === ref) toolCalls[k].done = true;
|
|
4683
|
+
}
|
|
4684
|
+
return;
|
|
4685
|
+
}
|
|
4686
|
+
if (t === "text" || t === "thinking" || t === "redacted_thinking") {
|
|
4687
|
+
for (var m = 0; m < toolCalls.length; m++) toolCalls[m].done = true;
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
function parseArgs(args) {
|
|
4691
|
+
if (args && typeof args === "object") return args;
|
|
4692
|
+
if (typeof args !== "string" || !args) return void 0;
|
|
4693
|
+
try {
|
|
4694
|
+
return JSON.parse(args);
|
|
4695
|
+
} catch (e) {
|
|
4696
|
+
return void 0;
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
4663
4699
|
function deltaBlockType(deltaType) {
|
|
4664
4700
|
if (deltaType === "thinking_delta" || deltaType === "signature_delta") return "thinking";
|
|
4665
4701
|
if (deltaType === "input_json_delta") return "tool_use";
|
|
@@ -4693,13 +4729,54 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4693
4729
|
if (type === "response.output_item.added") {
|
|
4694
4730
|
var item = ev.item;
|
|
4695
4731
|
if (item && typeof item.type === "string" && OPENAI_TOOL_ITEMS[item.type]) {
|
|
4696
|
-
|
|
4732
|
+
var oc = {
|
|
4697
4733
|
index: numberOr(ev.output_index, toolCalls.length),
|
|
4698
4734
|
// A built-in tool (web_search_call) has no name of its own, so the item
|
|
4699
4735
|
// type is the only label there is and a row can still be drawn.
|
|
4700
4736
|
name: typeof item.name === "string" && item.name ? item.name : item.type,
|
|
4701
4737
|
type: item.type
|
|
4702
|
-
}
|
|
4738
|
+
};
|
|
4739
|
+
if (typeof item.id === "string" && item.id) oc.id = item.id;
|
|
4740
|
+
var oa = parseArgs(item.arguments);
|
|
4741
|
+
if (oa !== void 0) oc.input = oa;
|
|
4742
|
+
toolCalls.push(oc);
|
|
4743
|
+
}
|
|
4744
|
+
return;
|
|
4745
|
+
}
|
|
4746
|
+
if (type === "response.mcp_call_arguments.delta" || type === "response.function_call_arguments.delta") {
|
|
4747
|
+
var gi = numberOr(ev.output_index, -1);
|
|
4748
|
+
var gc = callAt(gi);
|
|
4749
|
+
if (gc && gc.input === void 0 && typeof ev.delta === "string") {
|
|
4750
|
+
argBuf[gi] = (argBuf[gi] || "") + ev.delta;
|
|
4751
|
+
var gt = argBuf[gi].trim();
|
|
4752
|
+
if (gt.charAt(gt.length - 1) === "}") {
|
|
4753
|
+
var ga = parseArgs(gt);
|
|
4754
|
+
if (ga !== void 0) gc.input = ga;
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
return;
|
|
4758
|
+
}
|
|
4759
|
+
if (type === "response.mcp_call_arguments.done" || type === "response.function_call_arguments.done") {
|
|
4760
|
+
var ac = callAt(numberOr(ev.output_index, -1));
|
|
4761
|
+
var aa = parseArgs(ev.arguments);
|
|
4762
|
+
if (ac && aa !== void 0) ac.input = aa;
|
|
4763
|
+
return;
|
|
4764
|
+
}
|
|
4765
|
+
if (type === "response.mcp_call.completed" || type === "response.mcp_call.failed") {
|
|
4766
|
+
var cc = callAt(numberOr(ev.output_index, -1));
|
|
4767
|
+
if (cc) cc.done = true;
|
|
4768
|
+
return;
|
|
4769
|
+
}
|
|
4770
|
+
if (type === "response.output_item.done") {
|
|
4771
|
+
var di = ev.item;
|
|
4772
|
+
if (di && typeof di.type === "string" && OPENAI_TOOL_ITEMS[di.type]) {
|
|
4773
|
+
var dc = callAt(numberOr(ev.output_index, -1));
|
|
4774
|
+
if (dc) {
|
|
4775
|
+
var da = parseArgs(di.arguments);
|
|
4776
|
+
if (da !== void 0) dc.input = da;
|
|
4777
|
+
else if (di.action && typeof di.action === "object" && dc.input === void 0) dc.input = di.action;
|
|
4778
|
+
dc.done = true;
|
|
4779
|
+
}
|
|
4703
4780
|
}
|
|
4704
4781
|
return;
|
|
4705
4782
|
}
|
|
@@ -4850,7 +4927,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4850
4927
|
provider,
|
|
4851
4928
|
text: currentText(),
|
|
4852
4929
|
thinkingText: currentThinking(),
|
|
4853
|
-
|
|
4930
|
+
// Copied per call, not just per array: a call's input/done fill in after it
|
|
4931
|
+
// is first seen, and a snapshot already handed out must not change under
|
|
4932
|
+
// its reader.
|
|
4933
|
+
toolCalls: toolCalls.map(function(t) {
|
|
4934
|
+
return Object.assign({}, t);
|
|
4935
|
+
}),
|
|
4854
4936
|
toolNames: toolCalls.map(function(t) {
|
|
4855
4937
|
return t.name;
|
|
4856
4938
|
}),
|
|
@@ -4904,6 +4986,190 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
4904
4986
|
return target;
|
|
4905
4987
|
}
|
|
4906
4988
|
|
|
4989
|
+
// src/engine/activity.ts
|
|
4990
|
+
var CHAT_ACTIVITY_ROTATE_MS = 4e3;
|
|
4991
|
+
var byItem = /* @__PURE__ */ new Map();
|
|
4992
|
+
var startByObj = /* @__PURE__ */ new WeakMap();
|
|
4993
|
+
var startById = /* @__PURE__ */ new Map();
|
|
4994
|
+
var MAX_IDS = 200;
|
|
4995
|
+
function remember(map, key, value) {
|
|
4996
|
+
if (map.has(key)) map.delete(key);
|
|
4997
|
+
map.set(key, value);
|
|
4998
|
+
if (map.size > MAX_IDS) {
|
|
4999
|
+
var oldest = map.keys().next();
|
|
5000
|
+
if (!oldest.done) map.delete(oldest.value);
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
function stepOf(snap) {
|
|
5004
|
+
if (!snap) return { step: "thinking", count: 0 };
|
|
5005
|
+
var calls = Array.isArray(snap.toolCalls) ? snap.toolCalls : [];
|
|
5006
|
+
if (typeof snap.text === "string" && /\S/.test(snap.text)) return { step: "writing", count: calls.length };
|
|
5007
|
+
if (!calls.length) return { step: "thinking", count: 0 };
|
|
5008
|
+
var last = calls[calls.length - 1];
|
|
5009
|
+
if (last && !last.done) return { step: "tool", call: last, count: calls.length };
|
|
5010
|
+
return { step: "between", count: calls.length };
|
|
5011
|
+
}
|
|
5012
|
+
function noteChatActivity(serverItemId, snap, now) {
|
|
5013
|
+
if (!serverItemId) return;
|
|
5014
|
+
var t = Date.now();
|
|
5015
|
+
var s = stepOf(snap);
|
|
5016
|
+
var key = s.step + ":" + s.count;
|
|
5017
|
+
var prev = byItem.get(serverItemId);
|
|
5018
|
+
if (prev && prev.key === key) {
|
|
5019
|
+
if (s.call && s.call.input !== void 0 && prev.input === void 0) prev.input = s.call.input;
|
|
5020
|
+
return;
|
|
5021
|
+
}
|
|
5022
|
+
var act = { step: s.step, since: t, key };
|
|
5023
|
+
if (s.call) {
|
|
5024
|
+
act.tool = s.call.name;
|
|
5025
|
+
if (s.call.input !== void 0) act.input = s.call.input;
|
|
5026
|
+
}
|
|
5027
|
+
remember(byItem, serverItemId, act);
|
|
5028
|
+
}
|
|
5029
|
+
function chatActivityOf(msg) {
|
|
5030
|
+
var id = msg && typeof msg._serverItemId === "string" ? msg._serverItemId : "";
|
|
5031
|
+
return id && byItem.get(id) || null;
|
|
5032
|
+
}
|
|
5033
|
+
function turnStart(msg, now) {
|
|
5034
|
+
var ids = [];
|
|
5035
|
+
if (msg && typeof msg._serverItemId === "string" && msg._serverItemId) ids.push(msg._serverItemId);
|
|
5036
|
+
if (msg && typeof msg._localId === "string" && msg._localId) ids.push(msg._localId);
|
|
5037
|
+
var t;
|
|
5038
|
+
if (msg && typeof msg === "object") t = startByObj.get(msg);
|
|
5039
|
+
for (var i = 0; t === void 0 && i < ids.length; i++) t = startById.get(ids[i]);
|
|
5040
|
+
if (t === void 0) t = now;
|
|
5041
|
+
if (msg && typeof msg === "object") startByObj.set(msg, t);
|
|
5042
|
+
for (var j = 0; j < ids.length; j++) if (startById.get(ids[j]) !== t) remember(startById, ids[j], t);
|
|
5043
|
+
return t;
|
|
5044
|
+
}
|
|
5045
|
+
function langOf(lang) {
|
|
5046
|
+
return typeof lang === "string" && /^ko\b/i.test(lang) ? "ko" : "en";
|
|
5047
|
+
}
|
|
5048
|
+
function clip(v, max) {
|
|
5049
|
+
if (typeof v !== "string") return "";
|
|
5050
|
+
var s = v.replace(/\s+/g, " ").trim();
|
|
5051
|
+
if (s.length > max) s = s.slice(0, max - 1).trim() + "\u2026";
|
|
5052
|
+
return s;
|
|
5053
|
+
}
|
|
5054
|
+
function fileName(v) {
|
|
5055
|
+
if (typeof v !== "string" || !v) return "";
|
|
5056
|
+
var s = v.replace(/^(src::|db:)/, "");
|
|
5057
|
+
var parts = s.split("/").filter(function(p) {
|
|
5058
|
+
return !!p;
|
|
5059
|
+
});
|
|
5060
|
+
return clip(parts.length ? parts[parts.length - 1] : s, 40);
|
|
5061
|
+
}
|
|
5062
|
+
var T = {
|
|
5063
|
+
en: {
|
|
5064
|
+
thinking: ["Reading your question", "Thinking about where to look", "Planning the search", "Still thinking, this can take a moment", "Working out the best way to find it", "Getting ready to look through your data"],
|
|
5065
|
+
between: ["Looking at what it found", "Deciding what to check next", "Putting the pieces together", "Checking that it has what it needs", "Still working on it"],
|
|
5066
|
+
writing: ["Writing the answer"],
|
|
5067
|
+
still: "Still working on it",
|
|
5068
|
+
working: "Working"
|
|
5069
|
+
},
|
|
5070
|
+
ko: {
|
|
5071
|
+
thinking: ["\uC9C8\uBB38\uC744 \uC77D\uB294 \uC911", "\uC5B4\uB514\uB97C \uCC3E\uC544\uBCFC\uC9C0 \uC0DD\uAC01\uD558\uB294 \uC911", "\uAC80\uC0C9 \uBC29\uBC95\uC744 \uC815\uD558\uB294 \uC911", "\uC544\uC9C1 \uC0DD\uAC01\uD558\uB294 \uC911, \uC7A0\uC2DC\uB9CC \uAE30\uB2E4\uB824 \uC8FC\uC138\uC694", "\uAC00\uC7A5 \uC88B\uC740 \uBC29\uBC95\uC744 \uCC3E\uB294 \uC911", "\uB370\uC774\uD130\uB97C \uC0B4\uD3B4\uBCFC \uC900\uBE44\uB97C \uD558\uB294 \uC911"],
|
|
5072
|
+
between: ["\uCC3E\uC740 \uB0B4\uC6A9\uC744 \uC0B4\uD3B4\uBCF4\uB294 \uC911", "\uB2E4\uC74C\uC5D0 \uD655\uC778\uD560 \uAC83\uC744 \uC815\uD558\uB294 \uC911", "\uB0B4\uC6A9\uC744 \uC815\uB9AC\uD558\uB294 \uC911", "\uD544\uC694\uD55C \uB0B4\uC6A9\uC774 \uB2E4 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uB294 \uC911", "\uC544\uC9C1 \uC791\uC5C5 \uC911"],
|
|
5073
|
+
writing: ["\uB2F5\uBCC0\uC744 \uC791\uC131\uD558\uB294 \uC911"],
|
|
5074
|
+
still: "\uC544\uC9C1 \uC791\uC5C5 \uC911",
|
|
5075
|
+
working: "\uC791\uC5C5 \uC911"
|
|
5076
|
+
}
|
|
5077
|
+
};
|
|
5078
|
+
function toolLines(tool, i, lang) {
|
|
5079
|
+
var ko = lang === "ko";
|
|
5080
|
+
var inp = i && typeof i === "object" ? i : {};
|
|
5081
|
+
var q = clip(inp.query || inp.question, 40);
|
|
5082
|
+
var f = fileName(inp.path);
|
|
5083
|
+
var tbl = clip(inp.table_name, 30);
|
|
5084
|
+
switch (tool) {
|
|
5085
|
+
case "searchText":
|
|
5086
|
+
return ko ? [
|
|
5087
|
+
q ? f ? f + '\uC5D0\uC11C "' + q + '" \uCC3E\uB294 \uC911' : '\uD30C\uC77C\uC5D0\uC11C "' + q + '" \uCC3E\uB294 \uC911' : "\uD30C\uC77C\uC5D0\uC11C \uCC3E\uB294 \uC911",
|
|
5088
|
+
"\uBAA8\uB4E0 \uD398\uC774\uC9C0\uB97C \uD655\uC778\uD558\uB294 \uC911",
|
|
5089
|
+
"\uC544\uC9C1 \uCC3E\uB294 \uC911, \uD070 \uD504\uB85C\uC81D\uD2B8\uB294 \uC870\uAE08 \uB354 \uAC78\uB824\uC694",
|
|
5090
|
+
"\uACC4\uC18D \uCC3E\uB294 \uC911, \uAE30\uB2E4\uB824 \uC8FC\uC154\uC11C \uAC10\uC0AC\uD574\uC694"
|
|
5091
|
+
] : [
|
|
5092
|
+
q ? f ? "Searching " + f + ' for "' + q + '"' : 'Searching your files for "' + q + '"' : "Searching your files",
|
|
5093
|
+
"Checking every page",
|
|
5094
|
+
"Still searching, big projects take a bit longer",
|
|
5095
|
+
"Still searching, thanks for waiting"
|
|
5096
|
+
];
|
|
5097
|
+
case "readFileContent":
|
|
5098
|
+
return ko ? [
|
|
5099
|
+
f ? f + " \uC77D\uB294 \uC911" : "\uD30C\uC77C\uC744 \uC77D\uB294 \uC911",
|
|
5100
|
+
"\uD398\uC774\uC9C0\uB97C \uC0B4\uD3B4\uBCF4\uB294 \uC911",
|
|
5101
|
+
"\uC544\uC9C1 \uC77D\uB294 \uC911, \uAE34 \uD30C\uC77C\uC740 \uC870\uAE08 \uB354 \uAC78\uB824\uC694"
|
|
5102
|
+
] : [
|
|
5103
|
+
f ? "Reading " + f : "Reading a file",
|
|
5104
|
+
"Going through the pages",
|
|
5105
|
+
"Still reading, long files take a bit longer"
|
|
5106
|
+
];
|
|
5107
|
+
case "getFileOutline":
|
|
5108
|
+
return ko ? [f ? f + " \uAD6C\uC131\uC744 \uC0B4\uD3B4\uBCF4\uB294 \uC911" : "\uD30C\uC77C \uAD6C\uC131\uC744 \uC0B4\uD3B4\uBCF4\uB294 \uC911", "\uBAA9\uCC28\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : [f ? "Looking at how " + f + " is laid out" : "Looking at how the file is laid out", "Checking the table of contents", T.en.still];
|
|
5109
|
+
case "getRecords":
|
|
5110
|
+
return ko ? [
|
|
5111
|
+
tbl ? tbl + " \uD14C\uC774\uBE14\uC5D0\uC11C \uAE30\uB85D\uC744 \uCC3E\uB294 \uC911" : "\uAE30\uB85D\uC744 \uCC3E\uB294 \uC911",
|
|
5112
|
+
"\uD589\uC744 \uC0B4\uD3B4\uBCF4\uB294 \uC911",
|
|
5113
|
+
"\uC544\uC9C1 \uCC3E\uB294 \uC911, \uD070 \uD14C\uC774\uBE14\uC740 \uC870\uAE08 \uB354 \uAC78\uB824\uC694"
|
|
5114
|
+
] : [
|
|
5115
|
+
tbl ? "Looking up records in " + tbl : "Looking up records",
|
|
5116
|
+
"Going through the rows",
|
|
5117
|
+
"Still looking, big tables take a bit longer"
|
|
5118
|
+
];
|
|
5119
|
+
case "exportRecordsToFile":
|
|
5120
|
+
return ko ? [tbl ? tbl + " \uAE30\uB85D\uC744 \uD30C\uC77C\uB85C \uB9CC\uB4DC\uB294 \uC911" : "\uAE30\uB85D\uC744 \uD30C\uC77C\uB85C \uB9CC\uB4DC\uB294 \uC911", "\uD30C\uC77C\uC744 \uB9CC\uB4DC\uB294 \uC911", "\uC544\uC9C1 \uB9CC\uB4DC\uB294 \uC911, \uD070 \uD14C\uC774\uBE14\uC740 \uC870\uAE08 \uB354 \uAC78\uB824\uC694"] : [tbl ? "Exporting records from " + tbl : "Exporting records", "Building the file", "Still exporting, big tables take a bit longer"];
|
|
5121
|
+
case "writeReport":
|
|
5122
|
+
return ko ? ["\uBCF4\uACE0\uC11C\uB97C \uC791\uC131\uD558\uB294 \uC911", "\uC544\uC9C1 \uC791\uC131\uD558\uB294 \uC911, \uAE34 \uBCF4\uACE0\uC11C\uB294 \uC870\uAE08 \uB354 \uAC78\uB824\uC694"] : ["Writing the report", "Still writing, long reports take a bit longer"];
|
|
5123
|
+
case "getTables":
|
|
5124
|
+
return ko ? ["\uC5B4\uB5A4 \uD14C\uC774\uBE14\uC774 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking which tables there are", T.en.still];
|
|
5125
|
+
case "getTags":
|
|
5126
|
+
return ko ? ["\uD0DC\uADF8\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking tags", T.en.still];
|
|
5127
|
+
case "getIndexes":
|
|
5128
|
+
return ko ? ["\uD14C\uC774\uBE14 \uD56D\uBAA9\uC744 \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking the table's fields", T.en.still];
|
|
5129
|
+
case "getUniqueId":
|
|
5130
|
+
return ko ? ["\uB808\uCF54\uB4DC ID\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking record IDs", T.en.still];
|
|
5131
|
+
case "postRecords":
|
|
5132
|
+
return ko ? ["\uAE30\uB85D\uC744 \uC800\uC7A5\uD558\uB294 \uC911", T.ko.still] : ["Saving records", T.en.still];
|
|
5133
|
+
case "updateRecords":
|
|
5134
|
+
return ko ? ["\uAE30\uB85D\uC744 \uC218\uC815\uD558\uB294 \uC911", T.ko.still] : ["Updating records", T.en.still];
|
|
5135
|
+
case "deleteRecords":
|
|
5136
|
+
return ko ? ["\uAE30\uB85D\uC744 \uC0AD\uC81C\uD558\uB294 \uC911", T.ko.still] : ["Deleting records", T.en.still];
|
|
5137
|
+
case "getTemporaryUrl":
|
|
5138
|
+
return ko ? [f ? f + " \uB9C1\uD06C\uB97C \uB9CC\uB4DC\uB294 \uC911" : "\uB9C1\uD06C\uB97C \uB9CC\uB4DC\uB294 \uC911", T.ko.still] : [f ? "Getting a link to " + f : "Getting a link", T.en.still];
|
|
5139
|
+
case "getToolResponsePage":
|
|
5140
|
+
return ko ? ["\uACB0\uACFC\uC758 \uB2E4\uC74C \uBD80\uBD84\uC744 \uC77D\uB294 \uC911", T.ko.still] : ["Reading the next part of the results", T.en.still];
|
|
5141
|
+
case "correctSearchLink":
|
|
5142
|
+
return ko ? ["\uD398\uC774\uC9C0 \uB9C1\uD06C\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking the page link", T.en.still];
|
|
5143
|
+
case "getProjectInfos":
|
|
5144
|
+
return ko ? ["\uD504\uB85C\uC81D\uD2B8 \uC815\uBCF4\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking the project details", T.en.still];
|
|
5145
|
+
case "getProfile":
|
|
5146
|
+
return ko ? ["\uACC4\uC815 \uC815\uBCF4\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking your account", T.en.still];
|
|
5147
|
+
case "web_search":
|
|
5148
|
+
case "web_search_call":
|
|
5149
|
+
return ko ? ["\uC6F9\uC5D0\uC11C \uCC3E\uB294 \uC911", T.ko.still] : ["Searching the web", T.en.still];
|
|
5150
|
+
default:
|
|
5151
|
+
return ko ? [T.ko.working, T.ko.still] : [T.en.working, T.en.still];
|
|
5152
|
+
}
|
|
5153
|
+
}
|
|
5154
|
+
function pick(lines, elapsed, loopFrom) {
|
|
5155
|
+
var n = Math.floor(Math.max(0, elapsed) / CHAT_ACTIVITY_ROTATE_MS);
|
|
5156
|
+
if (n < lines.length) return lines[n];
|
|
5157
|
+
var from = Math.min(Math.max(0, loopFrom || 0), lines.length - 1);
|
|
5158
|
+
var span = lines.length - from;
|
|
5159
|
+
return lines[from + (n - lines.length) % span];
|
|
5160
|
+
}
|
|
5161
|
+
function chatActivityLine(msg, now, lang) {
|
|
5162
|
+
var t = typeof now === "number" ? now : Date.now();
|
|
5163
|
+
var L = langOf(lang);
|
|
5164
|
+
var start = turnStart(msg, t);
|
|
5165
|
+
var act = chatActivityOf(msg);
|
|
5166
|
+
if (!act || act.step === "thinking") return pick(T[L].thinking, t - start, 1);
|
|
5167
|
+
var elapsed = t - act.since;
|
|
5168
|
+
if (act.step === "writing") return pick(T[L].writing, elapsed);
|
|
5169
|
+
if (act.step === "between") return pick(T[L].between, elapsed);
|
|
5170
|
+
return pick(toolLines(act.tool || "", act.input, L), elapsed);
|
|
5171
|
+
}
|
|
5172
|
+
|
|
4907
5173
|
// src/engine/history.ts
|
|
4908
5174
|
function filterListByClearHorizon(list, clearedAt) {
|
|
4909
5175
|
if (!clearedAt) return list;
|
|
@@ -5579,7 +5845,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
5579
5845
|
restore(anchor);
|
|
5580
5846
|
return result;
|
|
5581
5847
|
}
|
|
5582
|
-
function
|
|
5848
|
+
function remember2() {
|
|
5583
5849
|
held = capture();
|
|
5584
5850
|
}
|
|
5585
5851
|
function hold() {
|
|
@@ -5625,7 +5891,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
5625
5891
|
capture,
|
|
5626
5892
|
restore,
|
|
5627
5893
|
preserve,
|
|
5628
|
-
remember,
|
|
5894
|
+
remember: remember2,
|
|
5629
5895
|
hold,
|
|
5630
5896
|
pinBottom,
|
|
5631
5897
|
absorb,
|
|
@@ -6903,6 +7169,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
6903
7169
|
_paintLiveStream(st) {
|
|
6904
7170
|
if (st.ended) return;
|
|
6905
7171
|
st.lastPaintAt = nowMs();
|
|
7172
|
+
noteChatActivity(st.id, st.parser.snapshot());
|
|
6906
7173
|
if (this.getHistoryCacheKey() !== st.ownerKey) return;
|
|
6907
7174
|
var idx = this._liveTargetIndex(st.id);
|
|
6908
7175
|
if (idx === -1) {
|
|
@@ -11760,7 +12027,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
11760
12027
|
* or waiting is left to the live queue check, which shows it as it settles; one already
|
|
11761
12028
|
* in the chat is not read again. Never throws.
|
|
11762
12029
|
*/
|
|
11763
|
-
loadRunPasses(storagePath,
|
|
12030
|
+
loadRunPasses(storagePath, fileName2) {
|
|
11764
12031
|
var self = this;
|
|
11765
12032
|
var cfg = chatEngineConfig();
|
|
11766
12033
|
var list = cfg.listIndexPasses, lookup = cfg.csrHistoryItemLookup;
|
|
@@ -11779,7 +12046,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
11779
12046
|
p.error = void 0;
|
|
11780
12047
|
this.host.notify();
|
|
11781
12048
|
var svcId = id.projectId, owner = id.owner;
|
|
11782
|
-
var name =
|
|
12049
|
+
var name = fileName2 || storagePath.split("/").pop() || storagePath;
|
|
11783
12050
|
var idsReady = p.ids.length ? Promise.resolve(p.ids) : Promise.resolve(list(svcId, storagePath)).then(function(ids) {
|
|
11784
12051
|
var clean = (Array.isArray(ids) ? ids : []).filter(function(x) {
|
|
11785
12052
|
return typeof x === "string" && !!x;
|
|
@@ -11941,14 +12208,14 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
11941
12208
|
});
|
|
11942
12209
|
}
|
|
11943
12210
|
/** The page progress to show for a file's row, or null (see _refreshPageProgress). */
|
|
11944
|
-
pageProgressFor(storagePath,
|
|
12211
|
+
pageProgressFor(storagePath, fileName2) {
|
|
11945
12212
|
var map = this.state.indexPageProgress;
|
|
11946
12213
|
if (!map) return null;
|
|
11947
12214
|
var p = storagePath ? map[storagePath] : void 0;
|
|
11948
|
-
if (!p &&
|
|
12215
|
+
if (!p && fileName2) {
|
|
11949
12216
|
var hit = null;
|
|
11950
12217
|
for (var k in map) {
|
|
11951
|
-
if (k ===
|
|
12218
|
+
if (k === fileName2 || k.slice(-(fileName2.length + 1)) === "/" + fileName2) {
|
|
11952
12219
|
if (hit) {
|
|
11953
12220
|
hit = null;
|
|
11954
12221
|
break;
|
|
@@ -13573,7 +13840,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
13573
13840
|
(function() {
|
|
13574
13841
|
var MCP_PROD = "https://mcp.skapi.com";
|
|
13575
13842
|
var MCP_DEV = "https://mcp.broadwayinc.computer";
|
|
13576
|
-
var BQ_VERSION = "1.21.
|
|
13843
|
+
var BQ_VERSION = "1.21.14" ;
|
|
13577
13844
|
var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
|
|
13578
13845
|
var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
13579
13846
|
var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
@@ -17349,6 +17616,34 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
17349
17616
|
if (CS.stickToBottom) chatScrollAnchor.pinBottom();
|
|
17350
17617
|
if (nextH < prevH) ensureHistoryFillsViewport();
|
|
17351
17618
|
}
|
|
17619
|
+
var activityLineEls = [];
|
|
17620
|
+
var activityTicker = null;
|
|
17621
|
+
function activityLang() {
|
|
17622
|
+
return typeof navigator !== "undefined" && navigator.language ? navigator.language : "";
|
|
17623
|
+
}
|
|
17624
|
+
function tickActivityLines() {
|
|
17625
|
+
var now = Date.now();
|
|
17626
|
+
var keep = [];
|
|
17627
|
+
for (var i = 0; i < activityLineEls.length; i++) {
|
|
17628
|
+
var el = activityLineEls[i];
|
|
17629
|
+
if (!el.isConnected) continue;
|
|
17630
|
+
keep.push(el);
|
|
17631
|
+
var t = chatActivityLine(el._bqMsg, now, activityLang());
|
|
17632
|
+
if (el.textContent !== t) el.textContent = t;
|
|
17633
|
+
}
|
|
17634
|
+
activityLineEls = keep;
|
|
17635
|
+
if (!keep.length && activityTicker) {
|
|
17636
|
+
clearInterval(activityTicker);
|
|
17637
|
+
activityTicker = null;
|
|
17638
|
+
}
|
|
17639
|
+
}
|
|
17640
|
+
function buildActivityText(msg) {
|
|
17641
|
+
var text = h("span", { class: "bq-activity-text", text: chatActivityLine(msg, Date.now(), activityLang()) });
|
|
17642
|
+
text._bqMsg = msg;
|
|
17643
|
+
activityLineEls.push(text);
|
|
17644
|
+
if (!activityTicker) activityTicker = setInterval(tickActivityLines, 1e3);
|
|
17645
|
+
return text;
|
|
17646
|
+
}
|
|
17352
17647
|
function buildMessageEl(msg, idx) {
|
|
17353
17648
|
var cls = ["bq-message"];
|
|
17354
17649
|
cls.push(msg.role === "user" ? "is-user" : "is-assistant");
|
|
@@ -17359,7 +17654,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
17359
17654
|
if (msg._dimSending || msg._cancelling) cls.push("is-sending-to-server");
|
|
17360
17655
|
var bubble;
|
|
17361
17656
|
if (msg.isPending && !msg._streaming || streamRecoveryPhase(msg) === "active") {
|
|
17362
|
-
bubble = h(
|
|
17657
|
+
bubble = h(
|
|
17658
|
+
"div",
|
|
17659
|
+
{ class: "bq-bubble" },
|
|
17660
|
+
msg.role === "assistant" && !msg.isBackgroundTask && !streamRecoveryPhase(msg) ? buildActivityText(msg) : null,
|
|
17661
|
+
h("span", { class: "bq-loader" })
|
|
17662
|
+
);
|
|
17363
17663
|
if (msg.role === "assistant" && !msg.isBackgroundTask && !streamRecoveryPhase(msg)) {
|
|
17364
17664
|
var waitDisabled = !msg._serverItemId || msg._cancelling;
|
|
17365
17665
|
var stopWaitBtn = h("button", {
|