@rulvar/bridge-ai-sdk 1.87.0 → 1.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +24 -12
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -550,18 +550,27 @@ var StreamMapper = class {
|
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
552
|
mapFinish(part) {
|
|
553
|
-
if (part.finishReason.unified === "error")
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
error: {
|
|
559
|
-
code: "agent",
|
|
560
|
-
message: part.finishReason.raw === void 0 ? "bridged provider reported an error finish" : `bridged provider reported an error finish (${part.finishReason.raw})`,
|
|
561
|
-
retryable: true,
|
|
562
|
-
data: { kind: "transport" }
|
|
553
|
+
if (part.finishReason.unified === "error") {
|
|
554
|
+
const errorBag = {};
|
|
555
|
+
if (this.response !== void 0) {
|
|
556
|
+
errorBag.response = this.response;
|
|
557
|
+
if (typeof this.response.id === "string") errorBag.responseId = this.response.id;
|
|
563
558
|
}
|
|
564
|
-
|
|
559
|
+
if (this.warnings.length > 0) errorBag.warnings = this.warnings;
|
|
560
|
+
return [{
|
|
561
|
+
type: "usage",
|
|
562
|
+
usage: mapUsage(part.usage)
|
|
563
|
+
}, {
|
|
564
|
+
type: "error",
|
|
565
|
+
error: {
|
|
566
|
+
code: "agent",
|
|
567
|
+
message: part.finishReason.raw === void 0 ? "bridged provider reported an error finish" : `bridged provider reported an error finish (${part.finishReason.raw})`,
|
|
568
|
+
retryable: true,
|
|
569
|
+
data: { kind: "transport" }
|
|
570
|
+
},
|
|
571
|
+
...Object.keys(errorBag).length === 0 ? {} : { providerMetadata: { [this.adapterId]: errorBag } }
|
|
572
|
+
}];
|
|
573
|
+
}
|
|
565
574
|
for (const acc of this.reasoning.values()) this.retained.push({
|
|
566
575
|
type: "reasoning",
|
|
567
576
|
text: acc.text,
|
|
@@ -573,7 +582,10 @@ var StreamMapper = class {
|
|
|
573
582
|
const bag = {};
|
|
574
583
|
if (this.retained.length > 0) bag.retainedParts = this.retained;
|
|
575
584
|
if (this.warnings.length > 0) bag.warnings = this.warnings;
|
|
576
|
-
if (this.response !== void 0)
|
|
585
|
+
if (this.response !== void 0) {
|
|
586
|
+
bag.response = this.response;
|
|
587
|
+
if (typeof this.response.id === "string") bag.responseId = this.response.id;
|
|
588
|
+
}
|
|
577
589
|
if (part.providerMetadata !== void 0) bag.upstream = part.providerMetadata;
|
|
578
590
|
if (this.effortDownmapped) bag.effortDownmap = "max->xhigh";
|
|
579
591
|
if (part.finishReason.unified === "other" && part.finishReason.raw !== void 0) bag.finishRaw = part.finishReason.raw;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/bridge-ai-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.89.0",
|
|
4
4
|
"description": "Rulvar bridge adapter wrapping any Vercel AI SDK LanguageModelV4 as a ProviderAdapter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ai-sdk/provider": "^4.0.3",
|
|
26
|
-
"@rulvar/core": "1.
|
|
26
|
+
"@rulvar/core": "1.89.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@ai-sdk/google": "^4.0.24",
|
|
30
30
|
"@types/node": "^22.20.1",
|
|
31
31
|
"tsdown": "^0.22.14",
|
|
32
32
|
"typescript": "~6.0.3",
|
|
33
|
-
"@rulvar/testing": "1.
|
|
33
|
+
"@rulvar/testing": "1.89.0"
|
|
34
34
|
},
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|