@intx/inference 0.2.2 → 0.3.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/adapter.d.ts +4 -2
- package/dist/adapter.js +2 -2
- package/dist/assembly.d.ts +8 -1
- package/dist/assembly.js +2 -1
- package/dist/authz-extension.d.ts +15 -1
- package/dist/authz-extension.js +93 -9
- package/dist/correlation.d.ts +1 -0
- package/dist/correlation.js +8 -1
- package/dist/default-director.d.ts +1 -1
- package/dist/default-director.js +37 -8
- package/dist/gates.d.ts +1 -0
- package/dist/gates.js +24 -1
- package/dist/harness.js +109 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/providers/anthropic.d.ts +5 -1
- package/dist/providers/anthropic.js +264 -17
- package/dist/providers/google-genai.d.ts +3 -1
- package/dist/providers/google-genai.js +224 -215
- package/dist/providers/index.d.ts +3 -3
- package/dist/providers/index.js +3 -3
- package/dist/providers/openai.d.ts +7 -1
- package/dist/providers/openai.js +353 -59
- package/dist/reactor.js +416 -103
- package/dist/transform.d.ts +1 -1
- package/dist/transform.js +19 -4
- package/package.json +5 -4
package/dist/transform.d.ts
CHANGED
package/dist/transform.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
// calls receive synthetic error results, and tool call IDs are normalized to
|
|
6
6
|
// a portable format.
|
|
7
7
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// not per-conversation.
|
|
8
|
+
// Callers invoke transformMessages when switching models. Adapter
|
|
9
|
+
// buildRequest paths also apply provider-specific history fixes. The
|
|
10
|
+
// originating model is tracked per-message, not per-conversation.
|
|
11
|
+
import { formatSafetyRatingText, } from "@intx/types/runtime";
|
|
11
12
|
export function transformMessages(messages, options) {
|
|
12
13
|
const { targetModel, keepThinkingForSameModel = true } = options;
|
|
13
14
|
// First pass: strip thinking blocks and filter aborted assistant messages.
|
|
@@ -16,11 +17,25 @@ export function transformMessages(messages, options) {
|
|
|
16
17
|
if (msg.role === "assistant") {
|
|
17
18
|
const isSameModel = msg.model === targetModel;
|
|
18
19
|
const keepThinking = keepThinkingForSameModel && isSameModel;
|
|
19
|
-
const filteredContent = msg.content
|
|
20
|
+
const filteredContent = msg.content
|
|
21
|
+
.filter((block) => {
|
|
20
22
|
if (block.type === "thinking") {
|
|
21
23
|
return keepThinking;
|
|
22
24
|
}
|
|
23
25
|
return true;
|
|
26
|
+
})
|
|
27
|
+
// safety_rating is output-only metadata. Convert it to text
|
|
28
|
+
// so cross-provider history keeps role alternation and a
|
|
29
|
+
// human-readable block reason without requiring every
|
|
30
|
+
// adapter to special-case the block.
|
|
31
|
+
.map((block) => {
|
|
32
|
+
if (block.type === "safety_rating") {
|
|
33
|
+
return {
|
|
34
|
+
type: "text",
|
|
35
|
+
text: formatSafetyRatingText(block),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return block;
|
|
24
39
|
});
|
|
25
40
|
// Filter out assistant messages that have no text or tool calls
|
|
26
41
|
// (aborted/error messages with only thinking blocks removed).
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intx/inference",
|
|
3
|
-
"
|
|
3
|
+
"description": "Provider-agnostic inference runtime with Anthropic, OpenAI, and Google GenAI adapters",
|
|
4
|
+
"version": "0.3.0",
|
|
4
5
|
"license": "LGPL-2.1-only",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"exports": {
|
|
@@ -16,12 +17,12 @@
|
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@intx/log": "0.
|
|
20
|
-
"@intx/types": "0.
|
|
20
|
+
"@intx/log": "0.3.0",
|
|
21
|
+
"@intx/types": "0.3.0",
|
|
21
22
|
"arktype": "^2.1.29"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@intx/mime": "0.
|
|
25
|
+
"@intx/mime": "0.3.0"
|
|
25
26
|
},
|
|
26
27
|
"files": [
|
|
27
28
|
"dist",
|