@opencode/ai 0.0.0-dev-20362 → 0.0.0-dev-20364
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/tool-history.js +16 -3
- package/package.json +3 -3
package/dist/tool-history.js
CHANGED
|
@@ -4,11 +4,19 @@ const MISSING_TOOL_RESULT = "Tool result missing";
|
|
|
4
4
|
export function normalizeToolHistory(messages) {
|
|
5
5
|
const normalized = [];
|
|
6
6
|
const pending = new Map();
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// System updates cannot sit between a tool call and its results, so they wait until every pending call is answered.
|
|
8
|
+
const held = [];
|
|
9
|
+
const releaseHeld = () => {
|
|
10
|
+
if (pending.size > 0)
|
|
9
11
|
return;
|
|
10
|
-
normalized.push(
|
|
12
|
+
normalized.push(...held);
|
|
13
|
+
held.length = 0;
|
|
14
|
+
};
|
|
15
|
+
const appendMissingResults = () => {
|
|
16
|
+
if (pending.size > 0)
|
|
17
|
+
normalized.push(missingToolResults(pending.values()));
|
|
11
18
|
pending.clear();
|
|
19
|
+
releaseHeld();
|
|
12
20
|
};
|
|
13
21
|
for (const message of messages) {
|
|
14
22
|
if (message.role === "user" || message.role === "assistant")
|
|
@@ -17,6 +25,11 @@ export function normalizeToolHistory(messages) {
|
|
|
17
25
|
const tool = normalizeToolMessage(message, pending);
|
|
18
26
|
if (tool)
|
|
19
27
|
normalized.push(tool);
|
|
28
|
+
releaseHeld();
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (message.role === "system" && pending.size > 0) {
|
|
32
|
+
held.push(message);
|
|
20
33
|
continue;
|
|
21
34
|
}
|
|
22
35
|
normalized.push(message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20364",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20364",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20364",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.112",
|
|
50
50
|
"google-auth-library": "10.5.0"
|