@f5-sales-demo/pi-ai 20.22.2 → 21.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5-sales-demo/pi-ai",
4
- "version": "20.22.2",
4
+ "version": "21.0.0",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/f5-sales-demo/xcsh",
7
7
  "author": "Can Boluk",
@@ -46,7 +46,7 @@
46
46
  "@anthropic-ai/sdk": "^0.115",
47
47
  "@aws-sdk/client-bedrock-runtime": "^3",
48
48
  "@bufbuild/protobuf": "^2.11",
49
- "@f5-sales-demo/pi-utils": "20.22.2",
49
+ "@f5-sales-demo/pi-utils": "21.0.0",
50
50
  "@google/genai": "^2.15",
51
51
  "@sinclair/typebox": "^0.34",
52
52
  "@smithy/node-http-handler": "^4.4",
@@ -780,9 +780,11 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
780
780
  let sawEvent = false;
781
781
  let sawMessageStart = false;
782
782
  let sawTerminalEnvelope = false;
783
+ let lastEnvelopeEvent = "none";
783
784
 
784
785
  for await (const event of markFirstStreamEvent(anthropicStream, firstEventWatchdog)) {
785
786
  sawEvent = true;
787
+ lastEnvelopeEvent = event.type;
786
788
 
787
789
  if (event.type === "message_start") {
788
790
  if (sawMessageStart) {
@@ -1040,7 +1042,19 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
1040
1042
  throw createAnthropicStreamEnvelopeError("stream ended before message_start");
1041
1043
  }
1042
1044
  if (!sawTerminalEnvelope) {
1043
- throw createAnthropicStreamEnvelopeError("stream ended before terminal stop signal");
1045
+ throw createAnthropicStreamEnvelopeError(
1046
+ "stream ended before terminal stop signal (provider=" +
1047
+ model.provider +
1048
+ ", model=" +
1049
+ model.id +
1050
+ ", api=" +
1051
+ output.api +
1052
+ ", responseId=" +
1053
+ (output.responseId ?? "unavailable") +
1054
+ ", lastEvent=" +
1055
+ lastEnvelopeEvent +
1056
+ ")",
1057
+ );
1044
1058
  }
1045
1059
 
1046
1060
  if (output.stopReason === "aborted" || output.stopReason === "error") {