@zhafron/opencode-kiro-auth 1.4.3 → 1.4.4
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/plugin/request.js +20 -4
- package/package.json +1 -1
package/dist/plugin/request.js
CHANGED
|
@@ -16,16 +16,27 @@ function sanitizeHistory(history) {
|
|
|
16
16
|
continue;
|
|
17
17
|
if (m.assistantResponseMessage?.toolUses) {
|
|
18
18
|
const next = history[i + 1];
|
|
19
|
-
if (next?.userInputMessage?.userInputMessageContext?.toolResults)
|
|
19
|
+
if (next?.userInputMessage?.userInputMessageContext?.toolResults) {
|
|
20
20
|
result.push(m);
|
|
21
|
+
}
|
|
21
22
|
}
|
|
22
23
|
else if (m.userInputMessage?.userInputMessageContext?.toolResults) {
|
|
23
24
|
const prev = result[result.length - 1];
|
|
24
|
-
if (prev?.assistantResponseMessage?.toolUses)
|
|
25
|
+
if (prev?.assistantResponseMessage?.toolUses) {
|
|
25
26
|
result.push(m);
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
|
-
else
|
|
29
|
+
else {
|
|
28
30
|
result.push(m);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (result.length > 0) {
|
|
34
|
+
const first = result[0];
|
|
35
|
+
if (!first ||
|
|
36
|
+
!first.userInputMessage ||
|
|
37
|
+
first.userInputMessage.userInputMessageContext?.toolResults) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
41
|
return result;
|
|
31
42
|
}
|
|
@@ -192,6 +203,9 @@ export function transformToCodeWhisperer(url, body, model, auth, think = false,
|
|
|
192
203
|
: `<thinking>${th}</thinking>`;
|
|
193
204
|
if (tus.length)
|
|
194
205
|
arm.toolUses = tus;
|
|
206
|
+
if (!arm.content && !arm.toolUses) {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
195
209
|
history.push({ assistantResponseMessage: arm });
|
|
196
210
|
}
|
|
197
211
|
}
|
|
@@ -249,7 +263,9 @@ export function transformToCodeWhisperer(url, body, model, auth, think = false,
|
|
|
249
263
|
arm.content = arm.content
|
|
250
264
|
? `<thinking>${th}</thinking>\n\n${arm.content}`
|
|
251
265
|
: `<thinking>${th}</thinking>`;
|
|
252
|
-
|
|
266
|
+
if (arm.content || arm.toolUses) {
|
|
267
|
+
history.push({ assistantResponseMessage: arm });
|
|
268
|
+
}
|
|
253
269
|
curContent = 'Continue';
|
|
254
270
|
}
|
|
255
271
|
else {
|