@sliday/tamp 0.3.8 → 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 (3) hide show
  1. package/README.md +18 -2
  2. package/index.js +9 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tamp
2
2
 
3
- **Token compression proxy for coding agents.** 52.6% fewer input tokens, zero code changes. Works with Claude Code, Aider, Cursor, Cline, Windsurf, and any OpenAI-compatible agent.
3
+ **Token compression proxy for coding agents.** 52.6% fewer input tokens, zero code changes. Works with Claude Code, Aider, Cursor, Cline, Windsurf, 🦞 [OpenClaw](https://openclaw.app), and any OpenAI-compatible agent.
4
4
 
5
5
  ```
6
6
  npx @sliday/tamp
@@ -9,9 +9,25 @@ npx @sliday/tamp
9
9
  Or install globally:
10
10
 
11
11
  ```bash
12
- curl -fsSL https://tamp.dev/setup.sh | bash
12
+ npm i -g @sliday/tamp@0.3.9
13
+ ```
14
+
15
+ ### 🦞 OpenClaw Quick Setup
16
+
17
+ ```bash
18
+ # 1. Start Tamp
19
+ TAMP_STAGES=minify,toon,strip-lines,whitespace,dedup,diff,prune tamp -y
20
+
21
+ # 2. Add provider to OpenClaw config
22
+ # baseUrl: "http://localhost:7778"
23
+ # apiKey: "${ANTHROPIC_API_KEY}"
24
+ # api: "anthropic-messages"
25
+
26
+ # 3. Set as primary model → done
13
27
  ```
14
28
 
29
+ 70MB RAM. <5ms latency. No Python needed. Full guide: [docs/openclaw-setup.md](docs/openclaw-setup.md)
30
+
15
31
  ## How It Works
16
32
 
17
33
  Tamp auto-detects your agent's API format and compresses tool result blocks before forwarding upstream. Source code, error results, and non-JSON content pass through untouched.
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.8",
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",