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/dist/engine.cjs CHANGED
@@ -1076,7 +1076,7 @@ function buildChatSystemPrompt(params) {
1076
1076
  const indexGroupLiteral = typeof g === "number" ? String(g) : g === "public" || g === "private" || g === "authorized" || g === "admin" ? `"${g}"` : '"authorized"';
1077
1077
  const reindexHint = canUpload === false ? `asking the project's owner to re-index that file` : client === "console" ? `re-indexing that file (select it on the Files page and choose Reindex)` : `re-indexing that file (attach the same file again and choose to reindex it)`;
1078
1078
  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.
1079
- 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 are written in (their names, titles and earlier hits show it): one or two short queries of the main terms (e.g. "oil leak", "gearbox"), before concluding anything.
1079
+ 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.
1080
1080
  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`}.
1081
1081
  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.
1082
1082
  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.
@@ -4814,6 +4814,7 @@ function createSseParser() {
4814
4814
  var error = null;
4815
4815
  var stopReason = null;
4816
4816
  var toolCalls = [];
4817
+ var argBuf = {};
4817
4818
  var malformedFrames = 0;
4818
4819
  var malformedToolJson = 0;
4819
4820
  var message = null;
@@ -4936,7 +4937,10 @@ function createSseParser() {
4936
4937
  type: block.type
4937
4938
  };
4938
4939
  if (typeof block.server_name === "string") call.serverName = block.server_name;
4940
+ if (typeof block.id === "string" && block.id) call.id = block.id;
4939
4941
  toolCalls.push(call);
4942
+ } else if (block && typeof block.type === "string") {
4943
+ markClaudeCallsDone(block);
4940
4944
  }
4941
4945
  return;
4942
4946
  }
@@ -4960,6 +4964,10 @@ function createSseParser() {
4960
4964
  var j = numberOr(ev.index, -1);
4961
4965
  var s = j >= 0 ? blocks.get(j) : void 0;
4962
4966
  if (s && s.sawJson) finishToolJson(s);
4967
+ if (s && s.block && s.block.input && typeof s.block.input === "object") {
4968
+ var sc = callAt(j);
4969
+ if (sc) sc.input = s.block.input;
4970
+ }
4963
4971
  return;
4964
4972
  }
4965
4973
  if (type === "message_delta") {
@@ -5020,6 +5028,34 @@ function createSseParser() {
5020
5028
  malformedToolJson++;
5021
5029
  }
5022
5030
  }
5031
+ function callAt(index) {
5032
+ for (var k = toolCalls.length - 1; k >= 0; k--) {
5033
+ if (toolCalls[k].index === index) return toolCalls[k];
5034
+ }
5035
+ return null;
5036
+ }
5037
+ function markClaudeCallsDone(block) {
5038
+ var t = block.type;
5039
+ if (/tool_result$/.test(t)) {
5040
+ var ref = typeof block.tool_use_id === "string" ? block.tool_use_id : "";
5041
+ for (var k = 0; k < toolCalls.length; k++) {
5042
+ if (ref && toolCalls[k].id === ref) toolCalls[k].done = true;
5043
+ }
5044
+ return;
5045
+ }
5046
+ if (t === "text" || t === "thinking" || t === "redacted_thinking") {
5047
+ for (var m = 0; m < toolCalls.length; m++) toolCalls[m].done = true;
5048
+ }
5049
+ }
5050
+ function parseArgs(args) {
5051
+ if (args && typeof args === "object") return args;
5052
+ if (typeof args !== "string" || !args) return void 0;
5053
+ try {
5054
+ return JSON.parse(args);
5055
+ } catch (e) {
5056
+ return void 0;
5057
+ }
5058
+ }
5023
5059
  function deltaBlockType(deltaType) {
5024
5060
  if (deltaType === "thinking_delta" || deltaType === "signature_delta") return "thinking";
5025
5061
  if (deltaType === "input_json_delta") return "tool_use";
@@ -5053,13 +5089,54 @@ function createSseParser() {
5053
5089
  if (type === "response.output_item.added") {
5054
5090
  var item = ev.item;
5055
5091
  if (item && typeof item.type === "string" && OPENAI_TOOL_ITEMS[item.type]) {
5056
- toolCalls.push({
5092
+ var oc = {
5057
5093
  index: numberOr(ev.output_index, toolCalls.length),
5058
5094
  // A built-in tool (web_search_call) has no name of its own, so the item
5059
5095
  // type is the only label there is and a row can still be drawn.
5060
5096
  name: typeof item.name === "string" && item.name ? item.name : item.type,
5061
5097
  type: item.type
5062
- });
5098
+ };
5099
+ if (typeof item.id === "string" && item.id) oc.id = item.id;
5100
+ var oa = parseArgs(item.arguments);
5101
+ if (oa !== void 0) oc.input = oa;
5102
+ toolCalls.push(oc);
5103
+ }
5104
+ return;
5105
+ }
5106
+ if (type === "response.mcp_call_arguments.delta" || type === "response.function_call_arguments.delta") {
5107
+ var gi = numberOr(ev.output_index, -1);
5108
+ var gc = callAt(gi);
5109
+ if (gc && gc.input === void 0 && typeof ev.delta === "string") {
5110
+ argBuf[gi] = (argBuf[gi] || "") + ev.delta;
5111
+ var gt = argBuf[gi].trim();
5112
+ if (gt.charAt(gt.length - 1) === "}") {
5113
+ var ga = parseArgs(gt);
5114
+ if (ga !== void 0) gc.input = ga;
5115
+ }
5116
+ }
5117
+ return;
5118
+ }
5119
+ if (type === "response.mcp_call_arguments.done" || type === "response.function_call_arguments.done") {
5120
+ var ac = callAt(numberOr(ev.output_index, -1));
5121
+ var aa = parseArgs(ev.arguments);
5122
+ if (ac && aa !== void 0) ac.input = aa;
5123
+ return;
5124
+ }
5125
+ if (type === "response.mcp_call.completed" || type === "response.mcp_call.failed") {
5126
+ var cc = callAt(numberOr(ev.output_index, -1));
5127
+ if (cc) cc.done = true;
5128
+ return;
5129
+ }
5130
+ if (type === "response.output_item.done") {
5131
+ var di = ev.item;
5132
+ if (di && typeof di.type === "string" && OPENAI_TOOL_ITEMS[di.type]) {
5133
+ var dc = callAt(numberOr(ev.output_index, -1));
5134
+ if (dc) {
5135
+ var da = parseArgs(di.arguments);
5136
+ if (da !== void 0) dc.input = da;
5137
+ else if (di.action && typeof di.action === "object" && dc.input === void 0) dc.input = di.action;
5138
+ dc.done = true;
5139
+ }
5063
5140
  }
5064
5141
  return;
5065
5142
  }
@@ -5210,7 +5287,12 @@ function createSseParser() {
5210
5287
  provider,
5211
5288
  text: currentText(),
5212
5289
  thinkingText: currentThinking(),
5213
- toolCalls: toolCalls.slice(),
5290
+ // Copied per call, not just per array: a call's input/done fill in after it
5291
+ // is first seen, and a snapshot already handed out must not change under
5292
+ // its reader.
5293
+ toolCalls: toolCalls.map(function(t) {
5294
+ return Object.assign({}, t);
5295
+ }),
5214
5296
  toolNames: toolCalls.map(function(t) {
5215
5297
  return t.name;
5216
5298
  }),
@@ -5264,6 +5346,190 @@ function mergeInto(target, src) {
5264
5346
  return target;
5265
5347
  }
5266
5348
 
5349
+ // src/engine/activity.ts
5350
+ var CHAT_ACTIVITY_ROTATE_MS = 4e3;
5351
+ var byItem = /* @__PURE__ */ new Map();
5352
+ var startByObj = /* @__PURE__ */ new WeakMap();
5353
+ var startById = /* @__PURE__ */ new Map();
5354
+ var MAX_IDS = 200;
5355
+ function remember(map, key, value) {
5356
+ if (map.has(key)) map.delete(key);
5357
+ map.set(key, value);
5358
+ if (map.size > MAX_IDS) {
5359
+ var oldest = map.keys().next();
5360
+ if (!oldest.done) map.delete(oldest.value);
5361
+ }
5362
+ }
5363
+ function stepOf(snap) {
5364
+ if (!snap) return { step: "thinking", count: 0 };
5365
+ var calls = Array.isArray(snap.toolCalls) ? snap.toolCalls : [];
5366
+ if (typeof snap.text === "string" && /\S/.test(snap.text)) return { step: "writing", count: calls.length };
5367
+ if (!calls.length) return { step: "thinking", count: 0 };
5368
+ var last = calls[calls.length - 1];
5369
+ if (last && !last.done) return { step: "tool", call: last, count: calls.length };
5370
+ return { step: "between", count: calls.length };
5371
+ }
5372
+ function noteChatActivity(serverItemId, snap, now) {
5373
+ if (!serverItemId) return;
5374
+ var t = typeof now === "number" ? now : Date.now();
5375
+ var s = stepOf(snap);
5376
+ var key = s.step + ":" + s.count;
5377
+ var prev = byItem.get(serverItemId);
5378
+ if (prev && prev.key === key) {
5379
+ if (s.call && s.call.input !== void 0 && prev.input === void 0) prev.input = s.call.input;
5380
+ return;
5381
+ }
5382
+ var act = { step: s.step, since: t, key };
5383
+ if (s.call) {
5384
+ act.tool = s.call.name;
5385
+ if (s.call.input !== void 0) act.input = s.call.input;
5386
+ }
5387
+ remember(byItem, serverItemId, act);
5388
+ }
5389
+ function chatActivityOf(msg) {
5390
+ var id = msg && typeof msg._serverItemId === "string" ? msg._serverItemId : "";
5391
+ return id && byItem.get(id) || null;
5392
+ }
5393
+ function turnStart(msg, now) {
5394
+ var ids = [];
5395
+ if (msg && typeof msg._serverItemId === "string" && msg._serverItemId) ids.push(msg._serverItemId);
5396
+ if (msg && typeof msg._localId === "string" && msg._localId) ids.push(msg._localId);
5397
+ var t;
5398
+ if (msg && typeof msg === "object") t = startByObj.get(msg);
5399
+ for (var i = 0; t === void 0 && i < ids.length; i++) t = startById.get(ids[i]);
5400
+ if (t === void 0) t = now;
5401
+ if (msg && typeof msg === "object") startByObj.set(msg, t);
5402
+ for (var j = 0; j < ids.length; j++) if (startById.get(ids[j]) !== t) remember(startById, ids[j], t);
5403
+ return t;
5404
+ }
5405
+ function langOf(lang) {
5406
+ return typeof lang === "string" && /^ko\b/i.test(lang) ? "ko" : "en";
5407
+ }
5408
+ function clip(v, max) {
5409
+ if (typeof v !== "string") return "";
5410
+ var s = v.replace(/\s+/g, " ").trim();
5411
+ if (s.length > max) s = s.slice(0, max - 1).trim() + "\u2026";
5412
+ return s;
5413
+ }
5414
+ function fileName(v) {
5415
+ if (typeof v !== "string" || !v) return "";
5416
+ var s = v.replace(/^(src::|db:)/, "");
5417
+ var parts = s.split("/").filter(function(p) {
5418
+ return !!p;
5419
+ });
5420
+ return clip(parts.length ? parts[parts.length - 1] : s, 40);
5421
+ }
5422
+ var T = {
5423
+ en: {
5424
+ 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"],
5425
+ 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"],
5426
+ writing: ["Writing the answer"],
5427
+ still: "Still working on it",
5428
+ working: "Working"
5429
+ },
5430
+ ko: {
5431
+ 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"],
5432
+ 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"],
5433
+ writing: ["\uB2F5\uBCC0\uC744 \uC791\uC131\uD558\uB294 \uC911"],
5434
+ still: "\uC544\uC9C1 \uC791\uC5C5 \uC911",
5435
+ working: "\uC791\uC5C5 \uC911"
5436
+ }
5437
+ };
5438
+ function toolLines(tool, i, lang) {
5439
+ var ko = lang === "ko";
5440
+ var inp = i && typeof i === "object" ? i : {};
5441
+ var q = clip(inp.query || inp.question, 40);
5442
+ var f = fileName(inp.path);
5443
+ var tbl = clip(inp.table_name, 30);
5444
+ switch (tool) {
5445
+ case "searchText":
5446
+ return ko ? [
5447
+ q ? f ? f + '\uC5D0\uC11C "' + q + '" \uCC3E\uB294 \uC911' : '\uD30C\uC77C\uC5D0\uC11C "' + q + '" \uCC3E\uB294 \uC911' : "\uD30C\uC77C\uC5D0\uC11C \uCC3E\uB294 \uC911",
5448
+ "\uBAA8\uB4E0 \uD398\uC774\uC9C0\uB97C \uD655\uC778\uD558\uB294 \uC911",
5449
+ "\uC544\uC9C1 \uCC3E\uB294 \uC911, \uD070 \uD504\uB85C\uC81D\uD2B8\uB294 \uC870\uAE08 \uB354 \uAC78\uB824\uC694",
5450
+ "\uACC4\uC18D \uCC3E\uB294 \uC911, \uAE30\uB2E4\uB824 \uC8FC\uC154\uC11C \uAC10\uC0AC\uD574\uC694"
5451
+ ] : [
5452
+ q ? f ? "Searching " + f + ' for "' + q + '"' : 'Searching your files for "' + q + '"' : "Searching your files",
5453
+ "Checking every page",
5454
+ "Still searching, big projects take a bit longer",
5455
+ "Still searching, thanks for waiting"
5456
+ ];
5457
+ case "readFileContent":
5458
+ return ko ? [
5459
+ f ? f + " \uC77D\uB294 \uC911" : "\uD30C\uC77C\uC744 \uC77D\uB294 \uC911",
5460
+ "\uD398\uC774\uC9C0\uB97C \uC0B4\uD3B4\uBCF4\uB294 \uC911",
5461
+ "\uC544\uC9C1 \uC77D\uB294 \uC911, \uAE34 \uD30C\uC77C\uC740 \uC870\uAE08 \uB354 \uAC78\uB824\uC694"
5462
+ ] : [
5463
+ f ? "Reading " + f : "Reading a file",
5464
+ "Going through the pages",
5465
+ "Still reading, long files take a bit longer"
5466
+ ];
5467
+ case "getFileOutline":
5468
+ 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];
5469
+ case "getRecords":
5470
+ return ko ? [
5471
+ tbl ? tbl + " \uD14C\uC774\uBE14\uC5D0\uC11C \uAE30\uB85D\uC744 \uCC3E\uB294 \uC911" : "\uAE30\uB85D\uC744 \uCC3E\uB294 \uC911",
5472
+ "\uD589\uC744 \uC0B4\uD3B4\uBCF4\uB294 \uC911",
5473
+ "\uC544\uC9C1 \uCC3E\uB294 \uC911, \uD070 \uD14C\uC774\uBE14\uC740 \uC870\uAE08 \uB354 \uAC78\uB824\uC694"
5474
+ ] : [
5475
+ tbl ? "Looking up records in " + tbl : "Looking up records",
5476
+ "Going through the rows",
5477
+ "Still looking, big tables take a bit longer"
5478
+ ];
5479
+ case "exportRecordsToFile":
5480
+ 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"];
5481
+ case "writeReport":
5482
+ 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"];
5483
+ case "getTables":
5484
+ 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];
5485
+ case "getTags":
5486
+ return ko ? ["\uD0DC\uADF8\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking tags", T.en.still];
5487
+ case "getIndexes":
5488
+ return ko ? ["\uD14C\uC774\uBE14 \uD56D\uBAA9\uC744 \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking the table's fields", T.en.still];
5489
+ case "getUniqueId":
5490
+ return ko ? ["\uB808\uCF54\uB4DC ID\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking record IDs", T.en.still];
5491
+ case "postRecords":
5492
+ return ko ? ["\uAE30\uB85D\uC744 \uC800\uC7A5\uD558\uB294 \uC911", T.ko.still] : ["Saving records", T.en.still];
5493
+ case "updateRecords":
5494
+ return ko ? ["\uAE30\uB85D\uC744 \uC218\uC815\uD558\uB294 \uC911", T.ko.still] : ["Updating records", T.en.still];
5495
+ case "deleteRecords":
5496
+ return ko ? ["\uAE30\uB85D\uC744 \uC0AD\uC81C\uD558\uB294 \uC911", T.ko.still] : ["Deleting records", T.en.still];
5497
+ case "getTemporaryUrl":
5498
+ 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];
5499
+ case "getToolResponsePage":
5500
+ 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];
5501
+ case "correctSearchLink":
5502
+ return ko ? ["\uD398\uC774\uC9C0 \uB9C1\uD06C\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking the page link", T.en.still];
5503
+ case "getProjectInfos":
5504
+ return ko ? ["\uD504\uB85C\uC81D\uD2B8 \uC815\uBCF4\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking the project details", T.en.still];
5505
+ case "getProfile":
5506
+ return ko ? ["\uACC4\uC815 \uC815\uBCF4\uB97C \uD655\uC778\uD558\uB294 \uC911", T.ko.still] : ["Checking your account", T.en.still];
5507
+ case "web_search":
5508
+ case "web_search_call":
5509
+ return ko ? ["\uC6F9\uC5D0\uC11C \uCC3E\uB294 \uC911", T.ko.still] : ["Searching the web", T.en.still];
5510
+ default:
5511
+ return ko ? [T.ko.working, T.ko.still] : [T.en.working, T.en.still];
5512
+ }
5513
+ }
5514
+ function pick(lines, elapsed, loopFrom) {
5515
+ var n = Math.floor(Math.max(0, elapsed) / CHAT_ACTIVITY_ROTATE_MS);
5516
+ if (n < lines.length) return lines[n];
5517
+ var from = Math.min(Math.max(0, loopFrom || 0), lines.length - 1);
5518
+ var span = lines.length - from;
5519
+ return lines[from + (n - lines.length) % span];
5520
+ }
5521
+ function chatActivityLine(msg, now, lang) {
5522
+ var t = typeof now === "number" ? now : Date.now();
5523
+ var L = langOf(lang);
5524
+ var start = turnStart(msg, t);
5525
+ var act = chatActivityOf(msg);
5526
+ if (!act || act.step === "thinking") return pick(T[L].thinking, t - start, 1);
5527
+ var elapsed = t - act.since;
5528
+ if (act.step === "writing") return pick(T[L].writing, elapsed);
5529
+ if (act.step === "between") return pick(T[L].between, elapsed);
5530
+ return pick(toolLines(act.tool || "", act.input, L), elapsed);
5531
+ }
5532
+
5267
5533
  // src/engine/history.ts
5268
5534
  function filterListByClearHorizon(list, clearedAt) {
5269
5535
  if (!clearedAt) return list;
@@ -5948,7 +6214,7 @@ function createScrollAnchor(options) {
5948
6214
  restore(anchor);
5949
6215
  return result;
5950
6216
  }
5951
- function remember() {
6217
+ function remember2() {
5952
6218
  held = capture();
5953
6219
  }
5954
6220
  function hold() {
@@ -5994,7 +6260,7 @@ function createScrollAnchor(options) {
5994
6260
  capture,
5995
6261
  restore,
5996
6262
  preserve,
5997
- remember,
6263
+ remember: remember2,
5998
6264
  hold,
5999
6265
  pinBottom,
6000
6266
  absorb,
@@ -7272,6 +7538,7 @@ var _ChatSession = class _ChatSession {
7272
7538
  _paintLiveStream(st) {
7273
7539
  if (st.ended) return;
7274
7540
  st.lastPaintAt = nowMs();
7541
+ noteChatActivity(st.id, st.parser.snapshot());
7275
7542
  if (this.getHistoryCacheKey() !== st.ownerKey) return;
7276
7543
  var idx = this._liveTargetIndex(st.id);
7277
7544
  if (idx === -1) {
@@ -12129,7 +12396,7 @@ var _ChatSession = class _ChatSession {
12129
12396
  * or waiting is left to the live queue check, which shows it as it settles; one already
12130
12397
  * in the chat is not read again. Never throws.
12131
12398
  */
12132
- loadRunPasses(storagePath, fileName) {
12399
+ loadRunPasses(storagePath, fileName2) {
12133
12400
  var self = this;
12134
12401
  var cfg = chatEngineConfig();
12135
12402
  var list = cfg.listIndexPasses, lookup = cfg.csrHistoryItemLookup;
@@ -12148,7 +12415,7 @@ var _ChatSession = class _ChatSession {
12148
12415
  p.error = void 0;
12149
12416
  this.host.notify();
12150
12417
  var svcId = id.projectId, owner = id.owner;
12151
- var name = fileName || storagePath.split("/").pop() || storagePath;
12418
+ var name = fileName2 || storagePath.split("/").pop() || storagePath;
12152
12419
  var idsReady = p.ids.length ? Promise.resolve(p.ids) : Promise.resolve(list(svcId, storagePath)).then(function(ids) {
12153
12420
  var clean = (Array.isArray(ids) ? ids : []).filter(function(x) {
12154
12421
  return typeof x === "string" && !!x;
@@ -12310,14 +12577,14 @@ var _ChatSession = class _ChatSession {
12310
12577
  });
12311
12578
  }
12312
12579
  /** The page progress to show for a file's row, or null (see _refreshPageProgress). */
12313
- pageProgressFor(storagePath, fileName) {
12580
+ pageProgressFor(storagePath, fileName2) {
12314
12581
  var map = this.state.indexPageProgress;
12315
12582
  if (!map) return null;
12316
12583
  var p = storagePath ? map[storagePath] : void 0;
12317
- if (!p && fileName) {
12584
+ if (!p && fileName2) {
12318
12585
  var hit = null;
12319
12586
  for (var k in map) {
12320
- if (k === fileName || k.slice(-(fileName.length + 1)) === "/" + fileName) {
12587
+ if (k === fileName2 || k.slice(-(fileName2.length + 1)) === "/" + fileName2) {
12321
12588
  if (hit) {
12322
12589
  hit = null;
12323
12590
  break;
@@ -13946,6 +14213,7 @@ exports.ANSWER_MODE_SETTING_LABEL = ANSWER_MODE_SETTING_LABEL;
13946
14213
  exports.BG_INDEXING_QUEUE_SUFFIX = BG_INDEXING_QUEUE_SUFFIX;
13947
14214
  exports.BOM = BOM;
13948
14215
  exports.BOM_EXTS = BOM_EXTS;
14216
+ exports.CHAT_ACTIVITY_ROTATE_MS = CHAT_ACTIVITY_ROTATE_MS;
13949
14217
  exports.CHAT_GREETING_MAX_LENGTH = CHAT_GREETING_MAX_LENGTH;
13950
14218
  exports.CLAUDE_INPUT_CAP_RATIO = CLAUDE_INPUT_CAP_RATIO;
13951
14219
  exports.CLAUDE_PER_REQUEST_INPUT_CAP = CLAUDE_PER_REQUEST_INPUT_CAP;
@@ -14060,6 +14328,8 @@ exports.callClaudeWithMcp = callClaudeWithMcp;
14060
14328
  exports.callClaudeWithPublicMcp = callClaudeWithPublicMcp;
14061
14329
  exports.callOpenAIWithPublicMcp = callOpenAIWithPublicMcp;
14062
14330
  exports.canonicalizePathForm = canonicalizePathForm;
14331
+ exports.chatActivityLine = chatActivityLine;
14332
+ exports.chatActivityOf = chatActivityOf;
14063
14333
  exports.chatCacheKey = chatCacheKey;
14064
14334
  exports.chatEffortFields = chatEffortFields;
14065
14335
  exports.chatEngineConfig = chatEngineConfig;
@@ -14191,6 +14461,7 @@ exports.normalizeTextContent = normalizeTextContent;
14191
14461
  exports.normalizeTrailingInlineToken = normalizeTrailingInlineToken;
14192
14462
  exports.normalizeUploadAccessGroup = normalizeUploadAccessGroup;
14193
14463
  exports.normalizeWebAccess = normalizeWebAccess;
14464
+ exports.noteChatActivity = noteChatActivity;
14194
14465
  exports.notifyAgentSaveAttachment = notifyAgentSaveAttachment;
14195
14466
  exports.parseAiAgentValue = parseAiAgentValue;
14196
14467
  exports.parseAttachmentContent = parseAttachmentContent;