bunnyquery 1.5.4 → 1.5.6
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
CHANGED
|
@@ -2214,7 +2214,7 @@ ${options.inlineContentPlaceholder}
|
|
|
2214
2214
|
(function() {
|
|
2215
2215
|
var MCP_PROD = "https://mcp.broadwayinc.computer";
|
|
2216
2216
|
var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
|
|
2217
|
-
var BQ_VERSION = "1.5.
|
|
2217
|
+
var BQ_VERSION = "1.5.5" ;
|
|
2218
2218
|
var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
|
|
2219
2219
|
var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
2220
2220
|
var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
@@ -3814,8 +3814,8 @@ ${options.inlineContentPlaceholder}
|
|
|
3814
3814
|
// [{ id, name, file, status, progress, uploadedUrl, storagePath, errorMessage }]
|
|
3815
3815
|
uploadingAttachments: false,
|
|
3816
3816
|
attachmentWarning: "",
|
|
3817
|
-
|
|
3818
|
-
//
|
|
3817
|
+
attachmentCapNotice: "",
|
|
3818
|
+
// informational "N files not added" when an add hit MAX_ATTACHMENT_FILE_COUNT
|
|
3819
3819
|
attachmentsRow: null,
|
|
3820
3820
|
// .bq-attachments DOM node
|
|
3821
3821
|
attachBtnEl: null,
|
|
@@ -4333,7 +4333,7 @@ ${options.inlineContentPlaceholder}
|
|
|
4333
4333
|
var FILE_ICON_SVG = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>';
|
|
4334
4334
|
var FOLDER_ICON_SVG = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>';
|
|
4335
4335
|
var MAX_CHATBOX_FILE_COUNT = 20;
|
|
4336
|
-
var MAX_ATTACHMENT_FILE_COUNT =
|
|
4336
|
+
var MAX_ATTACHMENT_FILE_COUNT = 20;
|
|
4337
4337
|
var VISIBLE_CHIP_CAP = 30;
|
|
4338
4338
|
var ESTIMATED_BYTES_PER_TOKEN = 3;
|
|
4339
4339
|
var ESTIMATED_PDF_BYTES_PER_TOKEN = 5e3;
|
|
@@ -4387,10 +4387,6 @@ ${options.inlineContentPlaceholder}
|
|
|
4387
4387
|
return el ? (el.value || "").trim() : "";
|
|
4388
4388
|
}
|
|
4389
4389
|
function recomputeAttachmentWarning() {
|
|
4390
|
-
if (CS.attachmentCapHit) {
|
|
4391
|
-
CS.attachmentWarning = "You can attach up to " + MAX_ATTACHMENT_FILE_COUNT + " files per message.";
|
|
4392
|
-
return;
|
|
4393
|
-
}
|
|
4394
4390
|
if (!currentChatInputText()) {
|
|
4395
4391
|
CS.attachmentWarning = "";
|
|
4396
4392
|
return;
|
|
@@ -4455,13 +4451,12 @@ ${options.inlineContentPlaceholder}
|
|
|
4455
4451
|
remaining -= count;
|
|
4456
4452
|
changed = true;
|
|
4457
4453
|
});
|
|
4458
|
-
|
|
4454
|
+
CS.attachmentCapNotice = dropped > 0 ? "You can attach up to " + MAX_ATTACHMENT_FILE_COUNT + " files per message. " + dropped + " file" + (dropped === 1 ? " was" : "s were") + " not added." : "";
|
|
4459
4455
|
if (changed) {
|
|
4460
4456
|
recomputeAttachmentWarning();
|
|
4461
4457
|
renderAttachmentChips();
|
|
4462
4458
|
scheduleAttachmentOverflowRecompute();
|
|
4463
4459
|
} else if (dropped > 0) {
|
|
4464
|
-
recomputeAttachmentWarning();
|
|
4465
4460
|
renderAttachmentChips();
|
|
4466
4461
|
}
|
|
4467
4462
|
updateComposerControls();
|
|
@@ -4566,7 +4561,7 @@ ${options.inlineContentPlaceholder}
|
|
|
4566
4561
|
return true;
|
|
4567
4562
|
});
|
|
4568
4563
|
CS.visibleAttachmentCount = Infinity;
|
|
4569
|
-
CS.
|
|
4564
|
+
CS.attachmentCapNotice = "";
|
|
4570
4565
|
recomputeAttachmentWarning();
|
|
4571
4566
|
renderAttachmentChips();
|
|
4572
4567
|
updateComposerControls();
|
|
@@ -4585,7 +4580,7 @@ ${options.inlineContentPlaceholder}
|
|
|
4585
4580
|
}
|
|
4586
4581
|
}
|
|
4587
4582
|
CS.attachments.splice(i, 1);
|
|
4588
|
-
CS.
|
|
4583
|
+
CS.attachmentCapNotice = "";
|
|
4589
4584
|
recomputeAttachmentWarning();
|
|
4590
4585
|
renderAttachmentChips();
|
|
4591
4586
|
updateComposerControls();
|
|
@@ -4602,7 +4597,7 @@ ${options.inlineContentPlaceholder}
|
|
|
4602
4597
|
});
|
|
4603
4598
|
CS.attachments = [];
|
|
4604
4599
|
CS.attachmentWarning = "";
|
|
4605
|
-
CS.
|
|
4600
|
+
CS.attachmentCapNotice = "";
|
|
4606
4601
|
renderAttachmentChips();
|
|
4607
4602
|
updateComposerControls();
|
|
4608
4603
|
scheduleAttachmentOverflowRecompute();
|
|
@@ -4614,7 +4609,7 @@ ${options.inlineContentPlaceholder}
|
|
|
4614
4609
|
CS.attachments.forEach(function(a) {
|
|
4615
4610
|
a._abort = null;
|
|
4616
4611
|
});
|
|
4617
|
-
CS.
|
|
4612
|
+
CS.attachmentCapNotice = "";
|
|
4618
4613
|
recomputeAttachmentWarning();
|
|
4619
4614
|
renderAttachmentChips();
|
|
4620
4615
|
updateComposerControls();
|
|
@@ -4642,11 +4637,14 @@ ${options.inlineContentPlaceholder}
|
|
|
4642
4637
|
var row = CS.attachmentsRow;
|
|
4643
4638
|
if (!row) return;
|
|
4644
4639
|
row.innerHTML = "";
|
|
4645
|
-
if (!CS.attachments.length && !CS.attachmentWarning) {
|
|
4640
|
+
if (!CS.attachments.length && !CS.attachmentWarning && !CS.attachmentCapNotice) {
|
|
4646
4641
|
row.style.display = "none";
|
|
4647
4642
|
return;
|
|
4648
4643
|
}
|
|
4649
4644
|
row.style.display = "";
|
|
4645
|
+
if (CS.attachmentCapNotice) {
|
|
4646
|
+
row.appendChild(h("div", { class: "bq-attachment-warning" }, h("span", { text: CS.attachmentCapNotice })));
|
|
4647
|
+
}
|
|
4650
4648
|
if (CS.attachmentWarning) {
|
|
4651
4649
|
row.appendChild(h("div", { class: "bq-attachment-warning" }, h("span", { text: CS.attachmentWarning })));
|
|
4652
4650
|
}
|
|
@@ -4731,10 +4729,9 @@ ${options.inlineContentPlaceholder}
|
|
|
4731
4729
|
}
|
|
4732
4730
|
function updateComposerControls() {
|
|
4733
4731
|
var uploading = CS.uploadingAttachments;
|
|
4734
|
-
|
|
4735
|
-
if (CS.
|
|
4736
|
-
if (CS.
|
|
4737
|
-
if (CS.sendBtnEl) CS.sendBtnEl.disabled = blocked || !!CS.attachmentWarning;
|
|
4732
|
+
if (CS.attachBtnEl) CS.attachBtnEl.disabled = uploading;
|
|
4733
|
+
if (CS.inputEl) CS.inputEl.disabled = uploading;
|
|
4734
|
+
if (CS.sendBtnEl) CS.sendBtnEl.disabled = uploading || !!CS.attachmentWarning;
|
|
4738
4735
|
}
|
|
4739
4736
|
function onAttachInputChange(inputEl) {
|
|
4740
4737
|
if (inputEl && inputEl.files && inputEl.files.length) addFilesToAttachments(inputEl.files);
|
|
@@ -5067,7 +5064,7 @@ ${options.inlineContentPlaceholder}
|
|
|
5067
5064
|
CS.attachments = [];
|
|
5068
5065
|
CS.uploadingAttachments = false;
|
|
5069
5066
|
CS.attachmentWarning = "";
|
|
5070
|
-
CS.
|
|
5067
|
+
CS.attachmentCapNotice = "";
|
|
5071
5068
|
CS.attachmentsRow = null;
|
|
5072
5069
|
CS.attachBtnEl = null;
|
|
5073
5070
|
CS.sendBtnEl = null;
|
package/package.json
CHANGED
|
@@ -22,12 +22,13 @@ export function buildIndexingSystemPrompt(params: IndexingSystemPromptParams): s
|
|
|
22
22
|
let systemPrompt =
|
|
23
23
|
`You are a background indexing agent for project ${service}.
|
|
24
24
|
- Image files (.jpg, .jpeg, .png, .gif, .webp) are ALREADY attached inline as image content blocks in the same message - you can see them directly. Do NOT call web_fetch on image URLs; that will fail or return garbage. Just look at the image block and answer.
|
|
25
|
-
- Most files (office documents like .docx/.xlsx/.pptx/.hwp/.hwpx/.ods, and text/data/code files like .csv/.tsv/.json/.xml/.txt/.md and source code) have ALREADY been extracted on the server and included inline in the user message between the "BEGIN FILE CONTENT" / "END FILE CONTENT" markers - read that directly
|
|
26
|
-
-
|
|
25
|
+
- Most files (office documents like .docx/.xlsx/.pptx/.hwp/.hwpx/.ods, and text/data/code files like .csv/.tsv/.json/.xml/.txt/.md and source code) have ALREADY been extracted on the server and included inline in the user message between the "BEGIN FILE CONTENT" / "END FILE CONTENT" markers - read that directly. If the inline content is a "[skapi: ...]" note, the file could not be extracted - index it from its metadata only.
|
|
26
|
+
- BIG or SCANNED files: the inline content may be only the FIRST part of a large file (it can end with a truncation or "more remains" note), and scanned PDFs / files with embedded photos are not fully captured inline. In those cases READ THE FILE WITH THE readFileContent TOOL: it returns the file ONE WINDOW at a time (spreadsheets as coordinate-tagged grid rows, scanned/large PDFs as rendered PAGE IMAGES, text as a range of characters). Pass the file's storage path. After each window: datafy it into records and SAVE them, THEN if the window says MORE REMAINS call readFileContent again with the cursor it gives you. Repeat until it says END OF FILE, so the WHOLE file is indexed - never stop after the first window.
|
|
27
|
+
- VISION: when a readFileContent window (or an inline attachment) includes IMAGES - scanned PDF pages, or photos embedded in a spreadsheet next to a row/block - LOOK at them and capture what they show as record data (the reading/values in a scanned table, the part/defect/condition visible in a photo). The image IS part of the data; correlate each photo with its labelled block ("PHOTO A3" markers tie a photo to that grid row).
|
|
27
28
|
- Whatever the file type, use the file's storage path (the "storage path" metadata line) as the "src::" unique_id - never the inline content or a temporary URL.
|
|
28
|
-
- TABULAR data (any spreadsheet - .csv/.tsv/.xlsx/.ods, or sheet-like rows): you MUST save EVERY data row as its own record (ONE record per row) with that row's actual column values in the record's "data", keyed by the header names, in a dedicated table (e.g. "spreadsheet_rows"). Do NOT summarize, sample only a few rows, or save just file metadata - index the whole sheet
|
|
29
|
+
- TABULAR data (any spreadsheet - .csv/.tsv/.xlsx/.xls/.ods, or sheet-like rows): you MUST save EVERY data row as its own record (ONE record per row) with that row's actual column values in the record's "data", keyed by the header names, in a dedicated table (e.g. "spreadsheet_rows"). Do NOT summarize, sample only a few rows, or save just file metadata - index the whole sheet, paging through it with readFileContent when it is large. Make MULTIPLE postRecords calls in batches (e.g. 30-50 rows per call) rather than one oversized call. This per-row completeness OVERRIDES brevity. ALSO save one file-level summary record (file name, sheet name(s), column headers, total row count, overall summary) - this is the record that carries the file's "src::" unique_id - and link EVERY per-row record to it via reference (set each row record's reference to that src:: file record; the row records themselves do NOT carry a src:: unique_id). The per-row records AND this reference linkage are BOTH mandatory: the linkage is what lets the whole sheet be found and cleaned up together when the file is re-indexed.
|
|
29
30
|
- EPUB / e-books / long-form books (.epub or any book-length prose, provided inline in reading order with chapter headings preserved): you MUST save ONE record per CHAPTER (or, when chapters are unclear, per major section/topic) in a dedicated table (e.g. "book_chapters") - never collapse the whole book into a single record. Each chapter record's "data" must capture the chapter title plus its order/number AND a substantive summary of that chapter's content (key events, arguments, characters, places, concepts, terms, notable quotes). Apply AS MANY relevant tags as possible to EVERY chapter record (characters, locations, themes, topics, key concepts, key terms, dates, named entities) so the book is easy to SEARCH and cross-reference later - this is the whole point. ALSO save one book-level record (title, author, language, overall summary, chapter list / table of contents, genre/subjects) and link each chapter record to it via reference. This per-chapter completeness OVERRIDES brevity; human-readable summaries only, never raw/binary bytes.
|
|
30
|
-
- This is a
|
|
31
|
+
- This is a background indexing task: do ALL the MCP saving FIRST, never reply mid-task, and never ask the user questions. Always use the MCP tools to save what you learn - be exhaustive about meaning (and, for tabular data, about every row). SAVE AS YOU GO: persist each window's records before reading the next, so progress is never lost. If the file is so large you cannot finish in one turn, still save everything you have read so far and note the last cursor/page you reached; a follow-up will continue from there. Never store raw or binary bytes (base64, blobs); describe them in human-readable text instead.
|
|
31
32
|
- Only AFTER every save is done, send exactly ONE final message summarizing what you indexed - never just "Indexing complete", and never a raw/base64/binary value or a large pasted dump. Keep it to a few factual sentences or a short markdown bullet list covering: the file name, its content type, each table you wrote to with its record/row count and the key columns/fields or topics captured, and anything that could not be extracted. Follow this shape - Indexed <file name> (<content type>): saved <N> records to <table(s)> capturing <key columns/fields or topics>; could not extract: <gaps, or none>.`;
|
|
32
33
|
|
|
33
34
|
if (serviceDescription) {
|