faf 7.16.2 → 8.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.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * A command value may carry its own note: `cmd — note`.
3
+ *
4
+ * `key_files` already works this way (`path — role`), and the authors turn
5
+ * that into a `| Path | Role |` table. Commands get the same convention, so a
6
+ * `.faf` can say what a script actually does:
7
+ *
8
+ * ```yaml
9
+ * commands:
10
+ * build: bun run build — clean, bundle cli+index, then tsc
11
+ * ```
12
+ *
13
+ * authors as:
14
+ *
15
+ * ```bash
16
+ * bun run build # clean, bundle cli+index, then tsc
17
+ * ```
18
+ *
19
+ * Without a note the behaviour is unchanged — the key is the comment, exactly
20
+ * as before. The separator is the em dash with spaces around it, matching
21
+ * `key_files`; a bare hyphen is left alone, because shell commands are full of
22
+ * them (`--force`, `-rf`).
23
+ *
24
+ * Every consumer of `data.commands` must split before it renders, or the note
25
+ * leaks into the command itself — an authored `bun run build — clean…` that a
26
+ * reader would try to run.
27
+ */
28
+ /** The separator a command value uses to carry its note. */
29
+ export declare const NOTE_SEPARATOR = " \u2014 ";
30
+ export interface CommandAndNote {
31
+ /** The command to run, with any note removed. */
32
+ cmd: string;
33
+ /** The note the value carried, or null when it carried none. */
34
+ note: string | null;
35
+ }
36
+ /**
37
+ * Split a command value into the command and its note.
38
+ *
39
+ * @param value a `commands` value, e.g. `bun run build` or `bun run build — clean, then tsc`
40
+ */
41
+ export declare function splitCommandNote(value: unknown): CommandAndNote;
42
+ /** The command alone — for prose and for authors that show no comments. */
43
+ export declare function commandOnly(value: unknown): string;
@@ -123,7 +123,14 @@ export declare function injectFafBlock(path: string, block: string, start?: stri
123
123
  * older block there is an example to faf, and stays below the new one;
124
124
  * - a whole-line START marker sits past more than MAX_OPEN_CONTAINERS
125
125
  * nested lists or quotes: faf did not read that far, and the older block
126
- * stays below the new one.
126
+ * stays below the new one;
127
+ * - a whole-line START or END marker is shown as text with no matching pair
128
+ * — a block an older faf truncated, or a pair the two readings read
129
+ * differently. faf cannot prove where that block ended, so it is left
130
+ * exactly as it is and the new block goes on top. Without this line the
131
+ * file is the one case in this family that is prefixed in silence: it
132
+ * carries faf's own marker text, so it looks most like faf's to a reader
133
+ * and least like it to faf.
127
134
  * `label` names the file (`CLAUDE.md`). `existing` is the file's text before
128
135
  * the write (null when there was none). faf-mcp and claude-faf-mcp print the
129
136
  * same line through this export.
@@ -1,6 +1,6 @@
1
1
  import type { KernelScoreResult, FafbInfo } from '../core/types.js';
2
2
  export declare function score(yaml: string): KernelScoreResult;
3
- /** Score a .faf YAML string (33 enterprise slots), as the file is (a leading BOM is not scored). */
3
+ /** Same as {@link score} (always 33) — kept for existing callers (a leading BOM is not scored). */
4
4
  export declare function scoreEnterprise(yaml: string): KernelScoreResult;
5
5
  /** Validate .faf YAML (a leading BOM is left out, as in {@link score}: `faf check` reads a BOM file). */
6
6
  export declare function validate(yaml: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "faf",
3
- "version": "7.16.2",
3
+ "version": "8.0.1",
4
4
  "description": "Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",
5
5
  "type": "module",
6
6
  "icon": "https://faf.one/orange-smiley.svg",
@@ -25,8 +25,7 @@
25
25
  "dist/**/*",
26
26
  "README.md",
27
27
  "LICENSE",
28
- "project.faf",
29
- "vendor/faf-scoring-kernel/**"
28
+ "project.faf"
30
29
  ],
31
30
  "scripts": {
32
31
  "dev": "bun src/cli.ts",
@@ -75,7 +74,7 @@
75
74
  },
76
75
  "dependencies": {
77
76
  "commander": "^14.0.3",
78
- "faf-scoring-kernel": "file:./vendor/faf-scoring-kernel",
77
+ "faf-scoring-kernel": "^3.0.0",
79
78
  "open": "^11.0.0",
80
79
  "yaml": "^2.9.0"
81
80
  },
package/project.faf CHANGED
@@ -1,29 +1,32 @@
1
1
  faf_version: "3.0"
2
2
  project:
3
3
  name: faf-cli
4
- version: "7.16.2"
5
- goal: "CLI for IANA-registered `.faf` + `.fafm` — context DNA and portable agent memory. TypeScript, Bun-native since v6. package faf-cli v7.16.2 The Discoverable Edition."
4
+ version: "8.0.1"
5
+ goal: "CLI for IANA-registered `.faf` + `.fafm` — context DNA and portable agent memory. TypeScript, Bun-native since v6. package faf-cli v8.0.1 The Always33 Edition — scored by the always-33 engine."
6
6
  main_language: TypeScript
7
7
  type: cli # found: package.json bin
8
8
  # Commands + key_files feed `faf export --agents` (hand values win over detection).
9
9
  commands:
10
10
  install: bun install
11
- build: bun run build
12
- dev: bun run dev
13
- test: bun run test
14
- lint: bun run lint
11
+ build: bun run build — clean, bundle src/cli.ts to dist, then tsc
12
+ dev: bun run dev — run the CLI from source, no build
13
+ test: bun run test — must pass before a change is done
14
+ lint: bun run lint — eslint over src
15
+ check:no-hardcode: bun run check:no-hardcode — fail if a build-machine path leaked into dist
15
16
  key_files:
16
- - src/cli.ts
17
- - src/index.ts
18
- - src/commands/
19
- - src/commands/memory.ts
20
- - src/core/
21
- - src/detect/
22
- - src/fafm/
23
- - src/interop/
24
- - src/wasm/
25
- - package.json
26
- - project.faf
17
+ - src/cli.ts — CLI entry (Commander); builds to the `faf` / `faf-cli` bin
18
+ - src/index.ts — library entry; builds to `main`, plus the `./pack` export
19
+ - src/commands/ — one file per faf subcommand (39)
20
+ - src/commands/memory.ts — `faf memory`, the `.fafm` surface
21
+ - src/core/ — domain engines (drift, faf-dna, faf-source, cwd-guard)
22
+ - src/detect/ — stack and project detection, per language
23
+ - src/fafm/ — the `.fafm` library (soul, from-claude-dir, types)
24
+ - src/interop/ — the context authors (agents, claude, gemini, cards, copilot)
25
+ - src/interrogate/ — extractors that read a repo's own files for facts (readme, cargo, compose, env)
26
+ - src/ui/ — terminal output (colors, display, progress, star-nudge)
27
+ - src/wasm/ — bridge to faf-scoring-kernel; scoring lives there, not in TS
28
+ - package.json — scripts, and the bin that maps `faf` to dist/cli.js
29
+ - project.faf — this file; the DNA every author reads from
27
30
  instant_context:
28
31
  what_building: CLI for IANA-registered .faf context + .fafm memory
29
32
  tech_stack: TypeScript · Bun-native since v6
@@ -43,9 +46,9 @@ stack:
43
46
  runtime: slotignored
44
47
  database: slotignored
45
48
  connection: slotignored
46
- hosting: slotignored
47
- build: slotignored
48
- cicd: slotignored
49
+ hosting: npm + Homebrew
50
+ build: Bun (bun build) + tsc
51
+ cicd: GitHub Actions
49
52
  monorepo_tool: slotignored
50
53
  package_manager: slotignored
51
54
  workspaces: slotignored
@@ -58,7 +61,7 @@ human_context:
58
61
  what: Persistent AI Context Standard — project DNA for AI. IANA-registered. Anthropic-merged.
59
62
  why: Eliminates 91% context re-discovery tax — define once, AI remembers forever
60
63
  where: npm registry, Homebrew, GitHub
61
- when: Production since September 2025; Bun-native since v6; current package 7.16.2
64
+ when: Production since September 2025; Bun-native since v6; current package 8.0.1 (always-33 engine)
62
65
  how: bunx faf-cli auto, then project.faf versions with your code — faf show renders it human-visible
63
66
  monorepo:
64
67
  packages_count: slotignored
@@ -1,14 +0,0 @@
1
- # faf-scoring-kernel 2.1.0 (vendored)
2
-
3
- WASM built from `~/FAF/faf-rust/crates/faf-wasm-sdk` against `faf-fafb` 1.0.4.
4
-
5
- - `compile_fafb` emits **FAFb wire v2**
6
- - `score_faf` is 21-slot base; `score_faf_enterprise` is 33-slot Mk4
7
-
8
- Rebuild:
9
-
10
- ```bash
11
- # wasm-opt -all emits stringref (Node 20 rejects). Crate metadata has wasm-opt = false.
12
- wasm-pack build --target nodejs --release --out-dir /tmp/faf-scoring-kernel-v2
13
- # copy faf_wasm_sdk* into this directory
14
- ```
@@ -1,42 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
- /**
5
- * Compile YAML to a FAFb v2 binary — returns Uint8Array.
6
- */
7
- export function compile_fafb(yaml: string): Uint8Array;
8
-
9
- /**
10
- * Decompile a FAFb binary to JSON (full content) — returns JSON string.
11
- */
12
- export function decompile_fafb(bytes: Uint8Array): string;
13
-
14
- /**
15
- * Get FAFb file info (header + section metadata, no content) — returns JSON.
16
- */
17
- export function fafb_info(bytes: Uint8Array): string;
18
-
19
- /**
20
- * Score FAF YAML content — 21-slot base (CLI default). Returns JSON.
21
- */
22
- export function score_faf(yaml: string): string;
23
-
24
- /**
25
- * Score FAF YAML content — full 33-slot Mk4. Returns JSON.
26
- */
27
- export function score_faf_enterprise(yaml: string): string;
28
-
29
- /**
30
- * Score a FAFb binary — returns JSON string (same shape as `score_faf`).
31
- */
32
- export function score_fafb(bytes: Uint8Array): string;
33
-
34
- /**
35
- * Get SDK version.
36
- */
37
- export function sdk_version(): string;
38
-
39
- /**
40
- * Validate FAF YAML content — true if it parses as a YAML mapping.
41
- */
42
- export function validate_faf(yaml: string): boolean;
@@ -1,366 +0,0 @@
1
- /* @ts-self-types="./faf_wasm_sdk.d.ts" */
2
-
3
- /**
4
- * Compile YAML to a FAFb v2 binary — returns Uint8Array.
5
- * @param {string} yaml
6
- * @returns {Uint8Array}
7
- */
8
- function compile_fafb(yaml) {
9
- try {
10
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
11
- const ptr0 = passStringToWasm0(yaml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
12
- const len0 = WASM_VECTOR_LEN;
13
- wasm.compile_fafb(retptr, ptr0, len0);
14
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
15
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
16
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
17
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
18
- if (r3) {
19
- throw takeObject(r2);
20
- }
21
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
22
- wasm.__wbindgen_export3(r0, r1 * 1, 1);
23
- return v2;
24
- } finally {
25
- wasm.__wbindgen_add_to_stack_pointer(16);
26
- }
27
- }
28
- exports.compile_fafb = compile_fafb;
29
-
30
- /**
31
- * Decompile a FAFb binary to JSON (full content) — returns JSON string.
32
- * @param {Uint8Array} bytes
33
- * @returns {string}
34
- */
35
- function decompile_fafb(bytes) {
36
- let deferred3_0;
37
- let deferred3_1;
38
- try {
39
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
40
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
41
- const len0 = WASM_VECTOR_LEN;
42
- wasm.decompile_fafb(retptr, ptr0, len0);
43
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
44
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
45
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
46
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
47
- var ptr2 = r0;
48
- var len2 = r1;
49
- if (r3) {
50
- ptr2 = 0; len2 = 0;
51
- throw takeObject(r2);
52
- }
53
- deferred3_0 = ptr2;
54
- deferred3_1 = len2;
55
- return getStringFromWasm0(ptr2, len2);
56
- } finally {
57
- wasm.__wbindgen_add_to_stack_pointer(16);
58
- wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
59
- }
60
- }
61
- exports.decompile_fafb = decompile_fafb;
62
-
63
- /**
64
- * Get FAFb file info (header + section metadata, no content) — returns JSON.
65
- * @param {Uint8Array} bytes
66
- * @returns {string}
67
- */
68
- function fafb_info(bytes) {
69
- let deferred3_0;
70
- let deferred3_1;
71
- try {
72
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
73
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
74
- const len0 = WASM_VECTOR_LEN;
75
- wasm.fafb_info(retptr, ptr0, len0);
76
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
77
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
78
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
79
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
80
- var ptr2 = r0;
81
- var len2 = r1;
82
- if (r3) {
83
- ptr2 = 0; len2 = 0;
84
- throw takeObject(r2);
85
- }
86
- deferred3_0 = ptr2;
87
- deferred3_1 = len2;
88
- return getStringFromWasm0(ptr2, len2);
89
- } finally {
90
- wasm.__wbindgen_add_to_stack_pointer(16);
91
- wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
92
- }
93
- }
94
- exports.fafb_info = fafb_info;
95
-
96
- /**
97
- * Score FAF YAML content — 21-slot base (CLI default). Returns JSON.
98
- * @param {string} yaml
99
- * @returns {string}
100
- */
101
- function score_faf(yaml) {
102
- let deferred3_0;
103
- let deferred3_1;
104
- try {
105
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
106
- const ptr0 = passStringToWasm0(yaml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
107
- const len0 = WASM_VECTOR_LEN;
108
- wasm.score_faf(retptr, ptr0, len0);
109
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
110
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
111
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
112
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
113
- var ptr2 = r0;
114
- var len2 = r1;
115
- if (r3) {
116
- ptr2 = 0; len2 = 0;
117
- throw takeObject(r2);
118
- }
119
- deferred3_0 = ptr2;
120
- deferred3_1 = len2;
121
- return getStringFromWasm0(ptr2, len2);
122
- } finally {
123
- wasm.__wbindgen_add_to_stack_pointer(16);
124
- wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
125
- }
126
- }
127
- exports.score_faf = score_faf;
128
-
129
- /**
130
- * Score FAF YAML content — full 33-slot Mk4. Returns JSON.
131
- * @param {string} yaml
132
- * @returns {string}
133
- */
134
- function score_faf_enterprise(yaml) {
135
- let deferred3_0;
136
- let deferred3_1;
137
- try {
138
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
139
- const ptr0 = passStringToWasm0(yaml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
140
- const len0 = WASM_VECTOR_LEN;
141
- wasm.score_faf_enterprise(retptr, ptr0, len0);
142
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
143
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
144
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
145
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
146
- var ptr2 = r0;
147
- var len2 = r1;
148
- if (r3) {
149
- ptr2 = 0; len2 = 0;
150
- throw takeObject(r2);
151
- }
152
- deferred3_0 = ptr2;
153
- deferred3_1 = len2;
154
- return getStringFromWasm0(ptr2, len2);
155
- } finally {
156
- wasm.__wbindgen_add_to_stack_pointer(16);
157
- wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
158
- }
159
- }
160
- exports.score_faf_enterprise = score_faf_enterprise;
161
-
162
- /**
163
- * Score a FAFb binary — returns JSON string (same shape as `score_faf`).
164
- * @param {Uint8Array} bytes
165
- * @returns {string}
166
- */
167
- function score_fafb(bytes) {
168
- let deferred3_0;
169
- let deferred3_1;
170
- try {
171
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
172
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
173
- const len0 = WASM_VECTOR_LEN;
174
- wasm.score_fafb(retptr, ptr0, len0);
175
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
176
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
177
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
178
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
179
- var ptr2 = r0;
180
- var len2 = r1;
181
- if (r3) {
182
- ptr2 = 0; len2 = 0;
183
- throw takeObject(r2);
184
- }
185
- deferred3_0 = ptr2;
186
- deferred3_1 = len2;
187
- return getStringFromWasm0(ptr2, len2);
188
- } finally {
189
- wasm.__wbindgen_add_to_stack_pointer(16);
190
- wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
191
- }
192
- }
193
- exports.score_fafb = score_fafb;
194
-
195
- /**
196
- * Get SDK version.
197
- * @returns {string}
198
- */
199
- function sdk_version() {
200
- let deferred1_0;
201
- let deferred1_1;
202
- try {
203
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
- wasm.sdk_version(retptr);
205
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
206
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
207
- deferred1_0 = r0;
208
- deferred1_1 = r1;
209
- return getStringFromWasm0(r0, r1);
210
- } finally {
211
- wasm.__wbindgen_add_to_stack_pointer(16);
212
- wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
213
- }
214
- }
215
- exports.sdk_version = sdk_version;
216
-
217
- /**
218
- * Validate FAF YAML content — true if it parses as a YAML mapping.
219
- * @param {string} yaml
220
- * @returns {boolean}
221
- */
222
- function validate_faf(yaml) {
223
- const ptr0 = passStringToWasm0(yaml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
224
- const len0 = WASM_VECTOR_LEN;
225
- const ret = wasm.validate_faf(ptr0, len0);
226
- return ret !== 0;
227
- }
228
- exports.validate_faf = validate_faf;
229
- function __wbg_get_imports() {
230
- const import0 = {
231
- __proto__: null,
232
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
233
- // Cast intrinsic for `Ref(String) -> Externref`.
234
- const ret = getStringFromWasm0(arg0, arg1);
235
- return addHeapObject(ret);
236
- },
237
- };
238
- return {
239
- __proto__: null,
240
- "./faf_wasm_sdk_bg.js": import0,
241
- };
242
- }
243
-
244
- function addHeapObject(obj) {
245
- if (heap_next === heap.length) heap.push(heap.length + 1);
246
- const idx = heap_next;
247
- heap_next = heap[idx];
248
-
249
- heap[idx] = obj;
250
- return idx;
251
- }
252
-
253
- function dropObject(idx) {
254
- if (idx < 1028) return;
255
- heap[idx] = heap_next;
256
- heap_next = idx;
257
- }
258
-
259
- function getArrayU8FromWasm0(ptr, len) {
260
- ptr = ptr >>> 0;
261
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
262
- }
263
-
264
- let cachedDataViewMemory0 = null;
265
- function getDataViewMemory0() {
266
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
267
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
268
- }
269
- return cachedDataViewMemory0;
270
- }
271
-
272
- function getStringFromWasm0(ptr, len) {
273
- return decodeText(ptr >>> 0, len);
274
- }
275
-
276
- let cachedUint8ArrayMemory0 = null;
277
- function getUint8ArrayMemory0() {
278
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
279
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
280
- }
281
- return cachedUint8ArrayMemory0;
282
- }
283
-
284
- function getObject(idx) { return heap[idx]; }
285
-
286
- let heap = new Array(1024).fill(undefined);
287
- heap.push(undefined, null, true, false);
288
-
289
- let heap_next = heap.length;
290
-
291
- function passArray8ToWasm0(arg, malloc) {
292
- const ptr = malloc(arg.length * 1, 1) >>> 0;
293
- getUint8ArrayMemory0().set(arg, ptr / 1);
294
- WASM_VECTOR_LEN = arg.length;
295
- return ptr;
296
- }
297
-
298
- function passStringToWasm0(arg, malloc, realloc) {
299
- if (realloc === undefined) {
300
- const buf = cachedTextEncoder.encode(arg);
301
- const ptr = malloc(buf.length, 1) >>> 0;
302
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
303
- WASM_VECTOR_LEN = buf.length;
304
- return ptr;
305
- }
306
-
307
- let len = arg.length;
308
- let ptr = malloc(len, 1) >>> 0;
309
-
310
- const mem = getUint8ArrayMemory0();
311
-
312
- let offset = 0;
313
-
314
- for (; offset < len; offset++) {
315
- const code = arg.charCodeAt(offset);
316
- if (code > 0x7F) break;
317
- mem[ptr + offset] = code;
318
- }
319
- if (offset !== len) {
320
- if (offset !== 0) {
321
- arg = arg.slice(offset);
322
- }
323
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
324
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
325
- const ret = cachedTextEncoder.encodeInto(arg, view);
326
-
327
- offset += ret.written;
328
- ptr = realloc(ptr, len, offset, 1) >>> 0;
329
- }
330
-
331
- WASM_VECTOR_LEN = offset;
332
- return ptr;
333
- }
334
-
335
- function takeObject(idx) {
336
- const ret = getObject(idx);
337
- dropObject(idx);
338
- return ret;
339
- }
340
-
341
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
342
- cachedTextDecoder.decode();
343
- function decodeText(ptr, len) {
344
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
345
- }
346
-
347
- const cachedTextEncoder = new TextEncoder();
348
-
349
- if (!('encodeInto' in cachedTextEncoder)) {
350
- cachedTextEncoder.encodeInto = function (arg, view) {
351
- const buf = cachedTextEncoder.encode(arg);
352
- view.set(buf);
353
- return {
354
- read: arg.length,
355
- written: buf.length
356
- };
357
- };
358
- }
359
-
360
- let WASM_VECTOR_LEN = 0;
361
-
362
- const wasmPath = `${__dirname}/faf_wasm_sdk_bg.wasm`;
363
- const wasmBytes = require('fs').readFileSync(wasmPath);
364
- const wasmModule = new WebAssembly.Module(wasmBytes);
365
- let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
366
- let wasm = wasmInstance.exports;
@@ -1,15 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export const memory: WebAssembly.Memory;
4
- export const compile_fafb: (a: number, b: number, c: number) => void;
5
- export const decompile_fafb: (a: number, b: number, c: number) => void;
6
- export const fafb_info: (a: number, b: number, c: number) => void;
7
- export const score_faf: (a: number, b: number, c: number) => void;
8
- export const score_faf_enterprise: (a: number, b: number, c: number) => void;
9
- export const score_fafb: (a: number, b: number, c: number) => void;
10
- export const sdk_version: (a: number) => void;
11
- export const validate_faf: (a: number, b: number) => number;
12
- export const __wbindgen_add_to_stack_pointer: (a: number) => number;
13
- export const __wbindgen_export: (a: number, b: number) => number;
14
- export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
15
- export const __wbindgen_export3: (a: number, b: number, c: number) => void;
@@ -1,23 +0,0 @@
1
- {
2
- "name": "faf-scoring-kernel",
3
- "version": "2.1.0",
4
- "description": "FAF Mk4 Scoring Kernel \u2014 WASM from faf-rust. Scores .faf (21/33) and compiles FAFb v2.",
5
- "license": "MIT",
6
- "author": "wolfejam <wolfejam@faf.one>",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/Wolfe-Jam/faf-rust"
10
- },
11
- "homepage": "https://faf.one",
12
- "files": [
13
- "faf_wasm_sdk_bg.wasm",
14
- "faf_wasm_sdk.js",
15
- "faf_wasm_sdk.d.ts",
16
- "faf_wasm_sdk_bg.wasm.d.ts"
17
- ],
18
- "main": "faf_wasm_sdk.js",
19
- "types": "faf_wasm_sdk.d.ts",
20
- "engines": {
21
- "node": ">=16.0.0"
22
- }
23
- }