tenjin-cli 0.1.0-alpha.15 → 0.1.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +54 -7
- package/README.md +43 -310
- package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
- package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-2BKS2FVE.js +93 -0
- package/dist/chunk-2BKS2FVE.js.map +1 -0
- package/dist/chunk-2G2WLVHB.js +102 -0
- package/dist/chunk-2G2WLVHB.js.map +1 -0
- package/dist/chunk-2I4QTOLB.js +11 -0
- package/dist/chunk-2I4QTOLB.js.map +1 -0
- package/dist/chunk-2JGT3KDW.js +172 -0
- package/dist/chunk-2JGT3KDW.js.map +1 -0
- package/dist/chunk-2QYORQBF.js +55 -0
- package/dist/chunk-2QYORQBF.js.map +1 -0
- package/dist/chunk-35M3VITA.js +102 -0
- package/dist/chunk-35M3VITA.js.map +1 -0
- package/dist/{chunk-KINZ23CV.js → chunk-3AUDA53C.js} +4740 -23
- package/dist/chunk-3AUDA53C.js.map +1 -0
- package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
- package/dist/chunk-56MOAIP5.js.map +1 -0
- package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5QHHRMRA.js +227 -0
- package/dist/chunk-5QHHRMRA.js.map +1 -0
- package/dist/{chunk-JBIKAAT3.js → chunk-5UDD5VSY.js} +8 -8
- package/dist/chunk-5UDD5VSY.js.map +1 -0
- package/dist/chunk-7QKHZQKW.js +1680 -0
- package/dist/chunk-7QKHZQKW.js.map +1 -0
- package/dist/{chunk-ZFJJ3EXC.js → chunk-AR7U7BRG.js} +550 -182
- package/dist/chunk-AR7U7BRG.js.map +1 -0
- package/dist/chunk-AUKDYPPX.js +130 -0
- package/dist/chunk-AUKDYPPX.js.map +1 -0
- package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
- package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
- package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
- package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
- package/dist/chunk-EGELTSPU.js.map +1 -0
- package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-J5INH7WB.js +299 -0
- package/dist/chunk-J5INH7WB.js.map +1 -0
- package/dist/chunk-JLEF5WHM.js +132 -0
- package/dist/chunk-JLEF5WHM.js.map +1 -0
- package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-KK4YGYTV.js +808 -0
- package/dist/chunk-KK4YGYTV.js.map +1 -0
- package/dist/{chunk-CPCX67TI.js → chunk-KUBEYXSO.js} +1076 -1038
- package/dist/chunk-KUBEYXSO.js.map +1 -0
- package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
- package/dist/{chunk-NIKXHWOL.js → chunk-LJ4DMVFI.js} +16 -16
- package/dist/chunk-LJ4DMVFI.js.map +1 -0
- package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/{chunk-HPJGOLTN.js → chunk-MRGADYDD.js} +13 -8
- package/dist/chunk-MRGADYDD.js.map +1 -0
- package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
- package/dist/chunk-N35E6CM2.js.map +1 -0
- package/dist/chunk-O4ZNKFRU.js +366 -0
- package/dist/chunk-O4ZNKFRU.js.map +1 -0
- package/dist/chunk-PDA2BVFY.js +244 -0
- package/dist/chunk-PDA2BVFY.js.map +1 -0
- package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-QDD2RN7G.js +10238 -0
- package/dist/chunk-QDD2RN7G.js.map +1 -0
- package/dist/chunk-S2NRVRPF.js +171 -0
- package/dist/chunk-S2NRVRPF.js.map +1 -0
- package/dist/chunk-TGLKKLQG.js +11 -0
- package/dist/chunk-TGLKKLQG.js.map +1 -0
- package/dist/chunk-TP4D47BY.js +127 -0
- package/dist/chunk-TP4D47BY.js.map +1 -0
- package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/{chunk-UO22YNY4.js → chunk-U2DZISAH.js} +43 -1
- package/dist/chunk-U2DZISAH.js.map +1 -0
- package/dist/chunk-WGQVJM56.js +165 -0
- package/dist/chunk-WGQVJM56.js.map +1 -0
- package/dist/{chunk-OLWTRUTS.js → chunk-WLMJE3GJ.js} +35 -16
- package/dist/chunk-WLMJE3GJ.js.map +1 -0
- package/dist/chunk-WS4JA6TC.js +137 -0
- package/dist/chunk-WS4JA6TC.js.map +1 -0
- package/dist/chunk-WXC57XGG.js +29 -0
- package/dist/chunk-WXC57XGG.js.map +1 -0
- package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/chunk-XZOEUYMX.js +1784 -0
- package/dist/chunk-XZOEUYMX.js.map +1 -0
- package/dist/{cli-KKRKBU5T.js → cli-VHYYYYXM.js} +303 -374
- package/dist/cli-VHYYYYXM.js.map +1 -0
- package/dist/config-5ADBAAXU.js +42 -0
- package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
- package/dist/doctor-Q35VQW3S.js +436 -0
- package/dist/doctor-Q35VQW3S.js.map +1 -0
- package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/{chunk-KAJZHIQ4.js → fund-GDDPL2BB.js} +81 -24
- package/dist/fund-GDDPL2BB.js.map +1 -0
- package/dist/hook-command-PBERPRE3.js +763 -0
- package/dist/hook-command-PBERPRE3.js.map +1 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/install-OKDKGUXM.js +60 -0
- package/dist/install-wallet-SI4LZ73K.js +106 -0
- package/dist/install-wallet-SI4LZ73K.js.map +1 -0
- package/dist/{run-XYTQ5TWQ.js → mcp-XX3WRQEZ.js} +3766 -10677
- package/dist/mcp-XX3WRQEZ.js.map +1 -0
- package/dist/paths-P2N4JTDZ.js +49 -0
- package/dist/pay-3SYKHKWJ.js +39 -0
- package/dist/redact-6W23GGJC.js +15 -0
- package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/{send-G746D7PQ.js → send-LQRKTEJT.js} +29 -29
- package/dist/send-LQRKTEJT.js.map +1 -0
- package/dist/{chunk-QZ6ROAJU.js → skill-placement-JMDPSKE6.js} +155 -10
- package/dist/skill-placement-JMDPSKE6.js.map +1 -0
- package/dist/status-FFC6FO72.js +64 -0
- package/dist/status-FFC6FO72.js.map +1 -0
- package/dist/status-line-SAXSU6CR.js +87 -0
- package/dist/status-line-SAXSU6CR.js.map +1 -0
- package/dist/status-line-wiring-L2WYIYBM.js +29 -0
- package/dist/tenjin-daemon.mjs +20421 -0
- package/dist/tenjin-shim.mjs +251 -0
- package/dist/tenjin-vitest-reporter.mjs +49 -0
- package/dist/uninstall-OACH27UV.js +147 -0
- package/dist/uninstall-OACH27UV.js.map +1 -0
- package/dist/{update-R76LHOZW.js → update-4W6EKLGZ.js} +132 -16
- package/dist/update-4W6EKLGZ.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/wallet-BMEXRR3P.js +32 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +71 -352
- package/docs/safety-model.md +16 -6
- package/package.json +8 -7
- package/LICENSE +0 -21
- package/dist/buy-VIRNSYGN.js +0 -47
- package/dist/chunk-2MYQN7HM.js +0 -247
- package/dist/chunk-2MYQN7HM.js.map +0 -1
- package/dist/chunk-2RF2GIJQ.js +0 -1188
- package/dist/chunk-2RF2GIJQ.js.map +0 -1
- package/dist/chunk-3GL2Z5QK.js +0 -57
- package/dist/chunk-3GL2Z5QK.js.map +0 -1
- package/dist/chunk-47PP7TAG.js.map +0 -1
- package/dist/chunk-4CQIDQOT.js +0 -167
- package/dist/chunk-4CQIDQOT.js.map +0 -1
- package/dist/chunk-4KG27W2S.js +0 -614
- package/dist/chunk-4KG27W2S.js.map +0 -1
- package/dist/chunk-5QQTYWEU.js +0 -199
- package/dist/chunk-5QQTYWEU.js.map +0 -1
- package/dist/chunk-65DTCCJ7.js +0 -21
- package/dist/chunk-65DTCCJ7.js.map +0 -1
- package/dist/chunk-A5DKHMUN.js +0 -173
- package/dist/chunk-A5DKHMUN.js.map +0 -1
- package/dist/chunk-B63XPWQ4.js +0 -246
- package/dist/chunk-B63XPWQ4.js.map +0 -1
- package/dist/chunk-CAR6FHK6.js +0 -105
- package/dist/chunk-CAR6FHK6.js.map +0 -1
- package/dist/chunk-CPCX67TI.js.map +0 -1
- package/dist/chunk-CQBVCYI2.js +0 -162
- package/dist/chunk-CQBVCYI2.js.map +0 -1
- package/dist/chunk-DBU5CXBV.js +0 -4731
- package/dist/chunk-DBU5CXBV.js.map +0 -1
- package/dist/chunk-DHJD77OW.js +0 -81
- package/dist/chunk-DHJD77OW.js.map +0 -1
- package/dist/chunk-EDZSNPE5.js +0 -35
- package/dist/chunk-EDZSNPE5.js.map +0 -1
- package/dist/chunk-EFWZPUTC.js +0 -65
- package/dist/chunk-EFWZPUTC.js.map +0 -1
- package/dist/chunk-EPFL6CTE.js +0 -448
- package/dist/chunk-EPFL6CTE.js.map +0 -1
- package/dist/chunk-GHLVXVZD.js +0 -142
- package/dist/chunk-GHLVXVZD.js.map +0 -1
- package/dist/chunk-H3SOOJ2I.js +0 -580
- package/dist/chunk-H3SOOJ2I.js.map +0 -1
- package/dist/chunk-HPJGOLTN.js.map +0 -1
- package/dist/chunk-HRGBS2PA.js +0 -203
- package/dist/chunk-HRGBS2PA.js.map +0 -1
- package/dist/chunk-ITUXPJIS.js +0 -314
- package/dist/chunk-ITUXPJIS.js.map +0 -1
- package/dist/chunk-JBIKAAT3.js.map +0 -1
- package/dist/chunk-KAJZHIQ4.js.map +0 -1
- package/dist/chunk-KINZ23CV.js.map +0 -1
- package/dist/chunk-LRYV3SK7.js +0 -235
- package/dist/chunk-LRYV3SK7.js.map +0 -1
- package/dist/chunk-M2O56UK7.js.map +0 -1
- package/dist/chunk-MJZZTKCC.js.map +0 -1
- package/dist/chunk-NIKXHWOL.js.map +0 -1
- package/dist/chunk-OKDRDT74.js +0 -209
- package/dist/chunk-OKDRDT74.js.map +0 -1
- package/dist/chunk-OKYSNAS3.js +0 -2144
- package/dist/chunk-OKYSNAS3.js.map +0 -1
- package/dist/chunk-OLWTRUTS.js.map +0 -1
- package/dist/chunk-QQ6ELLSA.js +0 -143
- package/dist/chunk-QQ6ELLSA.js.map +0 -1
- package/dist/chunk-QZ6ROAJU.js.map +0 -1
- package/dist/chunk-R7RSCBI7.js +0 -794
- package/dist/chunk-R7RSCBI7.js.map +0 -1
- package/dist/chunk-SGK2B724.js +0 -67
- package/dist/chunk-SGK2B724.js.map +0 -1
- package/dist/chunk-U6VPKMGC.js +0 -390
- package/dist/chunk-U6VPKMGC.js.map +0 -1
- package/dist/chunk-UHTVXQ2O.js +0 -140
- package/dist/chunk-UHTVXQ2O.js.map +0 -1
- package/dist/chunk-UO22YNY4.js.map +0 -1
- package/dist/chunk-US456VUI.js +0 -149
- package/dist/chunk-US456VUI.js.map +0 -1
- package/dist/chunk-V44J2MXV.js +0 -400
- package/dist/chunk-V44J2MXV.js.map +0 -1
- package/dist/chunk-VJQKL3YH.js +0 -216
- package/dist/chunk-VJQKL3YH.js.map +0 -1
- package/dist/chunk-VJSQSLBM.js +0 -1442
- package/dist/chunk-VJSQSLBM.js.map +0 -1
- package/dist/chunk-VYOJOX4Z.js +0 -165
- package/dist/chunk-VYOJOX4Z.js.map +0 -1
- package/dist/chunk-WY2K35OL.js +0 -269
- package/dist/chunk-WY2K35OL.js.map +0 -1
- package/dist/chunk-ZFJJ3EXC.js.map +0 -1
- package/dist/chunk-ZOBNS7CX.js.map +0 -1
- package/dist/cli-KKRKBU5T.js.map +0 -1
- package/dist/config-JMRUNYE6.js +0 -37
- package/dist/discover-B5HF6SHM.js +0 -102
- package/dist/discover-B5HF6SHM.js.map +0 -1
- package/dist/doctor-ZBG7X66D.js +0 -32
- package/dist/edit-PZJIILQE.js +0 -40
- package/dist/fund-EUDH5KPA.js +0 -40
- package/dist/inspect-QC6WEQPN.js +0 -37
- package/dist/install-GNK2W3PI.js +0 -972
- package/dist/install-GNK2W3PI.js.map +0 -1
- package/dist/outcome-KSGWZHUS.js +0 -24
- package/dist/pay-BC4UICPA.js +0 -361
- package/dist/pay-BC4UICPA.js.map +0 -1
- package/dist/publish-LXWFDIKF.js +0 -42
- package/dist/read-JMNUQ56P.js +0 -160
- package/dist/read-JMNUQ56P.js.map +0 -1
- package/dist/run-XYTQ5TWQ.js.map +0 -1
- package/dist/search-TSQAB45E.js +0 -25
- package/dist/secp256k1-XRPVBC6V.js.map +0 -1
- package/dist/send-G746D7PQ.js.map +0 -1
- package/dist/session-JBKWMJ24.js +0 -89
- package/dist/session-JBKWMJ24.js.map +0 -1
- package/dist/skill-heal-WKD67SLJ.js +0 -92
- package/dist/skill-heal-WKD67SLJ.js.map +0 -1
- package/dist/skill-placement-RIU4AMC2.js +0 -20
- package/dist/skill-placement-RIU4AMC2.js.map +0 -1
- package/dist/uninstall-5E263VTS.js +0 -73
- package/dist/uninstall-5E263VTS.js.map +0 -1
- package/dist/update-R76LHOZW.js.map +0 -1
- package/dist/usdc-4VCDHFWX.js +0 -38
- package/dist/usdc-4VCDHFWX.js.map +0 -1
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
- package/dist/wallet-TQ7D5EQ7.js +0 -41
- package/dist/wallet-TQ7D5EQ7.js.map +0 -1
- package/dist/wallet-ZAVXWLWP.js +0 -32
- package/dist/wallet-ZAVXWLWP.js.map +0 -1
- package/docs/command-reference.md +0 -303
- package/skills/tenjin/SKILL.md +0 -373
- package/skills/tenjin-pay/SKILL.md +0 -76
- package/skills/tenjin-publish/SKILL.md +0 -227
- package/skills/tenjin-publish/references/maintain.md +0 -39
- package/skills/tenjin-search/SKILL.md +0 -154
- package/skills/tenjin-search/references/permissions.md +0 -112
- /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
- /package/dist/{buy-VIRNSYGN.js.map → ccip-7RMRLAGV.js.map} +0 -0
- /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
- /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
- /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
- /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
- /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
- /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
- /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
- /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
- /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
- /package/dist/{ccip-ZGGWQN4X.js.map → config-5ADBAAXU.js.map} +0 -0
- /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
- /package/dist/{config-JMRUNYE6.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{doctor-ZBG7X66D.js.map → install-OKDKGUXM.js.map} +0 -0
- /package/dist/{edit-PZJIILQE.js.map → paths-P2N4JTDZ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-3SYKHKWJ.js.map} +0 -0
- /package/dist/{fund-EUDH5KPA.js.map → redact-6W23GGJC.js.map} +0 -0
- /package/dist/{inspect-QC6WEQPN.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
- /package/dist/{outcome-KSGWZHUS.js.map → status-line-wiring-L2WYIYBM.js.map} +0 -0
- /package/dist/{publish-LXWFDIKF.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
- /package/dist/{search-TSQAB45E.js.map → wallet-BMEXRR3P.js.map} +0 -0
package/dist/search-TSQAB45E.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
runSearch
|
|
4
|
-
} from "./chunk-CQBVCYI2.js";
|
|
5
|
-
import "./chunk-65DTCCJ7.js";
|
|
6
|
-
import "./chunk-VJQKL3YH.js";
|
|
7
|
-
import "./chunk-ITUXPJIS.js";
|
|
8
|
-
import "./chunk-EDZSNPE5.js";
|
|
9
|
-
import "./chunk-5QQTYWEU.js";
|
|
10
|
-
import "./chunk-OLWTRUTS.js";
|
|
11
|
-
import "./chunk-VYOJOX4Z.js";
|
|
12
|
-
import "./chunk-EFWZPUTC.js";
|
|
13
|
-
import "./chunk-U6VPKMGC.js";
|
|
14
|
-
import "./chunk-UO22YNY4.js";
|
|
15
|
-
import "./chunk-A5DKHMUN.js";
|
|
16
|
-
import "./chunk-3GL2Z5QK.js";
|
|
17
|
-
import "./chunk-JBIKAAT3.js";
|
|
18
|
-
import "./chunk-2MYQN7HM.js";
|
|
19
|
-
import "./chunk-ZOBNS7CX.js";
|
|
20
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
21
|
-
import "./chunk-ZXTAQYNA.js";
|
|
22
|
-
export {
|
|
23
|
-
runSearch
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=search-TSQAB45E.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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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3C,QAAM,IAAI,SAAS,SAAS,sBAAsB,KAAK,UAAU,KAAK,CAAC,IAAI;AAAA,IACzE,KAAK;AAAA,EACP,CAAC;AACH;AAUA,SAAS,eAAe,KAAsB;AAC5C,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,CAAC,UAAU,OAAO,GAAG;AACvB,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,GAAG,CAAC,IAAI;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,KAAK,WAAW,OAAO;AAC7B,MAAI,OAAO,gBAAgB,OAAO,gBAAgB,OAAO,cAAc;AACrE,UAAM,IAAI,SAAS,SAAS,qDAAqD;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAUA,eAAe,YACb,KACA,MACA,KACA,GACkB;AAClB,MAAI,IAAK,QAAO;AAChB,QAAM,SACJ,QAAQ,QAAQ,EAAE,aAAa,SAAS,CAAC,EAAE,GAAG;AAAA,SACpC,EAAE,IAAI;AAAA,SACN,EAAE,EAAE;AAAA,uBACU,YAAY,EAAE,MAAM,CAAC;AAAA;AAE/C,MAAI,KAAK,YAAY,OAAW,QAAO,KAAK,QAAQ,MAAM;AAE1D,MAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,MAAM,MAAO,QAAO;AAClD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
|
package/dist/session-JBKWMJ24.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
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-QQ6ELLSA.js";
|
|
6
|
-
import "./chunk-KINZ23CV.js";
|
|
7
|
-
import "./chunk-DBU5CXBV.js";
|
|
8
|
-
import "./chunk-KZAAWQNP.js";
|
|
9
|
-
import "./chunk-S5RYMCV6.js";
|
|
10
|
-
import "./chunk-POJRB2AE.js";
|
|
11
|
-
import "./chunk-YLYINX2H.js";
|
|
12
|
-
import {
|
|
13
|
-
describeWallet,
|
|
14
|
-
resolveWalletProvider
|
|
15
|
-
} from "./chunk-CPCX67TI.js";
|
|
16
|
-
import "./chunk-M2O56UK7.js";
|
|
17
|
-
import "./chunk-UHTVXQ2O.js";
|
|
18
|
-
import {
|
|
19
|
-
isSessionUsable,
|
|
20
|
-
loadSessionFile
|
|
21
|
-
} from "./chunk-HRGBS2PA.js";
|
|
22
|
-
import {
|
|
23
|
-
originOf
|
|
24
|
-
} from "./chunk-EDZSNPE5.js";
|
|
25
|
-
import "./chunk-GHLVXVZD.js";
|
|
26
|
-
import "./chunk-OLWTRUTS.js";
|
|
27
|
-
import {
|
|
28
|
-
resolveContextSettings
|
|
29
|
-
} from "./chunk-VYOJOX4Z.js";
|
|
30
|
-
import "./chunk-EFWZPUTC.js";
|
|
31
|
-
import "./chunk-U6VPKMGC.js";
|
|
32
|
-
import "./chunk-UO22YNY4.js";
|
|
33
|
-
import "./chunk-2MYQN7HM.js";
|
|
34
|
-
import "./chunk-ZOBNS7CX.js";
|
|
35
|
-
import {
|
|
36
|
-
CliError
|
|
37
|
-
} from "./chunk-ZFJJ3EXC.js";
|
|
38
|
-
import "./chunk-W6R3HAAG.js";
|
|
39
|
-
import "./chunk-47PP7TAG.js";
|
|
40
|
-
import "./chunk-XJN5WUKL.js";
|
|
41
|
-
import "./chunk-RBJPAZFI.js";
|
|
42
|
-
import "./chunk-KYQVEKP5.js";
|
|
43
|
-
import "./chunk-ZXTAQYNA.js";
|
|
44
|
-
|
|
45
|
-
// src/commands/session.ts
|
|
46
|
-
var V1_SCOPE = "read";
|
|
47
|
-
async function runSessionStart(args, ctx, deps = {}) {
|
|
48
|
-
const now = deps.now ?? Date.now;
|
|
49
|
-
if (args.scope !== void 0 && args.scope !== V1_SCOPE) {
|
|
50
|
-
throw new CliError("USAGE", `Unsupported session scope: ${JSON.stringify(args.scope)}`, {
|
|
51
|
-
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."
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const settings = await resolveContextSettings(ctx);
|
|
55
|
-
const provider = resolveWalletProvider(
|
|
56
|
-
ctx,
|
|
57
|
-
deps.provider !== void 0 ? { provider: deps.provider } : {}
|
|
58
|
-
);
|
|
59
|
-
const wallet = await describeWallet(provider);
|
|
60
|
-
const origin = originOf(settings.baseUrl);
|
|
61
|
-
const cached = await loadSessionFile(ctx.dataDir);
|
|
62
|
-
if (cached !== null && isSessionUsable(cached, wallet.address, now(), V1_SCOPE, origin)) {
|
|
63
|
-
return receipt(cached, false);
|
|
64
|
-
}
|
|
65
|
-
const signer = await provider.getSigner();
|
|
66
|
-
const file = await establishSession({
|
|
67
|
-
signer,
|
|
68
|
-
baseUrl: settings.baseUrl,
|
|
69
|
-
chainId: SESSION_CHAIN_ID,
|
|
70
|
-
dataDir: ctx.dataDir,
|
|
71
|
-
scope: V1_SCOPE
|
|
72
|
-
});
|
|
73
|
-
return receipt(file, true);
|
|
74
|
-
}
|
|
75
|
-
function receipt(file, minted) {
|
|
76
|
-
const { address, origin, scope, exp } = file;
|
|
77
|
-
const what = `${address} (scope ${scope}) for ${origin}`;
|
|
78
|
-
return {
|
|
79
|
-
data: { status: minted ? "created" : "reused", address, origin, scope, exp },
|
|
80
|
-
humanLines: [
|
|
81
|
-
minted ? `Session key minted for ${what}, expires ${exp}.` : `Session key already active for ${what}, expires ${exp}. No wallet signature needed.`,
|
|
82
|
-
"`tenjin read` can now recover pieces this wallet already owns from that origin. It still cannot pay."
|
|
83
|
-
]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
runSessionStart
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=session-JBKWMJ24.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,CAA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ire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
installSkill
|
|
4
|
-
} from "./chunk-QZ6ROAJU.js";
|
|
5
|
-
import {
|
|
6
|
-
emitWriteNotice
|
|
7
|
-
} from "./chunk-OLWTRUTS.js";
|
|
8
|
-
import {
|
|
9
|
-
resolveHermesHomeLenient
|
|
10
|
-
} from "./chunk-OKYSNAS3.js";
|
|
11
|
-
import "./chunk-A5DKHMUN.js";
|
|
12
|
-
import "./chunk-3GL2Z5QK.js";
|
|
13
|
-
import "./chunk-JBIKAAT3.js";
|
|
14
|
-
import {
|
|
15
|
-
CLI_SKILL_NAMES,
|
|
16
|
-
OPTIONAL_SKILL_NAMES,
|
|
17
|
-
readSkillFile,
|
|
18
|
-
resolveSkillsSource,
|
|
19
|
-
skillFrontmatterName,
|
|
20
|
-
skillsDirsFor
|
|
21
|
-
} from "./chunk-2MYQN7HM.js";
|
|
22
|
-
import "./chunk-ZOBNS7CX.js";
|
|
23
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
24
|
-
import "./chunk-ZXTAQYNA.js";
|
|
25
|
-
|
|
26
|
-
// src/lib/skill-heal.ts
|
|
27
|
-
import { existsSync, lstatSync } from "fs";
|
|
28
|
-
import { homedir } from "os";
|
|
29
|
-
import { dirname, isAbsolute, join } from "path";
|
|
30
|
-
import { fileURLToPath } from "url";
|
|
31
|
-
var OPT_OUT = "TENJIN_NO_SKILL_HEAL";
|
|
32
|
-
async function healWiredSkills(deps) {
|
|
33
|
-
try {
|
|
34
|
-
const env = deps.env ?? process.env;
|
|
35
|
-
if (env.CI !== void 0 && env.CI.length > 0) return;
|
|
36
|
-
if (env[OPT_OUT] === "1") return;
|
|
37
|
-
const home = deps.homeDir ?? homedir();
|
|
38
|
-
if (!isAbsolute(home)) return;
|
|
39
|
-
const source = deps.skillsSourceDir ?? packagedSource();
|
|
40
|
-
if (source === null) return;
|
|
41
|
-
const targets = healable(home, resolveHermesHomeLenient(home, env).home);
|
|
42
|
-
if (targets.length === 0) return;
|
|
43
|
-
await heal(targets, source, deps.io);
|
|
44
|
-
} catch {
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function packagedSource() {
|
|
48
|
-
const dir = resolveSkillsSource(fileURLToPath(new URL(".", import.meta.url)));
|
|
49
|
-
return existsSync(join(dirname(dir), "src")) ? null : dir;
|
|
50
|
-
}
|
|
51
|
-
function healable(home, hermesHome) {
|
|
52
|
-
const found = [];
|
|
53
|
-
for (const dir of skillsDirsFor(home, hermesHome)) {
|
|
54
|
-
if (!isRealDirectory(dir)) continue;
|
|
55
|
-
for (const name of [...CLI_SKILL_NAMES, ...OPTIONAL_SKILL_NAMES]) {
|
|
56
|
-
if (!isRealDirectory(join(dir, name))) continue;
|
|
57
|
-
const path = join(dir, name, "SKILL.md");
|
|
58
|
-
if (lstatSync(path, { throwIfNoEntry: false })?.isFile() !== true) continue;
|
|
59
|
-
found.push({ dir, name, path });
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return found;
|
|
63
|
-
}
|
|
64
|
-
function isRealDirectory(path) {
|
|
65
|
-
return lstatSync(path, { throwIfNoEntry: false })?.isDirectory() === true;
|
|
66
|
-
}
|
|
67
|
-
async function heal(targets, source, io) {
|
|
68
|
-
const updated = [];
|
|
69
|
-
for (const { dir, name, path } of targets) {
|
|
70
|
-
try {
|
|
71
|
-
if (!await isOurs(path, name)) continue;
|
|
72
|
-
const { status } = await installSkill(join(source, name), join(dir, name), false, name, {
|
|
73
|
-
followSymlinks: false
|
|
74
|
-
});
|
|
75
|
-
if (status === "up-to-date") continue;
|
|
76
|
-
updated.push(path);
|
|
77
|
-
} catch {
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (updated.length > 0) emitWriteNotice(io, noticeFor(updated));
|
|
81
|
-
}
|
|
82
|
-
async function isOurs(path, name) {
|
|
83
|
-
const read = await readSkillFile(path);
|
|
84
|
-
return read.kind === "ok" && skillFrontmatterName(read.bytes.toString("utf8")) === name;
|
|
85
|
-
}
|
|
86
|
-
function noticeFor(updated) {
|
|
87
|
-
return `Updated ${updated.join(" and ")} to match this CLI.`;
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
healWiredSkills
|
|
91
|
-
};
|
|
92
|
-
//# sourceMappingURL=skill-heal-WKD67SLJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/skill-heal.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { emitWriteNotice } from './output';\nimport type { Io } from './output';\nimport { installSkill } from './skill-writer';\nimport {\n CLI_SKILL_NAMES,\n readSkillFile,\n skillFrontmatterName,\n skillsDirsFor,\n} from './skill-wiring';\nimport { OPTIONAL_SKILL_NAMES, resolveSkillsSource } from './skills-source';\nimport { resolveHermesHomeLenient } from './hermes';\n\nexport interface HealDeps {\n io: Io;\n /** Environment for the CI and opt-out checks. Defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Home whose skills directories are healed. Tests inject a temp dir. */\n homeDir?: string;\n /**\n * The packaged skills source. Defaults to this build's own, and only that\n * default is checked for being a working tree: passing one is a deliberate act.\n */\n skillsSourceDir?: string;\n}\n\n/** The opt-out, in the shape the CLI's other `TENJIN_NO_*` switches take. */\nconst OPT_OUT = 'TENJIN_NO_SKILL_HEAL';\n\n/**\n * Refresh the CLI adapter skills ALREADY in a harness skills directory, so\n * updating the CLI updates the copies `install` wrote instead of leaving an agent\n * on an older version's instructions. Subordinate to the command that ran, like\n * the update nudge: after the envelope, never on stdout, never a failure.\n *\n * It is an UNATTENDED writer into the operator's home, so it is strictly more\n * conservative than `install`, which a human ran on purpose. What it declines to\n * touch is listed on {@link healable}, and it heals the CLI adapters plus any\n * optional skill that is present (presence is the gate that placed it):\n * the hosted `tenjin` skill mirrors tenjin.blog/skills.md, so the copy on disk\n * may be a NEWER fetch than this package ships, and rewriting it would undo that\n * and make install's \"re-fetch it from tenjin.blog/skills.md\" false. Same domain\n * `doctor`'s staleness check compares.\n *\n * Unlocked, on purpose. Concurrent healers write byte-identical content to the\n * same paths through per-file atomic renames, so there is nothing to serialize;\n * a lock here could only make things worse, because one left behind by a killed\n * process would silently disable healing on this machine forever.\n */\nexport async function healWiredSkills(deps: HealDeps): Promise<void> {\n try {\n const env = deps.env ?? process.env;\n // The same two doors the update nudge uses: a build log cannot act on this,\n // and an operator who wants their skills left alone says so once.\n if (env.CI !== undefined && env.CI.length > 0) return;\n if (env[OPT_OUT] === '1') return;\n\n const home = deps.homeDir ?? homedir();\n // An empty or relative HOME (sudo/docker env_reset, systemd units) would make\n // every target below relative, healing paths under the working directory.\n if (!isAbsolute(home)) return;\n\n const source = deps.skillsSourceDir ?? packagedSource();\n if (source === null) return;\n // Lenient on purpose: an unattended healer is the last place that should\n // refuse to run over a stray relative HERMES_HOME.\n const targets = healable(home, resolveHermesHomeLenient(home, env).home);\n if (targets.length === 0) return;\n await heal(targets, source, deps.io);\n } catch {\n // Whatever it was, it is the next command's to retry; this one is finished.\n }\n}\n\n/**\n * This build's packaged skills, or null when they are a working tree's. The\n * published package ships `dist/` and `skills/` with no `src/` beside them, so a\n * `src/` sibling means a checkout, whose skills may be half-edited and are not\n * what anyone agreed to install.\n */\nfunction packagedSource(): string | null {\n const dir = resolveSkillsSource(fileURLToPath(new URL('.', import.meta.url)));\n return existsSync(join(dirname(dir), 'src')) ? null : dir;\n}\n\ninterface Target {\n dir: string;\n name: string;\n /** The SKILL.md itself: what the gates judged, and what the notice names. */\n path: string;\n}\n\n/**\n * The (directory, skill) pairs this may rewrite, which is a deliberately narrow\n * set. A skill that is not there is never created, because presence is the\n * operator's consent to a directory.\n *\n * Nothing here is reached THROUGH a symlink. `install` follows one on purpose,\n * since the operator pointed it somewhere; unattended, following one means a\n * write landing wherever it points and a notice naming a path that is not where\n * it landed. That argument does not get weaker one directory up, so every\n * component this CLI creates is checked with `lstat`, not `stat`: the skills\n * directory, the skill directory, and SKILL.md. Above them is the harness's own\n * home, which every tool including the harness reaches through, so a link there\n * is the operator's name for the place rather than a redirect around us.\n *\n * Gating SKILL.md gates the whole write. It is not the only file a skill ships\n * any more (tenjin-search carries `references/`), but it is the only one whose\n * frontmatter can prove the directory is OURS, and `installSkill` writes the\n * whole packaged tree once that gate passes — so a reference file deleted or\n * edited under a healthy SKILL.md is restored on the same pass. The other gate,\n * that the file is ours at all, needs its content and so lives at the write.\n */\nfunction healable(home: string, hermesHome: string): Target[] {\n const found: Target[] = [];\n for (const dir of skillsDirsFor(home, hermesHome)) {\n if (!isRealDirectory(dir)) continue;\n for (const name of [...CLI_SKILL_NAMES, ...OPTIONAL_SKILL_NAMES]) {\n if (!isRealDirectory(join(dir, name))) continue;\n const path = join(dir, name, 'SKILL.md');\n if (lstatSync(path, { throwIfNoEntry: false })?.isFile() !== true) continue;\n found.push({ dir, name, path });\n }\n }\n return found;\n}\n\n/** A directory, and not a symlink to one. */\nfunction isRealDirectory(path: string): boolean {\n return lstatSync(path, { throwIfNoEntry: false })?.isDirectory() === true;\n}\n\nasync function heal(targets: readonly Target[], source: string, io: Io): Promise<void> {\n const updated: string[] = [];\n for (const { dir, name, path } of targets) {\n try {\n if (!(await isOurs(path, name))) continue;\n const { status } = await installSkill(join(source, name), join(dir, name), false, name, {\n followSymlinks: false,\n });\n if (status === 'up-to-date') continue;\n updated.push(path);\n } catch {\n // A denied write, a case collision, a file swapped under us: that skill keeps\n // what it has and the others are still healed, and NOTHING is said about it.\n // A cause the next command cannot clear either (a directory at 0500) would\n // otherwise print the same line forever, on every command, with no state to\n // suppress it and no way to dismiss it. `tenjin doctor` is where a skill that\n // is wired but not from this build gets reported, which is exactly this.\n }\n }\n if (updated.length > 0) emitWriteNotice(io, noticeFor(updated));\n}\n\n/** Does this file claim to BE the skill we would write over it? Somebody else's\n * skill is not ours to replace just for sitting at one of our paths. */\nasync function isOurs(path: string, name: string): Promise<boolean> {\n const read = await readSkillFile(path);\n return read.kind === 'ok' && skillFrontmatterName(read.bytes.toString('utf8')) === name;\n}\n\n/**\n * Files, not directories: this line is the only notice that content in the\n * operator's home changed unasked, so it has to say which content. It claims\n * nothing about edits being lost, because it cannot know. Every routine upgrade\n * rewrites these same files, and telling someone their edits are gone when they\n * made none is worse than saying nothing.\n */\nfunction noticeFor(updated: readonly string[]): string {\n return `Updated ${updated.join(' and ')} to match this CLI.`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY,YAAY;AAC1C,SAAS,qBAAqB;AA2B9B,IAAM,UAAU;AAsBhB,eAAsB,gBAAgB,MAA+B;AACnE,MAAI;AACF,UAAM,MAAM,KAAK,OAAO,QAAQ;AAGhC,QAAI,IAAI,OAAO,UAAa,IAAI,GAAG,SAAS,EAAG;AAC/C,QAAI,IAAI,OAAO,MAAM,IAAK;AAE1B,UAAM,OAAO,KAAK,WAAW,QAAQ;AAGrC,QAAI,CAAC,WAAW,IAAI,EAAG;AAEvB,UAAM,SAAS,KAAK,mBAAmB,eAAe;AACtD,QAAI,WAAW,KAAM;AAGrB,UAAM,UAAU,SAAS,MAAM,yBAAyB,MAAM,GAAG,EAAE,IAAI;AACvE,QAAI,QAAQ,WAAW,EAAG;AAC1B,UAAM,KAAK,SAAS,QAAQ,KAAK,EAAE;AAAA,EACrC,QAAQ;AAAA,EAER;AACF;AAQA,SAAS,iBAAgC;AACvC,QAAM,MAAM,oBAAoB,cAAc,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC,CAAC;AAC5E,SAAO,WAAW,KAAK,QAAQ,GAAG,GAAG,KAAK,CAAC,IAAI,OAAO;AACxD;AA8BA,SAAS,SAAS,MAAc,YAA8B;AAC5D,QAAM,QAAkB,CAAC;AACzB,aAAW,OAAO,cAAc,MAAM,UAAU,GAAG;AAC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node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
placeOptionalSkill,
|
|
4
|
-
syncBazaarSkill
|
|
5
|
-
} from "./chunk-DHJD77OW.js";
|
|
6
|
-
import "./chunk-QZ6ROAJU.js";
|
|
7
|
-
import "./chunk-OLWTRUTS.js";
|
|
8
|
-
import "./chunk-OKYSNAS3.js";
|
|
9
|
-
import "./chunk-A5DKHMUN.js";
|
|
10
|
-
import "./chunk-3GL2Z5QK.js";
|
|
11
|
-
import "./chunk-JBIKAAT3.js";
|
|
12
|
-
import "./chunk-2MYQN7HM.js";
|
|
13
|
-
import "./chunk-ZOBNS7CX.js";
|
|
14
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
15
|
-
import "./chunk-ZXTAQYNA.js";
|
|
16
|
-
export {
|
|
17
|
-
placeOptionalSkill,
|
|
18
|
-
syncBazaarSkill
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=skill-placement-RIU4AMC2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
KEPT_ITEMS,
|
|
4
|
-
REMOVED_FROM_DATA_DIR,
|
|
5
|
-
removeFromSettings,
|
|
6
|
-
removeHookScripts,
|
|
7
|
-
removeMarkerLines,
|
|
8
|
-
removeSkills
|
|
9
|
-
} from "./chunk-B63XPWQ4.js";
|
|
10
|
-
import "./chunk-QZ6ROAJU.js";
|
|
11
|
-
import {
|
|
12
|
-
sanitizeForTerminal
|
|
13
|
-
} from "./chunk-OLWTRUTS.js";
|
|
14
|
-
import "./chunk-OKYSNAS3.js";
|
|
15
|
-
import "./chunk-A5DKHMUN.js";
|
|
16
|
-
import "./chunk-3GL2Z5QK.js";
|
|
17
|
-
import "./chunk-JBIKAAT3.js";
|
|
18
|
-
import "./chunk-2MYQN7HM.js";
|
|
19
|
-
import "./chunk-ZOBNS7CX.js";
|
|
20
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
21
|
-
import "./chunk-ZXTAQYNA.js";
|
|
22
|
-
|
|
23
|
-
// src/commands/uninstall.ts
|
|
24
|
-
import { homedir } from "os";
|
|
25
|
-
async function runUninstall(ctx, deps = {}) {
|
|
26
|
-
const home = deps.home ?? homedir();
|
|
27
|
-
const settings = await removeFromSettings(home);
|
|
28
|
-
const scripts = await removeHookScripts(ctx.dataDir);
|
|
29
|
-
const skills = await removeSkills(home, deps.env);
|
|
30
|
-
const markers = await removeMarkerLines(home);
|
|
31
|
-
const report = {
|
|
32
|
-
settings,
|
|
33
|
-
skills,
|
|
34
|
-
scripts: scripts.scripts,
|
|
35
|
-
...scripts.removedDir !== void 0 ? { hooksDir: scripts.removedDir } : {},
|
|
36
|
-
markers,
|
|
37
|
-
kept: [...KEPT_ITEMS]
|
|
38
|
-
};
|
|
39
|
-
return { data: report, humanLines: humanLines(report) };
|
|
40
|
-
}
|
|
41
|
-
function humanLines(report) {
|
|
42
|
-
const { settings } = report;
|
|
43
|
-
const removed = [];
|
|
44
|
-
for (const dir of report.skills) removed.push(`skill ${sanitizeForTerminal(dir)}`);
|
|
45
|
-
for (const script of report.scripts) removed.push(`hook script ${sanitizeForTerminal(script)}`);
|
|
46
|
-
if (report.hooksDir !== void 0) {
|
|
47
|
-
removed.push(`empty hooks directory ${sanitizeForTerminal(report.hooksDir)}`);
|
|
48
|
-
}
|
|
49
|
-
for (const event of settings.hooks) {
|
|
50
|
-
removed.push(`${event} hook entry in ${sanitizeForTerminal(settings.path)}`);
|
|
51
|
-
}
|
|
52
|
-
if (settings.rules.length > 0) {
|
|
53
|
-
removed.push(
|
|
54
|
-
`${settings.rules.length} tenjin permission rule(s) in ${sanitizeForTerminal(settings.path)}`
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
for (const path of report.markers) {
|
|
58
|
-
removed.push(`legacy pointer line in ${sanitizeForTerminal(path)}`);
|
|
59
|
-
}
|
|
60
|
-
const lines = removed.length === 0 ? ["Nothing to remove; tenjin was not installed here."] : ["Removed:", ...removed.map((r) => ` - ${r}`)];
|
|
61
|
-
lines.push("Kept:");
|
|
62
|
-
for (const item of report.kept) lines.push(` - ${item}`);
|
|
63
|
-
lines.push(`Removed from ~/.tenjin: ${REMOVED_FROM_DATA_DIR}`);
|
|
64
|
-
if (settings.warning !== void 0) {
|
|
65
|
-
lines.push(`! ${sanitizeForTerminal(settings.warning)}`);
|
|
66
|
-
}
|
|
67
|
-
lines.push("Reinstall anytime: tenjin install");
|
|
68
|
-
return lines;
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
runUninstall
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=uninstall-5E263VTS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/uninstall.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport {\n KEPT_ITEMS,\n REMOVED_FROM_DATA_DIR,\n removeFromSettings,\n removeHookScripts,\n removeMarkerLines,\n removeSkills,\n type UninstallReport,\n} from '../lib/uninstall';\nimport { sanitizeForTerminal } from '../lib/output';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin uninstall`: undo exactly what `tenjin install` wrote, and nothing else.\n *\n * The shape of this command is the promise it makes. It removes the skills, the\n * hook scripts, our hook entries and permission rules in the harness's\n * settings.json, and the legacy pointer line older versions wrote into\n * CLAUDE.md/AGENTS.md. It does NOT remove the wallet, the config, the library,\n * the search ledger, or parked candidates: `install` did not create those, and a\n * wallet holds funds while a candidate is unpublished work. The hook scripts are\n * the one thing under `~/.tenjin` it does remove, because `install` generated\n * them. The receipt names both halves on every run, so the operator learns the\n * boundary from the command rather than from the docs.\n *\n * IDEMPOTENT BY CONSTRUCTION. Every step is \"remove it if it is ours and there\",\n * so a half-installed machine, an already-uninstalled one, and a machine that\n * never ran install all succeed and report what was (not) found. There is no\n * confirmation prompt and no --force: nothing here is unrecoverable, since a\n * `tenjin install` puts all of it back.\n */\n\nexport interface UninstallDeps {\n /** Home whose harness directories are cleaned; tests inject a temp dir. */\n home?: string;\n /** Environment the Hermes home is resolved from; defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n}\n\nexport async function runUninstall(\n ctx: CommandContext,\n deps: UninstallDeps = {},\n): Promise<CommandResult> {\n const home = deps.home ?? homedir();\n\n // Settings first: it is the only step with a concurrency guard, and the only\n // one that can refuse. Doing it before the scripts are deleted means a refusal\n // leaves a registered hook still pointing at a script that exists, rather than\n // at one that does not.\n const settings = await removeFromSettings(home);\n const scripts = await removeHookScripts(ctx.dataDir);\n const skills = await removeSkills(home, deps.env);\n const markers = await removeMarkerLines(home);\n\n const report: UninstallReport = {\n settings,\n skills,\n scripts: scripts.scripts,\n ...(scripts.removedDir !== undefined ? { hooksDir: scripts.removedDir } : {}),\n markers,\n kept: [...KEPT_ITEMS],\n };\n\n return { data: report, humanLines: humanLines(report) };\n}\n\nfunction humanLines(report: UninstallReport): string[] {\n const { settings } = report;\n const removed: string[] = [];\n for (const dir of report.skills) removed.push(`skill ${sanitizeForTerminal(dir)}`);\n for (const script of report.scripts) removed.push(`hook script ${sanitizeForTerminal(script)}`);\n if (report.hooksDir !== undefined) {\n removed.push(`empty hooks directory ${sanitizeForTerminal(report.hooksDir)}`);\n }\n for (const event of settings.hooks) {\n removed.push(`${event} hook entry in ${sanitizeForTerminal(settings.path)}`);\n }\n if (settings.rules.length > 0) {\n removed.push(\n `${settings.rules.length} tenjin permission rule(s) in ${sanitizeForTerminal(settings.path)}`,\n );\n }\n for (const path of report.markers) {\n removed.push(`legacy pointer line in ${sanitizeForTerminal(path)}`);\n }\n\n const lines =\n removed.length === 0\n ? ['Nothing to remove; tenjin was not installed here.']\n : ['Removed:', ...removed.map((r) => ` - ${r}`)];\n\n // Named on EVERY run, including the nothing-to-remove one: the boundary is the\n // point of the command, and an operator reaching for it is usually worried\n // about exactly these things. The exception is named right under them, because\n // an unqualified \"nothing under ~/.tenjin is touched\" is contradicted by the\n // hook scripts this same receipt just listed as removed.\n lines.push('Kept:');\n for (const item of report.kept) lines.push(` - ${item}`);\n lines.push(`Removed from ~/.tenjin: ${REMOVED_FROM_DATA_DIR}`);\n\n if (settings.warning !== undefined) {\n lines.push(`! ${sanitizeForTerminal(settings.warning)}`);\n }\n lines.push('Reinstall anytime: tenjin install');\n return lines;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AAwCxB,eAAsB,aACpB,KACA,OAAsB,CAAC,GACC;AACxB,QAAM,OAAO,KAAK,QAAQ,QAAQ;AAMlC,QAAM,WAAW,MAAM,mBAAmB,IAAI;AAC9C,QAAM,UAAU,MAAM,kBAAkB,IAAI,OAAO;AACnD,QAAM,SAAS,MAAM,aAAa,MAAM,KAAK,GAAG;AAChD,QAAM,UAAU,MAAM,kBAAkB,IAAI;AAE5C,QAAM,SAA0B;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,SAAS,QAAQ;AAAA,IACjB,GAAI,QAAQ,eAAe,SAAY,EAAE,UAAU,QAAQ,WAAW,IAAI,CAAC;AAAA,IAC3E;AAAA,IACA,MAAM,CAAC,GAAG,UAAU;AAAA,EACtB;AAEA,SAAO,EAAE,MAAM,QAAQ,YAAY,WAAW,MAAM,EAAE;AACxD;AAEA,SAAS,WAAW,QAAmC;AACrD,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,UAAoB,CAAC;AAC3B,aAAW,OAAO,OAAO,OAAQ,SAAQ,KAAK,SAAS,oBAAoB,GAAG,CAAC,EAAE;AACjF,aAAW,UAAU,OAAO,QAAS,SAAQ,KAAK,eAAe,oBAAoB,MAAM,CAAC,EAAE;AAC9F,MAAI,OAAO,aAAa,QAAW;AACjC,YAAQ,KAAK,yBAAyB,oBAAoB,OAAO,QAAQ,CAAC,EAAE;AAAA,EAC9E;AACA,aAAW,SAAS,SAAS,OAAO;AAClC,YAAQ,KAAK,GAAG,KAAK,kBAAkB,oBAAoB,SAAS,IAAI,CAAC,EAAE;AAAA,EAC7E;AACA,MAAI,SAAS,MAAM,SAAS,GAAG;AAC7B,YAAQ;AAAA,MACN,GAAG,SAAS,MAAM,MAAM,iCAAiC,oBAAoB,SAAS,IAAI,CAAC;AAAA,IAC7F;AAAA,EACF;AACA,aAAW,QAAQ,OAAO,SAAS;AACjC,YAAQ,KAAK,0BAA0B,oBAAoB,IAAI,CAAC,EAAE;AAAA,EACpE;AAEA,QAAM,QACJ,QAAQ,WAAW,IACf,CAAC,mDAAmD,IACpD,CAAC,YAAY,GAAG,QAAQ,IAAI,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;AAOpD,QAAM,KAAK,OAAO;AAClB,aAAW,QAAQ,OAAO,KAAM,OAAM,KAAK,OAAO,IAAI,EAAE;AACxD,QAAM,KAAK,2BAA2B,qBAAqB,EAAE;AAE7D,MAAI,SAAS,YAAY,QAAW;AAClC,UAAM,KAAK,KAAK,oBAAoB,SAAS,OAAO,CAAC,EAAE;AAAA,EACzD;AACA,QAAM,KAAK,mCAAmC;AAC9C,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/update.ts","../src/lib/install-location.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { homedir } from 'node:os';\nimport { fileURLToPath } from 'node:url';\nimport pkg from '../../package.json';\nimport { CliError } from '../lib/errors';\nimport { MANAGERS, classifyManager, refuse, resolveManagerScript } from '../lib/install-location';\nimport type { Delegable } from '../lib/install-location';\nimport { emitWriteNotice, sanitizeForTerminal } from '../lib/output';\nimport { channelTag, fetchDistTags, isNewer, resolveTarget } from '../lib/update-check';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin update`: replace this install with the newest version npm offers it,\n * by spawning the package manager that OWNS the install rather than\n * reimplementing one. Four invariants:\n *\n * - The argv pins the EXACT version the registry just named, never the tag, so\n * the check and the install cannot disagree about what ships, and the version\n * string is certified parseable by the same `isNewer` gate the nudge trusts\n * before it goes anywhere near an argv.\n * - The owner performs the install. npm, pnpm and bun are each driven with their\n * own global-add command, because the PATH race that makes a second install\n * dangerous comes from CROSS-manager writes, not from asking the owner to do\n * what it already owns. What cannot be driven is refused instead of guessed\n * at: a source checkout updates by git, an npx run has nothing installed to\n * replace, a project-local copy updates where it is declared, and yarn's\n * global install exists only in yarn 1. See lib/install-location.\n * - The child is a binary or `node <script>`, never a shell. That is what makes\n * the pinned argv worth pinning, and it is the only form that works on win32.\n * - The manager's chatter goes to stderr (live, human mode only, sanitized) and\n * its failure into the error envelope; stdout stays the one envelope every\n * command emits.\n */\n\n/** How long the npm child gets before it is killed. npm's own retry budget runs\n * into minutes, and an agent's turn should not hang on a wedged registry. */\nconst INSTALL_TIMEOUT_MS = 300_000;\n\nexport interface UpdateOptions {\n /** Report whether a newer version exists; never install. */\n check: boolean;\n}\n\n/**\n * How the child ended. Never rejects: all three outcomes are envelope-shaped\n * facts the caller reports, not exceptions, and each is separately testable.\n */\nexport type SpawnResult =\n { kind: 'exit'; code: number } | { kind: 'start-failed'; cause: unknown } | { kind: 'timeout' };\n\nexport type UpdateSpawn = (\n cmd: string,\n args: string[],\n opts: { cwd: string; timeoutMs: number },\n onOutput: (chunk: string) => void,\n) => Promise<SpawnResult>;\n\n/** What to spawn for one manager: a command and any argv that must precede its own. */\ninterface ResolvedManager {\n cmd: string;\n prefix: readonly string[];\n}\n\n/**\n * Turn a manager into a spawnable command. A resolved script runs under THIS\n * node, keeping `shell` unset on every platform; otherwise the bare binary name\n * is used, which is correct for a native binary and fails closed on win32 for a\n * `.cmd` shim.\n */\nfunction resolveManager(manager: Delegable, deps: UpdateDeps): ResolvedManager {\n const script =\n deps.managerScript !== undefined\n ? deps.managerScript\n : resolveManagerScript(manager, process.execPath);\n return script === null\n ? { cmd: MANAGERS[manager].bin, prefix: [] }\n : { cmd: process.execPath, prefix: [script] };\n}\n\nexport interface UpdateDeps {\n fetchImpl?: typeof fetch;\n spawnImpl?: UpdateSpawn;\n /** Where this build's code lives on disk; tests point it at fixture trees. */\n moduleDir?: string;\n /** The running version; defaults to this build's. Injectable for tests. */\n currentVersion?: string;\n /** The owning manager's entry script, or null when it has none to find.\n * Injectable so the argv shape is asserted without depending on the runner. */\n managerScript?: string | null;\n}\n\ninterface UpdateData {\n current: string;\n latest: string;\n updateAvailable: boolean;\n updated: boolean;\n}\n\nexport async function runUpdate(\n opts: UpdateOptions,\n ctx: CommandContext,\n deps: UpdateDeps = {},\n): Promise<CommandResult> {\n const current = deps.currentVersion ?? pkg.version;\n const channel = channelTag(current);\n const moduleDir = deps.moduleDir ?? fileURLToPath(new URL('.', import.meta.url));\n\n // Refused, not defaulted to a channel: a build whose version this package\n // cannot parse has no release line to compare against, and guessing one is how\n // a foreign build gets told it is up to date forever.\n if (channel === null) {\n throw new CliError('REFUSED', `tenjin-cli reports an unrecognizable version (${current})`, {\n fix: 'Reinstall a published build: npm i -g tenjin-cli',\n });\n }\n\n // First stage: everything whose fix string does not need a resolved version,\n // so it answers without the network. An offline contributor in a checkout is\n // told they are in a checkout, not told to go debug their registry access.\n refuse(moduleDir, { check: opts.check, spec: null });\n\n const tags = await fetchDistTags({\n fetchImpl: deps.fetchImpl,\n timeoutMs: ctx.flags.timeout,\n });\n if (tags === null) {\n throw new CliError('NETWORK_ERROR', 'Could not read tenjin-cli dist-tags from npm', {\n fix: 'Check access to registry.npmjs.org and retry',\n });\n }\n const latest = resolveTarget(current, tags);\n // Not a NETWORK_ERROR: nothing about the connection is wrong, and telling the\n // user to check their access sends them after a fault that is not there.\n if (latest === null) {\n const raw = tags[channel];\n throw raw === undefined\n ? new CliError('RESOURCE_NOT_FOUND', 'npm has no published tenjin-cli on the latest tag', {\n fix: 'Pick a version yourself: npm view tenjin-cli versions',\n })\n : new CliError(\n 'RESOURCE_NOT_FOUND',\n // Registry-controlled: bounded here, escaped by the error emitter.\n `npm's latest tenjin-cli (${raw.slice(0, 40)}) is not a version this build can read`,\n {\n fix: 'Install it by name: npm i -g tenjin-cli@<version> (npm view tenjin-cli versions)',\n },\n );\n }\n\n const updateAvailable = isNewer(latest, current);\n const data = (updated: boolean): UpdateData => ({\n current,\n latest,\n updateAvailable,\n updated,\n });\n\n if (!updateAvailable) {\n return {\n data: data(false),\n humanLines: [`tenjin-cli ${current} is up to date`],\n };\n }\n if (opts.check) {\n return {\n data: data(false),\n humanLines: [\n `tenjin-cli ${latest} is available (you have ${current}).`,\n 'Run tenjin update to install it.',\n ],\n };\n }\n\n // `latest` is argv-safe here: isNewer returned true, so it matched VERSION_RE.\n const spec = `tenjin-cli@${latest}`;\n\n // Second stage: the entries whose fix strings name the version just resolved.\n // Reached only on the install path, since --check has already returned.\n refuse(moduleDir, { check: false, spec });\n\n // Live chatter is a human courtesy only; the tail rides in the error envelope\n // so a piped failure is still diagnosable. Sanitized per line, because npm\n // relays publisher-controlled text (deprecation notices) and a line break is\n // the one control character this stream must keep.\n const human = ctx.io.isTTY && !ctx.flags.json;\n let tail = '';\n const onOutput = (chunk: string): void => {\n tail = (tail + chunk).slice(-2000);\n if (human) ctx.io.stderr.write(chunk.split('\\n').map(sanitizeForTerminal).join('\\n'));\n };\n\n // Whoever owns the install performs it. The PATH-race objection that used to\n // make this a refusal only applies to CROSS-manager writes; invoking the owner\n // is exactly what the refusal used to tell the user to type by hand.\n //\n // The cast is sound only because `refuse` ran directly above and yarn is one\n // of its entries, so the one non-delegable manager has already thrown. Move\n // this line above that call and it becomes a lie.\n const manager = classifyManager(moduleDir) as Delegable;\n const plan = MANAGERS[manager];\n // --ignore-scripts where the manager has it (tenjin-cli has no runtime\n // dependencies and no registry install runs its own `prepare`), and cwd is the\n // home directory so the child never reads a project's config by accident.\n const args = plan.args(spec);\n const resolved = resolveManager(manager, deps);\n const manual = `Run it yourself: ${plan.manual(spec)}`;\n\n const outcome = await (deps.spawnImpl ?? spawnCapture)(\n resolved.cmd,\n [...resolved.prefix, ...args],\n { cwd: homedir(), timeoutMs: INSTALL_TIMEOUT_MS },\n onOutput,\n );\n if (outcome.kind === 'start-failed') {\n throw new CliError('UPDATE_FAILED', `Could not start ${manager}`, {\n fix: manual,\n cause: outcome.cause,\n });\n }\n if (outcome.kind === 'timeout') {\n throw new CliError(\n 'UPDATE_FAILED',\n `${manager} did not finish in ${INSTALL_TIMEOUT_MS / 1000}s`,\n { fix: manual, details: { output: tail } },\n );\n }\n if (outcome.code !== 0) {\n throw new CliError('UPDATE_FAILED', `${manager} ${args.join(' ')} exited ${outcome.code}`, {\n // EACCES on a root-owned global prefix is the common cause; the operator\n // fixing that themselves beats this CLI ever escalating.\n fix: manual,\n details: { output: tail },\n });\n }\n\n emitWriteNotice(\n ctx.io,\n `tenjin update: replaced the global tenjin-cli with ${latest} via ${manager}`,\n );\n return {\n data: data(true),\n humanLines: [`Updated tenjin-cli ${current} -> ${latest}. New builds pick it up immediately.`],\n };\n}\n\n/**\n * Default spawn: merged stdout+stderr chunks out, an outcome back, no shell.\n * Bounded by its own timer rather than Node's `timeout` option so that a kill\n * this code ordered is distinguishable from any other death by signal.\n */\nexport const spawnCapture: UpdateSpawn = (cmd, args, opts, onOutput) =>\n new Promise((res) => {\n let child;\n try {\n child = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'], cwd: opts.cwd });\n } catch (cause) {\n // An argv or option Node rejects outright throws here; ENOENT arrives on\n // the 'error' event instead. Both mean the same thing to the caller.\n res({ kind: 'start-failed', cause });\n return;\n }\n let timedOut = false;\n const timer = setTimeout(() => {\n timedOut = true;\n child.kill('SIGKILL');\n }, opts.timeoutMs);\n child.stdout?.on('data', (chunk: Buffer) => onOutput(chunk.toString()));\n child.stderr?.on('data', (chunk: Buffer) => onOutput(chunk.toString()));\n child.on('error', (cause) => {\n clearTimeout(timer);\n res({ kind: 'start-failed', cause });\n });\n child.on('close', (code) => {\n clearTimeout(timer);\n res(timedOut ? { kind: 'timeout' } : { kind: 'exit', code: code ?? 1 });\n });\n });\n","import { existsSync, realpathSync, statSync } from 'node:fs';\nimport { delimiter, dirname, join, sep } from 'node:path';\nimport { CliError } from './errors';\n\n/**\n * WHERE this build is installed, and what that implies about replacing it.\n *\n * Its own module because it answers a different question from the command that\n * uses it: \"what IS this install\" rather than \"how do I replace it\". The\n * refusal set is the load-bearing part, and it got re-cut in three consecutive\n * reviews while it was expressed positionally inside the command body.\n */\n\n/** Managers a global install can be handed back to. yarn is deliberately absent\n * from the delegable set: see the yarn entry in REFUSALS. */\nexport type Delegable = 'npm' | 'pnpm' | 'bun';\n\n/**\n * One reason `npm install -g` would not actually replace THIS build.\n *\n * Each entry carries the three properties that decide WHEN it is evaluated,\n * because expressing them by where the line sat is what made this set get\n * re-cut three times: a missing entry, then a copy on the wrong side of the\n * fetch, then a duplicate that could not run. Declaring them means adding a\n * refusal is a matter of answering three questions, not of guessing a position.\n */\ninterface Refusal {\n /** Does this install location refuse? Pure filesystem, never the network. */\n test: (moduleDir: string) => boolean;\n error: (spec: string, moduleDir: string) => CliError;\n /**\n * Does the fix string name the version the registry just resolved? This is\n * also what decides whether the entry may run BEFORE the fetch: one that does\n * not need a version is evaluated first, so an offline user in a checkout is\n * told they are in a checkout rather than told to go debug their network.\n */\n needsVersion: boolean;\n /**\n * Does it apply to `--check`? Everything here is a reason not to WRITE, and\n * `--check` only reports, so today nothing does. An entry that ever answers\n * yes is one whose test says the REPORT would be wrong, not the install.\n */\n appliesToCheck: boolean;\n}\n\n/**\n * Ordered most-specific first: a checkout and an npx cache are recognizable\n * before any question of which manager or which tree, and the manager entry\n * precedes the global/local one because a pnpm or bun store has its own layout\n * that `isGlobalTree` is not written for.\n */\nexport const REFUSALS: readonly Refusal[] = [\n {\n test: isSourceCheckout,\n error: () =>\n new CliError('REFUSED', 'tenjin-cli is running from a source checkout, not an install', {\n fix: 'Update the checkout instead: git pull && pnpm install',\n }),\n needsVersion: false,\n appliesToCheck: false,\n },\n {\n test: (moduleDir) => moduleDir.split(sep).includes('_npx'),\n error: (spec) =>\n new CliError('REFUSED', 'tenjin-cli is running from the npx cache, not an install', {\n // Writing a global here would \"succeed\" and change nothing: the next\n // `npx tenjin` still resolves its own cached copy.\n fix: `npx fetches its own copy every time. To keep one: npm i -g ${spec}`,\n }),\n needsVersion: true,\n appliesToCheck: false,\n },\n {\n // The ONLY manager still refused. `yarn global add` is yarn-1 only, and\n // berry dropped global installs altogether, so there is no one command this\n // can drive across the versions a user might have. Every other manager is\n // delegated to rather than refused (see MANAGERS).\n test: (moduleDir) => classifyManager(moduleDir) === 'yarn',\n error: (spec) =>\n new CliError(\n 'REFUSED',\n 'This tenjin-cli was installed with yarn, whose global install exists only in yarn 1',\n { fix: `yarn global add ${spec}` },\n ),\n needsVersion: true,\n appliesToCheck: false,\n },\n {\n // Scoped to npm on purpose: the prefix-vs-project-root test is written for\n // npm's layout. pnpm's global store and bun's global dir both keep a\n // package.json beside `node_modules`, so an unscoped test would read either\n // as a project-local install and refuse the very case we now delegate.\n test: (moduleDir) => classifyManager(moduleDir) === 'npm' && !isGlobalTree(moduleDir),\n error: (spec) =>\n new CliError(\n 'REFUSED',\n 'This tenjin-cli is a project-local dependency, not a global install',\n {\n fix: `Update it where it is declared: npm i ${spec}`,\n },\n ),\n needsVersion: true,\n appliesToCheck: false,\n },\n];\n\n/**\n * Evaluate the refusal set, once per stage. `spec` is null before the registry\n * has been asked and the resolved `tenjin-cli@<version>` after, which is what\n * selects the eligible entries: every entry runs in exactly one stage, so no\n * refusal can be reached twice or, as in round three, be written twice and\n * reached once.\n */\nexport function refuse(moduleDir: string, opts: { check: boolean; spec: string | null }): void {\n for (const entry of REFUSALS) {\n if (opts.check && !entry.appliesToCheck) continue;\n if (entry.needsVersion !== (opts.spec !== null)) continue;\n if (entry.test(moduleDir)) throw entry.error(opts.spec ?? '', moduleDir);\n }\n}\n\n/**\n * The published package ships `dist/`, `docs/`, and `skills/` with no `src/`\n * beside them (the `files` array), so a `src/` next to the nearest package.json\n * means a checkout, whose version number says nothing about what HEAD holds.\n * Same test skill-heal uses to keep its hands off working-tree skills.\n */\nexport function isSourceCheckout(moduleDir: string): boolean {\n let dir = moduleDir;\n for (let i = 0; i < 8; i += 1) {\n if (existsSync(join(dir, 'package.json'))) return existsSync(join(dir, 'src'));\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return false;\n}\n\n/**\n * Is this a GLOBAL npm tree? A global install sits under a prefix directory that\n * is not itself a package (`<prefix>/lib/node_modules/tenjin-cli` on POSIX,\n * `<prefix>\\node_modules\\tenjin-cli` on win32), while a project-local one sits\n * under the project root, which by definition has a package.json. That parent is\n * the whole test, which is why it holds for homebrew, nvm, volta and a\n * user-set `npm config prefix` alike without this code enumerating any of them.\n */\nexport function isGlobalTree(moduleDir: string): boolean {\n const segs = moduleDir.split(sep);\n const i = segs.lastIndexOf('node_modules');\n if (i <= 0) return false;\n return !existsSync(join(segs.slice(0, i).join(sep), 'package.json'));\n}\n\n/**\n * Which package manager owns this install, read off the on-disk path. Node\n * resolved the bin symlink before loading us, so the segments name the real\n * store: pnpm's virtual store keeps a literal `.pnpm` segment (or\n * `pnpm/global` for older layouts), bun installs under `.bun`, yarn under\n * `.yarn` or `yarn/global`. Everything else is treated as npm's tree; that\n * covers nvm and volta, both of which route `npm i -g` correctly.\n */\nexport function classifyManager(moduleDir: string): Delegable | 'yarn' {\n const segs = moduleDir.split(sep);\n const pair = (a: string, b: string): boolean => segs.includes(a) && segs.includes(b);\n if (segs.includes('.pnpm') || pair('pnpm', 'global')) return 'pnpm';\n if (segs.includes('.bun')) return 'bun';\n if (segs.includes('.yarn') || pair('yarn', 'global')) return 'yarn';\n return 'npm';\n}\n\n/**\n * How to perform a global install with each manager we delegate to.\n *\n * `scriptSuffixes` is what a PATH shim may resolve to that Node can run\n * directly, which is how win32 is served without a shell: npm and pnpm ship as\n * JS, so the child becomes `node <script>`. An empty list means the binary is\n * native (bun), where spawning it by name already works on every platform.\n */\nexport const MANAGERS: Record<\n Delegable,\n {\n bin: string;\n scriptSuffixes: readonly string[];\n /** Ships beside the running node, as npm does inside the Node distribution. */\n besideNode: boolean;\n args: (spec: string) => string[];\n manual: (spec: string) => string;\n }\n> = {\n npm: {\n bin: 'npm',\n scriptSuffixes: ['npm-cli.js'],\n besideNode: true,\n args: (spec) => ['install', '-g', '--ignore-scripts', spec],\n manual: (spec) => `npm i -g ${spec}`,\n },\n pnpm: {\n bin: 'pnpm',\n // corepack's shim resolves to `pnpm.js`, a standalone install to `pnpm.cjs`.\n scriptSuffixes: ['.cjs', '.js'],\n besideNode: false,\n args: (spec) => ['add', '-g', '--ignore-scripts', spec],\n manual: (spec) => `pnpm add -g ${spec}`,\n },\n bun: {\n bin: 'bun',\n scriptSuffixes: [],\n besideNode: false,\n // No --ignore-scripts: bun's flag surface for it is not stable across the\n // versions in the wild, and an unknown flag would fail the install outright.\n args: (spec) => ['add', '-g', spec],\n manual: (spec) => `bun add -g ${spec}`,\n },\n};\n\n/**\n * npm's own entry script, so the child can be `node npm-cli.js` rather than the\n * `npm` shim.\n *\n * On win32 the shim is `npm.cmd`, which Node refuses to spawn without\n * `shell: true`, and `shell: true` is exactly what this command must not do —\n * it would hand back the argv safety the pinned version buys.\n *\n * Deliberately NOT \"npm ships inside the Node distribution\". That is a property\n * of the installer, not of Node: Homebrew's plain `node` formula keeps only\n * corepack in the keg and puts npm at the brew prefix, so a probe relative to\n * `process.execPath` alone returns null on one of the most common macOS setups.\n * So the layout is searched, not assumed — beside the running binary first\n * (official tarball and installer, nvm, volta, versioned brew kegs), then off\n * PATH, where on POSIX the `npm` shim is itself a symlink to `npm-cli.js` and on\n * win32 `npm.cmd` has `node_modules` beside it. Still null when npm cannot be\n * found at all; the caller then falls back to the bare shim, which works\n * everywhere but win32 and fails closed there into UPDATE_FAILED carrying the\n * manual command.\n */\nexport function resolveNpmCli(\n execPath: string,\n env: NodeJS.ProcessEnv = process.env,\n): string | null {\n return resolveManagerScript('npm', execPath, env);\n}\n\n/**\n * The JS entry script for `manager`, or null when it has none to find (a native\n * binary, or a shim this cannot see through). Null means \"spawn the bare name\",\n * which works everywhere but win32 and fails closed there.\n */\nexport function resolveManagerScript(\n manager: Delegable,\n execPath: string,\n env: NodeJS.ProcessEnv = process.env,\n): string | null {\n const plan = MANAGERS[manager];\n if (plan.scriptSuffixes.length === 0) return null;\n const beside = plan.besideNode ? scriptNear(dirname(execPath), plan.bin) : null;\n return beside ?? scriptOnPath(plan.bin, plan.scriptSuffixes, env);\n}\n\n/** A manager's script relative to a directory holding `node` or its own shim. */\nfunction scriptNear(dir: string, bin: string): string | null {\n const candidates = [\n join(dir, 'node_modules', bin, 'bin', `${bin}-cli.js`),\n join(dir, '..', 'lib', 'node_modules', bin, 'bin', `${bin}-cli.js`),\n ];\n return candidates.find(isFile) ?? null;\n}\n\n/**\n * Walk PATH for the manager's shim and turn it into its script. Probes the\n * PATHEXT extensions on win32 for the same reason `onPath` in skill-wiring.ts\n * does: the real file there is `npm.cmd`, never a bare `npm`.\n */\nfunction scriptOnPath(\n bin: string,\n suffixes: readonly string[],\n env: NodeJS.ProcessEnv,\n): string | null {\n const exts =\n process.platform === 'win32'\n ? ['', ...(env.PATHEXT ?? '.EXE;.CMD;.BAT;.COM').split(';').filter((e) => e.length > 0)]\n : [''];\n for (const part of (env.PATH ?? '').split(delimiter)) {\n if (part.length === 0) continue;\n for (const ext of exts) {\n if (!isFile(join(part, `${bin}${ext}`))) continue;\n // POSIX package managers link the shim straight at the script, which is\n // what makes this layout-independent rather than a longer guess list.\n //\n // The endsWith is a CORRECTNESS check, not a security guard: it asks \"did\n // this symlink land on npm's script or on something else\", and a shim\n // pointed elsewhere returns null, which falls back to spawning that same\n // retargeted shim anyway. PATH poisoning is out of scope by construction —\n // an attacker ahead of npm on PATH owns every tool the user runs, and the\n // pre-existing fallback `spawn('npm', ...)` resolved through the same PATH.\n const real = realpathOrNull(join(part, `${bin}${ext}`));\n if (real !== null && suffixes.some((suffix) => real.endsWith(suffix))) return real;\n const near = scriptNear(part, bin);\n if (near !== null) return near;\n }\n }\n return null;\n}\n\nfunction isFile(p: string): boolean {\n try {\n return statSync(p).isFile();\n } catch {\n return false;\n }\n}\n\nfunction realpathOrNull(p: string): string | null {\n try {\n return realpathSync(p);\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,qBAAqB;;;ACF9B,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,WAAW,SAAS,MAAM,WAAW;AAkDvC,IAAM,WAA+B;AAAA,EAC1C;AAAA,IACE,MAAM;AAAA,IACN,OAAO,MACL,IAAI,SAAS,WAAW,gEAAgE;AAAA,MACtF,KAAK;AAAA,IACP,CAAC;AAAA,IACH,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,MAAM,CAAC,cAAc,UAAU,MAAM,GAAG,EAAE,SAAS,MAAM;AAAA,IACzD,OAAO,CAAC,SACN,IAAI,SAAS,WAAW,4DAA4D;AAAA;AAAA;AAAA,MAGlF,KAAK,8DAA8D,IAAI;AAAA,IACzE,CAAC;AAAA,IACH,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKE,MAAM,CAAC,cAAc,gBAAgB,SAAS,MAAM;AAAA,IACpD,OAAO,CAAC,SACN,IAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA,EAAE,KAAK,mBAAmB,IAAI,GAAG;AAAA,IACnC;AAAA,IACF,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKE,MAAM,CAAC,cAAc,gBAAgB,SAAS,MAAM,SAAS,CAAC,aAAa,SAAS;AAAA,IACpF,OAAO,CAAC,SACN,IAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK,yCAAy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,IACL,MAAM,KAAK,IAAI;AAAA,IACf,YAAY,CAAC,sBAAsB,OAAO,OAAO,MAAM,sCAAsC;AAAA,EAC/F;AACF;AAOO,IAAM,eAA4B,CAAC,KAAK,MAAM,MAAM,aACzD,IAAI,QAAQ,CAAC,QAAQ;AACnB,MAAI;AACJ,MAAI;AACF,YAAQ,MAAM,KAAK,MAAM,EAAE,OAAO,CAAC,UAAU,QAAQ,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC;AAAA,EAC/E,SAAS,OAAO;AAGd,QAAI,EAAE,MAAM,gBAAgB,MAAM,CAAC;AACnC;AAAA,EACF;AACA,MAAI,WAAW;AACf,QAAM,QAAQ,WAAW,MAAM;AAC7B,eAAW;AACX,UAAM,KAAK,SAAS;AAAA,EACtB,GAAG,KAAK,SAAS;AACjB,QAAM,QAAQ,GAAG,QAAQ,CAAC,UAAkB,SAAS,MAAM,SAAS,CAAC,CAAC;AACtE,QAAM,QAAQ,GAAG,QAAQ,CAAC,UAAkB,SAAS,MAAM,SAAS,CAAC,CAAC;AACtE,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,iBAAa,KAAK;AAClB,QAAI,EAAE,MAAM,gBAAgB,MAAM,CAAC;AAAA,EACrC,CAAC;AACD,QAAM,GAAG,SAAS,CAAC,SAAS;AAC1B,iBAAa,KAAK;AAClB,QAAI,WAAW,EAAE,MAAM,UAAU,IAAI,EAAE,MAAM,QAAQ,MAAM,QAAQ,EAAE,CAAC;AAAA,EACxE,CAAC;AACH,CAAC;","names":[]}
|
package/dist/usdc-4VCDHFWX.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
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,
|
|
9
|
-
USDC_ADDRESS,
|
|
10
|
-
USDC_DECIMALS,
|
|
11
|
-
broadcastUsdcSend,
|
|
12
|
-
getUsdcBalance,
|
|
13
|
-
prepareUsdcSend
|
|
14
|
-
} from "./chunk-MJZZTKCC.js";
|
|
15
|
-
import "./chunk-7FK2UN2T.js";
|
|
16
|
-
import "./chunk-M2O56UK7.js";
|
|
17
|
-
import "./chunk-UHTVXQ2O.js";
|
|
18
|
-
import "./chunk-W6R3HAAG.js";
|
|
19
|
-
import "./chunk-U5S527PP.js";
|
|
20
|
-
import "./chunk-47PP7TAG.js";
|
|
21
|
-
import "./chunk-XJN5WUKL.js";
|
|
22
|
-
import "./chunk-RBJPAZFI.js";
|
|
23
|
-
import "./chunk-KYQVEKP5.js";
|
|
24
|
-
import "./chunk-ZXTAQYNA.js";
|
|
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,
|
|
32
|
-
USDC_ADDRESS,
|
|
33
|
-
USDC_DECIMALS,
|
|
34
|
-
broadcastUsdcSend,
|
|
35
|
-
getUsdcBalance,
|
|
36
|
-
prepareUsdcSend
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=usdc-4VCDHFWX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/wallet-TQ7D5EQ7.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
commitLocalWallet,
|
|
4
|
-
createLocalSpendAuthorizer,
|
|
5
|
-
createLocalWallet,
|
|
6
|
-
describeWallet,
|
|
7
|
-
parkOutgoingWallet,
|
|
8
|
-
prepareLocalWallet,
|
|
9
|
-
resolveSpendAuthorizer,
|
|
10
|
-
resolveWalletProvider,
|
|
11
|
-
restoreParkedWallet,
|
|
12
|
-
verifyAndPreserveOutgoingWallet,
|
|
13
|
-
verifyLocalWallet
|
|
14
|
-
} from "./chunk-CPCX67TI.js";
|
|
15
|
-
import "./chunk-M2O56UK7.js";
|
|
16
|
-
import "./chunk-UHTVXQ2O.js";
|
|
17
|
-
import "./chunk-GHLVXVZD.js";
|
|
18
|
-
import "./chunk-OLWTRUTS.js";
|
|
19
|
-
import "./chunk-UO22YNY4.js";
|
|
20
|
-
import "./chunk-ZOBNS7CX.js";
|
|
21
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
22
|
-
import "./chunk-W6R3HAAG.js";
|
|
23
|
-
import "./chunk-47PP7TAG.js";
|
|
24
|
-
import "./chunk-XJN5WUKL.js";
|
|
25
|
-
import "./chunk-RBJPAZFI.js";
|
|
26
|
-
import "./chunk-KYQVEKP5.js";
|
|
27
|
-
import "./chunk-ZXTAQYNA.js";
|
|
28
|
-
export {
|
|
29
|
-
commitLocalWallet,
|
|
30
|
-
createLocalSpendAuthorizer,
|
|
31
|
-
createLocalWallet,
|
|
32
|
-
describeWallet,
|
|
33
|
-
parkOutgoingWallet,
|
|
34
|
-
prepareLocalWallet,
|
|
35
|
-
resolveSpendAuthorizer,
|
|
36
|
-
resolveWalletProvider,
|
|
37
|
-
restoreParkedWallet,
|
|
38
|
-
verifyAndPreserveOutgoingWallet,
|
|
39
|
-
verifyLocalWallet
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=wallet-TQ7D5EQ7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/wallet-ZAVXWLWP.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
runWalletBalance,
|
|
4
|
-
runWalletCreate,
|
|
5
|
-
runWalletShow
|
|
6
|
-
} from "./chunk-NIKXHWOL.js";
|
|
7
|
-
import "./chunk-MJZZTKCC.js";
|
|
8
|
-
import "./chunk-7FK2UN2T.js";
|
|
9
|
-
import "./chunk-CPCX67TI.js";
|
|
10
|
-
import "./chunk-M2O56UK7.js";
|
|
11
|
-
import "./chunk-UHTVXQ2O.js";
|
|
12
|
-
import "./chunk-GHLVXVZD.js";
|
|
13
|
-
import "./chunk-OLWTRUTS.js";
|
|
14
|
-
import "./chunk-EFWZPUTC.js";
|
|
15
|
-
import "./chunk-U6VPKMGC.js";
|
|
16
|
-
import "./chunk-UO22YNY4.js";
|
|
17
|
-
import "./chunk-2MYQN7HM.js";
|
|
18
|
-
import "./chunk-ZOBNS7CX.js";
|
|
19
|
-
import "./chunk-ZFJJ3EXC.js";
|
|
20
|
-
import "./chunk-W6R3HAAG.js";
|
|
21
|
-
import "./chunk-U5S527PP.js";
|
|
22
|
-
import "./chunk-47PP7TAG.js";
|
|
23
|
-
import "./chunk-XJN5WUKL.js";
|
|
24
|
-
import "./chunk-RBJPAZFI.js";
|
|
25
|
-
import "./chunk-KYQVEKP5.js";
|
|
26
|
-
import "./chunk-ZXTAQYNA.js";
|
|
27
|
-
export {
|
|
28
|
-
runWalletBalance,
|
|
29
|
-
runWalletCreate,
|
|
30
|
-
runWalletShow
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=wallet-ZAVXWLWP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|