bunnyquery 1.5.0 → 1.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunnyquery",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Embeddable BunnyQuery AI chat widget + its framework-agnostic chat engine",
5
5
  "main": "bunnyquery.js",
6
6
  "exports": {
@@ -33,7 +33,7 @@ export function getContextWindow(platform: string, model?: string): number {
33
33
 
34
34
  export function stripFileBlocksFromHistory(content: string): string {
35
35
  if (!content) return content;
36
- return content.replace(/```([\w.-]+\.[a-zA-Z0-9]+)\n[\s\S]*?```/g, '[file previously attached: $1]');
36
+ return content.replace(/```([^\n`]+?\.[^\s.`]+)\n[\s\S]*?```/g, '[file previously attached: $1]');
37
37
  }
38
38
 
39
39
  export type BoundedChatOptions = {
@@ -99,8 +99,8 @@ export interface ChatHost {
99
99
  /** Map a relative path to the consumer's db storage key (e.g. uid-prefixed). */
100
100
  storagePathFor(relPath: string): string;
101
101
  getMimeType(name: string): string | null;
102
- /** Non-dismissible "file exists" prompt → keep+reindex vs overwrite. */
103
- promptOverwrite(filename: string): Promise<'overwrite' | 'reindex'>;
102
+ /** Non-dismissible "file exists" prompt → skip, keep+reindex, or overwrite. */
103
+ promptOverwrite(filename: string): Promise<'overwrite' | 'reindex' | 'skip'>;
104
104
  /** Clear the "apply to all" overwrite choice at the start of a batch. */
105
105
  resetOverwriteBatch(): void;
106
106
  /** Re-render the attachment chip row (progress / status). */
@@ -550,7 +550,7 @@ export class ChatSession {
550
550
  // (a partial link is broken markdown). If a frame's reveal boundary lands
551
551
  // inside one, snap it to the region end so the chip/link appears whole.
552
552
  var regions: Array<{ start: number; end: number }> = [], m;
553
- var fenceRegex = /```[\w.-]+\.[a-zA-Z0-9]+\n[\s\S]*?```/g;
553
+ var fenceRegex = /```[^\n`]+?\.[^\s.`]+\n[\s\S]*?```/g;
554
554
  while ((m = fenceRegex.exec(fullText)) !== null) regions.push({ start: m.index, end: m.index + m[0].length });
555
555
  var linkRegex = createInlineLinkRegex();
556
556
  while ((m = linkRegex.exec(fullText)) !== null) regions.push({ start: m.index, end: m.index + m[0].length });
@@ -1013,6 +1013,7 @@ export class ChatSession {
1013
1013
  members.forEach(function (member: any, idx: number) {
1014
1014
  chain = chain.then(function () {
1015
1015
  var hadExists = false;
1016
+ var skipped = false;
1016
1017
  var onProg = function (p: any) {
1017
1018
  if (p && p.total) {
1018
1019
  att.progress = Math.floor(((idx + p.loaded / p.total) / total) * 100);
@@ -1032,11 +1033,14 @@ export class ChatSession {
1032
1033
  if (!isExists) throw err; // a member upload failed → whole attachment fails (red)
1033
1034
  return self.host.promptOverwrite(member.file.name).then(function (choice) {
1034
1035
  if (choice === 'overwrite') return doMemberUpload(false); // replace the existing file
1035
- hadExists = true; // keep it; reindex only
1036
+ if (choice === 'skip') { skipped = true; return; } // leave it untouched; no upload/index
1037
+ hadExists = true; // keep it; Reindex
1036
1038
  });
1037
1039
  }).then(function () {
1040
+ if (skipped) return; // user skipped this member — no url, no index request
1038
1041
  return self.host.getTemporaryUrl(member.storagePath);
1039
1042
  }).then(function (url: string) {
1043
+ if (skipped) return; // guard the indexing branch for a skipped member
1040
1044
  urls.push({ name: member.relPath, url: url, storagePath: member.storagePath });
1041
1045
  if (att.kind !== 'folder') { att.uploadedUrl = url; att.storagePath = member.storagePath; }
1042
1046
  var mime = member.file.type || self.host.getMimeType(member.file.name);