tenjin-cli 0.1.0-alpha.0 → 0.1.0-alpha.10
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/NOTICE.md +33 -0
- package/README.md +575 -50
- package/dist/{_esm-ZH2J4QEH.js → _esm-C5CRWCYU.js} +2 -2
- package/dist/_esm-N4KAVXQR.js +881 -0
- package/dist/buy-FMDBZ4NY.js +44 -0
- package/dist/candidate-7LAELUQD.js +23 -0
- package/dist/ccip-RPPPKTJR.js +19 -0
- package/dist/{ccip-FXWZDDF5.js → ccip-ZGGWQN4X.js} +6 -5
- package/dist/chunk-2GSRYTZS.js +127 -0
- package/dist/chunk-2GSRYTZS.js.map +1 -0
- package/dist/chunk-2I4QTOLB.js +11 -0
- package/dist/chunk-2I4QTOLB.js.map +1 -0
- package/dist/chunk-36X2CA3N.js +311 -0
- package/dist/chunk-36X2CA3N.js.map +1 -0
- package/dist/{chunk-F5DZJLU3.js → chunk-47PP7TAG.js} +1441 -634
- package/dist/chunk-47PP7TAG.js.map +1 -0
- package/dist/chunk-5JMKIDMM.js +316 -0
- package/dist/chunk-5JMKIDMM.js.map +1 -0
- package/dist/chunk-5JXAZP7H.js +206 -0
- package/dist/chunk-5JXAZP7H.js.map +1 -0
- package/dist/chunk-5SE6BJRP.js +135 -0
- package/dist/chunk-5SE6BJRP.js.map +1 -0
- package/dist/chunk-6BZLSRNU.js +149 -0
- package/dist/chunk-6BZLSRNU.js.map +1 -0
- package/dist/{chunk-PAAL45FJ.js → chunk-7FK2UN2T.js} +3410 -412
- package/dist/chunk-7FK2UN2T.js.map +1 -0
- package/dist/chunk-7WDY4AXV.js +14620 -0
- package/dist/chunk-7WDY4AXV.js.map +1 -0
- package/dist/chunk-A6KCZPNQ.js +83 -0
- package/dist/chunk-A6KCZPNQ.js.map +1 -0
- package/dist/chunk-AWQ6A4CI.js +341 -0
- package/dist/chunk-AWQ6A4CI.js.map +1 -0
- package/dist/chunk-BJJ5BQO6.js +162 -0
- package/dist/chunk-BJJ5BQO6.js.map +1 -0
- package/dist/chunk-BUDHTDKL.js +612 -0
- package/dist/chunk-BUDHTDKL.js.map +1 -0
- package/dist/chunk-DKQMJTG7.js +188 -0
- package/dist/chunk-DKQMJTG7.js.map +1 -0
- package/dist/chunk-FKSAUOJU.js +137 -0
- package/dist/chunk-FKSAUOJU.js.map +1 -0
- package/dist/chunk-GECSWJ7O.js +1645 -0
- package/dist/chunk-GECSWJ7O.js.map +1 -0
- package/dist/chunk-GSDZRCGF.js +105 -0
- package/dist/chunk-GSDZRCGF.js.map +1 -0
- package/dist/chunk-JSSIMGQT.js +174 -0
- package/dist/chunk-JSSIMGQT.js.map +1 -0
- package/dist/chunk-KYH4KPE5.js +1357 -0
- package/dist/chunk-KYH4KPE5.js.map +1 -0
- package/dist/chunk-KYQVEKP5.js +209 -0
- package/dist/chunk-KYQVEKP5.js.map +1 -0
- package/dist/chunk-KZAAWQNP.js +6199 -0
- package/dist/chunk-KZAAWQNP.js.map +1 -0
- package/dist/{chunk-SXQQ2ZSR.js → chunk-M2O56UK7.js} +243 -75
- package/dist/chunk-M2O56UK7.js.map +1 -0
- package/dist/chunk-MD7WGYYI.js +125 -0
- package/dist/chunk-MD7WGYYI.js.map +1 -0
- package/dist/chunk-MJZZTKCC.js +323 -0
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/chunk-O6CAUZGY.js +317 -0
- package/dist/chunk-O6CAUZGY.js.map +1 -0
- package/dist/chunk-P74I3WH4.js +204 -0
- package/dist/chunk-P74I3WH4.js.map +1 -0
- package/dist/chunk-POF7HPRV.js +145 -0
- package/dist/chunk-POF7HPRV.js.map +1 -0
- package/dist/chunk-POJRB2AE.js +83 -0
- package/dist/chunk-POJRB2AE.js.map +1 -0
- package/dist/{chunk-FIYZLITH.js → chunk-PZRAAAY2.js} +107 -18
- package/dist/chunk-PZRAAAY2.js.map +1 -0
- package/dist/chunk-PZSUWDF2.js +35 -0
- package/dist/chunk-PZSUWDF2.js.map +1 -0
- package/dist/chunk-QW2Q2KAH.js +27 -0
- package/dist/chunk-QW2Q2KAH.js.map +1 -0
- package/dist/chunk-R2VLGNFD.js +181 -0
- package/dist/chunk-R2VLGNFD.js.map +1 -0
- package/dist/{chunk-CPUZRZ2A.js → chunk-RBJPAZFI.js} +25 -170
- package/dist/chunk-RBJPAZFI.js.map +1 -0
- package/dist/chunk-S5RYMCV6.js +70 -0
- package/dist/chunk-S5RYMCV6.js.map +1 -0
- package/dist/chunk-SGK2B724.js +67 -0
- package/dist/chunk-SGK2B724.js.map +1 -0
- package/dist/chunk-STND72DS.js +242 -0
- package/dist/chunk-STND72DS.js.map +1 -0
- package/dist/chunk-TEL27PR5.js +124 -0
- package/dist/chunk-TEL27PR5.js.map +1 -0
- package/dist/chunk-TWRYSGAW.js +134 -0
- package/dist/chunk-TWRYSGAW.js.map +1 -0
- package/dist/{chunk-WOHCAMDQ.js → chunk-U5S527PP.js} +1887 -1029
- package/dist/chunk-U5S527PP.js.map +1 -0
- package/dist/chunk-UHTVXQ2O.js +140 -0
- package/dist/chunk-UHTVXQ2O.js.map +1 -0
- package/dist/chunk-UOJRKQTZ.js +213 -0
- package/dist/chunk-UOJRKQTZ.js.map +1 -0
- package/dist/chunk-V4WWTZHZ.js +233 -0
- package/dist/chunk-V4WWTZHZ.js.map +1 -0
- package/dist/chunk-VRRLTZ2Q.js +651 -0
- package/dist/chunk-VRRLTZ2Q.js.map +1 -0
- package/dist/{chunk-TX5T3LKJ.js → chunk-W6R3HAAG.js} +21 -17
- package/dist/{chunk-TX5T3LKJ.js.map → chunk-W6R3HAAG.js.map} +1 -1
- package/dist/chunk-X3OOVSPX.js +154 -0
- package/dist/chunk-X3OOVSPX.js.map +1 -0
- package/dist/chunk-XJN5WUKL.js +204 -0
- package/dist/chunk-XJN5WUKL.js.map +1 -0
- package/dist/chunk-Y7ERTA7D.js +146 -0
- package/dist/chunk-Y7ERTA7D.js.map +1 -0
- package/dist/chunk-YLYINX2H.js +7806 -0
- package/dist/chunk-YLYINX2H.js.map +1 -0
- package/dist/chunk-ZQIQ55KK.js +51 -0
- package/dist/chunk-ZQIQ55KK.js.map +1 -0
- package/dist/chunk-ZUAQRIVP.js +1369 -0
- package/dist/chunk-ZUAQRIVP.js.map +1 -0
- package/dist/{chunk-3IMLRUZE.js → chunk-ZXTAQYNA.js} +6 -2
- package/dist/chunk-ZXTAQYNA.js.map +1 -0
- package/dist/{cli-LMHGCZ5S.js → cli-HK2XAWNW.js} +438 -177
- package/dist/cli-HK2XAWNW.js.map +1 -0
- package/dist/config-LYCHHNAJ.js +26 -0
- package/dist/config-LYCHHNAJ.js.map +1 -0
- package/dist/dist-U4M6QCKE.js +2842 -0
- package/dist/dist-U4M6QCKE.js.map +1 -0
- package/dist/doctor-2KPUQURC.js +27 -0
- package/dist/doctor-2KPUQURC.js.map +1 -0
- package/dist/edit-TST3OCKQ.js +38 -0
- package/dist/edit-TST3OCKQ.js.map +1 -0
- package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js +18 -0
- package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspect-TPTHVPBB.js +35 -0
- package/dist/inspect-TPTHVPBB.js.map +1 -0
- package/dist/install-PT3XEDJ6.js +1869 -0
- package/dist/install-PT3XEDJ6.js.map +1 -0
- package/dist/{mine.wasm-GQECMSGN.js → mine.wasm-6PIT3DK6.js} +2 -2
- package/dist/outcome-NPNSF2Q7.js +22 -0
- package/dist/outcome-NPNSF2Q7.js.map +1 -0
- package/dist/publish-XP5SEWST.js +41 -0
- package/dist/publish-XP5SEWST.js.map +1 -0
- package/dist/read-D4VXRWOG.js +158 -0
- package/dist/read-D4VXRWOG.js.map +1 -0
- package/dist/run-3IPGEXW7.js +16902 -0
- package/dist/run-3IPGEXW7.js.map +1 -0
- package/dist/search-YOBD6VDI.js +24 -0
- package/dist/search-YOBD6VDI.js.map +1 -0
- package/dist/{secp256k1-35YNNB6F.js → secp256k1-XRPVBC6V.js} +5 -4
- package/dist/secp256k1-XRPVBC6V.js.map +1 -0
- package/dist/send-BWNP6WN4.js +223 -0
- package/dist/send-BWNP6WN4.js.map +1 -0
- package/dist/session-GZEZBOMI.js +88 -0
- package/dist/session-GZEZBOMI.js.map +1 -0
- package/dist/skill-heal-OK6YALW6.js +85 -0
- package/dist/skill-heal-OK6YALW6.js.map +1 -0
- package/dist/usdc-4VCDHFWX.js +38 -0
- package/dist/usdc-4VCDHFWX.js.map +1 -0
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js +14 -0
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
- package/dist/wallet-5RHDFPN2.js +32 -0
- package/dist/wallet-5RHDFPN2.js.map +1 -0
- package/dist/wallet-YEGQBWWL.js +42 -0
- package/dist/wallet-YEGQBWWL.js.map +1 -0
- package/docs/agent-permissions.md +281 -0
- package/package.json +26 -17
- package/skills/tenjin/SKILL.md +364 -0
- package/skills/tenjin-publish/SKILL.md +219 -0
- package/skills/tenjin-search/SKILL.md +335 -0
- package/dist/chunk-376LHMK2.js +0 -100
- package/dist/chunk-376LHMK2.js.map +0 -1
- package/dist/chunk-CPUZRZ2A.js.map +0 -1
- package/dist/chunk-F5DZJLU3.js.map +0 -1
- package/dist/chunk-FIYZLITH.js.map +0 -1
- package/dist/chunk-LTTRND4A.js +0 -135
- package/dist/chunk-LTTRND4A.js.map +0 -1
- package/dist/chunk-PAAL45FJ.js.map +0 -1
- package/dist/chunk-QHIEYBLV.js +0 -320
- package/dist/chunk-QHIEYBLV.js.map +0 -1
- package/dist/chunk-SXQQ2ZSR.js.map +0 -1
- package/dist/chunk-WOHCAMDQ.js.map +0 -1
- package/dist/chunk-ZPZFPVDN.js +0 -67
- package/dist/chunk-ZPZFPVDN.js.map +0 -1
- package/dist/cli-LMHGCZ5S.js.map +0 -1
- package/dist/config-XVXZ3V2Q.js +0 -206
- package/dist/config-XVXZ3V2Q.js.map +0 -1
- package/dist/doctor-MVLZRVPU.js +0 -338
- package/dist/doctor-MVLZRVPU.js.map +0 -1
- package/dist/usdc-OQUOFF6R.js +0 -18
- package/dist/wallet-NRKWLKHX.js +0 -153
- package/dist/wallet-NRKWLKHX.js.map +0 -1
- package/dist/wallet-QUWK2PA4.js +0 -22
- /package/dist/{_esm-ZH2J4QEH.js.map → _esm-C5CRWCYU.js.map} +0 -0
- /package/dist/{ccip-FXWZDDF5.js.map → _esm-N4KAVXQR.js.map} +0 -0
- /package/dist/{chunk-3IMLRUZE.js.map → buy-FMDBZ4NY.js.map} +0 -0
- /package/dist/{secp256k1-35YNNB6F.js.map → candidate-7LAELUQD.js.map} +0 -0
- /package/dist/{usdc-OQUOFF6R.js.map → ccip-RPPPKTJR.js.map} +0 -0
- /package/dist/{wallet-QUWK2PA4.js.map → ccip-ZGGWQN4X.js.map} +0 -0
- /package/dist/{mine.wasm-GQECMSGN.js.map → mine.wasm-6PIT3DK6.js.map} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CliError
|
|
4
|
+
} from "./chunk-PZRAAAY2.js";
|
|
5
|
+
|
|
6
|
+
// src/lib/url.ts
|
|
7
|
+
function trimSlash(url) {
|
|
8
|
+
return url.replace(/\/+$/, "");
|
|
9
|
+
}
|
|
10
|
+
function tryOriginOf(url) {
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = new URL(url);
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
|
|
18
|
+
return parsed.origin;
|
|
19
|
+
}
|
|
20
|
+
function originOf(url) {
|
|
21
|
+
const origin = tryOriginOf(url);
|
|
22
|
+
if (origin === null) {
|
|
23
|
+
throw new CliError("USAGE", `Invalid base URL: ${JSON.stringify(url)}`, {
|
|
24
|
+
fix: "Set an absolute http(s) base URL: `tenjin config set baseUrl <url>`."
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return origin;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
trimSlash,
|
|
32
|
+
tryOriginOf,
|
|
33
|
+
originOf
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-PZSUWDF2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/url.ts"],"sourcesContent":["import { CliError } from './errors';\n\n/** Drop trailing slashes from a base URL so `${base}/path` never doubles a slash. */\nexport function trimSlash(url: string): string {\n return url.replace(/\\/+$/, '');\n}\n\n/**\n * The `scheme://host[:port]` of an http(s) URL, or null if it is not one.\n *\n * Non-http schemes are rejected rather than passed through, and that is the whole\n * reason this is not a one-line `new URL(url).origin`: for any non-special\n * scheme the WHATWG origin is the opaque string `\"null\"`, so `foo://tenjin.blog`\n * and `bar://evil.example` compare EQUAL. This value binds a wallet-derived\n * credential to one deployment, so an equal-comparing sentinel is exactly the\n * failure it exists to prevent — the same shape as the unparseable case, just\n * spelled differently.\n */\nexport function tryOriginOf(url: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return null;\n return parsed.origin;\n}\n\n/**\n * `tryOriginOf` for callers that cannot proceed without an origin. Throws USAGE\n * rather than returning a sentinel; anything that must survive a bad base URL\n * (diagnostics, above all) uses `tryOriginOf` and handles the null.\n */\nexport function originOf(url: string): string {\n const origin = tryOriginOf(url);\n if (origin === null) {\n throw new CliError('USAGE', `Invalid base URL: ${JSON.stringify(url)}`, {\n fix: 'Set an absolute http(s) base URL: `tenjin config set baseUrl <url>`.',\n });\n }\n return origin;\n}\n"],"mappings":";;;;;;AAGO,SAAS,UAAU,KAAqB;AAC7C,SAAO,IAAI,QAAQ,QAAQ,EAAE;AAC/B;AAaO,SAAS,YAAY,KAA4B;AACtD,MAAI;AACJ,MAAI;AACF,aAAS,IAAI,IAAI,GAAG;AAAA,EACtB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,OAAO,aAAa,WAAW,OAAO,aAAa,SAAU,QAAO;AACxE,SAAO,OAAO;AAChB;AAOO,SAAS,SAAS,KAAqB;AAC5C,QAAM,SAAS,YAAY,GAAG;AAC9B,MAAI,WAAW,MAAM;AACnB,UAAM,IAAI,SAAS,SAAS,qBAAqB,KAAK,UAAU,GAAG,CAAC,IAAI;AAAA,MACtE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/prompt.ts
|
|
4
|
+
import { createInterface } from "readline";
|
|
5
|
+
function promptYesNo(prompt, opts = {}) {
|
|
6
|
+
const { defaultYes = false, input = process.stdin, output = process.stderr } = opts;
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const rl = createInterface({ input, output });
|
|
9
|
+
let settled = false;
|
|
10
|
+
const settle = (value) => {
|
|
11
|
+
if (settled) return;
|
|
12
|
+
settled = true;
|
|
13
|
+
rl.close();
|
|
14
|
+
resolve(value);
|
|
15
|
+
};
|
|
16
|
+
rl.once("close", () => settle(false));
|
|
17
|
+
rl.question(prompt, (answer) => {
|
|
18
|
+
const a = answer.trim().toLowerCase();
|
|
19
|
+
settle(a === "" ? defaultYes : a === "y" || a === "yes");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
promptYesNo
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=chunk-QW2Q2KAH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/prompt.ts"],"sourcesContent":["import { createInterface } from 'node:readline';\n\nexport interface PromptYesNoOptions {\n /** What an EMPTY answer means; the closing of stdin (ctrl-D) is always false. */\n defaultYes?: boolean;\n /** Injectable streams for tests; label/echo go to stderr, never stdout. */\n input?: NodeJS.ReadableStream;\n output?: NodeJS.WritableStream;\n}\n\n/**\n * The one y/n reader every confirm gate shares (buy, send, install). \"y\"/\"yes\"\n * (any case) is true, an empty answer follows `defaultYes` (explicit at each\n * call site), anything else is false, and stdin closing mid-prompt resolves\n * false rather than hanging. The prompt writes to stderr so stdout stays a\n * single JSON envelope.\n */\nexport function promptYesNo(prompt: string, opts: PromptYesNoOptions = {}): Promise<boolean> {\n const { defaultYes = false, input = process.stdin, output = process.stderr } = opts;\n return new Promise((resolve) => {\n const rl = createInterface({ input, output });\n let settled = false;\n const settle = (value: boolean): void => {\n if (settled) return;\n settled = true;\n rl.close();\n resolve(value);\n };\n rl.once('close', () => settle(false));\n rl.question(prompt, (answer) => {\n const a = answer.trim().toLowerCase();\n settle(a === '' ? defaultYes : a === 'y' || a === 'yes');\n });\n });\n}\n"],"mappings":";;;AAAA,SAAS,uBAAuB;AAiBzB,SAAS,YAAY,QAAgB,OAA2B,CAAC,GAAqB;AAC3F,QAAM,EAAE,aAAa,OAAO,QAAQ,QAAQ,OAAO,SAAS,QAAQ,OAAO,IAAI;AAC/E,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAM,KAAK,gBAAgB,EAAE,OAAO,OAAO,CAAC;AAC5C,QAAI,UAAU;AACd,UAAM,SAAS,CAAC,UAAyB;AACvC,UAAI,QAAS;AACb,gBAAU;AACV,SAAG,MAAM;AACT,cAAQ,KAAK;AAAA,IACf;AACA,OAAG,KAAK,SAAS,MAAM,OAAO,KAAK,CAAC;AACpC,OAAG,SAAS,QAAQ,CAAC,WAAW;AAC9B,YAAM,IAAI,OAAO,KAAK,EAAE,YAAY;AACpC,aAAO,MAAM,KAAK,aAAa,MAAM,OAAO,MAAM,KAAK;AAAA,IACzD,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CliError,
|
|
4
|
+
external_exports
|
|
5
|
+
} from "./chunk-PZRAAAY2.js";
|
|
6
|
+
|
|
7
|
+
// src/lib/output.ts
|
|
8
|
+
import { styleText } from "util";
|
|
9
|
+
import { Stream } from "stream";
|
|
10
|
+
|
|
11
|
+
// src/schemas.ts
|
|
12
|
+
var SCHEMA_VERSION = 1;
|
|
13
|
+
var ErrorCodeSchema = external_exports.enum([
|
|
14
|
+
"NODE_UNSUPPORTED",
|
|
15
|
+
"USAGE",
|
|
16
|
+
"CONFIG_INVALID",
|
|
17
|
+
"WALLET_EXISTS",
|
|
18
|
+
"WALLET_MISSING",
|
|
19
|
+
"WALLET_INVALID_KEY",
|
|
20
|
+
"PROVIDER_ERROR",
|
|
21
|
+
"RPC_ERROR",
|
|
22
|
+
"API_UNREACHABLE",
|
|
23
|
+
"CONTRACT_MISMATCH",
|
|
24
|
+
"REFUSED",
|
|
25
|
+
"NETWORK_ERROR",
|
|
26
|
+
"INTERNAL",
|
|
27
|
+
"NOT_IMPLEMENTED",
|
|
28
|
+
// B2 (search/inspect/buy/outcome): a policy refusal (exit 3) has its own code
|
|
29
|
+
// so an agent can distinguish a spend-cap block from a generic REFUSED; a
|
|
30
|
+
// payment that failed after approval (exit 4) is PAYMENT_FAILED; the read
|
|
31
|
+
// route's own coded failures (402 preview parse, 409 gate) surface as these.
|
|
32
|
+
"POLICY_REFUSED",
|
|
33
|
+
"PAYMENT_FAILED",
|
|
34
|
+
"RESOURCE_NOT_FOUND",
|
|
35
|
+
"SEARCH_NOT_FOUND",
|
|
36
|
+
// A 429 from the anonymous search/outcome/read limits; error.details carries
|
|
37
|
+
// retryAfterSeconds so a looping agent can back off instead of hammering.
|
|
38
|
+
"RATE_LIMITED",
|
|
39
|
+
// B3 (publish): a publish that needs the human's yes (exit 3) — soft scan
|
|
40
|
+
// findings, or `review` mode always. NEEDS_CONFIRMATION clears with --yes;
|
|
41
|
+
// PUBLISH_BLOCKED is a hard-block finding (a live secret) that no mode or --yes
|
|
42
|
+
// ever clears. PUBLISH_FAILED (exit 4) is a write that failed AFTER approval,
|
|
43
|
+
// mirroring PAYMENT_FAILED's post-decision failure class.
|
|
44
|
+
"NEEDS_CONFIRMATION",
|
|
45
|
+
"PUBLISH_BLOCKED",
|
|
46
|
+
"PUBLISH_FAILED",
|
|
47
|
+
// A send that reverted or produced no receipt AFTER the human approved it and
|
|
48
|
+
// it was broadcast (exit 4), same post-decision class as PAYMENT_FAILED.
|
|
49
|
+
"SEND_FAILED"
|
|
50
|
+
]);
|
|
51
|
+
var MoneySchema = external_exports.object({
|
|
52
|
+
atomic: external_exports.string(),
|
|
53
|
+
usd: external_exports.string()
|
|
54
|
+
});
|
|
55
|
+
var OutputErrorSchema = external_exports.object({
|
|
56
|
+
code: ErrorCodeSchema,
|
|
57
|
+
message: external_exports.string(),
|
|
58
|
+
fix: external_exports.string().optional(),
|
|
59
|
+
details: external_exports.unknown().optional()
|
|
60
|
+
});
|
|
61
|
+
var SuccessEnvelopeSchema = external_exports.object({
|
|
62
|
+
schemaVersion: external_exports.literal(SCHEMA_VERSION),
|
|
63
|
+
command: external_exports.string(),
|
|
64
|
+
ok: external_exports.literal(true),
|
|
65
|
+
data: external_exports.unknown()
|
|
66
|
+
});
|
|
67
|
+
var FailureEnvelopeSchema = external_exports.object({
|
|
68
|
+
schemaVersion: external_exports.literal(SCHEMA_VERSION),
|
|
69
|
+
command: external_exports.string(),
|
|
70
|
+
ok: external_exports.literal(false),
|
|
71
|
+
error: OutputErrorSchema
|
|
72
|
+
});
|
|
73
|
+
var OutputEnvelopeSchema = external_exports.discriminatedUnion("ok", [
|
|
74
|
+
SuccessEnvelopeSchema,
|
|
75
|
+
FailureEnvelopeSchema
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
// src/lib/output.ts
|
|
79
|
+
function defaultIo() {
|
|
80
|
+
return {
|
|
81
|
+
stdout: process.stdout,
|
|
82
|
+
stderr: process.stderr,
|
|
83
|
+
isTTY: Boolean(process.stdout.isTTY)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function buildSuccessEnvelope(command, data) {
|
|
87
|
+
return { schemaVersion: SCHEMA_VERSION, command, ok: true, data };
|
|
88
|
+
}
|
|
89
|
+
function buildFailureEnvelope(command, err) {
|
|
90
|
+
const error = {
|
|
91
|
+
code: err.code,
|
|
92
|
+
message: err.message,
|
|
93
|
+
...err.fix !== void 0 ? { fix: err.fix } : {},
|
|
94
|
+
...err.details !== void 0 ? { details: err.details } : {}
|
|
95
|
+
};
|
|
96
|
+
return { schemaVersion: SCHEMA_VERSION, command, ok: false, error };
|
|
97
|
+
}
|
|
98
|
+
function emitSuccess(io, command, data, humanLines = [], opts = {}) {
|
|
99
|
+
if (humanMode(io, opts)) {
|
|
100
|
+
writeLines(io.stdout, humanLines);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
writeJson(io.stdout, buildSuccessEnvelope(command, data));
|
|
104
|
+
}
|
|
105
|
+
function emitFailure(io, command, err, opts = {}) {
|
|
106
|
+
const cliErr = normalizeError(err);
|
|
107
|
+
if (humanMode(io, opts)) {
|
|
108
|
+
const lines = [paint(io, "red", `error: ${sanitizeForTerminal(cliErr.message)}`)];
|
|
109
|
+
if (cliErr.fix !== void 0) {
|
|
110
|
+
lines.push(paint(io, "dim", `fix: ${sanitizeForTerminal(cliErr.fix)}`));
|
|
111
|
+
}
|
|
112
|
+
lines.push(...findingLines(io, cliErr.details));
|
|
113
|
+
writeLines(io.stdout, lines);
|
|
114
|
+
return cliErr;
|
|
115
|
+
}
|
|
116
|
+
writeJson(io.stdout, buildFailureEnvelope(command, cliErr));
|
|
117
|
+
return cliErr;
|
|
118
|
+
}
|
|
119
|
+
function emitNotice(io, text, opts = {}) {
|
|
120
|
+
if (!humanMode(io, opts)) return;
|
|
121
|
+
io.stderr.write(`${paint(io, "dim", sanitizeForTerminal(text))}
|
|
122
|
+
`);
|
|
123
|
+
}
|
|
124
|
+
function emitWriteNotice(io, text) {
|
|
125
|
+
io.stderr.write(`${paint(io, "dim", sanitizeForTerminal(text))}
|
|
126
|
+
`);
|
|
127
|
+
}
|
|
128
|
+
function sanitizeForTerminal(text) {
|
|
129
|
+
return text.replace(/\x1b(?:\[[0-9;?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g, "").replace(/[\x00-\x08\x0a-\x1f\x7f-\x9f]/g, "").replace(/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, "").replace(
|
|
130
|
+
/(\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F})|[\u{E0000}-\u{E007F}\u{FEFF}]/gu,
|
|
131
|
+
(_match, rgiFlag) => rgiFlag ?? ""
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function normalizeError(err) {
|
|
135
|
+
if (err instanceof CliError) return err;
|
|
136
|
+
if (err instanceof Error) return new CliError("INTERNAL", err.message, { cause: err });
|
|
137
|
+
return new CliError("INTERNAL", "Unexpected error", { details: err });
|
|
138
|
+
}
|
|
139
|
+
function humanMode(io, opts) {
|
|
140
|
+
return io.isTTY && opts.json !== true;
|
|
141
|
+
}
|
|
142
|
+
function findingLines(io, details) {
|
|
143
|
+
if (typeof details !== "object" || details === null || !("findings" in details)) return [];
|
|
144
|
+
const { findings } = details;
|
|
145
|
+
if (!Array.isArray(findings) || findings.length === 0) return [];
|
|
146
|
+
const rendered = [];
|
|
147
|
+
for (const f of findings) {
|
|
148
|
+
if (typeof f !== "object" || f === null) continue;
|
|
149
|
+
const { check, line, excerpt } = f;
|
|
150
|
+
if (typeof check !== "string" || typeof line !== "number" || typeof excerpt !== "string") {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
rendered.push(paint(io, "dim", ` ${check} (line ${line}): ${sanitizeForTerminal(excerpt)}`));
|
|
154
|
+
}
|
|
155
|
+
return rendered;
|
|
156
|
+
}
|
|
157
|
+
function writeJson(stream, value) {
|
|
158
|
+
stream.write(`${JSON.stringify(value, null, 2)}
|
|
159
|
+
`);
|
|
160
|
+
}
|
|
161
|
+
function writeLines(stream, lines) {
|
|
162
|
+
if (lines.length > 0) stream.write(`${lines.join("\n")}
|
|
163
|
+
`);
|
|
164
|
+
}
|
|
165
|
+
function paint(io, format, text) {
|
|
166
|
+
if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });
|
|
167
|
+
return styleText(format, text);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
defaultIo,
|
|
172
|
+
buildSuccessEnvelope,
|
|
173
|
+
buildFailureEnvelope,
|
|
174
|
+
emitSuccess,
|
|
175
|
+
emitFailure,
|
|
176
|
+
emitNotice,
|
|
177
|
+
emitWriteNotice,
|
|
178
|
+
sanitizeForTerminal,
|
|
179
|
+
normalizeError
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=chunk-R2VLGNFD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/output.ts","../src/schemas.ts"],"sourcesContent":["import { styleText } from 'node:util';\nimport { Stream } from 'node:stream';\nimport { CliError } from './errors';\nimport { SCHEMA_VERSION } from '../schemas';\nimport type { FailureEnvelope, OutputError, SuccessEnvelope } from '../schemas';\n\n/**\n * Injected streams + TTY fact. Every command receives one via CommandContext,\n * so tests drive the CLI in-process with memory buffers and no child process.\n * `isTTY` is the real terminal fact; the separate `--json` flag (passed to the\n * emit functions) is what suppresses human rendering — the two are ANDed, never\n * conflated, so `--json` on a TTY still yields pure machine output.\n */\nexport interface Io {\n stdout: NodeJS.WritableStream;\n stderr: NodeJS.WritableStream;\n isTTY: boolean;\n}\n\nexport function defaultIo(): Io {\n return {\n stdout: process.stdout,\n stderr: process.stderr,\n isTTY: Boolean(process.stdout.isTTY),\n };\n}\n\nexport interface EmitOptions {\n /** The global --json flag. When true, the JSON envelope is emitted even at a TTY. */\n json?: boolean;\n}\n\n/**\n * The two pure envelope builders, shared by the CLI's emit functions and the MCP\n * adapter so both surfaces produce the identical wire object by construction. They\n * hold no I/O and no --json branching: they turn a (command, data) or a normalized\n * CliError into the exact object that goes to stdout / structuredContent.\n */\nexport function buildSuccessEnvelope(command: string, data: unknown): SuccessEnvelope {\n return { schemaVersion: SCHEMA_VERSION, command, ok: true, data };\n}\n\nexport function buildFailureEnvelope(command: string, err: CliError): FailureEnvelope {\n const error: OutputError = {\n code: err.code,\n message: err.message,\n ...(err.fix !== undefined ? { fix: err.fix } : {}),\n ...(err.details !== undefined ? { details: err.details } : {}),\n };\n return { schemaVersion: SCHEMA_VERSION, command, ok: false, error };\n}\n\n/**\n * Output contract (human-first): at a TTY without `--json`, print ONLY the human\n * rendering to stdout, no JSON envelope. With `--json`, or when stdout is not a\n * TTY (a pipe, an agent), print exactly one JSON envelope to stdout and nothing\n * else. Exit codes are identical on both paths; only the stdout shape differs.\n */\nexport function emitSuccess(\n io: Io,\n command: string,\n data: unknown,\n humanLines: string[] = [],\n opts: EmitOptions = {},\n): void {\n if (humanMode(io, opts)) {\n writeLines(io.stdout, humanLines);\n return;\n }\n writeJson(io.stdout, buildSuccessEnvelope(command, data));\n}\n\n/**\n * The failure half of the same contract: at a TTY without `--json`, a red error\n * line plus a `fix` line to stdout and no envelope; otherwise exactly one failure\n * envelope to stdout. Accepts a CliError or any thrown value (non-CliError\n * normalizes to INTERNAL). Returns the normalized CliError so the caller reads its\n * `exitCode`.\n */\nexport function emitFailure(\n io: Io,\n command: string,\n err: unknown,\n opts: EmitOptions = {},\n): CliError {\n const cliErr = normalizeError(err);\n if (humanMode(io, opts)) {\n // Error messages can embed server-sourced text (api error passthrough) and\n // never carry intentional ANSI, so sanitize before painting.\n const lines = [paint(io, 'red', `error: ${sanitizeForTerminal(cliErr.message)}`)];\n if (cliErr.fix !== undefined) {\n lines.push(paint(io, 'dim', `fix: ${sanitizeForTerminal(cliErr.fix)}`));\n }\n // Scan findings are the one detail shape a human needs inline: without them an\n // interactive publish hitting NEEDS_CONFIRMATION / PUBLISH_BLOCKED sees the\n // count but not WHICH lines tripped. Every other details shape stays machine-only.\n lines.push(...findingLines(io, cliErr.details));\n writeLines(io.stdout, lines);\n return cliErr;\n }\n writeJson(io.stdout, buildFailureEnvelope(command, cliErr));\n return cliErr;\n}\n\n/**\n * One dim advisory line on stderr, human mode only. This is for facts that belong\n * to NO command's result — an unreadable spend ledger, a newer release on npm —\n * so they can never join the envelope on stdout or reach a machine consumer at\n * all. Sanitized here rather than by each caller: what these lines quote (a\n * registry version string, a parse error) is not the command's own prose.\n */\nexport function emitNotice(io: Io, text: string, opts: EmitOptions = {}): void {\n if (!humanMode(io, opts)) return;\n io.stderr.write(`${paint(io, 'dim', sanitizeForTerminal(text))}\\n`);\n}\n\n/**\n * The same dim stderr line, delivered whatever the surface is: no TTY gate and no\n * `--json` gate. Only for an advisory that reports a WRITE to the operator's own\n * files, where a piped or agent-driven run is precisely the case that must not\n * have it happen in silence. stdout is untouched either way, so the exactly-one\n * JSON object contract is unaffected.\n */\nexport function emitWriteNotice(io: Io, text: string): void {\n io.stderr.write(`${paint(io, 'dim', sanitizeForTerminal(text))}\\n`);\n}\n\n/**\n * Strip ANSI escape sequences, C0/C1 control characters, Unicode bidirectional\n * formatting, and invisible tag/BOM characters from a string headed for a\n * terminal. Commands apply this to every SERVER-sourced string (titles,\n * handles) they put into human lines or the buy confirm prompt; without it a\n * malicious deployment could use cursor-movement escapes to overwrite the very\n * price a human is being asked to confirm, a right-to-left override to reorder\n * that same line on screen into one that reads as a different price, or tag\n * characters to carry a payload that draws as nothing at all. It is not\n * applied to whole human lines here because trusted callers (doctor) paint\n * their own ANSI colors. JSON stdout is untouched: JSON.stringify escapes C0\n * controls itself, but the bidi and tag/BOM sets ride through it raw, and that\n * is deliberate rather than covered — the envelope is machine-read data whose\n * bytes must be what the server said, and a consumer reading codepoints is not\n * deceived by rendering order the way a human reading a drawn line is.\n */\nexport function sanitizeForTerminal(text: string): string {\n return (\n text\n // CSI/OSC/charset escape sequences first, then any stray ESC and the rest\n // of C0 (except \\t) plus DEL and the C1 range.\n // eslint-disable-next-line no-control-regex\n .replace(/\\x1b(?:\\[[0-9;?]*[ -/]*[@-~]|\\][^\\x07\\x1b]*(?:\\x07|\\x1b\\\\)|[@-Z\\\\-_])/g, '')\n // eslint-disable-next-line no-control-regex\n .replace(/[\\x00-\\x08\\x0a-\\x1f\\x7f-\\x9f]/g, '')\n // The UAX#9 directional formatting set: the marks (LRM/RLM/ALM), the\n // embeddings and overrides (U+202A-U+202E), and the isolates\n // (U+2066-U+2069). Removed, not escaped, so what a human reads is the\n // order the bytes are in. Deliberately this set and NOT all of category\n // Cf: U+200D (ZWJ) joins legitimate emoji sequences, and dropping it\n // would corrupt honest titles to defend against dishonest ones.\n .replace(/[\\u061c\\u200e\\u200f\\u202a-\\u202e\\u2066-\\u2069]/g, '')\n // The Unicode tag block (U+E0000-U+E007F) and the BOM/ZWNBSP, neither of\n // which has a legitimate mid-title use. Tag characters render as nothing\n // at all, so a payload spelled in them is invisible in the line a human\n // is reading and in the line they would paste back to report it.\n //\n // The three RGI subdivision flags are the exception and survive\n // byte-identical: they are ordinary title content. The whitelist is those\n // three sequences and NOT \"any well-formed tag sequence\", because a\n // non-RGI sequence draws as a bare black flag with the payload hidden\n // behind it, which is the exact channel this closes.\n //\n // Kept for the same reason as ZWJ above: U+200B (ZWSP) hints line breaks\n // in CJK and U+200C (ZWNJ) is orthographically required in Persian, so\n // stripping them would corrupt honest titles to defend against dishonest\n // ones.\n .replace(\n /(\\u{1F3F4}\\u{E0067}\\u{E0062}(?:\\u{E0065}\\u{E006E}\\u{E0067}|\\u{E0073}\\u{E0063}\\u{E0074}|\\u{E0077}\\u{E006C}\\u{E0073})\\u{E007F})|[\\u{E0000}-\\u{E007F}\\u{FEFF}]/gu,\n (_match, rgiFlag: string | undefined) => rgiFlag ?? '',\n )\n );\n}\n\n/** CliError passes through; every other thrown value becomes an INTERNAL CliError. */\nexport function normalizeError(err: unknown): CliError {\n if (err instanceof CliError) return err;\n if (err instanceof Error) return new CliError('INTERNAL', err.message, { cause: err });\n return new CliError('INTERNAL', 'Unexpected error', { details: err });\n}\n\n/** True in human-first mode: a TTY without --json. Otherwise the JSON envelope wins. */\nfunction humanMode(io: Io, opts: EmitOptions): boolean {\n return io.isTTY && opts.json !== true;\n}\n\n/**\n * Render `details.findings` (the scan-finding projection publish attaches to\n * NEEDS_CONFIRMATION / PUBLISH_BLOCKED) as one dim line per finding:\n * ` <check> (line N): <excerpt>`. The excerpt is already masked for secret\n * findings at the source; sanitize it anyway since it can echo file content.\n * Returns [] for any other details shape, so no other error leaks a detail dump.\n */\nfunction findingLines(io: Io, details: unknown): string[] {\n if (typeof details !== 'object' || details === null || !('findings' in details)) return [];\n const { findings } = details as { findings: unknown };\n if (!Array.isArray(findings) || findings.length === 0) return [];\n const rendered: string[] = [];\n for (const f of findings) {\n if (typeof f !== 'object' || f === null) continue;\n const { check, line, excerpt } = f as { check?: unknown; line?: unknown; excerpt?: unknown };\n if (typeof check !== 'string' || typeof line !== 'number' || typeof excerpt !== 'string') {\n continue;\n }\n rendered.push(paint(io, 'dim', ` ${check} (line ${line}): ${sanitizeForTerminal(excerpt)}`));\n }\n return rendered;\n}\n\nfunction writeJson(stream: NodeJS.WritableStream, value: unknown): void {\n stream.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nfunction writeLines(stream: NodeJS.WritableStream, lines: string[]): void {\n if (lines.length > 0) stream.write(`${lines.join('\\n')}\\n`);\n}\n\n/**\n * Color a human line for stdout (the human surface now). styleText emits ANSI only\n * when the target stream is color-capable (a real TTY with color depth) and honors\n * NO_COLOR/FORCE_COLOR natively. The `stream` option is passed only when stdout is\n * a genuine Stream; a test/redirected sink is not one, so it falls back to the\n * default capability check and comes out plain.\n */\nfunction paint(io: Io, format: Parameters<typeof styleText>[0], text: string): string {\n if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });\n return styleText(format, text);\n}\n","import { z } from 'zod';\n\n/**\n * Bumped only on a breaking change to any stdout envelope shape. Agents pin on\n * this: a consumer that sees an unexpected value should refuse to parse rather\n * than guess. Every envelope carries it, success or failure.\n */\nexport const SCHEMA_VERSION = 1;\n\n/**\n * The closed set of machine error codes. `error.code` in a failure envelope is\n * always one of these; agents branch on it, humans read `message`/`fix`. The\n * exit-code mapping lives in lib/errors.ts (this enum is the single source of\n * the code names both sides agree on).\n */\nexport const ErrorCodeSchema = z.enum([\n 'NODE_UNSUPPORTED',\n 'USAGE',\n 'CONFIG_INVALID',\n 'WALLET_EXISTS',\n 'WALLET_MISSING',\n 'WALLET_INVALID_KEY',\n 'PROVIDER_ERROR',\n 'RPC_ERROR',\n 'API_UNREACHABLE',\n 'CONTRACT_MISMATCH',\n 'REFUSED',\n 'NETWORK_ERROR',\n 'INTERNAL',\n 'NOT_IMPLEMENTED',\n // B2 (search/inspect/buy/outcome): a policy refusal (exit 3) has its own code\n // so an agent can distinguish a spend-cap block from a generic REFUSED; a\n // payment that failed after approval (exit 4) is PAYMENT_FAILED; the read\n // route's own coded failures (402 preview parse, 409 gate) surface as these.\n 'POLICY_REFUSED',\n 'PAYMENT_FAILED',\n 'RESOURCE_NOT_FOUND',\n 'SEARCH_NOT_FOUND',\n // A 429 from the anonymous search/outcome/read limits; error.details carries\n // retryAfterSeconds so a looping agent can back off instead of hammering.\n 'RATE_LIMITED',\n // B3 (publish): a publish that needs the human's yes (exit 3) — soft scan\n // findings, or `review` mode always. NEEDS_CONFIRMATION clears with --yes;\n // PUBLISH_BLOCKED is a hard-block finding (a live secret) that no mode or --yes\n // ever clears. PUBLISH_FAILED (exit 4) is a write that failed AFTER approval,\n // mirroring PAYMENT_FAILED's post-decision failure class.\n 'NEEDS_CONFIRMATION',\n 'PUBLISH_BLOCKED',\n 'PUBLISH_FAILED',\n // A send that reverted or produced no receipt AFTER the human approved it and\n // it was broadcast (exit 4), same post-decision class as PAYMENT_FAILED.\n 'SEND_FAILED',\n]);\nexport type ErrorCode = z.infer<typeof ErrorCodeSchema>;\n\n/**\n * All money in machine output is dual-form: `atomic` is the 6-decimal USDC base\n * unit as a decimal string (never a JS number — precision), `usd` is the same\n * value formatted as decimal dollars. Emit both so agents compute on `atomic`\n * and humans read `usd` without either side re-deriving the other.\n */\nexport const MoneySchema = z.object({\n atomic: z.string(),\n usd: z.string(),\n});\nexport type Money = z.infer<typeof MoneySchema>;\n\nexport const OutputErrorSchema = z.object({\n code: ErrorCodeSchema,\n message: z.string(),\n fix: z.string().optional(),\n details: z.unknown().optional(),\n});\nexport type OutputError = z.infer<typeof OutputErrorSchema>;\n\nexport const SuccessEnvelopeSchema = z.object({\n schemaVersion: z.literal(SCHEMA_VERSION),\n command: z.string(),\n ok: z.literal(true),\n data: z.unknown(),\n});\nexport type SuccessEnvelope = z.infer<typeof SuccessEnvelopeSchema>;\n\nexport const FailureEnvelopeSchema = z.object({\n schemaVersion: z.literal(SCHEMA_VERSION),\n command: z.string(),\n ok: z.literal(false),\n error: OutputErrorSchema,\n});\nexport type FailureEnvelope = z.infer<typeof FailureEnvelopeSchema>;\n\n/** The one thing every invocation prints to stdout, discriminated on `ok`. */\nexport const OutputEnvelopeSchema = z.discriminatedUnion('ok', [\n SuccessEnvelopeSchema,\n FailureEnvelopeSchema,\n]);\nexport type OutputEnvelope = z.infer<typeof OutputEnvelopeSchema>;\n"],"mappings":";;;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;;;ACMhB,IAAM,iBAAiB;AAQvB,IAAM,kBAAkB,iBAAE,KAAK;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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AO,MAAM,CAAC,CAAC;AAAA,CAAI;AACpD;AAEA,SAAS,WAAW,QAA+B,OAAuB;AACxE,MAAI,MAAM,SAAS,EAAG,QAAO,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;AAAA,CAAI;AAC5D;AASA,SAAS,MAAM,IAAQ,QAAyC,MAAsB;AACpF,MAAI,GAAG,kBAAkB,OAAQ,QAAO,UAAU,QAAQ,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;AACrF,SAAO,UAAU,QAAQ,IAAI;AAC/B;","names":[]}
|
|
@@ -1,121 +1,13 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
4
|
-
import * as nc from "crypto";
|
|
5
|
-
var crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
|
|
6
|
-
|
|
7
|
-
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
|
|
8
|
-
function isBytes(a) {
|
|
9
|
-
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
10
|
-
}
|
|
11
|
-
function anumber(n) {
|
|
12
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
13
|
-
throw new Error("positive integer expected, got " + n);
|
|
14
|
-
}
|
|
15
|
-
function abytes(b, ...lengths) {
|
|
16
|
-
if (!isBytes(b))
|
|
17
|
-
throw new Error("Uint8Array expected");
|
|
18
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
19
|
-
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
20
|
-
}
|
|
21
|
-
function ahash(h) {
|
|
22
|
-
if (typeof h !== "function" || typeof h.create !== "function")
|
|
23
|
-
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
24
|
-
anumber(h.outputLen);
|
|
25
|
-
anumber(h.blockLen);
|
|
26
|
-
}
|
|
27
|
-
function aexists(instance, checkFinished = true) {
|
|
28
|
-
if (instance.destroyed)
|
|
29
|
-
throw new Error("Hash instance has been destroyed");
|
|
30
|
-
if (checkFinished && instance.finished)
|
|
31
|
-
throw new Error("Hash#digest() has already been called");
|
|
32
|
-
}
|
|
33
|
-
function aoutput(out, instance) {
|
|
34
|
-
abytes(out);
|
|
35
|
-
const min = instance.outputLen;
|
|
36
|
-
if (out.length < min) {
|
|
37
|
-
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function u32(arr) {
|
|
41
|
-
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
42
|
-
}
|
|
43
|
-
function clean(...arrays) {
|
|
44
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
45
|
-
arrays[i].fill(0);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function createView(arr) {
|
|
49
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
50
|
-
}
|
|
51
|
-
function rotr(word, shift) {
|
|
52
|
-
return word << 32 - shift | word >>> shift;
|
|
53
|
-
}
|
|
54
|
-
var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
55
|
-
function byteSwap(word) {
|
|
56
|
-
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
57
|
-
}
|
|
58
|
-
function byteSwap32(arr) {
|
|
59
|
-
for (let i = 0; i < arr.length; i++) {
|
|
60
|
-
arr[i] = byteSwap(arr[i]);
|
|
61
|
-
}
|
|
62
|
-
return arr;
|
|
63
|
-
}
|
|
64
|
-
var swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
65
|
-
function utf8ToBytes(str) {
|
|
66
|
-
if (typeof str !== "string")
|
|
67
|
-
throw new Error("string expected");
|
|
68
|
-
return new Uint8Array(new TextEncoder().encode(str));
|
|
69
|
-
}
|
|
70
|
-
function toBytes(data) {
|
|
71
|
-
if (typeof data === "string")
|
|
72
|
-
data = utf8ToBytes(data);
|
|
73
|
-
abytes(data);
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
function concatBytes(...arrays) {
|
|
77
|
-
let sum = 0;
|
|
78
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
79
|
-
const a = arrays[i];
|
|
80
|
-
abytes(a);
|
|
81
|
-
sum += a.length;
|
|
82
|
-
}
|
|
83
|
-
const res = new Uint8Array(sum);
|
|
84
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
85
|
-
const a = arrays[i];
|
|
86
|
-
res.set(a, pad);
|
|
87
|
-
pad += a.length;
|
|
88
|
-
}
|
|
89
|
-
return res;
|
|
90
|
-
}
|
|
91
|
-
var Hash = class {
|
|
92
|
-
};
|
|
93
|
-
function createHasher(hashCons) {
|
|
94
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
95
|
-
const tmp = hashCons();
|
|
96
|
-
hashC.outputLen = tmp.outputLen;
|
|
97
|
-
hashC.blockLen = tmp.blockLen;
|
|
98
|
-
hashC.create = () => hashCons();
|
|
99
|
-
return hashC;
|
|
100
|
-
}
|
|
101
|
-
function randomBytes(bytesLength = 32) {
|
|
102
|
-
if (crypto && typeof crypto.getRandomValues === "function") {
|
|
103
|
-
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
104
|
-
}
|
|
105
|
-
if (crypto && typeof crypto.randomBytes === "function") {
|
|
106
|
-
return Uint8Array.from(crypto.randomBytes(bytesLength));
|
|
107
|
-
}
|
|
108
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
3
|
// node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/utils.js
|
|
112
4
|
var _0n = /* @__PURE__ */ BigInt(0);
|
|
113
5
|
var _1n = /* @__PURE__ */ BigInt(1);
|
|
114
|
-
function
|
|
6
|
+
function isBytes(a) {
|
|
115
7
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
116
8
|
}
|
|
117
|
-
function
|
|
118
|
-
if (!
|
|
9
|
+
function abytes(item) {
|
|
10
|
+
if (!isBytes(item))
|
|
119
11
|
throw new Error("Uint8Array expected");
|
|
120
12
|
}
|
|
121
13
|
function abool(title, value) {
|
|
@@ -137,7 +29,7 @@ var hasHexBuiltin = (
|
|
|
137
29
|
);
|
|
138
30
|
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
139
31
|
function bytesToHex(bytes) {
|
|
140
|
-
|
|
32
|
+
abytes(bytes);
|
|
141
33
|
if (hasHexBuiltin)
|
|
142
34
|
return bytes.toHex();
|
|
143
35
|
let hex = "";
|
|
@@ -181,7 +73,7 @@ function bytesToNumberBE(bytes) {
|
|
|
181
73
|
return hexToNumber(bytesToHex(bytes));
|
|
182
74
|
}
|
|
183
75
|
function bytesToNumberLE(bytes) {
|
|
184
|
-
|
|
76
|
+
abytes(bytes);
|
|
185
77
|
return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
|
|
186
78
|
}
|
|
187
79
|
function numberToBytesBE(n, len) {
|
|
@@ -198,7 +90,7 @@ function ensureBytes(title, hex, expectedLength) {
|
|
|
198
90
|
} catch (e) {
|
|
199
91
|
throw new Error(title + " must be hex string or Uint8Array, cause: " + e);
|
|
200
92
|
}
|
|
201
|
-
} else if (
|
|
93
|
+
} else if (isBytes(hex)) {
|
|
202
94
|
res = Uint8Array.from(hex);
|
|
203
95
|
} else {
|
|
204
96
|
throw new Error(title + " must be hex string or Uint8Array");
|
|
@@ -208,11 +100,11 @@ function ensureBytes(title, hex, expectedLength) {
|
|
|
208
100
|
throw new Error(title + " of length " + expectedLength + " expected, got " + len);
|
|
209
101
|
return res;
|
|
210
102
|
}
|
|
211
|
-
function
|
|
103
|
+
function concatBytes(...arrays) {
|
|
212
104
|
let sum = 0;
|
|
213
105
|
for (let i = 0; i < arrays.length; i++) {
|
|
214
106
|
const a = arrays[i];
|
|
215
|
-
|
|
107
|
+
abytes(a);
|
|
216
108
|
sum += a.length;
|
|
217
109
|
}
|
|
218
110
|
const res = new Uint8Array(sum);
|
|
@@ -223,7 +115,15 @@ function concatBytes2(...arrays) {
|
|
|
223
115
|
}
|
|
224
116
|
return res;
|
|
225
117
|
}
|
|
226
|
-
function
|
|
118
|
+
function equalBytes(a, b) {
|
|
119
|
+
if (a.length !== b.length)
|
|
120
|
+
return false;
|
|
121
|
+
let diff = 0;
|
|
122
|
+
for (let i = 0; i < a.length; i++)
|
|
123
|
+
diff |= a[i] ^ b[i];
|
|
124
|
+
return diff === 0;
|
|
125
|
+
}
|
|
126
|
+
function utf8ToBytes(str) {
|
|
227
127
|
if (typeof str !== "string")
|
|
228
128
|
throw new Error("string expected");
|
|
229
129
|
return new Uint8Array(new TextEncoder().encode(str));
|
|
@@ -280,7 +180,7 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
280
180
|
out.push(sl);
|
|
281
181
|
len += v.length;
|
|
282
182
|
}
|
|
283
|
-
return
|
|
183
|
+
return concatBytes(...out);
|
|
284
184
|
};
|
|
285
185
|
const genUntil = (seed, pred) => {
|
|
286
186
|
reset();
|
|
@@ -298,7 +198,7 @@ var validatorFns = {
|
|
|
298
198
|
function: (val) => typeof val === "function",
|
|
299
199
|
boolean: (val) => typeof val === "boolean",
|
|
300
200
|
string: (val) => typeof val === "string",
|
|
301
|
-
stringOrUint8Array: (val) => typeof val === "string" ||
|
|
201
|
+
stringOrUint8Array: (val) => typeof val === "string" || isBytes(val),
|
|
302
202
|
isSafeInteger: (val) => Number.isSafeInteger(val),
|
|
303
203
|
array: (val) => Array.isArray(val),
|
|
304
204
|
field: (val, object) => object.Fp.isValid(val),
|
|
@@ -334,47 +234,9 @@ function memoized(fn) {
|
|
|
334
234
|
};
|
|
335
235
|
}
|
|
336
236
|
|
|
337
|
-
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js
|
|
338
|
-
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
339
|
-
var _32n = /* @__PURE__ */ BigInt(32);
|
|
340
|
-
function fromBig(n, le = false) {
|
|
341
|
-
if (le)
|
|
342
|
-
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
343
|
-
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
344
|
-
}
|
|
345
|
-
function split(lst, le = false) {
|
|
346
|
-
const len = lst.length;
|
|
347
|
-
let Ah = new Uint32Array(len);
|
|
348
|
-
let Al = new Uint32Array(len);
|
|
349
|
-
for (let i = 0; i < len; i++) {
|
|
350
|
-
const { h, l } = fromBig(lst[i], le);
|
|
351
|
-
[Ah[i], Al[i]] = [h, l];
|
|
352
|
-
}
|
|
353
|
-
return [Ah, Al];
|
|
354
|
-
}
|
|
355
|
-
var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
356
|
-
var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
357
|
-
var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
358
|
-
var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
359
|
-
|
|
360
237
|
export {
|
|
361
|
-
|
|
238
|
+
isBytes,
|
|
362
239
|
abytes,
|
|
363
|
-
ahash,
|
|
364
|
-
aexists,
|
|
365
|
-
aoutput,
|
|
366
|
-
u32,
|
|
367
|
-
clean,
|
|
368
|
-
createView,
|
|
369
|
-
rotr,
|
|
370
|
-
swap32IfBE,
|
|
371
|
-
toBytes,
|
|
372
|
-
concatBytes,
|
|
373
|
-
Hash,
|
|
374
|
-
createHasher,
|
|
375
|
-
randomBytes,
|
|
376
|
-
isBytes2 as isBytes,
|
|
377
|
-
abytes2,
|
|
378
240
|
abool,
|
|
379
241
|
numberToHexUnpadded,
|
|
380
242
|
bytesToHex,
|
|
@@ -384,27 +246,20 @@ export {
|
|
|
384
246
|
numberToBytesBE,
|
|
385
247
|
numberToBytesLE,
|
|
386
248
|
ensureBytes,
|
|
387
|
-
|
|
388
|
-
|
|
249
|
+
concatBytes,
|
|
250
|
+
equalBytes,
|
|
251
|
+
utf8ToBytes,
|
|
389
252
|
inRange,
|
|
390
253
|
aInRange,
|
|
391
254
|
bitLen,
|
|
392
255
|
bitMask,
|
|
393
256
|
createHmacDrbg,
|
|
394
257
|
validateObject,
|
|
395
|
-
memoized
|
|
396
|
-
split,
|
|
397
|
-
rotlSH,
|
|
398
|
-
rotlSL,
|
|
399
|
-
rotlBH,
|
|
400
|
-
rotlBL
|
|
258
|
+
memoized
|
|
401
259
|
};
|
|
402
260
|
/*! Bundled license information:
|
|
403
261
|
|
|
404
|
-
@noble/hashes/esm/utils.js:
|
|
405
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
406
|
-
|
|
407
262
|
@noble/curves/esm/abstract/utils.js:
|
|
408
263
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
409
264
|
*/
|
|
410
|
-
//# sourceMappingURL=chunk-
|
|
265
|
+
//# sourceMappingURL=chunk-RBJPAZFI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/src/abstract/utils.ts"],"sourcesContent":["/**\n * Hex, bytes and number utilities.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nexport type Hex = Uint8Array | string; // hex strings are accepted for simplicity\nexport type PrivKey = Hex | bigint; // bigints are accepted to ease learning curve\nexport type CHash = {\n (message: Uint8Array | string): Uint8Array;\n blockLen: number;\n outputLen: number;\n create(opts?: { dkLen?: number }): any; // For shake\n};\nexport type FHash = (message: Uint8Array | string) => Uint8Array;\n\nexport function isBytes(a: unknown): a is Uint8Array {\n return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n\nexport function abytes(item: unknown): void {\n if (!isBytes(item)) throw new Error('Uint8Array expected');\n}\n\nexport function abool(title: string, value: boolean): void {\n if (typeof value !== 'boolean') throw new Error(title + ' boolean expected, got ' + value);\n}\n\n// Used in weierstrass, der\nexport function numberToHexUnpadded(num: number | bigint): string {\n const hex = num.toString(16);\n return hex.length & 1 ? '0' + hex : hex;\n}\n\nexport function hexToNumber(hex: string): bigint {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian\n}\n\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin: boolean =\n // @ts-ignore\n typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function';\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin) return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const;\nfunction asciiToBase16(ch: number): number | undefined {\n if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n // @ts-ignore\n if (hasHexBuiltin) return Uint8Array.fromHex(hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes: Uint8Array): bigint {\n return hexToNumber(bytesToHex(bytes));\n}\nexport function bytesToNumberLE(bytes: Uint8Array): bigint {\n abytes(bytes);\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\n\nexport function numberToBytesBE(n: number | bigint, len: number): Uint8Array {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n: number | bigint, len: number): Uint8Array {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n: number | bigint): Uint8Array {\n return hexToBytes(numberToHexUnpadded(n));\n}\n\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title: string, hex: Hex, expectedLength?: number): Uint8Array {\n let res: Uint8Array;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n } catch (e) {\n throw new Error(title + ' must be hex string or Uint8Array, cause: ' + e);\n }\n } else if (isBytes(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n } else {\n throw new Error(title + ' must be hex string or Uint8Array');\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(title + ' of length ' + expectedLength + ' expected, got ' + len);\n return res;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\n// Compares 2 u8a-s in kinda constant time\nexport function equalBytes(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i];\n return diff === 0;\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\n// Is positive bigint\nconst isPosBig = (n: bigint) => typeof n === 'bigint' && _0n <= n;\n\nexport function inRange(n: bigint, min: bigint, max: bigint): boolean {\n return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n\n/**\n * Asserts min <= n < max. NOTE: It's < max and not <= max.\n * @example\n * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)\n */\nexport function aInRange(title: string, n: bigint, min: bigint, max: bigint): void {\n // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n // consider P=256n, min=0n, max=P\n // - a for min=0 would require -1: `inRange('x', x, -1n, P)`\n // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`\n // - our way is the cleanest: `inRange('x', x, 0n, P)\n if (!inRange(n, min, max))\n throw new Error('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);\n}\n\n// Bit operations\n\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n * TODO: merge with nLength in modular\n */\nexport function bitLen(n: bigint): number {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1);\n return len;\n}\n\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n: bigint, pos: number): bigint {\n return (n >> BigInt(pos)) & _1n;\n}\n\n/**\n * Sets single bit at position.\n */\nexport function bitSet(n: bigint, pos: number, value: boolean): bigint {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n}\n\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n: number): bigint => (_1n << BigInt(n)) - _1n;\n\n// DRBG\n\nconst u8n = (len: number) => new Uint8Array(len); // creates Uint8Array\nconst u8fr = (arr: ArrayLike<number>) => Uint8Array.from(arr); // another shortcut\ntype Pred<T> = (v: Uint8Array) => T | undefined;\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG<Key>(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg<T>(\n hashLen: number,\n qByteLen: number,\n hmacFn: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array\n): (seed: Uint8Array, predicate: Pred<T>) => T {\n if (typeof hashLen !== 'number' || hashLen < 2) throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2) throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function') throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b: Uint8Array[]) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n(0)) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0) return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000) throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out: Uint8Array[] = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed: Uint8Array, pred: Pred<T>): T => {\n reset();\n reseed(seed); // Steps D-G\n let res: T | undefined = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen()))) reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n\n// Validating curves and fields\n\nconst validatorFns = {\n bigint: (val: any): boolean => typeof val === 'bigint',\n function: (val: any): boolean => typeof val === 'function',\n boolean: (val: any): boolean => typeof val === 'boolean',\n string: (val: any): boolean => typeof val === 'string',\n stringOrUint8Array: (val: any): boolean => typeof val === 'string' || isBytes(val),\n isSafeInteger: (val: any): boolean => Number.isSafeInteger(val),\n array: (val: any): boolean => Array.isArray(val),\n field: (val: any, object: any): any => (object as any).Fp.isValid(val),\n hash: (val: any): boolean => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n} as const;\ntype Validator = keyof typeof validatorFns;\ntype ValMap<T extends Record<string, any>> = { [K in keyof T]?: Validator };\n// type Record<K extends string | number | symbol, T> = { [P in K]: T; }\n\nexport function validateObject<T extends Record<string, any>>(\n object: T,\n validators: ValMap<T>,\n optValidators: ValMap<T> = {}\n): T {\n const checkField = (fieldName: keyof T, type: Validator, isOptional: boolean) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function') throw new Error('invalid validator function');\n\n const val = object[fieldName as keyof typeof object];\n if (isOptional && val === undefined) return;\n if (!checkVal(val, object)) {\n throw new Error(\n 'param ' + String(fieldName) + ' is invalid. Expected ' + type + ', got ' + val\n );\n }\n };\n for (const [fieldName, type] of Object.entries(validators)) checkField(fieldName, type!, false);\n for (const [fieldName, type] of Object.entries(optValidators)) checkField(fieldName, type!, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n\n/**\n * throws not implemented error\n */\nexport const notImplemented = (): never => {\n throw new Error('not implemented');\n};\n\n/**\n * Memoizes (caches) computation result.\n * Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.\n */\nexport function memoized<T extends object, R, O extends any[]>(\n fn: (arg: T, ...args: O) => R\n): (arg: T, ...args: O) => R {\n const map = new WeakMap<T, R>();\n return (arg: T, ...args: O): R => {\n const val = map.get(arg);\n if (val !== undefined) return val;\n const computed = fn(arg, ...args);\n map.set(arg, computed);\n return computed;\n };\n}\n"],"mappings":";;;AAUA,IAAM,MAAsB,uBAAO,CAAC;AACpC,IAAM,MAAsB,uBAAO,CAAC;AAW9B,SAAU,QAAQ,GAAU;AAChC,SAAO,aAAa,cAAe,YAAY,OAAO,CAAC,KAAK,EAAE,YAAY,SAAS;AACrF;AAEM,SAAU,OAAO,MAAa;AAClC,MAAI,CAAC,QAAQ,IAAI;AAAG,UAAM,IAAI,MAAM,qBAAqB;AAC3D;AAEM,SAAU,MAAM,OAAe,OAAc;AACjD,MAAI,OAAO,UAAU;AAAW,UAAM,IAAI,MAAM,QAAQ,4BAA4B,KAAK;AAC3F;AAGM,SAAU,oBAAoB,KAAoB;AACtD,QAAM,MAAM,IAAI,SAAS,EAAE;AAC3B,SAAO,IAAI,SAAS,IAAI,MAAM,MAAM;AACtC;AAEM,SAAU,YAAY,KAAW;AACrC,MAAI,OAAO,QAAQ;AAAU,UAAM,IAAI,MAAM,8BAA8B,OAAO,GAAG;AACrF,SAAO,QAAQ,KAAK,MAAM,OAAO,OAAO,GAAG;AAC7C;AAGA,IAAM;;EAEJ,OAAO,WAAW,KAAK,CAAA,CAAE,EAAE,UAAU,cAAc,OAAO,WAAW,YAAY;;AAGnF,IAAM,QAAwB,sBAAM,KAAK,EAAE,QAAQ,IAAG,GAAI,CAAC,GAAG,MAC5D,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AAO3B,SAAU,WAAW,OAAiB;AAC1C,SAAO,KAAK;AAEZ,MAAI;AAAe,WAAO,MAAM,MAAK;AAErC,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,I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