bunnyquery 1.9.1 → 1.9.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.css +33 -0
- package/bunnyquery.js +296 -31
- package/dist/engine.cjs +70 -17
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.mts +96 -3
- package/dist/engine.d.ts +96 -3
- package/dist/engine.mjs +70 -18
- package/dist/engine.mjs.map +1 -1
- package/package.json +1 -1
- package/src/engine/host.ts +29 -0
- package/src/engine/prompts/chat_system_prompt.ts +20 -1
- package/src/engine/prompts/index.ts +1 -0
- package/src/engine/prompts/indexing_system_prompt.ts +13 -1
- package/src/engine/prompts/indexing_user_message.ts +29 -2
- package/src/engine/requests.ts +57 -6
- package/src/engine/session.ts +36 -3
- package/src/widget.css +33 -0
package/bunnyquery.css
CHANGED
|
@@ -1018,6 +1018,39 @@
|
|
|
1018
1018
|
}
|
|
1019
1019
|
.bq-overwrite-applyall input { cursor: pointer; margin: 0; }
|
|
1020
1020
|
|
|
1021
|
+
/* Access-group chooser (who may read a file once it is indexed). A radio list
|
|
1022
|
+
rather than a row of buttons: the three answers are not equally weighted and
|
|
1023
|
+
the hint under each is what actually distinguishes them. */
|
|
1024
|
+
.bq-access-options {
|
|
1025
|
+
display: flex;
|
|
1026
|
+
flex-direction: column;
|
|
1027
|
+
gap: 0.15rem;
|
|
1028
|
+
margin: 0 0 1rem;
|
|
1029
|
+
}
|
|
1030
|
+
.bq-access-option {
|
|
1031
|
+
display: grid;
|
|
1032
|
+
grid-template-columns: auto 1fr;
|
|
1033
|
+
align-items: baseline;
|
|
1034
|
+
column-gap: 0.5rem;
|
|
1035
|
+
padding: 0.5rem 0.6rem;
|
|
1036
|
+
border: 1px solid transparent;
|
|
1037
|
+
cursor: pointer;
|
|
1038
|
+
user-select: none;
|
|
1039
|
+
}
|
|
1040
|
+
.bq-access-option:hover { background: var(--bq-hover-bg); }
|
|
1041
|
+
.bq-access-option input { cursor: pointer; margin: 0; }
|
|
1042
|
+
.bq-access-option-label {
|
|
1043
|
+
font-size: 0.88rem;
|
|
1044
|
+
color: var(--bq-ink);
|
|
1045
|
+
}
|
|
1046
|
+
.bq-access-option-hint {
|
|
1047
|
+
grid-column: 2;
|
|
1048
|
+
font-size: 0.76rem;
|
|
1049
|
+
line-height: 1.35;
|
|
1050
|
+
color: var(--bq-muted);
|
|
1051
|
+
margin-top: 0.15rem;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1021
1054
|
/* ============================================================================
|
|
1022
1055
|
* RESPONSIVE
|
|
1023
1056
|
* ==========================================================================*/
|
package/bunnyquery.js
CHANGED
|
@@ -292,11 +292,13 @@ Extracted content of attached office files (read inline below; do NOT fetch thei
|
|
|
292
292
|
// src/engine/prompts/chat_system_prompt.ts
|
|
293
293
|
function buildChatSystemPrompt(params) {
|
|
294
294
|
const { projectId, serviceName, serviceDescription, greeting, canUpload} = params;
|
|
295
|
+
const g = params.indexAccessGroup;
|
|
296
|
+
const indexGroupLiteral = typeof g === "number" ? String(g) : g === "public" || g === "private" || g === "authorized" || g === "admin" ? `"${g}"` : '"authorized"';
|
|
295
297
|
let systemPrompt = `
|
|
296
298
|
You are a dedicated assistant for the project ID: "${projectId}".
|
|
297
299
|
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.
|
|
298
300
|
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.
|
|
299
|
-
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"
|
|
301
|
+
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 index or tag query here - the auto-fill would search a group this project's data is not in and come back empty. 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. 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", "\uC5C6\uC5B4?", "\uD558\uB098\uB3C4 \uC5C6\uB098?"), 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.
|
|
300
302
|
Never assert absence from a partial read. Do not say "there is no X", "none", "not found", or "\uC544\uB2C8\uC694, \uC5C6\uC2B5\uB2C8\uB2E4" until a complete scan has come back empty. If you have not finished scanning every relevant table and file, keep querying instead of guessing. A confident "no" that later turns out wrong is worse than telling the user you are still checking.
|
|
301
303
|
Embedded values: a search term is often stored inside a larger string. A merchant "BAKSA" appears as "DNH*BAKSA#4070277042", and a card as "5860****5173". Server-side index filters match only exact values, leading prefixes, or trailing suffixes, and tag filters only EXACT whole-tag values - never a partial or interior substring - so filtering on such a field silently drops rows. When the value you are looking for may be embedded, do not trust a narrow filter to be complete. Fetch the full set with fetch_all and match the substring yourself.
|
|
302
304
|
File attachments: When a user message contains an "Attached files:" section with markdown links, those links point to short-lived signed URLs in this project's db storage and will expire.
|
|
@@ -345,6 +347,7 @@ Project description: """${serviceDescription}"""`;
|
|
|
345
347
|
// src/engine/prompts/indexing_system_prompt.ts
|
|
346
348
|
function buildIndexingSystemPrompt(params) {
|
|
347
349
|
const { projectId, serviceName, serviceDescription } = params;
|
|
350
|
+
const accessGroup = params.accessGroup === "public" || params.accessGroup === "private" ? params.accessGroup : "authorized";
|
|
348
351
|
let systemPrompt = `You are a background indexing agent for project ${projectId}.
|
|
349
352
|
- 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.
|
|
350
353
|
- 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.
|
|
@@ -353,7 +356,8 @@ Project description: """${serviceDescription}"""`;
|
|
|
353
356
|
- VISION: when the message (a readFileContent window, an embedded PDF page, or an inline attachment) includes IMAGES - scanned/rendered 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).
|
|
354
357
|
- TRANSCRIBE, DO NOT DESCRIBE. When an image contains ANY text - a label, tag, stamp, form field, serial/part number, handwriting - your FIRST job is to read the characters out and store them VERBATIM, not to describe the scene. A record saying "a red inspection tag with handwritten markings" is worthless: it is unsearchable and every such photo produces the same sentence. Put the characters you can actually read into these EXACT fields, not variations of them: "printed_text" (the pre-printed wording), "handwritten_text" (what a person wrote by hand), and, when you can resolve one, "part_no", "tag_id" and "date". Same reason as the fixed table names: a field called photo_text in one pass and visible_text_notes in the next cannot be queried together. Read PARTIAL values rather than skipping: "500.7402.52__" beats nothing. Only when a character is genuinely unreadable, leave that field null or mark the unreadable span - do NOT invent it, and do NOT replace the whole transcription with a description of what the object looks like. A scene description is a nice extra AFTER the text, never instead of it.
|
|
355
358
|
- IMAGE FILES uploaded as the file itself: if ANY readable character appears ANYWHERE in the image (a label, a stamp, a sign in the background) it counts as an image WITH text - transcribe it per the rule above, and also capture the layout (what appears where) and every entity named. Only a truly text-free image gets description first: a one-line caption, then the objects present with their attributes (type, color, count, condition, position). Either way, save what you extract onto the file's "src::" record with updateRecords, TAG every entity and identifier visible, and INDEX the one number the image offers (a measured value, an amount, a count).
|
|
356
|
-
- Whatever the file type, this file's identity is "src::" + its storage path (the "storage path" metadata line) - never the inline content or a temporary URL. That record ALREADY EXISTS: the upload pipeline creates it in table "file_summaries" (access group "
|
|
359
|
+
- Whatever the file type, this file's identity is "src::" + its storage path (the "storage path" metadata line) - never the inline content or a temporary URL. That record ALREADY EXISTS: the upload pipeline creates it in table "file_summaries" (access group "${accessGroup}") before indexing starts, so posting it again is rejected as a duplicate unique_id. Reference it from every record you write, and add what you learn to it with updateRecords. If that update unexpectedly reports the record does not exist, post it yourself ONCE with that exact "src::" unique_id (table "file_summaries", access group "${accessGroup}") and carry on; this is the ONE exception to the do-NOT-post-the-file-record rules elsewhere in these instructions, because the source identity must never be dropped just because an update failed.
|
|
360
|
+
- ACCESS GROUP (hard rule): every record you write for this file - the file record, per-row records, chapters, summaries, intermediates - MUST be posted with access group "${accessGroup}". Pass it explicitly on every postRecords call; do not leave it out and do not vary it between passes of the same file. An access group is part of a record's table key, so records saved under a different group than the file are in a different table and will not come back with the rest of it: a "public" file whose rows were saved as "authorized" is one an anonymous visitor can see the name of and none of the contents of, and a re-index cannot find the strays to clean them up. The one exception is the EXTRACTED MEDIA records in "__MEDIA__", which the pipeline creates for you - leave their group alone and only enrich them.
|
|
357
361
|
- REACHABILITY (hard rule): every record you write while indexing this file MUST be reachable from the file's "src::<storage path>" record by following reference - either reference that record directly, or reference something that already reaches it. A record with no reference, or one pointing outside this file's chain, is an ORPHAN: deleting or re-indexing the file removes the reachable records and leaves the orphan behind forever, where it keeps turning up in later answers as stale data. If you create an intermediate record that OTHER records reference (a page record that rows hang off, a sheet or section record), set source.can_remove_referencing_records to true on it; the delete cascade passes a delete through a record only when that record carries the flag OR a unique_id starting "src::" (the file record cascades because its unique_id starts with "src::"; the intermediates you create carry no "src::" id, so they need the flag), and it cascades ONE LEVEL AT A TIME, so EVERY intermediate record in a chain needs its own marker - an unmarked link stops the cascade there and everything below it survives as orphans. When in doubt, reference the file record directly and keep the chain flat.
|
|
358
362
|
- 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 table named EXACTLY "spreadsheet_rows". Do NOT summarize, sample only a few rows, or save just file metadata - index the whole sheet, window by window, until it ends. Make MULTIPLE postRecords calls in batches (e.g. 30-50 rows per call) rather than one oversized call. This per-row completeness OVERRIDES brevity. The file-level "src::" record ALREADY EXISTS - the upload pipeline creates it before indexing starts - so do NOT create it. Link EVERY per-row record to it via reference (set each row record's reference to exactly "src::" + the storage path, with NO sheet/window/summary suffix added; the row records themselves do NOT carry a src:: unique_id). Enrich that same record with sheet name(s), column headers and total row count via updateRecords rather than posting another one. 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. INDEX each row record on the row's most useful NUMERIC column (named by its header) so rows sort and range-query; when the row has no numeric column, index the grid row number instead. TAG each row record with the sheet name, the file name, and the row's categorical values (a status, a category, a type) - tags are how rows are filtered without scanning the table.
|
|
359
363
|
- ONE RECORD PER GRID ROW, ALWAYS. "Row" means the numbered row of the sheet (R37 is one record), never a visual block, item, section or left/right pair. Sheets that repeat the same columns side by side (an A/B block beside a C/D block, "paired" or "mirrored" layouts) still get ONE record per grid row, holding BOTH sides - suffix the keys to keep them apart (PART_NO_A / PART_NO_B). Collapsing a 16-row window into 2 or 3 "block" records is the single most damaging mistake here: it silently loses most of the cells and makes every later total wrong, because some windows were counted per row and others per block. If a window shows rows R37 to R52, you save records for R37..R52 and the count you report is the number of grid rows you actually wrote.
|
|
@@ -374,6 +378,10 @@ Project description: """${serviceDescription}"""`;
|
|
|
374
378
|
}
|
|
375
379
|
|
|
376
380
|
// src/engine/prompts/indexing_user_message.ts
|
|
381
|
+
function indexingAccessGroup(attachment) {
|
|
382
|
+
const g = attachment && attachment.accessGroup;
|
|
383
|
+
return g === "public" || g === "private" ? g : "authorized";
|
|
384
|
+
}
|
|
377
385
|
function buildIndexingUserMessage(attachment, options) {
|
|
378
386
|
const head = `A new file has just been uploaded. Index it now.
|
|
379
387
|
|
|
@@ -382,7 +390,11 @@ File metadata:
|
|
|
382
390
|
- storage path: ${attachment.storagePath}
|
|
383
391
|
` + (attachment.mime ? `- mime type: ${attachment.mime}
|
|
384
392
|
` : "") + (typeof attachment.size === "number" ? `- size (bytes): ${attachment.size}
|
|
385
|
-
` : "")
|
|
393
|
+
` : "") + // Stated in the metadata block as well as the system prompt because this is
|
|
394
|
+
// the per-FILE value: one project can hold public and private files at once,
|
|
395
|
+
// and the system prompt is what is constant across the run.
|
|
396
|
+
`- access group (use this for EVERY record you write for this file): ${indexingAccessGroup(attachment)}
|
|
397
|
+
`;
|
|
386
398
|
if (options?.inlineContent) {
|
|
387
399
|
return head + `
|
|
388
400
|
The file's content was parsed by the client and is provided inline below. Read it directly - do NOT fetch any URL for this file. Set every record's reference to exactly "src::" + the storage path above (not this content). That file record already exists, so enrich it with updateRecords rather than posting it.
|
|
@@ -430,7 +442,8 @@ Records for the earlier pages are ALREADY saved (they reference "${src}"). The N
|
|
|
430
442
|
- name: ${attachment.name}
|
|
431
443
|
- storage path: ${attachment.storagePath}
|
|
432
444
|
` + (attachment.mime ? `- mime type: ${attachment.mime}
|
|
433
|
-
` : "")
|
|
445
|
+
` : "") + `- access group (use this for EVERY record you write for this file): ${indexingAccessGroup(attachment)}
|
|
446
|
+
`;
|
|
434
447
|
}
|
|
435
448
|
function buildRenderDatafy(placeholder) {
|
|
436
449
|
return `
|
|
@@ -473,7 +486,8 @@ File metadata:
|
|
|
473
486
|
- name: ${attachment.name}
|
|
474
487
|
- storage path: ${attachment.storagePath}
|
|
475
488
|
` + (attachment.mime ? `- mime type: ${attachment.mime}
|
|
476
|
-
` : "") +
|
|
489
|
+
` : "") + `- access group (use this for EVERY record you write for this file): ${indexingAccessGroup(attachment)}
|
|
490
|
+
|
|
477
491
|
Records for the earlier windows/pages of this file are ALREADY saved (they reference "${src}"). First call getRecords with reference "${src}" to see how far the previous pass got (the furthest row/window already saved). The reference ALONE is the whole query: it returns every record written from this file across ALL tables and ALL access groups, so do NOT add table_name or access_group to narrow it. The response is PAGED, so keep fetching pages until it reports there are no more, and take the furthest point from the WHOLE set, never from the first page. Then call readFileContent with the storage path above and a CURSOR that RESUMES just after that point - do NOT start at the beginning. The cursor is derivable from what you already saved:
|
|
478
492
|
- Spreadsheet: the cursor is "<sheetIndex>:<nextRow>" (0-based sheet index, 1-based row). If you saved up to row R of sheet S, use cursor="S:R+1".
|
|
479
493
|
- Text: the cursor is the character offset already read.
|
|
@@ -1459,6 +1473,11 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
1459
1473
|
var DEFAULT_CLAUDE_MODEL = "claude-sonnet-5";
|
|
1460
1474
|
var DEFAULT_OPENAI_MODEL = "gpt-5.6-luna";
|
|
1461
1475
|
var mcpUrl = () => chatEngineConfig().mcpBaseUrl;
|
|
1476
|
+
function mcpEndpointFor(anonymous, publicProjectId, service) {
|
|
1477
|
+
if (!anonymous) return { url: mcpUrl(), token: "$ACCESS_TOKEN" };
|
|
1478
|
+
const project = publicProjectId || service;
|
|
1479
|
+
return { url: String(mcpUrl()).replace(/\/+$/, "") + "/p/" + project };
|
|
1480
|
+
}
|
|
1462
1481
|
var clientSecretRequest = (opts) => chatEngineConfig().clientSecretRequest(opts);
|
|
1463
1482
|
var VARIANT_IMAGE_DETAIL = "original";
|
|
1464
1483
|
var VARIANT_TEXT_VERBOSITY = "high";
|
|
@@ -1684,7 +1703,8 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
1684
1703
|
}
|
|
1685
1704
|
});
|
|
1686
1705
|
}
|
|
1687
|
-
async function callClaudeWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, fileUrls, onResponse, onError) {
|
|
1706
|
+
async function callClaudeWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, fileUrls, onResponse, onError, mcpScope) {
|
|
1707
|
+
const endpoint = mcpEndpointFor(mcpScope?.anonymous, mcpScope?.publicProjectId, service);
|
|
1688
1708
|
return callClaudeWithMcp({
|
|
1689
1709
|
prompt,
|
|
1690
1710
|
messages,
|
|
@@ -1698,11 +1718,14 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
1698
1718
|
fileUrls,
|
|
1699
1719
|
mcpServer: {
|
|
1700
1720
|
name: MCP_NAME,
|
|
1701
|
-
url:
|
|
1702
|
-
authorizationToken
|
|
1721
|
+
url: endpoint.url,
|
|
1722
|
+
// Omitted entirely for an anonymous turn; the `if (mcpServer.authorizationToken)`
|
|
1723
|
+
// guard below drops the key rather than sending an empty one.
|
|
1724
|
+
authorizationToken: endpoint.token
|
|
1703
1725
|
}});
|
|
1704
1726
|
}
|
|
1705
|
-
async function callOpenAIWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, fileUrls, onResponse, onError) {
|
|
1727
|
+
async function callOpenAIWithPublicMcp(prompt, service, owner, messages, system, model, userId, extractContent, fileUrls, onResponse, onError, mcpScope) {
|
|
1728
|
+
const endpoint = mcpEndpointFor(mcpScope?.anonymous, mcpScope?.publicProjectId, service);
|
|
1706
1729
|
const resolvedModel = model || DEFAULT_OPENAI_MODEL;
|
|
1707
1730
|
const imageDetail = getOpenAIImageDetail(resolvedModel);
|
|
1708
1731
|
const messageList = messages && messages.length ? prepareOpenAIMessages(messages, imageDetail) : [
|
|
@@ -1745,11 +1768,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
1745
1768
|
{
|
|
1746
1769
|
type: "mcp",
|
|
1747
1770
|
server_label: MCP_NAME,
|
|
1748
|
-
server_url:
|
|
1771
|
+
server_url: endpoint.url,
|
|
1749
1772
|
require_approval: "never",
|
|
1750
|
-
headers:
|
|
1751
|
-
|
|
1752
|
-
|
|
1773
|
+
// No `headers` at all for an anonymous turn: `Bearer ` with an
|
|
1774
|
+
// empty token is a credential the MCP server rejects, and the
|
|
1775
|
+
// project-scoped endpoint needs none.
|
|
1776
|
+
...endpoint.token ? { headers: { Authorization: "Bearer " + endpoint.token } } : {}
|
|
1753
1777
|
},
|
|
1754
1778
|
...[
|
|
1755
1779
|
{
|
|
@@ -1860,7 +1884,10 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
1860
1884
|
// by the tools' schema pattern.
|
|
1861
1885
|
projectId: info.publicProjectId || service,
|
|
1862
1886
|
serviceName: info.serviceName,
|
|
1863
|
-
serviceDescription: info.serviceDescription
|
|
1887
|
+
serviceDescription: info.serviceDescription,
|
|
1888
|
+
// Per-FILE, not per-project: one project holds public and private files at
|
|
1889
|
+
// once, so this travels on the attachment rather than the identity.
|
|
1890
|
+
accessGroup: attachment.accessGroup
|
|
1864
1891
|
});
|
|
1865
1892
|
if (platform === "openai") {
|
|
1866
1893
|
const resolvedModel2 = info.model || DEFAULT_OPENAI_MODEL;
|
|
@@ -3383,10 +3410,23 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
3383
3410
|
this._lidSeq += 1;
|
|
3384
3411
|
return "lid_" + this._lidSeq;
|
|
3385
3412
|
}
|
|
3413
|
+
/**
|
|
3414
|
+
* The key every per-chat cache hangs off: the restored message cache, the
|
|
3415
|
+
* hydrated-body memo, the live-index key and the per-file storage-path key.
|
|
3416
|
+
*
|
|
3417
|
+
* It carries the IDENTITY as well as the project and platform. A single
|
|
3418
|
+
* browser can hold more than one conversation on one project without a
|
|
3419
|
+
* reload — an anonymous visitor who signs in, or a dashboard user who logs
|
|
3420
|
+
* out and back in as someone else — and with an identity-free key the
|
|
3421
|
+
* previous conversation stayed in the cache and was re-rendered, and written
|
|
3422
|
+
* back, as the new one's. `userId` is the same value the request queue is
|
|
3423
|
+
* named after, so two identities that share a queue share a cache, which is
|
|
3424
|
+
* exactly right.
|
|
3425
|
+
*/
|
|
3386
3426
|
getHistoryCacheKey() {
|
|
3387
3427
|
var id = this.host.getIdentity();
|
|
3388
3428
|
if (!id.projectId || id.platform === "none") return "";
|
|
3389
|
-
return id.projectId + "#" + id.platform;
|
|
3429
|
+
return id.projectId + "#" + id.platform + "#" + (id.userId || "");
|
|
3390
3430
|
}
|
|
3391
3431
|
/** Re-apply memoized hydrated texts onto freshly-mapped messages. Both
|
|
3392
3432
|
* clients call this right after their mapper runs (loadHistory does it
|
|
@@ -3589,7 +3629,9 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
3589
3629
|
if (projectId === void 0) projectId = id.projectId;
|
|
3590
3630
|
if (owner === void 0) owner = id.owner;
|
|
3591
3631
|
}
|
|
3592
|
-
|
|
3632
|
+
var liveId = this.host.getIdentity();
|
|
3633
|
+
var mcpScope = { anonymous: liveId.anonymous, publicProjectId: liveId.publicProjectId };
|
|
3634
|
+
return platform === "openai" ? callOpenAIWithPublicMcp(prompt, projectId, owner, messages, system, model, userId, extractContent, fileUrls, void 0, void 0, mcpScope) : callClaudeWithPublicMcp(prompt, projectId, owner, messages, system, model, userId, extractContent, fileUrls, void 0, void 0, mcpScope);
|
|
3593
3635
|
}
|
|
3594
3636
|
dispatchAgentRequest(params) {
|
|
3595
3637
|
var self = this;
|
|
@@ -5977,6 +6019,15 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
5977
6019
|
})).catch(function() {
|
|
5978
6020
|
});
|
|
5979
6021
|
});
|
|
6022
|
+
var accessGroup;
|
|
6023
|
+
preIndex = preIndex.then(function() {
|
|
6024
|
+
if (alreadyIndexing) return;
|
|
6025
|
+
if (typeof self.host.uploadAccessGroup !== "function") return;
|
|
6026
|
+
return Promise.resolve(self.host.uploadAccessGroup(member.storagePath)).then(function(g) {
|
|
6027
|
+
accessGroup = g || void 0;
|
|
6028
|
+
}).catch(function() {
|
|
6029
|
+
});
|
|
6030
|
+
});
|
|
5980
6031
|
return preIndex.then(function() {
|
|
5981
6032
|
return parseAttachmentContent(member.file, member.file.name, mime || void 0);
|
|
5982
6033
|
}).then(function(parsedContent) {
|
|
@@ -5995,7 +6046,8 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
5995
6046
|
storagePath: member.storagePath,
|
|
5996
6047
|
mime: mime || void 0,
|
|
5997
6048
|
size: member.file.size,
|
|
5998
|
-
url
|
|
6049
|
+
url,
|
|
6050
|
+
accessGroup
|
|
5999
6051
|
},
|
|
6000
6052
|
parsedContent: parsedContent || void 0
|
|
6001
6053
|
}).then(function(ack) {
|
|
@@ -6526,7 +6578,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
6526
6578
|
(function() {
|
|
6527
6579
|
var MCP_PROD = "https://mcp.broadwayinc.computer";
|
|
6528
6580
|
var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
|
|
6529
|
-
var BQ_VERSION = "1.9.
|
|
6581
|
+
var BQ_VERSION = "1.9.4" ;
|
|
6530
6582
|
var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
|
|
6531
6583
|
var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
6532
6584
|
var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
@@ -6542,7 +6594,9 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
6542
6594
|
// sessionStorage
|
|
6543
6595
|
googleRedirect: "bq_embed:google_redirect",
|
|
6544
6596
|
// sessionStorage
|
|
6545
|
-
clearHorizon: "bq_embed:clearedAt"
|
|
6597
|
+
clearHorizon: "bq_embed:clearedAt",
|
|
6598
|
+
anonId: "bq_embed:anon_id"
|
|
6599
|
+
// per-project anonymous device id
|
|
6546
6600
|
};
|
|
6547
6601
|
function h(tag, attrs) {
|
|
6548
6602
|
var el = document.createElement(tag);
|
|
@@ -6697,6 +6751,40 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
6697
6751
|
function skey(base) {
|
|
6698
6752
|
return base + ":" + (S.projectId || "default");
|
|
6699
6753
|
}
|
|
6754
|
+
function anonymousAllowed() {
|
|
6755
|
+
if (S.opts && typeof S.opts.allowAnonymous === "boolean") return S.opts.allowAnonymous;
|
|
6756
|
+
var conf = S.service && S.service.conf || null;
|
|
6757
|
+
if (!conf || typeof conf.prevent_anonymous === "undefined") return false;
|
|
6758
|
+
return !conf.prevent_anonymous;
|
|
6759
|
+
}
|
|
6760
|
+
function isAnonymousSession() {
|
|
6761
|
+
return !S.user && anonymousAllowed();
|
|
6762
|
+
}
|
|
6763
|
+
function randomId() {
|
|
6764
|
+
try {
|
|
6765
|
+
var buf = new Uint8Array(16);
|
|
6766
|
+
(window.crypto || window.msCrypto).getRandomValues(buf);
|
|
6767
|
+
var out = "";
|
|
6768
|
+
for (var i = 0; i < buf.length; i++) out += ("0" + buf[i].toString(16)).slice(-2);
|
|
6769
|
+
return out;
|
|
6770
|
+
} catch (e) {
|
|
6771
|
+
return "x" + Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
|
6772
|
+
}
|
|
6773
|
+
}
|
|
6774
|
+
var _anonIdMemo = null;
|
|
6775
|
+
function anonDeviceId() {
|
|
6776
|
+
if (_anonIdMemo) return _anonIdMemo;
|
|
6777
|
+
var key = skey(SK.anonId);
|
|
6778
|
+
var stored = lsGet(key);
|
|
6779
|
+
if (stored) {
|
|
6780
|
+
_anonIdMemo = stored;
|
|
6781
|
+
return stored;
|
|
6782
|
+
}
|
|
6783
|
+
var minted = "anon_" + randomId();
|
|
6784
|
+
lsSet(key, minted);
|
|
6785
|
+
_anonIdMemo = lsGet(key) || minted;
|
|
6786
|
+
return _anonIdMemo;
|
|
6787
|
+
}
|
|
6700
6788
|
function loadTheme() {
|
|
6701
6789
|
var stored = lsGet(SK.theme);
|
|
6702
6790
|
if (stored === "dark" || stored === "light") return stored;
|
|
@@ -7225,6 +7313,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
7225
7313
|
text: "Sign up \u2192"
|
|
7226
7314
|
}));
|
|
7227
7315
|
}
|
|
7316
|
+
var canReturnToChat = !S.user && anonymousAllowed();
|
|
7228
7317
|
var form = h(
|
|
7229
7318
|
"form",
|
|
7230
7319
|
{ class: "bq-form", onsubmit: submit },
|
|
@@ -7234,7 +7323,22 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
7234
7323
|
errorBox,
|
|
7235
7324
|
h("div", { class: "bq-form-bottom" }, submitBtn)
|
|
7236
7325
|
);
|
|
7237
|
-
var children =
|
|
7326
|
+
var children = [];
|
|
7327
|
+
if (canReturnToChat) {
|
|
7328
|
+
children.push(h(
|
|
7329
|
+
"div",
|
|
7330
|
+
{ class: "bq-settings-top" },
|
|
7331
|
+
h("button", {
|
|
7332
|
+
class: "bq-link",
|
|
7333
|
+
type: "button",
|
|
7334
|
+
onclick: function() {
|
|
7335
|
+
enterAfterLogin();
|
|
7336
|
+
},
|
|
7337
|
+
text: "\u2190 Back to chat"
|
|
7338
|
+
})
|
|
7339
|
+
));
|
|
7340
|
+
}
|
|
7341
|
+
children = children.concat(authHeader("Login")).concat([form]);
|
|
7238
7342
|
if (googleEnabled()) {
|
|
7239
7343
|
children.push(
|
|
7240
7344
|
h(
|
|
@@ -8185,7 +8289,15 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
8185
8289
|
return void 0;
|
|
8186
8290
|
})(),
|
|
8187
8291
|
owner: S.owner,
|
|
8188
|
-
|
|
8292
|
+
// The chat identity, which the engine turns into the request queue
|
|
8293
|
+
// name. An anonymous visitor gets their DEVICE id rather than the
|
|
8294
|
+
// project id: the old fallback gave every anonymous visitor of a
|
|
8295
|
+
// project the same queue, so they would have shared one transcript
|
|
8296
|
+
// and head-of-line-blocked each other's turns on a single FIFO.
|
|
8297
|
+
userId: S.user && S.user.user_id || (isAnonymousSession() ? anonDeviceId() : S.projectId),
|
|
8298
|
+
// Sends the turn's MCP tools to the project-scoped, credential-free
|
|
8299
|
+
// endpoint instead of the root one with an empty bearer.
|
|
8300
|
+
anonymous: isAnonymousSession(),
|
|
8189
8301
|
platform: S.aiPlatform,
|
|
8190
8302
|
model: S.aiModel || void 0,
|
|
8191
8303
|
serviceName: S.serviceName,
|
|
@@ -8247,7 +8359,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
8247
8359
|
return deleteFileIndexRecordDb(path);
|
|
8248
8360
|
},
|
|
8249
8361
|
ensureFileIndexRecord: function(path, meta) {
|
|
8250
|
-
return
|
|
8362
|
+
return resolveUploadAccessGroup(path).then(function(g) {
|
|
8363
|
+
return ensureFileIndexRecordDb(path, meta, g);
|
|
8364
|
+
});
|
|
8365
|
+
},
|
|
8366
|
+
uploadAccessGroup: function(path) {
|
|
8367
|
+
return resolveUploadAccessGroup(path);
|
|
8251
8368
|
},
|
|
8252
8369
|
storagePathFor: function(relPath) {
|
|
8253
8370
|
return attachmentStoragePath(relPath);
|
|
@@ -8259,7 +8376,8 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
8259
8376
|
return promptOverwrite(filename);
|
|
8260
8377
|
},
|
|
8261
8378
|
resetOverwriteBatch: function() {
|
|
8262
|
-
|
|
8379
|
+
resetOverwriteBatch();
|
|
8380
|
+
resetAccessGroupBatch();
|
|
8263
8381
|
},
|
|
8264
8382
|
renderAttachmentChips: function() {
|
|
8265
8383
|
renderAttachmentChips();
|
|
@@ -8370,7 +8488,11 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
8370
8488
|
// paints), so the model is told what it opened with. Same call as
|
|
8371
8489
|
// buildGreetingEl, so the two can never disagree.
|
|
8372
8490
|
greeting: greetingParts().text,
|
|
8373
|
-
canUpload: !uploadsFrozenForUser()
|
|
8491
|
+
canUpload: !uploadsFrozenForUser(),
|
|
8492
|
+
// Where THIS project's indexer writes. The MCP's auto-fill assumes
|
|
8493
|
+
// "authorized"; on a project set to public or private that would
|
|
8494
|
+
// search the wrong group and answer "nothing found".
|
|
8495
|
+
indexAccessGroup: projectUploadAccessGroup()});
|
|
8374
8496
|
}
|
|
8375
8497
|
function refreshSkapiSession() {
|
|
8376
8498
|
return S.skapi.getProfile({ refreshToken: true }).then(function() {
|
|
@@ -8813,12 +8935,12 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
8813
8935
|
}
|
|
8814
8936
|
return createChain();
|
|
8815
8937
|
}
|
|
8816
|
-
function ensureFileIndexRecordDb(storagePath, meta) {
|
|
8938
|
+
function ensureFileIndexRecordDb(storagePath, meta, accessGroup) {
|
|
8817
8939
|
if (!storagePath || !S.skapi || typeof S.skapi.postRecord !== "function") return Promise.resolve();
|
|
8818
8940
|
return Promise.resolve(S.skapi.postRecord(null, {
|
|
8819
8941
|
service: S.projectId,
|
|
8820
8942
|
unique_id: "src::" + storagePath,
|
|
8821
|
-
table: { name: "file_summaries", access_group:
|
|
8943
|
+
table: { name: "file_summaries", access_group: normalizeUploadAccessGroup(accessGroup) },
|
|
8822
8944
|
// Deleting the file record must cascade to every record referencing it.
|
|
8823
8945
|
source: { can_remove_referencing_records: true },
|
|
8824
8946
|
data: {
|
|
@@ -9517,7 +9639,9 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
9517
9639
|
}
|
|
9518
9640
|
function getClearHistoryStorageKey() {
|
|
9519
9641
|
if (!S.projectId || S.aiPlatform === "none") return "";
|
|
9520
|
-
|
|
9642
|
+
var key = SK.clearHorizon + ":" + S.projectId + "#" + S.aiPlatform;
|
|
9643
|
+
if (isAnonymousSession()) key += "#" + anonDeviceId();
|
|
9644
|
+
return key;
|
|
9521
9645
|
}
|
|
9522
9646
|
function getClearedAt() {
|
|
9523
9647
|
var key = getClearHistoryStorageKey();
|
|
@@ -9881,7 +10005,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
9881
10005
|
var liveIndex = session.getLiveIndexState();
|
|
9882
10006
|
var fresh = markerSweep.svc === S.projectId;
|
|
9883
10007
|
var stubs = void 0;
|
|
9884
|
-
if (fresh) {
|
|
10008
|
+
if (fresh && !isAnonymousSession()) {
|
|
9885
10009
|
stubs = {};
|
|
9886
10010
|
var myId = S.user && S.user.user_id || "";
|
|
9887
10011
|
for (var rp in markerSweep.runs) {
|
|
@@ -10392,6 +10516,16 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10392
10516
|
}
|
|
10393
10517
|
});
|
|
10394
10518
|
CS.settingsBtnEl = settingsBtn;
|
|
10519
|
+
var headerRight = isAnonymousSession() ? h("button", {
|
|
10520
|
+
class: "bq-link",
|
|
10521
|
+
type: "button",
|
|
10522
|
+
title: "Login",
|
|
10523
|
+
onclick: function() {
|
|
10524
|
+
renderLogin();
|
|
10525
|
+
},
|
|
10526
|
+
text: "Login"
|
|
10527
|
+
}) : settingsBtn;
|
|
10528
|
+
if (isAnonymousSession()) CS.settingsBtnEl = null;
|
|
10395
10529
|
var header = h(
|
|
10396
10530
|
"div",
|
|
10397
10531
|
{ class: "bq-section-title" },
|
|
@@ -10399,7 +10533,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10399
10533
|
"div",
|
|
10400
10534
|
{ class: "bq-title-row" },
|
|
10401
10535
|
brandTitleEl(),
|
|
10402
|
-
h("div", { class: "bq-title-right" },
|
|
10536
|
+
h("div", { class: "bq-title-right" }, headerRight)
|
|
10403
10537
|
)
|
|
10404
10538
|
);
|
|
10405
10539
|
var chatArea;
|
|
@@ -10536,6 +10670,128 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10536
10670
|
overwriteState.resolver = null;
|
|
10537
10671
|
if (r) r(choice);
|
|
10538
10672
|
}
|
|
10673
|
+
var UPLOAD_ACCESS_GROUPS = ["public", "authorized", "private"];
|
|
10674
|
+
var UPLOAD_ACCESS_LABELS = {
|
|
10675
|
+
public: "Public",
|
|
10676
|
+
authorized: "Signed in users",
|
|
10677
|
+
private: "Only me"
|
|
10678
|
+
};
|
|
10679
|
+
var UPLOAD_ACCESS_HINTS = {
|
|
10680
|
+
public: "Anyone can ask about this file, including visitors who are not logged in.",
|
|
10681
|
+
authorized: "Only users signed in to this project can ask about this file.",
|
|
10682
|
+
private: "Only you can ask about this file."
|
|
10683
|
+
};
|
|
10684
|
+
function normalizeUploadAccessGroup(v) {
|
|
10685
|
+
return UPLOAD_ACCESS_GROUPS.indexOf(v) === -1 ? "authorized" : v;
|
|
10686
|
+
}
|
|
10687
|
+
function projectAccessSetting() {
|
|
10688
|
+
var conf = S.service && S.service.conf || {};
|
|
10689
|
+
var v = conf.default_access_group;
|
|
10690
|
+
if (v === "ask") return "ask";
|
|
10691
|
+
return UPLOAD_ACCESS_GROUPS.indexOf(v) === -1 ? null : v;
|
|
10692
|
+
}
|
|
10693
|
+
function projectUploadAccessGroup() {
|
|
10694
|
+
var v = projectAccessSetting();
|
|
10695
|
+
return v && v !== "ask" ? v : "authorized";
|
|
10696
|
+
}
|
|
10697
|
+
function projectAsksUploadAccess() {
|
|
10698
|
+
return projectAccessSetting() === "ask";
|
|
10699
|
+
}
|
|
10700
|
+
var accessGroupState = { resolver: null, sticky: null, handle: null, applyToAll: false, choice: "authorized", perPath: {} };
|
|
10701
|
+
function resetAccessGroupBatch() {
|
|
10702
|
+
accessGroupState.sticky = null;
|
|
10703
|
+
accessGroupState.applyToAll = false;
|
|
10704
|
+
accessGroupState.perPath = {};
|
|
10705
|
+
}
|
|
10706
|
+
function chooseAccessGroup(choice) {
|
|
10707
|
+
var picked = normalizeUploadAccessGroup(choice);
|
|
10708
|
+
if (accessGroupState.applyToAll) accessGroupState.sticky = picked;
|
|
10709
|
+
if (accessGroupState.handle) {
|
|
10710
|
+
accessGroupState.handle.close();
|
|
10711
|
+
accessGroupState.handle = null;
|
|
10712
|
+
}
|
|
10713
|
+
var r = accessGroupState.resolver;
|
|
10714
|
+
accessGroupState.resolver = null;
|
|
10715
|
+
if (r) r(picked);
|
|
10716
|
+
}
|
|
10717
|
+
var accessGroupChain = Promise.resolve();
|
|
10718
|
+
function resolveUploadAccessGroup(storagePath) {
|
|
10719
|
+
if (!projectAsksUploadAccess()) return Promise.resolve(projectUploadAccessGroup());
|
|
10720
|
+
var fallback = projectUploadAccessGroup();
|
|
10721
|
+
if (accessGroupState.sticky) return Promise.resolve(accessGroupState.sticky);
|
|
10722
|
+
var pathKey = String(storagePath || "");
|
|
10723
|
+
if (pathKey && accessGroupState.perPath[pathKey]) {
|
|
10724
|
+
return Promise.resolve(accessGroupState.perPath[pathKey]);
|
|
10725
|
+
}
|
|
10726
|
+
var run = accessGroupChain.then(function() {
|
|
10727
|
+
if (accessGroupState.sticky) return accessGroupState.sticky;
|
|
10728
|
+
if (pathKey && accessGroupState.perPath[pathKey]) {
|
|
10729
|
+
return accessGroupState.perPath[pathKey];
|
|
10730
|
+
}
|
|
10731
|
+
accessGroupState.applyToAll = false;
|
|
10732
|
+
accessGroupState.choice = fallback;
|
|
10733
|
+
var filename = String(storagePath || "").split("/").pop() || "this file";
|
|
10734
|
+
return new Promise(function(resolve) {
|
|
10735
|
+
accessGroupState.resolver = resolve;
|
|
10736
|
+
accessGroupState.handle = openModal(function() {
|
|
10737
|
+
var list = h("div", { class: "bq-access-options" });
|
|
10738
|
+
UPLOAD_ACCESS_GROUPS.forEach(function(g) {
|
|
10739
|
+
var input = h("input", { type: "radio", name: "bq-access-group", value: g });
|
|
10740
|
+
input.checked = g === accessGroupState.choice;
|
|
10741
|
+
input.addEventListener("change", function() {
|
|
10742
|
+
if (input.checked) accessGroupState.choice = g;
|
|
10743
|
+
});
|
|
10744
|
+
list.appendChild(h(
|
|
10745
|
+
"label",
|
|
10746
|
+
{ class: "bq-access-option" },
|
|
10747
|
+
input,
|
|
10748
|
+
h("span", { class: "bq-access-option-label", text: UPLOAD_ACCESS_LABELS[g] }),
|
|
10749
|
+
h("span", { class: "bq-access-option-hint", text: UPLOAD_ACCESS_HINTS[g] })
|
|
10750
|
+
));
|
|
10751
|
+
});
|
|
10752
|
+
var applyCb = h("input", { type: "checkbox" });
|
|
10753
|
+
applyCb.addEventListener("change", function() {
|
|
10754
|
+
accessGroupState.applyToAll = !!applyCb.checked;
|
|
10755
|
+
});
|
|
10756
|
+
var applyLabel = h(
|
|
10757
|
+
"label",
|
|
10758
|
+
{ class: "bq-overwrite-applyall" },
|
|
10759
|
+
applyCb,
|
|
10760
|
+
h("span", { text: "Apply to all remaining files" })
|
|
10761
|
+
);
|
|
10762
|
+
return h(
|
|
10763
|
+
"div",
|
|
10764
|
+
{ class: "bq-modal" },
|
|
10765
|
+
h("div", { class: "bq-modal-delete-header" }, h("span", { text: "Who can read this file?" })),
|
|
10766
|
+
h(
|
|
10767
|
+
"p",
|
|
10768
|
+
{ class: "bq-modal-desc" },
|
|
10769
|
+
"Choose who can ask questions about \u201C" + filename + "\u201D once it is indexed."
|
|
10770
|
+
),
|
|
10771
|
+
list,
|
|
10772
|
+
applyLabel,
|
|
10773
|
+
h(
|
|
10774
|
+
"div",
|
|
10775
|
+
{ class: "bq-modal-btns" },
|
|
10776
|
+
h("button", { class: "btn", type: "button", onclick: function() {
|
|
10777
|
+
chooseAccessGroup(accessGroupState.choice);
|
|
10778
|
+
} }, "Upload")
|
|
10779
|
+
)
|
|
10780
|
+
);
|
|
10781
|
+
}, { dismissible: false });
|
|
10782
|
+
});
|
|
10783
|
+
});
|
|
10784
|
+
accessGroupChain = run.catch(function() {
|
|
10785
|
+
return void 0;
|
|
10786
|
+
});
|
|
10787
|
+
return run.then(function(picked) {
|
|
10788
|
+
var g = normalizeUploadAccessGroup(picked);
|
|
10789
|
+
if (pathKey) accessGroupState.perPath[pathKey] = g;
|
|
10790
|
+
return g;
|
|
10791
|
+
}).catch(function() {
|
|
10792
|
+
return fallback;
|
|
10793
|
+
});
|
|
10794
|
+
}
|
|
10539
10795
|
function promptOverwrite(filename) {
|
|
10540
10796
|
if (overwriteState.sticky) return Promise.resolve(overwriteState.sticky);
|
|
10541
10797
|
overwriteState.applyToAll = false;
|
|
@@ -10647,6 +10903,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10647
10903
|
}).catch(function() {
|
|
10648
10904
|
}).then(function() {
|
|
10649
10905
|
S.user = null;
|
|
10906
|
+
if (anonymousAllowed()) return enterAfterLogin();
|
|
10650
10907
|
renderLogin();
|
|
10651
10908
|
});
|
|
10652
10909
|
}
|
|
@@ -10660,7 +10917,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10660
10917
|
}).then(function() {
|
|
10661
10918
|
return loadServiceInfo();
|
|
10662
10919
|
}).then(function(conn) {
|
|
10663
|
-
S.service = conn;
|
|
10920
|
+
if (conn) S.service = conn;
|
|
10664
10921
|
applyAgentConfig();
|
|
10665
10922
|
}).then(function() {
|
|
10666
10923
|
renderChat();
|
|
@@ -10720,6 +10977,7 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10720
10977
|
return getProfile().then(function(user) {
|
|
10721
10978
|
S.user = user;
|
|
10722
10979
|
if (!user) {
|
|
10980
|
+
if (anonymousAllowed()) return enterAfterLogin();
|
|
10723
10981
|
renderLogin();
|
|
10724
10982
|
return;
|
|
10725
10983
|
}
|
|
@@ -10758,8 +11016,15 @@ Index the REMAINING windows - one record per row/item, looking at any page image
|
|
|
10758
11016
|
// defaults to current host page
|
|
10759
11017
|
hostDomain: null,
|
|
10760
11018
|
// db-CDN host; null → skapi.app (dev) / skapi.com (prod)
|
|
10761
|
-
attachmentParsers: null
|
|
11019
|
+
attachmentParsers: null,
|
|
10762
11020
|
// client-side attachment parsers, e.g. [createHwpParser()]
|
|
11021
|
+
// Open the chat with no login for visitors without an account.
|
|
11022
|
+
// null → follow the project's own "Allow anonymous users" setting
|
|
11023
|
+
// (getConnectionInfo().conf.prevent_anonymous); true/false pins it.
|
|
11024
|
+
allowAnonymous: null,
|
|
11025
|
+
// Server-driven windowed indexing; read at configureChatEngine time.
|
|
11026
|
+
// Listed here so the defaults object is the full opt surface.
|
|
11027
|
+
windowedIndexing: true
|
|
10763
11028
|
}, opts || {});
|
|
10764
11029
|
S.mountEl = mountEl;
|
|
10765
11030
|
clear(mountEl);
|