190proof 1.0.102 → 1.0.104
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.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -123,6 +123,11 @@ interface GenericMessage {
|
|
|
123
123
|
* `redacted_thinking` blocks captured in
|
|
124
124
|
* `ParsedResponseMessage.reasoningDetails`). Preserves the signatures /
|
|
125
125
|
* encrypted payloads that providers validate on round-trip.
|
|
126
|
+
*
|
|
127
|
+
* Safe to echo regardless of which provider serves the next call: each
|
|
128
|
+
* serializer keeps only its own provider's block shapes (Anthropic keeps
|
|
129
|
+
* `thinking`/`redacted_thinking`; OpenAI-compat keeps `reasoning.*`), so a
|
|
130
|
+
* cross-provider fallback drops foreign blocks instead of 400ing.
|
|
126
131
|
*/
|
|
127
132
|
reasoningDetails?: any;
|
|
128
133
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -123,6 +123,11 @@ interface GenericMessage {
|
|
|
123
123
|
* `redacted_thinking` blocks captured in
|
|
124
124
|
* `ParsedResponseMessage.reasoningDetails`). Preserves the signatures /
|
|
125
125
|
* encrypted payloads that providers validate on round-trip.
|
|
126
|
+
*
|
|
127
|
+
* Safe to echo regardless of which provider serves the next call: each
|
|
128
|
+
* serializer keeps only its own provider's block shapes (Anthropic keeps
|
|
129
|
+
* `thinking`/`redacted_thinking`; OpenAI-compat keeps `reasoning.*`), so a
|
|
130
|
+
* cross-provider fallback drops foreign blocks instead of 400ing.
|
|
126
131
|
*/
|
|
127
132
|
reasoningDetails?: any;
|
|
128
133
|
}
|
package/dist/index.js
CHANGED
|
@@ -320,6 +320,14 @@ function buildOpenAIRequestConfig(identifier, model, config) {
|
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
+
function filterOpenAICompatReasoningDetails(details) {
|
|
324
|
+
if (!Array.isArray(details))
|
|
325
|
+
return details || void 0;
|
|
326
|
+
const blocks = details.filter(
|
|
327
|
+
(block) => typeof (block == null ? void 0 : block.type) === "string" && block.type.startsWith("reasoning.")
|
|
328
|
+
);
|
|
329
|
+
return blocks.length ? blocks : void 0;
|
|
330
|
+
}
|
|
323
331
|
async function prepareOpenAIPayload(identifier, payload) {
|
|
324
332
|
var _a, _b;
|
|
325
333
|
const preparedPayload = {
|
|
@@ -387,8 +395,11 @@ async function prepareOpenAIPayload(identifier, payload) {
|
|
|
387
395
|
}
|
|
388
396
|
if (message.reasoning)
|
|
389
397
|
outMessage.reasoning = message.reasoning;
|
|
390
|
-
|
|
391
|
-
|
|
398
|
+
const reasoningDetails = filterOpenAICompatReasoningDetails(
|
|
399
|
+
message.reasoningDetails
|
|
400
|
+
);
|
|
401
|
+
if (reasoningDetails)
|
|
402
|
+
outMessage.reasoning_details = reasoningDetails;
|
|
392
403
|
preparedPayload.messages.push(outMessage);
|
|
393
404
|
}
|
|
394
405
|
return preparedPayload;
|
|
@@ -728,7 +739,9 @@ async function prepareAnthropicPayload(_identifier, payload) {
|
|
|
728
739
|
});
|
|
729
740
|
}
|
|
730
741
|
}
|
|
731
|
-
const leadingBlocks = message.role === "assistant" && Array.isArray(message.reasoningDetails) ? message.reasoningDetails
|
|
742
|
+
const leadingBlocks = message.role === "assistant" && Array.isArray(message.reasoningDetails) ? message.reasoningDetails.filter(
|
|
743
|
+
(block) => (block == null ? void 0 : block.type) === "thinking" || (block == null ? void 0 : block.type) === "redacted_thinking"
|
|
744
|
+
) : [];
|
|
732
745
|
const toolUseBlocks = (message.functionCalls || []).map((fc, i) => {
|
|
733
746
|
var _a;
|
|
734
747
|
return {
|
|
@@ -1227,8 +1240,11 @@ function prepareOpenAICompatMessages(messages) {
|
|
|
1227
1240
|
}
|
|
1228
1241
|
if (message.reasoning)
|
|
1229
1242
|
outMessage.reasoning = message.reasoning;
|
|
1230
|
-
|
|
1231
|
-
|
|
1243
|
+
const reasoningDetails = filterOpenAICompatReasoningDetails(
|
|
1244
|
+
message.reasoningDetails
|
|
1245
|
+
);
|
|
1246
|
+
if (reasoningDetails)
|
|
1247
|
+
outMessage.reasoning_details = reasoningDetails;
|
|
1232
1248
|
out.push(outMessage);
|
|
1233
1249
|
}
|
|
1234
1250
|
return out;
|