@sliday/tamp 0.2.8 → 0.2.9
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/index.js +1 -1
- package/package.json +1 -1
- package/stats.js +5 -3
package/index.js
CHANGED
|
@@ -105,10 +105,10 @@ function pipeRequest(req, res, upstreamUrl, prefixChunks) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
return http.createServer(async (req, res) => {
|
|
108
|
-
if (config.log) console.error(`[tamp] ${req.method} ${req.url}`)
|
|
109
108
|
const provider = detectProvider(req.method, req.url)
|
|
110
109
|
|
|
111
110
|
if (!provider) {
|
|
111
|
+
if (config.log) console.error(`[tamp] ${req.method} ${req.url}`)
|
|
112
112
|
const upstreamUrl = new URL(req.url, config.upstream)
|
|
113
113
|
return pipeRequest(req, res, upstreamUrl)
|
|
114
114
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"providers.js",
|
|
10
10
|
"stats.js"
|
|
11
11
|
],
|
|
12
|
-
"version": "0.2.
|
|
12
|
+
"version": "0.2.9",
|
|
13
13
|
"description": "Token compression proxy for coding agents. Works with Claude Code, Aider, Cursor, Cline, Windsurf. 33.9% fewer input tokens.",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"main": "index.js",
|
package/stats.js
CHANGED
|
@@ -16,13 +16,14 @@ export function formatRequestLog(stats, session, providerName, url, bodySize, to
|
|
|
16
16
|
const sizeInfo = bodySize ? ` ${c.dim}${fmtSize(bodySize)}${c.reset}` : ''
|
|
17
17
|
|
|
18
18
|
if (!compressed.length && !stats.length) {
|
|
19
|
-
return `[tamp] ${c.cyan}${label}${c.reset} ${path}${sizeInfo} ${c.dim}—
|
|
19
|
+
return `[tamp] ${c.cyan}${label}${c.reset} ${path}${sizeInfo} ${c.dim}— passthrough${c.reset}`
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
if (!compressed.length) {
|
|
23
23
|
const skipCount = stats.filter(s => s.skipped).length
|
|
24
|
+
const n = stats.length
|
|
24
25
|
const reason = skipCount ? `${skipCount} skipped` : 'nothing to compress'
|
|
25
|
-
return `[tamp] ${c.cyan}${label}${c.reset} ${path}${sizeInfo} ${c.dim}— ${
|
|
26
|
+
return `[tamp] ${c.cyan}${label}${c.reset} ${path}${sizeInfo} ${c.dim}— ${n} block${n !== 1 ? 's' : ''}, ${reason}${c.reset}`
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
const totalOrig = compressed.reduce((a, s) => a + s.originalLen, 0)
|
|
@@ -34,7 +35,8 @@ export function formatRequestLog(stats, session, providerName, url, bodySize, to
|
|
|
34
35
|
const tokSaved = totalOrigTok - totalCompTok
|
|
35
36
|
|
|
36
37
|
const lines = []
|
|
37
|
-
|
|
38
|
+
const n = compressed.length
|
|
39
|
+
lines.push(`[tamp] ${c.cyan}${label}${c.reset} ${path}${sizeInfo} ${c.green}— ${n} block${n !== 1 ? 's' : ''} compressed, -${pct}%${c.reset}`)
|
|
38
40
|
|
|
39
41
|
for (const s of compressed) {
|
|
40
42
|
const sPct = (((s.originalLen - s.compressedLen) / s.originalLen) * 100).toFixed(1)
|