@ai-sdk/harness 1.0.49 → 1.0.51
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 +18 -0
- package/dist/agent/index.js +32 -0
- package/dist/agent/index.js.map +1 -1
- package/package.json +4 -4
- package/src/agent/internal/run-prompt.ts +39 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/harness",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@ai-sdk/provider": "4.0.4",
|
|
48
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
49
|
-
"ai": "7.0.
|
|
48
|
+
"@ai-sdk/provider-utils": "5.0.17",
|
|
49
|
+
"ai": "7.0.45"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"ws": "^8.21.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"typescript": "5.8.3",
|
|
66
66
|
"ws": "^8.21.0",
|
|
67
67
|
"zod": "3.25.76",
|
|
68
|
-
"@ai-sdk/otel": "1.0.
|
|
68
|
+
"@ai-sdk/otel": "1.0.45",
|
|
69
69
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
@@ -399,6 +399,41 @@ export function runPrompt<
|
|
|
399
399
|
isError: continuation.isError,
|
|
400
400
|
});
|
|
401
401
|
};
|
|
402
|
+
const enqueueHostToolOutcome = (options: {
|
|
403
|
+
toolCall: HarnessAgentToolApprovalContinuation['toolCall'];
|
|
404
|
+
outcome: HostToolOutcome;
|
|
405
|
+
}): void => {
|
|
406
|
+
if (options.outcome.ok) {
|
|
407
|
+
const stripped = stripWorkDir(
|
|
408
|
+
{
|
|
409
|
+
type: 'tool-result',
|
|
410
|
+
toolCallId: options.toolCall.toolCallId,
|
|
411
|
+
toolName: options.toolCall.toolName,
|
|
412
|
+
result: options.outcome.output as Extract<
|
|
413
|
+
HarnessV1StreamPart,
|
|
414
|
+
{ type: 'tool-result' }
|
|
415
|
+
>['result'],
|
|
416
|
+
},
|
|
417
|
+
input.sessionWorkDir,
|
|
418
|
+
) as Extract<HarnessV1StreamPart, { type: 'tool-result' }>;
|
|
419
|
+
result.enqueueContinuation({
|
|
420
|
+
type: 'tool-result',
|
|
421
|
+
toolCallId: options.toolCall.toolCallId,
|
|
422
|
+
toolName: options.toolCall.toolName,
|
|
423
|
+
input: options.toolCall.input,
|
|
424
|
+
output: stripped.result,
|
|
425
|
+
} as TextStreamPart<TOOLS>);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
result.enqueueContinuation({
|
|
430
|
+
type: 'tool-error',
|
|
431
|
+
toolCallId: options.toolCall.toolCallId,
|
|
432
|
+
toolName: options.toolCall.toolName,
|
|
433
|
+
input: options.toolCall.input,
|
|
434
|
+
error: options.outcome.error,
|
|
435
|
+
} as TextStreamPart<TOOLS>);
|
|
436
|
+
};
|
|
402
437
|
const processPendingApprovalContinuation = async (
|
|
403
438
|
approval: HarnessV1PendingToolApproval,
|
|
404
439
|
continuation: HarnessAgentToolApprovalContinuation,
|
|
@@ -484,6 +519,10 @@ export function runPrompt<
|
|
|
484
519
|
await finishForHostInputPause({ completeCurrentStep: false });
|
|
485
520
|
return 'awaiting-tool-result';
|
|
486
521
|
}
|
|
522
|
+
enqueueHostToolOutcome({
|
|
523
|
+
toolCall: continuation.toolCall,
|
|
524
|
+
outcome: execution.outcome,
|
|
525
|
+
});
|
|
487
526
|
await telemetry.toolEnd(rawToolCall.toolCallId, execution.outcome);
|
|
488
527
|
return 'continued';
|
|
489
528
|
};
|