@ai-sdk/harness-pi 1.0.89 → 1.0.92

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @ai-sdk/harness-pi
2
2
 
3
+ ## 1.0.92
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [3e125ba]
8
+ - Updated dependencies [0e590d2]
9
+ - @ai-sdk/provider-utils@5.0.32
10
+ - @ai-sdk/harness@1.0.90
11
+
12
+ ## 1.0.91
13
+
14
+ ### Patch Changes
15
+
16
+ - @ai-sdk/harness@1.0.89
17
+
18
+ ## 1.0.90
19
+
20
+ ### Patch Changes
21
+
22
+ - 32349cc: Surface every host tool approval request when a Pi step emits multiple tool calls.
23
+ - Updated dependencies [32349cc]
24
+ - Updated dependencies [a9782e1]
25
+ - Updated dependencies [35841f5]
26
+ - Updated dependencies [d2f3353]
27
+ - @ai-sdk/harness@1.0.88
28
+ - @ai-sdk/provider-utils@5.0.31
29
+
3
30
  ## 1.0.89
4
31
 
5
32
  ### Patch Changes
package/dist/index.js CHANGED
@@ -128,7 +128,7 @@ import {
128
128
  import { getAiGatewayAuthFromEnv } from "@ai-sdk/harness/utils";
129
129
 
130
130
  // src/version.ts
131
- var VERSION = true ? "1.0.89" : "0.0.0-test";
131
+ var VERSION = true ? "1.0.92" : "0.0.0-test";
132
132
 
133
133
  // src/pi-auth.ts
134
134
  var DEFAULT_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
@@ -1002,6 +1002,7 @@ function createPiTranslatorState(options = {}) {
1002
1002
  reasoningStarted: false,
1003
1003
  observedToolNames: /* @__PURE__ */ new Map(),
1004
1004
  pendingStepToolCallIds: /* @__PURE__ */ new Set(),
1005
+ stepToolCallCount: void 0,
1005
1006
  stepOpen: false,
1006
1007
  hostToolResults: /* @__PURE__ */ new Map(),
1007
1008
  dynamicToolCallIds: /* @__PURE__ */ new Set(),
@@ -1048,6 +1049,7 @@ function finishStep(state) {
1048
1049
  if (!state.stepOpen || state.pendingStepToolCallIds.size > 0) return [];
1049
1050
  state.stepOpen = false;
1050
1051
  state.pendingStepToolCallIds.clear();
1052
+ state.stepToolCallCount = void 0;
1051
1053
  return [
1052
1054
  {
1053
1055
  type: "finish-step",
@@ -1087,6 +1089,7 @@ function translatePiEvent(event, state) {
1087
1089
  if (event.type === "message_start") {
1088
1090
  state.stepOpen = true;
1089
1091
  state.pendingStepToolCallIds.clear();
1092
+ state.stepToolCallCount = void 0;
1090
1093
  }
1091
1094
  state.streamedAssistantText = "";
1092
1095
  state.currentTextId = void 0;
@@ -1166,11 +1169,14 @@ function translatePiEvent(event, state) {
1166
1169
  state.currentReasoningId = void 0;
1167
1170
  }
1168
1171
  if (event.type === "message_end") {
1169
- for (const toolCallId of extractPiToolCallIds(event.message)) {
1172
+ const toolCallIds = extractPiToolCallIds(event.message);
1173
+ state.stepToolCallCount = toolCallIds.length > 0 ? toolCallIds.length : void 0;
1174
+ for (const toolCallId of toolCallIds) {
1170
1175
  state.pendingStepToolCallIds.add(toolCallId);
1171
1176
  }
1172
1177
  } else {
1173
1178
  state.pendingStepToolCallIds.clear();
1179
+ state.stepToolCallCount = void 0;
1174
1180
  parts.push(...finishStep(state));
1175
1181
  }
1176
1182
  return parts;
@@ -1191,7 +1197,8 @@ function translatePiEvent(event, state) {
1191
1197
  input,
1192
1198
  ...wire !== native ? { nativeName: native } : {},
1193
1199
  ...providerExecuted ? { providerExecuted: true } : {},
1194
- ...isMcpTool ? { dynamic: true } : {}
1200
+ ...isMcpTool ? { dynamic: true } : {},
1201
+ ...state.stepToolCallCount != null ? { stepToolCallCount: state.stepToolCallCount } : {}
1195
1202
  }
1196
1203
  ];
1197
1204
  }