tenjin-cli 0.1.0-alpha.4 → 0.1.0-alpha.7
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 +269 -38
- package/dist/{buy-OOOLUDND.js → buy-XVOMNWKN.js} +21 -18
- package/dist/{candidate-TWCWTFGA.js → candidate-DJB2NNTG.js} +7 -8
- package/dist/{chunk-KXIX7YDV.js → chunk-2KIDDWQO.js} +5 -5
- package/dist/{chunk-NXCJN2FJ.js → chunk-2L73UI6T.js} +51 -42
- package/dist/chunk-2L73UI6T.js.map +1 -0
- package/dist/{chunk-OJD54DIU.js → chunk-2YX6LTCD.js} +5 -5
- package/dist/{chunk-H5ETJRQD.js → chunk-5X4EBGGU.js} +22 -14
- package/dist/chunk-5X4EBGGU.js.map +1 -0
- package/dist/chunk-6S44OLND.js +699 -0
- package/dist/chunk-6S44OLND.js.map +1 -0
- package/dist/{chunk-FU6MCSLG.js → chunk-7WDY4AXV.js} +2 -64
- package/dist/chunk-7WDY4AXV.js.map +1 -0
- package/dist/{chunk-VV4P5RVK.js → chunk-BBUYCDSG.js} +16 -4
- package/dist/chunk-BBUYCDSG.js.map +1 -0
- package/dist/chunk-CYRYVZPN.js +213 -0
- package/dist/chunk-CYRYVZPN.js.map +1 -0
- package/dist/{chunk-FHB3VKZW.js → chunk-DAJ56EUU.js} +5 -3
- package/dist/chunk-DAJ56EUU.js.map +1 -0
- package/dist/chunk-DH6D6QIO.js +239 -0
- package/dist/chunk-DH6D6QIO.js.map +1 -0
- package/dist/chunk-E6BNARCS.js +614 -0
- package/dist/chunk-E6BNARCS.js.map +1 -0
- package/dist/chunk-GABYDXWL.js +190 -0
- package/dist/chunk-GABYDXWL.js.map +1 -0
- package/dist/{chunk-EUQN3L5X.js → chunk-GM4RZUVU.js} +21 -9
- package/dist/chunk-GM4RZUVU.js.map +1 -0
- package/dist/{chunk-C4TIWOAM.js → chunk-GXYNLMUQ.js} +28 -11
- package/dist/chunk-GXYNLMUQ.js.map +1 -0
- package/dist/{chunk-6WWVYYSB.js → chunk-J6CVKC4M.js} +86 -4
- package/dist/chunk-J6CVKC4M.js.map +1 -0
- package/dist/{chunk-5JH7ZB6Z.js → chunk-KT2DGKFT.js} +76 -10
- package/dist/chunk-KT2DGKFT.js.map +1 -0
- package/dist/chunk-L6AV2Q73.js +105 -0
- package/dist/chunk-L6AV2Q73.js.map +1 -0
- package/dist/{chunk-333FOTUJ.js → chunk-MJZZTKCC.js} +108 -2
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/{chunk-XNNOR7F7.js → chunk-OTDI5FXG.js} +3 -5
- package/dist/{chunk-XNNOR7F7.js.map → chunk-OTDI5FXG.js.map} +1 -1
- package/dist/chunk-PIIWLEEG.js +337 -0
- package/dist/chunk-PIIWLEEG.js.map +1 -0
- package/dist/{chunk-ULLWHHIT.js → chunk-PLU3E63S.js} +468 -559
- package/dist/chunk-PLU3E63S.js.map +1 -0
- package/dist/chunk-QW2Q2KAH.js +27 -0
- package/dist/chunk-QW2Q2KAH.js.map +1 -0
- package/dist/{chunk-S3KZ3PPK.js → chunk-RGFBBNGP.js} +291 -59
- package/dist/chunk-RGFBBNGP.js.map +1 -0
- package/dist/chunk-SGK2B724.js +67 -0
- package/dist/chunk-SGK2B724.js.map +1 -0
- package/dist/chunk-UYP7G3GZ.js +412 -0
- package/dist/chunk-UYP7G3GZ.js.map +1 -0
- package/dist/{chunk-DPUMEMGM.js → chunk-VZ3AJCO5.js} +3 -5
- package/dist/{chunk-DPUMEMGM.js.map → chunk-VZ3AJCO5.js.map} +1 -1
- package/dist/{chunk-QH6677FJ.js → chunk-WDJTGVKN.js} +2 -2
- package/dist/{chunk-QH6677FJ.js.map → chunk-WDJTGVKN.js.map} +1 -1
- package/dist/{chunk-4GR7DGD6.js → chunk-WI5EOAQQ.js} +33 -256
- package/dist/{chunk-4GR7DGD6.js.map → chunk-WI5EOAQQ.js.map} +1 -1
- package/dist/{chunk-DPET3TW5.js → chunk-WRWCDLVK.js} +13 -12
- package/dist/chunk-WRWCDLVK.js.map +1 -0
- package/dist/chunk-XBJ3VLWX.js +35 -0
- package/dist/chunk-XBJ3VLWX.js.map +1 -0
- package/dist/chunk-ZEWY3RJ3.js +149 -0
- package/dist/chunk-ZEWY3RJ3.js.map +1 -0
- package/dist/chunk-ZFE7STX7.js +143 -0
- package/dist/chunk-ZFE7STX7.js.map +1 -0
- package/dist/{cli-AFSLAKR6.js → cli-7B2QNJG3.js} +247 -26
- package/dist/cli-7B2QNJG3.js.map +1 -0
- package/dist/{config-DBEEM3UA.js → config-SAQEQRFB.js} +7 -6
- package/dist/{doctor-XDA3YU6H.js → doctor-ENJ22XWN.js} +10 -8
- package/dist/{publish-IH7RJXGB.js → edit-2QO5GQDU.js} +19 -17
- package/dist/index.js +1 -1
- package/dist/{inspect-YBGDAG47.js → inspect-IPKKQB2S.js} +16 -15
- package/dist/{install-7J6KKEEP.js → install-7ZIYISQ7.js} +180 -133
- package/dist/install-7ZIYISQ7.js.map +1 -0
- package/dist/outcome-NSDE2KAJ.js +20 -0
- package/dist/publish-7WIFFNFG.js +40 -0
- package/dist/read-5TQR7LCF.js +158 -0
- package/dist/read-5TQR7LCF.js.map +1 -0
- package/dist/{run-DCZFEW2C.js → run-NPKIP26Y.js} +109 -34
- package/dist/{run-DCZFEW2C.js.map → run-NPKIP26Y.js.map} +1 -1
- package/dist/search-63ELMRZH.js +24 -0
- package/dist/send-ENE47KQE.js +222 -0
- package/dist/send-ENE47KQE.js.map +1 -0
- package/dist/session-FZU4VFFE.js +87 -0
- package/dist/session-FZU4VFFE.js.map +1 -0
- package/dist/{usdc-AU6ZIKA6.js → usdc-4VCDHFWX.js} +20 -4
- package/dist/{wallet-UWHSHWC6.js → wallet-OCCGEH6H.js} +8 -8
- package/dist/{wallet-HKG3GSTX.js → wallet-RBDVNZVR.js} +17 -7
- package/dist/wallet-RBDVNZVR.js.map +1 -0
- package/package.json +1 -1
- package/skills/tenjin/SKILL.md +32 -7
- package/skills/tenjin-publish/SKILL.md +109 -16
- package/skills/tenjin-search/SKILL.md +174 -15
- package/dist/chunk-333FOTUJ.js.map +0 -1
- package/dist/chunk-5JH7ZB6Z.js.map +0 -1
- package/dist/chunk-6WWVYYSB.js.map +0 -1
- package/dist/chunk-BXUS5UCT.js +0 -212
- package/dist/chunk-BXUS5UCT.js.map +0 -1
- package/dist/chunk-C4TIWOAM.js.map +0 -1
- package/dist/chunk-CJU555P5.js +0 -333
- package/dist/chunk-CJU555P5.js.map +0 -1
- package/dist/chunk-DPET3TW5.js.map +0 -1
- package/dist/chunk-EUQN3L5X.js.map +0 -1
- package/dist/chunk-FHB3VKZW.js.map +0 -1
- package/dist/chunk-FU6MCSLG.js.map +0 -1
- package/dist/chunk-H5ETJRQD.js.map +0 -1
- package/dist/chunk-MM4TGTST.js +0 -59
- package/dist/chunk-MM4TGTST.js.map +0 -1
- package/dist/chunk-MUBUQVC3.js +0 -67
- package/dist/chunk-MUBUQVC3.js.map +0 -1
- package/dist/chunk-NXCJN2FJ.js.map +0 -1
- package/dist/chunk-R7BMDJZM.js +0 -167
- package/dist/chunk-R7BMDJZM.js.map +0 -1
- package/dist/chunk-S3KZ3PPK.js.map +0 -1
- package/dist/chunk-ULLWHHIT.js.map +0 -1
- package/dist/chunk-VV4P5RVK.js.map +0 -1
- package/dist/chunk-YFREUEUI.js +0 -78
- package/dist/chunk-YFREUEUI.js.map +0 -1
- package/dist/cli-AFSLAKR6.js.map +0 -1
- package/dist/install-7J6KKEEP.js.map +0 -1
- package/dist/outcome-ZFGHX2XW.js +0 -20
- package/dist/search-R6NIQFXI.js +0 -24
- /package/dist/{buy-OOOLUDND.js.map → buy-XVOMNWKN.js.map} +0 -0
- /package/dist/{candidate-TWCWTFGA.js.map → candidate-DJB2NNTG.js.map} +0 -0
- /package/dist/{chunk-KXIX7YDV.js.map → chunk-2KIDDWQO.js.map} +0 -0
- /package/dist/{chunk-OJD54DIU.js.map → chunk-2YX6LTCD.js.map} +0 -0
- /package/dist/{config-DBEEM3UA.js.map → config-SAQEQRFB.js.map} +0 -0
- /package/dist/{doctor-XDA3YU6H.js.map → doctor-ENJ22XWN.js.map} +0 -0
- /package/dist/{inspect-YBGDAG47.js.map → edit-2QO5GQDU.js.map} +0 -0
- /package/dist/{outcome-ZFGHX2XW.js.map → inspect-IPKKQB2S.js.map} +0 -0
- /package/dist/{publish-IH7RJXGB.js.map → outcome-NSDE2KAJ.js.map} +0 -0
- /package/dist/{search-R6NIQFXI.js.map → publish-7WIFFNFG.js.map} +0 -0
- /package/dist/{usdc-AU6ZIKA6.js.map → search-63ELMRZH.js.map} +0 -0
- /package/dist/{wallet-HKG3GSTX.js.map → usdc-4VCDHFWX.js.map} +0 -0
- /package/dist/{wallet-UWHSHWC6.js.map → wallet-OCCGEH6H.js.map} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runSearch
|
|
4
|
+
} from "./chunk-5X4EBGGU.js";
|
|
5
|
+
import "./chunk-CYRYVZPN.js";
|
|
6
|
+
import "./chunk-VZ3AJCO5.js";
|
|
7
|
+
import "./chunk-OTDI5FXG.js";
|
|
8
|
+
import "./chunk-2L73UI6T.js";
|
|
9
|
+
import "./chunk-WWX32ML4.js";
|
|
10
|
+
import "./chunk-GXYNLMUQ.js";
|
|
11
|
+
import "./chunk-WDJTGVKN.js";
|
|
12
|
+
import "./chunk-XBJ3VLWX.js";
|
|
13
|
+
import "./chunk-2I4QTOLB.js";
|
|
14
|
+
import "./chunk-BBUYCDSG.js";
|
|
15
|
+
import "./chunk-DAJ56EUU.js";
|
|
16
|
+
import "./chunk-YBMMV4Y4.js";
|
|
17
|
+
import "./chunk-UO22YNY4.js";
|
|
18
|
+
import "./chunk-UYP7G3GZ.js";
|
|
19
|
+
import "./chunk-J6CVKC4M.js";
|
|
20
|
+
import "./chunk-ZXTAQYNA.js";
|
|
21
|
+
export {
|
|
22
|
+
runSearch
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=search-63ELMRZH.js.map
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
promptYesNo
|
|
4
|
+
} from "./chunk-QW2Q2KAH.js";
|
|
5
|
+
import {
|
|
6
|
+
describeWallet,
|
|
7
|
+
resolveWalletProvider
|
|
8
|
+
} from "./chunk-RGFBBNGP.js";
|
|
9
|
+
import "./chunk-WRWCDLVK.js";
|
|
10
|
+
import "./chunk-2I4QTOLB.js";
|
|
11
|
+
import "./chunk-BBUYCDSG.js";
|
|
12
|
+
import {
|
|
13
|
+
resolveContextSettings
|
|
14
|
+
} from "./chunk-DAJ56EUU.js";
|
|
15
|
+
import "./chunk-YBMMV4Y4.js";
|
|
16
|
+
import "./chunk-UO22YNY4.js";
|
|
17
|
+
import {
|
|
18
|
+
SEND_MAX_UNSET,
|
|
19
|
+
parseUsdToAtomic,
|
|
20
|
+
toMoney
|
|
21
|
+
} from "./chunk-UYP7G3GZ.js";
|
|
22
|
+
import {
|
|
23
|
+
CliError
|
|
24
|
+
} from "./chunk-J6CVKC4M.js";
|
|
25
|
+
import {
|
|
26
|
+
FeeCapExceededError,
|
|
27
|
+
SendPendingError,
|
|
28
|
+
SendRevertedError,
|
|
29
|
+
USDC_ADDRESS,
|
|
30
|
+
broadcastUsdcSend,
|
|
31
|
+
getUsdcBalance,
|
|
32
|
+
prepareUsdcSend
|
|
33
|
+
} from "./chunk-MJZZTKCC.js";
|
|
34
|
+
import "./chunk-7FK2UN2T.js";
|
|
35
|
+
import "./chunk-M2O56UK7.js";
|
|
36
|
+
import "./chunk-UHTVXQ2O.js";
|
|
37
|
+
import "./chunk-W6R3HAAG.js";
|
|
38
|
+
import "./chunk-U5S527PP.js";
|
|
39
|
+
import {
|
|
40
|
+
formatEther,
|
|
41
|
+
getAddress,
|
|
42
|
+
isAddress
|
|
43
|
+
} from "./chunk-47PP7TAG.js";
|
|
44
|
+
import "./chunk-XJN5WUKL.js";
|
|
45
|
+
import "./chunk-RBJPAZFI.js";
|
|
46
|
+
import "./chunk-KYQVEKP5.js";
|
|
47
|
+
import "./chunk-ZXTAQYNA.js";
|
|
48
|
+
|
|
49
|
+
// src/commands/send.ts
|
|
50
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
51
|
+
var DEAD_ADDRESS = "0x000000000000000000000000000000000000dEaD";
|
|
52
|
+
async function runSend(args, ctx, deps = {}) {
|
|
53
|
+
requireUsdc(args.token);
|
|
54
|
+
const amountAtomic = BigInt(parseUsdToAtomic(args.amount));
|
|
55
|
+
if (amountAtomic === 0n) {
|
|
56
|
+
throw new CliError("USAGE", "The send amount must be greater than zero.", {
|
|
57
|
+
fix: "Pass a positive decimal USDC amount, e.g. `tenjin send 5 usdc <to>`."
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const to = parseRecipient(args.to);
|
|
61
|
+
const provider = resolveWalletProvider(
|
|
62
|
+
ctx,
|
|
63
|
+
deps.provider !== void 0 ? { provider: deps.provider } : {}
|
|
64
|
+
);
|
|
65
|
+
const desc = await describeWallet(provider);
|
|
66
|
+
if (to.toLowerCase() === desc.address.toLowerCase()) {
|
|
67
|
+
throw new CliError("USAGE", "The recipient is this wallet itself.", {
|
|
68
|
+
fix: "Pass the destination wallet address, not the sending one."
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const { rpcUrl, sendMaxAmountAtomic } = await resolveContextSettings(ctx);
|
|
72
|
+
enforceSendCap(amountAtomic, sendMaxAmountAtomic);
|
|
73
|
+
let balance;
|
|
74
|
+
try {
|
|
75
|
+
balance = await getUsdcBalance(desc.address, rpcUrl);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
throw new CliError("RPC_ERROR", `Could not read the USDC balance from ${rpcUrl}.`, {
|
|
78
|
+
fix: "Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.",
|
|
79
|
+
cause: err
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (amountAtomic > balance) {
|
|
83
|
+
throw new CliError("REFUSED", "The amount exceeds the wallet USDC balance.", {
|
|
84
|
+
fix: "Check `tenjin wallet balance` and send at most that amount.",
|
|
85
|
+
details: {
|
|
86
|
+
requested: toMoney(amountAtomic.toString()),
|
|
87
|
+
balance: toMoney(balance.toString())
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
let prepared;
|
|
92
|
+
try {
|
|
93
|
+
prepared = await prepareUsdcSend({ from: desc.address, to, amountAtomic, rpcUrl });
|
|
94
|
+
} catch (err) {
|
|
95
|
+
if (err instanceof FeeCapExceededError) {
|
|
96
|
+
throw new CliError("REFUSED", "The RPC gas/fee estimate is abnormal for Base; refusing.", {
|
|
97
|
+
fix: "Check `tenjin config get rpcUrl` points at a trusted Base RPC; if the RPC is fine, Base fees are spiking \u2014 wait and retry.",
|
|
98
|
+
cause: err
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
throw new CliError("RPC_ERROR", "Could not prepare the transfer on Base.", {
|
|
102
|
+
fix: "Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.",
|
|
103
|
+
cause: err
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (prepared.ethBalanceWei < prepared.feeWei) {
|
|
107
|
+
throw new CliError("REFUSED", "The wallet has no ETH on Base to pay the network fee.", {
|
|
108
|
+
fix: `Send a little ETH on Base to ${desc.address} (about ${formatEther(prepared.feeWei)} ETH needed), then retry.`,
|
|
109
|
+
details: {
|
|
110
|
+
ethBalanceWei: prepared.ethBalanceWei.toString(),
|
|
111
|
+
feeWei: prepared.feeWei.toString()
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const approved = await confirmSend(ctx, deps, args.yes === true, {
|
|
116
|
+
amountAtomic,
|
|
117
|
+
to,
|
|
118
|
+
from: desc.address,
|
|
119
|
+
feeWei: prepared.feeWei
|
|
120
|
+
});
|
|
121
|
+
if (!approved) {
|
|
122
|
+
throw new CliError("REFUSED", "Send not confirmed.", {
|
|
123
|
+
fix: "Verify the recipient and amount, then re-run with --yes to approve this transfer.",
|
|
124
|
+
details: { to, amount: toMoney(amountAtomic.toString()) }
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const signer = await provider.getSigner();
|
|
128
|
+
if (signer.address.toLowerCase() !== desc.address.toLowerCase()) {
|
|
129
|
+
throw new CliError(
|
|
130
|
+
"PROVIDER_ERROR",
|
|
131
|
+
`The signer address ${signer.address} does not match the confirmed wallet ${desc.address}.`,
|
|
132
|
+
{ fix: "The wallet changed between preview and signing; re-run `tenjin send`." }
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
let txHash;
|
|
136
|
+
try {
|
|
137
|
+
txHash = await broadcastUsdcSend({ signer, prepared, rpcUrl });
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err instanceof SendRevertedError) {
|
|
140
|
+
throw new CliError("SEND_FAILED", "The transfer was mined but reverted; no USDC moved.", {
|
|
141
|
+
fix: "Check the transaction on a Base explorer, then retry if the cause is transient.",
|
|
142
|
+
details: { txHash: err.txHash },
|
|
143
|
+
cause: err
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (err instanceof SendPendingError) {
|
|
147
|
+
throw new CliError("SEND_FAILED", "The transfer was broadcast but not confirmed in time.", {
|
|
148
|
+
fix: "Check the transaction on a Base explorer before retrying: it may still mine, and an immediate retry could double-send.",
|
|
149
|
+
details: { txHash: err.txHash, pending: true },
|
|
150
|
+
cause: err
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
throw new CliError("RPC_ERROR", "The transfer could not be sent on Base.", {
|
|
154
|
+
fix: "Check the network and RPC, then retry.",
|
|
155
|
+
cause: err
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
const amount = toMoney(amountAtomic.toString());
|
|
159
|
+
return {
|
|
160
|
+
data: { txHash, from: signer.address, to, token: "USDC", network: "base", amount },
|
|
161
|
+
humanLines: [`Sent ${amount.usd} USDC on Base to ${to}`, `Tx: ${txHash}`]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function enforceSendCap(amountAtomic, capAtomic) {
|
|
165
|
+
if (capAtomic === SEND_MAX_UNSET) {
|
|
166
|
+
throw new CliError(
|
|
167
|
+
"POLICY_REFUSED",
|
|
168
|
+
"No sendMaxAmount is configured; a per-send cap must be set before the first send.",
|
|
169
|
+
{
|
|
170
|
+
fix: "Run `tenjin config set sendMaxAmount <usd>` (or `0` to disable send, or `none` to opt in to uncapped), then retry. --yes does not bypass this."
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
if (capAtomic === null) return;
|
|
175
|
+
if (capAtomic === 0n) {
|
|
176
|
+
throw new CliError("POLICY_REFUSED", "Sending is disabled by sendMaxAmount = 0.", {
|
|
177
|
+
fix: "Run `tenjin config set sendMaxAmount <usd|none>` to allow sends."
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (amountAtomic > capAtomic) {
|
|
181
|
+
throw new CliError("POLICY_REFUSED", "The amount exceeds the sendMaxAmount cap.", {
|
|
182
|
+
fix: "Send a smaller amount, or raise the cap with `tenjin config set sendMaxAmount <usd>`.",
|
|
183
|
+
details: { requested: toMoney(amountAtomic.toString()), cap: toMoney(capAtomic.toString()) }
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function requireUsdc(token) {
|
|
188
|
+
if (token.trim().toLowerCase() === "usdc") return;
|
|
189
|
+
throw new CliError("USAGE", `Unsupported token: ${JSON.stringify(token)}`, {
|
|
190
|
+
fix: "Only USDC on Base is supported: `tenjin send <amount> usdc <to>`."
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function parseRecipient(raw) {
|
|
194
|
+
const trimmed = raw.trim();
|
|
195
|
+
if (!isAddress(trimmed)) {
|
|
196
|
+
throw new CliError("USAGE", `Invalid recipient address: ${JSON.stringify(raw)}`, {
|
|
197
|
+
fix: "Pass a 0x-prefixed 20-byte address, checksummed or all-lowercase (lowercase skips the checksum typo check)."
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
const to = getAddress(trimmed);
|
|
201
|
+
if (to === USDC_ADDRESS || to === ZERO_ADDRESS || to === DEAD_ADDRESS) {
|
|
202
|
+
throw new CliError("USAGE", "The recipient is a known fund-destroying address.", {
|
|
203
|
+
fix: "Tokens sent to the token contract, the zero address, or the burn address are unrecoverable. Pass the destination wallet address."
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return to;
|
|
207
|
+
}
|
|
208
|
+
async function confirmSend(ctx, deps, yes, d) {
|
|
209
|
+
if (yes) return true;
|
|
210
|
+
const prompt = `Send ${toMoney(d.amountAtomic.toString()).usd} USDC on Base
|
|
211
|
+
from ${d.from}
|
|
212
|
+
to ${d.to}
|
|
213
|
+
network fee up to ~${formatEther(d.feeWei)} ETH
|
|
214
|
+
This moves funds out of the agent wallet and cannot be undone. [y/N] `;
|
|
215
|
+
if (deps.confirm !== void 0) return deps.confirm(prompt);
|
|
216
|
+
if (!ctx.io.isTTY || !process.stdin.isTTY) return false;
|
|
217
|
+
return promptYesNo(prompt);
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
runSend
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=send-ENE47KQE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/send.ts"],"sourcesContent":["import { formatEther, getAddress, isAddress, type Address } from 'viem';\nimport { SEND_MAX_UNSET } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { parseUsdToAtomic, toMoney } from '../lib/money';\nimport { promptYesNo } from '../lib/prompt';\nimport { resolveContextSettings } from '../lib/settings';\nimport {\n broadcastUsdcSend,\n FeeCapExceededError,\n getUsdcBalance,\n prepareUsdcSend,\n SendPendingError,\n SendRevertedError,\n USDC_ADDRESS,\n} from '../lib/usdc';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin send <amount> <token> <to>`: the escape hatch that moves funds OUT of\n * the agent wallet, complementary to delegation (which redirects future revenue\n * off the hot key; this is for a balance already on it). Invariants a reader\n * cannot derive from the code order alone:\n * - the confirm (buy's posture: interactive y/N, `--yes` bypasses the prompt\n * only, headless without it refuses) runs BEFORE the signer is resolved, so\n * no refusal branch ever touches key material;\n * - `sendMaxAmount` is a spend-policy gate, NOT satisfiable by --yes, and it\n * has NO default: unset refuses until `config set sendMaxAmount` is run\n * (require-set-before-first-send; \"none\" is an explicit uncapped opt-in);\n * - the verb is deliberately absent from the MCP toolset (spec 10's narrow\n * toolset) and the skill adapters — human-invoked only, both pinned by tests.\n */\n\nexport interface SendArgs {\n /** Decimal USD at the edge (O1 convention); converted to atomic exactly once. */\n amount: string;\n token: string;\n /** Recipient address, 0x-prefixed; checksummed or all-lowercase. */\n to: string;\n /** Skip the interactive confirm. REQUIRED to send when not at a TTY. */\n yes?: boolean;\n}\n\nexport interface SendDeps {\n /** Test seam: bypass the local wallet provider. */\n provider?: WalletProvider;\n /** Interactive-confirm seam; defaults to a TTY y/n prompt (same shape as buy). */\n confirm?: (prompt: string) => Promise<boolean>;\n}\n\nconst ZERO_ADDRESS: Address = '0x0000000000000000000000000000000000000000';\nconst DEAD_ADDRESS: Address = '0x000000000000000000000000000000000000dEaD';\n\nexport async function runSend(\n args: SendArgs,\n ctx: CommandContext,\n deps: SendDeps = {},\n): Promise<CommandResult> {\n requireUsdc(args.token);\n const amountAtomic = BigInt(parseUsdToAtomic(args.amount));\n if (amountAtomic === 0n) {\n throw new CliError('USAGE', 'The send amount must be greater than zero.', {\n fix: 'Pass a positive decimal USDC amount, e.g. `tenjin send 5 usdc <to>`.',\n });\n }\n const to = parseRecipient(args.to);\n\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // Address + posture only; surfaces WALLET_MISSING. No key material yet.\n const desc = await describeWallet(provider);\n if (to.toLowerCase() === desc.address.toLowerCase()) {\n throw new CliError('USAGE', 'The recipient is this wallet itself.', {\n fix: 'Pass the destination wallet address, not the sending one.',\n });\n }\n\n const { rpcUrl, sendMaxAmountAtomic } = await resolveContextSettings(ctx);\n enforceSendCap(amountAtomic, sendMaxAmountAtomic);\n\n let balance: bigint;\n try {\n balance = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (amountAtomic > balance) {\n throw new CliError('REFUSED', 'The amount exceeds the wallet USDC balance.', {\n fix: 'Check `tenjin wallet balance` and send at most that amount.',\n details: {\n requested: toMoney(amountAtomic.toString()),\n balance: toMoney(balance.toString()),\n },\n });\n }\n\n // Read-only chain prep before the confirm, so the prompt can show the fee and\n // a wallet without gas refuses before asking anyone to approve anything.\n let prepared;\n try {\n prepared = await prepareUsdcSend({ from: desc.address, to, amountAtomic, rpcUrl });\n } catch (err) {\n if (err instanceof FeeCapExceededError) {\n throw new CliError('REFUSED', 'The RPC gas/fee estimate is abnormal for Base; refusing.', {\n fix: 'Check `tenjin config get rpcUrl` points at a trusted Base RPC; if the RPC is fine, Base fees are spiking — wait and retry.',\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'Could not prepare the transfer on Base.', {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (prepared.ethBalanceWei < prepared.feeWei) {\n throw new CliError('REFUSED', 'The wallet has no ETH on Base to pay the network fee.', {\n fix: `Send a little ETH on Base to ${desc.address} (about ${formatEther(prepared.feeWei)} ETH needed), then retry.`,\n details: {\n ethBalanceWei: prepared.ethBalanceWei.toString(),\n feeWei: prepared.feeWei.toString(),\n },\n });\n }\n\n const approved = await confirmSend(ctx, deps, args.yes === true, {\n amountAtomic,\n to,\n from: desc.address,\n feeWei: prepared.feeWei,\n });\n if (!approved) {\n throw new CliError('REFUSED', 'Send not confirmed.', {\n fix: 'Verify the recipient and amount, then re-run with --yes to approve this transfer.',\n details: { to, amount: toMoney(amountAtomic.toString()) },\n });\n }\n\n // The only door to the key; a missing passphrase entry refuses here with the\n // provider's coded error. The signer must be the wallet the human just saw:\n // the local provider guarantees it, a hosted one is only trusted after this.\n const signer = await provider.getSigner();\n if (signer.address.toLowerCase() !== desc.address.toLowerCase()) {\n throw new CliError(\n 'PROVIDER_ERROR',\n `The signer address ${signer.address} does not match the confirmed wallet ${desc.address}.`,\n { fix: 'The wallet changed between preview and signing; re-run `tenjin send`.' },\n );\n }\n\n let txHash: string;\n try {\n txHash = await broadcastUsdcSend({ signer, prepared, rpcUrl });\n } catch (err) {\n if (err instanceof SendRevertedError) {\n throw new CliError('SEND_FAILED', 'The transfer was mined but reverted; no USDC moved.', {\n fix: 'Check the transaction on a Base explorer, then retry if the cause is transient.',\n details: { txHash: err.txHash },\n cause: err,\n });\n }\n if (err instanceof SendPendingError) {\n throw new CliError('SEND_FAILED', 'The transfer was broadcast but not confirmed in time.', {\n fix: 'Check the transaction on a Base explorer before retrying: it may still mine, and an immediate retry could double-send.',\n details: { txHash: err.txHash, pending: true },\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'The transfer could not be sent on Base.', {\n fix: 'Check the network and RPC, then retry.',\n cause: err,\n });\n }\n\n const amount = toMoney(amountAtomic.toString());\n return {\n data: { txHash, from: signer.address, to, token: 'USDC', network: 'base', amount },\n humanLines: [`Sent ${amount.usd} USDC on Base to ${to}`, `Tx: ${txHash}`],\n };\n}\n\n/**\n * The hard per-send cap (`config set sendMaxAmount`): a policy gate, not a\n * confirm — no branch here is satisfiable by --yes. There is no default cap:\n * an unset key refuses (require-set-before-first-send), exactly as strict as\n * the set-cap refusals below.\n */\nfunction enforceSendCap(\n amountAtomic: bigint,\n capAtomic: bigint | null | typeof SEND_MAX_UNSET,\n): void {\n if (capAtomic === SEND_MAX_UNSET) {\n throw new CliError(\n 'POLICY_REFUSED',\n 'No sendMaxAmount is configured; a per-send cap must be set before the first send.',\n {\n fix: 'Run `tenjin config set sendMaxAmount <usd>` (or `0` to disable send, or `none` to opt in to uncapped), then retry. --yes does not bypass this.',\n },\n );\n }\n if (capAtomic === null) return;\n if (capAtomic === 0n) {\n throw new CliError('POLICY_REFUSED', 'Sending is disabled by sendMaxAmount = 0.', {\n fix: 'Run `tenjin config set sendMaxAmount <usd|none>` to allow sends.',\n });\n }\n if (amountAtomic > capAtomic) {\n throw new CliError('POLICY_REFUSED', 'The amount exceeds the sendMaxAmount cap.', {\n fix: 'Send a smaller amount, or raise the cap with `tenjin config set sendMaxAmount <usd>`.',\n details: { requested: toMoney(amountAtomic.toString()), cap: toMoney(capAtomic.toString()) },\n });\n }\n}\n\n/** USDC on Base only; anything else is a usage error, not a guess. */\nfunction requireUsdc(token: string): void {\n if (token.trim().toLowerCase() === 'usdc') return;\n throw new CliError('USAGE', `Unsupported token: ${JSON.stringify(token)}`, {\n fix: 'Only USDC on Base is supported: `tenjin send <amount> usdc <to>`.',\n });\n}\n\n/**\n * Validate and resolve the recipient. Strict `isAddress` refuses malformed input\n * and a bad EIP-55 checksum on MIXED-CASE input (all-lowercase input carries no\n * checksum to verify — that limit is inherent to the format); `getAddress` then\n * yields the checksummed form the preview shows and the transfer targets. Known\n * fund-destroying destinations (the USDC contract, the zero address, the burn\n * address) refuse outright.\n */\nfunction parseRecipient(raw: string): Address {\n const trimmed = raw.trim();\n if (!isAddress(trimmed)) {\n throw new CliError('USAGE', `Invalid recipient address: ${JSON.stringify(raw)}`, {\n fix: 'Pass a 0x-prefixed 20-byte address, checksummed or all-lowercase (lowercase skips the checksum typo check).',\n });\n }\n const to = getAddress(trimmed);\n if (to === USDC_ADDRESS || to === ZERO_ADDRESS || to === DEAD_ADDRESS) {\n throw new CliError('USAGE', 'The recipient is a known fund-destroying address.', {\n fix: 'Tokens sent to the token contract, the zero address, or the burn address are unrecoverable. Pass the destination wallet address.',\n });\n }\n return to;\n}\n\ninterface ConfirmDetails {\n amountAtomic: bigint;\n to: Address;\n from: Address;\n feeWei: bigint;\n}\n\n/** Buy's confirm posture; the preview names the resolved recipient, amount, and fee. */\nasync function confirmSend(\n ctx: CommandContext,\n deps: SendDeps,\n yes: boolean,\n d: ConfirmDetails,\n): Promise<boolean> {\n if (yes) return true;\n const prompt =\n `Send ${toMoney(d.amountAtomic.toString()).usd} USDC on Base\\n` +\n ` from ${d.from}\\n` +\n ` to ${d.to}\\n` +\n ` network fee up to ~${formatEther(d.feeWei)} ETH\\n` +\n `This moves funds out of the agent wallet and cannot be undone. [y/N] `;\n if (deps.confirm !== undefined) return deps.confirm(prompt);\n // Both streams must be real TTYs; piped stdin/stdout without --yes refuses.\n if (!ctx.io.isTTY || !process.stdin.isTTY) return false;\n return promptYesNo(prompt);\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
SESSION_CHAIN_ID,
|
|
4
|
+
establishSession
|
|
5
|
+
} from "./chunk-ZFE7STX7.js";
|
|
6
|
+
import "./chunk-7WDY4AXV.js";
|
|
7
|
+
import "./chunk-POJRB2AE.js";
|
|
8
|
+
import {
|
|
9
|
+
isSessionUsable,
|
|
10
|
+
loadSessionFile
|
|
11
|
+
} from "./chunk-GABYDXWL.js";
|
|
12
|
+
import {
|
|
13
|
+
describeWallet,
|
|
14
|
+
resolveWalletProvider
|
|
15
|
+
} from "./chunk-RGFBBNGP.js";
|
|
16
|
+
import "./chunk-WRWCDLVK.js";
|
|
17
|
+
import {
|
|
18
|
+
originOf
|
|
19
|
+
} from "./chunk-XBJ3VLWX.js";
|
|
20
|
+
import "./chunk-2I4QTOLB.js";
|
|
21
|
+
import "./chunk-BBUYCDSG.js";
|
|
22
|
+
import "./chunk-KZAAWQNP.js";
|
|
23
|
+
import "./chunk-S5RYMCV6.js";
|
|
24
|
+
import "./chunk-YLYINX2H.js";
|
|
25
|
+
import {
|
|
26
|
+
resolveContextSettings
|
|
27
|
+
} from "./chunk-DAJ56EUU.js";
|
|
28
|
+
import "./chunk-YBMMV4Y4.js";
|
|
29
|
+
import "./chunk-UO22YNY4.js";
|
|
30
|
+
import "./chunk-UYP7G3GZ.js";
|
|
31
|
+
import {
|
|
32
|
+
CliError
|
|
33
|
+
} from "./chunk-J6CVKC4M.js";
|
|
34
|
+
import "./chunk-M2O56UK7.js";
|
|
35
|
+
import "./chunk-UHTVXQ2O.js";
|
|
36
|
+
import "./chunk-W6R3HAAG.js";
|
|
37
|
+
import "./chunk-47PP7TAG.js";
|
|
38
|
+
import "./chunk-XJN5WUKL.js";
|
|
39
|
+
import "./chunk-RBJPAZFI.js";
|
|
40
|
+
import "./chunk-KYQVEKP5.js";
|
|
41
|
+
import "./chunk-ZXTAQYNA.js";
|
|
42
|
+
|
|
43
|
+
// src/commands/session.ts
|
|
44
|
+
var V1_SCOPE = "read";
|
|
45
|
+
async function runSessionStart(args, ctx, deps = {}) {
|
|
46
|
+
const now = deps.now ?? Date.now;
|
|
47
|
+
if (args.scope !== void 0 && args.scope !== V1_SCOPE) {
|
|
48
|
+
throw new CliError("USAGE", `Unsupported session scope: ${JSON.stringify(args.scope)}`, {
|
|
49
|
+
fix: "This version mints read-scoped sessions only; run `tenjin session start --scope read` (or omit the flag). A write-capable session is minted by `tenjin publish` / `tenjin edit` on the run that needs it."
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const settings = await resolveContextSettings(ctx);
|
|
53
|
+
const provider = resolveWalletProvider(
|
|
54
|
+
ctx,
|
|
55
|
+
deps.provider !== void 0 ? { provider: deps.provider } : {}
|
|
56
|
+
);
|
|
57
|
+
const wallet = await describeWallet(provider);
|
|
58
|
+
const origin = originOf(settings.baseUrl);
|
|
59
|
+
const cached = await loadSessionFile(ctx.dataDir);
|
|
60
|
+
if (cached !== null && isSessionUsable(cached, wallet.address, now(), V1_SCOPE, origin)) {
|
|
61
|
+
return receipt(cached, false);
|
|
62
|
+
}
|
|
63
|
+
const signer = await provider.getSigner();
|
|
64
|
+
const file = await establishSession({
|
|
65
|
+
signer,
|
|
66
|
+
baseUrl: settings.baseUrl,
|
|
67
|
+
chainId: SESSION_CHAIN_ID,
|
|
68
|
+
dataDir: ctx.dataDir,
|
|
69
|
+
scope: V1_SCOPE
|
|
70
|
+
});
|
|
71
|
+
return receipt(file, true);
|
|
72
|
+
}
|
|
73
|
+
function receipt(file, minted) {
|
|
74
|
+
const { address, origin, scope, exp } = file;
|
|
75
|
+
const what = `${address} (scope ${scope}) for ${origin}`;
|
|
76
|
+
return {
|
|
77
|
+
data: { status: minted ? "created" : "reused", address, origin, scope, exp },
|
|
78
|
+
humanLines: [
|
|
79
|
+
minted ? `Session key minted for ${what}, expires ${exp}.` : `Session key already active for ${what}, expires ${exp}. No wallet signature needed.`,
|
|
80
|
+
"`tenjin read` can now recover pieces this wallet already owns from that origin. It still cannot pay."
|
|
81
|
+
]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
runSessionStart
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=session-FZU4VFFE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/session.ts"],"sourcesContent":["import { CliError } from '../lib/errors';\nimport { resolveContextSettings } from '../lib/settings';\nimport { establishSession, SESSION_CHAIN_ID } from '../lib/session-key';\nimport { isSessionUsable, loadSessionFile, type SessionScope } from '../lib/session-present';\nimport { originOf } from '../lib/url';\nimport type { SessionFile } from '../lib/session-present';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin session start --scope read`: open the wallet ONCE and mint a ≤24h\n * P-256 session key that `tenjin read` can then present, unattended, to recover a\n * piece this wallet already owns but has not cached on this machine.\n *\n * This is the attended half of a deliberate split: `read` cannot open a keystore,\n * so the one wallet signature a recovery needs comes from a verb the operator\n * invokes on purpose. It spends nothing and cannot, but it does open the\n * keystore, which is why it sits in the OPT-IN tier beside `buy`.\n *\n * What it leaves on disk is a wallet-derived credential. Treat it as one: it is\n * bound to the origin it was minted against and every presenter re-checks that,\n * and the receipt below carries no key material. `lib/permissions.ts` states the\n * exposure an operator is accepting.\n *\n * v1 accepts NO other scope. `--scope read+write` is refused rather than\n * forwarded: a prefix allowlist rule pins the verb and not the flags, so the only\n * way `Bash(tenjin session start:*)` can be a non-escalatable grant is for every\n * command line it matches to mint the narrow scope. The write path keeps minting\n * its own `read+write` session lazily, from `publish`/`edit`, where a human is\n * already consenting to a write.\n */\n\n/** The only scope v1 mints; see the docblock for why that is load-bearing. */\nconst V1_SCOPE: SessionScope = 'read';\n\nexport interface SessionStartArgs {\n /** Raw `--scope`; validated at the edge, USAGE on anything but `read`. */\n scope?: string;\n}\n\nexport interface SessionStartDeps {\n provider?: WalletProvider;\n env?: NodeJS.ProcessEnv;\n /** Clock seam (ms since epoch) for the reuse decision. */\n now?: () => number;\n}\n\nexport async function runSessionStart(\n args: SessionStartArgs,\n ctx: CommandContext,\n deps: SessionStartDeps = {},\n): Promise<CommandResult> {\n const now = deps.now ?? Date.now;\n if (args.scope !== undefined && args.scope !== V1_SCOPE) {\n throw new CliError('USAGE', `Unsupported session scope: ${JSON.stringify(args.scope)}`, {\n fix: 'This version mints read-scoped sessions only; run `tenjin session start --scope read` (or omit the flag). A write-capable session is minted by `tenjin publish` / `tenjin edit` on the run that needs it.',\n });\n }\n\n const settings = await resolveContextSettings(ctx);\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // describe() reports the address WITHOUT unlocking the key, which is what makes\n // the reuse path below cost no wallet interaction (no passphrase prompt).\n const wallet = await describeWallet(provider);\n\n // Idempotent: a live session wide enough AND minted for this origin is reused,\n // so a second run opens no wallet, and a cached `read+write` (publish's) is\n // never downgraded. A session for another deployment is not reusable.\n const origin = originOf(settings.baseUrl);\n const cached = await loadSessionFile(ctx.dataDir);\n if (cached !== null && isSessionUsable(cached, wallet.address, now(), V1_SCOPE, origin)) {\n return receipt(cached, false);\n }\n\n const signer = await provider.getSigner();\n const file = await establishSession({\n signer,\n baseUrl: settings.baseUrl,\n chainId: SESSION_CHAIN_ID,\n dataDir: ctx.dataDir,\n scope: V1_SCOPE,\n });\n return receipt(file, true);\n}\n\n/**\n * The receipt. Address, origin, scope and expiry ONLY — never the delegation and\n * never the private JWK: this output lands in an agent's transcript, and a\n * session key printed there outlives the 0600 file it was written to.\n */\nfunction receipt(file: SessionFile, minted: boolean): CommandResult {\n const { address, origin, scope, exp } = file;\n const what = `${address} (scope ${scope}) for ${origin}`;\n return {\n data: { status: minted ? 'created' : 'reused', address, origin, scope, exp },\n humanLines: [\n minted\n ? `Session key minted for ${what}, expires ${exp}.`\n : `Session key already active for ${what}, expires ${exp}. No wallet signature needed.`,\n '`tenjin read` can now recover pieces this wallet already owns from that origin. It still cannot pay.',\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAM,WAAyB;AAc/B,eAAsB,gBACpB,MACA,KACA,OAAyB,CAAC,GACF;AACxB,QAAM,MAAM,KAAK,OAAO,KAAK;AAC7B,MAAI,KAAK,UAAU,UAAa,KAAK,UAAU,UAAU;AACvD,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI;AAAA,MACtF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,WAAW;AAAA,IACf;AAAA,IACA,KAAK,aAAa,SAAY,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;AAAA,EAC/D;AAGA,QAAM,SAAS,MAAM,eAAe,QAAQ;AAK5C,QAAM,SAAS,SAAS,SAAS,OAAO;AACxC,QAAM,SAAS,MAAM,gBAAgB,IAAI,OAAO;AAChD,MAAI,WAAW,QAAQ,gBAAgB,QAAQ,OAAO,SAAS,IAAI,GAAG,UAAU,MAAM,GAAG;AACvF,WAAO,QAAQ,QAAQ,KAAK;AAAA,EAC9B;AAEA,QAAM,SAAS,MAAM,SAAS,UAAU;AACxC,QAAM,OAAO,MAAM,iBAAiB;AAAA,IAClC;AAAA,IACA,SAAS,SAAS;AAAA,IAClB,SAAS;AAAA,IACT,SAAS,IAAI;AAAA,IACb,OAAO;AAAA,EACT,CAAC;AACD,SAAO,QAAQ,MAAM,IAAI;AAC3B;AAOA,SAAS,QAAQ,MAAmB,QAAgC;AAClE,QAAM,EAAE,SAAS,QAAQ,OAAO,IAAI,IAAI;AACxC,QAAM,OAAO,GAAG,OAAO,WAAW,KAAK,SAAS,MAAM;AACtD,SAAO;AAAA,IACL,MAAM,EAAE,QAAQ,SAAS,YAAY,UAAU,SAAS,QAAQ,OAAO,IAAI;AAAA,IAC3E,YAAY;AAAA,MACV,SACI,0BAA0B,IAAI,aAAa,GAAG,MAC9C,kCAAkC,IAAI,aAAa,GAAG;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
FeeCapExceededError,
|
|
4
|
+
SEND_GAS_CAP,
|
|
5
|
+
SEND_MAX_FEE_PER_GAS_CAP,
|
|
6
|
+
SEND_MAX_PRIORITY_FEE_CAP,
|
|
7
|
+
SendPendingError,
|
|
8
|
+
SendRevertedError,
|
|
3
9
|
USDC_ADDRESS,
|
|
4
10
|
USDC_DECIMALS,
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
broadcastUsdcSend,
|
|
12
|
+
getUsdcBalance,
|
|
13
|
+
prepareUsdcSend
|
|
14
|
+
} from "./chunk-MJZZTKCC.js";
|
|
7
15
|
import "./chunk-7FK2UN2T.js";
|
|
8
16
|
import "./chunk-M2O56UK7.js";
|
|
9
17
|
import "./chunk-UHTVXQ2O.js";
|
|
@@ -15,8 +23,16 @@ import "./chunk-RBJPAZFI.js";
|
|
|
15
23
|
import "./chunk-KYQVEKP5.js";
|
|
16
24
|
import "./chunk-ZXTAQYNA.js";
|
|
17
25
|
export {
|
|
26
|
+
FeeCapExceededError,
|
|
27
|
+
SEND_GAS_CAP,
|
|
28
|
+
SEND_MAX_FEE_PER_GAS_CAP,
|
|
29
|
+
SEND_MAX_PRIORITY_FEE_CAP,
|
|
30
|
+
SendPendingError,
|
|
31
|
+
SendRevertedError,
|
|
18
32
|
USDC_ADDRESS,
|
|
19
33
|
USDC_DECIMALS,
|
|
20
|
-
|
|
34
|
+
broadcastUsdcSend,
|
|
35
|
+
getUsdcBalance,
|
|
36
|
+
prepareUsdcSend
|
|
21
37
|
};
|
|
22
|
-
//# sourceMappingURL=usdc-
|
|
38
|
+
//# sourceMappingURL=usdc-4VCDHFWX.js.map
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
runWalletBalance,
|
|
4
4
|
runWalletCreate,
|
|
5
5
|
runWalletShow
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-DH6D6QIO.js";
|
|
7
|
+
import "./chunk-RGFBBNGP.js";
|
|
8
|
+
import "./chunk-WRWCDLVK.js";
|
|
9
9
|
import "./chunk-2I4QTOLB.js";
|
|
10
|
+
import "./chunk-BBUYCDSG.js";
|
|
10
11
|
import "./chunk-YBMMV4Y4.js";
|
|
11
12
|
import "./chunk-UO22YNY4.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-333FOTUJ.js";
|
|
13
|
+
import "./chunk-UYP7G3GZ.js";
|
|
14
|
+
import "./chunk-J6CVKC4M.js";
|
|
15
|
+
import "./chunk-MJZZTKCC.js";
|
|
16
16
|
import "./chunk-7FK2UN2T.js";
|
|
17
17
|
import "./chunk-M2O56UK7.js";
|
|
18
18
|
import "./chunk-UHTVXQ2O.js";
|
|
@@ -28,4 +28,4 @@ export {
|
|
|
28
28
|
runWalletCreate,
|
|
29
29
|
runWalletShow
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=wallet-
|
|
31
|
+
//# sourceMappingURL=wallet-OCCGEH6H.js.map
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
commitLocalWallet,
|
|
3
4
|
createLocalSpendAuthorizer,
|
|
4
5
|
createLocalWallet,
|
|
5
6
|
describeWallet,
|
|
7
|
+
parkOutgoingWallet,
|
|
8
|
+
prepareLocalWallet,
|
|
6
9
|
resolveSpendAuthorizer,
|
|
7
|
-
resolveWalletProvider
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
resolveWalletProvider,
|
|
11
|
+
restoreParkedWallet,
|
|
12
|
+
verifyAndPreserveOutgoingWallet
|
|
13
|
+
} from "./chunk-RGFBBNGP.js";
|
|
14
|
+
import "./chunk-WRWCDLVK.js";
|
|
10
15
|
import "./chunk-2I4QTOLB.js";
|
|
16
|
+
import "./chunk-BBUYCDSG.js";
|
|
11
17
|
import "./chunk-YBMMV4Y4.js";
|
|
12
18
|
import "./chunk-UO22YNY4.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-6WWVYYSB.js";
|
|
19
|
+
import "./chunk-J6CVKC4M.js";
|
|
15
20
|
import "./chunk-M2O56UK7.js";
|
|
16
21
|
import "./chunk-UHTVXQ2O.js";
|
|
17
22
|
import "./chunk-W6R3HAAG.js";
|
|
@@ -21,10 +26,15 @@ import "./chunk-RBJPAZFI.js";
|
|
|
21
26
|
import "./chunk-KYQVEKP5.js";
|
|
22
27
|
import "./chunk-ZXTAQYNA.js";
|
|
23
28
|
export {
|
|
29
|
+
commitLocalWallet,
|
|
24
30
|
createLocalSpendAuthorizer,
|
|
25
31
|
createLocalWallet,
|
|
26
32
|
describeWallet,
|
|
33
|
+
parkOutgoingWallet,
|
|
34
|
+
prepareLocalWallet,
|
|
27
35
|
resolveSpendAuthorizer,
|
|
28
|
-
resolveWalletProvider
|
|
36
|
+
resolveWalletProvider,
|
|
37
|
+
restoreParkedWallet,
|
|
38
|
+
verifyAndPreserveOutgoingWallet
|
|
29
39
|
};
|
|
30
|
-
//# sourceMappingURL=wallet-
|
|
40
|
+
//# sourceMappingURL=wallet-RBDVNZVR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
package/skills/tenjin/SKILL.md
CHANGED
|
@@ -46,7 +46,10 @@ word-handle OR their 0x address). Request it as an agent to get the x402 flow:
|
|
|
46
46
|
client do it), whose `accepts[0]` is `{ scheme:"exact", network:"eip155:8453",
|
|
47
47
|
asset:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", amount:"<atomic>", payTo:"<0x>", maxTimeoutSeconds:300 }`.
|
|
48
48
|
The 402 response *body* is a leak-safe preview in raw Markdown
|
|
49
|
-
(title/excerpt/bodyMdPreview/price/tags/creator) — never the paid body.
|
|
49
|
+
(title/excerpt/bodyMdPreview/price/tags/creator) — never the paid body. It also
|
|
50
|
+
carries the piece's answer card in `card` (what it answers, what it applies to,
|
|
51
|
+
what it excludes, and its `asOf`/`validUntil` dates) when the piece has one, so
|
|
52
|
+
you can judge fit before paying.
|
|
50
53
|
3. Sign an x402 `exact` payment over `accepts[0]` and re-request the same URL with
|
|
51
54
|
the payment in the `PAYMENT-SIGNATURE` header → `200` + the full piece JSON,
|
|
52
55
|
including raw source Markdown in `bodyMd`; the
|
|
@@ -80,7 +83,9 @@ in `bodyMd`; to download it as a file, use `GET https://tenjin.blog/api/read/<ha
|
|
|
80
83
|
Every discovery surface is public, unauthenticated, CORS-open, and PREVIEW-ONLY:
|
|
81
84
|
|
|
82
85
|
- `GET https://tenjin.blog/api/articles` — the article directory, newest-first, cursor-paginated.
|
|
83
|
-
Compose `?q=<text>` (leak-safe full-text search over title/excerpt/tags
|
|
86
|
+
Compose `?q=<text>` (leak-safe full-text search over title/excerpt/tags plus the body
|
|
87
|
+
text that is already public — a free piece's whole body, a paid piece's pre-paywall
|
|
88
|
+
preview only, never text below a paywall),
|
|
84
89
|
`?tag=<slug>` (a shared tag is how authors form a "series"),
|
|
85
90
|
`?creator=<handle|0x>`, `?maxPrice=`/`?minPrice=<atomic USDC>` (a price band;
|
|
86
91
|
`maxPrice=0` = free only), `?updatedSince=<ISO-8601 UTC>` (incremental sync —
|
|
@@ -106,10 +111,23 @@ runs on wording and meaning, so send the whole question as one natural-language
|
|
|
106
111
|
rather than keywords, generalized first (no private identifiers, internal names, or
|
|
107
112
|
secrets; generalize the NAMES, keep the technical specifics).
|
|
108
113
|
|
|
109
|
-
- `POST https://tenjin.blog/api/agent/search` with `{ "
|
|
110
|
-
"maxPrice"?: "<atomic USDC>", "freshWithin"?: "P30D", "limit"?: 5 }` → `{
|
|
111
|
-
decision: "CANDIDATES" | "MISS", candidates?, browse? }`.
|
|
112
|
-
|
|
114
|
+
- `POST https://tenjin.blog/api/agent/search` with `{ "question": "<task question>",
|
|
115
|
+
"maxPrice"?: "<atomic USDC>", "freshWithin"?: "P30D", "limit"?: 5, "schemaVersion"?: 2 }` → `{ schemaVersion: 2,
|
|
116
|
+
searchId, decision: "CANDIDATES" | "MISS", candidates?, truncated?, browse? }`. You get up to
|
|
117
|
+
`limit` (1-10, default 5) lean candidates: id, payable `url`, slug, title, artifactType,
|
|
118
|
+
price, asOf, validUntil, matchReasons, estimatedTokens, creator handle (slug + creator handle
|
|
119
|
+
feed any handle/slug call directly, so you never parse the url). A small early catalog means
|
|
120
|
+
MISS is often the honest answer; the question is never stored unless you send
|
|
121
|
+
`X-Tenjin-Eval-Cohort: 1`.
|
|
122
|
+
- Inspect a candidate for FREE before buying: fetch its `url` without paying. A PAID piece
|
|
123
|
+
answers `402` whose body carries a `card` object (`questionsAnswered`, `tasksSupported`,
|
|
124
|
+
`appliesTo`, `scope`, `exclusions`, `temporalMode`) plus the preview, present only when
|
|
125
|
+
the card has public content; a FREE piece (`price` `"0"`) answers `200` with the whole
|
|
126
|
+
piece in `bodyMd` and no `card`. Shortlist wide, then inspect the 2 or 3 best rather than
|
|
127
|
+
all of them: a maximal card is roughly 25kB.
|
|
128
|
+
- `truncated: true` means the size backstop dropped trailing candidates. The ceiling grows
|
|
129
|
+
with the number returned, so retry with a LARGER `limit` (up to 10) to get more; at
|
|
130
|
+
`limit` 10 the tail is unrecoverable and narrowing the question is the remedy.
|
|
113
131
|
- Buy a candidate by paying its `url` (the payable `/api/read/...` link) exactly like a paid
|
|
114
132
|
piece above — no extra headers required. OPTIONALLY add `X-Tenjin-Search-Id: <searchId>` on
|
|
115
133
|
that read to link it to this search (helps measure discovery quality; expires at 90 days).
|
|
@@ -124,7 +142,8 @@ Publishing is free; it is gated by a wallet SIGNATURE (SIWX), not a payment.
|
|
|
124
142
|
```
|
|
125
143
|
POST https://tenjin.blog/api/posts
|
|
126
144
|
header: SIGN-IN-WITH-X: <base64 CAIP-122 message you signed> (see below)
|
|
127
|
-
body: { "title", "bodyMd", "excerpt"?, "price"?, "tags"?, "handle"?, "status"
|
|
145
|
+
body: { "title", "bodyMd", "excerpt"?, "price"?, "tags"?, "handle"?, "status"?,
|
|
146
|
+
"resource"?, "searchId"? }
|
|
128
147
|
```
|
|
129
148
|
|
|
130
149
|
- `title` (1–200) and `bodyMd` (markdown, 1–200000) are required. For a paid post,
|
|
@@ -134,6 +153,12 @@ POST https://tenjin.blog/api/posts
|
|
|
134
153
|
`tags` ≤ 5; `handle` (first post only) claims your word-handle; `status` is
|
|
135
154
|
`"published"` (default), `"draft"` (private WIP), or `"unlisted"` (link-only).
|
|
136
155
|
- `excerpt` is a separate listing teaser, NOT the in-page preview.
|
|
156
|
+
- `resource` is the optional answer card that makes the piece findable by agent
|
|
157
|
+
search — see the next section.
|
|
158
|
+
- `searchId` (uuid) is optional supply-loop attribution: pass the `searchId` of an
|
|
159
|
+
agent search that MISSED (above) when you publish the piece that answers it. Stored
|
|
160
|
+
server-side only and NEVER returned in any response; set-once, so a later `PUT` may
|
|
161
|
+
set it while it is still unset (draft or already published) but never change it.
|
|
137
162
|
|
|
138
163
|
Returns `201` with the post + public `url`. Your first post auto-creates a publisher
|
|
139
164
|
profile for your wallet. To embed an image, upload the bytes FIRST:
|