slash-tokens 1.5.7 → 1.6.0

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 ADDED
@@ -0,0 +1,237 @@
1
+ # Changelog
2
+
3
+ ## 1.6.0 (2026-08-24)
4
+
5
+ ### Fixed Deal — 10% on the report, not the Team invoice
6
+
7
+ Team/Pro is the live cart ($39/mo or $390/yr). 10% of measured savings is postponed UFN; it still appears on the weekly number as the comparison (what the meter would have been vs the plan). Trial keys still pay 10%. `report()` may return `counterfactual_fee_usd` from the worker. Site copy unchanged.
8
+
9
+ ## 1.5.7 (2026-08-24)
10
+
11
+ Punch-list cleanup from the full-codebase review after calibration shipped.
12
+
13
+ ## 1.5.6 (2026-08-23)
14
+
15
+ `preflightRoute()` respects `init({ route, models })`.
16
+
17
+ ## 1.5.5 (2026-08-23)
18
+
19
+ CLI scanner/report calibrate and price per-provider, not one flat rate.
20
+
21
+ ## 1.5.4 (2026-08-23)
22
+
23
+ Claude Sonnet 5 pricing corrected to $2/$10. Doc drift.
24
+
25
+ ## 1.5.3 (2026-08-23)
26
+
27
+ WASM no longer silently truncates input above ~1.06 MB.
28
+
29
+ ## 1.5.2 (2026-08-23)
30
+
31
+ Gemini and Grok factors re-verified against the 29-sample corpus.
32
+
33
+ ## 1.5.1 (2026-08-23)
34
+
35
+ Corpus 9→29 samples. Claude factor 1.85→2.05 (Spanish under-report).
36
+
37
+ ## 1.5.0 (2026-08-23)
38
+
39
+ Per-model calibration wired into every real call site. Gemini and Grok calibrated. Retired API IDs fixed.
40
+
41
+ ## 1.4.1 (2026-04-20)
42
+
43
+ ### Polish release — no code changes
44
+
45
+ **FAF 100% 🏆 · synced with a lean CLAUDE.md.** Documentation and brand consistency pass ahead of wider distribution. No SDK surface changes; all code identical to 1.4.0.
46
+
47
+ `project.faf` now scores a full 🏆 Trophy (12/12 slots). CLAUDE.md is intentionally lean — a one-line `<!-- faf: ... -->` meta-stamp and a bi-sync status line, nothing more. Every piece of context has exactly one home: structured facts in `project.faf`, narrative in `README.md`, the sync pointer in `CLAUDE.md`. Token-frugal by design — which is on-brand for a token optimization SDK.
48
+
49
+ ### Changed
50
+ - **License/Brand language rewritten.** Merged the prior separate `Brand` and `License` sections into one. Leads with "Code: MIT. Fork it, ship it, change it, show it, share it, sell it." — six verbs, because *show* and *share* are community drivers. Brand protection follows in plain language ("don't represent your app as Slash") instead of the prior "violators will get a takedown request" phrasing. Consistent across the ecosystem (slash-nextjs, RadioFAF).
51
+ - **v1.4 and v1.3 callouts now stacked** at the top of both READMEs — newest first, with the 🆕 badge on v1.4. The Opus 4.7 story (v1.3) keeps its visibility, not erased by the newer release.
52
+ - **"Know the cost before the call leaves your machine."** subtitle added to `npm/README.md` so both READMEs read identically below the headline.
53
+ - **WASM badge now shows 4.8 KB** (the raw WASM engine size, matching every other surface) instead of the 5.1 KiB minzipped package total. Both numbers are true; the brand claim ("4.8 KB WASM") is the one users recognize.
54
+ - **Signature sign-off added:** 🏎️ *Don't go to the Corner Shop in a Ferrari.* — the line we've been using everywhere else now appears on both READMEs.
55
+ - **shields.io badge URLs refreshed** to the newer (`?style=flat`) format so GitHub's camo image proxy re-fetches under fresh URLs (fixes the intermittent "rate limited by upstream service" render on the bundle-size badge).
56
+
57
+ ### Why
58
+ The npm package page bakes the README into the tarball at publish time. After v1.4.0 shipped, several improvements landed on GitHub but couldn't reach the npm landing page without a new publish. With the launch X post about to fire, the page visitors land on first needs to reflect the current brand and language.
59
+
60
+ ---
61
+
62
+ ## 1.4.0 (2026-04-19)
63
+
64
+ ### The Single-Source-of-Truth Edition
65
+
66
+ Extracted `PROVIDER_MODELS` to a shared module and added `preflightRoute()` — the exact routing decision the Slash proxy makes (same-provider only). Fixes a class of downstream bug where consumers used `preflight().options[0]` as a routing decision (cross-provider analysis) instead of the actual routing. Also caught a latent bug: `claude-opus-4.7` was in `MODELS` but missing from the Anthropic provider group, making it an orphan to the routing algorithm.
67
+
68
+ ### New
69
+ - **`preflightRoute(content, model)`** — returns the single cheapest same-provider `Alternative | null`. Matches mcpaas-cf proxy's `findCheapestRoute` semantics exactly. This is what downstream consumers should use to show "what Slash would route to," not `preflight().options[0]`.
70
+ - **`PROVIDER_MODELS`** and **`providerOf(model)`** — exported from the new `providers.ts` shared module. Single source of truth for same-provider grouping.
71
+
72
+ ### Changed
73
+ - **`intercept.ts` refactored** — no longer maintains its own `PROVIDER_MODELS` copy; imports from `providers.ts`. Removes drift risk between `preflight.ts` and `intercept.ts`.
74
+ - **`claude-opus-4.7` added to Anthropic provider group** — was already in `MODELS` but orphaned from `PROVIDER_MODELS`, caught by the new test suite.
75
+
76
+ ### Clarified (not changed)
77
+ - **`preflight().options` is cross-provider analysis** — returns cheapest models globally, sorted by price. Use it to *show alternatives*. Do not use it as a routing decision.
78
+ - **`preflightRoute()` is the routing decision** — same-provider only. Use it to show *"what would Slash route to right now."*
79
+
80
+ ### Testing
81
+ - 127 pass, 0 fail, 432 assertions (up from 118 / 386 in v1.3.0)
82
+ - 7 new TIER 1 BRAKE tests asserting the same-provider invariant, null return semantics, and `providerOf` hygiene
83
+ - See `TEST-NOTES.md` for the full test matrix and WJTTC tier plan
84
+
85
+ ### Docs
86
+ - `TEST-NOTES.md` — new living doc collecting invariants and WJTTC tier plan
87
+
88
+ ### Non-breaking
89
+ - `preflight()` behavior unchanged
90
+ - All existing exports retained
91
+ - Only additions + one internal refactor
92
+
93
+ ---
94
+
95
+ ## 1.3.0 (2026-04-16)
96
+
97
+ ### The Opus 4.7 Edition
98
+
99
+ Same-day support for Claude Opus 4.7 — the new flagship — with measured token calibration and proxy-ready benchmarking. Plus a Gemini URL-extraction fix.
100
+
101
+ ### New
102
+ - **Opus 4.7 support** — pricing + calibration layer. Measured 1.16–1.51x token increase vs prior Opus generations
103
+ - **Benchmark harness** — now supports custom proxy + auth headers, so you can benchmark Slash against direct upstream
104
+ - **Gemini URL model extraction** fix — proxy path correctly identifies model from `/v1beta/models/:model:generateContent`
105
+ - **Cross-repo integration** — Gemini proxy path covered by integration tests
106
+
107
+ ### Model Registry
108
+ - `claude-opus-4.7` with confirmed API ID `claude-opus-4-7`
109
+ - All 4 providers routable through Slash proxy (Anthropic, OpenAI, xAI, Google)
110
+
111
+ ### Testing
112
+ - 118 pass, 0 fail, 386 assertions
113
+
114
+ ### Docs
115
+ - Honest production analysis — $75.98 saved, $7.60 collected (real numbers, not projections)
116
+
117
+ ---
118
+
119
+ ## 1.2.1 (2026-04-15)
120
+
121
+ ### Fixes
122
+ - Add `pass` action type to `ReportOptions` — SDK types now match server (`prevented | routed | pass`)
123
+
124
+ ### Testing
125
+ - Cross-repo integration suite: 17 tests verifying SDK ↔ mcpaas-cf contract
126
+ - Self-registering test keys, no secrets needed
127
+ - TIER 5 proxy-path tests (Anthropic gateway, OpenAI, txn counting)
128
+ - 118 tests total, 374 assertions
129
+
130
+ ---
131
+
132
+ ## 1.2.0 (2026-04-14)
133
+
134
+ ### The Next.js Edition
135
+
136
+ Session summary on exit — every time you stop your dev server, Slash prints how much you saved that session:
137
+ ```
138
+ [slash] Session: 47 calls | 23 routed | $0.89 salvaged — The more you build, the more you save
139
+ ```
140
+ Fires on `exit`, `SIGINT` (Ctrl+C), and `SIGTERM`. Zero calls = silent.
141
+
142
+ ### New
143
+ - `auto` mode: session summary on process exit
144
+ - Dashboard: 90-day transaction history (History panel, show all)
145
+ - Dashboard: live feed now scrollable, shows `$saved` instead of raw token counts
146
+
147
+ ### Testing
148
+ - 99 pass, 0 fail, 326 assertions
149
+
150
+ ---
151
+
152
+ ## 1.1.2 (2026-04-13)
153
+
154
+ ### Fixes
155
+ - Fix Haiku model ID — `claude-haiku-4-5-20251001` (was wrong, routing would fail)
156
+ - Action types aligned to Gate vocabulary — `prevented | routed` (was `skipped | reduced | routed`)
157
+
158
+ ### Testing
159
+ - 99 pass, 0 fail, 326 assertions
160
+
161
+ ## 1.1.1 (2026-04-08)
162
+
163
+ Token Optimization for Context Engineers.
164
+
165
+ ### Auto Mode — Routes to Cheapest Model
166
+ - `import 'slash-tokens/auto'` — one import, every call optimized
167
+ - Routes within same provider: Opus → Haiku, GPT-5.4 → Nano, Grok → Fast
168
+ - Rewrites request body before fetch — the API gets the cheaper model
169
+ - Verbose by default — new users see every call, every route, every save
170
+ - Nudges at $5/$10/$25/$50/$100 thresholds: `⚡ $5 salvaged — keep building`
171
+
172
+ ### Configuration
173
+ - `init({ route: true })` — route to cheapest model (default)
174
+ - `init({ route: false })` — track only, don't touch my models
175
+ - `init({ models: ['claude-haiku', 'claude-sonnet'] })` — model-level control
176
+ - `init({ quiet: true })` — nudges only, no per-call logging
177
+
178
+ ### CLI
179
+ - Evaluator doesn't charge — `bunx slash-tokens` is free
180
+ - "Token optimization analysis" (not "burn analysis")
181
+ - "TOKENS SALVAGED" (not "savings")
182
+ - "DAILY TOKEN VOLUME" (not "daily burn")
183
+ - Single "Next" link to setup page
184
+
185
+ ### API
186
+ - `salvaged` / `salvagePercent` (replaces `savings` / `savingsPercent`)
187
+ - npm description: "Token Optimization for Context Engineers"
188
+
189
+ ### Testing
190
+ - 99 pass, 0 fail, 326 assertions
191
+
192
+ ## 1.1.0 (2026-04-07)
193
+
194
+ Token Optimization for Context Engineering.
195
+
196
+ ### Features
197
+ - `preflight(content, model)` — tokens, cost, fits, cheaper alternatives
198
+ - `import 'slash-tokens/auto'` — one import, every LLM call pre-flighted
199
+ - 10 models with verified April 2026 pricing (Claude, Grok, Gemini, GPT)
200
+ - `report()` — metered savings reporting, 10% of what you save
201
+ - `init()` — key configuration with 3-layer resolution
202
+ - `MODELS` — full pricing table exported for direct access
203
+ - `listModels()` — enumerate all supported models
204
+
205
+ ### Models (April 2026)
206
+ - Anthropic: claude-opus ($5/M), claude-sonnet ($3/M), claude-haiku ($1/M)
207
+ - xAI: grok-4.20 ($2/M), grok-4-1-fast ($0.20/M)
208
+ - Google: gemini-3.1-pro ($2/M), gemini-2.5-flash ($0.30/M)
209
+ - OpenAI: gpt-5.4 ($2.50/M), gpt-5.4-mini ($0.75/M), gpt-5.4-nano ($0.20/M)
210
+
211
+ ### Auto mode
212
+ - Intercepts fetch() to Anthropic, OpenAI, xAI, Google endpoints
213
+ - Model name normalization (handles full API IDs + legacy names)
214
+ - Non-blocking, sub-millisecond
215
+
216
+ ### Testing
217
+ - 323 tests: 172 Zig, 101 TypeScript, 50 API
218
+
219
+ ## 1.0.0 (2026-04-07)
220
+
221
+ Initial v1 release. Superseded by 1.1.0 (pricing corrections).
222
+
223
+ ## 0.3.0 (2026-04-06)
224
+
225
+ Deprecated. Added preflight + auto mode with outdated pricing.
226
+
227
+ ## 0.2.0 (2026-04-06)
228
+
229
+ Deprecated. Added report() + init() SDK integration.
230
+
231
+ ## 0.1.0 (2026-04-04)
232
+
233
+ Deprecated. Token estimation + CLI scanner.
234
+
235
+ ## 0.0.1 (2026-04-02)
236
+
237
+ Initial placeholder.
@@ -11,5 +11,7 @@ export interface ReportResult {
11
11
  fee_usd: number;
12
12
  balance_remaining_usd: number;
13
13
  timestamp: string;
14
+ /** 10% of this call's savings — comparison only. Charged fee is fee_usd (0 on Team). */
15
+ counterfactual_fee_usd?: number;
14
16
  }
15
17
  export declare function report(opts: ReportOptions): Promise<ReportResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slash-tokens",
3
- "version": "1.5.7",
3
+ "version": "1.6.0",
4
4
  "description": "Token Optimization for Context Engineers. 4.8 KB WASM. Sub-millisecond. Zero dependencies.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -20,7 +20,8 @@
20
20
  }
21
21
  },
22
22
  "files": [
23
- "dist"
23
+ "dist",
24
+ "CHANGELOG.md"
24
25
  ],
25
26
  "sideEffects": false,
26
27
  "scripts": {