@sliday/tamp 0.3.9 → 0.3.10

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/index.js +9 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -7,6 +7,13 @@ import { compressRequest } from './compress.js'
7
7
  import { detectProvider } from './providers.js'
8
8
  import { createSession, formatRequestLog } from './stats.js'
9
9
 
10
+ function buildUpstreamUrl(reqPath, base) {
11
+ const parsed = new URL(base)
12
+ const basePath = parsed.pathname.replace(/\/+$/, '')
13
+ parsed.pathname = basePath + reqPath
14
+ return parsed
15
+ }
16
+
10
17
  export function createProxy(overrides = {}) {
11
18
  const base = loadConfig()
12
19
  const config = { ...base, ...overrides }
@@ -116,13 +123,13 @@ return http.createServer(async (req, res) => {
116
123
 
117
124
  if (!provider) {
118
125
  if (config.log) console.error(`[tamp] ${req.method} ${req.url}`)
119
- const upstreamUrl = new URL(req.url, config.upstream)
126
+ const upstreamUrl = buildUpstreamUrl(req.url, config.upstream)
120
127
  return pipeRequest(req, res, upstreamUrl)
121
128
  }
122
129
 
123
130
  const upstream = config.upstreams?.[provider.name] || config.upstream
124
131
  const reqUrl = provider.normalizeUrl ? provider.normalizeUrl(req.url) : req.url
125
- const upstreamUrl = new URL(reqUrl, upstream)
132
+ const upstreamUrl = buildUpstreamUrl(reqUrl, upstream)
126
133
 
127
134
  const chunks = []
128
135
  let size = 0
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "providers.js",
10
10
  "stats.js"
11
11
  ],
12
- "version": "0.3.9",
12
+ "version": "0.3.10",
13
13
  "description": "Token compression proxy for coding agents. Works with Claude Code, Aider, Cursor, Cline, Windsurf. 52.6% fewer input tokens.",
14
14
  "type": "module",
15
15
  "main": "index.js",