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/install-GNK2W3PI.js
DELETED
|
@@ -1,972 +0,0 @@
|
|
|
1
|
-
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
runWalletCreate
|
|
4
|
-
} from "./chunk-NIKXHWOL.js";
|
|
5
|
-
import "./chunk-MJZZTKCC.js";
|
|
6
|
-
import "./chunk-7FK2UN2T.js";
|
|
7
|
-
import {
|
|
8
|
-
describeWallet,
|
|
9
|
-
resolveWalletProvider
|
|
10
|
-
} from "./chunk-CPCX67TI.js";
|
|
11
|
-
import "./chunk-M2O56UK7.js";
|
|
12
|
-
import "./chunk-UHTVXQ2O.js";
|
|
13
|
-
import {
|
|
14
|
-
collectDoctorChecks,
|
|
15
|
-
isNoWalletCheck
|
|
16
|
-
} from "./chunk-R7RSCBI7.js";
|
|
17
|
-
import "./chunk-HRGBS2PA.js";
|
|
18
|
-
import "./chunk-EDZSNPE5.js";
|
|
19
|
-
import "./chunk-5QQTYWEU.js";
|
|
20
|
-
import {
|
|
21
|
-
walletFileExists
|
|
22
|
-
} from "./chunk-GHLVXVZD.js";
|
|
23
|
-
import {
|
|
24
|
-
removeMarkerLines
|
|
25
|
-
} from "./chunk-B63XPWQ4.js";
|
|
26
|
-
import {
|
|
27
|
-
placeOptionalSkill
|
|
28
|
-
} from "./chunk-DHJD77OW.js";
|
|
29
|
-
import {
|
|
30
|
-
installSkill
|
|
31
|
-
} from "./chunk-QZ6ROAJU.js";
|
|
32
|
-
import {
|
|
33
|
-
sanitizeForTerminal
|
|
34
|
-
} from "./chunk-OLWTRUTS.js";
|
|
35
|
-
import {
|
|
36
|
-
confirmChoice,
|
|
37
|
-
intro,
|
|
38
|
-
outro,
|
|
39
|
-
persistAgentDispatchHookMode,
|
|
40
|
-
persistBazaarPay,
|
|
41
|
-
persistInstallHarness,
|
|
42
|
-
persistPublishMode,
|
|
43
|
-
persistWebSearchHookMode,
|
|
44
|
-
selectOne
|
|
45
|
-
} from "./chunk-H3SOOJ2I.js";
|
|
46
|
-
import {
|
|
47
|
-
PERMISSIONS_DOC_URL,
|
|
48
|
-
recommendedPermissions
|
|
49
|
-
} from "./chunk-4CQIDQOT.js";
|
|
50
|
-
import "./chunk-VYOJOX4Z.js";
|
|
51
|
-
import "./chunk-EFWZPUTC.js";
|
|
52
|
-
import {
|
|
53
|
-
CONFIG_DEFAULTS,
|
|
54
|
-
PublishModeSchema,
|
|
55
|
-
WebSearchModeSchema,
|
|
56
|
-
loadRawConfig,
|
|
57
|
-
parsePublishModeFlag,
|
|
58
|
-
parseWebSearchHookModeFlag
|
|
59
|
-
} from "./chunk-U6VPKMGC.js";
|
|
60
|
-
import "./chunk-UO22YNY4.js";
|
|
61
|
-
import {
|
|
62
|
-
FREE_VERB_RULES,
|
|
63
|
-
MODE_GATED_RULES,
|
|
64
|
-
hooksSkipped,
|
|
65
|
-
hooksUndo,
|
|
66
|
-
inspectFreeVerbRules,
|
|
67
|
-
permissionsSkipped,
|
|
68
|
-
planFreeVerbAllowlist,
|
|
69
|
-
resolveHermesHome,
|
|
70
|
-
resolveHermesHomeLenient,
|
|
71
|
-
retractModeGatedRules,
|
|
72
|
-
rulesForPublishMode,
|
|
73
|
-
wireFreeVerbAllowlist,
|
|
74
|
-
wireHermesIntegration,
|
|
75
|
-
wireSearchHooks
|
|
76
|
-
} from "./chunk-OKYSNAS3.js";
|
|
77
|
-
import "./chunk-A5DKHMUN.js";
|
|
78
|
-
import "./chunk-3GL2Z5QK.js";
|
|
79
|
-
import "./chunk-JBIKAAT3.js";
|
|
80
|
-
import {
|
|
81
|
-
CLI_SKILL_NAMES,
|
|
82
|
-
HARNESS_TARGETS,
|
|
83
|
-
HOSTED_SKILL_NAME,
|
|
84
|
-
OPTIONAL_PAY_SKILL,
|
|
85
|
-
PRODUCTION_HOST,
|
|
86
|
-
SKILL_NAMES,
|
|
87
|
-
harnessDetectedBy,
|
|
88
|
-
harnessTargetDir,
|
|
89
|
-
isModelInvocationDisabled,
|
|
90
|
-
onPath,
|
|
91
|
-
readSkillFile,
|
|
92
|
-
resolveSkillsSource
|
|
93
|
-
} from "./chunk-2MYQN7HM.js";
|
|
94
|
-
import {
|
|
95
|
-
ownsAnyLock,
|
|
96
|
-
releaseOwnedLocks
|
|
97
|
-
} from "./chunk-ZOBNS7CX.js";
|
|
98
|
-
import {
|
|
99
|
-
CliError,
|
|
100
|
-
external_exports,
|
|
101
|
-
hasCode,
|
|
102
|
-
walletPath
|
|
103
|
-
} from "./chunk-ZFJJ3EXC.js";
|
|
104
|
-
import "./chunk-W6R3HAAG.js";
|
|
105
|
-
import "./chunk-U5S527PP.js";
|
|
106
|
-
import "./chunk-47PP7TAG.js";
|
|
107
|
-
import "./chunk-XJN5WUKL.js";
|
|
108
|
-
import "./chunk-RBJPAZFI.js";
|
|
109
|
-
import "./chunk-KYQVEKP5.js";
|
|
110
|
-
import "./chunk-ZXTAQYNA.js";
|
|
111
|
-
|
|
112
|
-
// src/commands/install.ts
|
|
113
|
-
import { existsSync } from "fs";
|
|
114
|
-
import { readFile } from "fs/promises";
|
|
115
|
-
import { fileURLToPath } from "url";
|
|
116
|
-
import { dirname, isAbsolute, join } from "path";
|
|
117
|
-
import { homedir } from "os";
|
|
118
|
-
import { styleText } from "util";
|
|
119
|
-
import { Stream } from "stream";
|
|
120
|
-
var HARNESSES = HARNESS_TARGETS;
|
|
121
|
-
var InstallInputSchema = external_exports.object({
|
|
122
|
-
harness: external_exports.array(external_exports.string()).optional(),
|
|
123
|
-
dryRun: external_exports.boolean().optional(),
|
|
124
|
-
publishMode: external_exports.string().optional(),
|
|
125
|
-
noWallet: external_exports.boolean().optional(),
|
|
126
|
-
/**
|
|
127
|
-
* ACCEPTED AND IGNORED. `install` writes no CLAUDE.md/AGENTS.md line any more —
|
|
128
|
-
* a skill's own frontmatter description is the trigger surface the harness reads
|
|
129
|
-
* at session start, so the line only duplicated it. Both spellings still parse so
|
|
130
|
-
* a script or a released doc that passes one does not fail; neither does anything.
|
|
131
|
-
*/
|
|
132
|
-
claudeMd: external_exports.boolean().optional(),
|
|
133
|
-
/**
|
|
134
|
-
* Tri-state. `true` (`--allow-free-verbs`) wires the free-verb
|
|
135
|
-
* allowlist without asking, which is now also what an unanswered non-interactive
|
|
136
|
-
* run does, so the flag is kept for compatibility and as an explicit statement of
|
|
137
|
-
* intent. `false` (`--no-allow-free-verbs`) is the opt-out and is the only way to
|
|
138
|
-
* get a run that writes no permission rule. `undefined` asks when it can, and
|
|
139
|
-
* writes when it cannot ask.
|
|
140
|
-
*/
|
|
141
|
-
allowFreeVerbs: external_exports.boolean().optional(),
|
|
142
|
-
/** The harness search-hook behavior to install (`--search-hooks auto|remind|off`). */
|
|
143
|
-
searchHooks: external_exports.string().optional(),
|
|
144
|
-
/**
|
|
145
|
-
* `--no-hooks`: register no hooks THIS RUN, changing nothing persistent. It is
|
|
146
|
-
* deliberately not the same as `--search-hooks off`, which is a durable
|
|
147
|
-
* statement about behavior and writes `hooks.webSearch: off` (and
|
|
148
|
-
* `hooks.agentDispatch: off`) to config.
|
|
149
|
-
*/
|
|
150
|
-
noHooks: external_exports.boolean().optional()
|
|
151
|
-
});
|
|
152
|
-
function walletFix(reason) {
|
|
153
|
-
switch (reason) {
|
|
154
|
-
case "no-passphrase-store":
|
|
155
|
-
return "No OS credential store is available to hold the wallet passphrase. Set TENJIN_WALLET_PASSPHRASE and re-run `tenjin install`, or run `tenjin wallet create` in a terminal to enter one.";
|
|
156
|
-
case "create-failed":
|
|
157
|
-
return "Fix the reported problem, then run `tenjin wallet create`.";
|
|
158
|
-
case "dry-run":
|
|
159
|
-
case "flag":
|
|
160
|
-
return "Create one with `tenjin wallet create`.";
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
var CODEX_NETWORK_RULE = "[sandbox_workspace_write]\nnetwork_access = true";
|
|
164
|
-
async function runInstall(input, ctx, deps = {}) {
|
|
165
|
-
return withInterruptGuard((markPhase) => installBody(input, ctx, deps, markPhase));
|
|
166
|
-
}
|
|
167
|
-
async function withInterruptGuard(fn) {
|
|
168
|
-
let phase;
|
|
169
|
-
const onSignal = (signal) => {
|
|
170
|
-
const wasWriting = ownsAnyLock() || phase === "writing-skills";
|
|
171
|
-
releaseOwnedLocks();
|
|
172
|
-
if (process.stdin.isTTY) process.stdin.setRawMode?.(false);
|
|
173
|
-
if (process.stdout.isTTY) process.stdout.write("\x1B[?25h");
|
|
174
|
-
process.stderr.write(
|
|
175
|
-
wasWriting ? `
|
|
176
|
-
Interrupted mid-write. Some files may be half-written; re-run \`tenjin install\` to finish.
|
|
177
|
-
` : phase === "wired" ? `
|
|
178
|
-
Interrupted after the skills were written; later setup steps may not have finished. Re-run \`tenjin install\` to finish.
|
|
179
|
-
` : "\nInterrupted before anything was written; nothing changed.\n"
|
|
180
|
-
);
|
|
181
|
-
process.exit(signal === "SIGINT" ? 130 : 143);
|
|
182
|
-
};
|
|
183
|
-
process.on("SIGINT", onSignal);
|
|
184
|
-
process.on("SIGTERM", onSignal);
|
|
185
|
-
try {
|
|
186
|
-
return await fn((p) => {
|
|
187
|
-
phase = p;
|
|
188
|
-
});
|
|
189
|
-
} finally {
|
|
190
|
-
process.off("SIGINT", onSignal);
|
|
191
|
-
process.off("SIGTERM", onSignal);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function installBody(input, ctx, deps, markPhase) {
|
|
195
|
-
const parsed = InstallInputSchema.safeParse(input);
|
|
196
|
-
if (!parsed.success) {
|
|
197
|
-
throw new CliError("USAGE", "Invalid install options", {
|
|
198
|
-
fix: "Run `tenjin install --help`.",
|
|
199
|
-
details: parsed.error.issues
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
const dryRun = parsed.data.dryRun === true;
|
|
203
|
-
const noWallet = parsed.data.noWallet === true;
|
|
204
|
-
const noHooks = parsed.data.noHooks === true;
|
|
205
|
-
const allowFreeVerbs = parsed.data.allowFreeVerbs;
|
|
206
|
-
const publishModeFlag = parsed.data.publishMode !== void 0 ? parseModeFlag(parsed.data.publishMode) : void 0;
|
|
207
|
-
const searchHooksFlag = parsed.data.searchHooks !== void 0 ? parseWebSearchHookModeFlag(parsed.data.searchHooks, "--search-hooks") : void 0;
|
|
208
|
-
const env = deps.env ?? process.env;
|
|
209
|
-
const home = deps.homeDir ?? homedir();
|
|
210
|
-
if (!isAbsolute(home)) {
|
|
211
|
-
throw new CliError(
|
|
212
|
-
"INTERNAL",
|
|
213
|
-
"The home directory did not resolve to an absolute path, so nothing was installed.",
|
|
214
|
-
{
|
|
215
|
-
fix: "Set HOME to your home directory (`export HOME=...`), then re-run `tenjin install`."
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
const which = deps.which ?? ((bin) => onPath(bin, env));
|
|
220
|
-
const targetsHermes = parsed.data.harness?.includes("hermes") === true;
|
|
221
|
-
const hermesTarget = targetsHermes ? { home: resolveHermesHome(home, env), warning: void 0 } : resolveHermesHomeLenient(home, env);
|
|
222
|
-
const hermesHome = hermesTarget.home;
|
|
223
|
-
const humanOutput = ctx.flags.json === true ? false : deps.isInteractive ?? ctx.io.isTTY;
|
|
224
|
-
const canPrompt = humanOutput && (deps.isInteractive ?? Boolean(process.stdin.isTTY));
|
|
225
|
-
const skillsSource = deps.skillsSourceDir ?? resolveSkillsSource(fileURLToPath(new URL(".", import.meta.url)));
|
|
226
|
-
await assertSkillsSource(skillsSource);
|
|
227
|
-
const plans = resolvePlans(parsed.data.harness, home, hermesHome, which);
|
|
228
|
-
const explicitHarness = parsed.data.harness !== void 0 && parsed.data.harness.length > 0;
|
|
229
|
-
const harnesses = [];
|
|
230
|
-
const rawConfig = await loadRawConfig(ctx.dataDir);
|
|
231
|
-
if (!dryRun) markPhase("writing-skills");
|
|
232
|
-
for (const plan of plans) {
|
|
233
|
-
harnesses.push(await applyPlan(plan, skillsSource, dryRun));
|
|
234
|
-
}
|
|
235
|
-
await assertSkillsLanded(plans, dryRun);
|
|
236
|
-
if (!dryRun) markPhase("wired");
|
|
237
|
-
if (explicitHarness && !dryRun) {
|
|
238
|
-
await underDataDir(
|
|
239
|
-
ctx.dataDir,
|
|
240
|
-
() => persistInstallHarness(
|
|
241
|
-
ctx.dataDir,
|
|
242
|
-
plans.map((p) => p.harness)
|
|
243
|
-
)
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
const pointerCleanup = dryRun ? [] : await removeMarkerLines(home);
|
|
247
|
-
if (canPrompt) await (deps.intro ?? intro)("tenjin install");
|
|
248
|
-
const publishMode = await underDataDir(
|
|
249
|
-
ctx.dataDir,
|
|
250
|
-
() => resolvePublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt)
|
|
251
|
-
);
|
|
252
|
-
const permissions = await resolvePermissions({
|
|
253
|
-
plans,
|
|
254
|
-
home,
|
|
255
|
-
deps,
|
|
256
|
-
flag: allowFreeVerbs,
|
|
257
|
-
dryRun,
|
|
258
|
-
canPrompt,
|
|
259
|
-
publishMode: publishMode.value
|
|
260
|
-
});
|
|
261
|
-
const hooks = await underDataDir(
|
|
262
|
-
ctx.dataDir,
|
|
263
|
-
() => resolveHooks({ plans, home, ctx, deps, flag: searchHooksFlag, noHooks, dryRun, canPrompt })
|
|
264
|
-
);
|
|
265
|
-
const hermesResult = harnesses.find((result) => result.harness === "hermes");
|
|
266
|
-
if (hermesResult !== void 0) {
|
|
267
|
-
const tenjinCommand = deps.tenjinCommand ?? process.argv[1];
|
|
268
|
-
const nodeCommand = deps.nodeCommand ?? process.execPath;
|
|
269
|
-
if (tenjinCommand === void 0 || !isAbsolute(tenjinCommand) || !isAbsolute(nodeCommand)) {
|
|
270
|
-
throw new CliError(
|
|
271
|
-
"INTERNAL",
|
|
272
|
-
"Hermes integration requires absolute Tenjin and Node executable paths.",
|
|
273
|
-
{ fix: "Run `tenjin install --harness hermes` through the installed Tenjin CLI." }
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
hermesResult.hermes = await wireHermesIntegration({
|
|
277
|
-
hermesHome,
|
|
278
|
-
dataDir: ctx.dataDir,
|
|
279
|
-
tenjinCommand,
|
|
280
|
-
nodeCommand,
|
|
281
|
-
dryRun,
|
|
282
|
-
// Activation consent: the operator named Hermes on the command line.
|
|
283
|
-
explicit: explicitHarness && targetsHermes,
|
|
284
|
-
// Write consent, read off the SAME hooks decision that gates Claude's
|
|
285
|
-
// settings.json, because `--no-hooks` promises "writes no config" in the
|
|
286
|
-
// README and that promise cannot hold on only one of the two harnesses.
|
|
287
|
-
hooks: { enabled: hermesHooksEnabled(hooks), fix: hooks.fix, mode: hooks.mode }
|
|
288
|
-
});
|
|
289
|
-
for (const part of [
|
|
290
|
-
hermesResult.hermes.mcp,
|
|
291
|
-
hermesResult.hermes.plugin,
|
|
292
|
-
hermesResult.hermes.activation
|
|
293
|
-
]) {
|
|
294
|
-
if (part.warning !== void 0) hermesResult.warnings.push(part.warning);
|
|
295
|
-
}
|
|
296
|
-
if (hermesTarget.warning !== void 0) hermesResult.warnings.push(hermesTarget.warning);
|
|
297
|
-
}
|
|
298
|
-
const wallet = await underDataDir(
|
|
299
|
-
ctx.dataDir,
|
|
300
|
-
() => resolveWallet(ctx, deps, walletSkip(dryRun, noWallet), canPrompt)
|
|
301
|
-
);
|
|
302
|
-
const bazaarPay = await underDataDir(
|
|
303
|
-
ctx.dataDir,
|
|
304
|
-
() => resolveBazaarPay(ctx, deps, dryRun, canPrompt, rawConfig.bazaarPay)
|
|
305
|
-
);
|
|
306
|
-
if (!dryRun) {
|
|
307
|
-
for (const plan of plans) {
|
|
308
|
-
try {
|
|
309
|
-
await placeOptionalSkill(
|
|
310
|
-
OPTIONAL_PAY_SKILL,
|
|
311
|
-
plan.skillsDir,
|
|
312
|
-
skillsSource,
|
|
313
|
-
bazaarPay.enabled
|
|
314
|
-
);
|
|
315
|
-
} catch {
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
const doctorDeps = { ...deps.doctorDeps ?? {} };
|
|
320
|
-
doctorDeps.homeDir ??= home;
|
|
321
|
-
doctorDeps.which ??= which;
|
|
322
|
-
const collect = deps.collectChecks ?? ((c) => collectDoctorChecks(c, doctorDeps));
|
|
323
|
-
const doctor = await collect(ctx);
|
|
324
|
-
if (canPrompt) await (deps.outro ?? outro)("Setup complete.");
|
|
325
|
-
const data = {
|
|
326
|
-
dryRun,
|
|
327
|
-
skillsSource,
|
|
328
|
-
harnesses,
|
|
329
|
-
// One-time cleanup, reported because it edits a file the operator owns. Older
|
|
330
|
-
// versions wrote a pointer line into CLAUDE.md/AGENTS.md; nothing writes one
|
|
331
|
-
// now, so an install that finds one removes it and says which file it touched.
|
|
332
|
-
pointerCleanup,
|
|
333
|
-
doctor: { status: doctor.failure !== void 0 ? "fail" : "pass", checks: doctor.checks },
|
|
334
|
-
publishMode,
|
|
335
|
-
bazaarPay,
|
|
336
|
-
// Shipped with the install rather than left for the operator to discover after
|
|
337
|
-
// their first auto-mode denial (#33). Static constants, no config key: see
|
|
338
|
-
// lib/permissions.ts for why this is deliberately not operator-editable state.
|
|
339
|
-
// `wired` is the outcome of THIS run's settings.json write; the three
|
|
340
|
-
// recommendation tiers beside it are unchanged, so a machine consumer that
|
|
341
|
-
// read `alwaysSafe` / `optIn` / `neverAllowlisted` before still does.
|
|
342
|
-
permissions: { ...recommendedPermissions(publishMode.value), wired: permissions },
|
|
343
|
-
hooks,
|
|
344
|
-
wallet
|
|
345
|
-
};
|
|
346
|
-
if (!humanOutput) return { data };
|
|
347
|
-
const humanLines = buildWalkthrough(ctx.io, {
|
|
348
|
-
pointerCleanup,
|
|
349
|
-
dryRun,
|
|
350
|
-
dataDir: ctx.dataDir,
|
|
351
|
-
harnesses,
|
|
352
|
-
publishMode,
|
|
353
|
-
permissions,
|
|
354
|
-
hooks,
|
|
355
|
-
wallet,
|
|
356
|
-
doctor
|
|
357
|
-
});
|
|
358
|
-
return { data, humanLines };
|
|
359
|
-
}
|
|
360
|
-
function walletSkip(dryRun, noWallet) {
|
|
361
|
-
if (dryRun) return "dry-run";
|
|
362
|
-
if (noWallet) return "flag";
|
|
363
|
-
return void 0;
|
|
364
|
-
}
|
|
365
|
-
async function underDataDir(dataDir, fn) {
|
|
366
|
-
try {
|
|
367
|
-
return await fn();
|
|
368
|
-
} catch (err) {
|
|
369
|
-
if (!hasCode(err, "EACCES") && !hasCode(err, "EPERM")) throw err;
|
|
370
|
-
throw new CliError("INTERNAL", `Could not use the Tenjin data directory ${dataDir}.`, {
|
|
371
|
-
fix: `Permission denied. Check that you can write to it (\`ls -ld ${dataDir}\`), then re-run \`tenjin install\`.`,
|
|
372
|
-
cause: err
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
var EXAMPLE_QUESTION = "what actually changed in <library> v3's public API";
|
|
377
|
-
function buildWalkthrough(io, s) {
|
|
378
|
-
const lines = [];
|
|
379
|
-
if (s.dryRun) {
|
|
380
|
-
lines.push(paint(io, "yellow", "Dry run: nothing was written."));
|
|
381
|
-
lines.push("");
|
|
382
|
-
}
|
|
383
|
-
lines.push(...summaryLines(io, s));
|
|
384
|
-
const notices = noticeLines(io, s);
|
|
385
|
-
if (notices.length > 0) lines.push("", ...notices);
|
|
386
|
-
return lines;
|
|
387
|
-
}
|
|
388
|
-
function noticeLines(io, s) {
|
|
389
|
-
const lines = [];
|
|
390
|
-
for (const h of s.harnesses) {
|
|
391
|
-
if (h.hostedArrivedFirst) {
|
|
392
|
-
lines.push(
|
|
393
|
-
paint(
|
|
394
|
-
io,
|
|
395
|
-
"dim",
|
|
396
|
-
`The hosted ${HOSTED_SKILL_NAME} skill was already in ${h.skillsDir}: kept as the zero-install fallback, and the CLI skills now take precedence.`
|
|
397
|
-
)
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
if (h.codexNetworkRule !== void 0) {
|
|
401
|
-
lines.push(paint(io, "dim", "Codex blocks network by default; add to ~/.codex/config.toml:"));
|
|
402
|
-
for (const rl of h.codexNetworkRule.split("\n")) lines.push(paint(io, "dim", ` ${rl}`));
|
|
403
|
-
}
|
|
404
|
-
for (const w of h.warnings) lines.push(paint(io, "yellow", `! ${w}`));
|
|
405
|
-
}
|
|
406
|
-
if (s.pointerCleanup.length > 0) {
|
|
407
|
-
lines.push(
|
|
408
|
-
`Removed the old Tenjin pointer line from ${s.pointerCleanup.join(" and ")}; the skills carry their own triggers now.`
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
const stale = s.permissions.removed.filter((r) => !MODE_GATED_RULES.includes(r));
|
|
412
|
-
if (stale.length > 0) {
|
|
413
|
-
lines.push(
|
|
414
|
-
`Removed ${stale.length} permission rule(s) an older tenjin left in ${s.permissions.path ?? "your settings"} for commands that no longer exist.`
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
if (s.permissions.planned !== true && s.permissions.added.length > 0) {
|
|
418
|
-
lines.push(paint(io, "dim", `Undo anytime: remove those lines from ${s.permissions.path}.`));
|
|
419
|
-
}
|
|
420
|
-
if (s.hooks.added.length > 0 || s.hooks.updated.length > 0) {
|
|
421
|
-
lines.push(paint(io, "dim", hooksDisclosure(s.hooks)));
|
|
422
|
-
lines.push(
|
|
423
|
-
paint(io, "dim", hooksUndo(s.hooks.path ?? "~/.claude/settings.json", s.hooks.scriptsDir))
|
|
424
|
-
);
|
|
425
|
-
lines.push(
|
|
426
|
-
`${paint(io, "bold", "Restart Claude Code")} to load them; hooks are read once at session start.`
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
if (s.hooks.warning !== void 0) {
|
|
430
|
-
lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.hooks.warning)}`));
|
|
431
|
-
}
|
|
432
|
-
for (const line of walletDisclosure(s.wallet, s.dataDir)) lines.push(paint(io, "dim", line));
|
|
433
|
-
if (s.wallet.warning !== void 0) {
|
|
434
|
-
lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.wallet.warning)}`));
|
|
435
|
-
}
|
|
436
|
-
if (s.permissions.warning !== void 0) {
|
|
437
|
-
lines.push(paint(io, "yellow", `! ${sanitizeForTerminal(s.permissions.warning)}`));
|
|
438
|
-
}
|
|
439
|
-
lines.push(...doctorNotices(io, s.doctor, s.wallet));
|
|
440
|
-
return lines;
|
|
441
|
-
}
|
|
442
|
-
function summaryLines(io, s) {
|
|
443
|
-
return [
|
|
444
|
-
...s.harnesses.map((h) => skillsLine(io, h, s.dryRun)),
|
|
445
|
-
publishingLine(io, s.publishMode.value, s.permissions),
|
|
446
|
-
permissionsLine(io, s.permissions),
|
|
447
|
-
hooksLine(io, s.hooks),
|
|
448
|
-
walletLine(io, s.wallet),
|
|
449
|
-
`${paint(io, "bold", "Next:")} tenjin search "${EXAMPLE_QUESTION}"`
|
|
450
|
-
];
|
|
451
|
-
}
|
|
452
|
-
function hooksDisclosure(h) {
|
|
453
|
-
const shared = "A Stop hook reminds you locally when a MISS you searched for is still unpublished, and a SessionStart hook prints one paragraph on when to search first; neither makes a network call.";
|
|
454
|
-
if (h.mode === "remind") {
|
|
455
|
-
return `The WebSearch and dispatch hooks print a one-line reminder that Tenjin may have an answer; they send nothing off-machine. ${shared}`;
|
|
456
|
-
}
|
|
457
|
-
return `Before a web search or a subagent dispatch, the hooks ask ${PRODUCTION_HOST} the same question (free and anonymous, ~2s budget, 5s harness kill) and mention a tested answer if one exists; the query text, or at most 400 characters of the subagent prompt, leaves the machine. They can never block or change the tool call. ${shared}`;
|
|
458
|
-
}
|
|
459
|
-
function hooksLine(io, h) {
|
|
460
|
-
const label = paint(io, "bold", "Search hooks:");
|
|
461
|
-
const wrote = h.added.length + h.updated.length;
|
|
462
|
-
if (wrote > 0) {
|
|
463
|
-
return `${paint(io, "green", "\u2713")} ${label} ${h.mode} mode, ${wrote} hook event(s) registered in ${h.path}. Change: tenjin config set hooks.webSearch <auto|remind|off> (or hooks.agentDispatch)`;
|
|
464
|
-
}
|
|
465
|
-
if (h.skipped === void 0) {
|
|
466
|
-
return `${paint(io, "green", "\u2713")} ${label} ${h.mode} mode, already registered in ${h.path}`;
|
|
467
|
-
}
|
|
468
|
-
if (h.skipped === "harness-not-claude") {
|
|
469
|
-
return `${paint(io, "dim", "-")} ${label} not wired (Claude Code only).`;
|
|
470
|
-
}
|
|
471
|
-
if (h.skipped === "native-harness") {
|
|
472
|
-
return `${paint(io, "green", "\u2713")} ${label} ${h.mode} mode through the native Hermes plugin. Change: tenjin config set hooks.webSearch <auto|remind|off> (or hooks.agentDispatch)`;
|
|
473
|
-
}
|
|
474
|
-
if (h.skipped === "dry-run") {
|
|
475
|
-
return `${paint(io, "dim", "-")} ${label} unchanged (dry run).`;
|
|
476
|
-
}
|
|
477
|
-
if (h.skipped === "mode-off") {
|
|
478
|
-
return `${paint(io, "dim", "-")} ${label} off (hooks.webSearch). Turn them on: tenjin config set hooks.webSearch auto, then tenjin install`;
|
|
479
|
-
}
|
|
480
|
-
if (h.skipped === "declined") {
|
|
481
|
-
return `${paint(io, "dim", "-")} ${label} not registered this run; nothing was configured. Register them: tenjin install`;
|
|
482
|
-
}
|
|
483
|
-
if (h.skipped === "changed-since-read") {
|
|
484
|
-
return `${paint(io, "yellow", "!")} ${label} ${h.path} changed while it was being updated, so nothing was written. Re-run: tenjin install`;
|
|
485
|
-
}
|
|
486
|
-
return `${paint(io, "yellow", "!")} ${label} ${h.path} was left untouched. Fix it, then: tenjin install`;
|
|
487
|
-
}
|
|
488
|
-
function harnessLabel(h) {
|
|
489
|
-
return h === "claude" ? "Claude Code" : h === "codex" ? "Codex" : h === "hermes" ? "Hermes" : "Agent Skills";
|
|
490
|
-
}
|
|
491
|
-
function skillsLine(io, h, dryRun) {
|
|
492
|
-
const changed = h.skills.some((s) => s.status !== "up-to-date");
|
|
493
|
-
const verb = dryRun ? "would install" : changed ? "installed" : "up to date";
|
|
494
|
-
const head = `${harnessLabel(h.harness)}: ${h.skills.length} skills ${verb}`;
|
|
495
|
-
return `${paint(io, "green", "\u2713")} ${paint(io, "bold", head)} in ${h.skillsDir}. ${skillRoster(h)}.`;
|
|
496
|
-
}
|
|
497
|
-
function publishingLine(io, mode, wired) {
|
|
498
|
-
const undo = wired.modeGrant === void 0 ? "" : ` ${paint(io, "dim", wired.planned === true ? "Would turn off:" : "Turn off:")} tenjin config set publish.mode review`;
|
|
499
|
-
return `${paint(io, "green", "\u2713")} ${paint(io, "bold", `Publishing: ${mode}`)}. ${modeBlurb(mode)}${undo}`;
|
|
500
|
-
}
|
|
501
|
-
function permissionsLine(io, p) {
|
|
502
|
-
const label = paint(io, "bold", "Permissions:");
|
|
503
|
-
const allowed = p.added.length + p.alreadyPresent.length;
|
|
504
|
-
const retracted = p.removed.filter((r) => MODE_GATED_RULES.includes(r));
|
|
505
|
-
const gaveBack = retracted.length === 0 ? "" : p.planned === true ? ` A real run would remove ${retracted.length} rule(s) for publish and edit from ${p.path ?? "your settings"}.` : ` Publishing is back to asking first, so ${retracted.length} rule(s) for publish and edit were removed from ${p.path ?? "your settings"}.`;
|
|
506
|
-
const unchanged = retracted.length === 0 || p.planned === true ? "unchanged" : "otherwise unchanged";
|
|
507
|
-
if (p.planned === true && p.added.length > 0) {
|
|
508
|
-
return `${paint(io, "dim", "-")} ${label} would allow ${allowed} tenjin commands in ${p.path}. Details: ${PERMISSIONS_DOC_URL}`;
|
|
509
|
-
}
|
|
510
|
-
if (p.added.length > 0) {
|
|
511
|
-
return `${paint(io, "green", "\u2713")} ${label} ${allowed} tenjin commands allowed in ${p.path}.${gaveBack} Details: ${PERMISSIONS_DOC_URL}`;
|
|
512
|
-
}
|
|
513
|
-
if (p.skipped === void 0) {
|
|
514
|
-
return `${paint(io, "green", "\u2713")} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}.${gaveBack}`;
|
|
515
|
-
}
|
|
516
|
-
if (p.skipped === "harness-not-claude") {
|
|
517
|
-
return `${paint(io, "dim", "-")} ${label} not wired for this harness (Claude Code only).${gaveBack} The lines your harness needs: ${PERMISSIONS_DOC_URL}`;
|
|
518
|
-
}
|
|
519
|
-
if (p.skipped === "dry-run") {
|
|
520
|
-
return `${paint(io, "dim", "-")} ${label} ${unchanged} (dry run); the ${FREE_VERB_RULES.length} rules a real run needs are already there.${gaveBack}`;
|
|
521
|
-
}
|
|
522
|
-
if (p.skipped === "declined" || p.skipped === "not-requested") {
|
|
523
|
-
return `${paint(io, "dim", "-")} ${label} ${unchanged}.${gaveBack} Allow the ${FREE_VERB_RULES.length} free tenjin commands with: tenjin install --allow-free-verbs`;
|
|
524
|
-
}
|
|
525
|
-
if (p.skipped === "changed-since-read") {
|
|
526
|
-
return `${paint(io, "yellow", "!")} ${label} ${p.path} changed while it was being updated, so nothing was written.${gaveBack} Re-run: tenjin install`;
|
|
527
|
-
}
|
|
528
|
-
return `${paint(io, "yellow", "!")} ${label} ${p.path} was left untouched.${gaveBack} Fix it, then: tenjin install --allow-free-verbs`;
|
|
529
|
-
}
|
|
530
|
-
function walletLine(io, w) {
|
|
531
|
-
const label = paint(io, "bold", "Wallet:");
|
|
532
|
-
if (w.status === "existing") {
|
|
533
|
-
return `${paint(io, "green", "\u2713")} ${label} ${w.address} (existing). Check funds with: tenjin wallet balance`;
|
|
534
|
-
}
|
|
535
|
-
if (w.status === "created") {
|
|
536
|
-
return `${paint(io, "green", "\u2713")} ${label} ${w.address}, holding $0. Fund it with a few dollars of USDC on Base, then: tenjin wallet balance`;
|
|
537
|
-
}
|
|
538
|
-
if (w.status === "skipped") {
|
|
539
|
-
const icon = w.reason === "no-passphrase-store" || w.reason === "create-failed" ? "!" : "-";
|
|
540
|
-
const color = icon === "!" ? "yellow" : "dim";
|
|
541
|
-
return `${paint(io, color, icon)} ${label} none (${w.reason}). ${w.fix}`;
|
|
542
|
-
}
|
|
543
|
-
return `${paint(io, "dim", "-")} ${label} none. Create one later with: tenjin wallet create`;
|
|
544
|
-
}
|
|
545
|
-
function walletDisclosure(w, dataDir) {
|
|
546
|
-
if (w.status !== "created") return [];
|
|
547
|
-
return [
|
|
548
|
-
`A wallet was created at ${walletPath(dataDir)}: the key is encrypted at rest (keystore v3, scrypt, mode 0600) and never leaves this machine.`,
|
|
549
|
-
"It holds $0. Funding it is a human step: run `tenjin fund` (card checkout via Coinbase, opened in your browser), or send USDC on Base to that address."
|
|
550
|
-
];
|
|
551
|
-
}
|
|
552
|
-
function skillRoster(h) {
|
|
553
|
-
const cli = h.skills.filter((s) => s.cli).map((s) => s.name);
|
|
554
|
-
const hosted = h.skills.filter((s) => !s.cli).map((s) => s.name);
|
|
555
|
-
const parts = [];
|
|
556
|
-
if (cli.length > 0) parts.push(`${cli.join(", ")} (CLI)`);
|
|
557
|
-
if (hosted.length > 0) parts.push(`${hosted.join(", ")} (hosted, zero-install fallback)`);
|
|
558
|
-
return parts.join("; ");
|
|
559
|
-
}
|
|
560
|
-
function modeBlurb(v) {
|
|
561
|
-
return v === "auto" ? "Your agent publishes and updates pieces on its own, under your identity." : v === "review" ? "Your agent asks you in chat before every publish." : "Your agent publishes on its own, under your identity, and only a hard block stops it.";
|
|
562
|
-
}
|
|
563
|
-
async function resolveWallet(ctx, deps, skipReason, canPrompt) {
|
|
564
|
-
const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);
|
|
565
|
-
if (exists) {
|
|
566
|
-
return {
|
|
567
|
-
status: "existing",
|
|
568
|
-
address: await (deps.walletAddress ?? existingWalletAddress)(ctx)
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
if (skipReason !== void 0) {
|
|
572
|
-
return { status: "skipped", reason: skipReason, fix: walletFix(skipReason) };
|
|
573
|
-
}
|
|
574
|
-
if (canPrompt) {
|
|
575
|
-
const confirm = deps.confirmWallet ?? defaultConfirm;
|
|
576
|
-
if (!await confirm(WALLET_QUESTION)) return { status: "declined" };
|
|
577
|
-
}
|
|
578
|
-
try {
|
|
579
|
-
const create = deps.createWallet ?? ((c) => defaultCreateWallet(c, deps.walletPassphrase, deps.env));
|
|
580
|
-
return { status: "created", address: await create(ctx) };
|
|
581
|
-
} catch (err) {
|
|
582
|
-
const reason = isNoPassphraseError(err) ? "no-passphrase-store" : "create-failed";
|
|
583
|
-
return {
|
|
584
|
-
status: "skipped",
|
|
585
|
-
reason,
|
|
586
|
-
fix: walletFix(reason),
|
|
587
|
-
...reason === "create-failed" ? { warning: `The wallet could not be created: ${errorText(err)}` } : {}
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
function isNoPassphraseError(err) {
|
|
592
|
-
return err instanceof CliError && err.code === "USAGE" && err.message.includes("No wallet passphrase is available");
|
|
593
|
-
}
|
|
594
|
-
function errorText(err) {
|
|
595
|
-
return err instanceof Error ? err.message : String(err);
|
|
596
|
-
}
|
|
597
|
-
async function existingWalletAddress(ctx) {
|
|
598
|
-
return (await describeWallet(resolveWalletProvider(ctx))).address;
|
|
599
|
-
}
|
|
600
|
-
async function defaultCreateWallet(ctx, passphrase, env) {
|
|
601
|
-
const result = await runWalletCreate(ctx, {
|
|
602
|
-
...passphrase !== void 0 ? { passphrase } : {},
|
|
603
|
-
...env !== void 0 ? { env } : {}
|
|
604
|
-
});
|
|
605
|
-
return result.data.address;
|
|
606
|
-
}
|
|
607
|
-
function defaultConfirm(label) {
|
|
608
|
-
return confirmChoice(label, true);
|
|
609
|
-
}
|
|
610
|
-
var BAZAAR_QUESTION = "Enable the Bazaar pay lane? x402 lets this wallet pay HTTP endpoints that answer with a priced 402, and the Bazaar (https://docs.cdp.coinbase.com/x402/bazaar) is the public catalog of them. When on, `tenjin pay` may pay Bazaar-listed non-Tenjin endpoints under your spend policy. More: https://x402.org";
|
|
611
|
-
async function resolveBazaarPay(ctx, deps, dryRun, canPrompt, existing) {
|
|
612
|
-
if (existing !== void 0) return { enabled: existing, status: "kept" };
|
|
613
|
-
if (dryRun || !canPrompt) return { enabled: false, status: "not-asked" };
|
|
614
|
-
const confirm = deps.confirmBazaarPay ?? ((label) => confirmChoice(label, false));
|
|
615
|
-
const yes = await confirm(BAZAAR_QUESTION);
|
|
616
|
-
await persistBazaarPay(ctx.dataDir, yes);
|
|
617
|
-
return { enabled: yes, status: yes ? "enabled" : "declined" };
|
|
618
|
-
}
|
|
619
|
-
function summaryAlreadySaysNoWallet(wallet) {
|
|
620
|
-
return wallet.status === "declined" || wallet.status === "skipped";
|
|
621
|
-
}
|
|
622
|
-
function doctorNotices(io, doctor, wallet) {
|
|
623
|
-
const problems = doctor.checks.filter(
|
|
624
|
-
(c) => c.status !== "ok" && !(summaryAlreadySaysNoWallet(wallet) && isNoWalletCheck(c))
|
|
625
|
-
);
|
|
626
|
-
if (problems.length === 0) return [];
|
|
627
|
-
const lines = [paint(io, "yellow", "Some checks need attention:")];
|
|
628
|
-
for (const c of problems) {
|
|
629
|
-
const icon = c.status === "fail" ? paint(io, "red", "\u2717") : paint(io, "yellow", "!");
|
|
630
|
-
lines.push(` ${icon} ${c.name}: ${sanitizeForTerminal(c.detail)}`);
|
|
631
|
-
if (c.fix !== void 0) {
|
|
632
|
-
lines.push(paint(io, "dim", ` fix: ${sanitizeForTerminal(c.fix)}`));
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
return lines;
|
|
636
|
-
}
|
|
637
|
-
var DEFAULT_MODE = CONFIG_DEFAULTS.publish.mode;
|
|
638
|
-
var RECOMMENDED_MODE = "auto";
|
|
639
|
-
var PUBLISH_MODE_CHOICES = [
|
|
640
|
-
{
|
|
641
|
-
value: "auto",
|
|
642
|
-
label: "Auto (recommended)",
|
|
643
|
-
hint: "your agent publishes and updates pieces on its own, under your identity"
|
|
644
|
-
},
|
|
645
|
-
{ value: "review", label: "Ask me in chat first" },
|
|
646
|
-
{ value: "full-auto", label: "Fully unattended", hint: "only a hard block stops it" }
|
|
647
|
-
];
|
|
648
|
-
var PUBLISH_MODE_QUESTION = "When your agent has something worth publishing:";
|
|
649
|
-
async function resolvePublishMode(flag, ctx, deps, dryRun, interactive) {
|
|
650
|
-
if (flag !== void 0) {
|
|
651
|
-
if (!dryRun) await persistPublishMode(ctx.dataDir, flag);
|
|
652
|
-
return { value: flag, source: "flag" };
|
|
653
|
-
}
|
|
654
|
-
const config = await loadRawConfig(ctx.dataDir);
|
|
655
|
-
if (config.publish?.mode !== void 0) {
|
|
656
|
-
return { value: config.publish.mode, source: "existing" };
|
|
657
|
-
}
|
|
658
|
-
if (dryRun) return { value: DEFAULT_MODE, source: "default-skipped" };
|
|
659
|
-
if (!interactive) {
|
|
660
|
-
await persistPublishMode(ctx.dataDir, RECOMMENDED_MODE);
|
|
661
|
-
return { value: RECOMMENDED_MODE, source: "headless-default" };
|
|
662
|
-
}
|
|
663
|
-
const answer = await (deps.promptPublishMode ?? defaultPromptPublishMode)();
|
|
664
|
-
if (answer === null) return { value: DEFAULT_MODE, source: "default-skipped" };
|
|
665
|
-
const parsed = PublishModeSchema.safeParse(answer);
|
|
666
|
-
if (!parsed.success) return { value: DEFAULT_MODE, source: "default-skipped" };
|
|
667
|
-
await persistPublishMode(ctx.dataDir, parsed.data);
|
|
668
|
-
return { value: parsed.data, source: "prompt" };
|
|
669
|
-
}
|
|
670
|
-
function defaultPromptPublishMode() {
|
|
671
|
-
return selectOne({
|
|
672
|
-
message: PUBLISH_MODE_QUESTION,
|
|
673
|
-
choices: PUBLISH_MODE_CHOICES.map((c) => ({ ...c })),
|
|
674
|
-
initialValue: "auto"
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
function parseModeFlag(value) {
|
|
678
|
-
return parsePublishModeFlag(value, "--publish-mode");
|
|
679
|
-
}
|
|
680
|
-
function permissionsQuestionHead(mode) {
|
|
681
|
-
const count = rulesForPublishMode(mode).length;
|
|
682
|
-
return `Let your agent use tenjin without permission popups? Adds ${count} command rules to ~/.claude/settings.json.`;
|
|
683
|
-
}
|
|
684
|
-
var PERMISSIONS_QUESTION = `${permissionsQuestionHead("review")} None of them can spend your money. Details: ${PERMISSIONS_DOC_URL}`;
|
|
685
|
-
function permissionsQuestion(mode) {
|
|
686
|
-
if (mode === "review") return PERMISSIONS_QUESTION;
|
|
687
|
-
return `${permissionsQuestionHead(mode)} None of them can spend your money, and on publish.mode ${mode} your agent will publish under your identity on its own. Details: ${PERMISSIONS_DOC_URL}`;
|
|
688
|
-
}
|
|
689
|
-
var WALLET_QUESTION = "Create a wallet now?";
|
|
690
|
-
async function resolvePermissions(args) {
|
|
691
|
-
const { plans, home, deps, flag, dryRun, canPrompt, publishMode } = args;
|
|
692
|
-
if (dryRun) return (deps.planPermissions ?? planFreeVerbAllowlist)(home, publishMode);
|
|
693
|
-
let retractedRules = [];
|
|
694
|
-
let retractedFrom;
|
|
695
|
-
if (publishMode === "review") {
|
|
696
|
-
const retracted = await (deps.retractModeGated ?? retractModeGatedRules)(home);
|
|
697
|
-
if (retracted.skipped !== void 0) return retracted;
|
|
698
|
-
retractedRules = retracted.removed;
|
|
699
|
-
retractedFrom = retracted.path;
|
|
700
|
-
}
|
|
701
|
-
const withRetraction = (result) => retractedRules.length === 0 ? result : {
|
|
702
|
-
...result,
|
|
703
|
-
removed: [...retractedRules, ...result.removed],
|
|
704
|
-
// A non-Claude skip carries no `path`, deliberately: naming a Claude
|
|
705
|
-
// file to a Codex-only operator points them at a file that is nothing
|
|
706
|
-
// to do with their harness. Once we have RETRACTED from that file, the
|
|
707
|
-
// reverse is true, and the operator needs to know which file changed.
|
|
708
|
-
...result.path === void 0 ? { path: retractedFrom } : {}
|
|
709
|
-
};
|
|
710
|
-
const hasClaude = plans.some((p) => p.harness === "claude");
|
|
711
|
-
if (!hasClaude) {
|
|
712
|
-
return withRetraction(
|
|
713
|
-
permissionsSkipped(plans[0]?.harness ?? "shared", home, "harness-not-claude")
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
if (flag === false) return withRetraction(permissionsSkipped("claude", home, "declined"));
|
|
717
|
-
const probe = await (deps.inspectPermissions ?? inspectFreeVerbRules)(home, publishMode);
|
|
718
|
-
if (probe.satisfied !== void 0) return withRetraction(probe.satisfied);
|
|
719
|
-
if (probe.pending !== null && probe.pending.length === 0) {
|
|
720
|
-
return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
|
|
721
|
-
}
|
|
722
|
-
if (flag === true || !canPrompt) {
|
|
723
|
-
return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
|
|
724
|
-
}
|
|
725
|
-
const confirm = deps.confirmPermissions ?? defaultConfirm;
|
|
726
|
-
if (!await confirm(permissionsQuestion(publishMode))) {
|
|
727
|
-
return withRetraction(permissionsSkipped("claude", home, "declined"));
|
|
728
|
-
}
|
|
729
|
-
return withRetraction(await wireFreeVerbAllowlist(home, publishMode));
|
|
730
|
-
}
|
|
731
|
-
var SEARCH_HOOKS_QUESTION = "Let Tenjin ride along with your web searches?";
|
|
732
|
-
var SEARCH_HOOKS_CHOICES = [
|
|
733
|
-
{
|
|
734
|
-
value: "auto",
|
|
735
|
-
label: "Yes, check Tenjin first (recommended)",
|
|
736
|
-
hint: `before a WebSearch or a subagent dispatch, ask ${PRODUCTION_HOST} the same question (free, anonymous, 2s budget) and mention a tested answer; the query or the first 400 chars of the prompt leaves the machine`
|
|
737
|
-
},
|
|
738
|
-
{
|
|
739
|
-
value: "remind",
|
|
740
|
-
label: "Just remind me",
|
|
741
|
-
hint: "a one-line reminder, nothing sent off-machine"
|
|
742
|
-
},
|
|
743
|
-
{ value: "off", label: "No hooks", hint: "nothing is registered" }
|
|
744
|
-
];
|
|
745
|
-
async function resolveHooks(args) {
|
|
746
|
-
const { plans, home, ctx, deps, flag, noHooks, dryRun, canPrompt } = args;
|
|
747
|
-
const dataDir = ctx.dataDir;
|
|
748
|
-
const rawHooks = (await loadRawConfig(dataDir)).hooks;
|
|
749
|
-
const stored = rawHooks?.webSearch ?? rawHooks?.searchMode;
|
|
750
|
-
const storedWebSearch = rawHooks?.webSearch ?? rawHooks?.searchMode;
|
|
751
|
-
const storedAgentDispatchRaw = rawHooks?.agentDispatch ?? (rawHooks?.dispatchMode === "inherit" ? storedWebSearch : rawHooks?.dispatchMode);
|
|
752
|
-
const storedAgentDispatch = storedAgentDispatchRaw ?? (rawHooks?.searchMode !== void 0 ? storedWebSearch : void 0);
|
|
753
|
-
const storedWebSearchEff = storedWebSearch ?? DEFAULT_HOOK_MODE;
|
|
754
|
-
const storedAgentDispatchEff = storedAgentDispatch ?? storedWebSearch ?? DEFAULT_HOOK_MODE;
|
|
755
|
-
const hasClaude = plans.some((p) => p.harness === "claude");
|
|
756
|
-
const hasHermes = plans.some((p) => p.harness === "hermes");
|
|
757
|
-
if (!hasClaude && !hasHermes) {
|
|
758
|
-
const harness = plans[0]?.harness ?? "shared";
|
|
759
|
-
return hooksSkipped(
|
|
760
|
-
harness,
|
|
761
|
-
home,
|
|
762
|
-
dataDir,
|
|
763
|
-
flag ?? stored ?? DEFAULT_HOOK_MODE,
|
|
764
|
-
"harness-not-claude"
|
|
765
|
-
);
|
|
766
|
-
}
|
|
767
|
-
if (noHooks) {
|
|
768
|
-
return hooksSkipped(
|
|
769
|
-
hasHermes ? "hermes" : "claude",
|
|
770
|
-
home,
|
|
771
|
-
dataDir,
|
|
772
|
-
stored ?? DEFAULT_HOOK_MODE,
|
|
773
|
-
"declined"
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
const mode = await chooseHookMode(flag, stored, deps, dryRun, canPrompt);
|
|
777
|
-
if (mode === null) {
|
|
778
|
-
return hooksSkipped(
|
|
779
|
-
hasHermes ? "hermes" : "claude",
|
|
780
|
-
home,
|
|
781
|
-
dataDir,
|
|
782
|
-
stored ?? DEFAULT_HOOK_MODE,
|
|
783
|
-
"declined"
|
|
784
|
-
);
|
|
785
|
-
}
|
|
786
|
-
const resultHarness = hasHermes && !hasClaude ? "hermes" : "claude";
|
|
787
|
-
if (dryRun) return hooksSkipped(resultHarness, home, dataDir, mode, "dry-run");
|
|
788
|
-
const isExplicitChoice = flag !== void 0 || canPrompt && !dryRun;
|
|
789
|
-
const hasAnyHookKey = rawHooks?.webSearch !== void 0 || rawHooks?.agentDispatch !== void 0 || rawHooks?.searchMode !== void 0 || rawHooks?.dispatchMode !== void 0;
|
|
790
|
-
const needsSync = isExplicitChoice ? rawHooks?.webSearch === void 0 || rawHooks?.agentDispatch === void 0 || mode !== storedWebSearchEff || mode !== storedAgentDispatchEff : !hasAnyHookKey;
|
|
791
|
-
if (needsSync) {
|
|
792
|
-
await persistWebSearchHookMode(dataDir, mode);
|
|
793
|
-
await persistAgentDispatchHookMode(dataDir, mode);
|
|
794
|
-
}
|
|
795
|
-
if (mode === "off") return hooksSkipped(resultHarness, home, dataDir, mode, "mode-off");
|
|
796
|
-
if (!hasClaude) return hooksSkipped("hermes", home, dataDir, mode, "native-harness");
|
|
797
|
-
return wireSearchHooks({ homeDir: home, dataDir, mode });
|
|
798
|
-
}
|
|
799
|
-
function hermesHooksEnabled(hooks) {
|
|
800
|
-
return hooks.skipped !== "declined" && hooks.skipped !== "mode-off" && hooks.skipped !== "harness-not-claude";
|
|
801
|
-
}
|
|
802
|
-
var DEFAULT_HOOK_MODE = CONFIG_DEFAULTS.hooks.webSearch;
|
|
803
|
-
async function chooseHookMode(flag, stored, deps, dryRun, canPrompt) {
|
|
804
|
-
if (flag !== void 0) return flag;
|
|
805
|
-
if (dryRun || !canPrompt) return stored ?? DEFAULT_HOOK_MODE;
|
|
806
|
-
const answer = await (deps.promptSearchHooks ?? defaultPromptSearchHooks)();
|
|
807
|
-
if (answer === null) return null;
|
|
808
|
-
const parsed = WebSearchModeSchema.safeParse(answer);
|
|
809
|
-
return parsed.success ? parsed.data : null;
|
|
810
|
-
}
|
|
811
|
-
function defaultPromptSearchHooks() {
|
|
812
|
-
return selectOne({
|
|
813
|
-
message: SEARCH_HOOKS_QUESTION,
|
|
814
|
-
choices: SEARCH_HOOKS_CHOICES.map((c) => ({ ...c })),
|
|
815
|
-
initialValue: "auto"
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
function resolvePlans(override, home, hermesHome, which) {
|
|
819
|
-
if (override !== void 0 && override.length > 0) {
|
|
820
|
-
const plans2 = override.map(
|
|
821
|
-
(v) => planFor(validateHarness(v), ["override"], true, home, hermesHome)
|
|
822
|
-
);
|
|
823
|
-
return dedupeBySkillsDir(plans2);
|
|
824
|
-
}
|
|
825
|
-
const plans = [];
|
|
826
|
-
const claudeBy = harnessDetectedBy(home, "claude", which, hermesHome);
|
|
827
|
-
const codexBy = harnessDetectedBy(home, "codex", which, hermesHome);
|
|
828
|
-
const hermesBy = harnessDetectedBy(home, "hermes", which, hermesHome);
|
|
829
|
-
if (claudeBy.length > 0) plans.push(planFor("claude", claudeBy, true, home, hermesHome));
|
|
830
|
-
if (codexBy.length > 0) plans.push(planFor("codex", codexBy, true, home, hermesHome));
|
|
831
|
-
if (hermesBy.length > 0) plans.push(planFor("hermes", hermesBy, true, home, hermesHome));
|
|
832
|
-
if (plans.length === 0) {
|
|
833
|
-
plans.push(planFor("shared", ["fallback"], false, home, hermesHome));
|
|
834
|
-
}
|
|
835
|
-
return dedupeBySkillsDir(plans);
|
|
836
|
-
}
|
|
837
|
-
function planFor(harness, detectedBy, detected, home, hermesHome) {
|
|
838
|
-
const skillsDir = harnessTargetDir(home, harness, hermesHome);
|
|
839
|
-
return {
|
|
840
|
-
harness,
|
|
841
|
-
detected,
|
|
842
|
-
detectedBy,
|
|
843
|
-
skillsDir,
|
|
844
|
-
wiresAgentsMd: harness !== "claude" && harness !== "hermes",
|
|
845
|
-
home
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
function dedupeBySkillsDir(plans) {
|
|
849
|
-
const seen = /* @__PURE__ */ new Set();
|
|
850
|
-
const out = [];
|
|
851
|
-
for (const p of plans) {
|
|
852
|
-
if (seen.has(p.skillsDir)) continue;
|
|
853
|
-
seen.add(p.skillsDir);
|
|
854
|
-
out.push(p);
|
|
855
|
-
}
|
|
856
|
-
return out;
|
|
857
|
-
}
|
|
858
|
-
function validateHarness(value) {
|
|
859
|
-
if (HARNESSES.includes(value)) return value;
|
|
860
|
-
throw new CliError("USAGE", `Unknown harness "${value}"`, {
|
|
861
|
-
fix: `--harness must be one of: ${HARNESSES.join(", ")}.`
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
async function applyPlan(plan, skillsSource, dryRun) {
|
|
865
|
-
const skills = [];
|
|
866
|
-
const warnings = [];
|
|
867
|
-
for (const name of SKILL_NAMES) {
|
|
868
|
-
const { status, warning, preexisting } = await installSkill(
|
|
869
|
-
join(skillsSource, name),
|
|
870
|
-
join(plan.skillsDir, name),
|
|
871
|
-
dryRun,
|
|
872
|
-
name
|
|
873
|
-
);
|
|
874
|
-
skills.push({
|
|
875
|
-
name,
|
|
876
|
-
status,
|
|
877
|
-
preexisting,
|
|
878
|
-
cli: CLI_SKILL_NAMES.includes(name),
|
|
879
|
-
modelInvocable: await landedInvocable(plan.skillsDir, skillsSource, name, dryRun)
|
|
880
|
-
});
|
|
881
|
-
if (warning !== void 0) warnings.push(warning);
|
|
882
|
-
}
|
|
883
|
-
const hostedPreexisting = skills.some((s) => s.name === HOSTED_SKILL_NAME && s.preexisting);
|
|
884
|
-
const hostedArrivedFirst = hostedPreexisting && !skills.some((s) => s.cli && s.preexisting);
|
|
885
|
-
const result = {
|
|
886
|
-
harness: plan.harness,
|
|
887
|
-
detected: plan.detected,
|
|
888
|
-
detectedBy: plan.detectedBy,
|
|
889
|
-
skillsDir: plan.skillsDir,
|
|
890
|
-
skills,
|
|
891
|
-
hostedPreexisting,
|
|
892
|
-
hostedArrivedFirst,
|
|
893
|
-
notes: notesFor(plan, hostedArrivedFirst),
|
|
894
|
-
warnings
|
|
895
|
-
};
|
|
896
|
-
if (plan.wiresAgentsMd) result.codexNetworkRule = CODEX_NETWORK_RULE;
|
|
897
|
-
return result;
|
|
898
|
-
}
|
|
899
|
-
function notesFor(plan, hostedArrivedFirst) {
|
|
900
|
-
const notes = plan.harness === "claude" ? [
|
|
901
|
-
"Installed at the user level (~/.claude/skills). A Claude Code plugin will later make this automatic."
|
|
902
|
-
] : [
|
|
903
|
-
"Copied into the shared Agent Skills location (~/.agents/skills). Codex and any Agent-Skills-compatible harness read it there."
|
|
904
|
-
];
|
|
905
|
-
if (hostedArrivedFirst) {
|
|
906
|
-
notes.push(
|
|
907
|
-
`The hosted ${HOSTED_SKILL_NAME} skill was already here; the skill stays as the zero-install fallback (its file is replaced by this package's mirror) and the CLI skills (${CLI_SKILL_NAMES.join(", ")}) take precedence while the CLI is installed.`
|
|
908
|
-
);
|
|
909
|
-
}
|
|
910
|
-
return notes;
|
|
911
|
-
}
|
|
912
|
-
async function landedInvocable(skillsDir, skillsSource, name, dryRun) {
|
|
913
|
-
const read = await readSkillFile(join(dryRun ? skillsSource : skillsDir, name, "SKILL.md"));
|
|
914
|
-
if (read.kind !== "ok") return false;
|
|
915
|
-
return !isModelInvocationDisabled(read.bytes.toString("utf8"));
|
|
916
|
-
}
|
|
917
|
-
async function assertSkillsLanded(plans, dryRun) {
|
|
918
|
-
if (dryRun) return;
|
|
919
|
-
const missing = [];
|
|
920
|
-
for (const plan of plans) {
|
|
921
|
-
for (const name of SKILL_NAMES) {
|
|
922
|
-
if (!existsSync(join(plan.skillsDir, name, "SKILL.md"))) {
|
|
923
|
-
missing.push(join(plan.skillsDir, name));
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
if (missing.length === 0) return;
|
|
928
|
-
throw new CliError("INTERNAL", `Skills were not written: ${missing.join(", ")}`, {
|
|
929
|
-
// Safe to point at permissions because nothing removes a landed file any more:
|
|
930
|
-
// each shipped file arrives by its own atomic rename. When this was a
|
|
931
|
-
// rm-then-write it also fired on a lost race, and sent people to chmod a
|
|
932
|
-
// directory that was fine.
|
|
933
|
-
fix: `Check that you can write to the skills directory (\`ls -ld ${dirname(missing[0] ?? "")}\`), then re-run \`tenjin install\`.`
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
function paint(io, format, text) {
|
|
937
|
-
if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });
|
|
938
|
-
return styleText(format, text);
|
|
939
|
-
}
|
|
940
|
-
async function assertSkillsSource(dir) {
|
|
941
|
-
for (const name of SKILL_NAMES) {
|
|
942
|
-
if (!existsSync(join(dir, name, "SKILL.md"))) {
|
|
943
|
-
throw new CliError("INTERNAL", `Packaged skill "${name}" is missing under ${dir}`, {
|
|
944
|
-
fix: "Reinstall tenjin-cli; the published package must ship every skill under skills/."
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
for (const name of CLI_SKILL_NAMES) {
|
|
949
|
-
const text = await readFile(join(dir, name, "SKILL.md"), "utf8");
|
|
950
|
-
if (isModelInvocationDisabled(text)) {
|
|
951
|
-
throw new CliError(
|
|
952
|
-
"INTERNAL",
|
|
953
|
-
`Packaged skill "${name}" carries disable-model-invocation: true, so no harness would surface it`,
|
|
954
|
-
{
|
|
955
|
-
fix: "Reinstall tenjin-cli; the published CLI skills must be model-invocable."
|
|
956
|
-
}
|
|
957
|
-
);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
export {
|
|
962
|
-
BAZAAR_QUESTION,
|
|
963
|
-
PERMISSIONS_QUESTION,
|
|
964
|
-
PUBLISH_MODE_CHOICES,
|
|
965
|
-
PUBLISH_MODE_QUESTION,
|
|
966
|
-
SEARCH_HOOKS_CHOICES,
|
|
967
|
-
SEARCH_HOOKS_QUESTION,
|
|
968
|
-
WALLET_QUESTION,
|
|
969
|
-
permissionsQuestion,
|
|
970
|
-
runInstall
|
|
971
|
-
};
|
|
972
|
-
//# sourceMappingURL=install-GNK2W3PI.js.map
|