@blackwell-systems/gcf 1.0.0 → 1.0.1
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 +2 -2
- package/dist/cli.js +16 -4
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
- package/src/cli.ts +16 -4
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
TypeScript implementation of [GCF](https://gcformat.com/) — the most token-efficient wire format for LLMs. A drop-in alternative to JSON and TOON for any structured data.
|
|
10
10
|
|
|
11
|
-
**79% fewer input tokens than JSON. 63% fewer output tokens. 90.
|
|
11
|
+
**79% fewer input tokens than JSON. 63% fewer output tokens. 90.7% average comprehension accuracy across 10 models and 3 providers (four models hit 100%). 1,300+ LLM evaluations. Zero training.**
|
|
12
12
|
|
|
13
13
|
Docs: [gcformat.com](https://gcformat.com/) · [Playground](https://gcformat.com/playground.html) · [GCF vs TOON](https://gcformat.com/guide/vs-toon.html)
|
|
14
14
|
|
|
@@ -196,7 +196,7 @@ Works on objects, arrays, and primitives. Arrays of uniform objects get tabular
|
|
|
196
196
|
|
|
197
197
|
| | GCF | TOON | JSON |
|
|
198
198
|
|---|---|---|---|
|
|
199
|
-
| **Comprehension** (23 runs, 10 models) | **90.
|
|
199
|
+
| **Comprehension** (23 runs, 10 models) | **90.7%** | 68.5% | 53.6% |
|
|
200
200
|
| **Generation** (28 runs, 9 models) | **5/5** | 1.0/5 | 5.0/5 |
|
|
201
201
|
| **Input tokens** (500 symbols) | **11,090** | 16,378 | 53,341 |
|
|
202
202
|
| **Output tokens** (100 symbols) | **5,976** | 8,937 | 16,121 |
|
package/dist/cli.js
CHANGED
|
@@ -5,17 +5,23 @@
|
|
|
5
5
|
import { readFileSync } from 'node:fs';
|
|
6
6
|
import { encode } from './encode.js';
|
|
7
7
|
import { decode } from './decode.js';
|
|
8
|
+
import { encodeGeneric } from './generic.js';
|
|
9
|
+
import { decodeGeneric } from './decode_generic.js';
|
|
8
10
|
const USAGE = `gcf - token-optimized wire format for LLM tool responses
|
|
9
11
|
|
|
10
12
|
Usage:
|
|
11
|
-
gcf encode [file]
|
|
12
|
-
gcf decode [file]
|
|
13
|
-
gcf
|
|
14
|
-
gcf
|
|
13
|
+
gcf encode [file] Encode JSON graph payload to GCF (stdin if no file)
|
|
14
|
+
gcf decode [file] Decode GCF graph text to JSON (stdin if no file)
|
|
15
|
+
gcf encode-generic [file] Encode generic JSON to GCF (stdin if no file)
|
|
16
|
+
gcf decode-generic [file] Decode generic GCF to JSON (stdin if no file)
|
|
17
|
+
gcf stats [file] Compare token counts: JSON vs GCF (stdin if no file)
|
|
18
|
+
gcf version Print version
|
|
15
19
|
|
|
16
20
|
Examples:
|
|
17
21
|
gcf encode < payload.json
|
|
18
22
|
gcf decode < payload.gcf
|
|
23
|
+
gcf encode-generic < data.json
|
|
24
|
+
gcf decode-generic < data.gcf
|
|
19
25
|
gcf stats payload.json
|
|
20
26
|
`;
|
|
21
27
|
function readInput(args) {
|
|
@@ -99,6 +105,12 @@ switch (cmd) {
|
|
|
99
105
|
case 'decode':
|
|
100
106
|
doDecode(readInput(args.slice(1)));
|
|
101
107
|
break;
|
|
108
|
+
case 'encode-generic':
|
|
109
|
+
process.stdout.write(encodeGeneric(JSON.parse(readInput(args.slice(1)))));
|
|
110
|
+
break;
|
|
111
|
+
case 'decode-generic':
|
|
112
|
+
console.log(JSON.stringify(decodeGeneric(readInput(args.slice(1))), null, 2));
|
|
113
|
+
break;
|
|
102
114
|
case 'stats':
|
|
103
115
|
doStats(readInput(args.slice(1)));
|
|
104
116
|
break;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;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AAC,CAAC;QAC9E,MAAM;IACR,KAAK,OAAO;QACV,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM;IACR,KAAK,SAAS;QACZ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,MAAM;IACR,KAAK,IAAI,CAAC;IACV,KAAK,QAAQ,CAAC;IACd,KAAK,MAAM;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM;IACR;QACE,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,GAAG,MAAM,CAAC,CAAC;QACpD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackwell-systems/gcf",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Drop-in JSON replacement for AI pipelines. 79% fewer tokens. 90.
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Drop-in JSON replacement for AI pipelines. 79% fewer tokens. 90.7% comprehension across 10 models. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
package/src/cli.ts
CHANGED
|
@@ -6,19 +6,25 @@
|
|
|
6
6
|
import { readFileSync } from 'node:fs';
|
|
7
7
|
import { encode } from './encode.js';
|
|
8
8
|
import { decode } from './decode.js';
|
|
9
|
+
import { encodeGeneric } from './generic.js';
|
|
10
|
+
import { decodeGeneric } from './decode_generic.js';
|
|
9
11
|
import type { Payload, Symbol, Edge } from './types.js';
|
|
10
12
|
|
|
11
13
|
const USAGE = `gcf - token-optimized wire format for LLM tool responses
|
|
12
14
|
|
|
13
15
|
Usage:
|
|
14
|
-
gcf encode [file]
|
|
15
|
-
gcf decode [file]
|
|
16
|
-
gcf
|
|
17
|
-
gcf
|
|
16
|
+
gcf encode [file] Encode JSON graph payload to GCF (stdin if no file)
|
|
17
|
+
gcf decode [file] Decode GCF graph text to JSON (stdin if no file)
|
|
18
|
+
gcf encode-generic [file] Encode generic JSON to GCF (stdin if no file)
|
|
19
|
+
gcf decode-generic [file] Decode generic GCF to JSON (stdin if no file)
|
|
20
|
+
gcf stats [file] Compare token counts: JSON vs GCF (stdin if no file)
|
|
21
|
+
gcf version Print version
|
|
18
22
|
|
|
19
23
|
Examples:
|
|
20
24
|
gcf encode < payload.json
|
|
21
25
|
gcf decode < payload.gcf
|
|
26
|
+
gcf encode-generic < data.json
|
|
27
|
+
gcf decode-generic < data.gcf
|
|
22
28
|
gcf stats payload.json
|
|
23
29
|
`;
|
|
24
30
|
|
|
@@ -114,6 +120,12 @@ switch (cmd) {
|
|
|
114
120
|
case 'decode':
|
|
115
121
|
doDecode(readInput(args.slice(1)));
|
|
116
122
|
break;
|
|
123
|
+
case 'encode-generic':
|
|
124
|
+
process.stdout.write(encodeGeneric(JSON.parse(readInput(args.slice(1)))));
|
|
125
|
+
break;
|
|
126
|
+
case 'decode-generic':
|
|
127
|
+
console.log(JSON.stringify(decodeGeneric(readInput(args.slice(1))), null, 2));
|
|
128
|
+
break;
|
|
117
129
|
case 'stats':
|
|
118
130
|
doStats(readInput(args.slice(1)));
|
|
119
131
|
break;
|