@peer-agent/runtime-sdk 0.0.5-beta.3 → 0.0.5
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/dist/pipeline.js +22 -8
- package/package.json +3 -3
package/dist/pipeline.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isParallelSafeLocalToolBatch } from '@peer-agent/runtime-core';
|
|
1
2
|
const DEFAULT_MAX_TURNS = 64;
|
|
2
3
|
function normalizeMaxTurns(value, fallback) {
|
|
3
4
|
if (value === Number.POSITIVE_INFINITY)
|
|
@@ -93,14 +94,27 @@ export function createRuntimePipeline(options) {
|
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
const executions = [];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
if (isParallelSafeLocalToolBatch(outcome.calls)) {
|
|
98
|
+
const batch = await Promise.all(outcome.calls.map(async (call, index) => {
|
|
99
|
+
throwIfAborted(signal);
|
|
100
|
+
return options.tools.execute(call, {
|
|
101
|
+
...currentContext,
|
|
102
|
+
index,
|
|
103
|
+
});
|
|
104
|
+
}));
|
|
105
|
+
executions.push(...batch);
|
|
106
|
+
toolCalls += batch.length;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
for (const [index, call] of outcome.calls.entries()) {
|
|
110
|
+
throwIfAborted(signal);
|
|
111
|
+
const execution = await options.tools.execute(call, {
|
|
112
|
+
...currentContext,
|
|
113
|
+
index,
|
|
114
|
+
});
|
|
115
|
+
executions.push(execution);
|
|
116
|
+
toolCalls += 1;
|
|
117
|
+
}
|
|
104
118
|
}
|
|
105
119
|
state = await options.model.applyToolResults(state, executions, currentContext);
|
|
106
120
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peer-agent/runtime-sdk",
|
|
3
|
-
"version": "0.0.5
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Public host-neutral orchestration SDK for Peer Agent runtimes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"LICENSE"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@peer-agent/
|
|
38
|
-
"@peer-agent/
|
|
37
|
+
"@peer-agent/runtime-core": "^0.0.5",
|
|
38
|
+
"@peer-agent/protocol": "^0.0.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^5.9.3"
|