tenjin-cli 0.1.0-alpha.2 → 0.1.0-alpha.4
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 +156 -185
- package/dist/{_esm-FEASBWRP.js → _esm-N4KAVXQR.js} +9 -9
- package/dist/buy-OOOLUDND.js +41 -0
- package/dist/candidate-TWCWTFGA.js +22 -0
- package/dist/{ccip-XR5NE5QK.js → ccip-RPPPKTJR.js} +5 -5
- package/dist/{ccip-NQXCEK2U.js → ccip-ZGGWQN4X.js} +4 -4
- package/dist/{chunk-XJIW7USF.js → chunk-333FOTUJ.js} +5 -5
- package/dist/{chunk-YALGASEU.js → chunk-47PP7TAG.js} +1610 -1610
- package/dist/chunk-47PP7TAG.js.map +1 -0
- package/dist/{buy-U35DQ6XM.js → chunk-4GR7DGD6.js} +23 -41
- package/dist/{buy-U35DQ6XM.js.map → chunk-4GR7DGD6.js.map} +1 -1
- package/dist/{chunk-27ONARHV.js → chunk-5JH7ZB6Z.js} +7 -7
- package/dist/{chunk-27ONARHV.js.map → chunk-5JH7ZB6Z.js.map} +1 -1
- package/dist/{chunk-OYMYCW7J.js → chunk-6WWVYYSB.js} +32 -2
- package/dist/{chunk-OYMYCW7J.js.map → chunk-6WWVYYSB.js.map} +1 -1
- package/dist/{chunk-UGX7YPX2.js → chunk-7FK2UN2T.js} +65 -65
- package/dist/{chunk-UGX7YPX2.js.map → chunk-7FK2UN2T.js.map} +1 -1
- package/dist/{chunk-IYLHQMT5.js → chunk-BXUS5UCT.js} +5 -4
- package/dist/chunk-BXUS5UCT.js.map +1 -0
- package/dist/{chunk-QNP7H47L.js → chunk-C4TIWOAM.js} +2 -2
- package/dist/{chunk-QNP7H47L.js.map → chunk-C4TIWOAM.js.map} +1 -1
- package/dist/{chunk-7PHSZKQS.js → chunk-CJU555P5.js} +24 -24
- package/dist/{chunk-7PHSZKQS.js.map → chunk-CJU555P5.js.map} +1 -1
- package/dist/{chunk-YN5SHIXQ.js → chunk-DPET3TW5.js} +2 -2
- package/dist/{chunk-TLCMMYLY.js → chunk-DPUMEMGM.js} +5 -5
- package/dist/chunk-DPUMEMGM.js.map +1 -0
- package/dist/{chunk-TFGSOPWR.js → chunk-EUQN3L5X.js} +9 -9
- package/dist/{chunk-TFGSOPWR.js.map → chunk-EUQN3L5X.js.map} +1 -1
- package/dist/{chunk-UPIEAMGH.js → chunk-FHB3VKZW.js} +6 -6
- package/dist/{chunk-UPIEAMGH.js.map → chunk-FHB3VKZW.js.map} +1 -1
- package/dist/{chunk-S3IGX57D.js → chunk-FU6MCSLG.js} +9 -9
- package/dist/{lookup-WYVTOMVY.js → chunk-H5ETJRQD.js} +54 -29
- package/dist/chunk-H5ETJRQD.js.map +1 -0
- package/dist/chunk-KXIX7YDV.js +59 -0
- package/dist/chunk-KXIX7YDV.js.map +1 -0
- package/dist/{chunk-5CLSD5YN.js → chunk-KYQVEKP5.js} +7 -7
- package/dist/{chunk-RRN3YTK7.js → chunk-KZAAWQNP.js} +3 -3
- package/dist/{chunk-NCE5NSN6.js → chunk-M2O56UK7.js} +158 -158
- package/dist/chunk-M2O56UK7.js.map +1 -0
- package/dist/{chunk-7KUW4MJD.js → chunk-MM4TGTST.js} +6 -6
- package/dist/{chunk-7KUW4MJD.js.map → chunk-MM4TGTST.js.map} +1 -1
- package/dist/{chunk-YIYQ2ZNT.js → chunk-NXCJN2FJ.js} +55 -28
- package/dist/chunk-NXCJN2FJ.js.map +1 -0
- package/dist/{candidate-RLYCQMF5.js → chunk-OJD54DIU.js} +15 -19
- package/dist/{candidate-RLYCQMF5.js.map → chunk-OJD54DIU.js.map} +1 -1
- package/dist/{chunk-ZABPQJ3M.js → chunk-POJRB2AE.js} +2 -2
- package/dist/{chunk-N62ROTMC.js → chunk-QH6677FJ.js} +5 -4
- package/dist/chunk-QH6677FJ.js.map +1 -0
- package/dist/{wallet-6QKS6UHW.js → chunk-R7BMDJZM.js} +15 -27
- package/dist/{wallet-6QKS6UHW.js.map → chunk-R7BMDJZM.js.map} +1 -1
- package/dist/{chunk-Z6MFJV5Z.js → chunk-S3KZ3PPK.js} +15 -11
- package/dist/{chunk-Z6MFJV5Z.js.map → chunk-S3KZ3PPK.js.map} +1 -1
- package/dist/{chunk-CYOF7ROH.js → chunk-S5RYMCV6.js} +3 -3
- package/dist/{chunk-ZMHYXMO6.js → chunk-U5S527PP.js} +3 -3
- package/dist/{chunk-RY4XKNV3.js → chunk-UHTVXQ2O.js} +3 -3
- package/dist/{publish-D76B3MBK.js → chunk-ULLWHHIT.js} +25 -42
- package/dist/chunk-ULLWHHIT.js.map +1 -0
- package/dist/{chunk-Z52RA3NC.js → chunk-VV4P5RVK.js} +47 -20
- package/dist/chunk-VV4P5RVK.js.map +1 -0
- package/dist/{chunk-QVX5MWJZ.js → chunk-W6R3HAAG.js} +2 -2
- package/dist/{chunk-3OV7E5G5.js → chunk-WWX32ML4.js} +1 -1
- package/dist/{chunk-3OV7E5G5.js.map → chunk-WWX32ML4.js.map} +1 -1
- package/dist/{chunk-HIVZG55D.js → chunk-XJN5WUKL.js} +2 -2
- package/dist/{chunk-JPHG2JW3.js → chunk-XNNOR7F7.js} +25 -25
- package/dist/chunk-XNNOR7F7.js.map +1 -0
- package/dist/{inspect-JGYJWFDP.js → chunk-YFREUEUI.js} +8 -26
- package/dist/{inspect-JGYJWFDP.js.map → chunk-YFREUEUI.js.map} +1 -1
- package/dist/{chunk-HSDCI7OV.js → chunk-YLYINX2H.js} +3 -3
- package/dist/{cli-4NNBEQYH.js → cli-AFSLAKR6.js} +47 -36
- package/dist/{cli-4NNBEQYH.js.map → cli-AFSLAKR6.js.map} +1 -1
- package/dist/{config-2VSXWWHK.js → config-DBEEM3UA.js} +5 -5
- package/dist/{doctor-JJPNIBYH.js → doctor-XDA3YU6H.js} +7 -7
- package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-WHYKB6HA.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/inspect-YBGDAG47.js +33 -0
- package/dist/install-7J6KKEEP.js +542 -0
- package/dist/install-7J6KKEEP.js.map +1 -0
- package/dist/outcome-ZFGHX2XW.js +20 -0
- package/dist/publish-IH7RJXGB.js +36 -0
- package/dist/publish-IH7RJXGB.js.map +1 -0
- package/dist/run-DCZFEW2C.js +16806 -0
- package/dist/run-DCZFEW2C.js.map +1 -0
- package/dist/search-R6NIQFXI.js +24 -0
- package/dist/search-R6NIQFXI.js.map +1 -0
- package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-XRPVBC6V.js} +3 -3
- package/dist/secp256k1-XRPVBC6V.js.map +1 -0
- package/dist/usdc-AU6ZIKA6.js +22 -0
- package/dist/usdc-AU6ZIKA6.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-TUQJBMHM.js} +5 -5
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
- package/dist/{wallet-PA54CRBL.js → wallet-HKG3GSTX.js} +10 -10
- package/dist/wallet-HKG3GSTX.js.map +1 -0
- package/dist/wallet-UWHSHWC6.js +31 -0
- package/dist/wallet-UWHSHWC6.js.map +1 -0
- package/package.json +4 -3
- package/skills/tenjin/SKILL.md +56 -13
- package/skills/tenjin-publish/SKILL.md +57 -27
- package/skills/tenjin-search/SKILL.md +57 -31
- package/dist/chunk-IYLHQMT5.js.map +0 -1
- package/dist/chunk-JPHG2JW3.js.map +0 -1
- package/dist/chunk-N62ROTMC.js.map +0 -1
- package/dist/chunk-NCE5NSN6.js.map +0 -1
- package/dist/chunk-TLCMMYLY.js.map +0 -1
- package/dist/chunk-YALGASEU.js.map +0 -1
- package/dist/chunk-YIYQ2ZNT.js.map +0 -1
- package/dist/chunk-Z52RA3NC.js.map +0 -1
- package/dist/install-ZQRMSRGW.js +0 -378
- package/dist/install-ZQRMSRGW.js.map +0 -1
- package/dist/lookup-WYVTOMVY.js.map +0 -1
- package/dist/outcome-HKKT6QIA.js +0 -66
- package/dist/outcome-HKKT6QIA.js.map +0 -1
- package/dist/publish-D76B3MBK.js.map +0 -1
- package/dist/usdc-JIAJW4SV.js +0 -22
- /package/dist/{_esm-FEASBWRP.js.map → _esm-N4KAVXQR.js.map} +0 -0
- /package/dist/{ccip-NQXCEK2U.js.map → buy-OOOLUDND.js.map} +0 -0
- /package/dist/{ccip-XR5NE5QK.js.map → candidate-TWCWTFGA.js.map} +0 -0
- /package/dist/{config-2VSXWWHK.js.map → ccip-RPPPKTJR.js.map} +0 -0
- /package/dist/{doctor-JJPNIBYH.js.map → ccip-ZGGWQN4X.js.map} +0 -0
- /package/dist/{chunk-XJIW7USF.js.map → chunk-333FOTUJ.js.map} +0 -0
- /package/dist/{chunk-YN5SHIXQ.js.map → chunk-DPET3TW5.js.map} +0 -0
- /package/dist/{chunk-S3IGX57D.js.map → chunk-FU6MCSLG.js.map} +0 -0
- /package/dist/{chunk-5CLSD5YN.js.map → chunk-KYQVEKP5.js.map} +0 -0
- /package/dist/{chunk-RRN3YTK7.js.map → chunk-KZAAWQNP.js.map} +0 -0
- /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POJRB2AE.js.map} +0 -0
- /package/dist/{chunk-CYOF7ROH.js.map → chunk-S5RYMCV6.js.map} +0 -0
- /package/dist/{chunk-ZMHYXMO6.js.map → chunk-U5S527PP.js.map} +0 -0
- /package/dist/{chunk-RY4XKNV3.js.map → chunk-UHTVXQ2O.js.map} +0 -0
- /package/dist/{chunk-QVX5MWJZ.js.map → chunk-W6R3HAAG.js.map} +0 -0
- /package/dist/{chunk-HIVZG55D.js.map → chunk-XJN5WUKL.js.map} +0 -0
- /package/dist/{chunk-HSDCI7OV.js.map → chunk-YLYINX2H.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → config-DBEEM3UA.js.map} +0 -0
- /package/dist/{secp256k1-N3ZHU7LB.js.map → doctor-XDA3YU6H.js.map} +0 -0
- /package/dist/{usdc-JIAJW4SV.js.map → ethersCompat-Df4a6QIZ-WHYKB6HA.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → inspect-YBGDAG47.js.map} +0 -0
- /package/dist/{wallet-PA54CRBL.js.map → outcome-ZFGHX2XW.js.map} +0 -0
|
@@ -3,32 +3,27 @@ import {
|
|
|
3
3
|
createCandidate,
|
|
4
4
|
dropCandidate,
|
|
5
5
|
listCandidates
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DPUMEMGM.js";
|
|
7
7
|
import {
|
|
8
8
|
UUID_RE
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WWX32ML4.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeForTerminal
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VV4P5RVK.js";
|
|
13
13
|
import {
|
|
14
14
|
pathExists
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-IYLHQMT5.js";
|
|
17
|
-
import "./chunk-2I4QTOLB.js";
|
|
18
|
-
import "./chunk-UO22YNY4.js";
|
|
19
|
-
import "./chunk-MUBUQVC3.js";
|
|
15
|
+
} from "./chunk-FHB3VKZW.js";
|
|
20
16
|
import {
|
|
21
17
|
CliError
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-ZXTAQYNA.js";
|
|
18
|
+
} from "./chunk-6WWVYYSB.js";
|
|
24
19
|
|
|
25
20
|
// src/commands/candidate.ts
|
|
26
21
|
import { readFile } from "fs/promises";
|
|
27
22
|
import { dirname, join, resolve } from "path";
|
|
28
23
|
async function runCandidateAdd(args, ctx, deps = {}) {
|
|
29
|
-
if (!UUID_RE.test(args.
|
|
30
|
-
throw new CliError("USAGE", `Invalid --
|
|
31
|
-
fix: "Pass the
|
|
24
|
+
if (!UUID_RE.test(args.searchId)) {
|
|
25
|
+
throw new CliError("USAGE", `Invalid --search-id: ${JSON.stringify(args.searchId)}.`, {
|
|
26
|
+
fix: "Pass the searchId from a prior `tenjin search` (a uuid)."
|
|
32
27
|
});
|
|
33
28
|
}
|
|
34
29
|
if (args.question !== void 0 && args.question.length > 200) {
|
|
@@ -50,7 +45,7 @@ async function runCandidateAdd(args, ctx, deps = {}) {
|
|
|
50
45
|
const created = (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
|
|
51
46
|
const record = await createCandidate(ctx.dataDir, {
|
|
52
47
|
draft,
|
|
53
|
-
|
|
48
|
+
searchId: args.searchId,
|
|
54
49
|
...args.question !== void 0 ? { question: args.question } : {},
|
|
55
50
|
created,
|
|
56
51
|
sourceProject
|
|
@@ -59,7 +54,7 @@ async function runCandidateAdd(args, ctx, deps = {}) {
|
|
|
59
54
|
data: {
|
|
60
55
|
id: record.id,
|
|
61
56
|
path: record.dir,
|
|
62
|
-
|
|
57
|
+
searchId: record.meta.searchId,
|
|
63
58
|
...record.meta.question !== void 0 ? { question: record.meta.question } : {},
|
|
64
59
|
created: record.meta.created,
|
|
65
60
|
sourceProject: record.meta.sourceProject
|
|
@@ -72,7 +67,7 @@ async function runCandidateList(ctx, deps = {}) {
|
|
|
72
67
|
const records = await listCandidates(ctx.dataDir);
|
|
73
68
|
const candidates = records.map((r) => ({
|
|
74
69
|
id: r.id,
|
|
75
|
-
|
|
70
|
+
searchId: r.meta.searchId,
|
|
76
71
|
...r.meta.question !== void 0 ? { question: r.meta.question } : {},
|
|
77
72
|
created: r.meta.created,
|
|
78
73
|
sourceProject: r.meta.sourceProject,
|
|
@@ -119,9 +114,10 @@ function humanizeAge(iso, now) {
|
|
|
119
114
|
if (ms < DAY) return `${Math.floor(ms / HOUR)}h ago`;
|
|
120
115
|
return `${Math.floor(ms / DAY)}d ago`;
|
|
121
116
|
}
|
|
117
|
+
|
|
122
118
|
export {
|
|
123
119
|
runCandidateAdd,
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
runCandidateList,
|
|
121
|
+
runCandidateDrop
|
|
126
122
|
};
|
|
127
|
-
//# sourceMappingURL=
|
|
123
|
+
//# sourceMappingURL=chunk-OJD54DIU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/candidate.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { dirname, join, resolve } from 'node:path';\nimport { CliError } from '../lib/errors';\nimport { createCandidate, dropCandidate, listCandidates } from '../lib/candidate-store';\nimport { UUID_RE } from '../lib/ids';\nimport { sanitizeForTerminal } from '../lib/output';\nimport { pathExists } from '../lib/settings';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin candidate [add|list|drop]`: the D40 local store of parked publish\n * drafts. Entirely offline — a candidate never touches the network and never\n * uploads; only a later `tenjin publish --candidate <id>` sends it, under the\n * D38 consent scan. This module owns the command surface; lib/candidate-store.ts\n * owns the on-disk custody (0700 dirs, 0600 files, atomic meta commit).\n */\n\nexport interface CandidateAddArgs {\n file: string;\n
|
|
1
|
+
{"version":3,"sources":["../src/commands/candidate.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { dirname, join, resolve } from 'node:path';\nimport { CliError } from '../lib/errors';\nimport { createCandidate, dropCandidate, listCandidates } from '../lib/candidate-store';\nimport { UUID_RE } from '../lib/ids';\nimport { sanitizeForTerminal } from '../lib/output';\nimport { pathExists } from '../lib/settings';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin candidate [add|list|drop]`: the D40 local store of parked publish\n * drafts. Entirely offline — a candidate never touches the network and never\n * uploads; only a later `tenjin publish --candidate <id>` sends it, under the\n * D38 consent scan. This module owns the command surface; lib/candidate-store.ts\n * owns the on-disk custody (0700 dirs, 0600 files, atomic meta commit).\n */\n\nexport interface CandidateAddArgs {\n file: string;\n searchId: string;\n question?: string;\n}\n\nexport interface CandidateDeps {\n /** Clock seam so list ordering / age tests are deterministic. */\n now?: () => Date;\n /** cwd seam so sourceProject discovery is testable against a temp tree. */\n cwd?: string;\n}\n\nexport async function runCandidateAdd(\n args: CandidateAddArgs,\n ctx: CommandContext,\n deps: CandidateDeps = {},\n): Promise<CommandResult> {\n if (!UUID_RE.test(args.searchId)) {\n throw new CliError('USAGE', `Invalid --search-id: ${JSON.stringify(args.searchId)}.`, {\n fix: 'Pass the searchId from a prior `tenjin search` (a uuid).',\n });\n }\n // Cap the question at the server's questionsAnswered item bound (200) at PARK\n // time, so a candidate can never be born unpublishable — it prefills the card's\n // questionsAnswered, which publish would otherwise reject only at write time.\n if (args.question !== undefined && args.question.length > 200) {\n throw new CliError('USAGE', 'A candidate --question is at most 200 characters.', {\n fix: 'Shorten the question to 200 characters or fewer.',\n });\n }\n\n let draft: string;\n try {\n draft = await readFile(args.file, 'utf8');\n } catch (err) {\n throw new CliError('USAGE', `Cannot read draft file ${JSON.stringify(args.file)}.`, {\n fix: 'Pass a path to a readable Markdown file.',\n cause: err,\n });\n }\n\n const cwd = deps.cwd ?? process.cwd();\n const sourceProject = await repoRootOrCwd(cwd);\n const created = (deps.now?.() ?? new Date()).toISOString();\n\n const record = await createCandidate(ctx.dataDir, {\n draft,\n searchId: args.searchId,\n ...(args.question !== undefined ? { question: args.question } : {}),\n created,\n sourceProject,\n });\n\n return {\n data: {\n id: record.id,\n path: record.dir,\n searchId: record.meta.searchId,\n ...(record.meta.question !== undefined ? { question: record.meta.question } : {}),\n created: record.meta.created,\n sourceProject: record.meta.sourceProject,\n },\n humanLines: [`Parked candidate ${record.id}`, ` ${record.dir}`],\n };\n}\n\nexport async function runCandidateList(\n ctx: CommandContext,\n deps: CandidateDeps = {},\n): Promise<CommandResult> {\n const now = deps.now?.() ?? new Date();\n const records = await listCandidates(ctx.dataDir);\n\n const candidates = records.map((r) => ({\n id: r.id,\n searchId: r.meta.searchId,\n ...(r.meta.question !== undefined ? { question: r.meta.question } : {}),\n created: r.meta.created,\n sourceProject: r.meta.sourceProject,\n path: r.dir,\n }));\n\n const humanLines =\n records.length === 0\n ? ['No pending candidates.']\n : records.map((r) => {\n const q =\n r.meta.question !== undefined ? sanitizeForTerminal(r.meta.question) : '(no question)';\n return `${r.id} ${humanizeAge(r.meta.created, now)} ${q} [${sanitizeForTerminal(\n r.meta.sourceProject,\n )}]`;\n });\n\n return { data: { candidates }, humanLines };\n}\n\nexport async function runCandidateDrop(\n args: { id: string },\n ctx: CommandContext,\n): Promise<CommandResult> {\n const dropped = await dropCandidate(ctx.dataDir, args.id);\n if (!dropped) {\n throw new CliError('USAGE', `No candidate with id ${JSON.stringify(args.id)}.`, {\n fix: 'Run `tenjin candidate list` to see pending candidate ids.',\n });\n }\n return {\n data: { id: args.id, dropped: true },\n humanLines: [`Dropped candidate ${args.id}.`],\n };\n}\n\n/**\n * The project a candidate was parked from: the nearest ancestor holding a `.git`\n * (inclusive), or the cwd when the add did not run inside a repo. Mirrors the\n * repo-root walk settings.ts uses to bound the `.tenjin.json` search.\n */\nasync function repoRootOrCwd(cwd: string): Promise<string> {\n let dir = resolve(cwd);\n for (;;) {\n if (await pathExists(join(dir, '.git'))) return dir;\n const parent = dirname(dir);\n if (parent === dir) return resolve(cwd);\n dir = parent;\n }\n}\n\nconst MINUTE = 60_000;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\n\n/**\n * Compact relative age for the human list (\"just now\", \"5m ago\", \"3d ago\"). A\n * future or unparseable timestamp degrades to \"just now\" rather than throwing;\n * the ISO value is always carried verbatim in the JSON data for machines.\n */\nfunction humanizeAge(iso: string, now: Date): string {\n const then = Date.parse(iso);\n if (Number.isNaN(then)) return 'just now';\n const ms = now.getTime() - then;\n if (ms < MINUTE) return 'just now';\n if (ms < HOUR) return `${Math.floor(ms / MINUTE)}m ago`;\n if (ms < DAY) return `${Math.floor(ms / HOUR)}h ago`;\n return `${Math.floor(ms / DAY)}d ago`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,MAAM,eAAe;AA6BvC,eAAsB,gBACpB,MACA,KACA,OAAsB,CAAC,GACC;AACxB,MAAI,CAAC,QAAQ,KAAK,KAAK,QA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D,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK,QAAO,QAAQ,GAAG;AACtC,UAAM;AAAA,EACR;AACF;AAEA,IAAM,SAAS;AACf,IAAM,OAAO,KAAK;AAClB,IAAM,MAAM,KAAK;AAOjB,SAAS,YAAY,KAAa,KAAmB;AACnD,QAAM,OAAO,KAAK,MAAM,GAAG;AAC3B,MAAI,OAAO,MAAM,IAAI,EAAG,QAAO;AAC/B,QAAM,KAAK,IAAI,QAAQ,IAAI;AAC3B,MAAI,KAAK,OAAQ,QAAO;AACxB,MAAI,KAAK,KAAM,QAAO,GAAG,KAAK,MAAM,KAAK,MAAM,CAAC;AAChD,MAAI,KAAK,IAAK,QAAO,GAAG,KAAK,MAAM,KAAK,IAAI,CAAC;AAC7C,SAAO,GAAG,KAAK,MAAM,KAAK,GAAG,CAAC;AAChC;","names":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
p,
|
|
6
6
|
r,
|
|
7
7
|
t
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YLYINX2H.js";
|
|
9
9
|
|
|
10
10
|
// node_modules/.pnpm/@signinwithethereum+siwe@4.2.0_viem@2.55.2_typescript@6.0.3_zod@4.4.3_/node_modules/@signinwithethereum/siwe/dist/ethersCompat-Df4a6QIZ.js
|
|
11
11
|
var a2 = "6492649264926492649264926492649264926492649264926492649264926492";
|
|
@@ -80,4 +80,4 @@ export {
|
|
|
80
80
|
c,
|
|
81
81
|
f
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-POJRB2AE.js.map
|
|
@@ -3,7 +3,7 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "tenjin-cli",
|
|
6
|
-
version: "0.1.0-alpha.
|
|
6
|
+
version: "0.1.0-alpha.4",
|
|
7
7
|
type: "module",
|
|
8
8
|
description: "Tenjin agent CLI for the x402 knowledge marketplace.",
|
|
9
9
|
license: "MIT",
|
|
@@ -54,13 +54,14 @@ var package_default = {
|
|
|
54
54
|
},
|
|
55
55
|
devDependencies: {
|
|
56
56
|
"@changesets/cli": "^2.31.1",
|
|
57
|
-
"@eslint/js": "^
|
|
57
|
+
"@eslint/js": "^10",
|
|
58
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
58
59
|
"@types/node": "^25",
|
|
59
60
|
"@x402/core": "2.17.0",
|
|
60
61
|
"@x402/evm": "2.17.0",
|
|
61
62
|
"@x402/extensions": "2.17.0",
|
|
62
63
|
commander: "^14.0.1",
|
|
63
|
-
eslint: "^
|
|
64
|
+
eslint: "^10",
|
|
64
65
|
"eslint-config-prettier": "^10",
|
|
65
66
|
ox: "0.14.30",
|
|
66
67
|
prettier: "^3",
|
|
@@ -76,4 +77,4 @@ var package_default = {
|
|
|
76
77
|
export {
|
|
77
78
|
package_default
|
|
78
79
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-QH6677FJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"tenjin-cli\",\n \"version\": \"0.1.0-alpha.4\",\n \"type\": \"module\",\n \"description\": \"Tenjin agent CLI for the x402 knowledge marketplace.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/BackTrackCo/tenjin-agent.git\"\n },\n \"homepage\": \"https://tenjin.blog/agents\",\n \"bugs\": \"https://github.com/BackTrackCo/tenjin-agent/issues\",\n \"keywords\": [\n \"x402\",\n \"usdc\",\n \"base\",\n \"ai-agents\",\n \"agent-payments\",\n \"mcp\",\n \"knowledge-marketplace\",\n \"micropayments\",\n \"claude\",\n \"codex\",\n \"cli\"\n ],\n \"bin\": {\n \"tenjin\": \"dist/index.js\"\n },\n \"engines\": {\n \"node\": \">=22\"\n },\n \"files\": [\n \"dist\",\n \"skills\",\n \"NOTICE.md\"\n ],\n \"packageManager\": \"pnpm@11.11.0\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"check\": \"pnpm run build && pnpm run test\",\n \"sync:skill\": \"node scripts/sync-skill.mjs\",\n \"pack-smoke\": \"bash scripts/pack-smoke.sh\",\n \"changeset\": \"changeset\",\n \"prepublishOnly\": \"pnpm run build\",\n \"prepare\": \"git config core.hooksPath .githooks || true\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.31.1\",\n \"@eslint/js\": \"^10\",\n \"@modelcontextprotocol/sdk\": \"1.29.0\",\n \"@types/node\": \"^25\",\n \"@x402/core\": \"2.17.0\",\n \"@x402/evm\": \"2.17.0\",\n \"@x402/extensions\": \"2.17.0\",\n \"commander\": \"^14.0.1\",\n \"eslint\": \"^10\",\n \"eslint-config-prettier\": \"^10\",\n \"ox\": \"0.14.30\",\n \"prettier\": \"^3\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^6\",\n \"typescript-eslint\": \"^8\",\n \"viem\": \"^2.53.1\",\n \"vitest\": \"^4.1.9\",\n \"zod\": \"^4.4.3\"\n }\n}\n"],"mappings":";;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,SAAW;AAAA,EACX,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,EACR,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,QAAU;AAAA,EACZ;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,EAClB,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,cAAc;AAAA,IACd,WAAa;AAAA,IACb,gBAAkB;AAAA,IAClB,SAAW;AAAA,EACb;AAAA,EACA,iBAAmB;AAAA,IACjB,mBAAmB;AAAA,IACnB,cAAc;AAAA,IACd,6BAA6B;AAAA,IAC7B,eAAe;AAAA,IACf,cAAc;AAAA,IACd,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,WAAa;AAAA,IACb,QAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,IAAM;AAAA,IACN,UAAY;AAAA,IACZ,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,KAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,42 +1,29 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
getUsdcBalance
|
|
4
|
-
} from "./chunk-XJIW7USF.js";
|
|
5
|
-
import {
|
|
6
|
-
loadRawConfig,
|
|
7
|
-
resolveSettings,
|
|
8
|
-
toMoney
|
|
9
|
-
} from "./chunk-IYLHQMT5.js";
|
|
10
2
|
import {
|
|
11
3
|
createLocalWallet,
|
|
12
4
|
describeWallet,
|
|
13
5
|
resolvePassphraseForCreate,
|
|
14
6
|
resolveWalletProvider
|
|
15
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S3KZ3PPK.js";
|
|
16
8
|
import {
|
|
17
9
|
walletFileExists
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-2I4QTOLB.js";
|
|
10
|
+
} from "./chunk-DPET3TW5.js";
|
|
20
11
|
import {
|
|
21
12
|
LockTimeoutError,
|
|
22
13
|
withFileLock
|
|
23
14
|
} from "./chunk-YBMMV4Y4.js";
|
|
24
|
-
import
|
|
25
|
-
|
|
15
|
+
import {
|
|
16
|
+
loadRawConfig,
|
|
17
|
+
resolveSettings,
|
|
18
|
+
toMoney
|
|
19
|
+
} from "./chunk-BXUS5UCT.js";
|
|
26
20
|
import {
|
|
27
21
|
CliError,
|
|
28
22
|
walletPath
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
import "./chunk-QVX5MWJZ.js";
|
|
34
|
-
import "./chunk-ZMHYXMO6.js";
|
|
35
|
-
import "./chunk-YALGASEU.js";
|
|
36
|
-
import "./chunk-HIVZG55D.js";
|
|
37
|
-
import "./chunk-RBJPAZFI.js";
|
|
38
|
-
import "./chunk-5CLSD5YN.js";
|
|
39
|
-
import "./chunk-ZXTAQYNA.js";
|
|
23
|
+
} from "./chunk-6WWVYYSB.js";
|
|
24
|
+
import {
|
|
25
|
+
getUsdcBalance
|
|
26
|
+
} from "./chunk-333FOTUJ.js";
|
|
40
27
|
|
|
41
28
|
// src/commands/wallet.ts
|
|
42
29
|
import { mkdir } from "fs/promises";
|
|
@@ -171,9 +158,10 @@ function hasEnvKey() {
|
|
|
171
158
|
const envKey = process.env.TENJIN_WALLET_KEY;
|
|
172
159
|
return envKey !== void 0 && envKey.length > 0;
|
|
173
160
|
}
|
|
161
|
+
|
|
174
162
|
export {
|
|
175
|
-
runWalletBalance,
|
|
176
163
|
runWalletCreate,
|
|
177
|
-
runWalletShow
|
|
164
|
+
runWalletShow,
|
|
165
|
+
runWalletBalance
|
|
178
166
|
};
|
|
179
|
-
//# sourceMappingURL=
|
|
167
|
+
//# sourceMappingURL=chunk-R7BMDJZM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/wallet.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { CliError } from '../lib/errors';\nimport { walletPath } from '../lib/paths';\nimport { withFileLock, LockTimeoutError } from '../lib/lock';\nimport { loadRawConfig, resolveSettings } from '../lib/config';\nimport { toMoney } from '../lib/money';\nimport { getUsdcBalance } from '../lib/usdc';\nimport {\n createLocalWallet,\n describeWallet,\n resolveWalletProvider,\n type ResolveWalletProviderOptions,\n} from '../lib/wallet';\nimport { walletFileExists } from '../lib/wallet/store';\nimport { resolvePassphraseForCreate, type PassphraseSource } from '../lib/wallet/passphrase';\nimport type { PassphraseOverrides } from '../lib/wallet/local';\nimport type { CommandContext, CommandResult } from '../context';\n\nconst FUNDING_LINE = 'Send USDC on Base. $5 covers ~50 typical resources.';\nconst KEY_STORAGE = 'encrypted (keystore v3, scrypt)';\nconst isWindows = process.platform === 'win32';\n\nexport interface WalletCreateOptions {\n /** Test seam for passphrase resolution (keychain exec, TTY prompt, platform). */\n passphrase?: PassphraseOverrides;\n}\n\nexport async function runWalletCreate(\n ctx: CommandContext,\n opts: WalletCreateOptions = {},\n): Promise<CommandResult> {\n const { address, walletPath: path, source } = await createWalletLocked(ctx.dataDir, opts);\n\n const warnings = custodyWarnings();\n return {\n data: {\n address,\n walletPath: path,\n provider: 'local',\n policyEnforcement: 'client-only',\n keyStorage: KEY_STORAGE,\n passphraseSource: source,\n warnings,\n },\n humanLines: [\n `Wallet created: ${address}`,\n `Key stored ${KEY_STORAGE}.`,\n passphraseNote(source),\n FUNDING_LINE,\n ...warnings,\n ],\n };\n}\n\n/**\n * Run the whole create critical section under a cross-process file lock: the\n * existence pre-check, the passphrase generate-and-store, and the no-clobber\n * write. Without the lock these interleave across two concurrent creates — each\n * generates a distinct passphrase and persists it to the OS store (which is\n * last-writer-wins on every platform) BEFORE the exclusive file write, so a\n * different process can win the file, orphaning the winning wallet from the\n * passphrase the store now holds (which then decrypts nothing, unrecoverably).\n * Serializing means the loser blocks until the winner commits, then trips\n * refuseIfWalletExists and exits WALLET_EXISTS having never generated or stored a\n * passphrase. The store-before-write ordering stays (it still guards the\n * single-process crash window), and the exclusive write stays the final authority.\n */\nasync function createWalletLocked(\n dir: string,\n opts: WalletCreateOptions,\n): Promise<{ address: string; walletPath: string; source: PassphraseSource }> {\n // Ensure the data dir exists so the lock's own mkdir has a parent on a fresh\n // install; the exclusive wallet write below re-ensures it at 0700 regardless.\n await mkdir(dir, { recursive: true, mode: 0o700 });\n const lockPath = join(dir, 'wallet.create.lock');\n try {\n return await withFileLock(lockPath, async () => {\n await refuseIfWalletExists(dir);\n const { passphrase, source } = await resolvePassphraseForCreate({\n env: process.env,\n dir,\n ...opts.passphrase,\n });\n const { address, walletPath: path } = await createLocalWallet(dir, passphrase);\n return { address, walletPath: path, source };\n });\n } catch (err) {\n // A lock timeout is not the user's error; surface it as INTERNAL with the one\n // manual step (there is no auto-steal), keeping the JSON error contract. Every\n // other error — notably the loser's WALLET_EXISTS — propagates unchanged.\n if (err instanceof LockTimeoutError) {\n throw new CliError('INTERNAL', err.message, {\n fix: `If no other tenjin process is running, remove ${lockPath} and retry.`,\n cause: err,\n });\n }\n throw err;\n }\n}\n\n/** Where the encryption passphrase lives, and what the user must remember. */\nfunction passphraseNote(source: PassphraseSource): string {\n switch (source) {\n case 'keychain':\n return 'Passphrase saved to your macOS keychain (service tenjin-cli); signing will be transparent on this machine.';\n case 'dpapi':\n return 'Passphrase saved to a DPAPI-encrypted file, readable only by you on this Windows machine; signing will be transparent here.';\n case 'secret-service':\n return 'Passphrase saved to your Linux keyring (Secret Service, service tenjin-cli); signing will be transparent on this machine.';\n case 'env':\n return 'Encrypted with TENJIN_WALLET_PASSPHRASE; keep that value to sign.';\n case 'prompt':\n return 'Remember your passphrase: it is required to sign and cannot be recovered.';\n }\n}\n\nexport async function runWalletShow(\n ctx: CommandContext,\n opts: ResolveWalletProviderOptions = {},\n): Promise<CommandResult> {\n const provider = resolveWalletProvider(ctx, opts);\n const desc = await describeWallet(provider);\n // Diagnostics are the provider's own: a remote provider reports no local file\n // path or perms warning, so `show` never contaminates a remote wallet's output\n // with a stale local wallet.json's state. keyStorage/passphraseSource are the\n // custody posture reported without decrypting or requiring a passphrase.\n const { walletPath: path, keyStorage, passphraseSource, warnings } = await provider.diagnostics();\n\n const humanLines = [`Address: ${desc.address}`, `Key source: ${desc.credentialSource}`];\n if (keyStorage !== undefined) humanLines.push(`Key storage: ${keyStorage}`);\n if (passphraseSource !== undefined) humanLines.push(`Passphrase: ${passphraseSource}`);\n humanLines.push(...warnings);\n\n return {\n data: {\n address: desc.address,\n provider: desc.provider,\n credentialSource: desc.credentialSource,\n policyEnforcement: desc.policyEnforcement,\n ...(path !== undefined ? { walletPath: path } : {}),\n ...(keyStorage !== undefined ? { keyStorage } : {}),\n ...(passphraseSource !== undefined ? { passphraseSource } : {}),\n warnings,\n },\n humanLines,\n };\n}\n\nexport async function runWalletBalance(\n ctx: CommandContext,\n opts: ResolveWalletProviderOptions = {},\n): Promise<CommandResult> {\n const provider = resolveWalletProvider(ctx, opts);\n const desc = await describeWallet(provider);\n\n const config = await loadRawConfig(ctx.dataDir);\n const rpcUrl = resolveSettings({\n config,\n flags: { baseUrl: ctx.flags.baseUrl },\n env: process.env,\n }).rpcUrl.value;\n\n let atomic: bigint;\n try {\n atomic = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n\n const balance = toMoney(atomic.toString());\n return {\n data: { address: desc.address, balance },\n humanLines: [`Balance: ${balance.usd} USDC on Base`],\n };\n}\n\n/** create refuses to overwrite: keys are non-recoverable and may hold funds. */\nasync function refuseIfWalletExists(dir: string): Promise<void> {\n if (!(await walletFileExists(dir))) return;\n const path = walletPath(dir);\n throw new CliError('WALLET_EXISTS', `A wallet already exists at ${path}.`, {\n fix: `Keys are non-recoverable; move it aside first (e.g. \\`mv ${path} ${path}.bak\\`) to create a new one.`,\n });\n}\n\nfunction custodyWarnings(): string[] {\n const warnings: string[] = [];\n if (hasEnvKey()) {\n warnings.push('TENJIN_WALLET_KEY is set and shadows this file at runtime.');\n }\n if (isWindows) {\n warnings.push('File permissions are not enforced on Windows; the key file is not restricted.');\n }\n return warnings;\n}\n\nfunction hasEnvKey(): boolean {\n const envKey = process.env.TENJIN_WALLET_KEY;\n return envKey !== undefined && envKey.length > 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,YAAY;AAkBrB,IAAM,eAAe;AACrB,IAAM,cAAc;AACpB,IAAM,YAAY,QAAQ,aAAa;AAOvC,eAAsB,gBACpB,KACA,OAA4B,CAAC,GACL;AACxB,QAAM,EAAE,SAAS,YAAY,MAAM,OAAO,IAAI,MAAM,mBAAmB,IAAI,SAAS,IAAI;AAExF,QAAM,WAAW,gBAAgB;AACjC,SAAO;AAAA,IACL,MAAM;AAAA,MACJ;AAAA,MACA,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,mBAAmB;AAAA,MACnB,YAAY;AAAA,MACZ,kBAAkB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,mBAAmB,OAAO;AAAA,MAC1B,cAAc,WAAW;AAAA,MACzB,eAAe,MAAM;AAAA,MACrB;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EACF;AACF;AAeA,eAAe,mBACb,KACA,MAC4E;AAG5E,QAAM,MAAM,KAAK,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACjD,QAAM,WAAW,KAAK,KAAK,oBAAoB;AAC/C,MAAI;AACF,WAAO,MAAM,aAAa,UAAU,YAAY;AAC9C,YAAM,qBAAqB,GAAG;AAC9B,YAAM,EAAE,YAAY,OAAO,IAAI,M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SAAO;AACT;AAEA,SAAS,YAAqB;AAC5B,QAAM,SAAS,QAAQ,IAAI;AAC3B,SAAO,WAAW,UAAa,OAAO,SAAS;AACjD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/wallet.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { CliError } from '../lib/errors';\nimport { walletPath } from '../lib/paths';\nimport { withFileLock, LockTimeoutError } from '../lib/lock';\nimport { loadRawConfig, resolveSettings } from '../lib/config';\nimport { toMoney } from '../lib/money';\nimport { getUsdcBalance } from '../lib/usdc';\nimport {\n createLocalWallet,\n describeWallet,\n resolveWalletProvider,\n type ResolveWalletProviderOptions,\n} from '../lib/wallet';\nimport { walletFileExists } from '../lib/wallet/store';\nimport { resolvePassphraseForCreate, type PassphraseSource } from '../lib/wallet/passphrase';\nimport type { PassphraseOverrides } from '../lib/wallet/local';\nimport type { CommandContext, CommandResult } from '../context';\n\nconst FUNDING_LINE = 'Send USDC on Base. $5 covers ~50 typical resources.';\nconst KEY_STORAGE = 'encrypted (keystore v3, scrypt)';\nconst isWindows = process.platform === 'win32';\n\nexport interface WalletCreateOptions {\n /** Test seam for passphrase resolution (keychain exec, TTY prompt, platform). */\n passphrase?: PassphraseOverrides;\n}\n\nexport async function runWalletCreate(\n ctx: CommandContext,\n opts: WalletCreateOptions = {},\n): Promise<CommandResult> {\n const { address, walletPath: path, source } = await createWalletLocked(ctx.dataDir, opts);\n\n const warnings = custodyWarnings();\n return {\n data: {\n address,\n walletPath: path,\n provider: 'local',\n policyEnforcement: 'client-only',\n keyStorage: KEY_STORAGE,\n passphraseSource: source,\n warnings,\n },\n humanLines: [\n `Wallet created: ${address}`,\n `Key stored ${KEY_STORAGE}.`,\n passphraseNote(source),\n FUNDING_LINE,\n ...warnings,\n ],\n };\n}\n\n/**\n * Run the whole create critical section under a cross-process file lock: the\n * existence pre-check, the passphrase generate-and-store, and the no-clobber\n * write. Without the lock these interleave across two concurrent creates — each\n * generates a distinct passphrase and persists it to the OS store (which is\n * last-writer-wins on every platform) BEFORE the exclusive file write, so a\n * different process can win the file, orphaning the winning wallet from the\n * passphrase the store now holds (which then decrypts nothing, unrecoverably).\n * Serializing means the loser blocks until the winner commits, then trips\n * refuseIfWalletExists and exits WALLET_EXISTS having never generated or stored a\n * passphrase. The store-before-write ordering stays (it still guards the\n * single-process crash window), and the exclusive write stays the final authority.\n */\nasync function createWalletLocked(\n dir: string,\n opts: WalletCreateOptions,\n): Promise<{ address: string; walletPath: string; source: PassphraseSource }> {\n // Ensure the data dir exists so the lock's own mkdir has a parent on a fresh\n // install; the exclusive wallet write below re-ensures it at 0700 regardless.\n await mkdir(dir, { recursive: true, mode: 0o700 });\n const lockPath = join(dir, 'wallet.create.lock');\n try {\n return await withFileLock(lockPath, async () => {\n await refuseIfWalletExists(dir);\n const { passphrase, source } = await resolvePassphraseForCreate({\n env: process.env,\n dir,\n ...opts.passphrase,\n });\n const { address, walletPath: path } = await createLocalWallet(dir, passphrase);\n return { address, walletPath: path, source };\n });\n } catch (err) {\n // A lock timeout is not the user's error; surface it as INTERNAL with the one\n // manual step (there is no auto-steal), keeping the JSON error contract. Every\n // other error — notably the loser's WALLET_EXISTS — propagates unchanged.\n if (err instanceof LockTimeoutError) {\n throw new CliError('INTERNAL', err.message, {\n fix: `If no other tenjin process is running, remove ${lockPath} and retry.`,\n cause: err,\n });\n }\n throw err;\n }\n}\n\n/** Where the encryption passphrase lives, and what the user must remember. */\nfunction passphraseNote(source: PassphraseSource): string {\n switch (source) {\n case 'keychain':\n return 'Passphrase saved to your macOS keychain (service tenjin-cli); signing will be transparent on this machine.';\n case 'dpapi':\n return 'Passphrase saved to a DPAPI-encrypted file, readable only by you on this Windows machine; signing will be transparent here.';\n case 'secret-service':\n return 'Passphrase saved to your Linux keyring (Secret Service, service tenjin-cli); signing will be transparent on this machine.';\n case 'env':\n return 'Encrypted with TENJIN_WALLET_PASSPHRASE; keep that value to sign.';\n case 'prompt':\n return 'Remember your passphrase: it is required to sign and cannot be recovered.';\n }\n}\n\nexport async function runWalletShow(\n ctx: CommandContext,\n opts: ResolveWalletProviderOptions = {},\n): Promise<CommandResult> {\n const provider = resolveWalletProvider(ctx, opts);\n const desc = await describeWallet(provider);\n // Diagnostics are the provider's own: a remote provider reports no local file\n // path or perms warning, so `show` never contaminates a remote wallet's output\n // with a stale local wallet.json's state. keyStorage/passphraseSource are the\n // custody posture reported without decrypting or requiring a passphrase.\n const { walletPath: path, keyStorage, passphraseSource, warnings } = await provider.diagnostics();\n\n const humanLines = [`Address: ${desc.address}`, `Key source: ${desc.credentialSource}`];\n if (keyStorage !== undefined) humanLines.push(`Key storage: ${keyStorage}`);\n if (passphraseSource !== undefined) humanLines.push(`Passphrase: ${passphraseSource}`);\n humanLines.push(...warnings);\n\n return {\n data: {\n address: desc.address,\n provider: desc.provider,\n credentialSource: desc.credentialSource,\n policyEnforcement: desc.policyEnforcement,\n ...(path !== undefined ? { walletPath: path } : {}),\n ...(keyStorage !== undefined ? { keyStorage } : {}),\n ...(passphraseSource !== undefined ? { passphraseSource } : {}),\n warnings,\n },\n humanLines,\n };\n}\n\nexport async function runWalletBalance(\n ctx: CommandContext,\n opts: ResolveWalletProviderOptions = {},\n): Promise<CommandResult> {\n const provider = resolveWalletProvider(ctx, opts);\n const desc = await describeWallet(provider);\n\n const config = await loadRawConfig(ctx.dataDir);\n const rpcUrl = resolveSettings({\n config,\n flags: { baseUrl: ctx.flags.baseUrl },\n env: process.env,\n }).rpcUrl.value;\n\n let atomic: bigint;\n try {\n atomic = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n\n const balance = toMoney(atomic.toString());\n return {\n data: { address: desc.address, balance },\n humanLines: [`Balance: ${balance.usd} USDC on Base`],\n };\n}\n\n/** create refuses to overwrite: keys are non-recoverable and may hold funds. */\nasync function refuseIfWalletExists(dir: string): Promise<void> {\n if (!(await walletFileExists(dir))) return;\n const path = walletPath(dir);\n throw new CliError('WALLET_EXISTS', `A wallet already exists at ${path}.`, {\n fix: `Keys are non-recoverable; move it aside first (e.g. \\`mv ${path} ${path}.bak\\`) to create a new one.`,\n });\n}\n\nfunction custodyWarnings(): string[] {\n const warnings: string[] = [];\n if (hasEnvKey()) {\n warnings.push('TENJIN_WALLET_KEY is set and shadows this file at runtime.');\n }\n if (isWindows) {\n warnings.push('File permissions are not enforced on Windows; the key file is not restricted.');\n }\n return warnings;\n}\n\nfunction hasEnvKey(): boolean {\n const envKey = process.env.TENJIN_WALLET_KEY;\n return envKey !== undefined && envKey.length > 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,YAAY;AAkBrB,IAAM,eAAe;AACrB,IAAM,cAAc;AACpB,IAAM,YAAY,QAAQ,aAAa;AAOvC,eAAsB,gBACpB,KACA,OAA4B,CAAC,GACL;AACxB,QAAM,EAAE,SAAS,YAAY,MAAM,OAAO,IAAI,MAAM,mBAAmB,IAAI,SAAS,IAAI;AAExF,QAAM,WAAW,gBAAgB;AACjC,SAAO;AAAA,IACL,MAAM;AAAA,MACJ;AAAA,MACA,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,mBAAmB;AAAA,MACnB,YAAY;AAAA,MACZ,kBAAkB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,mBAAmB,OAAO;AAAA,MAC1B,cAAc,WAAW;AAAA,MACzB,eAAe,MAAM;AAAA,MACrB;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EACF;AACF;AAeA,eAAe,mBACb,KACA,MAC4E;AAG5E,QAAM,MAAM,KAAK,EAAE,WAAW,MAAM,MAAM,IAAM,CAAC;AACjD,QAAM,WAAW,KAAK,KAAK,oBAAoB;AAC/C,MAAI;AACF,WAAO,MAAM,aAAa,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A4D;AAAA,EAC5E;AACA,MAAI,WAAW;AACb,aAAS,KAAK,+EAA+E;AAAA,EAC/F;AACA,SAAO;AACT;AAEA,SAAS,YAAqB;AAC5B,QAAM,SAAS,QAAQ,IAAI;AAC3B,SAAO,WAAW,UAAa,OAAO,SAAS;AACjD;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
readWalletRecord,
|
|
5
5
|
walletFileMode,
|
|
6
6
|
writeWalletRecord
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DPET3TW5.js";
|
|
8
8
|
import {
|
|
9
9
|
withFileLock
|
|
10
10
|
} from "./chunk-YBMMV4Y4.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
external_exports,
|
|
20
20
|
passphraseBlobPath,
|
|
21
21
|
walletPath
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6WWVYYSB.js";
|
|
23
23
|
import {
|
|
24
24
|
hashAuthorization,
|
|
25
25
|
hashMessage,
|
|
@@ -28,16 +28,16 @@ import {
|
|
|
28
28
|
publicKeyToAddress,
|
|
29
29
|
serializeSignature,
|
|
30
30
|
serializeTransaction
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-M2O56UK7.js";
|
|
32
32
|
import {
|
|
33
33
|
hmac,
|
|
34
34
|
secp256k1,
|
|
35
35
|
sha256
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-W6R3HAAG.js";
|
|
37
37
|
import {
|
|
38
38
|
InvalidAddressError,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
concat2 as concat,
|
|
40
|
+
from,
|
|
41
41
|
hexToBytes,
|
|
42
42
|
isAddress,
|
|
43
43
|
isEqual,
|
|
@@ -45,10 +45,10 @@ import {
|
|
|
45
45
|
keccak256,
|
|
46
46
|
numberToHex,
|
|
47
47
|
random,
|
|
48
|
-
|
|
48
|
+
slice2 as slice,
|
|
49
49
|
toHex,
|
|
50
50
|
toHex2
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-47PP7TAG.js";
|
|
52
52
|
import {
|
|
53
53
|
ahash,
|
|
54
54
|
anumber,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
rotl,
|
|
61
61
|
swap32IfBE,
|
|
62
62
|
u32
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-KYQVEKP5.js";
|
|
64
64
|
|
|
65
65
|
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/pbkdf2.js
|
|
66
66
|
function pbkdf2Init(hash, _password, _salt, _opts) {
|
|
@@ -1295,7 +1295,11 @@ async function readLedger(path) {
|
|
|
1295
1295
|
// src/lib/wallet/index.ts
|
|
1296
1296
|
function resolveWalletProvider(ctx, opts = {}) {
|
|
1297
1297
|
if (opts.provider !== void 0) return opts.provider;
|
|
1298
|
-
return createLocalProvider({
|
|
1298
|
+
return createLocalProvider({
|
|
1299
|
+
dir: ctx.dataDir,
|
|
1300
|
+
env: process.env,
|
|
1301
|
+
passphrase: { isTTY: ctx.io.isTTY ? void 0 : false }
|
|
1302
|
+
});
|
|
1299
1303
|
}
|
|
1300
1304
|
function resolveSpendAuthorizer(ctx, policy, opts = {}) {
|
|
1301
1305
|
if (opts.authorizer !== void 0) return opts.authorizer;
|
|
@@ -1327,4 +1331,4 @@ export {
|
|
|
1327
1331
|
@noble/ciphers/esm/utils.js:
|
|
1328
1332
|
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
|
1329
1333
|
*/
|
|
1330
|
-
//# sourceMappingURL=chunk-
|
|
1334
|
+
//# sourceMappingURL=chunk-S3KZ3PPK.js.map
|