@ai-sdk/harness 1.0.87 → 1.0.91
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 +37 -0
- package/dist/agent/index.d.ts +5 -0
- package/dist/agent/index.js +20 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +16 -6
- package/dist/utils/index.js +62 -27
- package/dist/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/src/agent/internal/run-prompt.ts +35 -4
- package/src/utils/credential-forwarding.ts +30 -0
- package/src/utils/index.ts +6 -1
- package/src/utils/sandbox-credential-brokering.ts +23 -6
- package/src/v1/harness-v1-credential-forwarding.ts +4 -2
- package/src/v1/harness-v1-network-sandbox-session.ts +6 -0
- package/src/v1/harness-v1-stream-part.ts +14 -3
- package/src/v1/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @ai-sdk/harness
|
|
2
2
|
|
|
3
|
+
## 1.0.91
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8dd86a9]
|
|
8
|
+
- Updated dependencies [fda13b3]
|
|
9
|
+
- Updated dependencies [957146c]
|
|
10
|
+
- Updated dependencies [ce6849a]
|
|
11
|
+
- ai@7.0.83
|
|
12
|
+
|
|
13
|
+
## 1.0.90
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 0e590d2: feat(harness): harden credential brokering to only apply with correct ephemeral secret
|
|
18
|
+
- Updated dependencies [3e125ba]
|
|
19
|
+
- ai@7.0.82
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.32
|
|
21
|
+
|
|
22
|
+
## 1.0.89
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- ai@7.0.81
|
|
27
|
+
|
|
28
|
+
## 1.0.88
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 32349cc: Surface every host tool approval request when a Pi step emits multiple tool calls.
|
|
33
|
+
- Updated dependencies [a9782e1]
|
|
34
|
+
- Updated dependencies [35841f5]
|
|
35
|
+
- Updated dependencies [d2f3353]
|
|
36
|
+
- Updated dependencies [eed7950]
|
|
37
|
+
- @ai-sdk/provider-utils@5.0.31
|
|
38
|
+
- ai@7.0.80
|
|
39
|
+
|
|
3
40
|
## 1.0.87
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -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;
|
package/dist/agent/index.js
CHANGED
|
@@ -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
|
}
|