tanuki-context 0.2.1 → 0.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.
package/README.md CHANGED
@@ -22,21 +22,25 @@ cleaned up and drawn. A vision model reads it directly:
22
22
 
23
23
  ![a rendered page: dense 5x8-pixel text, 312 columns of system log](https://raw.githubusercontent.com/Osyna/tanuki-context/main/docs/example-page.png)
24
24
 
25
- *Four pages like this replace 51,200 tokens of raw text with 5,320
26
- a 90% cut. Zoom in: it's all still there, errors verbatim.*
25
+ *Four pages like this replace 51,200 tokens of raw text with 5,264
26
+ a 90% cut. Zoom in: it's all still there, errors verbatim. (Hostnames,
27
+ IPs, MACs, and network names were rewritten to placeholders before
28
+ rendering; the structure and repetition are untouched.)*
27
29
 
28
30
  ## What you save
29
31
 
30
- Measured on that same 200 KB slice of a real system journal (1,370 lines
31
- from tailscaled, NetworkManager, the kernel, and friends — mixed on purpose;
32
- a plain `journalctl` tail is so repetitive the result looks fake):
32
+ Measured on that same 200 KB slice of a real system journal (1,434 lines
33
+ from tailscaled, NetworkManager, the kernel, and friends — mixed on
34
+ purpose; a plain `journalctl` tail is so repetitive the result looks fake.
35
+ Identifiers were rewritten before measuring; the repetition shape and
36
+ every error line are untouched):
33
37
 
34
38
  | how the log enters the conversation | tokens | saved |
35
39
  | ----------------------------------- | -----: | --------: |
36
40
  | pasted as raw text | 51,200 | 0 |
37
41
  | drawn as image pages | 10,752 | **-79%** |
38
- | noise removed first, then drawn | 5,320 | **-90%** |
39
- | plus codebook and tiny font | 2,352 | **-95%** |
42
+ | noise removed first, then drawn | 5,264 | **-90%** |
43
+ | plus codebook and tiny font | 2,576 | **-95%** |
40
44
 
41
45
  Every row is one command on your own file:
42
46
 
@@ -81,8 +85,8 @@ call replaces a whole round of trial and error:
81
85
  ```
82
86
  npx tanuki-context estimate journal.log 0
83
87
  # { "imageTokens": 10752, "verdict": "PIPELINE cheaper",
84
- # "recommend": { "distill": true, "codebook": true, "imageTokens": 3920,
85
- # "pages": 3, "tinyImageTokens": 2352 }, ... }
88
+ # "recommend": { "distill": true, "codebook": true, "imageTokens": 4256,
89
+ # "pages": 3, "tinyImageTokens": 2576 }, ... }
86
90
  ```
87
91
 
88
92
  **Implicit (proxy) — for clients you can't modify.** A small local relay.
@@ -160,8 +164,8 @@ input (11 lines): distilled (deterministic):
160
164
  ```
161
165
 
162
166
  The ERROR line survived untouched, the count is exact, and the same input
163
- always produces the same output. On the 200 KB journal: 1,371 lines to 621,
164
- half the characters gone, all 318 error/warn lines kept verbatim.
167
+ always produces the same output. On the 200 KB journal: 1,434 lines to 641,
168
+ half the characters gone, all 310 error/warn lines kept verbatim.
165
169
 
166
170
  **Stage 1 — the ladder.** Five text-compression levels, 0 (off) to 4 (gist
167
171
  only). From level 2 up, an exact-recall guard keeps code, identifiers,
package/dist/agent.js CHANGED
@@ -65,7 +65,7 @@ class ZJ{value;constructor(J){this.value=J}}function nJ(){let J=process.env.TANU
65
65
  //! tanuki-context estimate <file> [level] [--distill]
66
66
  //! tanuki-context render <file> [level] [outdir]
67
67
  //! tanuki-context proxy [--port N] [--upstream URL] [knobs] (implicit mode)
68
- var cJ="0.2.1",NJ=6;function JZ(J,Q){let Z=Math.min(J.length,Q.length),$=0;while($<Z&&J.charCodeAt($)===Q.charCodeAt($))$++;if($>=Z)return J.length-Q.length;return J.codePointAt($)-Q.codePointAt($)}function C(J,Q,Z=""){if(J===null||J===void 0)return"null";if(J instanceof ZJ){let z=J.value;return Number.isFinite(z)&&Number.isInteger(z)?z.toFixed(1):String(z)}let $=typeof J;if($==="string")return JSON.stringify(J);if($==="number"||$==="boolean")return String(J);if(Array.isArray(J)){if(J.length===0)return"[]";if(!Q){let q="[";for(let X=0;X<J.length;X++){if(X>0)q+=",";q+=C(J[X],!1)}return q+"]"}let z=Z+" ",K=`[
68
+ var cJ="0.2.2",NJ=6;function JZ(J,Q){let Z=Math.min(J.length,Q.length),$=0;while($<Z&&J.charCodeAt($)===Q.charCodeAt($))$++;if($>=Z)return J.length-Q.length;return J.codePointAt($)-Q.codePointAt($)}function C(J,Q,Z=""){if(J===null||J===void 0)return"null";if(J instanceof ZJ){let z=J.value;return Number.isFinite(z)&&Number.isInteger(z)?z.toFixed(1):String(z)}let $=typeof J;if($==="string")return JSON.stringify(J);if($==="number"||$==="boolean")return String(J);if(Array.isArray(J)){if(J.length===0)return"[]";if(!Q){let q="[";for(let X=0;X<J.length;X++){if(X>0)q+=",";q+=C(J[X],!1)}return q+"]"}let z=Z+" ",K=`[
69
69
  `;for(let q=0;q<J.length;q++){if(q>0)K+=`,
70
70
  `;K+=z+C(J[q],!0,z)}return K+`
71
71
  `+Z+"]"}let V=J,G=Object.keys(V).sort(JZ);if(G.length===0)return"{}";if(!Q){let z="{";for(let K=0;K<G.length;K++){if(K>0)z+=",";z+=JSON.stringify(G[K])+":"+C(V[G[K]],!1)}return z+"}"}let Y=Z+" ",H=`{
package/dist/cli.js CHANGED
@@ -71,7 +71,7 @@ var c={level:0,distill:!1,codebook:!1,font:"normal",minChars:4000,ratio:0.75,min
71
71
  //! tanuki-context estimate <file> [level] [--distill]
72
72
  //! tanuki-context render <file> [level] [outdir]
73
73
  //! tanuki-context proxy [--port N] [--upstream URL] [knobs] (implicit mode)
74
- var NZ="0.2.1",TJ=6;function jZ(J,Q){let Z=Math.min(J.length,Q.length),$=0;while($<Z&&J.charCodeAt($)===Q.charCodeAt($))$++;if($>=Z)return J.length-Q.length;return J.codePointAt($)-Q.codePointAt($)}function E(J,Q,Z=""){if(J===null||J===void 0)return"null";if(J instanceof e){let H=J.value;return Number.isFinite(H)&&Number.isInteger(H)?H.toFixed(1):String(H)}let $=typeof J;if($==="string")return JSON.stringify(J);if($==="number"||$==="boolean")return String(J);if(Array.isArray(J)){if(J.length===0)return"[]";if(!Q){let B="[";for(let X=0;X<J.length;X++){if(X>0)B+=",";B+=E(J[X],!1)}return B+"]"}let H=Z+" ",K=`[
74
+ var NZ="0.2.2",TJ=6;function jZ(J,Q){let Z=Math.min(J.length,Q.length),$=0;while($<Z&&J.charCodeAt($)===Q.charCodeAt($))$++;if($>=Z)return J.length-Q.length;return J.codePointAt($)-Q.codePointAt($)}function E(J,Q,Z=""){if(J===null||J===void 0)return"null";if(J instanceof e){let H=J.value;return Number.isFinite(H)&&Number.isInteger(H)?H.toFixed(1):String(H)}let $=typeof J;if($==="string")return JSON.stringify(J);if($==="number"||$==="boolean")return String(J);if(Array.isArray(J)){if(J.length===0)return"[]";if(!Q){let B="[";for(let X=0;X<J.length;X++){if(X>0)B+=",";B+=E(J[X],!1)}return B+"]"}let H=Z+" ",K=`[
75
75
  `;for(let B=0;B<J.length;B++){if(B>0)K+=`,
76
76
  `;K+=H+E(J[B],!0,H)}return K+`
77
77
  `+Z+"]"}let V=J,z=Object.keys(V).sort(jZ);if(z.length===0)return"{}";if(!Q){let H="{";for(let K=0;K<z.length;K++){if(K>0)H+=",";H+=JSON.stringify(z[K])+":"+E(V[z[K]],!1)}return H+"}"}let Y=Z+" ",G=`{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tanuki-context",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Token-cutting context pipeline as an MCP server: distill logs, compress text, render dense PNG pages (pxpipe imaging engine). Zero dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",