@kylindc/ccxray 1.2.1 → 1.2.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/forward.js +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kylindc/ccxray",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "X-ray vision for AI agent sessions — a transparent HTTP proxy and dashboard for Claude Code",
5
5
  "main": "server/index.js",
6
6
  "bin": {
package/server/forward.js CHANGED
@@ -36,7 +36,16 @@ function forwardBedrockRequest(ctx) {
36
36
  const { id, ts, startTime, parsedBody, rawBody, clientReq, clientRes, reqSessionId } = ctx;
37
37
 
38
38
  const statsStripped = stripInjectedStats(parsedBody);
39
- const bodyToSend = (ctx.bodyModified || statsStripped) ? Buffer.from(JSON.stringify(parsedBody)) : rawBody;
39
+
40
+ // Translate the Anthropic API body to Bedrock native format:
41
+ // - add anthropic_version (Bedrock requires it in the body; Claude Code sends it as a header)
42
+ // - strip `model` (encoded in the URL) and `stream` (indicated by the endpoint path)
43
+ const baseBody = parsedBody || JSON.parse(rawBody.toString());
44
+ const { model: _model, stream: _stream, ...bedrockFields } = baseBody;
45
+ const bodyToSend = Buffer.from(JSON.stringify({
46
+ anthropic_version: 'bedrock-2023-05-31',
47
+ ...bedrockFields,
48
+ }));
40
49
 
41
50
  // Resolve Bedrock model ID
42
51
  let bedrockModelId;