tenjin-cli 0.1.0-alpha.1 → 0.1.0-alpha.2
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 +164 -16
- package/dist/{_esm-ZH2J4QEH.js → _esm-C5CRWCYU.js} +2 -2
- package/dist/_esm-FEASBWRP.js +881 -0
- package/dist/buy-U35DQ6XM.js +1598 -0
- package/dist/buy-U35DQ6XM.js.map +1 -0
- package/dist/candidate-RLYCQMF5.js +127 -0
- package/dist/candidate-RLYCQMF5.js.map +1 -0
- package/dist/{ccip-UCLT5VOW.js → ccip-NQXCEK2U.js} +6 -5
- package/dist/ccip-XR5NE5QK.js +19 -0
- package/dist/chunk-27ONARHV.js +171 -0
- package/dist/chunk-27ONARHV.js.map +1 -0
- package/dist/chunk-2I4QTOLB.js +11 -0
- package/dist/chunk-2I4QTOLB.js.map +1 -0
- package/dist/chunk-3OV7E5G5.js +18 -0
- package/dist/chunk-3OV7E5G5.js.map +1 -0
- package/dist/chunk-5CLSD5YN.js +209 -0
- package/dist/chunk-5CLSD5YN.js.map +1 -0
- package/dist/chunk-7KUW4MJD.js +59 -0
- package/dist/chunk-7KUW4MJD.js.map +1 -0
- package/dist/{doctor-3QBYN46N.js → chunk-7PHSZKQS.js} +88 -93
- package/dist/chunk-7PHSZKQS.js.map +1 -0
- package/dist/chunk-CYOF7ROH.js +70 -0
- package/dist/chunk-CYOF7ROH.js.map +1 -0
- package/dist/chunk-HIVZG55D.js +204 -0
- package/dist/chunk-HIVZG55D.js.map +1 -0
- package/dist/chunk-HSDCI7OV.js +7806 -0
- package/dist/chunk-HSDCI7OV.js.map +1 -0
- package/dist/{chunk-EZROUI5U.js → chunk-IYLHQMT5.js} +85 -9
- package/dist/chunk-IYLHQMT5.js.map +1 -0
- package/dist/chunk-JPHG2JW3.js +96 -0
- package/dist/chunk-JPHG2JW3.js.map +1 -0
- package/dist/{chunk-ZPZFPVDN.js → chunk-MUBUQVC3.js} +1 -1
- package/dist/chunk-MUBUQVC3.js.map +1 -0
- package/dist/chunk-N62ROTMC.js +79 -0
- package/dist/chunk-N62ROTMC.js.map +1 -0
- package/dist/{chunk-T4LKNY7T.js → chunk-NCE5NSN6.js} +166 -11
- package/dist/chunk-NCE5NSN6.js.map +1 -0
- package/dist/{chunk-YG2DO46P.js → chunk-OYMYCW7J.js} +18 -3
- package/dist/{chunk-YG2DO46P.js.map → chunk-OYMYCW7J.js.map} +1 -1
- package/dist/chunk-QNP7H47L.js +152 -0
- package/dist/chunk-QNP7H47L.js.map +1 -0
- package/dist/{chunk-Q53IYV2G.js → chunk-QVX5MWJZ.js} +20 -17
- package/dist/{chunk-Q53IYV2G.js.map → chunk-QVX5MWJZ.js.map} +1 -1
- package/dist/{chunk-CUWUHTIL.js → chunk-RBJPAZFI.js} +16 -202
- package/dist/chunk-RBJPAZFI.js.map +1 -0
- package/dist/chunk-RRN3YTK7.js +6199 -0
- package/dist/chunk-RRN3YTK7.js.map +1 -0
- package/dist/chunk-RY4XKNV3.js +140 -0
- package/dist/chunk-RY4XKNV3.js.map +1 -0
- package/dist/chunk-S3IGX57D.js +14682 -0
- package/dist/chunk-S3IGX57D.js.map +1 -0
- package/dist/{config-CEFTL5ZL.js → chunk-TFGSOPWR.js} +115 -18
- package/dist/chunk-TFGSOPWR.js.map +1 -0
- package/dist/chunk-TLCMMYLY.js +126 -0
- package/dist/chunk-TLCMMYLY.js.map +1 -0
- package/dist/{chunk-IPOWB3G3.js → chunk-UGX7YPX2.js} +3314 -306
- package/dist/chunk-UGX7YPX2.js.map +1 -0
- package/dist/chunk-UO22YNY4.js +69 -0
- package/dist/chunk-UO22YNY4.js.map +1 -0
- package/dist/chunk-UPIEAMGH.js +160 -0
- package/dist/chunk-UPIEAMGH.js.map +1 -0
- package/dist/chunk-XJIW7USF.js +217 -0
- package/dist/chunk-XJIW7USF.js.map +1 -0
- package/dist/{chunk-BRJHUQSY.js → chunk-YALGASEU.js} +1548 -1452
- package/dist/chunk-YALGASEU.js.map +1 -0
- package/dist/chunk-YIYQ2ZNT.js +286 -0
- package/dist/chunk-YIYQ2ZNT.js.map +1 -0
- package/dist/{chunk-DXPYFVKG.js → chunk-YN5SHIXQ.js} +6 -6
- package/dist/chunk-YN5SHIXQ.js.map +1 -0
- package/dist/chunk-Z52RA3NC.js +137 -0
- package/dist/chunk-Z52RA3NC.js.map +1 -0
- package/dist/{chunk-EXBMF5X7.js → chunk-Z6MFJV5Z.js} +151 -19
- package/dist/chunk-Z6MFJV5Z.js.map +1 -0
- package/dist/chunk-ZABPQJ3M.js +83 -0
- package/dist/chunk-ZABPQJ3M.js.map +1 -0
- package/dist/{chunk-LPRVHM7P.js → chunk-ZMHYXMO6.js} +1655 -114
- package/dist/chunk-ZMHYXMO6.js.map +1 -0
- package/dist/{chunk-3IMLRUZE.js → chunk-ZXTAQYNA.js} +6 -2
- package/dist/{cli-WA65NP4Y.js → cli-4NNBEQYH.js} +177 -177
- package/dist/cli-4NNBEQYH.js.map +1 -0
- package/dist/config-2VSXWWHK.js +21 -0
- package/dist/doctor-JJPNIBYH.js +20 -0
- package/dist/doctor-JJPNIBYH.js.map +1 -0
- package/dist/ethersCompat-Df4a6QIZ-3YZIAXDK.js +18 -0
- package/dist/ethersCompat-Df4a6QIZ-3YZIAXDK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspect-JGYJWFDP.js +96 -0
- package/dist/inspect-JGYJWFDP.js.map +1 -0
- package/dist/install-ZQRMSRGW.js +378 -0
- package/dist/install-ZQRMSRGW.js.map +1 -0
- package/dist/lookup-WYVTOMVY.js +113 -0
- package/dist/lookup-WYVTOMVY.js.map +1 -0
- package/dist/{mine.wasm-GQECMSGN.js → mine.wasm-6PIT3DK6.js} +2 -2
- package/dist/outcome-HKKT6QIA.js +66 -0
- package/dist/outcome-HKKT6QIA.js.map +1 -0
- package/dist/publish-D76B3MBK.js +1480 -0
- package/dist/publish-D76B3MBK.js.map +1 -0
- package/dist/{secp256k1-BEZS642W.js → secp256k1-N3ZHU7LB.js} +5 -4
- package/dist/secp256k1-N3ZHU7LB.js.map +1 -0
- package/dist/usdc-JIAJW4SV.js +22 -0
- package/dist/usdc-JIAJW4SV.js.map +1 -0
- package/dist/viemAdapter-By13KInL-ZZE6UV4Y.js +14 -0
- package/dist/viemAdapter-By13KInL-ZZE6UV4Y.js.map +1 -0
- package/dist/{wallet-XD576HF3.js → wallet-6QKS6UHW.js} +28 -22
- package/dist/{wallet-XD576HF3.js.map → wallet-6QKS6UHW.js.map} +1 -1
- package/dist/wallet-PA54CRBL.js +30 -0
- package/dist/wallet-PA54CRBL.js.map +1 -0
- package/package.json +19 -16
- package/skills/tenjin/SKILL.md +199 -0
- package/skills/tenjin-publish/SKILL.md +96 -0
- package/skills/tenjin-search/SKILL.md +122 -0
- package/dist/chunk-BRJHUQSY.js.map +0 -1
- package/dist/chunk-CUWUHTIL.js.map +0 -1
- package/dist/chunk-DXPYFVKG.js.map +0 -1
- package/dist/chunk-EXBMF5X7.js.map +0 -1
- package/dist/chunk-EZROUI5U.js.map +0 -1
- package/dist/chunk-IPOWB3G3.js.map +0 -1
- package/dist/chunk-LPRVHM7P.js.map +0 -1
- package/dist/chunk-T4LKNY7T.js.map +0 -1
- package/dist/chunk-ZPZFPVDN.js.map +0 -1
- package/dist/cli-WA65NP4Y.js.map +0 -1
- package/dist/config-CEFTL5ZL.js.map +0 -1
- package/dist/doctor-3QBYN46N.js.map +0 -1
- package/dist/usdc-44R6XZF2.js +0 -18
- package/dist/wallet-ELBTBMXO.js +0 -20
- /package/dist/{_esm-ZH2J4QEH.js.map → _esm-C5CRWCYU.js.map} +0 -0
- /package/dist/{ccip-UCLT5VOW.js.map → _esm-FEASBWRP.js.map} +0 -0
- /package/dist/{chunk-3IMLRUZE.js.map → ccip-NQXCEK2U.js.map} +0 -0
- /package/dist/{secp256k1-BEZS642W.js.map → ccip-XR5NE5QK.js.map} +0 -0
- /package/dist/{usdc-44R6XZF2.js.map → chunk-ZXTAQYNA.js.map} +0 -0
- /package/dist/{wallet-ELBTBMXO.js.map → config-2VSXWWHK.js.map} +0 -0
- /package/dist/{mine.wasm-GQECMSGN.js.map → mine.wasm-6PIT3DK6.js.map} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
createCandidate,
|
|
4
|
+
dropCandidate,
|
|
5
|
+
listCandidates
|
|
6
|
+
} from "./chunk-TLCMMYLY.js";
|
|
7
|
+
import {
|
|
8
|
+
UUID_RE
|
|
9
|
+
} from "./chunk-3OV7E5G5.js";
|
|
10
|
+
import {
|
|
11
|
+
sanitizeForTerminal
|
|
12
|
+
} from "./chunk-Z52RA3NC.js";
|
|
13
|
+
import {
|
|
14
|
+
pathExists
|
|
15
|
+
} from "./chunk-UPIEAMGH.js";
|
|
16
|
+
import "./chunk-IYLHQMT5.js";
|
|
17
|
+
import "./chunk-2I4QTOLB.js";
|
|
18
|
+
import "./chunk-UO22YNY4.js";
|
|
19
|
+
import "./chunk-MUBUQVC3.js";
|
|
20
|
+
import {
|
|
21
|
+
CliError
|
|
22
|
+
} from "./chunk-OYMYCW7J.js";
|
|
23
|
+
import "./chunk-ZXTAQYNA.js";
|
|
24
|
+
|
|
25
|
+
// src/commands/candidate.ts
|
|
26
|
+
import { readFile } from "fs/promises";
|
|
27
|
+
import { dirname, join, resolve } from "path";
|
|
28
|
+
async function runCandidateAdd(args, ctx, deps = {}) {
|
|
29
|
+
if (!UUID_RE.test(args.lookupId)) {
|
|
30
|
+
throw new CliError("USAGE", `Invalid --lookup-id: ${JSON.stringify(args.lookupId)}.`, {
|
|
31
|
+
fix: "Pass the lookupId from a prior `tenjin lookup` (a uuid)."
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (args.question !== void 0 && args.question.length > 200) {
|
|
35
|
+
throw new CliError("USAGE", "A candidate --question is at most 200 characters.", {
|
|
36
|
+
fix: "Shorten the question to 200 characters or fewer."
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let draft;
|
|
40
|
+
try {
|
|
41
|
+
draft = await readFile(args.file, "utf8");
|
|
42
|
+
} catch (err) {
|
|
43
|
+
throw new CliError("USAGE", `Cannot read draft file ${JSON.stringify(args.file)}.`, {
|
|
44
|
+
fix: "Pass a path to a readable Markdown file.",
|
|
45
|
+
cause: err
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const cwd = deps.cwd ?? process.cwd();
|
|
49
|
+
const sourceProject = await repoRootOrCwd(cwd);
|
|
50
|
+
const created = (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
|
|
51
|
+
const record = await createCandidate(ctx.dataDir, {
|
|
52
|
+
draft,
|
|
53
|
+
lookupId: args.lookupId,
|
|
54
|
+
...args.question !== void 0 ? { question: args.question } : {},
|
|
55
|
+
created,
|
|
56
|
+
sourceProject
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
data: {
|
|
60
|
+
id: record.id,
|
|
61
|
+
path: record.dir,
|
|
62
|
+
lookupId: record.meta.lookupId,
|
|
63
|
+
...record.meta.question !== void 0 ? { question: record.meta.question } : {},
|
|
64
|
+
created: record.meta.created,
|
|
65
|
+
sourceProject: record.meta.sourceProject
|
|
66
|
+
},
|
|
67
|
+
humanLines: [`Parked candidate ${record.id}`, ` ${record.dir}`]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function runCandidateList(ctx, deps = {}) {
|
|
71
|
+
const now = deps.now?.() ?? /* @__PURE__ */ new Date();
|
|
72
|
+
const records = await listCandidates(ctx.dataDir);
|
|
73
|
+
const candidates = records.map((r) => ({
|
|
74
|
+
id: r.id,
|
|
75
|
+
lookupId: r.meta.lookupId,
|
|
76
|
+
...r.meta.question !== void 0 ? { question: r.meta.question } : {},
|
|
77
|
+
created: r.meta.created,
|
|
78
|
+
sourceProject: r.meta.sourceProject,
|
|
79
|
+
path: r.dir
|
|
80
|
+
}));
|
|
81
|
+
const humanLines = records.length === 0 ? ["No pending candidates."] : records.map((r) => {
|
|
82
|
+
const q = r.meta.question !== void 0 ? sanitizeForTerminal(r.meta.question) : "(no question)";
|
|
83
|
+
return `${r.id} ${humanizeAge(r.meta.created, now)} ${q} [${sanitizeForTerminal(
|
|
84
|
+
r.meta.sourceProject
|
|
85
|
+
)}]`;
|
|
86
|
+
});
|
|
87
|
+
return { data: { candidates }, humanLines };
|
|
88
|
+
}
|
|
89
|
+
async function runCandidateDrop(args, ctx) {
|
|
90
|
+
const dropped = await dropCandidate(ctx.dataDir, args.id);
|
|
91
|
+
if (!dropped) {
|
|
92
|
+
throw new CliError("USAGE", `No candidate with id ${JSON.stringify(args.id)}.`, {
|
|
93
|
+
fix: "Run `tenjin candidate list` to see pending candidate ids."
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
data: { id: args.id, dropped: true },
|
|
98
|
+
humanLines: [`Dropped candidate ${args.id}.`]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function repoRootOrCwd(cwd) {
|
|
102
|
+
let dir = resolve(cwd);
|
|
103
|
+
for (; ; ) {
|
|
104
|
+
if (await pathExists(join(dir, ".git"))) return dir;
|
|
105
|
+
const parent = dirname(dir);
|
|
106
|
+
if (parent === dir) return resolve(cwd);
|
|
107
|
+
dir = parent;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var MINUTE = 6e4;
|
|
111
|
+
var HOUR = 60 * MINUTE;
|
|
112
|
+
var DAY = 24 * HOUR;
|
|
113
|
+
function humanizeAge(iso, now) {
|
|
114
|
+
const then = Date.parse(iso);
|
|
115
|
+
if (Number.isNaN(then)) return "just now";
|
|
116
|
+
const ms = now.getTime() - then;
|
|
117
|
+
if (ms < MINUTE) return "just now";
|
|
118
|
+
if (ms < HOUR) return `${Math.floor(ms / MINUTE)}m ago`;
|
|
119
|
+
if (ms < DAY) return `${Math.floor(ms / HOUR)}h ago`;
|
|
120
|
+
return `${Math.floor(ms / DAY)}d ago`;
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
runCandidateAdd,
|
|
124
|
+
runCandidateDrop,
|
|
125
|
+
runCandidateList
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=candidate-RLYCQMF5.js.map
|
|
@@ -0,0 +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 lookupId: 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.lookupId)) {\n throw new CliError('USAGE', `Invalid --lookup-id: ${JSON.stringify(args.lookupId)}.`, {\n fix: 'Pass the lookupId from a prior `tenjin lookup` (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 lookupId: args.lookupId,\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 lookupId: record.meta.lookupId,\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 lookupId: r.meta.lookupId,\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,QAAQ,GAAG;AAChC,UAAM,IAAI,SAAS,SAAS,wBAAwB,KAAK,UAAU,KAAK,QAAQ,CAAC,KAAK;AAAA,MACpF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAIA,MAAI,KAAK,aAAa,UAAa,KAAK,SAAS,SAAS,KAAK;AAC7D,UAAM,IAAI,SAAS,SAAS,qDAAqD;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,MAA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,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":[]}
|
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
offchainLookup,
|
|
5
5
|
offchainLookupAbiItem,
|
|
6
6
|
offchainLookupSignature
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-RRN3YTK7.js";
|
|
8
|
+
import "./chunk-HIVZG55D.js";
|
|
9
|
+
import "./chunk-RBJPAZFI.js";
|
|
10
|
+
import "./chunk-5CLSD5YN.js";
|
|
11
|
+
import "./chunk-ZXTAQYNA.js";
|
|
11
12
|
export {
|
|
12
13
|
ccipRequest,
|
|
13
14
|
offchainLookup,
|
|
14
15
|
offchainLookupAbiItem,
|
|
15
16
|
offchainLookupSignature
|
|
16
17
|
};
|
|
17
|
-
//# sourceMappingURL=ccip-
|
|
18
|
+
//# sourceMappingURL=ccip-NQXCEK2U.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ccipRequest,
|
|
4
|
+
offchainLookup,
|
|
5
|
+
offchainLookupAbiItem,
|
|
6
|
+
offchainLookupSignature
|
|
7
|
+
} from "./chunk-ZMHYXMO6.js";
|
|
8
|
+
import "./chunk-YALGASEU.js";
|
|
9
|
+
import "./chunk-HIVZG55D.js";
|
|
10
|
+
import "./chunk-RBJPAZFI.js";
|
|
11
|
+
import "./chunk-5CLSD5YN.js";
|
|
12
|
+
import "./chunk-ZXTAQYNA.js";
|
|
13
|
+
export {
|
|
14
|
+
ccipRequest,
|
|
15
|
+
offchainLookup,
|
|
16
|
+
offchainLookupAbiItem,
|
|
17
|
+
offchainLookupSignature
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ccip-XR5NE5QK.js.map
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
SIWX_HEADER,
|
|
4
|
+
decodePaymentRequiredHeader,
|
|
5
|
+
decodePaymentResponseHeader
|
|
6
|
+
} from "./chunk-S3IGX57D.js";
|
|
7
|
+
import {
|
|
8
|
+
rateLimitError
|
|
9
|
+
} from "./chunk-YIYQ2ZNT.js";
|
|
10
|
+
import {
|
|
11
|
+
SLUG_RE,
|
|
12
|
+
UUID_RE
|
|
13
|
+
} from "./chunk-3OV7E5G5.js";
|
|
14
|
+
import {
|
|
15
|
+
CLIENT_HEADER,
|
|
16
|
+
httpRequest
|
|
17
|
+
} from "./chunk-QNP7H47L.js";
|
|
18
|
+
import {
|
|
19
|
+
CliError,
|
|
20
|
+
external_exports
|
|
21
|
+
} from "./chunk-OYMYCW7J.js";
|
|
22
|
+
|
|
23
|
+
// src/lib/read-client.ts
|
|
24
|
+
var PAYMENT_REQUIRED_HEADER = "PAYMENT-REQUIRED";
|
|
25
|
+
var PAYMENT_RESPONSE_HEADER = "PAYMENT-RESPONSE";
|
|
26
|
+
var readBodySchema = external_exports.object({
|
|
27
|
+
id: external_exports.string().regex(UUID_RE, "resource id must be a uuid"),
|
|
28
|
+
slug: external_exports.string().regex(SLUG_RE, "unsafe slug").max(80),
|
|
29
|
+
title: external_exports.string(),
|
|
30
|
+
bodyMd: external_exports.string(),
|
|
31
|
+
price: external_exports.string(),
|
|
32
|
+
creator: external_exports.object({
|
|
33
|
+
handle: external_exports.string().nullish(),
|
|
34
|
+
walletAddress: external_exports.string().nullish()
|
|
35
|
+
}).passthrough()
|
|
36
|
+
}).passthrough();
|
|
37
|
+
var previewSchema = external_exports.object({
|
|
38
|
+
id: external_exports.string().optional(),
|
|
39
|
+
title: external_exports.string().optional(),
|
|
40
|
+
price: external_exports.string().optional(),
|
|
41
|
+
creator: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
42
|
+
}).passthrough();
|
|
43
|
+
var ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
44
|
+
var paymentRequiredSchema = external_exports.object({
|
|
45
|
+
x402Version: external_exports.literal(2),
|
|
46
|
+
accepts: external_exports.array(
|
|
47
|
+
external_exports.object({
|
|
48
|
+
scheme: external_exports.string(),
|
|
49
|
+
network: external_exports.string().regex(/^eip155:\d+$/, "network must be CAIP-2 eip155"),
|
|
50
|
+
asset: external_exports.string().regex(ADDRESS_RE, "asset must be a 0x address"),
|
|
51
|
+
amount: external_exports.string().regex(/^\d{1,39}$/, "amount must be an atomic integer string"),
|
|
52
|
+
payTo: external_exports.string().regex(ADDRESS_RE, "payTo must be a 0x address")
|
|
53
|
+
}).passthrough()
|
|
54
|
+
)
|
|
55
|
+
}).passthrough();
|
|
56
|
+
async function fetchRead(url, opts) {
|
|
57
|
+
const headers = {
|
|
58
|
+
accept: "application/json",
|
|
59
|
+
"x-tenjin-client": CLIENT_HEADER
|
|
60
|
+
};
|
|
61
|
+
if (opts.lookupId !== void 0) headers["x-tenjin-lookup-id"] = opts.lookupId;
|
|
62
|
+
if (opts.siwxHeader !== void 0) headers[SIWX_HEADER] = opts.siwxHeader;
|
|
63
|
+
if (opts.paymentHeaders !== void 0) Object.assign(headers, opts.paymentHeaders);
|
|
64
|
+
const res = await httpRequest(url, {
|
|
65
|
+
method: "GET",
|
|
66
|
+
timeoutMs: opts.timeoutMs,
|
|
67
|
+
headers,
|
|
68
|
+
fetchImpl: opts.fetchImpl
|
|
69
|
+
});
|
|
70
|
+
if (!res.ok) {
|
|
71
|
+
const code = res.kind === "network" || res.kind === "timeout" ? "NETWORK_ERROR" : "API_UNREACHABLE";
|
|
72
|
+
throw new CliError(code, `${url}: ${res.message}`, {
|
|
73
|
+
fix: "Check the resource URL and your network, then retry."
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (res.status === 200) {
|
|
77
|
+
const parsed = readBodySchema.safeParse(res.json);
|
|
78
|
+
if (!parsed.success) {
|
|
79
|
+
throw new CliError(
|
|
80
|
+
"CONTRACT_MISMATCH",
|
|
81
|
+
"The read response did not match the expected contract",
|
|
82
|
+
{
|
|
83
|
+
fix: "Update tenjin-cli; the read contract may have changed.",
|
|
84
|
+
details: parsed.error.issues
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const settlement = decodeSettlement(res.header(PAYMENT_RESPONSE_HEADER));
|
|
89
|
+
return {
|
|
90
|
+
kind: "entitled",
|
|
91
|
+
body: parsed.data,
|
|
92
|
+
...settlement !== void 0 ? { settlementTxHash: settlement } : {}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (res.status === 402) {
|
|
96
|
+
const encoded = res.header(PAYMENT_REQUIRED_HEADER);
|
|
97
|
+
if (encoded === void 0) {
|
|
98
|
+
throw new CliError("CONTRACT_MISMATCH", "The 402 carried no PAYMENT-REQUIRED header", {
|
|
99
|
+
fix: "The server may be misconfigured; try another resource or update tenjin-cli."
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
let decoded;
|
|
103
|
+
try {
|
|
104
|
+
decoded = decodePaymentRequiredHeader(encoded);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
throw new CliError("CONTRACT_MISMATCH", "Could not decode the PAYMENT-REQUIRED header", {
|
|
107
|
+
fix: "Update tenjin-cli; the x402 header format may have changed.",
|
|
108
|
+
cause: err
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const validated = paymentRequiredSchema.safeParse(decoded);
|
|
112
|
+
if (!validated.success) {
|
|
113
|
+
throw new CliError(
|
|
114
|
+
"CONTRACT_MISMATCH",
|
|
115
|
+
"The 402 challenge is not a valid x402 v2 payment declaration.",
|
|
116
|
+
{
|
|
117
|
+
fix: "Update tenjin-cli, or check --base-url points at a Tenjin deployment.",
|
|
118
|
+
details: validated.error.issues
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
const paymentRequired = decoded;
|
|
123
|
+
const preview = previewSchema.safeParse(res.json);
|
|
124
|
+
return {
|
|
125
|
+
kind: "payment_required",
|
|
126
|
+
paymentRequired,
|
|
127
|
+
preview: preview.success ? preview.data : {}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (res.status === 409) {
|
|
131
|
+
return { kind: "already_purchased", message: readMessage(res.json) ?? "Already purchased." };
|
|
132
|
+
}
|
|
133
|
+
if (res.status === 404) {
|
|
134
|
+
throw new CliError("RESOURCE_NOT_FOUND", `No resource at ${url}`, {
|
|
135
|
+
fix: "Check the handle/slug or resource id."
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (res.status === 429) throw rateLimitError(url, (n) => res.header(n));
|
|
139
|
+
throw new CliError(
|
|
140
|
+
"API_UNREACHABLE",
|
|
141
|
+
readMessage(res.json) ?? `Unexpected status ${res.status} from ${url}`,
|
|
142
|
+
{
|
|
143
|
+
fix: "Retry; if it persists the resource may be unavailable.",
|
|
144
|
+
details: res.json
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function decodeSettlement(header) {
|
|
149
|
+
if (header === void 0) return void 0;
|
|
150
|
+
try {
|
|
151
|
+
const settle = decodePaymentResponseHeader(header);
|
|
152
|
+
const tx = settle.transaction;
|
|
153
|
+
return typeof tx === "string" ? tx : void 0;
|
|
154
|
+
} catch {
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function readMessage(json) {
|
|
159
|
+
if (typeof json === "object" && json !== null) {
|
|
160
|
+
const rec = json;
|
|
161
|
+
if (typeof rec.message === "string") return rec.message;
|
|
162
|
+
if (typeof rec.error === "string") return rec.error;
|
|
163
|
+
if (typeof rec.code === "string") return rec.code;
|
|
164
|
+
}
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
fetchRead
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=chunk-27ONARHV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/read-client.ts"],"sourcesContent":["import { z } from 'zod';\nimport { decodePaymentRequiredHeader, decodePaymentResponseHeader } from '@x402/core/http';\nimport type { PaymentRequired } from '@x402/core/types';\nimport { CliError } from './errors';\nimport { rateLimitError } from './agent-api';\nimport { httpRequest } from './http';\nimport { CLIENT_HEADER } from './client-meta';\nimport { SIWX_HEADER } from './siwx';\n\n/**\n * The read-route (`GET /api/read/<handle>/<slug>`) client, always JSON/x402, so\n * it is the robust agent target (llms-full). It surfaces the three outcomes the\n * buy flow branches on: `entitled` (200 with the full body, free post, SIWX\n * re-read, or freshly paid), `payment_required` (402 with the decoded\n * PAYMENT-REQUIRED header + the leak-safe preview body), and `already_purchased`\n * (409 owned-re-pay gate, nothing charged). Purchase attribution rides\n * `X-Tenjin-Client` always and `X-Tenjin-Lookup-Id` when a lookup preceded the buy.\n */\n\nconst PAYMENT_REQUIRED_HEADER = 'PAYMENT-REQUIRED';\nconst PAYMENT_RESPONSE_HEADER = 'PAYMENT-RESPONSE';\n\n// id/slug become filesystem path segments (the local library), so they are\n// validated as a uuid + the server's slug charset HERE, at the trust boundary, so\n// a hostile id='../../evil' or slug fails as CONTRACT_MISMATCH before delivery.\nimport { SLUG_RE, UUID_RE as RESOURCE_ID_RE } from './ids';\n\n/** The full essay body a 200 returns (loose: require what the CLI reads, keep the rest). */\nconst readBodySchema = z\n .object({\n id: z.string().regex(RESOURCE_ID_RE, 'resource id must be a uuid'),\n slug: z.string().regex(SLUG_RE, 'unsafe slug').max(80),\n title: z.string(),\n bodyMd: z.string(),\n price: z.string(),\n creator: z\n .object({\n handle: z.string().nullish(),\n walletAddress: z.string().nullish(),\n })\n .passthrough(),\n })\n .passthrough();\n\nexport type ReadBody = z.infer<typeof readBodySchema>;\n\n/** The leak-safe 402 preview body, never the paid content. */\nconst previewSchema = z\n .object({\n id: z.string().optional(),\n title: z.string().optional(),\n price: z.string().optional(),\n creator: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough();\n\nexport type Preview = z.infer<typeof previewSchema>;\n\n// The decoded PAYMENT-REQUIRED is money-path input: validate the fields the pay\n// path consumes (amount as an atomic integer, CAIP-2 network, 0x asset/payTo)\n// at THIS boundary instead of trusting raw base64 JSON. Loose otherwise so new\n// server fields never break an older CLI.\nconst ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;\nconst paymentRequiredSchema = z\n .object({\n x402Version: z.literal(2),\n accepts: z.array(\n z\n .object({\n scheme: z.string(),\n network: z.string().regex(/^eip155:\\d+$/, 'network must be CAIP-2 eip155'),\n asset: z.string().regex(ADDRESS_RE, 'asset must be a 0x address'),\n amount: z.string().regex(/^\\d{1,39}$/, 'amount must be an atomic integer string'),\n payTo: z.string().regex(ADDRESS_RE, 'payTo must be a 0x address'),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\nexport type ReadResult =\n | { kind: 'entitled'; body: ReadBody; settlementTxHash?: string }\n | { kind: 'payment_required'; paymentRequired: PaymentRequired; preview: Preview }\n | { kind: 'already_purchased'; message: string };\n\nexport interface ReadRequestOptions {\n timeoutMs: number;\n fetchImpl?: typeof fetch;\n /** A `SIGN-IN-WITH-X` header for the entitled free re-read. */\n siwxHeader?: string;\n /** The `PAYMENT-SIGNATURE` header(s) for a paid request. */\n paymentHeaders?: Record<string, string>;\n /** Attribute a following purchase to the lookup that surfaced it. */\n lookupId?: string;\n}\n\nexport async function fetchRead(url: string, opts: ReadRequestOptions): Promise<ReadResult> {\n const headers: Record<string, string> = {\n accept: 'application/json',\n 'x-tenjin-client': CLIENT_HEADER,\n };\n if (opts.lookupId !== undefined) headers['x-tenjin-lookup-id'] = opts.lookupId;\n if (opts.siwxHeader !== undefined) headers[SIWX_HEADER] = opts.siwxHeader;\n if (opts.paymentHeaders !== undefined) Object.assign(headers, opts.paymentHeaders);\n\n const res = await httpRequest(url, {\n method: 'GET',\n timeoutMs: opts.timeoutMs,\n headers,\n fetchImpl: opts.fetchImpl,\n });\n if (!res.ok) {\n const code =\n res.kind === 'network' || res.kind === 'timeout' ? 'NETWORK_ERROR' : 'API_UNREACHABLE';\n throw new CliError(code, `${url}: ${res.message}`, {\n fix: 'Check the resource URL and your network, then retry.',\n });\n }\n\n if (res.status === 200) {\n const parsed = readBodySchema.safeParse(res.json);\n if (!parsed.success) {\n throw new CliError(\n 'CONTRACT_MISMATCH',\n 'The read response did not match the expected contract',\n {\n fix: 'Update tenjin-cli; the read contract may have changed.',\n details: parsed.error.issues,\n },\n );\n }\n const settlement = decodeSettlement(res.header(PAYMENT_RESPONSE_HEADER));\n return {\n kind: 'entitled',\n body: parsed.data,\n ...(settlement !== undefined ? { settlementTxHash: settlement } : {}),\n };\n }\n\n if (res.status === 402) {\n const encoded = res.header(PAYMENT_REQUIRED_HEADER);\n if (encoded === undefined) {\n throw new CliError('CONTRACT_MISMATCH', 'The 402 carried no PAYMENT-REQUIRED header', {\n fix: 'The server may be misconfigured; try another resource or update tenjin-cli.',\n });\n }\n let decoded: PaymentRequired;\n try {\n decoded = decodePaymentRequiredHeader(encoded);\n } catch (err) {\n throw new CliError('CONTRACT_MISMATCH', 'Could not decode the PAYMENT-REQUIRED header', {\n fix: 'Update tenjin-cli; the x402 header format may have changed.',\n cause: err,\n });\n }\n const validated = paymentRequiredSchema.safeParse(decoded);\n if (!validated.success) {\n throw new CliError(\n 'CONTRACT_MISMATCH',\n 'The 402 challenge is not a valid x402 v2 payment declaration.',\n {\n fix: 'Update tenjin-cli, or check --base-url points at a Tenjin deployment.',\n details: validated.error.issues,\n },\n );\n }\n const paymentRequired = decoded;\n const preview = previewSchema.safeParse(res.json);\n return {\n kind: 'payment_required',\n paymentRequired,\n preview: preview.success ? preview.data : {},\n };\n }\n\n if (res.status === 409) {\n // The owned-re-pay gate: a payment for a post this wallet already bought is\n // refused, nothing charged. The caller falls back to a SIWX free re-read.\n return { kind: 'already_purchased', message: readMessage(res.json) ?? 'Already purchased.' };\n }\n\n if (res.status === 404) {\n throw new CliError('RESOURCE_NOT_FOUND', `No resource at ${url}`, {\n fix: 'Check the handle/slug or resource id.',\n });\n }\n\n // 429 on the paid-read path is a recoverable pause, not an outage: surface\n // RATE_LIMITED + retryAfterSeconds like postLookup/postOutcomes do, so a looping\n // agent (the caller most likely to hit this) can back off instead of treating it\n // as API_UNREACHABLE.\n if (res.status === 429) throw rateLimitError(url, (n) => res.header(n));\n\n throw new CliError(\n 'API_UNREACHABLE',\n readMessage(res.json) ?? `Unexpected status ${res.status} from ${url}`,\n {\n fix: 'Retry; if it persists the resource may be unavailable.',\n details: res.json,\n },\n );\n}\n\nfunction decodeSettlement(header: string | undefined): string | undefined {\n if (header === undefined) return undefined;\n try {\n const settle = decodePaymentResponseHeader(header);\n const tx = (settle as { transaction?: unknown }).transaction;\n return typeof tx === 'string' ? tx : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction readMessage(json: unknown): string | undefined {\n if (typeof json === 'object' && json !== null) {\n const rec = json as Record<string, unknown>;\n if (typeof rec.message === 'string') return rec.message;\n if (typeof rec.error === 'string') return rec.error;\n if (typeof rec.code === 'string') return rec.code;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmBA,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAQhC,IAAM,iBAAiB,iBACpB,OAAO;AAAA,EACN,IAAI,iBAAE,OAAO,EAAE,MAAM,SAAgB,4BAA4B;AAAA,EACjE,MAAM,iBAAE,OAAO,EAAE,MAAM,SAAS,aAAa,EAAE,IAAI,EAAE;AAAA,EACrD,OAAO,iBAAE,OAAO;AAAA,EAChB,QAA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","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/errno.ts
|
|
4
|
+
function hasCode(err, code) {
|
|
5
|
+
return typeof err === "object" && err !== null && "code" in err && err.code === code;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
hasCode
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-2I4QTOLB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/errno.ts"],"sourcesContent":["/**\n * True when `err` is a Node system error carrying the given `code` (ENOENT,\n * EEXIST, …). One definition so the fs-error checks scattered across the wallet\n * store, config loader, and session cache stay identical.\n */\nexport function hasCode(err: unknown, code: string): boolean {\n return (\n typeof err === 'object' &&\n err !== null &&\n 'code' in err &&\n (err as { code?: unknown }).code === code\n );\n}\n"],"mappings":";;;AAKO,SAAS,QAAQ,KAAc,MAAuB;AAC3D,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACT,IAA2B,SAAS;AAEzC;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/ids.ts
|
|
4
|
+
import { randomUUID } from "crypto";
|
|
5
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6
|
+
var SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
7
|
+
var ATOMIC_RE = /^\d{1,39}$/;
|
|
8
|
+
function newId() {
|
|
9
|
+
return randomUUID();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
UUID_RE,
|
|
14
|
+
SLUG_RE,
|
|
15
|
+
ATOMIC_RE,
|
|
16
|
+
newId
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=chunk-3OV7E5G5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/ids.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\n/**\n * The shared identity patterns for server-controlled values that become file\n * paths, URL segments, or terminal output. One definition so a future change\n * (e.g. accepting uppercase ids) cannot be applied in one command and missed in\n * another. SLUG_RE must match the server's slugify charset (lib/posts.ts:\n * lowercase a-z0-9 groups joined by single hyphens, no leading/trailing hyphen).\n */\nexport const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nexport const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n/** A non-negative atomic USDC integer string (6-decimal base units). */\nexport const ATOMIC_RE = /^\\d{1,39}$/;\n\n/**\n * Mint a fresh opaque id for a locally-created entity (a parked candidate). A v4\n * uuid: the same shape a lookupId takes, so UUID_RE validates it and a `drop\n * <id>` argument that reaches a filesystem path can't traverse out of the store.\n */\nexport function newId(): string {\n return randomUUID();\n}\n"],"mappings":";;;AAAA,SAAS,kBAAkB;AASpB,IAAM,UAAU;AAChB,IAAM,UAAU;AAEhB,IAAM,YAAY;AAOlB,SAAS,QAAgB;AAC9B,SAAO,WAAW;AACpB;","names":[]}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
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
|
+
function rotl(word, shift) {
|
|
55
|
+
return word << shift | word >>> 32 - shift >>> 0;
|
|
56
|
+
}
|
|
57
|
+
var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
58
|
+
function byteSwap(word) {
|
|
59
|
+
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
60
|
+
}
|
|
61
|
+
function byteSwap32(arr) {
|
|
62
|
+
for (let i = 0; i < arr.length; i++) {
|
|
63
|
+
arr[i] = byteSwap(arr[i]);
|
|
64
|
+
}
|
|
65
|
+
return arr;
|
|
66
|
+
}
|
|
67
|
+
var swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
68
|
+
var hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
|
|
71
|
+
))();
|
|
72
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
73
|
+
function bytesToHex(bytes) {
|
|
74
|
+
abytes(bytes);
|
|
75
|
+
if (hasHexBuiltin)
|
|
76
|
+
return bytes.toHex();
|
|
77
|
+
let hex = "";
|
|
78
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
79
|
+
hex += hexes[bytes[i]];
|
|
80
|
+
}
|
|
81
|
+
return hex;
|
|
82
|
+
}
|
|
83
|
+
var nextTick = async () => {
|
|
84
|
+
};
|
|
85
|
+
async function asyncLoop(iters, tick, cb) {
|
|
86
|
+
let ts = Date.now();
|
|
87
|
+
for (let i = 0; i < iters; i++) {
|
|
88
|
+
cb(i);
|
|
89
|
+
const diff = Date.now() - ts;
|
|
90
|
+
if (diff >= 0 && diff < tick)
|
|
91
|
+
continue;
|
|
92
|
+
await nextTick();
|
|
93
|
+
ts += diff;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function utf8ToBytes(str) {
|
|
97
|
+
if (typeof str !== "string")
|
|
98
|
+
throw new Error("string expected");
|
|
99
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
100
|
+
}
|
|
101
|
+
function toBytes(data) {
|
|
102
|
+
if (typeof data === "string")
|
|
103
|
+
data = utf8ToBytes(data);
|
|
104
|
+
abytes(data);
|
|
105
|
+
return data;
|
|
106
|
+
}
|
|
107
|
+
function kdfInputToBytes(data) {
|
|
108
|
+
if (typeof data === "string")
|
|
109
|
+
data = utf8ToBytes(data);
|
|
110
|
+
abytes(data);
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
function concatBytes(...arrays) {
|
|
114
|
+
let sum = 0;
|
|
115
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
116
|
+
const a = arrays[i];
|
|
117
|
+
abytes(a);
|
|
118
|
+
sum += a.length;
|
|
119
|
+
}
|
|
120
|
+
const res = new Uint8Array(sum);
|
|
121
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
122
|
+
const a = arrays[i];
|
|
123
|
+
res.set(a, pad);
|
|
124
|
+
pad += a.length;
|
|
125
|
+
}
|
|
126
|
+
return res;
|
|
127
|
+
}
|
|
128
|
+
function checkOpts(defaults, opts) {
|
|
129
|
+
if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
|
|
130
|
+
throw new Error("options should be object or undefined");
|
|
131
|
+
const merged = Object.assign(defaults, opts);
|
|
132
|
+
return merged;
|
|
133
|
+
}
|
|
134
|
+
var Hash = class {
|
|
135
|
+
};
|
|
136
|
+
function createHasher(hashCons) {
|
|
137
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
138
|
+
const tmp = hashCons();
|
|
139
|
+
hashC.outputLen = tmp.outputLen;
|
|
140
|
+
hashC.blockLen = tmp.blockLen;
|
|
141
|
+
hashC.create = () => hashCons();
|
|
142
|
+
return hashC;
|
|
143
|
+
}
|
|
144
|
+
function randomBytes(bytesLength = 32) {
|
|
145
|
+
if (crypto && typeof crypto.getRandomValues === "function") {
|
|
146
|
+
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
147
|
+
}
|
|
148
|
+
if (crypto && typeof crypto.randomBytes === "function") {
|
|
149
|
+
return Uint8Array.from(crypto.randomBytes(bytesLength));
|
|
150
|
+
}
|
|
151
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js
|
|
155
|
+
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
156
|
+
var _32n = /* @__PURE__ */ BigInt(32);
|
|
157
|
+
function fromBig(n, le = false) {
|
|
158
|
+
if (le)
|
|
159
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
160
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
161
|
+
}
|
|
162
|
+
function split(lst, le = false) {
|
|
163
|
+
const len = lst.length;
|
|
164
|
+
let Ah = new Uint32Array(len);
|
|
165
|
+
let Al = new Uint32Array(len);
|
|
166
|
+
for (let i = 0; i < len; i++) {
|
|
167
|
+
const { h, l } = fromBig(lst[i], le);
|
|
168
|
+
[Ah[i], Al[i]] = [h, l];
|
|
169
|
+
}
|
|
170
|
+
return [Ah, Al];
|
|
171
|
+
}
|
|
172
|
+
var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
173
|
+
var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
174
|
+
var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
175
|
+
var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
176
|
+
|
|
177
|
+
export {
|
|
178
|
+
anumber,
|
|
179
|
+
abytes,
|
|
180
|
+
ahash,
|
|
181
|
+
aexists,
|
|
182
|
+
aoutput,
|
|
183
|
+
u32,
|
|
184
|
+
clean,
|
|
185
|
+
createView,
|
|
186
|
+
rotr,
|
|
187
|
+
rotl,
|
|
188
|
+
swap32IfBE,
|
|
189
|
+
bytesToHex,
|
|
190
|
+
asyncLoop,
|
|
191
|
+
toBytes,
|
|
192
|
+
kdfInputToBytes,
|
|
193
|
+
concatBytes,
|
|
194
|
+
checkOpts,
|
|
195
|
+
Hash,
|
|
196
|
+
createHasher,
|
|
197
|
+
randomBytes,
|
|
198
|
+
split,
|
|
199
|
+
rotlSH,
|
|
200
|
+
rotlSL,
|
|
201
|
+
rotlBH,
|
|
202
|
+
rotlBL
|
|
203
|
+
};
|
|
204
|
+
/*! Bundled license information:
|
|
205
|
+
|
|
206
|
+
@noble/hashes/esm/utils.js:
|
|
207
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
208
|
+
*/
|
|
209
|
+
//# sourceMappingURL=chunk-5CLSD5YN.js.map
|