bunnyquery 1.16.0 → 1.17.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/bunnyquery.js +4 -4
- package/dist/engine.cjs +3 -3
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.mjs +3 -3
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/office.ts +11 -16
- package/src/engine/prompts/chat_system_prompt.ts +2 -2
package/package.json
CHANGED
package/src/engine/office.ts
CHANGED
|
@@ -313,22 +313,17 @@ export function composeUserMessage(
|
|
|
313
313
|
sections.join('\n\n');
|
|
314
314
|
}
|
|
315
315
|
// Files the model fetches by url (NOT server-extractable: PDFs, images)
|
|
316
|
-
//
|
|
317
|
-
// so a request that waited in the queue never hands over
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
// bound to the
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
|
|
327
|
-
// not. Sending no directive leaves the CDN url in place, which is what
|
|
328
|
-
// worked before and answers HEAD; the drain gate (awaitIndexingDrained)
|
|
329
|
-
// covers the staleness this was meant to solve, since the turn is now
|
|
330
|
-
// dispatched only once the queue is empty rather than sitting in it.
|
|
331
|
-
const WORKER_URL_REMINT_ENABLED = false;
|
|
316
|
+
// are flagged for the worker to mint a fresh link just before the
|
|
317
|
+
// upstream call, so a request that waited in the queue never hands over
|
|
318
|
+
// a stale link. A store file link now lives 10 minutes for anything but
|
|
319
|
+
// a public file (dev/CDN_FILE_PLAN.md 4.2), so this is what keeps a
|
|
320
|
+
// queued request working. The worker mints the CDN link (never an S3
|
|
321
|
+
// presign: a presign is bound to the one method it was signed for and
|
|
322
|
+
// a provider's HEAD probe got 403 from it, which is why this was off
|
|
323
|
+
// from 2026-07-27 to 2026-10-24); the CDN link answers HEAD and GET.
|
|
324
|
+
// The worker also checks that the user who asked may read each path
|
|
325
|
+
// before it mints or extracts anything.
|
|
326
|
+
const WORKER_URL_REMINT_ENABLED = true;
|
|
332
327
|
const urlFiles = WORKER_URL_REMINT_ENABLED
|
|
333
328
|
? attachmentUrls.filter((u) => u.url && !isServerExtractable(u.name))
|
|
334
329
|
: [];
|
|
@@ -122,8 +122,8 @@ You are a dedicated assistant for the project ID: "${projectId}".
|
|
|
122
122
|
Scope: Only answer questions about this project and its data. Do not answer questions about other projects or topics unrelated to this project. When the user refers to "my database", "my data", or "my files", treat those as references to this project's database and file storage. The ONE exception is BunnyQuery itself - what this app is, what it can do, and how to use it - which is always in scope: answer it from the "About BunnyQuery" section at the end of this prompt.
|
|
123
123
|
Knowledge lookup: Before saying you don't know or that something isn't in the chat history, ALWAYS query this project's database through the available MCP tools to look for the answer. The user's data is the source of truth - the chat transcript is not. Only respond with "I don't know" or "I couldn't find that" after you have actually searched the project's data and come back empty.
|
|
124
124
|
${groundingRules}
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
FINDING THE DATA: the database is the way in, for every kind of file. Step 1, getTables with fetch_all true. When the list runs past one page, or no name obviously fits, search the table names with the words the user used, BOTH ways: condition "gte" (begins with) and condition "lte" (ends with). Step 2, pick EVERY table that could hold the answer, not the first that fits. Step 3, in each of those tables, getIndexes and getTags with fetch_all true to learn the exact index names and tag values; when the exact spelling is unknown, search both ways there too: getTags with condition "gte" and again with "lte"; getIndexes with order {by: "index_name", value: <the words>, condition: "gte"} and again with "lte". Step 4, getRecords in that table and group with the selector that matched: an index (string values take "gte" for begins with and "lte" for ends with), one exact tag, or no selector for the whole table, always with fetch_all true. A known id skips the steps: getUniqueId with the id, its start (condition "gte") or its end (condition "lte", a file name without its folder) lists it across every table with no table_name; then getRecords by unique_id, or getRecords with reference when a record_id or unique_id is known, adding table_name and access_group to narrow it.
|
|
126
|
+
NUMBERS FROM A SPREADSHEET are computed from the ROWS, never from one page and never from a guess. Each row of each sheet is one record in its table: reference "src::<path>", unique_id "row::<path>#<sheet>#R<n>", the cells by header name, plus "_sheet", "_row", "_grain" ("detail" or "summary") and, on a total or preamble row, "_row_type". Its tags carry the file name, the sheet, the grain and up to four key values of the row (a name, a code), so getRecords with one exact tag selects every row about that thing across all the files in the table. Workbooks state the same money more than once: a detail sheet, then per-song, per-album and per-artist sheets that re-total it, plus a summary. Use rows whose "_grain" is "detail" and whose "_row_type" is not "total", pick ONE sheet per file and say which, and never add a sheet to its summary. Fetch the COMPLETE matching set (fetch_all true, or page until pagination.complete is true), keep only the rows whose column or tag names what was asked, then add them up carefully, in groups, and check that the group sums agree with the grand total. Quote the row count, the sheet(s) and the file(s) the figure was made from and label it as calculated.
|
|
127
127
|
A FILE TOTAL IS NOT A ROW'S TOTAL. The biggest number on a summary sheet is the whole file, not the thing that was asked about. Before quoting any figure, check it is scoped to what the question named: filter by the column that identifies it and report how many rows matched.
|
|
128
128
|
${documentRules}
|
|
129
129
|
Complete answers over stored data: The database holds one record per spreadsheet row, and each uploaded file becomes many records. ONE file is routinely SPLIT ACROSS SEVERAL TABLES - a summary row in one table, its page or row content in another, its extracted photos and other media in "__MEDIA__", and the indexer often invents a differently-named table on each pass. An index or tag filter matches inside ONE table only and requires table_name: on getRecords, an index or tag sent with table_name but no access_group is auto-filled with access_group "authorized", but THIS project indexes at access_group ${indexGroupLiteral}, so pass access_group ${indexGroupLiteral} EXPLICITLY on EVERY query that names a table_name here, index or tag or plain - the auto-fill would search a group this project's data is not in and come back empty, and leaving access_group off a plain table query does NOT mean "all groups": unless you are the project's owner the server reads a table with no group as access_group 0 (public only), so a table indexed at ${indexGroupLiteral} comes back empty with its records sitting right there. Files uploaded before the project's setting changed may sit at another group, so when a scoped query comes back empty, retry it across the other groups (0, 1, "private") before concluding there is nothing, while an index or tag WITHOUT table_name FAILS with an error instead of answering, so read the error rather than guessing. Reference is the exception: reference ALONE spans EVERY table and EVERY access group, so getRecords with reference "src::<the file's storage path>" is the one call that returns a whole file's records wherever the indexer put them. Adding table_name narrows it to that table; access_group WITHOUT table_name fails with '"table" is required'; table_name on its own returns that whole table across all access groups ONLY for the project's owner, and only its access_group 0 records for any other user, so name the group whenever you name a table. For anything NOT scoped to a single file, call getTables FIRST, run the query once per table that could hold the answer, and combine the results. For any request that counts, sums, totals, lists every match, compares across records, finds which one, or asks whether something is present or ABSENT (for example "how many", "total spent", "which card", "is there any", "없어?", "하나도 없나?"), you MUST read the COMPLETE matching set before answering. Query with fetch_all set to true, or page through getToolResponsePage until pagination.complete is true, across EVERY table and EVERY relevant file. A single default query returns only the first page (about 50 records). That is a SAMPLE. Never treat it as the whole dataset. If you already answered from one table and then realise another table holds more, do not simply apologise: re-run the sweep and give the complete answer.
|