@reverbia/sdk 1.0.0-next.20260114030517 → 1.0.0-next.20260114193116
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 +23 -6
- package/dist/expo/index.d.mts +3 -0
- package/dist/expo/index.d.ts +3 -0
- package/dist/expo/index.mjs +23 -6
- package/dist/react/index.cjs +65 -16
- package/dist/react/index.d.mts +3 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.mjs +65 -16
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -753,7 +753,10 @@ var CompletionsStrategy = class {
|
|
|
753
753
|
let finalContent = accumulator.content;
|
|
754
754
|
let finalThinking = accumulator.thinking;
|
|
755
755
|
if (accumulator.partialReasoningTag) {
|
|
756
|
-
const finalParse = parseReasoningTags(
|
|
756
|
+
const finalParse = parseReasoningTags(
|
|
757
|
+
"",
|
|
758
|
+
accumulator.partialReasoningTag
|
|
759
|
+
);
|
|
757
760
|
finalContent += finalParse.messageContent;
|
|
758
761
|
if (finalParse.reasoningContent) {
|
|
759
762
|
finalThinking += finalParse.reasoningContent;
|
|
@@ -1687,6 +1690,7 @@ function useChatStorage(options) {
|
|
|
1687
1690
|
getToken,
|
|
1688
1691
|
baseUrl,
|
|
1689
1692
|
onData,
|
|
1693
|
+
onThinking,
|
|
1690
1694
|
onFinish,
|
|
1691
1695
|
onError
|
|
1692
1696
|
} = options;
|
|
@@ -1715,6 +1719,7 @@ function useChatStorage(options) {
|
|
|
1715
1719
|
getToken,
|
|
1716
1720
|
baseUrl,
|
|
1717
1721
|
onData,
|
|
1722
|
+
onThinking,
|
|
1718
1723
|
onFinish,
|
|
1719
1724
|
onError
|
|
1720
1725
|
});
|
|
@@ -2084,8 +2089,8 @@ function useChatStorage(options) {
|
|
|
2084
2089
|
usage: convertUsageToStored(responseData.usage),
|
|
2085
2090
|
responseDuration,
|
|
2086
2091
|
sources: combinedSources,
|
|
2087
|
-
thoughtProcess: finalizeThoughtProcess(thoughtProcess)
|
|
2088
|
-
thinking: thinkingContent
|
|
2092
|
+
thoughtProcess: finalizeThoughtProcess(thoughtProcess)
|
|
2093
|
+
// thinking: thinkingContent,
|
|
2089
2094
|
});
|
|
2090
2095
|
} catch (err) {
|
|
2091
2096
|
return {
|
|
@@ -3882,7 +3887,7 @@ var preprocessMemories = (items, minConfidence = 0.6) => {
|
|
|
3882
3887
|
|
|
3883
3888
|
// src/lib/memory/constants.ts
|
|
3884
3889
|
var DEFAULT_API_EMBEDDING_MODEL = "fireworks/accounts/fireworks/models/qwen3-embedding-8b";
|
|
3885
|
-
var DEFAULT_COMPLETION_MODEL = "
|
|
3890
|
+
var DEFAULT_COMPLETION_MODEL = "fireworks/accounts/fireworks/models/gpt-oss-20b";
|
|
3886
3891
|
|
|
3887
3892
|
// src/expo/useMemoryStorage.ts
|
|
3888
3893
|
var import_client5 = require("@reverbia/sdk");
|
|
@@ -4480,7 +4485,7 @@ __decorateClass([
|
|
|
4480
4485
|
], UserPreference.prototype, "updatedAt", 2);
|
|
4481
4486
|
|
|
4482
4487
|
// src/lib/db/schema.ts
|
|
4483
|
-
var SDK_SCHEMA_VERSION =
|
|
4488
|
+
var SDK_SCHEMA_VERSION = 9;
|
|
4484
4489
|
var sdkSchema = (0, import_watermelondb9.appSchema)({
|
|
4485
4490
|
version: SDK_SCHEMA_VERSION,
|
|
4486
4491
|
tables: [
|
|
@@ -4503,8 +4508,10 @@ var sdkSchema = (0, import_watermelondb9.appSchema)({
|
|
|
4503
4508
|
{ name: "response_duration", type: "number", isOptional: true },
|
|
4504
4509
|
{ name: "was_stopped", type: "boolean", isOptional: true },
|
|
4505
4510
|
{ name: "error", type: "string", isOptional: true },
|
|
4506
|
-
{ name: "thought_process", type: "string", isOptional: true }
|
|
4511
|
+
{ name: "thought_process", type: "string", isOptional: true },
|
|
4507
4512
|
// JSON stringified ActivityPhase[]
|
|
4513
|
+
{ name: "thinking", type: "string", isOptional: true }
|
|
4514
|
+
// Reasoning/thinking content
|
|
4508
4515
|
]
|
|
4509
4516
|
}),
|
|
4510
4517
|
(0, import_watermelondb9.tableSchema)({
|
|
@@ -4642,6 +4649,16 @@ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
|
|
|
4642
4649
|
(0, import_migrations2.unsafeExecuteSql)("DELETE FROM conversations;"),
|
|
4643
4650
|
(0, import_migrations2.unsafeExecuteSql)("DELETE FROM memories;")
|
|
4644
4651
|
]
|
|
4652
|
+
},
|
|
4653
|
+
// v8 -> v9: Added thinking column to history for reasoning/thinking content
|
|
4654
|
+
{
|
|
4655
|
+
toVersion: 9,
|
|
4656
|
+
steps: [
|
|
4657
|
+
(0, import_migrations2.addColumns)({
|
|
4658
|
+
table: "history",
|
|
4659
|
+
columns: [{ name: "thinking", type: "string", isOptional: true }]
|
|
4660
|
+
})
|
|
4661
|
+
]
|
|
4645
4662
|
}
|
|
4646
4663
|
]
|
|
4647
4664
|
});
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -835,6 +835,8 @@ interface BaseUseChatStorageOptions {
|
|
|
835
835
|
baseUrl?: string;
|
|
836
836
|
/** Callback invoked with each streamed response chunk */
|
|
837
837
|
onData?: (chunk: string) => void;
|
|
838
|
+
/** Callback invoked when thinking/reasoning content is received (from <think> tags or API reasoning) */
|
|
839
|
+
onThinking?: (chunk: string) => void;
|
|
838
840
|
/** Callback invoked when the response completes successfully */
|
|
839
841
|
onFinish?: (response: LlmapiResponseResponse) => void;
|
|
840
842
|
/** Callback invoked when an error occurs during the request */
|
|
@@ -1304,6 +1306,7 @@ declare const sdkSchema: Readonly<{
|
|
|
1304
1306
|
* - v5 → v6: Added `thought_process` column to history table for activity tracking
|
|
1305
1307
|
* - v6 → v7: Added `userPreferences` table for unified user settings storage
|
|
1306
1308
|
* - v7 → v8: BREAKING - Clear all data (embedding model change)
|
|
1309
|
+
* - v8 → v9: Added `thinking` column to history table for reasoning/thinking content
|
|
1307
1310
|
*/
|
|
1308
1311
|
declare const sdkMigrations: Readonly<{
|
|
1309
1312
|
validated: true;
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -835,6 +835,8 @@ interface BaseUseChatStorageOptions {
|
|
|
835
835
|
baseUrl?: string;
|
|
836
836
|
/** Callback invoked with each streamed response chunk */
|
|
837
837
|
onData?: (chunk: string) => void;
|
|
838
|
+
/** Callback invoked when thinking/reasoning content is received (from <think> tags or API reasoning) */
|
|
839
|
+
onThinking?: (chunk: string) => void;
|
|
838
840
|
/** Callback invoked when the response completes successfully */
|
|
839
841
|
onFinish?: (response: LlmapiResponseResponse) => void;
|
|
840
842
|
/** Callback invoked when an error occurs during the request */
|
|
@@ -1304,6 +1306,7 @@ declare const sdkSchema: Readonly<{
|
|
|
1304
1306
|
* - v5 → v6: Added `thought_process` column to history table for activity tracking
|
|
1305
1307
|
* - v6 → v7: Added `userPreferences` table for unified user settings storage
|
|
1306
1308
|
* - v7 → v8: BREAKING - Clear all data (embedding model change)
|
|
1309
|
+
* - v8 → v9: Added `thinking` column to history table for reasoning/thinking content
|
|
1307
1310
|
*/
|
|
1308
1311
|
declare const sdkMigrations: Readonly<{
|
|
1309
1312
|
validated: true;
|
package/dist/expo/index.mjs
CHANGED
|
@@ -715,7 +715,10 @@ var CompletionsStrategy = class {
|
|
|
715
715
|
let finalContent = accumulator.content;
|
|
716
716
|
let finalThinking = accumulator.thinking;
|
|
717
717
|
if (accumulator.partialReasoningTag) {
|
|
718
|
-
const finalParse = parseReasoningTags(
|
|
718
|
+
const finalParse = parseReasoningTags(
|
|
719
|
+
"",
|
|
720
|
+
accumulator.partialReasoningTag
|
|
721
|
+
);
|
|
719
722
|
finalContent += finalParse.messageContent;
|
|
720
723
|
if (finalParse.reasoningContent) {
|
|
721
724
|
finalThinking += finalParse.reasoningContent;
|
|
@@ -1652,6 +1655,7 @@ function useChatStorage(options) {
|
|
|
1652
1655
|
getToken,
|
|
1653
1656
|
baseUrl,
|
|
1654
1657
|
onData,
|
|
1658
|
+
onThinking,
|
|
1655
1659
|
onFinish,
|
|
1656
1660
|
onError
|
|
1657
1661
|
} = options;
|
|
@@ -1680,6 +1684,7 @@ function useChatStorage(options) {
|
|
|
1680
1684
|
getToken,
|
|
1681
1685
|
baseUrl,
|
|
1682
1686
|
onData,
|
|
1687
|
+
onThinking,
|
|
1683
1688
|
onFinish,
|
|
1684
1689
|
onError
|
|
1685
1690
|
});
|
|
@@ -2049,8 +2054,8 @@ function useChatStorage(options) {
|
|
|
2049
2054
|
usage: convertUsageToStored(responseData.usage),
|
|
2050
2055
|
responseDuration,
|
|
2051
2056
|
sources: combinedSources,
|
|
2052
|
-
thoughtProcess: finalizeThoughtProcess(thoughtProcess)
|
|
2053
|
-
thinking: thinkingContent
|
|
2057
|
+
thoughtProcess: finalizeThoughtProcess(thoughtProcess)
|
|
2058
|
+
// thinking: thinkingContent,
|
|
2054
2059
|
});
|
|
2055
2060
|
} catch (err) {
|
|
2056
2061
|
return {
|
|
@@ -3847,7 +3852,7 @@ var preprocessMemories = (items, minConfidence = 0.6) => {
|
|
|
3847
3852
|
|
|
3848
3853
|
// src/lib/memory/constants.ts
|
|
3849
3854
|
var DEFAULT_API_EMBEDDING_MODEL = "fireworks/accounts/fireworks/models/qwen3-embedding-8b";
|
|
3850
|
-
var DEFAULT_COMPLETION_MODEL = "
|
|
3855
|
+
var DEFAULT_COMPLETION_MODEL = "fireworks/accounts/fireworks/models/gpt-oss-20b";
|
|
3851
3856
|
|
|
3852
3857
|
// src/expo/useMemoryStorage.ts
|
|
3853
3858
|
import { postApiV1Embeddings } from "@reverbia/sdk";
|
|
@@ -4450,7 +4455,7 @@ __decorateClass([
|
|
|
4450
4455
|
], UserPreference.prototype, "updatedAt", 2);
|
|
4451
4456
|
|
|
4452
4457
|
// src/lib/db/schema.ts
|
|
4453
|
-
var SDK_SCHEMA_VERSION =
|
|
4458
|
+
var SDK_SCHEMA_VERSION = 9;
|
|
4454
4459
|
var sdkSchema = appSchema3({
|
|
4455
4460
|
version: SDK_SCHEMA_VERSION,
|
|
4456
4461
|
tables: [
|
|
@@ -4473,8 +4478,10 @@ var sdkSchema = appSchema3({
|
|
|
4473
4478
|
{ name: "response_duration", type: "number", isOptional: true },
|
|
4474
4479
|
{ name: "was_stopped", type: "boolean", isOptional: true },
|
|
4475
4480
|
{ name: "error", type: "string", isOptional: true },
|
|
4476
|
-
{ name: "thought_process", type: "string", isOptional: true }
|
|
4481
|
+
{ name: "thought_process", type: "string", isOptional: true },
|
|
4477
4482
|
// JSON stringified ActivityPhase[]
|
|
4483
|
+
{ name: "thinking", type: "string", isOptional: true }
|
|
4484
|
+
// Reasoning/thinking content
|
|
4478
4485
|
]
|
|
4479
4486
|
}),
|
|
4480
4487
|
tableSchema3({
|
|
@@ -4612,6 +4619,16 @@ var sdkMigrations = schemaMigrations2({
|
|
|
4612
4619
|
unsafeExecuteSql("DELETE FROM conversations;"),
|
|
4613
4620
|
unsafeExecuteSql("DELETE FROM memories;")
|
|
4614
4621
|
]
|
|
4622
|
+
},
|
|
4623
|
+
// v8 -> v9: Added thinking column to history for reasoning/thinking content
|
|
4624
|
+
{
|
|
4625
|
+
toVersion: 9,
|
|
4626
|
+
steps: [
|
|
4627
|
+
addColumns2({
|
|
4628
|
+
table: "history",
|
|
4629
|
+
columns: [{ name: "thinking", type: "string", isOptional: true }]
|
|
4630
|
+
})
|
|
4631
|
+
]
|
|
4615
4632
|
}
|
|
4616
4633
|
]
|
|
4617
4634
|
});
|
package/dist/react/index.cjs
CHANGED
|
@@ -1516,7 +1516,10 @@ var CompletionsStrategy = class {
|
|
|
1516
1516
|
let finalContent = accumulator.content;
|
|
1517
1517
|
let finalThinking = accumulator.thinking;
|
|
1518
1518
|
if (accumulator.partialReasoningTag) {
|
|
1519
|
-
const finalParse = parseReasoningTags(
|
|
1519
|
+
const finalParse = parseReasoningTags(
|
|
1520
|
+
"",
|
|
1521
|
+
accumulator.partialReasoningTag
|
|
1522
|
+
);
|
|
1520
1523
|
finalContent += finalParse.messageContent;
|
|
1521
1524
|
if (finalParse.reasoningContent) {
|
|
1522
1525
|
finalThinking += finalParse.reasoningContent;
|
|
@@ -3300,6 +3303,7 @@ function useChatStorage(options) {
|
|
|
3300
3303
|
getToken,
|
|
3301
3304
|
baseUrl,
|
|
3302
3305
|
onData,
|
|
3306
|
+
onThinking,
|
|
3303
3307
|
onFinish,
|
|
3304
3308
|
onError,
|
|
3305
3309
|
apiType,
|
|
@@ -3337,6 +3341,7 @@ function useChatStorage(options) {
|
|
|
3337
3341
|
getToken,
|
|
3338
3342
|
baseUrl,
|
|
3339
3343
|
onData,
|
|
3344
|
+
onThinking,
|
|
3340
3345
|
onFinish,
|
|
3341
3346
|
onError,
|
|
3342
3347
|
apiType
|
|
@@ -3435,13 +3440,19 @@ function useChatStorage(options) {
|
|
|
3435
3440
|
let resolvedContent = msg.content;
|
|
3436
3441
|
for (const [fileId, url] of fileIdToUrlMap) {
|
|
3437
3442
|
const placeholder = createFilePlaceholder(fileId);
|
|
3438
|
-
const escapedPlaceholder = placeholder.replace(
|
|
3443
|
+
const escapedPlaceholder = placeholder.replace(
|
|
3444
|
+
/[.*+?^${}()|[\]\\]/g,
|
|
3445
|
+
"\\$&"
|
|
3446
|
+
);
|
|
3439
3447
|
const placeholderRegex = new RegExp(escapedPlaceholder, "g");
|
|
3440
3448
|
const replacement = ``;
|
|
3441
3449
|
console.log(
|
|
3442
3450
|
`[getMessages] Replacing ${placeholder} with: ${replacement}`
|
|
3443
3451
|
);
|
|
3444
|
-
resolvedContent = resolvedContent.replace(
|
|
3452
|
+
resolvedContent = resolvedContent.replace(
|
|
3453
|
+
placeholderRegex,
|
|
3454
|
+
replacement
|
|
3455
|
+
);
|
|
3445
3456
|
}
|
|
3446
3457
|
console.log(
|
|
3447
3458
|
`[getMessages] Resolved content length: ${resolvedContent.length}, original length: ${msg.content.length}`
|
|
@@ -3451,7 +3462,10 @@ function useChatStorage(options) {
|
|
|
3451
3462
|
);
|
|
3452
3463
|
return resolvedMessages;
|
|
3453
3464
|
} catch (error) {
|
|
3454
|
-
console.error(
|
|
3465
|
+
console.error(
|
|
3466
|
+
"[useChatStorage] Failed to resolve file placeholders:",
|
|
3467
|
+
error
|
|
3468
|
+
);
|
|
3455
3469
|
return messages;
|
|
3456
3470
|
}
|
|
3457
3471
|
}
|
|
@@ -3791,11 +3805,15 @@ function useChatStorage(options) {
|
|
|
3791
3805
|
async (content, address) => {
|
|
3792
3806
|
try {
|
|
3793
3807
|
if (!isOPFSSupported()) {
|
|
3794
|
-
console.warn(
|
|
3808
|
+
console.warn(
|
|
3809
|
+
"[extractAndStoreEncryptedMCPImages] OPFS not supported"
|
|
3810
|
+
);
|
|
3795
3811
|
return { processedFiles: [], cleanedContent: content };
|
|
3796
3812
|
}
|
|
3797
3813
|
if (!hasEncryptionKey(address)) {
|
|
3798
|
-
console.warn(
|
|
3814
|
+
console.warn(
|
|
3815
|
+
"[extractAndStoreEncryptedMCPImages] Encryption key not available"
|
|
3816
|
+
);
|
|
3799
3817
|
return { processedFiles: [], cleanedContent: content };
|
|
3800
3818
|
}
|
|
3801
3819
|
const MCP_IMAGE_URL_PATTERN = new RegExp(
|
|
@@ -3853,7 +3871,10 @@ function useChatStorage(options) {
|
|
|
3853
3871
|
const urlPath = imageUrl.split("?")[0] ?? imageUrl;
|
|
3854
3872
|
const extension = urlPath.match(/\.([a-zA-Z0-9]+)$/)?.[1] || "png";
|
|
3855
3873
|
const mimeType = blob.type || `image/${extension}`;
|
|
3856
|
-
const fileName = `mcp-image-${Date.now()}-${fileId.slice(
|
|
3874
|
+
const fileName = `mcp-image-${Date.now()}-${fileId.slice(
|
|
3875
|
+
0,
|
|
3876
|
+
8
|
|
3877
|
+
)}.${extension}`;
|
|
3857
3878
|
await writeEncryptedFile(fileId, blob, encryptionKey, {
|
|
3858
3879
|
name: fileName,
|
|
3859
3880
|
sourceUrl: imageUrl
|
|
@@ -3948,7 +3969,10 @@ function useChatStorage(options) {
|
|
|
3948
3969
|
placeholder
|
|
3949
3970
|
);
|
|
3950
3971
|
replacementCount += rawMatches.length;
|
|
3951
|
-
cleanedContent = cleanedContent.replace(
|
|
3972
|
+
cleanedContent = cleanedContent.replace(
|
|
3973
|
+
rawUrlPattern,
|
|
3974
|
+
placeholder
|
|
3975
|
+
);
|
|
3952
3976
|
}
|
|
3953
3977
|
console.log(
|
|
3954
3978
|
`[extractAndStoreEncryptedMCPImages] Total replacements made: ${replacementCount} for URL:`,
|
|
@@ -3970,13 +3994,19 @@ function useChatStorage(options) {
|
|
|
3970
3994
|
);
|
|
3971
3995
|
}
|
|
3972
3996
|
} else {
|
|
3973
|
-
console.error(
|
|
3997
|
+
console.error(
|
|
3998
|
+
"[extractAndStoreEncryptedMCPImages] Failed:",
|
|
3999
|
+
result.reason
|
|
4000
|
+
);
|
|
3974
4001
|
}
|
|
3975
4002
|
});
|
|
3976
4003
|
cleanedContent = cleanedContent.replace(/\n{3,}/g, "\n\n").trim();
|
|
3977
4004
|
return { processedFiles, cleanedContent };
|
|
3978
4005
|
} catch (err) {
|
|
3979
|
-
console.error(
|
|
4006
|
+
console.error(
|
|
4007
|
+
"[extractAndStoreEncryptedMCPImages] Unexpected error:",
|
|
4008
|
+
err
|
|
4009
|
+
);
|
|
3980
4010
|
return { processedFiles: [], cleanedContent: content };
|
|
3981
4011
|
}
|
|
3982
4012
|
},
|
|
@@ -4006,7 +4036,7 @@ function useChatStorage(options) {
|
|
|
4006
4036
|
toolChoice,
|
|
4007
4037
|
reasoning,
|
|
4008
4038
|
thinking,
|
|
4009
|
-
onThinking,
|
|
4039
|
+
onThinking: onThinking2,
|
|
4010
4040
|
apiType: requestApiType,
|
|
4011
4041
|
writeFile
|
|
4012
4042
|
} = args;
|
|
@@ -4079,7 +4109,7 @@ function useChatStorage(options) {
|
|
|
4079
4109
|
toolChoice,
|
|
4080
4110
|
reasoning,
|
|
4081
4111
|
thinking,
|
|
4082
|
-
onThinking,
|
|
4112
|
+
onThinking: onThinking2,
|
|
4083
4113
|
apiType: requestApiType
|
|
4084
4114
|
});
|
|
4085
4115
|
const responseDuration = (Date.now() - startTime) / 1e3;
|
|
@@ -4215,7 +4245,14 @@ function useChatStorage(options) {
|
|
|
4215
4245
|
assistantMessage: storedAssistantMessage
|
|
4216
4246
|
};
|
|
4217
4247
|
},
|
|
4218
|
-
[
|
|
4248
|
+
[
|
|
4249
|
+
ensureConversation,
|
|
4250
|
+
getMessages,
|
|
4251
|
+
storageCtx,
|
|
4252
|
+
baseSendMessage,
|
|
4253
|
+
walletAddress,
|
|
4254
|
+
extractAndStoreEncryptedMCPImages
|
|
4255
|
+
]
|
|
4219
4256
|
);
|
|
4220
4257
|
const searchMessages = (0, import_react2.useCallback)(
|
|
4221
4258
|
async (queryVector, options2) => {
|
|
@@ -4359,7 +4396,7 @@ __decorateClass([
|
|
|
4359
4396
|
], UserPreference.prototype, "updatedAt", 2);
|
|
4360
4397
|
|
|
4361
4398
|
// src/lib/db/schema.ts
|
|
4362
|
-
var SDK_SCHEMA_VERSION =
|
|
4399
|
+
var SDK_SCHEMA_VERSION = 9;
|
|
4363
4400
|
var sdkSchema = (0, import_watermelondb7.appSchema)({
|
|
4364
4401
|
version: SDK_SCHEMA_VERSION,
|
|
4365
4402
|
tables: [
|
|
@@ -4382,8 +4419,10 @@ var sdkSchema = (0, import_watermelondb7.appSchema)({
|
|
|
4382
4419
|
{ name: "response_duration", type: "number", isOptional: true },
|
|
4383
4420
|
{ name: "was_stopped", type: "boolean", isOptional: true },
|
|
4384
4421
|
{ name: "error", type: "string", isOptional: true },
|
|
4385
|
-
{ name: "thought_process", type: "string", isOptional: true }
|
|
4422
|
+
{ name: "thought_process", type: "string", isOptional: true },
|
|
4386
4423
|
// JSON stringified ActivityPhase[]
|
|
4424
|
+
{ name: "thinking", type: "string", isOptional: true }
|
|
4425
|
+
// Reasoning/thinking content
|
|
4387
4426
|
]
|
|
4388
4427
|
}),
|
|
4389
4428
|
(0, import_watermelondb7.tableSchema)({
|
|
@@ -4521,6 +4560,16 @@ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
|
|
|
4521
4560
|
(0, import_migrations2.unsafeExecuteSql)("DELETE FROM conversations;"),
|
|
4522
4561
|
(0, import_migrations2.unsafeExecuteSql)("DELETE FROM memories;")
|
|
4523
4562
|
]
|
|
4563
|
+
},
|
|
4564
|
+
// v8 -> v9: Added thinking column to history for reasoning/thinking content
|
|
4565
|
+
{
|
|
4566
|
+
toVersion: 9,
|
|
4567
|
+
steps: [
|
|
4568
|
+
(0, import_migrations2.addColumns)({
|
|
4569
|
+
table: "history",
|
|
4570
|
+
columns: [{ name: "thinking", type: "string", isOptional: true }]
|
|
4571
|
+
})
|
|
4572
|
+
]
|
|
4524
4573
|
}
|
|
4525
4574
|
]
|
|
4526
4575
|
});
|
|
@@ -5249,7 +5298,7 @@ var postAuthOauthByProviderRevoke = (options) => {
|
|
|
5249
5298
|
|
|
5250
5299
|
// src/lib/memory/constants.ts
|
|
5251
5300
|
var DEFAULT_API_EMBEDDING_MODEL = "fireworks/accounts/fireworks/models/qwen3-embedding-8b";
|
|
5252
|
-
var DEFAULT_COMPLETION_MODEL = "
|
|
5301
|
+
var DEFAULT_COMPLETION_MODEL = "fireworks/accounts/fireworks/models/gpt-oss-20b";
|
|
5253
5302
|
|
|
5254
5303
|
// src/lib/memory/embeddings.ts
|
|
5255
5304
|
var generateEmbeddingForText = async (text5, options = {}) => {
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1442,6 +1442,8 @@ interface BaseUseChatStorageOptions {
|
|
|
1442
1442
|
baseUrl?: string;
|
|
1443
1443
|
/** Callback invoked with each streamed response chunk */
|
|
1444
1444
|
onData?: (chunk: string) => void;
|
|
1445
|
+
/** Callback invoked when thinking/reasoning content is received (from <think> tags or API reasoning) */
|
|
1446
|
+
onThinking?: (chunk: string) => void;
|
|
1445
1447
|
/** Callback invoked when the response completes successfully */
|
|
1446
1448
|
onFinish?: (response: LlmapiResponseResponse) => void;
|
|
1447
1449
|
/** Callback invoked when an error occurs during the request */
|
|
@@ -2002,6 +2004,7 @@ declare const sdkSchema: Readonly<{
|
|
|
2002
2004
|
* - v5 → v6: Added `thought_process` column to history table for activity tracking
|
|
2003
2005
|
* - v6 → v7: Added `userPreferences` table for unified user settings storage
|
|
2004
2006
|
* - v7 → v8: BREAKING - Clear all data (embedding model change)
|
|
2007
|
+
* - v8 → v9: Added `thinking` column to history table for reasoning/thinking content
|
|
2005
2008
|
*/
|
|
2006
2009
|
declare const sdkMigrations: Readonly<{
|
|
2007
2010
|
validated: true;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1442,6 +1442,8 @@ interface BaseUseChatStorageOptions {
|
|
|
1442
1442
|
baseUrl?: string;
|
|
1443
1443
|
/** Callback invoked with each streamed response chunk */
|
|
1444
1444
|
onData?: (chunk: string) => void;
|
|
1445
|
+
/** Callback invoked when thinking/reasoning content is received (from <think> tags or API reasoning) */
|
|
1446
|
+
onThinking?: (chunk: string) => void;
|
|
1445
1447
|
/** Callback invoked when the response completes successfully */
|
|
1446
1448
|
onFinish?: (response: LlmapiResponseResponse) => void;
|
|
1447
1449
|
/** Callback invoked when an error occurs during the request */
|
|
@@ -2002,6 +2004,7 @@ declare const sdkSchema: Readonly<{
|
|
|
2002
2004
|
* - v5 → v6: Added `thought_process` column to history table for activity tracking
|
|
2003
2005
|
* - v6 → v7: Added `userPreferences` table for unified user settings storage
|
|
2004
2006
|
* - v7 → v8: BREAKING - Clear all data (embedding model change)
|
|
2007
|
+
* - v8 → v9: Added `thinking` column to history table for reasoning/thinking content
|
|
2005
2008
|
*/
|
|
2006
2009
|
declare const sdkMigrations: Readonly<{
|
|
2007
2010
|
validated: true;
|
package/dist/react/index.mjs
CHANGED
|
@@ -1379,7 +1379,10 @@ var CompletionsStrategy = class {
|
|
|
1379
1379
|
let finalContent = accumulator.content;
|
|
1380
1380
|
let finalThinking = accumulator.thinking;
|
|
1381
1381
|
if (accumulator.partialReasoningTag) {
|
|
1382
|
-
const finalParse = parseReasoningTags(
|
|
1382
|
+
const finalParse = parseReasoningTags(
|
|
1383
|
+
"",
|
|
1384
|
+
accumulator.partialReasoningTag
|
|
1385
|
+
);
|
|
1383
1386
|
finalContent += finalParse.messageContent;
|
|
1384
1387
|
if (finalParse.reasoningContent) {
|
|
1385
1388
|
finalThinking += finalParse.reasoningContent;
|
|
@@ -3166,6 +3169,7 @@ function useChatStorage(options) {
|
|
|
3166
3169
|
getToken,
|
|
3167
3170
|
baseUrl,
|
|
3168
3171
|
onData,
|
|
3172
|
+
onThinking,
|
|
3169
3173
|
onFinish,
|
|
3170
3174
|
onError,
|
|
3171
3175
|
apiType,
|
|
@@ -3203,6 +3207,7 @@ function useChatStorage(options) {
|
|
|
3203
3207
|
getToken,
|
|
3204
3208
|
baseUrl,
|
|
3205
3209
|
onData,
|
|
3210
|
+
onThinking,
|
|
3206
3211
|
onFinish,
|
|
3207
3212
|
onError,
|
|
3208
3213
|
apiType
|
|
@@ -3301,13 +3306,19 @@ function useChatStorage(options) {
|
|
|
3301
3306
|
let resolvedContent = msg.content;
|
|
3302
3307
|
for (const [fileId, url] of fileIdToUrlMap) {
|
|
3303
3308
|
const placeholder = createFilePlaceholder(fileId);
|
|
3304
|
-
const escapedPlaceholder = placeholder.replace(
|
|
3309
|
+
const escapedPlaceholder = placeholder.replace(
|
|
3310
|
+
/[.*+?^${}()|[\]\\]/g,
|
|
3311
|
+
"\\$&"
|
|
3312
|
+
);
|
|
3305
3313
|
const placeholderRegex = new RegExp(escapedPlaceholder, "g");
|
|
3306
3314
|
const replacement = ``;
|
|
3307
3315
|
console.log(
|
|
3308
3316
|
`[getMessages] Replacing ${placeholder} with: ${replacement}`
|
|
3309
3317
|
);
|
|
3310
|
-
resolvedContent = resolvedContent.replace(
|
|
3318
|
+
resolvedContent = resolvedContent.replace(
|
|
3319
|
+
placeholderRegex,
|
|
3320
|
+
replacement
|
|
3321
|
+
);
|
|
3311
3322
|
}
|
|
3312
3323
|
console.log(
|
|
3313
3324
|
`[getMessages] Resolved content length: ${resolvedContent.length}, original length: ${msg.content.length}`
|
|
@@ -3317,7 +3328,10 @@ function useChatStorage(options) {
|
|
|
3317
3328
|
);
|
|
3318
3329
|
return resolvedMessages;
|
|
3319
3330
|
} catch (error) {
|
|
3320
|
-
console.error(
|
|
3331
|
+
console.error(
|
|
3332
|
+
"[useChatStorage] Failed to resolve file placeholders:",
|
|
3333
|
+
error
|
|
3334
|
+
);
|
|
3321
3335
|
return messages;
|
|
3322
3336
|
}
|
|
3323
3337
|
}
|
|
@@ -3657,11 +3671,15 @@ function useChatStorage(options) {
|
|
|
3657
3671
|
async (content, address) => {
|
|
3658
3672
|
try {
|
|
3659
3673
|
if (!isOPFSSupported()) {
|
|
3660
|
-
console.warn(
|
|
3674
|
+
console.warn(
|
|
3675
|
+
"[extractAndStoreEncryptedMCPImages] OPFS not supported"
|
|
3676
|
+
);
|
|
3661
3677
|
return { processedFiles: [], cleanedContent: content };
|
|
3662
3678
|
}
|
|
3663
3679
|
if (!hasEncryptionKey(address)) {
|
|
3664
|
-
console.warn(
|
|
3680
|
+
console.warn(
|
|
3681
|
+
"[extractAndStoreEncryptedMCPImages] Encryption key not available"
|
|
3682
|
+
);
|
|
3665
3683
|
return { processedFiles: [], cleanedContent: content };
|
|
3666
3684
|
}
|
|
3667
3685
|
const MCP_IMAGE_URL_PATTERN = new RegExp(
|
|
@@ -3719,7 +3737,10 @@ function useChatStorage(options) {
|
|
|
3719
3737
|
const urlPath = imageUrl.split("?")[0] ?? imageUrl;
|
|
3720
3738
|
const extension = urlPath.match(/\.([a-zA-Z0-9]+)$/)?.[1] || "png";
|
|
3721
3739
|
const mimeType = blob.type || `image/${extension}`;
|
|
3722
|
-
const fileName = `mcp-image-${Date.now()}-${fileId.slice(
|
|
3740
|
+
const fileName = `mcp-image-${Date.now()}-${fileId.slice(
|
|
3741
|
+
0,
|
|
3742
|
+
8
|
|
3743
|
+
)}.${extension}`;
|
|
3723
3744
|
await writeEncryptedFile(fileId, blob, encryptionKey, {
|
|
3724
3745
|
name: fileName,
|
|
3725
3746
|
sourceUrl: imageUrl
|
|
@@ -3814,7 +3835,10 @@ function useChatStorage(options) {
|
|
|
3814
3835
|
placeholder
|
|
3815
3836
|
);
|
|
3816
3837
|
replacementCount += rawMatches.length;
|
|
3817
|
-
cleanedContent = cleanedContent.replace(
|
|
3838
|
+
cleanedContent = cleanedContent.replace(
|
|
3839
|
+
rawUrlPattern,
|
|
3840
|
+
placeholder
|
|
3841
|
+
);
|
|
3818
3842
|
}
|
|
3819
3843
|
console.log(
|
|
3820
3844
|
`[extractAndStoreEncryptedMCPImages] Total replacements made: ${replacementCount} for URL:`,
|
|
@@ -3836,13 +3860,19 @@ function useChatStorage(options) {
|
|
|
3836
3860
|
);
|
|
3837
3861
|
}
|
|
3838
3862
|
} else {
|
|
3839
|
-
console.error(
|
|
3863
|
+
console.error(
|
|
3864
|
+
"[extractAndStoreEncryptedMCPImages] Failed:",
|
|
3865
|
+
result.reason
|
|
3866
|
+
);
|
|
3840
3867
|
}
|
|
3841
3868
|
});
|
|
3842
3869
|
cleanedContent = cleanedContent.replace(/\n{3,}/g, "\n\n").trim();
|
|
3843
3870
|
return { processedFiles, cleanedContent };
|
|
3844
3871
|
} catch (err) {
|
|
3845
|
-
console.error(
|
|
3872
|
+
console.error(
|
|
3873
|
+
"[extractAndStoreEncryptedMCPImages] Unexpected error:",
|
|
3874
|
+
err
|
|
3875
|
+
);
|
|
3846
3876
|
return { processedFiles: [], cleanedContent: content };
|
|
3847
3877
|
}
|
|
3848
3878
|
},
|
|
@@ -3872,7 +3902,7 @@ function useChatStorage(options) {
|
|
|
3872
3902
|
toolChoice,
|
|
3873
3903
|
reasoning,
|
|
3874
3904
|
thinking,
|
|
3875
|
-
onThinking,
|
|
3905
|
+
onThinking: onThinking2,
|
|
3876
3906
|
apiType: requestApiType,
|
|
3877
3907
|
writeFile
|
|
3878
3908
|
} = args;
|
|
@@ -3945,7 +3975,7 @@ function useChatStorage(options) {
|
|
|
3945
3975
|
toolChoice,
|
|
3946
3976
|
reasoning,
|
|
3947
3977
|
thinking,
|
|
3948
|
-
onThinking,
|
|
3978
|
+
onThinking: onThinking2,
|
|
3949
3979
|
apiType: requestApiType
|
|
3950
3980
|
});
|
|
3951
3981
|
const responseDuration = (Date.now() - startTime) / 1e3;
|
|
@@ -4081,7 +4111,14 @@ function useChatStorage(options) {
|
|
|
4081
4111
|
assistantMessage: storedAssistantMessage
|
|
4082
4112
|
};
|
|
4083
4113
|
},
|
|
4084
|
-
[
|
|
4114
|
+
[
|
|
4115
|
+
ensureConversation,
|
|
4116
|
+
getMessages,
|
|
4117
|
+
storageCtx,
|
|
4118
|
+
baseSendMessage,
|
|
4119
|
+
walletAddress,
|
|
4120
|
+
extractAndStoreEncryptedMCPImages
|
|
4121
|
+
]
|
|
4085
4122
|
);
|
|
4086
4123
|
const searchMessages = useCallback2(
|
|
4087
4124
|
async (queryVector, options2) => {
|
|
@@ -4230,7 +4267,7 @@ __decorateClass([
|
|
|
4230
4267
|
], UserPreference.prototype, "updatedAt", 2);
|
|
4231
4268
|
|
|
4232
4269
|
// src/lib/db/schema.ts
|
|
4233
|
-
var SDK_SCHEMA_VERSION =
|
|
4270
|
+
var SDK_SCHEMA_VERSION = 9;
|
|
4234
4271
|
var sdkSchema = appSchema2({
|
|
4235
4272
|
version: SDK_SCHEMA_VERSION,
|
|
4236
4273
|
tables: [
|
|
@@ -4253,8 +4290,10 @@ var sdkSchema = appSchema2({
|
|
|
4253
4290
|
{ name: "response_duration", type: "number", isOptional: true },
|
|
4254
4291
|
{ name: "was_stopped", type: "boolean", isOptional: true },
|
|
4255
4292
|
{ name: "error", type: "string", isOptional: true },
|
|
4256
|
-
{ name: "thought_process", type: "string", isOptional: true }
|
|
4293
|
+
{ name: "thought_process", type: "string", isOptional: true },
|
|
4257
4294
|
// JSON stringified ActivityPhase[]
|
|
4295
|
+
{ name: "thinking", type: "string", isOptional: true }
|
|
4296
|
+
// Reasoning/thinking content
|
|
4258
4297
|
]
|
|
4259
4298
|
}),
|
|
4260
4299
|
tableSchema2({
|
|
@@ -4392,6 +4431,16 @@ var sdkMigrations = schemaMigrations2({
|
|
|
4392
4431
|
unsafeExecuteSql("DELETE FROM conversations;"),
|
|
4393
4432
|
unsafeExecuteSql("DELETE FROM memories;")
|
|
4394
4433
|
]
|
|
4434
|
+
},
|
|
4435
|
+
// v8 -> v9: Added thinking column to history for reasoning/thinking content
|
|
4436
|
+
{
|
|
4437
|
+
toVersion: 9,
|
|
4438
|
+
steps: [
|
|
4439
|
+
addColumns2({
|
|
4440
|
+
table: "history",
|
|
4441
|
+
columns: [{ name: "thinking", type: "string", isOptional: true }]
|
|
4442
|
+
})
|
|
4443
|
+
]
|
|
4395
4444
|
}
|
|
4396
4445
|
]
|
|
4397
4446
|
});
|
|
@@ -5120,7 +5169,7 @@ var postAuthOauthByProviderRevoke = (options) => {
|
|
|
5120
5169
|
|
|
5121
5170
|
// src/lib/memory/constants.ts
|
|
5122
5171
|
var DEFAULT_API_EMBEDDING_MODEL = "fireworks/accounts/fireworks/models/qwen3-embedding-8b";
|
|
5123
|
-
var DEFAULT_COMPLETION_MODEL = "
|
|
5172
|
+
var DEFAULT_COMPLETION_MODEL = "fireworks/accounts/fireworks/models/gpt-oss-20b";
|
|
5124
5173
|
|
|
5125
5174
|
// src/lib/memory/embeddings.ts
|
|
5126
5175
|
var generateEmbeddingForText = async (text5, options = {}) => {
|