@mmmbuto/anthmorph 0.1.2 → 0.1.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/CHANGELOG.md +34 -0
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +48 -123
- package/bin/anthmorph +0 -0
- package/docs/CLAUDE_CODE_SETUP.md +78 -0
- package/docs/PACKAGING.md +59 -0
- package/docs/RELEASE.md +82 -0
- package/package.json +16 -4
- package/prebuilt/anthmorph +0 -0
- package/scripts/anthmorphctl +150 -8
- package/scripts/docker_build_linux.sh +11 -0
- package/scripts/docker_npm_dry_run.sh +25 -0
- package/scripts/docker_release_checks.sh +18 -0
- package/scripts/docker_rust_test.sh +35 -0
- package/scripts/docker_secret_scan.sh +11 -0
- package/scripts/postinstall.js +10 -1
- package/scripts/test_claude_code_patterns_real.sh +150 -0
- package/src/config.rs +33 -0
- package/src/main.rs +24 -5
- package/src/models/anthropic.rs +46 -1
- package/src/proxy.rs +432 -47
- package/src/transform.rs +364 -42
- package/scripts/smoke_test.sh +0 -72
- package/tests/real_backends.rs +0 -213
package/src/models/anthropic.rs
CHANGED
|
@@ -23,11 +23,29 @@ pub struct AnthropicRequest {
|
|
|
23
23
|
#[serde(default)]
|
|
24
24
|
pub tools: Option<Vec<Tool>>,
|
|
25
25
|
#[serde(default)]
|
|
26
|
+
pub thinking: Option<ThinkingConfig>,
|
|
27
|
+
#[serde(default)]
|
|
28
|
+
pub output_config: Option<OutputConfig>,
|
|
29
|
+
#[serde(default)]
|
|
26
30
|
pub stop_sequences: Option<Vec<String>>,
|
|
27
31
|
#[serde(flatten)]
|
|
28
32
|
pub extra: serde_json::Map<String, serde_json::Value>,
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
#[derive(Debug, Clone, Deserialize)]
|
|
36
|
+
pub struct ThinkingConfig {
|
|
37
|
+
#[serde(rename = "type")]
|
|
38
|
+
pub thinking_type: String,
|
|
39
|
+
#[serde(default, alias = "budgetTokens")]
|
|
40
|
+
pub budget_tokens: Option<usize>,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[derive(Debug, Clone, Deserialize)]
|
|
44
|
+
pub struct OutputConfig {
|
|
45
|
+
#[serde(default)]
|
|
46
|
+
pub effort: Option<String>,
|
|
47
|
+
}
|
|
48
|
+
|
|
31
49
|
#[derive(Debug, Clone)]
|
|
32
50
|
pub enum SystemPrompt {
|
|
33
51
|
Single(String),
|
|
@@ -115,6 +133,8 @@ pub enum ContentBlock {
|
|
|
115
133
|
Text { text: String },
|
|
116
134
|
#[serde(rename = "image")]
|
|
117
135
|
Image { source: ImageSource },
|
|
136
|
+
#[serde(rename = "document")]
|
|
137
|
+
Document { source: serde_json::Value },
|
|
118
138
|
#[serde(rename = "tool_use")]
|
|
119
139
|
ToolUse {
|
|
120
140
|
id: String,
|
|
@@ -130,6 +150,20 @@ pub enum ContentBlock {
|
|
|
130
150
|
},
|
|
131
151
|
#[serde(rename = "thinking")]
|
|
132
152
|
Thinking { thinking: String },
|
|
153
|
+
#[serde(rename = "server_tool_use")]
|
|
154
|
+
ServerToolUse {
|
|
155
|
+
#[serde(default)]
|
|
156
|
+
name: Option<String>,
|
|
157
|
+
#[serde(default)]
|
|
158
|
+
input: Option<serde_json::Value>,
|
|
159
|
+
},
|
|
160
|
+
#[serde(rename = "search_result")]
|
|
161
|
+
SearchResult {
|
|
162
|
+
#[serde(default)]
|
|
163
|
+
query: Option<String>,
|
|
164
|
+
#[serde(default)]
|
|
165
|
+
content: Vec<serde_json::Value>,
|
|
166
|
+
},
|
|
133
167
|
#[serde(other)]
|
|
134
168
|
Other,
|
|
135
169
|
}
|
|
@@ -236,12 +270,17 @@ pub struct MessageStartData {
|
|
|
236
270
|
#[serde(rename = "type")]
|
|
237
271
|
pub message_type: String,
|
|
238
272
|
pub role: String,
|
|
273
|
+
pub content: Vec<serde_json::Value>,
|
|
239
274
|
pub model: String,
|
|
275
|
+
#[serde(rename = "stop_reason")]
|
|
276
|
+
pub stop_reason: Option<serde_json::Value>,
|
|
277
|
+
#[serde(rename = "stop_sequence")]
|
|
278
|
+
pub stop_sequence: Option<serde_json::Value>,
|
|
240
279
|
pub usage: Usage,
|
|
241
280
|
}
|
|
242
281
|
|
|
243
282
|
#[derive(Debug, Clone, Serialize)]
|
|
244
|
-
#[serde(tag = "type"
|
|
283
|
+
#[serde(tag = "type")]
|
|
245
284
|
pub enum ContentBlockStartData {
|
|
246
285
|
#[serde(rename = "text")]
|
|
247
286
|
Text { text: String },
|
|
@@ -276,3 +315,9 @@ pub struct MessageDeltaUsage {
|
|
|
276
315
|
#[serde(rename = "output_tokens")]
|
|
277
316
|
pub output_tokens: usize,
|
|
278
317
|
}
|
|
318
|
+
|
|
319
|
+
#[derive(Debug, Clone, Serialize)]
|
|
320
|
+
pub struct CountTokensResponse {
|
|
321
|
+
#[serde(rename = "input_tokens")]
|
|
322
|
+
pub input_tokens: usize,
|
|
323
|
+
}
|