tenjin-cli 0.1.0-alpha.25 → 0.1.0-alpha.27
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 +16 -43
- package/dist/{chunk-EOGJKIOG.js → chunk-2TYQD22Q.js} +16 -7
- package/dist/chunk-2TYQD22Q.js.map +1 -0
- package/dist/{chunk-SCAE6PW6.js → chunk-4L7KMA7P.js} +6 -6
- package/dist/{chunk-UDWGT4FX.js → chunk-5FGO6TYT.js} +13 -5
- package/dist/chunk-5FGO6TYT.js.map +1 -0
- package/dist/{chunk-IYLECN4D.js → chunk-5NEHH2E5.js} +3 -3
- package/dist/{chunk-EACMJEF3.js → chunk-64SE3QC5.js} +75 -176
- package/dist/chunk-64SE3QC5.js.map +1 -0
- package/dist/chunk-6ZSGER3A.js +52 -0
- package/dist/chunk-6ZSGER3A.js.map +1 -0
- package/dist/{chunk-QF4SSCQV.js → chunk-AWKQSKUL.js} +4 -3
- package/dist/chunk-AWKQSKUL.js.map +1 -0
- package/dist/chunk-B2L53TMK.js +70 -0
- package/dist/chunk-B2L53TMK.js.map +1 -0
- package/dist/chunk-BOAI23CX.js +222 -0
- package/dist/chunk-BOAI23CX.js.map +1 -0
- package/dist/{chunk-OZ3LWLCI.js → chunk-DATCR7AU.js} +3 -3
- package/dist/{chunk-NTYQHAIM.js → chunk-DSNXKUXI.js} +2 -2
- package/dist/{chunk-HII5HOQV.js → chunk-G4AM2SOL.js} +5 -3
- package/dist/{chunk-HII5HOQV.js.map → chunk-G4AM2SOL.js.map} +1 -1
- package/dist/{chunk-VYONGSMQ.js → chunk-GU4GGKYP.js} +85 -6
- package/dist/chunk-GU4GGKYP.js.map +1 -0
- package/dist/{chunk-YSW57KUT.js → chunk-H2L33M7F.js} +31 -27
- package/dist/chunk-H2L33M7F.js.map +1 -0
- package/dist/{chunk-ODH7UXIS.js → chunk-HC3QEZKT.js} +5 -4
- package/dist/chunk-HC3QEZKT.js.map +1 -0
- package/dist/chunk-MAQUL5BD.js +99 -0
- package/dist/chunk-MAQUL5BD.js.map +1 -0
- package/dist/{chunk-EG7P4SM6.js → chunk-O7CUHHYU.js} +4 -4
- package/dist/{chunk-EG7P4SM6.js.map → chunk-O7CUHHYU.js.map} +1 -1
- package/dist/{chunk-CEMXMUIU.js → chunk-OHZYNZSD.js} +36 -7
- package/dist/chunk-OHZYNZSD.js.map +1 -0
- package/dist/{chunk-3ZYPVSIU.js → chunk-PY7MQUKP.js} +238 -43
- package/dist/chunk-PY7MQUKP.js.map +1 -0
- package/dist/chunk-PZ5N6BAL.js +268 -0
- package/dist/chunk-PZ5N6BAL.js.map +1 -0
- package/dist/chunk-S4SAZ7OD.js +30 -0
- package/dist/chunk-S4SAZ7OD.js.map +1 -0
- package/dist/{chunk-NYPFOHSJ.js → chunk-SKQQOEWH.js} +4 -4
- package/dist/{chunk-XICKN3CH.js → chunk-VIOUZW7Z.js} +2 -46
- package/dist/chunk-VIOUZW7Z.js.map +1 -0
- package/dist/{chunk-YTM7OURD.js → chunk-VNNXAYJE.js} +2 -2
- package/dist/{chunk-CKDD554V.js → chunk-VXIBZ6W5.js} +5 -3
- package/dist/{chunk-CKDD554V.js.map → chunk-VXIBZ6W5.js.map} +1 -1
- package/dist/{chunk-GT6W3VJM.js → chunk-X7I343ZY.js} +3 -53
- package/dist/chunk-X7I343ZY.js.map +1 -0
- package/dist/{chunk-KGTQRJGS.js → chunk-XVYATBKD.js} +5 -10
- package/dist/{chunk-KGTQRJGS.js.map → chunk-XVYATBKD.js.map} +1 -1
- package/dist/{chunk-DRXDTITB.js → chunk-YKM2ZTA2.js} +59 -25
- package/dist/chunk-YKM2ZTA2.js.map +1 -0
- package/dist/{chunk-CP7O6M55.js → chunk-YQOQ6XEI.js} +109 -27
- package/dist/chunk-YQOQ6XEI.js.map +1 -0
- package/dist/{cli-4WMGZPBP.js → cli-6JNIPZQ6.js} +43 -39
- package/dist/{cli-4WMGZPBP.js.map → cli-6JNIPZQ6.js.map} +1 -1
- package/dist/{config-VU6U7QOU.js → config-G75YT6NC.js} +15 -10
- package/dist/{doctor-26JS2SG3.js → doctor-3GMDOW4Y.js} +140 -98
- package/dist/doctor-3GMDOW4Y.js.map +1 -0
- package/dist/env-proxy-XL4P73MZ.js +15 -0
- package/dist/{fund-JJN3FRRF.js → fund-3IPR5YRJ.js} +26 -14
- package/dist/{fund-JJN3FRRF.js.map → fund-3IPR5YRJ.js.map} +1 -1
- package/dist/hook-command-ZXX4FT4N.js +32 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/{install-GXQ33J4G.js → install-6OROTYHZ.js} +20 -14
- package/dist/{install-identity-HFQUXPSI.js → install-identity-PM4AGFFX.js} +7 -6
- package/dist/{install-wallet-27LTEHBI.js → install-wallet-6756NOB5.js} +11 -8
- package/dist/{install-wallet-27LTEHBI.js.map → install-wallet-6756NOB5.js.map} +1 -1
- package/dist/{mcp-AHCZVD2U.js → mcp-33FAAZ7F.js} +723 -123
- package/dist/mcp-33FAAZ7F.js.map +1 -0
- package/dist/{pay-3TCOPGCX.js → pay-XOYR4PCH.js} +14 -12
- package/dist/{payments-H3LSBGSL.js → payments-UTQDBO7H.js} +8 -6
- package/dist/{payments-H3LSBGSL.js.map → payments-UTQDBO7H.js.map} +1 -1
- package/dist/{send-LKCLN5GA.js → send-CVGNOQW3.js} +12 -9
- package/dist/{send-LKCLN5GA.js.map → send-CVGNOQW3.js.map} +1 -1
- package/dist/{status-2FDGI4LQ.js → status-NACN4DGX.js} +10 -7
- package/dist/{status-2FDGI4LQ.js.map → status-NACN4DGX.js.map} +1 -1
- package/dist/{status-line-QKDJYZGV.js → status-line-3IQKGRUH.js} +6 -5
- package/dist/{status-line-QKDJYZGV.js.map → status-line-3IQKGRUH.js.map} +1 -1
- package/dist/{status-line-wiring-ZDBYHNYR.js → status-line-wiring-QXBOOY2T.js} +4 -4
- package/dist/{uninstall-ZXWABDHS.js → uninstall-NYFKSYW4.js} +22 -16
- package/dist/{uninstall-ZXWABDHS.js.map → uninstall-NYFKSYW4.js.map} +1 -1
- package/dist/{update-HEIWVOP5.js → update-RJDA5ZY3.js} +11 -13
- package/dist/update-RJDA5ZY3.js.map +1 -0
- package/dist/{wallet-T7JYWI6O.js → wallet-B3FVHNTS.js} +11 -8
- package/dist/wallet-B3FVHNTS.js.map +1 -0
- package/docs/agent-permissions.md +18 -7
- package/docs/troubleshooting.md +13 -0
- package/package.json +4 -3
- package/dist/chunk-3ZYPVSIU.js.map +0 -1
- package/dist/chunk-CEMXMUIU.js.map +0 -1
- package/dist/chunk-CP7O6M55.js.map +0 -1
- package/dist/chunk-DRXDTITB.js.map +0 -1
- package/dist/chunk-EACMJEF3.js.map +0 -1
- package/dist/chunk-EOGJKIOG.js.map +0 -1
- package/dist/chunk-GT6W3VJM.js.map +0 -1
- package/dist/chunk-ODH7UXIS.js.map +0 -1
- package/dist/chunk-QF4SSCQV.js.map +0 -1
- package/dist/chunk-UDWGT4FX.js.map +0 -1
- package/dist/chunk-VYONGSMQ.js.map +0 -1
- package/dist/chunk-XICKN3CH.js.map +0 -1
- package/dist/chunk-YSW57KUT.js.map +0 -1
- package/dist/doctor-26JS2SG3.js.map +0 -1
- package/dist/hook-command-S2V4UNB3.js +0 -28
- package/dist/mcp-AHCZVD2U.js.map +0 -1
- package/dist/update-HEIWVOP5.js.map +0 -1
- /package/dist/{chunk-SCAE6PW6.js.map → chunk-4L7KMA7P.js.map} +0 -0
- /package/dist/{chunk-IYLECN4D.js.map → chunk-5NEHH2E5.js.map} +0 -0
- /package/dist/{chunk-OZ3LWLCI.js.map → chunk-DATCR7AU.js.map} +0 -0
- /package/dist/{chunk-NTYQHAIM.js.map → chunk-DSNXKUXI.js.map} +0 -0
- /package/dist/{chunk-NYPFOHSJ.js.map → chunk-SKQQOEWH.js.map} +0 -0
- /package/dist/{chunk-YTM7OURD.js.map → chunk-VNNXAYJE.js.map} +0 -0
- /package/dist/{config-VU6U7QOU.js.map → config-G75YT6NC.js.map} +0 -0
- /package/dist/{hook-command-S2V4UNB3.js.map → env-proxy-XL4P73MZ.js.map} +0 -0
- /package/dist/{install-GXQ33J4G.js.map → hook-command-ZXX4FT4N.js.map} +0 -0
- /package/dist/{install-identity-HFQUXPSI.js.map → install-6OROTYHZ.js.map} +0 -0
- /package/dist/{pay-3TCOPGCX.js.map → install-identity-PM4AGFFX.js.map} +0 -0
- /package/dist/{status-line-wiring-ZDBYHNYR.js.map → pay-XOYR4PCH.js.map} +0 -0
- /package/dist/{wallet-T7JYWI6O.js.map → status-line-wiring-QXBOOY2T.js.map} +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
promptYesNo
|
|
4
|
+
} from "./chunk-LHHMV4GU.js";
|
|
2
5
|
import {
|
|
3
6
|
assertPublicDestination
|
|
4
7
|
} from "./chunk-LAIZ2AQA.js";
|
|
@@ -54,40 +57,39 @@ import {
|
|
|
54
57
|
maxUint256,
|
|
55
58
|
toBytes
|
|
56
59
|
} from "./chunk-TTNESUPQ.js";
|
|
57
|
-
import {
|
|
58
|
-
promptYesNo
|
|
59
|
-
} from "./chunk-LHHMV4GU.js";
|
|
60
60
|
import {
|
|
61
61
|
USDC_ADDRESS
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-VNNXAYJE.js";
|
|
63
63
|
import {
|
|
64
64
|
describeWallet,
|
|
65
65
|
resolveSpendAuthorizer,
|
|
66
66
|
resolveWalletProvider
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-O7CUHHYU.js";
|
|
68
68
|
import {
|
|
69
69
|
getAddress
|
|
70
70
|
} from "./chunk-EGELTSPU.js";
|
|
71
|
-
import {
|
|
72
|
-
sanitizeForTerminal
|
|
73
|
-
} from "./chunk-UDWGT4FX.js";
|
|
74
71
|
import {
|
|
75
72
|
mask
|
|
76
73
|
} from "./chunk-7QKHZQKW.js";
|
|
77
74
|
import {
|
|
78
75
|
fetchFailureToCliError,
|
|
79
76
|
httpRequest
|
|
80
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-OHZYNZSD.js";
|
|
78
|
+
import {
|
|
79
|
+
sanitizeForTerminal
|
|
80
|
+
} from "./chunk-5FGO6TYT.js";
|
|
81
81
|
import {
|
|
82
82
|
resolveContextSettings
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-G4AM2SOL.js";
|
|
84
84
|
import {
|
|
85
|
-
external_exports,
|
|
86
|
-
isSameDeployment,
|
|
87
85
|
parseUsdToAtomic,
|
|
88
|
-
readUsdcBalanceWithFallback,
|
|
89
86
|
toMoney
|
|
90
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-6ZSGER3A.js";
|
|
88
|
+
import {
|
|
89
|
+
external_exports,
|
|
90
|
+
isSameDeployment,
|
|
91
|
+
readUsdcBalanceWithFallback
|
|
92
|
+
} from "./chunk-VIOUZW7Z.js";
|
|
91
93
|
import {
|
|
92
94
|
CliError
|
|
93
95
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -11821,8 +11823,7 @@ async function executePay(args, ctx, deps, warnings) {
|
|
|
11821
11823
|
ctx,
|
|
11822
11824
|
deps.provider !== void 0 ? { provider: deps.provider } : {}
|
|
11823
11825
|
);
|
|
11824
|
-
await
|
|
11825
|
-
const signer = await provider.getSigner();
|
|
11826
|
+
const signer = await openWallet(provider);
|
|
11826
11827
|
openedSigner.current = signer;
|
|
11827
11828
|
let effectiveChallenge = paymentRequired;
|
|
11828
11829
|
let effectiveRequirement = requirement;
|
|
@@ -11995,17 +11996,19 @@ async function executePay(args, ctx, deps, warnings) {
|
|
|
11995
11996
|
printBody: args.printBody === true
|
|
11996
11997
|
});
|
|
11997
11998
|
}
|
|
11999
|
+
const refusal = settlementRefusal(paid);
|
|
11998
12000
|
throw new CliError(
|
|
11999
12001
|
"PAYMENT_FAILED",
|
|
12000
|
-
paid.status === 402 ? "Payment was not accepted by the endpoint." : `The endpoint answered ${paid.status} on the paid request; whether it settled is unknown.`,
|
|
12002
|
+
refusal !== void 0 ? `The endpoint did not settle the payment${refusal.reason !== void 0 ? `: ${refusal.reason.replace(/\.+$/, "")}` : ""}.` : paid.status === 402 ? "Payment was not accepted by the endpoint." : `The endpoint answered ${paid.status} on the paid request; whether it settled is unknown.`,
|
|
12001
12003
|
{
|
|
12002
|
-
fix: "The signed payment already left and is recorded as transmitted exposure; the endpoint may still settle it. Do not simply retry: each attempt signs a fresh authorization. Verify the endpoint (and this listing, if Bazaar) before paying again.",
|
|
12004
|
+
fix: refusal !== void 0 ? "The seller reported that nothing settled, but the signed authorization stays valid until it expires, so it is recorded as transmitted exposure. Do not simply retry: each attempt signs a fresh authorization. Use a different service for this." : "The signed payment already left and is recorded as transmitted exposure; the endpoint may still settle it. Do not simply retry: each attempt signs a fresh authorization. Verify the endpoint (and this listing, if Bazaar) before paying again.",
|
|
12003
12005
|
// The amount rides on the failure so a caller can report what is at risk
|
|
12004
12006
|
// rather than a zero. Settlement is unknown by construction here.
|
|
12005
12007
|
details: {
|
|
12006
12008
|
status: paid.status,
|
|
12007
12009
|
body: paid.json,
|
|
12008
12010
|
...providerError(paid.text),
|
|
12011
|
+
...refusal?.reason !== void 0 ? { settlementError: refusal.reason } : {},
|
|
12009
12012
|
amountAtomic: payment.amountAtomic.toString(),
|
|
12010
12013
|
settlement: "unknown",
|
|
12011
12014
|
...payment.authorization !== void 0 ? { authorization: payment.authorization } : {}
|
|
@@ -12138,14 +12141,15 @@ function providerMessage(body) {
|
|
|
12138
12141
|
}
|
|
12139
12142
|
var PROVIDER_ERROR_CHARS = 500;
|
|
12140
12143
|
function providerError(text) {
|
|
12144
|
+
const line = sellerLine(text);
|
|
12145
|
+
return line.length > 0 ? { providerError: line } : {};
|
|
12146
|
+
}
|
|
12147
|
+
function sellerLine(text) {
|
|
12141
12148
|
const flat = sanitizeForTerminal(
|
|
12142
12149
|
mask(text.slice(0, PROVIDER_ERROR_CHARS * 8)).replace(/\s+/g, " ")
|
|
12143
12150
|
).trim();
|
|
12144
|
-
if (flat.length === 0) return {};
|
|
12145
12151
|
const chars = Array.from(flat);
|
|
12146
|
-
return {
|
|
12147
|
-
providerError: chars.length <= PROVIDER_ERROR_CHARS ? flat : `${chars.slice(0, PROVIDER_ERROR_CHARS).join("")}\u2026`
|
|
12148
|
-
};
|
|
12152
|
+
return chars.length <= PROVIDER_ERROR_CHARS ? flat : `${chars.slice(0, PROVIDER_ERROR_CHARS).join("")}\u2026`;
|
|
12149
12153
|
}
|
|
12150
12154
|
function noMatchingEntry(challenge, terms) {
|
|
12151
12155
|
if (terms === void 0 || terms.network === void 0 && terms.asset === void 0) {
|
|
@@ -12271,16 +12275,45 @@ function deliver(url, lane, res, opts) {
|
|
|
12271
12275
|
};
|
|
12272
12276
|
}
|
|
12273
12277
|
function settlementTx(res) {
|
|
12278
|
+
const tx = paymentResponse(res)?.transaction;
|
|
12279
|
+
return typeof tx === "string" && /^0x[0-9a-fA-F]{64}$/.test(tx) ? tx : void 0;
|
|
12280
|
+
}
|
|
12281
|
+
function settlementRefusal(res) {
|
|
12282
|
+
const settle = paymentResponse(res);
|
|
12283
|
+
if (settle?.success !== false) return void 0;
|
|
12284
|
+
const said = [settle.errorReason, settle.errorMessage].find(
|
|
12285
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
12286
|
+
);
|
|
12287
|
+
const reason = said !== void 0 ? sellerLine(said) : "";
|
|
12288
|
+
return reason.length > 0 ? { reason } : {};
|
|
12289
|
+
}
|
|
12290
|
+
function paymentResponse(res) {
|
|
12274
12291
|
const header = res.header(PAYMENT_RESPONSE_HEADER) ?? res.header(PAYMENT_RESPONSE_HEADER_V1);
|
|
12275
12292
|
if (header === void 0) return void 0;
|
|
12276
12293
|
try {
|
|
12277
12294
|
const settle = decodePaymentResponseHeader(header);
|
|
12278
|
-
|
|
12279
|
-
return typeof tx === "string" && /^0x[0-9a-fA-F]{64}$/.test(tx) ? tx : void 0;
|
|
12295
|
+
return typeof settle === "object" && settle !== null ? settle : void 0;
|
|
12280
12296
|
} catch {
|
|
12281
12297
|
return void 0;
|
|
12282
12298
|
}
|
|
12283
12299
|
}
|
|
12300
|
+
async function openWallet(provider) {
|
|
12301
|
+
try {
|
|
12302
|
+
await describeWallet(provider);
|
|
12303
|
+
return await provider.getSigner();
|
|
12304
|
+
} catch (err) {
|
|
12305
|
+
if (!(err instanceof CliError)) throw err;
|
|
12306
|
+
throw new CliError(err.code, err.message, {
|
|
12307
|
+
exitCode: err.exitCode,
|
|
12308
|
+
...err.fix !== void 0 ? { fix: err.fix } : {},
|
|
12309
|
+
details: {
|
|
12310
|
+
...typeof err.details === "object" && err.details !== null ? err.details : {},
|
|
12311
|
+
walletUnavailable: true
|
|
12312
|
+
},
|
|
12313
|
+
cause: err
|
|
12314
|
+
});
|
|
12315
|
+
}
|
|
12316
|
+
}
|
|
12284
12317
|
function signerOrThrow(held) {
|
|
12285
12318
|
if (held.current === void 0) {
|
|
12286
12319
|
throw new CliError("INTERNAL", "The payment was built before the wallet was opened.");
|
|
@@ -12295,6 +12328,7 @@ export {
|
|
|
12295
12328
|
inputProblems,
|
|
12296
12329
|
assertResultSchema,
|
|
12297
12330
|
projectBody,
|
|
12331
|
+
policyFix,
|
|
12298
12332
|
x402Client,
|
|
12299
12333
|
BatchSettlementEvmScheme,
|
|
12300
12334
|
toClientEvmSigner,
|
|
@@ -12304,4 +12338,4 @@ export {
|
|
|
12304
12338
|
paidLegTimeoutMs,
|
|
12305
12339
|
settlementTx
|
|
12306
12340
|
};
|
|
12307
|
-
//# sourceMappingURL=chunk-
|
|
12341
|
+
//# sourceMappingURL=chunk-YKM2ZTA2.js.map
|