functionalscript 0.35.2 → 0.37.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/fs/asn.1/module.f.js +1 -1
- package/fs/asserts/proof.f.js +1 -1
- package/fs/base_n/module.f.js +3 -3
- package/fs/base_n/proof.f.js +3 -3
- package/fs/{base128 → basen/base128}/module.f.d.ts +1 -1
- package/fs/{base128 → basen/base128}/module.f.js +1 -1
- package/fs/{base128 → basen/base128}/proof.f.js +3 -3
- package/fs/{base64 → basen/base64}/module.f.d.ts +2 -2
- package/fs/basen/base64/module.f.js +71 -0
- package/fs/{base64 → basen/base64}/proof.f.d.ts +2 -0
- package/fs/{base64 → basen/base64}/proof.f.js +17 -2
- package/fs/{cbase32 → basen/cbase32}/module.f.d.ts +2 -2
- package/fs/{cbase32 → basen/cbase32}/module.f.js +2 -2
- package/fs/{cbase32 → basen/cbase32}/proof.f.js +1 -1
- package/fs/bnf/data/module.f.js +4 -4
- package/fs/bnf/data/proof.f.js +6 -6
- package/fs/bnf/descent/module.f.js +6 -6
- package/fs/bnf/descent/proof.f.js +6 -6
- package/fs/bnf/ll1/module.f.js +9 -9
- package/fs/bnf/ll1/proof.f.js +6 -6
- package/fs/bnf/module.f.js +4 -4
- package/fs/bnf/proof.f.js +2 -2
- package/fs/bnf/testlib.f.js +1 -1
- package/fs/cas/cli/module.f.js +7 -7
- package/fs/cas/cli/proof.f.js +8 -8
- package/fs/cas/mcp/module.f.d.ts +8 -4
- package/fs/cas/mcp/module.f.js +124 -72
- package/fs/cas/mcp/proof.f.d.ts +3 -8
- package/fs/cas/mcp/proof.f.js +122 -186
- package/fs/cas/module.f.js +12 -19
- package/fs/cas/proof.f.d.ts +4 -2
- package/fs/cas/proof.f.js +10 -10
- package/fs/ci/bun/module.f.js +2 -2
- package/fs/ci/common/module.f.d.ts +2 -2
- package/fs/ci/common/module.f.js +4 -4
- package/fs/ci/config/module.f.d.ts +20 -21
- package/fs/ci/config/module.f.js +8 -10
- package/fs/ci/deno/module.f.js +8 -4
- package/fs/ci/module.f.js +9 -9
- package/fs/ci/node/module.f.d.ts +1 -1
- package/fs/ci/node/module.f.js +3 -5
- package/fs/ci/playwright/module.f.js +3 -3
- package/fs/ci/proof.f.js +14 -14
- package/fs/ci/rust/module.f.js +2 -2
- package/fs/cli/module.f.js +3 -3
- package/fs/cli/proof.f.js +3 -3
- package/fs/{types → common}/monoid/module.f.d.ts +1 -1
- package/fs/crypto/hmac/module.f.js +2 -2
- package/fs/crypto/hmac/proof.f.js +5 -5
- package/fs/crypto/pow/module.f.js +3 -3
- package/fs/crypto/pow/proof.f.js +4 -4
- package/fs/crypto/secp/module.f.js +2 -2
- package/fs/crypto/secp/proof.f.js +3 -3
- package/fs/crypto/sha2/module.f.js +2 -2
- package/fs/crypto/sha2/proof.f.js +6 -6
- package/fs/crypto/sign/module.f.js +4 -4
- package/fs/crypto/vdf/module.f.js +1 -1
- package/fs/crypto/vdf/proof.f.js +1 -1
- package/fs/dev/module.f.js +6 -6
- package/fs/dev/package_json/module.f.js +6 -6
- package/fs/dev/package_json/proof.f.js +3 -3
- package/fs/dev/proof.f.js +2 -2
- package/fs/djs/ast/module.f.js +2 -2
- package/fs/djs/ast/proof.f.js +4 -4
- package/fs/djs/examples/m.f.d.ts +1 -1
- package/fs/djs/module.f.d.ts +1 -1
- package/fs/djs/module.f.js +5 -5
- package/fs/djs/parser/module.f.js +4 -4
- package/fs/djs/parser/proof.f.js +19 -7
- package/fs/djs/proof.f.js +3 -3
- package/fs/djs/serializer/module.f.js +6 -6
- package/fs/djs/serializer/proof.f.js +4 -4
- package/fs/djs/tokenizer/module.f.js +3 -3
- package/fs/djs/tokenizer/proof.f.js +5 -5
- package/fs/djs/tokenizer-new/proof.f.js +6 -6
- package/fs/djs/transpiler/module.f.d.ts +5 -0
- package/fs/djs/transpiler/module.f.js +21 -11
- package/fs/djs/transpiler/proof.f.js +5 -5
- package/fs/effects/memory/module.f.js +4 -4
- package/fs/effects/memory/proof.f.js +3 -3
- package/fs/effects/module.f.d.ts +15 -0
- package/fs/effects/module.f.js +15 -1
- package/fs/effects/node/memory/module.js +2 -2
- package/fs/effects/node/memory/proof.js +3 -3
- package/fs/effects/node/module.f.js +10 -20
- package/fs/effects/node/module.js +13 -11
- package/fs/effects/node/proof.f.d.ts +3 -0
- package/fs/effects/node/proof.f.js +19 -1
- package/fs/effects/node/virtual/module.f.js +7 -8
- package/fs/effects/node/virtual/proof.f.d.ts +1 -0
- package/fs/effects/node/virtual/proof.f.js +11 -4
- package/fs/effects/proof.f.d.ts +5 -0
- package/fs/effects/proof.f.js +22 -1
- package/fs/emergent_testing/all.test.js +2 -2
- package/fs/emergent_testing/example.f.d.ts +1 -1
- package/fs/emergent_testing/module.f.js +6 -6
- package/fs/emergent_testing/proof.f.d.ts +19 -17
- package/fs/emergent_testing/proof.f.js +7 -7
- package/fs/emergent_testing/scenarios/all.js +1 -1
- package/fs/fsc/bnf.f.js +2 -2
- package/fs/fsc/json.f.js +1 -1
- package/fs/fsc/module.f.d.ts +1 -0
- package/fs/fsc/module.f.js +11 -7
- package/fs/fsc/proof.f.js +4 -4
- package/fs/fsm/module.f.js +9 -9
- package/fs/fsm/proof.f.js +7 -7
- package/fs/js/tokenizer/module.f.d.ts +1 -1
- package/fs/js/tokenizer/module.f.js +14 -8
- package/fs/js/tokenizer/proof.f.js +64 -5
- package/fs/mcp/module.f.d.ts +13 -13
- package/fs/mcp/module.f.js +8 -8
- package/fs/mcp/proof.f.js +5 -5
- package/fs/mcp/stdio/module.f.d.ts +2 -2
- package/fs/mcp/stdio/module.f.js +10 -10
- package/fs/mcp/stdio/proof.f.js +10 -10
- package/fs/{html → media/html}/module.f.d.ts +3 -3
- package/fs/{html → media/html}/module.f.js +9 -9
- package/fs/media/json/module.f.d.ts +50 -0
- package/fs/{json → media/json}/module.f.js +7 -7
- package/fs/{json → media/json}/parser/module.f.d.ts +2 -2
- package/fs/{json → media/json}/parser/module.f.js +7 -7
- package/fs/{json → media/json}/parser/proof.f.js +24 -6
- package/fs/{json → media/json}/proof.f.js +4 -4
- package/fs/media/json/rpc/module.f.d.ts +114 -0
- package/fs/{json → media/json}/rpc/module.f.js +3 -3
- package/fs/{json → media/json}/rpc/proof.f.js +4 -4
- package/fs/media/json/schema/module.f.d.ts +78 -0
- package/fs/{json → media/json}/schema/module.f.js +2 -2
- package/fs/{json → media/json}/schema/proof.f.js +3 -3
- package/fs/{json → media/json}/serializer/module.f.d.ts +1 -1
- package/fs/{json → media/json}/serializer/module.f.js +2 -2
- package/fs/{json → media/json}/serializer/proof.f.js +2 -2
- package/fs/{json → media/json}/tokenizer/module.f.d.ts +2 -2
- package/fs/{json → media/json}/tokenizer/module.f.js +4 -4
- package/fs/{json → media/json}/tokenizer/proof.f.js +5 -5
- package/fs/media/module.f.d.ts +37 -0
- package/fs/media/module.f.js +24 -0
- package/fs/media/proof.f.d.ts +9 -0
- package/fs/media/proof.f.js +57 -0
- package/fs/media/revision/module.f.d.ts +51 -0
- package/fs/media/revision/module.f.js +110 -0
- package/fs/media/revision/proof.f.d.ts +29 -0
- package/fs/media/revision/proof.f.js +119 -0
- package/fs/{mime → media/type}/module.f.d.ts +6 -6
- package/fs/{mime → media/type}/module.f.js +6 -6
- package/fs/{mime → media/type}/proof.f.js +6 -6
- package/fs/module.f.d.ts +2 -0
- package/fs/{fjs/module.f.js → module.f.js} +8 -8
- package/fs/module.js +4 -0
- package/fs/path/module.f.d.ts +6 -0
- package/fs/path/module.f.js +8 -2
- package/fs/path/proof.f.d.ts +1 -0
- package/fs/path/proof.f.js +40 -2
- package/fs/{fjs/proof.f.d.ts → proof.f.d.ts} +1 -0
- package/fs/{fjs/proof.f.js → proof.f.js} +10 -4
- package/fs/sul/id/module.f.js +9 -9
- package/fs/sul/id/proof.f.js +5 -5
- package/fs/sul/level/hash/module.f.js +3 -3
- package/fs/sul/level/hash/proof.f.js +3 -3
- package/fs/sul/level/literal/module.f.js +5 -5
- package/fs/sul/level/literal/proof.f.js +3 -3
- package/fs/sul/module.f.js +3 -3
- package/fs/sul/proof.f.js +3 -3
- package/fs/text/ascii/proof.f.js +3 -3
- package/fs/text/code_point/module.f.js +2 -2
- package/fs/text/code_point/proof.f.js +1 -1
- package/fs/text/module.f.js +5 -5
- package/fs/text/proof.f.js +4 -4
- package/fs/text/sgr/module.f.js +2 -2
- package/fs/text/sgr/proof.f.js +2 -2
- package/fs/text/utf16/module.f.js +5 -5
- package/fs/text/utf16/proof.f.js +4 -4
- package/fs/text/utf8/module.f.d.ts +6 -0
- package/fs/text/utf8/module.f.js +37 -19
- package/fs/text/utf8/proof.f.js +58 -5
- package/fs/types/array/module.f.js +1 -1
- package/fs/types/array/proof.f.js +3 -3
- package/fs/types/bigfloat/module.f.js +1 -1
- package/fs/types/bigfloat/proof.f.js +1 -1
- package/fs/types/bigint/module.f.js +2 -2
- package/fs/types/bigint/proof.f.js +3 -3
- package/fs/types/bit_vec/module.f.js +8 -8
- package/fs/types/bit_vec/proof.f.js +5 -5
- package/fs/types/btree/find/module.f.js +1 -1
- package/fs/types/btree/find/proof.f.d.ts +3 -1
- package/fs/types/btree/find/proof.f.js +7 -7
- package/fs/types/btree/module.f.js +2 -2
- package/fs/types/btree/proof.f.d.ts +11 -5
- package/fs/types/btree/proof.f.js +7 -7
- package/fs/types/btree/remove/module.f.js +4 -4
- package/fs/types/btree/remove/proof.f.d.ts +5 -2
- package/fs/types/btree/remove/proof.f.js +5 -5
- package/fs/types/btree/set/module.f.js +3 -3
- package/fs/types/btree/set/proof.f.js +4 -4
- package/fs/types/byte_set/module.f.js +2 -2
- package/fs/types/byte_set/proof.f.js +4 -4
- package/fs/types/function/compare/proof.f.js +1 -1
- package/fs/types/function/operator/proof.f.d.ts +21 -10
- package/fs/types/function/operator/proof.f.js +1 -1
- package/fs/types/function/proof.f.js +1 -1
- package/fs/types/list/module.f.js +2 -2
- package/fs/types/list/proof.f.d.ts +15 -7
- package/fs/types/list/proof.f.js +4 -4
- package/fs/types/map/proof.f.js +2 -2
- package/fs/types/nibble_set/proof.f.js +2 -2
- package/fs/types/nullable/module.f.js +2 -2
- package/fs/types/nullable/proof.f.js +1 -1
- package/fs/types/number/module.f.js +5 -5
- package/fs/types/number/proof.f.js +1 -1
- package/fs/types/object/module.f.js +4 -4
- package/fs/types/object/proof.f.js +1 -1
- package/fs/types/ordered_map/module.f.js +6 -6
- package/fs/types/ordered_map/proof.f.js +3 -3
- package/fs/types/patricia_trie/proof.f.d.ts +11 -5
- package/fs/types/patricia_trie/proof.f.js +2 -2
- package/fs/types/prime_field/module.f.js +2 -2
- package/fs/types/prime_field/proof.f.js +2 -2
- package/fs/types/range/proof.f.js +1 -1
- package/fs/types/range_map/module.f.js +4 -4
- package/fs/types/range_map/proof.f.js +7 -7
- package/fs/types/result/module.f.d.ts +4 -0
- package/fs/types/result/module.f.js +4 -0
- package/fs/types/result/module.js +1 -1
- package/fs/types/result/proof.f.d.ts +9 -3
- package/fs/types/result/proof.f.js +12 -2
- package/fs/types/rtti/common/module.f.js +4 -4
- package/fs/types/rtti/module.f.d.ts +2 -2
- package/fs/types/rtti/module.f.js +1 -1
- package/fs/types/rtti/parse/module.f.js +5 -5
- package/fs/types/rtti/parse/proof.f.js +2 -2
- package/fs/types/rtti/ts/module.f.js +1 -1
- package/fs/types/rtti/ts/proof.f.js +2 -2
- package/fs/types/rtti/validate/module.f.js +4 -4
- package/fs/types/rtti/validate/proof.f.js +2 -2
- package/fs/types/sorted_list/module.f.js +3 -3
- package/fs/types/sorted_list/proof.f.js +6 -6
- package/fs/types/sorted_set/module.f.js +1 -1
- package/fs/types/sorted_set/proof.f.js +6 -6
- package/fs/types/string/module.f.js +4 -4
- package/fs/types/string/proof.f.js +2 -2
- package/fs/types/string_set/module.f.js +6 -6
- package/fs/types/string_set/proof.f.js +1 -1
- package/fs/types/ts/proof.f.d.ts +18 -18
- package/fs/types/ts/proof.f.js +1 -1
- package/fs/types/uint8array/module.f.js +4 -4
- package/fs/types/uint8array/proof.f.js +4 -4
- package/fs/website/module.f.js +3 -3
- package/fs/website/proof.f.js +3 -3
- package/package.json +8 -8
- package/fs/base64/module.f.js +0 -60
- package/fs/fjs/module.f.d.ts +0 -2
- package/fs/fjs/module.js +0 -4
- package/fs/json/module.f.d.ts +0 -50
- package/fs/json/rpc/module.f.d.ts +0 -114
- package/fs/json/schema/module.f.d.ts +0 -77
- /package/fs/{base128 → basen/base128}/proof.f.d.ts +0 -0
- /package/fs/{cbase32 → basen/cbase32}/proof.f.d.ts +0 -0
- /package/fs/{types → common}/monoid/module.f.js +0 -0
- /package/fs/{types → common}/monoid/proof.f.d.ts +0 -0
- /package/fs/{types → common}/monoid/proof.f.js +0 -0
- /package/fs/{html → media/html}/proof.f.d.ts +0 -0
- /package/fs/{html → media/html}/proof.f.js +0 -0
- /package/fs/{json → media/json}/parser/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/rpc/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/schema/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/serializer/proof.f.d.ts +0 -0
- /package/fs/{json → media/json}/tokenizer/proof.f.d.ts +0 -0
- /package/fs/{mime → media/type}/proof.f.d.ts +0 -0
- /package/fs/{fjs/module.d.ts → module.d.ts} +0 -0
package/fs/asn.1/module.f.js
CHANGED
|
@@ -8,7 +8,7 @@ import { bitLength, divUp8 } from "../types/bigint/module.f.js";
|
|
|
8
8
|
import { empty, isVec, length, msb, uint, unpack, vec, vec8 } from "../types/bit_vec/module.f.js";
|
|
9
9
|
import { identity } from "../types/function/module.f.js";
|
|
10
10
|
import { max } from "../types/function/compare/module.f.js";
|
|
11
|
-
import { encode as b128encode, decode as b128decode } from "../base128/module.f.js";
|
|
11
|
+
import { encode as b128encode, decode as b128decode } from "../basen/base128/module.f.js";
|
|
12
12
|
const { popFront: pop, listToVec } = msb;
|
|
13
13
|
const pop8 = pop(8n);
|
|
14
14
|
const classPcMask = 224n;
|
package/fs/asserts/proof.f.js
CHANGED
package/fs/base_n/module.f.js
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import { msb, lsb, vec, chunkList, unpack } from
|
|
15
|
-
import { fold } from
|
|
16
|
-
import { compose } from
|
|
14
|
+
import { msb, lsb, vec, chunkList, unpack } from '../types/bit_vec/module.f.js';
|
|
15
|
+
import { fold } from '../types/list/module.f.js';
|
|
16
|
+
import { compose } from '../types/function/module.f.js';
|
|
17
17
|
const { unpackSplit } = msb;
|
|
18
18
|
const { tryListToVec: reversedListToVec } = lsb;
|
|
19
19
|
// `chunkList(msb)` doesn't depend on `bits` or `v` — shared across every
|
package/fs/base_n/proof.f.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { assertEq } from
|
|
2
|
-
import { empty, maxLength, vec, length } from
|
|
3
|
-
import { baseN } from
|
|
1
|
+
import { assertEq } from '../asserts/module.f.js';
|
|
2
|
+
import { empty, maxLength, vec, length } from '../types/bit_vec/module.f.js';
|
|
3
|
+
import { baseN } from './module.f.js';
|
|
4
4
|
const hex = baseN(4n, '0123456789abcdef');
|
|
5
5
|
const cb32 = baseN(5n, '0123456789abcdefghjkmnpqrstvwxyz', c => {
|
|
6
6
|
const lower = c.toLowerCase();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { empty, vec, vec8 } from
|
|
2
|
-
import { asBase } from
|
|
3
|
-
import { encode, decode } from
|
|
1
|
+
import { empty, vec, vec8 } from '../../types/bit_vec/module.f.js';
|
|
2
|
+
import { asBase } from '../../types/nominal/module.f.js';
|
|
3
|
+
import { encode, decode } from './module.f.js';
|
|
4
4
|
const test = (a, b) => {
|
|
5
5
|
const encoded = encode(a);
|
|
6
6
|
if (encoded !== b) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { type Vec } from "
|
|
7
|
-
import type { Nullable } from "
|
|
6
|
+
import { type Vec } from "../../types/bit_vec/module.f.ts";
|
|
7
|
+
import type { Nullable } from "../../types/nullable/module.f.ts";
|
|
8
8
|
export declare const encode: (input: Vec) => Nullable<string>;
|
|
9
9
|
export declare const decode: (input: string) => Nullable<Vec>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Base64 encoding and decoding (RFC 4648).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { msb, length, vec, maxLength } from "../../types/bit_vec/module.f.js";
|
|
7
|
+
import { baseN } from "../../base_n/module.f.js";
|
|
8
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
9
|
+
const { popFront } = msb;
|
|
10
|
+
const { vecToString, stringToVec } = baseN(6n, alphabet);
|
|
11
|
+
export const encode = (input) => {
|
|
12
|
+
const len = length(input);
|
|
13
|
+
// Base64 is a byte codec; reject non-octet-aligned inputs.
|
|
14
|
+
if (len % 8n !== 0n) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
// `vecToString` (via `baseN`'s `chunkList`) already left-pads a trailing
|
|
18
|
+
// partial 6-bit chunk with zeros, so `input` needs no explicit padding —
|
|
19
|
+
// building one would risk pushing an intermediate `Vec` past `maxLength`
|
|
20
|
+
// for input already at or near that limit, for no benefit.
|
|
21
|
+
let result = vecToString(input);
|
|
22
|
+
// Append `=` padding to make total length a multiple of 4.
|
|
23
|
+
while (result.length % 4 !== 0) {
|
|
24
|
+
result += '=';
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
export const decode = (input) => {
|
|
29
|
+
// Count and strip trailing `=` padding (0, 1, or 2).
|
|
30
|
+
let padChars = 0;
|
|
31
|
+
for (let i = input.length - 1; i >= 0 && input[i] === '='; i--) {
|
|
32
|
+
padChars++;
|
|
33
|
+
}
|
|
34
|
+
if (padChars > 2) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const body = input.slice(0, input.length - padChars);
|
|
38
|
+
// Total chars must make a multiple of 4 with the padding.
|
|
39
|
+
if ((body.length + padChars) % 4 !== 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (padChars === 0) {
|
|
43
|
+
return stringToVec(body);
|
|
44
|
+
}
|
|
45
|
+
// `encode`'s zero-padding bits (added to reach a 6-bit boundary) live
|
|
46
|
+
// entirely inside the *last* character's chunk — RFC 4648 padding never
|
|
47
|
+
// spans more than one base64 character. Decode every character but the
|
|
48
|
+
// last through `stringToVec` as usual, then decode and trim the last
|
|
49
|
+
// character on its own, so no intermediate `Vec` built here is ever
|
|
50
|
+
// wider than the final, post-trim result — even for input whose decoded
|
|
51
|
+
// payload lands exactly at `maxLength`.
|
|
52
|
+
const removeBits = BigInt(padChars * 2);
|
|
53
|
+
const realBits = 6n - removeBits;
|
|
54
|
+
const head = stringToVec(body.slice(0, body.length - 1));
|
|
55
|
+
if (head === null) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const lastChunk = stringToVec(body.slice(body.length - 1));
|
|
59
|
+
if (lastChunk === null) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
if (length(head) + realBits > maxLength) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const [kept, pad] = popFront(realBits)(lastChunk);
|
|
66
|
+
// Padding bits must be zero (RFC 4648 §3.5).
|
|
67
|
+
if (pad !== vec(removeBits)(0n)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return msb.concat(head)(vec(realBits)(kept));
|
|
71
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertEq } from
|
|
2
|
-
import { empty, vec, repeat, vec8 } from "
|
|
1
|
+
import { assertEq } from '../../asserts/module.f.js';
|
|
2
|
+
import { empty, vec, repeat, vec8, maxLength } from "../../types/bit_vec/module.f.js";
|
|
3
3
|
import { encode, decode } from "./module.f.js";
|
|
4
4
|
const check = (s, v) => {
|
|
5
5
|
assertEq(encode(v), s);
|
|
@@ -83,6 +83,21 @@ export const proof = {
|
|
|
83
83
|
const oversized = 'A'.repeat(174_764);
|
|
84
84
|
assertEq(decode(oversized), null);
|
|
85
85
|
},
|
|
86
|
+
encodeAtMaxLengthSucceeds: () => {
|
|
87
|
+
// A `maxLength`-sized vector's trailing partial 6-bit chunk is
|
|
88
|
+
// left-padded by `vecToString` itself (see `baseN`), so `encode`
|
|
89
|
+
// never needs to build an over-`maxLength` intermediate and must not
|
|
90
|
+
// reject this boundary input.
|
|
91
|
+
assertEq(encode(vec(maxLength)(0n)), 'A'.repeat(174_763) + '=');
|
|
92
|
+
},
|
|
93
|
+
decodeAtMaxLengthSucceeds: () => {
|
|
94
|
+
// Companion to `encodeAtMaxLengthSucceeds`: the encoded string's raw,
|
|
95
|
+
// pre-trim bit count (1_048_578) is 2 over `maxLength` even though
|
|
96
|
+
// the payload it decodes to is exactly `maxLength`. `decode` must
|
|
97
|
+
// trim the last character's 2 zero-padding bits before — not after —
|
|
98
|
+
// measuring the result against `maxLength`.
|
|
99
|
+
check('A'.repeat(174_763) + '=', vec(maxLength)(0n));
|
|
100
|
+
},
|
|
86
101
|
// Regression guard: `encode` used to be quadratic in the input size, not
|
|
87
102
|
// linear. `baseN`'s `vecToString` (`fs/base_n/module.f.ts`) popped one
|
|
88
103
|
// 6-bit chunk off the front at a time via `popFront`, and each `popFront`
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { type Vec } from "
|
|
7
|
-
import type { Nullable } from "
|
|
6
|
+
import { type Vec } from "../../types/bit_vec/module.f.ts";
|
|
7
|
+
import type { Nullable } from "../../types/nullable/module.f.ts";
|
|
8
8
|
export declare const vec5xToCBase32: (v: Vec) => string;
|
|
9
9
|
export declare const cBase32ToVec5x: (s: string) => Nullable<Vec>;
|
|
10
10
|
export declare const vecToCBase32: (v: Vec) => string;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { msb, lsb, length, vec, empty } from "
|
|
7
|
-
import { baseN } from "
|
|
6
|
+
import { msb, lsb, length, vec, empty } from "../../types/bit_vec/module.f.js";
|
|
7
|
+
import { baseN } from "../../base_n/module.f.js";
|
|
8
8
|
// 0123456789abcdef
|
|
9
9
|
const m = '0123456789abcdefghjkmnpqrstvwxyz';
|
|
10
10
|
const { concat } = msb;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { empty, vec } from "
|
|
1
|
+
import { empty, vec } from "../../types/bit_vec/module.f.js";
|
|
2
2
|
import { cBase32ToVec, cBase32ToVec5x, vec5xToCBase32, vecToCBase32 } from "./module.f.js";
|
|
3
3
|
const check5x = (s, v) => {
|
|
4
4
|
const sr = vec5xToCBase32(v);
|
package/fs/bnf/data/module.f.js
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module
|
|
12
12
|
*/
|
|
13
|
-
import { stringToCodePointList } from
|
|
14
|
-
import { map, toArray } from
|
|
15
|
-
import { oneEncode, } from
|
|
16
|
-
import {} from
|
|
13
|
+
import { stringToCodePointList } from '../../text/utf16/module.f.js';
|
|
14
|
+
import { map, toArray } from '../../types/list/module.f.js';
|
|
15
|
+
import { oneEncode, } from '../module.f.js';
|
|
16
|
+
import {} from '../../types/object/module.f.js';
|
|
17
17
|
const { entries } = Object;
|
|
18
18
|
const find = (map) => (fr) => {
|
|
19
19
|
for (const [k, v] of entries(map)) {
|
package/fs/bnf/data/proof.f.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { stringify } from
|
|
2
|
-
import { identity } from
|
|
3
|
-
import { sort } from
|
|
4
|
-
import { oneEncode, option, range, rangeDecode, repeat0Plus, set } from
|
|
5
|
-
import { classic, deterministic } from
|
|
6
|
-
import { toData } from
|
|
1
|
+
import { stringify } from '../../media/json/module.f.js';
|
|
2
|
+
import { identity } from '../../types/function/module.f.js';
|
|
3
|
+
import { sort } from '../../types/object/module.f.js';
|
|
4
|
+
import { oneEncode, option, range, rangeDecode, repeat0Plus, set } from '../module.f.js';
|
|
5
|
+
import { classic, deterministic } from '../testlib.f.js';
|
|
6
|
+
import { toData } from './module.f.js';
|
|
7
7
|
export const proof = {
|
|
8
8
|
rangeDecode: () => {
|
|
9
9
|
const decoded1 = stringify(sort)(rangeDecode(0x000079_000087));
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
|
-
import {} from
|
|
13
|
-
import { rangeDecode } from
|
|
14
|
-
import { contains as rangeContains } from
|
|
15
|
-
import { definedEntries } from
|
|
16
|
-
import { toData } from
|
|
17
|
-
import {} from
|
|
12
|
+
import {} from '../../text/utf16/module.f.js';
|
|
13
|
+
import { rangeDecode } from '../module.f.js';
|
|
14
|
+
import { contains as rangeContains } from '../../types/range/module.f.js';
|
|
15
|
+
import { definedEntries } from '../../types/object/module.f.js';
|
|
16
|
+
import { toData } from '../data/module.f.js';
|
|
17
|
+
import {} from '../module.f.js';
|
|
18
18
|
const emptyTagMapAdd = (ruleSet) => (map) => (name) => {
|
|
19
19
|
if (name in map) {
|
|
20
20
|
return [ruleSet, map, map[name]];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { stringToCodePointList } from
|
|
2
|
-
import { map, toArray } from
|
|
3
|
-
import { commaJoin0Plus, option, range, repeat0Plus, set } from
|
|
4
|
-
import { deterministic } from
|
|
5
|
-
import { toData } from
|
|
6
|
-
import { createEmptyTagMap, descentParser } from
|
|
1
|
+
import { stringToCodePointList } from '../../text/utf16/module.f.js';
|
|
2
|
+
import { map, toArray } from '../../types/list/module.f.js';
|
|
3
|
+
import { commaJoin0Plus, option, range, repeat0Plus, set } from '../module.f.js';
|
|
4
|
+
import { deterministic } from '../testlib.f.js';
|
|
5
|
+
import { toData } from '../data/module.f.js';
|
|
6
|
+
import { createEmptyTagMap, descentParser } from './module.f.js';
|
|
7
7
|
const mapCodePoint = (cp) => [cp, undefined];
|
|
8
8
|
const descentParserCpOnly = (m, name, cp) => {
|
|
9
9
|
const cpm = toArray(map(mapCodePoint)(cp));
|
package/fs/bnf/ll1/module.f.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
|
-
import {} from
|
|
13
|
-
import { strictEqual } from
|
|
14
|
-
import { toArray } from
|
|
15
|
-
import { rangeMap } from
|
|
16
|
-
import { contains, set } from
|
|
17
|
-
import { rangeDecode } from
|
|
18
|
-
import { definedEntries } from
|
|
19
|
-
import { toData } from
|
|
20
|
-
import {} from
|
|
12
|
+
import {} from '../../text/utf16/module.f.js';
|
|
13
|
+
import { strictEqual } from '../../types/function/operator/module.f.js';
|
|
14
|
+
import { toArray } from '../../types/list/module.f.js';
|
|
15
|
+
import { rangeMap } from '../../types/range_map/module.f.js';
|
|
16
|
+
import { contains, set } from '../../types/string_set/module.f.js';
|
|
17
|
+
import { rangeDecode } from '../module.f.js';
|
|
18
|
+
import { definedEntries } from '../../types/object/module.f.js';
|
|
19
|
+
import { toData } from '../data/module.f.js';
|
|
20
|
+
import {} from '../module.f.js';
|
|
21
21
|
const dispatchOp = rangeMap({
|
|
22
22
|
union: a => b => {
|
|
23
23
|
if (a === null) {
|
package/fs/bnf/ll1/proof.f.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { stringToCodePointList } from
|
|
2
|
-
import { toArray } from
|
|
3
|
-
import { commaJoin0Plus, option, range, repeat0Plus, set } from
|
|
4
|
-
import { deterministic } from
|
|
5
|
-
import { toData } from
|
|
6
|
-
import { dispatchMap, parser, parserRuleSet } from
|
|
1
|
+
import { stringToCodePointList } from '../../text/utf16/module.f.js';
|
|
2
|
+
import { toArray } from '../../types/list/module.f.js';
|
|
3
|
+
import { commaJoin0Plus, option, range, repeat0Plus, set } from '../module.f.js';
|
|
4
|
+
import { deterministic } from '../testlib.f.js';
|
|
5
|
+
import { toData } from '../data/module.f.js';
|
|
6
|
+
import { dispatchMap, parser, parserRuleSet } from './module.f.js';
|
|
7
7
|
export const proof = {
|
|
8
8
|
dispatch: [
|
|
9
9
|
() => {
|
package/fs/bnf/module.f.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import { codePointListToString, stringToCodePointList } from
|
|
10
|
-
import { definedValues } from
|
|
11
|
-
import { isArray2 } from
|
|
12
|
-
import { map, toArray, repeat as listRepeat } from
|
|
9
|
+
import { codePointListToString, stringToCodePointList } from '../text/utf16/module.f.js';
|
|
10
|
+
import { definedValues } from '../types/object/module.f.js';
|
|
11
|
+
import { isArray2 } from '../types/array/module.f.js';
|
|
12
|
+
import { map, toArray, repeat as listRepeat } from '../types/list/module.f.js';
|
|
13
13
|
/**
|
|
14
14
|
* Full 24-bit symbol range packed into a single {@link TerminalRange}.
|
|
15
15
|
*/
|
package/fs/bnf/proof.f.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { classic, deterministic } from
|
|
2
|
-
import { rangeEncode, str, set, range, commaJoin0Plus, isEmpty, oneEncode, repeat1Plus, } from
|
|
1
|
+
import { classic, deterministic } from './testlib.f.js';
|
|
2
|
+
import { rangeEncode, str, set, range, commaJoin0Plus, isEmpty, oneEncode, repeat1Plus, } from './module.f.js';
|
|
3
3
|
export const proof = {
|
|
4
4
|
test: () => {
|
|
5
5
|
classic();
|
package/fs/bnf/testlib.f.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { commaJoin0Plus, max, none, option, range, remove, repeat, repeat0Plus, set } from
|
|
1
|
+
import { commaJoin0Plus, max, none, option, range, remove, repeat, repeat0Plus, set } from './module.f.js';
|
|
2
2
|
export const classic = () => {
|
|
3
3
|
// https://www.json.org/json-en.html
|
|
4
4
|
const json = () => [element];
|
package/fs/cas/cli/module.f.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { sha256 } from
|
|
7
|
-
import { cBase32ToVec, vecToCBase32 } from
|
|
8
|
-
import { forEachStep, pure } from
|
|
9
|
-
import { errorExit, log, writeFromStream } from
|
|
10
|
-
import { dispatch } from
|
|
11
|
-
import {} from
|
|
12
|
-
import { casAddFile, fileCas } from
|
|
6
|
+
import { sha256 } from '../../crypto/sha2/module.f.js';
|
|
7
|
+
import { cBase32ToVec, vecToCBase32 } from '../../basen/cbase32/module.f.js';
|
|
8
|
+
import { forEachStep, pure } from '../../effects/module.f.js';
|
|
9
|
+
import { errorExit, log, writeFromStream } from '../../effects/node/module.f.js';
|
|
10
|
+
import { dispatch } from '../../cli/module.f.js';
|
|
11
|
+
import {} from '../../effects/memory/module.f.js';
|
|
12
|
+
import { casAddFile, fileCas } from '../module.f.js';
|
|
13
13
|
export const commands = [
|
|
14
14
|
{
|
|
15
15
|
names: ['add'],
|
package/fs/cas/cli/proof.f.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { commands } from
|
|
2
|
-
import { computeSync, sha256 } from
|
|
3
|
-
import { maxLength, vec, vec8 } from
|
|
4
|
-
import { defaultNodeProgramOptions, emptyState, virtual } from
|
|
5
|
-
import {} from
|
|
6
|
-
import { dispatch } from
|
|
7
|
-
import { vecToCBase32 } from
|
|
8
|
-
import { assert, assertEq } from
|
|
1
|
+
import { commands } from './module.f.js';
|
|
2
|
+
import { computeSync, sha256 } from '../../crypto/sha2/module.f.js';
|
|
3
|
+
import { maxLength, vec, vec8 } from '../../types/bit_vec/module.f.js';
|
|
4
|
+
import { defaultNodeProgramOptions, emptyState, virtual } from '../../effects/node/virtual/module.f.js';
|
|
5
|
+
import {} from '../../effects/node/module.f.js';
|
|
6
|
+
import { dispatch } from '../../cli/module.f.js';
|
|
7
|
+
import { vecToCBase32 } from '../../basen/cbase32/module.f.js';
|
|
8
|
+
import { assert, assertEq } from '../../asserts/module.f.js';
|
|
9
9
|
const makeOptions = (args) => ({ ...defaultNodeProgramOptions, args });
|
|
10
10
|
const main = dispatch(commands);
|
|
11
11
|
export const proof = {
|
package/fs/cas/mcp/module.f.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type Effect } from '../../effects/module.f.ts';
|
|
2
2
|
import { type MemOp } from '../../effects/memory/module.f.ts';
|
|
3
|
-
import { type Read, type
|
|
3
|
+
import { type Read, type Write } from '../../effects/node/module.f.ts';
|
|
4
4
|
import { type McpConfig, type McpHandlers } from '../../mcp/module.f.ts';
|
|
5
5
|
import { type FileCasOperation } from '../module.f.ts';
|
|
6
6
|
/** Arguments for `cas_add`: content to store, with optional encoding type. */
|
|
7
7
|
export declare const casAddArgs: {
|
|
8
8
|
readonly content: import("../../types/rtti/module.f.ts").String;
|
|
9
|
-
readonly type: import("../../types/rtti/module.f.ts").Or<["text", "base64",
|
|
9
|
+
readonly type: import("../../types/rtti/module.f.ts").Or<["text", "base64", undefined]>;
|
|
10
10
|
};
|
|
11
11
|
/** Arguments for `cas_get`: the cBase32 hash to look up; optionally request inline content. */
|
|
12
12
|
export declare const casGetArgs: {
|
|
@@ -18,7 +18,7 @@ export declare const casListArgs: {};
|
|
|
18
18
|
/**
|
|
19
19
|
* MCP handlers for `FileCas`.
|
|
20
20
|
*/
|
|
21
|
-
export declare const casMcpHandlers: (home: string) => McpHandlers<FileCasOperation
|
|
21
|
+
export declare const casMcpHandlers: (home: string) => McpHandlers<FileCasOperation>;
|
|
22
22
|
/**
|
|
23
23
|
* Static MCP configuration for the CAS server: advertises the `tools`
|
|
24
24
|
* capability, identifies the server, and pins the protocol version.
|
|
@@ -29,4 +29,8 @@ export declare const casConfig: McpConfig;
|
|
|
29
29
|
* the `mcpStep` for `c`, and drives the read → parse → dispatch → write loop
|
|
30
30
|
* until stdin EOF.
|
|
31
31
|
*/
|
|
32
|
-
export declare const casMcpServer: (home: string) => Effect<Read | Write | MemOp | FileCasOperation
|
|
32
|
+
export declare const casMcpServer: (home: string) => Effect<Read | Write | MemOp | FileCasOperation, void>;
|
|
33
|
+
export declare const proof: {
|
|
34
|
+
casMcpServer: () => void;
|
|
35
|
+
collectReadOverflow: () => void;
|
|
36
|
+
};
|