@reverbia/sdk 1.0.0-next.20260109180912 → 1.0.0-next.20260110032702
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/expo/index.cjs +34 -2
- package/dist/expo/index.mjs +34 -2
- package/dist/react/index.cjs +34 -3
- package/dist/react/index.mjs +34 -3
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -1642,6 +1642,34 @@ function useChatStorage(options) {
|
|
|
1642
1642
|
if (!content) {
|
|
1643
1643
|
return extractedSources;
|
|
1644
1644
|
}
|
|
1645
|
+
const jsonBlockRegex = /```(?:json)?\s*(\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\})\s*```/g;
|
|
1646
|
+
let jsonMatch;
|
|
1647
|
+
let foundJsonSources = false;
|
|
1648
|
+
while ((jsonMatch = jsonBlockRegex.exec(content)) !== null) {
|
|
1649
|
+
if (jsonMatch[1]) {
|
|
1650
|
+
try {
|
|
1651
|
+
const parsed = JSON.parse(jsonMatch[1]);
|
|
1652
|
+
if (Array.isArray(parsed.sources)) {
|
|
1653
|
+
foundJsonSources = true;
|
|
1654
|
+
for (const source of parsed.sources) {
|
|
1655
|
+
if (source.url && !seenUrls.has(source.url)) {
|
|
1656
|
+
seenUrls.add(source.url);
|
|
1657
|
+
extractedSources.push({
|
|
1658
|
+
title: source.title || void 0,
|
|
1659
|
+
url: source.url,
|
|
1660
|
+
// Map 'description' from JSON to 'snippet' in SearchSource type
|
|
1661
|
+
snippet: source.description || source.snippet || void 0
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
} catch {
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
if (foundJsonSources) {
|
|
1671
|
+
return extractedSources;
|
|
1672
|
+
}
|
|
1645
1673
|
const markdownLinkRegex = /\[([^\]]*)\]\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
1646
1674
|
const plainUrlRegex = /https?:\/\/[^\s<>\[\]()'"]+/g;
|
|
1647
1675
|
let match;
|
|
@@ -1889,12 +1917,15 @@ function useChatStorage(options) {
|
|
|
1889
1917
|
content: assistantContent,
|
|
1890
1918
|
sources
|
|
1891
1919
|
});
|
|
1920
|
+
const jsonSourcesBlockRegex = /```(?:json)?\s*\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\}\s*```/g;
|
|
1921
|
+
let cleanedContent = assistantContent.replace(jsonSourcesBlockRegex, "").trim();
|
|
1922
|
+
cleanedContent = cleanedContent.replace(/\n{3,}/g, "\n\n");
|
|
1892
1923
|
let storedAssistantMessage;
|
|
1893
1924
|
try {
|
|
1894
1925
|
storedAssistantMessage = await createMessageOp(storageCtx, {
|
|
1895
1926
|
conversationId: convId,
|
|
1896
1927
|
role: "assistant",
|
|
1897
|
-
content:
|
|
1928
|
+
content: cleanedContent,
|
|
1898
1929
|
model: responseData.model || model,
|
|
1899
1930
|
usage: convertUsageToStored(responseData.usage),
|
|
1900
1931
|
responseDuration,
|
|
@@ -3891,7 +3922,8 @@ function useMemoryStorage(options) {
|
|
|
3891
3922
|
content: [{ type: "text", text: m.content }]
|
|
3892
3923
|
}))
|
|
3893
3924
|
],
|
|
3894
|
-
model: model || completionsModel
|
|
3925
|
+
model: model || completionsModel,
|
|
3926
|
+
tool_choice: "none"
|
|
3895
3927
|
},
|
|
3896
3928
|
headers: {
|
|
3897
3929
|
Authorization: `Bearer ${token}`
|
package/dist/expo/index.mjs
CHANGED
|
@@ -1606,6 +1606,34 @@ function useChatStorage(options) {
|
|
|
1606
1606
|
if (!content) {
|
|
1607
1607
|
return extractedSources;
|
|
1608
1608
|
}
|
|
1609
|
+
const jsonBlockRegex = /```(?:json)?\s*(\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\})\s*```/g;
|
|
1610
|
+
let jsonMatch;
|
|
1611
|
+
let foundJsonSources = false;
|
|
1612
|
+
while ((jsonMatch = jsonBlockRegex.exec(content)) !== null) {
|
|
1613
|
+
if (jsonMatch[1]) {
|
|
1614
|
+
try {
|
|
1615
|
+
const parsed = JSON.parse(jsonMatch[1]);
|
|
1616
|
+
if (Array.isArray(parsed.sources)) {
|
|
1617
|
+
foundJsonSources = true;
|
|
1618
|
+
for (const source of parsed.sources) {
|
|
1619
|
+
if (source.url && !seenUrls.has(source.url)) {
|
|
1620
|
+
seenUrls.add(source.url);
|
|
1621
|
+
extractedSources.push({
|
|
1622
|
+
title: source.title || void 0,
|
|
1623
|
+
url: source.url,
|
|
1624
|
+
// Map 'description' from JSON to 'snippet' in SearchSource type
|
|
1625
|
+
snippet: source.description || source.snippet || void 0
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
} catch {
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
if (foundJsonSources) {
|
|
1635
|
+
return extractedSources;
|
|
1636
|
+
}
|
|
1609
1637
|
const markdownLinkRegex = /\[([^\]]*)\]\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
1610
1638
|
const plainUrlRegex = /https?:\/\/[^\s<>\[\]()'"]+/g;
|
|
1611
1639
|
let match;
|
|
@@ -1853,12 +1881,15 @@ function useChatStorage(options) {
|
|
|
1853
1881
|
content: assistantContent,
|
|
1854
1882
|
sources
|
|
1855
1883
|
});
|
|
1884
|
+
const jsonSourcesBlockRegex = /```(?:json)?\s*\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\}\s*```/g;
|
|
1885
|
+
let cleanedContent = assistantContent.replace(jsonSourcesBlockRegex, "").trim();
|
|
1886
|
+
cleanedContent = cleanedContent.replace(/\n{3,}/g, "\n\n");
|
|
1856
1887
|
let storedAssistantMessage;
|
|
1857
1888
|
try {
|
|
1858
1889
|
storedAssistantMessage = await createMessageOp(storageCtx, {
|
|
1859
1890
|
conversationId: convId,
|
|
1860
1891
|
role: "assistant",
|
|
1861
|
-
content:
|
|
1892
|
+
content: cleanedContent,
|
|
1862
1893
|
model: responseData.model || model,
|
|
1863
1894
|
usage: convertUsageToStored(responseData.usage),
|
|
1864
1895
|
responseDuration,
|
|
@@ -3855,7 +3886,8 @@ function useMemoryStorage(options) {
|
|
|
3855
3886
|
content: [{ type: "text", text: m.content }]
|
|
3856
3887
|
}))
|
|
3857
3888
|
],
|
|
3858
|
-
model: model || completionsModel
|
|
3889
|
+
model: model || completionsModel,
|
|
3890
|
+
tool_choice: "none"
|
|
3859
3891
|
},
|
|
3860
3892
|
headers: {
|
|
3861
3893
|
Authorization: `Bearer ${token}`
|
package/dist/react/index.cjs
CHANGED
|
@@ -2987,6 +2987,34 @@ function useChatStorage(options) {
|
|
|
2987
2987
|
if (!content) {
|
|
2988
2988
|
return extractedSources;
|
|
2989
2989
|
}
|
|
2990
|
+
const jsonBlockRegex = /```(?:json)?\s*(\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\})\s*```/g;
|
|
2991
|
+
let jsonMatch;
|
|
2992
|
+
let foundJsonSources = false;
|
|
2993
|
+
while ((jsonMatch = jsonBlockRegex.exec(content)) !== null) {
|
|
2994
|
+
if (jsonMatch[1]) {
|
|
2995
|
+
try {
|
|
2996
|
+
const parsed = JSON.parse(jsonMatch[1]);
|
|
2997
|
+
if (Array.isArray(parsed.sources)) {
|
|
2998
|
+
foundJsonSources = true;
|
|
2999
|
+
for (const source of parsed.sources) {
|
|
3000
|
+
if (source.url && !seenUrls.has(source.url)) {
|
|
3001
|
+
seenUrls.add(source.url);
|
|
3002
|
+
extractedSources.push({
|
|
3003
|
+
title: source.title || void 0,
|
|
3004
|
+
url: source.url,
|
|
3005
|
+
// Map 'description' from JSON to 'snippet' in SearchSource type
|
|
3006
|
+
snippet: source.description || source.snippet || void 0
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
} catch {
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
if (foundJsonSources) {
|
|
3016
|
+
return extractedSources;
|
|
3017
|
+
}
|
|
2990
3018
|
const markdownLinkRegex = /\[([^\]]*)\]\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
2991
3019
|
const plainUrlRegex = /(?<![(\[])https?:\/\/[^\s<>\[\]()'"]+(?<![.,;:!?])/g;
|
|
2992
3020
|
let match;
|
|
@@ -3312,11 +3340,13 @@ function useChatStorage(options) {
|
|
|
3312
3340
|
content: assistantContent,
|
|
3313
3341
|
sources
|
|
3314
3342
|
}).filter((source) => !source.url?.includes(MCP_R2_DOMAIN));
|
|
3343
|
+
const jsonSourcesBlockRegex = /```(?:json)?\s*\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\}\s*```/g;
|
|
3344
|
+
let cleanedContent = assistantContent.replace(jsonSourcesBlockRegex, "").trim();
|
|
3345
|
+
cleanedContent = cleanedContent.replace(/\n{3,}/g, "\n\n");
|
|
3315
3346
|
let processedFiles = [];
|
|
3316
|
-
let cleanedContent = assistantContent;
|
|
3317
3347
|
if (writeFile) {
|
|
3318
3348
|
const result2 = await extractAndStoreMCPImages(
|
|
3319
|
-
|
|
3349
|
+
cleanedContent,
|
|
3320
3350
|
writeFile
|
|
3321
3351
|
);
|
|
3322
3352
|
processedFiles = result2.processedFiles;
|
|
@@ -4517,7 +4547,8 @@ function useMemoryStorage(options) {
|
|
|
4517
4547
|
content: [{ type: "text", text: m.content }]
|
|
4518
4548
|
}))
|
|
4519
4549
|
],
|
|
4520
|
-
model: model || completionsModel
|
|
4550
|
+
model: model || completionsModel,
|
|
4551
|
+
tool_choice: "none"
|
|
4521
4552
|
},
|
|
4522
4553
|
headers: {
|
|
4523
4554
|
Authorization: `Bearer ${token}`
|
package/dist/react/index.mjs
CHANGED
|
@@ -2860,6 +2860,34 @@ function useChatStorage(options) {
|
|
|
2860
2860
|
if (!content) {
|
|
2861
2861
|
return extractedSources;
|
|
2862
2862
|
}
|
|
2863
|
+
const jsonBlockRegex = /```(?:json)?\s*(\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\})\s*```/g;
|
|
2864
|
+
let jsonMatch;
|
|
2865
|
+
let foundJsonSources = false;
|
|
2866
|
+
while ((jsonMatch = jsonBlockRegex.exec(content)) !== null) {
|
|
2867
|
+
if (jsonMatch[1]) {
|
|
2868
|
+
try {
|
|
2869
|
+
const parsed = JSON.parse(jsonMatch[1]);
|
|
2870
|
+
if (Array.isArray(parsed.sources)) {
|
|
2871
|
+
foundJsonSources = true;
|
|
2872
|
+
for (const source of parsed.sources) {
|
|
2873
|
+
if (source.url && !seenUrls.has(source.url)) {
|
|
2874
|
+
seenUrls.add(source.url);
|
|
2875
|
+
extractedSources.push({
|
|
2876
|
+
title: source.title || void 0,
|
|
2877
|
+
url: source.url,
|
|
2878
|
+
// Map 'description' from JSON to 'snippet' in SearchSource type
|
|
2879
|
+
snippet: source.description || source.snippet || void 0
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
} catch {
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
if (foundJsonSources) {
|
|
2889
|
+
return extractedSources;
|
|
2890
|
+
}
|
|
2863
2891
|
const markdownLinkRegex = /\[([^\]]*)\]\(([^()]*(?:\([^()]*\)[^()]*)*)\)/g;
|
|
2864
2892
|
const plainUrlRegex = /(?<![(\[])https?:\/\/[^\s<>\[\]()'"]+(?<![.,;:!?])/g;
|
|
2865
2893
|
let match;
|
|
@@ -3185,11 +3213,13 @@ function useChatStorage(options) {
|
|
|
3185
3213
|
content: assistantContent,
|
|
3186
3214
|
sources
|
|
3187
3215
|
}).filter((source) => !source.url?.includes(MCP_R2_DOMAIN));
|
|
3216
|
+
const jsonSourcesBlockRegex = /```(?:json)?\s*\{(?:(?!```)[^])*?"sources"(?:(?!```)[^])*?\}\s*```/g;
|
|
3217
|
+
let cleanedContent = assistantContent.replace(jsonSourcesBlockRegex, "").trim();
|
|
3218
|
+
cleanedContent = cleanedContent.replace(/\n{3,}/g, "\n\n");
|
|
3188
3219
|
let processedFiles = [];
|
|
3189
|
-
let cleanedContent = assistantContent;
|
|
3190
3220
|
if (writeFile) {
|
|
3191
3221
|
const result2 = await extractAndStoreMCPImages(
|
|
3192
|
-
|
|
3222
|
+
cleanedContent,
|
|
3193
3223
|
writeFile
|
|
3194
3224
|
);
|
|
3195
3225
|
processedFiles = result2.processedFiles;
|
|
@@ -4395,7 +4425,8 @@ function useMemoryStorage(options) {
|
|
|
4395
4425
|
content: [{ type: "text", text: m.content }]
|
|
4396
4426
|
}))
|
|
4397
4427
|
],
|
|
4398
|
-
model: model || completionsModel
|
|
4428
|
+
model: model || completionsModel,
|
|
4429
|
+
tool_choice: "none"
|
|
4399
4430
|
},
|
|
4400
4431
|
headers: {
|
|
4401
4432
|
Authorization: `Bearer ${token}`
|