keri-ts 0.2.3 → 0.3.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 +70 -8
- package/esm/app/cli/agent.js +0 -19
- package/esm/app/cli/annotate-color.js +215 -0
- package/esm/app/cli/annotate.js +13 -3
- package/esm/app/cli/benchmark.js +210 -0
- package/esm/app/cli/cli.js +50 -52
- package/esm/app/cli/command-definitions.js +260 -6
- package/esm/app/cli/common/existing.js +40 -0
- package/esm/app/cli/common/parsing.js +20 -0
- package/esm/app/cli/export.js +51 -0
- package/esm/app/cli/incept.js +106 -0
- package/esm/app/cli/index.js +2 -0
- package/esm/app/cli/init.js +72 -41
- package/esm/app/configing.js +261 -0
- package/esm/app/habbing.js +386 -0
- package/esm/app/index.js +3 -0
- package/esm/app/keeping.js +321 -0
- package/esm/app/version.js +2 -2
- package/esm/db/basing.js +66 -1
- package/esm/db/core/lmdber.js +13 -7
- package/esm/db/core/path-manager.js +193 -169
- package/esm/db/index.js +1 -0
- package/esm/db/keeping.js +214 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
- package/package.json +4 -2
- package/types/app/cli/agent.d.ts.map +1 -1
- package/types/app/cli/annotate-color.d.ts +6 -0
- package/types/app/cli/annotate-color.d.ts.map +1 -0
- package/types/app/cli/annotate.d.ts.map +1 -1
- package/types/app/cli/benchmark.d.ts +11 -0
- package/types/app/cli/benchmark.d.ts.map +1 -0
- package/types/app/cli/cli.d.ts.map +1 -1
- package/types/app/cli/command-definitions.d.ts +5 -2
- package/types/app/cli/command-definitions.d.ts.map +1 -1
- package/types/app/cli/command-types.d.ts +12 -0
- package/types/app/cli/command-types.d.ts.map +1 -1
- package/types/app/cli/common/existing.d.ts +4 -0
- package/types/app/cli/common/existing.d.ts.map +1 -0
- package/types/app/cli/common/parsing.d.ts +15 -0
- package/types/app/cli/common/parsing.d.ts.map +1 -0
- package/types/app/cli/export.d.ts +8 -0
- package/types/app/cli/export.d.ts.map +1 -0
- package/types/app/cli/incept.d.ts +8 -0
- package/types/app/cli/incept.d.ts.map +1 -0
- package/types/app/cli/index.d.ts +2 -0
- package/types/app/cli/index.d.ts.map +1 -1
- package/types/app/cli/init.d.ts +5 -0
- package/types/app/cli/init.d.ts.map +1 -1
- package/types/app/configing.d.ts +57 -0
- package/types/app/configing.d.ts.map +1 -0
- package/types/app/habbing.d.ts +107 -0
- package/types/app/habbing.d.ts.map +1 -0
- package/types/app/index.d.ts +3 -0
- package/types/app/index.d.ts.map +1 -1
- package/types/app/keeping.d.ts +72 -0
- package/types/app/keeping.d.ts.map +1 -0
- package/types/app/version.d.ts +2 -2
- package/types/db/basing.d.ts +16 -1
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/lmdber.d.ts +8 -4
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/path-manager.d.ts +88 -24
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/index.d.ts +1 -0
- package/types/db/index.d.ts.map +1 -1
- package/types/db/keeping.d.ts +73 -0
- package/types/db/keeping.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
- package/esm/app/cli/stub-commands.js +0 -61
- package/types/app/cli/stub-commands.d.ts +0 -6
- package/types/app/cli/stub-commands.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,25 +1,87 @@
|
|
|
1
1
|
# keri-ts
|
|
2
2
|
|
|
3
|
-
KERI TypeScript runtime package with the `tufa` CLI
|
|
4
|
-
database/runtime modules.
|
|
3
|
+
KERI TypeScript runtime package with the `tufa` CLI.
|
|
5
4
|
|
|
6
5
|
## Install
|
|
7
6
|
|
|
8
7
|
```bash
|
|
8
|
+
# As a dependency
|
|
9
9
|
npm install keri-ts
|
|
10
|
+
|
|
11
|
+
# Global CLI install
|
|
12
|
+
npm install -g keri-ts
|
|
10
13
|
```
|
|
11
14
|
|
|
12
|
-
## CLI
|
|
15
|
+
## CLI quick start
|
|
16
|
+
|
|
17
|
+
`tufa version` and `tufa annotate` are the fastest way to verify your setup.
|
|
13
18
|
|
|
14
19
|
```bash
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
# Version
|
|
21
|
+
tufa version
|
|
22
|
+
tufa --version
|
|
23
|
+
|
|
24
|
+
# Annotate CESR from file
|
|
25
|
+
tufa annotate --in ./mystream.cesr
|
|
26
|
+
|
|
27
|
+
# Annotate from stdin
|
|
28
|
+
cat ./mystream.cesr | tufa annotate
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Benchmark CESR parser
|
|
32
|
+
|
|
33
|
+
Benchmark any CESR stream from file or stdin:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Benchmark a stream file
|
|
37
|
+
tufa benchmark cesr --in ./mystream.cesr
|
|
38
|
+
|
|
39
|
+
# Benchmark from stdin with explicit chunk simulation
|
|
40
|
+
cat ./mystream.cesr | tufa benchmark cesr --chunk-size 256 --iterations 25 --warmup 5
|
|
17
41
|
```
|
|
18
42
|
|
|
19
|
-
|
|
43
|
+
- `--in <path>`: input file path (defaults to stdin)
|
|
44
|
+
- `--iterations <count>`: measured benchmark runs (default `50`)
|
|
45
|
+
- `--warmup <count>`: warmup runs before measurement (default `5`)
|
|
46
|
+
- `--chunk-size <bytes>`: chunk size for streaming simulation (`0` = full
|
|
47
|
+
stream)
|
|
48
|
+
- `--framed`: benchmark parser in framed mode
|
|
49
|
+
- `--compat`: benchmark parser with compat attachment dispatch mode
|
|
50
|
+
- `--allow-errors`: continue benchmark even when parse errors are emitted
|
|
51
|
+
- `--json`: print one JSON result line
|
|
52
|
+
|
|
53
|
+
## Annotate options
|
|
20
54
|
|
|
21
55
|
```bash
|
|
56
|
+
tufa annotate --in <path> --out <path> --pretty
|
|
57
|
+
tufa annotate --qb2 --in <binary.qb2> --out <annotation.txt>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- `--in <path>`: input file path (defaults to stdin)
|
|
61
|
+
- `--out <path>`: output file path (defaults to stdout)
|
|
62
|
+
- `--qb2`: parse input as qb2 binary
|
|
63
|
+
- `--pretty`: pretty-print annotation output
|
|
64
|
+
- `--colored`: colorize annotation output on stdout only (ignored with `--out`)
|
|
65
|
+
|
|
66
|
+
Optional color overrides:
|
|
67
|
+
|
|
68
|
+
- File: `$HOME/.tufa/annot-color.yaml` or `$HOME/.tufa/annot-color.yml`
|
|
69
|
+
- Keys: `counter`, `group`, `body`, `signature`, `said`, `opaque`, `comment`
|
|
70
|
+
- Values: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`,
|
|
71
|
+
or bright variants (`brightBlack` ... `brightWhite`)
|
|
72
|
+
|
|
73
|
+
## Package entrypoints
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# CLI help
|
|
77
|
+
npx tufa --help
|
|
78
|
+
|
|
79
|
+
# From source in this repo
|
|
22
80
|
deno task tufa --help
|
|
23
|
-
deno task
|
|
24
|
-
deno task build:npm
|
|
81
|
+
deno task tufa version
|
|
25
82
|
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Licensed under the Apache License, Version 2.0 (`Apache-2.0`). See the
|
|
87
|
+
top-level `LICENSE` file in this repository.
|
package/esm/app/cli/agent.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { ValidationError } from "../../core/errors.js";
|
|
2
2
|
import { startServer } from "../server.js";
|
|
3
|
-
function printAgentHelp() {
|
|
4
|
-
console.log(`
|
|
5
|
-
tufa agent - Start the KERI agent server
|
|
6
|
-
|
|
7
|
-
Usage: tufa agent [options]
|
|
8
|
-
|
|
9
|
-
Options:
|
|
10
|
-
--port, -p <port> Port number for the server (default: 8000)
|
|
11
|
-
--help, -h Show this help message
|
|
12
|
-
|
|
13
|
-
The agent server provides HTTP endpoints for interacting with keri-ts.
|
|
14
|
-
The server will run until interrupted with SIGINT (Ctrl+C).
|
|
15
|
-
`);
|
|
16
|
-
}
|
|
17
3
|
/**
|
|
18
4
|
* Agent command operation - starts the HTTP server
|
|
19
5
|
*
|
|
@@ -21,11 +7,6 @@ The server will run until interrupted with SIGINT (Ctrl+C).
|
|
|
21
7
|
* @returns Operation that runs the server until shutdown
|
|
22
8
|
*/
|
|
23
9
|
export function* agentCommand(args) {
|
|
24
|
-
// Check for help flag
|
|
25
|
-
if (args.help || args.h) {
|
|
26
|
-
printAgentHelp();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
10
|
// Extract port from args (default to 8000)
|
|
30
11
|
const port = args.port ? Number(args.port) : 8000;
|
|
31
12
|
// Validate port number
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
const ANSI_CODES = {
|
|
3
|
+
black: "\x1b[30m",
|
|
4
|
+
red: "\x1b[31m",
|
|
5
|
+
green: "\x1b[32m",
|
|
6
|
+
yellow: "\x1b[33m",
|
|
7
|
+
blue: "\x1b[34m",
|
|
8
|
+
magenta: "\x1b[35m",
|
|
9
|
+
cyan: "\x1b[36m",
|
|
10
|
+
white: "\x1b[37m",
|
|
11
|
+
brightBlack: "\x1b[90m",
|
|
12
|
+
brightRed: "\x1b[91m",
|
|
13
|
+
brightGreen: "\x1b[92m",
|
|
14
|
+
brightYellow: "\x1b[93m",
|
|
15
|
+
brightBlue: "\x1b[94m",
|
|
16
|
+
brightMagenta: "\x1b[95m",
|
|
17
|
+
brightCyan: "\x1b[96m",
|
|
18
|
+
brightWhite: "\x1b[97m",
|
|
19
|
+
};
|
|
20
|
+
const RESET = "\x1b[0m";
|
|
21
|
+
const COLOR_KEYS = [
|
|
22
|
+
"counter",
|
|
23
|
+
"group",
|
|
24
|
+
"body",
|
|
25
|
+
"signature",
|
|
26
|
+
"said",
|
|
27
|
+
"opaque",
|
|
28
|
+
"comment",
|
|
29
|
+
];
|
|
30
|
+
const DEFAULT_COLORS = {
|
|
31
|
+
counter: "cyan",
|
|
32
|
+
group: "magenta",
|
|
33
|
+
body: "green",
|
|
34
|
+
signature: "yellow",
|
|
35
|
+
said: "brightBlue",
|
|
36
|
+
opaque: "brightRed",
|
|
37
|
+
comment: "brightBlack",
|
|
38
|
+
};
|
|
39
|
+
const SAID_CAPTURE = /(said=)(\S+)/g;
|
|
40
|
+
const COMMENT_DELIM = " # ";
|
|
41
|
+
function isColorName(value) {
|
|
42
|
+
return typeof value === "string" && value in ANSI_CODES;
|
|
43
|
+
}
|
|
44
|
+
function parseColorConfig(raw) {
|
|
45
|
+
const parsed = {};
|
|
46
|
+
const lines = raw.split(/\r?\n/);
|
|
47
|
+
for (const line of lines) {
|
|
48
|
+
const trimmed = line.trim();
|
|
49
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
50
|
+
continue;
|
|
51
|
+
const match = /^([A-Za-z][A-Za-z0-9_-]*)\s*:\s*(.+?)\s*$/.exec(trimmed);
|
|
52
|
+
if (!match)
|
|
53
|
+
return null;
|
|
54
|
+
const key = match[1];
|
|
55
|
+
let value = match[2];
|
|
56
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
57
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
58
|
+
value = value.slice(1, -1);
|
|
59
|
+
}
|
|
60
|
+
parsed[key] = value;
|
|
61
|
+
}
|
|
62
|
+
const config = {};
|
|
63
|
+
for (const key of COLOR_KEYS) {
|
|
64
|
+
const value = parsed[key];
|
|
65
|
+
if (value === undefined)
|
|
66
|
+
continue;
|
|
67
|
+
if (!isColorName(value))
|
|
68
|
+
return null;
|
|
69
|
+
config[key] = value;
|
|
70
|
+
}
|
|
71
|
+
return config;
|
|
72
|
+
}
|
|
73
|
+
function resolveConfigPath(homeDir) {
|
|
74
|
+
const basePath = `${homeDir}/.tufa`;
|
|
75
|
+
const yamlPath = `${basePath}/annot-color.yaml`;
|
|
76
|
+
const ymlPath = `${basePath}/annot-color.yml`;
|
|
77
|
+
try {
|
|
78
|
+
const stat = dntShim.Deno.statSync(yamlPath);
|
|
79
|
+
if (stat.isFile)
|
|
80
|
+
return yamlPath;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Continue to .yml fallback
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const stat = dntShim.Deno.statSync(ymlPath);
|
|
87
|
+
if (stat.isFile)
|
|
88
|
+
return ymlPath;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// No config file, use defaults
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function readUserColorConfig() {
|
|
96
|
+
const homeDir = dntShim.Deno.env.get("HOME");
|
|
97
|
+
if (!homeDir)
|
|
98
|
+
return null;
|
|
99
|
+
const configPath = resolveConfigPath(homeDir);
|
|
100
|
+
if (!configPath)
|
|
101
|
+
return null;
|
|
102
|
+
try {
|
|
103
|
+
return parseColorConfig(dntShim.Deno.readTextFileSync(configPath));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function toAnsiColors(userConfig) {
|
|
110
|
+
const names = { ...DEFAULT_COLORS };
|
|
111
|
+
if (userConfig) {
|
|
112
|
+
for (const key of COLOR_KEYS) {
|
|
113
|
+
const value = userConfig[key];
|
|
114
|
+
if (value)
|
|
115
|
+
names[key] = value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
counter: ANSI_CODES[names.counter],
|
|
120
|
+
group: ANSI_CODES[names.group],
|
|
121
|
+
body: ANSI_CODES[names.body],
|
|
122
|
+
signature: ANSI_CODES[names.signature],
|
|
123
|
+
said: ANSI_CODES[names.said],
|
|
124
|
+
opaque: ANSI_CODES[names.opaque],
|
|
125
|
+
comment: ANSI_CODES[names.comment],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function color(text, ansiCode) {
|
|
129
|
+
if (!text)
|
|
130
|
+
return text;
|
|
131
|
+
return `${ansiCode}${text}${RESET}`;
|
|
132
|
+
}
|
|
133
|
+
function colorizeComment(comment, colors) {
|
|
134
|
+
const saidTinted = comment.replace(SAID_CAPTURE, (_whole, prefix, said) => `${prefix}${color(said, colors.said)}`);
|
|
135
|
+
return color(saidTinted, colors.comment);
|
|
136
|
+
}
|
|
137
|
+
function colorizeValue(value, comment, colors) {
|
|
138
|
+
const text = value.trim();
|
|
139
|
+
if (!text)
|
|
140
|
+
return value;
|
|
141
|
+
if (comment && /opaque/i.test(comment)) {
|
|
142
|
+
return color(value, colors.opaque);
|
|
143
|
+
}
|
|
144
|
+
if (comment && /(Indexer|Sig|Sigs|Signature)/.test(comment)) {
|
|
145
|
+
return color(value, colors.signature);
|
|
146
|
+
}
|
|
147
|
+
if (comment && /(Group|count=|counter)/.test(comment)) {
|
|
148
|
+
return color(value, colors.group);
|
|
149
|
+
}
|
|
150
|
+
if (comment && /SERDER/.test(comment)) {
|
|
151
|
+
return color(value, colors.body);
|
|
152
|
+
}
|
|
153
|
+
if (/^[\[{]/.test(text)) {
|
|
154
|
+
return color(value, colors.body);
|
|
155
|
+
}
|
|
156
|
+
if (/^-[A-Za-z0-9_-]+$/.test(text)) {
|
|
157
|
+
return color(value, colors.counter);
|
|
158
|
+
}
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
function colorizeLine(line, colors) {
|
|
162
|
+
const trimmed = line.trimStart();
|
|
163
|
+
if (trimmed.startsWith("#")) {
|
|
164
|
+
return color(line, colors.comment);
|
|
165
|
+
}
|
|
166
|
+
const idx = line.indexOf(COMMENT_DELIM);
|
|
167
|
+
if (idx === -1) {
|
|
168
|
+
return colorizeValue(line, null, colors);
|
|
169
|
+
}
|
|
170
|
+
const value = line.slice(0, idx);
|
|
171
|
+
const comment = line.slice(idx + COMMENT_DELIM.length);
|
|
172
|
+
const valueTinted = colorizeValue(value, comment, colors);
|
|
173
|
+
const commentTinted = colorizeComment(comment, colors);
|
|
174
|
+
return `${valueTinted}${COMMENT_DELIM}${commentTinted}`;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Apply ANSI styling for CLI-only CESR annotation display.
|
|
178
|
+
* This is intentionally presentation-only and must not alter persisted output.
|
|
179
|
+
*/
|
|
180
|
+
export function colorizeAnnotatedOutput(annotated) {
|
|
181
|
+
const colors = toAnsiColors(readUserColorConfig());
|
|
182
|
+
const lines = annotated.split("\n");
|
|
183
|
+
const out = [];
|
|
184
|
+
let inPrettyJsonBody = false;
|
|
185
|
+
// support colorizing lines even with --pretty arg
|
|
186
|
+
for (const line of lines) {
|
|
187
|
+
const idx = line.indexOf(COMMENT_DELIM);
|
|
188
|
+
const value = idx === -1 ? line : line.slice(0, idx);
|
|
189
|
+
const comment = idx === -1 ? null : line.slice(idx + COMMENT_DELIM.length);
|
|
190
|
+
const trimmed = value.trim();
|
|
191
|
+
if (comment && /SERDER/.test(comment)) {
|
|
192
|
+
if (trimmed === "}" || trimmed === "]") {
|
|
193
|
+
const valueTinted = color(value, colors.body);
|
|
194
|
+
const commentTinted = colorizeComment(comment, colors);
|
|
195
|
+
out.push(`${valueTinted}${COMMENT_DELIM}${commentTinted}`);
|
|
196
|
+
inPrettyJsonBody = false;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
out.push(colorizeLine(line, colors));
|
|
200
|
+
inPrettyJsonBody = false;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (inPrettyJsonBody && idx === -1) {
|
|
204
|
+
out.push(color(line, colors.body));
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (idx === -1 && (trimmed === "{" || trimmed === "[")) {
|
|
208
|
+
inPrettyJsonBody = true;
|
|
209
|
+
out.push(color(line, colors.body));
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
out.push(colorizeLine(line, colors));
|
|
213
|
+
}
|
|
214
|
+
return out.join("\n");
|
|
215
|
+
}
|
package/esm/app/cli/annotate.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
2
|
import { annotate } from "cesr-ts";
|
|
3
|
+
import { colorizeAnnotatedOutput } from "./annotate-color.js";
|
|
3
4
|
const TEXT_DECODER = new TextDecoder();
|
|
5
|
+
/**
|
|
6
|
+
* Reads bytes from stdin in chunks of 64KB and returns them as a single Uint8Array
|
|
7
|
+
* @returns All bytes read from stdin
|
|
8
|
+
*/
|
|
4
9
|
function readAllStdinSync() {
|
|
5
10
|
const chunks = [];
|
|
6
11
|
let total = 0;
|
|
7
12
|
while (true) {
|
|
8
|
-
const chunk = new Uint8Array(64 * 1024);
|
|
9
|
-
const read = dntShim.Deno.stdin.readSync(chunk);
|
|
13
|
+
const chunk = new Uint8Array(64 * 1024); // 64KB chunk size
|
|
14
|
+
const read = dntShim.Deno.stdin.readSync(chunk); // reads up to 64KB chunk, returns num bytes
|
|
10
15
|
if (read === null) {
|
|
16
|
+
// read until EOF (null)
|
|
11
17
|
break;
|
|
12
18
|
}
|
|
13
19
|
const used = chunk.subarray(0, read);
|
|
@@ -29,6 +35,7 @@ export function* annotateCommand(args) {
|
|
|
29
35
|
outPath: args.outPath,
|
|
30
36
|
qb2: args.qb2,
|
|
31
37
|
pretty: args.pretty,
|
|
38
|
+
colored: args.colored,
|
|
32
39
|
};
|
|
33
40
|
const inputBytes = options.inPath
|
|
34
41
|
? dntShim.Deno.readFileSync(options.inPath)
|
|
@@ -43,5 +50,8 @@ export function* annotateCommand(args) {
|
|
|
43
50
|
dntShim.Deno.writeTextFileSync(options.outPath, annotated);
|
|
44
51
|
return;
|
|
45
52
|
}
|
|
46
|
-
|
|
53
|
+
const output = options.colored
|
|
54
|
+
? colorizeAnnotatedOutput(annotated)
|
|
55
|
+
: annotated;
|
|
56
|
+
console.log(output);
|
|
47
57
|
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { createParser } from "cesr-ts";
|
|
3
|
+
/**
|
|
4
|
+
* Synchronously consume stdin for CLI benchmark mode.
|
|
5
|
+
*
|
|
6
|
+
* Maintainer note:
|
|
7
|
+
* - Synchronous read keeps CLI command implementation simple and deterministic.
|
|
8
|
+
* - This function should remain isolated; parser benchmark internals themselves
|
|
9
|
+
* are IO-agnostic.
|
|
10
|
+
*/
|
|
11
|
+
function readAllStdinSync() {
|
|
12
|
+
const chunks = [];
|
|
13
|
+
let total = 0;
|
|
14
|
+
while (true) {
|
|
15
|
+
const chunk = new Uint8Array(64 * 1024);
|
|
16
|
+
const read = dntShim.Deno.stdin.readSync(chunk);
|
|
17
|
+
if (read === null) {
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
const used = chunk.subarray(0, read);
|
|
21
|
+
chunks.push(used);
|
|
22
|
+
total += read;
|
|
23
|
+
}
|
|
24
|
+
const output = new Uint8Array(total);
|
|
25
|
+
let offset = 0;
|
|
26
|
+
for (const chunk of chunks) {
|
|
27
|
+
output.set(chunk, offset);
|
|
28
|
+
offset += chunk.length;
|
|
29
|
+
}
|
|
30
|
+
return output;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validate positive integer options with explicit field-scoped errors.
|
|
34
|
+
*/
|
|
35
|
+
function asPositiveInteger(value, fallback, fieldName) {
|
|
36
|
+
if (value === undefined) {
|
|
37
|
+
return fallback;
|
|
38
|
+
}
|
|
39
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
|
|
40
|
+
throw new Error(`${fieldName} must be a positive integer`);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate non-negative integer options with explicit field-scoped errors.
|
|
46
|
+
*/
|
|
47
|
+
function asNonNegativeInteger(value, fallback, fieldName) {
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
return fallback;
|
|
50
|
+
}
|
|
51
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
52
|
+
throw new Error(`${fieldName} must be a non-negative integer`);
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Normalize optional chunk sizing into a legal parse feed shape.
|
|
58
|
+
*/
|
|
59
|
+
function normalizeChunkSize(chunkSize, inputLength) {
|
|
60
|
+
if (chunkSize <= 0 || chunkSize >= inputLength) {
|
|
61
|
+
return inputLength;
|
|
62
|
+
}
|
|
63
|
+
return chunkSize;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build ordered chunk views over the input stream.
|
|
67
|
+
*
|
|
68
|
+
* Invariant:
|
|
69
|
+
* - uses `subarray` so benchmark execution does not add avoidable copy overhead.
|
|
70
|
+
*/
|
|
71
|
+
function createChunks(input, chunkSize) {
|
|
72
|
+
if (chunkSize >= input.length) {
|
|
73
|
+
return [input];
|
|
74
|
+
}
|
|
75
|
+
const chunks = [];
|
|
76
|
+
for (let offset = 0; offset < input.length; offset += chunkSize) {
|
|
77
|
+
chunks.push(input.subarray(offset, Math.min(offset + chunkSize, input.length)));
|
|
78
|
+
}
|
|
79
|
+
return chunks;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Execute one complete parser pass and aggregate frame/error events.
|
|
83
|
+
*/
|
|
84
|
+
function parseStreamOnce(input, chunkSize, parserOptions) {
|
|
85
|
+
const parser = createParser(parserOptions);
|
|
86
|
+
let frameCount = 0;
|
|
87
|
+
let errorCount = 0;
|
|
88
|
+
for (const chunk of createChunks(input, chunkSize)) {
|
|
89
|
+
for (const event of parser.feed(chunk)) {
|
|
90
|
+
if (event.type === "frame") {
|
|
91
|
+
frameCount++;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
errorCount++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
for (const event of parser.flush()) {
|
|
99
|
+
if (event.type === "frame") {
|
|
100
|
+
frameCount++;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
errorCount++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { frameCount, errorCount };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Run timed parser benchmark loop for `tufa benchmark cesr`.
|
|
110
|
+
*
|
|
111
|
+
* Boundary contract:
|
|
112
|
+
* - warmup runs are excluded from timing.
|
|
113
|
+
* - correctness remains first: parse errors fail the benchmark unless
|
|
114
|
+
* explicitly allowed.
|
|
115
|
+
*/
|
|
116
|
+
function benchmarkParser(input, options) {
|
|
117
|
+
if (input.length === 0) {
|
|
118
|
+
throw new Error("Benchmark input stream must not be empty");
|
|
119
|
+
}
|
|
120
|
+
const iterations = asPositiveInteger(options.iterations, 50, "iterations");
|
|
121
|
+
const warmupIterations = asNonNegativeInteger(options.warmupIterations, 5, "warmup");
|
|
122
|
+
const parsedChunkSize = asNonNegativeInteger(options.chunkSize, 0, "chunkSize");
|
|
123
|
+
const chunkSize = normalizeChunkSize(parsedChunkSize, input.length);
|
|
124
|
+
const failOnParseError = !(options.allowErrors ?? false);
|
|
125
|
+
const parserOptions = {
|
|
126
|
+
framed: options.framed ?? false,
|
|
127
|
+
attachmentDispatchMode: options.compat ? "compat" : "strict",
|
|
128
|
+
};
|
|
129
|
+
for (let i = 0; i < warmupIterations; i++) {
|
|
130
|
+
parseStreamOnce(input, chunkSize, parserOptions);
|
|
131
|
+
}
|
|
132
|
+
let totalFrames = 0;
|
|
133
|
+
let totalErrors = 0;
|
|
134
|
+
const startMs = performance.now();
|
|
135
|
+
for (let i = 0; i < iterations; i++) {
|
|
136
|
+
const summary = parseStreamOnce(input, chunkSize, parserOptions);
|
|
137
|
+
totalFrames += summary.frameCount;
|
|
138
|
+
totalErrors += summary.errorCount;
|
|
139
|
+
if (failOnParseError && summary.errorCount > 0) {
|
|
140
|
+
throw new Error(`Benchmark run produced parse errors (run=${i + 1}, errorCount=${summary.errorCount})`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const elapsedMs = Math.max(performance.now() - startMs, Number.EPSILON);
|
|
144
|
+
const throughputMiBPerSec = ((input.length * iterations * 1000) / elapsedMs) /
|
|
145
|
+
(1024 * 1024);
|
|
146
|
+
const framesPerSec = (totalFrames * 1000) / elapsedMs;
|
|
147
|
+
return {
|
|
148
|
+
iterations,
|
|
149
|
+
warmupIterations,
|
|
150
|
+
bytesPerIteration: input.length,
|
|
151
|
+
chunkSize,
|
|
152
|
+
totalFrames,
|
|
153
|
+
totalErrors,
|
|
154
|
+
elapsedMs,
|
|
155
|
+
avgIterationMs: elapsedMs / iterations,
|
|
156
|
+
throughputMiBPerSec,
|
|
157
|
+
framesPerSec,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Render maintainer-oriented benchmark output for terminal use.
|
|
162
|
+
*/
|
|
163
|
+
function formatBenchmarkText(sourceLabel, result) {
|
|
164
|
+
const chunkLabel = result.chunkSize === result.bytesPerIteration
|
|
165
|
+
? "full stream"
|
|
166
|
+
: `${result.chunkSize} bytes`;
|
|
167
|
+
return [
|
|
168
|
+
"CESR parser benchmark",
|
|
169
|
+
`source: ${sourceLabel}`,
|
|
170
|
+
`iterations: ${result.iterations} (warmup: ${result.warmupIterations})`,
|
|
171
|
+
`input bytes/iteration: ${result.bytesPerIteration}`,
|
|
172
|
+
`chunk size: ${chunkLabel}`,
|
|
173
|
+
`frames/iteration: ${(result.totalFrames / result.iterations).toFixed(2)}`,
|
|
174
|
+
`errors/iteration: ${(result.totalErrors / result.iterations).toFixed(2)}`,
|
|
175
|
+
`avg iteration: ${result.avgIterationMs.toFixed(3)} ms`,
|
|
176
|
+
`throughput: ${result.throughputMiBPerSec.toFixed(3)} MiB/s`,
|
|
177
|
+
`frame rate: ${result.framesPerSec.toFixed(2)} frames/s`,
|
|
178
|
+
].join("\n");
|
|
179
|
+
}
|
|
180
|
+
// deno-lint-ignore require-yield
|
|
181
|
+
/**
|
|
182
|
+
* Effection command handler for `tufa benchmark cesr`.
|
|
183
|
+
*
|
|
184
|
+
* Responsibility boundary:
|
|
185
|
+
* - parse command options from dispatch args,
|
|
186
|
+
* - read stream input from file/stdin,
|
|
187
|
+
* - execute benchmark and emit one result payload (text or JSON).
|
|
188
|
+
*/
|
|
189
|
+
export function* benchmarkCommand(args) {
|
|
190
|
+
const options = {
|
|
191
|
+
inPath: args.inPath,
|
|
192
|
+
iterations: args.iterations,
|
|
193
|
+
warmupIterations: args.warmupIterations,
|
|
194
|
+
chunkSize: args.chunkSize,
|
|
195
|
+
framed: args.framed,
|
|
196
|
+
compat: args.compat,
|
|
197
|
+
allowErrors: args.allowErrors,
|
|
198
|
+
json: args.json,
|
|
199
|
+
};
|
|
200
|
+
const sourceLabel = options.inPath ? options.inPath : "stdin";
|
|
201
|
+
const inputBytes = options.inPath
|
|
202
|
+
? dntShim.Deno.readFileSync(options.inPath)
|
|
203
|
+
: readAllStdinSync();
|
|
204
|
+
const result = benchmarkParser(inputBytes, options);
|
|
205
|
+
if (options.json) {
|
|
206
|
+
console.log(JSON.stringify({ source: sourceLabel, ...result }));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
console.log(formatBenchmarkText(sourceLabel, result));
|
|
210
|
+
}
|