@ai-sdk/harness 1.0.87 → 1.0.90

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
2
2
 
3
+ ## 1.0.90
4
+
5
+ ### Patch Changes
6
+
7
+ - 0e590d2: feat(harness): harden credential brokering to only apply with correct ephemeral secret
8
+ - Updated dependencies [3e125ba]
9
+ - ai@7.0.82
10
+ - @ai-sdk/provider-utils@5.0.32
11
+
12
+ ## 1.0.89
13
+
14
+ ### Patch Changes
15
+
16
+ - ai@7.0.81
17
+
18
+ ## 1.0.88
19
+
20
+ ### Patch Changes
21
+
22
+ - 32349cc: Surface every host tool approval request when a Pi step emits multiple tool calls.
23
+ - Updated dependencies [a9782e1]
24
+ - Updated dependencies [35841f5]
25
+ - Updated dependencies [d2f3353]
26
+ - Updated dependencies [eed7950]
27
+ - @ai-sdk/provider-utils@5.0.31
28
+ - ai@7.0.80
29
+
3
30
  ## 1.0.87
4
31
 
5
32
  ### Patch Changes
@@ -572,6 +572,11 @@ type HarnessV1StreamPart = {
572
572
  harnessMetadata?: HarnessV1Metadata;
573
573
  } | (LanguageModelV4ToolCall & {
574
574
  nativeName?: string;
575
+ /**
576
+ * Total tool calls in the current model step, when known before tool
577
+ * execution begins. Populate this on every tool call in the step.
578
+ */
579
+ stepToolCallCount?: number;
575
580
  }) | LanguageModelV4ToolApprovalRequest | LanguageModelV4ToolResult | {
576
581
  type: 'finish-step';
577
582
  finishReason: LanguageModelV4FinishReason;
@@ -1614,6 +1614,9 @@ function runPrompt(input) {
1614
1614
  let stepText = "";
1615
1615
  let stepReasoning = "";
1616
1616
  let stepToolCalls = [];
1617
+ let expectedStepToolCallCount;
1618
+ let observedStepToolCallCount = 0;
1619
+ let pauseAfterStepToolCalls = false;
1617
1620
  const buildStepContent = () => {
1618
1621
  const parts = [];
1619
1622
  if (stepText) parts.push({ type: "text", text: stepText });
@@ -1625,6 +1628,9 @@ function runPrompt(input) {
1625
1628
  stepText = "";
1626
1629
  stepReasoning = "";
1627
1630
  stepToolCalls = [];
1631
+ expectedStepToolCallCount = void 0;
1632
+ observedStepToolCallCount = 0;
1633
+ pauseAfterStepToolCalls = false;
1628
1634
  };
1629
1635
  const zeroUsage = {
1630
1636
  inputTokens: {
@@ -1859,6 +1865,10 @@ function runPrompt(input) {
1859
1865
  }
1860
1866
  }
1861
1867
  while (true) {
1868
+ if (pauseAfterStepToolCalls && expectedStepToolCallCount != null && observedStepToolCallCount >= expectedStepToolCallCount) {
1869
+ await finishForHostInputPause({ completeCurrentStep: true });
1870
+ return;
1871
+ }
1862
1872
  const { value, done: done2 } = await reader.read();
1863
1873
  if (done2) {
1864
1874
  releasePendingStopBoundary();
@@ -1965,6 +1975,8 @@ function runPrompt(input) {
1965
1975
  stepReasoning += value.delta;
1966
1976
  }
1967
1977
  if (value.type === "tool-call") {
1978
+ observedStepToolCallCount += 1;
1979
+ expectedStepToolCallCount != null ? expectedStepToolCallCount : expectedStepToolCallCount = value.stepToolCallCount;
1968
1980
  stepToolCalls.push({
1969
1981
  type: "tool-call",
1970
1982
  toolCallId: value.toolCallId,
@@ -2145,11 +2157,19 @@ function runPrompt(input) {
2145
2157
  approvalId: pendingApproval.approvalId,
2146
2158
  toolCall: pendingParsedToolCall
2147
2159
  });
2160
+ if (expectedStepToolCallCount != null && observedStepToolCallCount < expectedStepToolCallCount) {
2161
+ pauseAfterStepToolCalls = true;
2162
+ continue;
2163
+ }
2148
2164
  await finishForHostInputPause({ completeCurrentStep: true });
2149
2165
  return;
2150
2166
  }
2151
2167
  if (!isExecutableTool(activeTools[toolCall.toolName])) {
2152
2168
  recordPendingToolResult({ toolCall });
2169
+ if (expectedStepToolCallCount != null && observedStepToolCallCount < expectedStepToolCallCount) {
2170
+ pauseAfterStepToolCalls = true;
2171
+ continue;
2172
+ }
2153
2173
  await finishForHostInputPause({ completeCurrentStep: true });
2154
2174
  return;
2155
2175
  }