@ai-sdk/harness 1.0.141 → 1.0.143
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,21 @@
|
|
|
1
1
|
# @ai-sdk/harness
|
|
2
2
|
|
|
3
|
+
## 1.0.143
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c4a5c8d: fix(harness): fix calculation for total turn token usage so that it is not just the last step usage
|
|
8
|
+
- 50ac48b: fix(harness): fix `raw` chunk emission to not start a step
|
|
9
|
+
- e8af189: fix(harness): ensure a dynamic tool with the same name as a currently inactive built-in tool can pass validation
|
|
10
|
+
- Updated dependencies [3ebefff]
|
|
11
|
+
- ai@7.0.132
|
|
12
|
+
|
|
13
|
+
## 1.0.142
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- ai@7.0.131
|
|
18
|
+
|
|
3
19
|
## 1.0.141
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/agent/index.js
CHANGED
|
@@ -304,6 +304,16 @@ var HarnessStreamTextResult = class {
|
|
|
304
304
|
this.fullStreamController.enqueue(part);
|
|
305
305
|
}
|
|
306
306
|
/**
|
|
307
|
+
* Push adapter-specific raw data to `fullStream` without attributing it to a
|
|
308
|
+
* model step.
|
|
309
|
+
*/
|
|
310
|
+
enqueueRaw(rawValue) {
|
|
311
|
+
this.fullStreamController.enqueue({
|
|
312
|
+
type: "raw",
|
|
313
|
+
rawValue
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
307
317
|
* Drop content replayed while a suspended host-input pause closes its
|
|
308
318
|
* already-recorded model step.
|
|
309
319
|
*/
|
|
@@ -1947,15 +1957,18 @@ function runPrompt(input) {
|
|
|
1947
1957
|
break;
|
|
1948
1958
|
}
|
|
1949
1959
|
if (value == null) continue;
|
|
1960
|
+
if (value.type === "raw") {
|
|
1961
|
+
result.enqueueRaw(value.rawValue);
|
|
1962
|
+
continue;
|
|
1963
|
+
}
|
|
1950
1964
|
if (pendingStopBoundary != null) {
|
|
1951
1965
|
if (value.type === "finish") releasePendingStopBoundary();
|
|
1952
1966
|
else if ((await Promise.all(input.stopConditions.map((condition) => condition({ steps: completedSteps })))).some(Boolean)) {
|
|
1953
1967
|
await input.onStopConditionMet?.();
|
|
1954
|
-
const { usage } = pendingStopBoundary;
|
|
1955
1968
|
releasePendingStopBoundary();
|
|
1956
1969
|
await lifecycle.end({
|
|
1957
1970
|
steps: completedSteps,
|
|
1958
|
-
usage:
|
|
1971
|
+
usage: completedSteps.reduce((total, step) => addLanguageModelUsage(total, step.usage), createNullLanguageModelUsage())
|
|
1959
1972
|
});
|
|
1960
1973
|
await result.finish();
|
|
1961
1974
|
return;
|
|
@@ -2024,9 +2037,19 @@ function runPrompt(input) {
|
|
|
2024
2037
|
tools: input.harness.builtinTools,
|
|
2025
2038
|
toolName: value.toolName
|
|
2026
2039
|
}));
|
|
2040
|
+
const isFilteredBuiltinDynamicCall = displayValue.providerExecuted === true && displayValue.dynamic === true && hasTool({
|
|
2041
|
+
tools: input.harness.builtinTools,
|
|
2042
|
+
toolName: displayValue.toolName
|
|
2043
|
+
}) && !isHarnessV1BuiltinToolIncluded({
|
|
2044
|
+
toolName: displayValue.toolName,
|
|
2045
|
+
toolFiltering: input.builtinToolFiltering
|
|
2046
|
+
}) && !hasTool({
|
|
2047
|
+
tools: activeTools,
|
|
2048
|
+
toolName: displayValue.toolName
|
|
2049
|
+
});
|
|
2027
2050
|
const parsedToolCall = asToolCallTextStreamPart({ part: await validateToolCall({
|
|
2028
2051
|
event: isHostTool ? value : displayValue,
|
|
2029
|
-
tools: input.tools
|
|
2052
|
+
tools: isFilteredBuiltinDynamicCall ? void 0 : input.tools
|
|
2030
2053
|
}) });
|
|
2031
2054
|
validatedHostToolCall = isHostTool ? parsedToolCall : void 0;
|
|
2032
2055
|
const displayToolCall = isHostTool ? displayHostToolCall({
|
|
@@ -2104,7 +2127,6 @@ function runPrompt(input) {
|
|
|
2104
2127
|
});
|
|
2105
2128
|
if (input.stopConditions != null && input.stopConditions.length > 0) pendingStopBoundary = {
|
|
2106
2129
|
finishReason: value.finishReason,
|
|
2107
|
-
usage: value.usage,
|
|
2108
2130
|
releaseCheckpoint: pinSandboxChannelEventCheckpoint(value)
|
|
2109
2131
|
};
|
|
2110
2132
|
}
|