@rulvar/anthropic 1.27.0 → 1.28.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.
Files changed (2) hide show
  1. package/dist/index.js +15 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -766,6 +766,7 @@ function anthropic(options = {}) {
766
766
  stream: true
767
767
  }, signal === void 0 ? void 0 : { signal });
768
768
  } catch (thrown) {
769
+ if (signal?.aborted === true) return;
769
770
  yield {
770
771
  type: "error",
771
772
  error: anthropicErrorToWire(thrown)
@@ -791,7 +792,20 @@ function anthropic(options = {}) {
791
792
  };
792
793
  return;
793
794
  }
794
- if (!mapping.pauseTurn) return;
795
+ if (mapping.finished) return;
796
+ if (!mapping.pauseTurn) {
797
+ if (signal?.aborted === true) return;
798
+ yield {
799
+ type: "error",
800
+ error: {
801
+ code: "agent",
802
+ message: "Messages stream ended before message_stop; the read was truncated",
803
+ retryable: true,
804
+ data: { kind: "transport" }
805
+ }
806
+ };
807
+ return;
808
+ }
795
809
  carryRetained.push(...mapping.assistantContent.filter((block) => block.type === "thinking" || block.type === "redacted_thinking"));
796
810
  continuations += 1;
797
811
  if (continuations > pauseCap) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/anthropic",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Rulvar first-class provider adapter over @anthropic-ai/sdk.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@anthropic-ai/sdk": "^0.110.0",
26
- "@rulvar/core": "1.27.0"
26
+ "@rulvar/core": "1.28.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.20.0",
30
30
  "tsdown": "^0.22.3",
31
31
  "typescript": "~6.0.3",
32
- "@rulvar/testing": "1.27.0"
32
+ "@rulvar/testing": "1.28.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",