poe-code 3.0.274 → 3.0.276
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/dist/index.js +20 -4
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/memory/dist/index.js +19 -3
- package/packages/memory/dist/index.js.map +2 -2
- package/packages/package-lint/dist/model.js +41 -9
- package/packages/package-lint/dist/report.js +7 -1
- package/packages/package-lint/dist/rules/exports-subpath-resolvable.js +0 -0
- package/packages/package-lint/dist/rules/index.js +9 -0
- package/packages/package-lint/dist/rules/published-bin-must-be-executable.js +32 -1
- package/packages/package-lint/dist/source-imports.js +13 -10
- package/packages/tokenfill/dist/cli.js +13 -4
- package/packages/tokenfill/dist/tokenizer.js +20 -3
package/dist/index.js
CHANGED
|
@@ -100945,12 +100945,28 @@ import { get_encoding } from "tiktoken";
|
|
|
100945
100945
|
function createTokenizer(options = {}) {
|
|
100946
100946
|
const encoding = options.encoding ?? DEFAULT_ENCODING;
|
|
100947
100947
|
const tokenizer = get_encoding(encoding);
|
|
100948
|
-
const utf8Decoder = new TextDecoder();
|
|
100949
100948
|
const strictUtf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
100950
100949
|
const encode = (text5) => tokenizer.encode(text5);
|
|
100950
|
+
const normalizeDecodeTokens = (tokens) => {
|
|
100951
|
+
if (tokens instanceof Uint32Array) {
|
|
100952
|
+
return tokens;
|
|
100953
|
+
}
|
|
100954
|
+
const tokenArray = new Uint32Array(tokens.length);
|
|
100955
|
+
tokens.forEach((token, index) => {
|
|
100956
|
+
if (!Number.isFinite(token) || !Number.isInteger(token) || token < 0 || token > 4294967295) {
|
|
100957
|
+
throw new TypeError(`token id at index ${index} must be a finite non-negative integer.`);
|
|
100958
|
+
}
|
|
100959
|
+
tokenArray[index] = token;
|
|
100960
|
+
});
|
|
100961
|
+
return tokenArray;
|
|
100962
|
+
};
|
|
100951
100963
|
const decode = (tokens) => {
|
|
100952
|
-
const tokenArray =
|
|
100953
|
-
|
|
100964
|
+
const tokenArray = normalizeDecodeTokens(tokens);
|
|
100965
|
+
try {
|
|
100966
|
+
return strictUtf8Decoder.decode(tokenizer.decode(tokenArray));
|
|
100967
|
+
} catch {
|
|
100968
|
+
throw new Error("Cannot decode tokens without corrupting UTF-8 text.");
|
|
100969
|
+
}
|
|
100954
100970
|
};
|
|
100955
100971
|
const count = (text5) => encode(text5).length;
|
|
100956
100972
|
const truncate4 = (text5, tokenCount) => {
|
|
@@ -136474,7 +136490,7 @@ var init_package2 = __esm({
|
|
|
136474
136490
|
"package.json"() {
|
|
136475
136491
|
package_default2 = {
|
|
136476
136492
|
name: "poe-code",
|
|
136477
|
-
version: "3.0.
|
|
136493
|
+
version: "3.0.276",
|
|
136478
136494
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
136479
136495
|
type: "module",
|
|
136480
136496
|
main: "./dist/index.js",
|