@anthonyhaussman/opencode-agy-auth 1.1.22-alpha.0 → 1.1.23-alpha.0
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/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/src/sdk/request/prepare.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18442,6 +18442,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
|
|
|
18442
18442
|
contents2 = closeToolLoopForThinking(contents2);
|
|
18443
18443
|
}
|
|
18444
18444
|
contents2 = normalizeContentsSequence(contents2);
|
|
18445
|
+
contents2 = ensureTrailingUserTurn(contents2);
|
|
18445
18446
|
const latestSig = getLatestSignature(sessionId2);
|
|
18446
18447
|
applyLatestSignature(contents2, latestSig);
|
|
18447
18448
|
requestPayloadInside.contents = contents2;
|
|
@@ -18482,6 +18483,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
|
|
|
18482
18483
|
contents = closeToolLoopForThinking(contents);
|
|
18483
18484
|
}
|
|
18484
18485
|
contents = normalizeContentsSequence(contents);
|
|
18486
|
+
contents = ensureTrailingUserTurn(contents);
|
|
18485
18487
|
const latestSig = getLatestSignature(sessionId);
|
|
18486
18488
|
applyLatestSignature(contents, latestSig);
|
|
18487
18489
|
requestPayload.contents = contents;
|
|
@@ -18700,6 +18702,16 @@ function normalizeCachedContent(requestPayload) {
|
|
|
18700
18702
|
delete requestPayload.extra_body;
|
|
18701
18703
|
}
|
|
18702
18704
|
}
|
|
18705
|
+
function ensureTrailingUserTurn(contents) {
|
|
18706
|
+
if (!Array.isArray(contents) || contents.length === 0) {
|
|
18707
|
+
return contents;
|
|
18708
|
+
}
|
|
18709
|
+
const last = contents[contents.length - 1];
|
|
18710
|
+
if (last && (last.role === "model" || last.role === "assistant")) {
|
|
18711
|
+
return [...contents, { role: "user", parts: [{ text: "[Continue]" }] }];
|
|
18712
|
+
}
|
|
18713
|
+
return contents;
|
|
18714
|
+
}
|
|
18703
18715
|
function normalizeContentsSequence(contents) {
|
|
18704
18716
|
const merged = [];
|
|
18705
18717
|
for (const msg of contents) {
|