tenjin-cli 0.1.0-alpha.31 → 0.1.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -26
- package/dist/{_esm-MEXZI5DL.js → _esm-BIN7VY2L.js} +128 -132
- package/dist/{alive-J64H46HI.js → alive-GSOWKUOY.js} +13 -6
- package/dist/auto-update-Y24UL56V.js +24 -0
- package/dist/{ccip-7RMRLAGV.js → ccip-DHDFKTQV.js} +2 -2
- package/dist/{chunk-TTNESUPQ.js → chunk-2GP3HRYK.js} +2120 -193
- package/dist/chunk-2GP3HRYK.js.map +1 -0
- package/dist/chunk-2M2VPI2E.js +560 -0
- package/dist/chunk-2M2VPI2E.js.map +1 -0
- package/dist/{chunk-D65GNPS3.js → chunk-2RWB7RKE.js} +288 -108
- package/dist/chunk-2RWB7RKE.js.map +1 -0
- package/dist/{chunk-AGZ7PJKY.js → chunk-36RVGZNY.js} +22 -5
- package/dist/chunk-36RVGZNY.js.map +1 -0
- package/dist/chunk-3AIHRXKO.js +72 -0
- package/dist/chunk-3AIHRXKO.js.map +1 -0
- package/dist/{chunk-S4SAZ7OD.js → chunk-3FMZGI7I.js} +12 -2
- package/dist/{chunk-S4SAZ7OD.js.map → chunk-3FMZGI7I.js.map} +1 -1
- package/dist/chunk-3GNJXKIT.js +198 -0
- package/dist/chunk-3GNJXKIT.js.map +1 -0
- package/dist/{chunk-UQUOVWBG.js → chunk-4K7TQHNP.js} +7 -7
- package/dist/{chunk-A36LQPHV.js → chunk-4LMUQMBH.js} +1 -1
- package/dist/{chunk-A36LQPHV.js.map → chunk-4LMUQMBH.js.map} +1 -1
- package/dist/{chunk-KXQ4UIP7.js → chunk-4USCZ2NI.js} +2 -2
- package/dist/chunk-4YOZGGTZ.js +247 -0
- package/dist/chunk-4YOZGGTZ.js.map +1 -0
- package/dist/chunk-62KNUYWD.js +111 -0
- package/dist/chunk-62KNUYWD.js.map +1 -0
- package/dist/{chunk-POUWHWID.js → chunk-6CMM6YCB.js} +3 -3
- package/dist/{chunk-POUWHWID.js.map → chunk-6CMM6YCB.js.map} +1 -1
- package/dist/{chunk-5MARFNSB.js → chunk-A5GKIG5O.js} +49 -30
- package/dist/chunk-A5GKIG5O.js.map +1 -0
- package/dist/{chunk-YFPY4ONH.js → chunk-AGMVASXZ.js} +4 -4
- package/dist/chunk-BF4XHEQK.js +116 -0
- package/dist/chunk-BF4XHEQK.js.map +1 -0
- package/dist/chunk-BFDQ4WNW.js +119 -0
- package/dist/chunk-BFDQ4WNW.js.map +1 -0
- package/dist/{chunk-P4NH7OUK.js → chunk-C2Q76BVM.js} +49 -50
- package/dist/chunk-C2Q76BVM.js.map +1 -0
- package/dist/chunk-CEXSOI5R.js +808 -0
- package/dist/chunk-CEXSOI5R.js.map +1 -0
- package/dist/{chunk-QSCPK4F5.js → chunk-E7SW44LM.js} +4 -11
- package/dist/chunk-E7SW44LM.js.map +1 -0
- package/dist/chunk-EDJWHDDL.js +33 -0
- package/dist/chunk-EDJWHDDL.js.map +1 -0
- package/dist/chunk-F3ED5WTR.js +13 -0
- package/dist/chunk-F3ED5WTR.js.map +1 -0
- package/dist/{chunk-K72RURN3.js → chunk-FVIGCDSV.js} +2 -2
- package/dist/chunk-FVIGCDSV.js.map +1 -0
- package/dist/{chunk-5K5W4S66.js → chunk-GTTUCOPD.js} +2 -2
- package/dist/{chunk-4ZZO6ULA.js → chunk-HDPUXS3Z.js} +19 -48
- package/dist/chunk-HDPUXS3Z.js.map +1 -0
- package/dist/{chunk-LEFIX6RS.js → chunk-HGGWCP7W.js} +31 -11
- package/dist/chunk-HGGWCP7W.js.map +1 -0
- package/dist/{chunk-ORWL5BSN.js → chunk-HGZEPQUT.js} +2 -2
- package/dist/chunk-HMWYAUA6.js +478 -0
- package/dist/chunk-HMWYAUA6.js.map +1 -0
- package/dist/{chunk-7QKHZQKW.js → chunk-IADZOXKN.js} +39 -6
- package/dist/chunk-IADZOXKN.js.map +1 -0
- package/dist/{chunk-7Q5FDF65.js → chunk-IE7P2BZE.js} +3 -3
- package/dist/{chunk-77TCKDEC.js → chunk-ILNIZ5I2.js} +788 -508
- package/dist/chunk-ILNIZ5I2.js.map +1 -0
- package/dist/{hosts-FWZOV26H.js → chunk-INTFHMU4.js} +79 -24
- package/dist/chunk-INTFHMU4.js.map +1 -0
- package/dist/{chunk-6E5R45ZO.js → chunk-J57UC3DD.js} +4 -4
- package/dist/{chunk-6E5R45ZO.js.map → chunk-J57UC3DD.js.map} +1 -1
- package/dist/chunk-JNJWBTU2.js +3497 -0
- package/dist/chunk-JNJWBTU2.js.map +1 -0
- package/dist/{chunk-7WU4OPLP.js → chunk-KM7RY2ZS.js} +5 -3
- package/dist/{chunk-7WU4OPLP.js.map → chunk-KM7RY2ZS.js.map} +1 -1
- package/dist/chunk-L6JEXB3E.js +293 -0
- package/dist/chunk-L6JEXB3E.js.map +1 -0
- package/dist/chunk-LRW6S53P.js +450 -0
- package/dist/chunk-LRW6S53P.js.map +1 -0
- package/dist/{chunk-UKY4CHNC.js → chunk-LXAYUOXI.js} +24 -11
- package/dist/chunk-LXAYUOXI.js.map +1 -0
- package/dist/{chunk-WJXLQXJY.js → chunk-MPZUYCAP.js} +4 -1
- package/dist/{chunk-WJXLQXJY.js.map → chunk-MPZUYCAP.js.map} +1 -1
- package/dist/chunk-NDGZDTSJ.js +393 -0
- package/dist/chunk-NDGZDTSJ.js.map +1 -0
- package/dist/{chunk-SJLTEINJ.js → chunk-OJNTCYQQ.js} +17 -1
- package/dist/chunk-OJNTCYQQ.js.map +1 -0
- package/dist/{chunk-OHRR5OYM.js → chunk-P3LFTKE7.js} +5 -10
- package/dist/chunk-P3LFTKE7.js.map +1 -0
- package/dist/{chunk-XZKD7DIF.js → chunk-RL5UUDT4.js} +3 -3
- package/dist/{chunk-XZKD7DIF.js.map → chunk-RL5UUDT4.js.map} +1 -1
- package/dist/{chunk-5C32RLTA.js → chunk-RVPYTUP4.js} +20 -5
- package/dist/chunk-RVPYTUP4.js.map +1 -0
- package/dist/{chunk-YVFXE7RR.js → chunk-SNNSAGMT.js} +7279 -2627
- package/dist/chunk-SNNSAGMT.js.map +1 -0
- package/dist/{chunk-WK7F3B2E.js → chunk-SO3XRZPX.js} +3 -3
- package/dist/{chunk-R5LCN54M.js → chunk-TC2WZLSC.js} +13 -17
- package/dist/{chunk-R5LCN54M.js.map → chunk-TC2WZLSC.js.map} +1 -1
- package/dist/{chunk-B7HUUJOK.js → chunk-TKPF35W6.js} +3 -3
- package/dist/{chunk-KXVP2VKA.js → chunk-U3IKUGRP.js} +32 -33
- package/dist/chunk-U3IKUGRP.js.map +1 -0
- package/dist/{chunk-AKWGE6JQ.js → chunk-UUGOUOVT.js} +37 -2
- package/dist/chunk-UUGOUOVT.js.map +1 -0
- package/dist/{chunk-2XLC3AEX.js → chunk-UXZONNEQ.js} +536 -510
- package/dist/chunk-UXZONNEQ.js.map +1 -0
- package/dist/{chunk-7ZRL2LBQ.js → chunk-V2LQLN5H.js} +6 -6
- package/dist/{chunk-NEFNKLBE.js → chunk-WFSPCCVW.js} +1536 -423
- package/dist/chunk-WFSPCCVW.js.map +1 -0
- package/dist/{chunk-27EPWVOY.js → chunk-WXA2BWTE.js} +7 -3
- package/dist/chunk-WXA2BWTE.js.map +1 -0
- package/dist/chunk-WYXUQGOL.js +191 -0
- package/dist/chunk-WYXUQGOL.js.map +1 -0
- package/dist/chunk-X5ZBP3IY.js +97 -0
- package/dist/chunk-X5ZBP3IY.js.map +1 -0
- package/dist/{chunk-MNXS2U45.js → chunk-ZDZERB6L.js} +206 -297
- package/dist/chunk-ZDZERB6L.js.map +1 -0
- package/dist/chunk-ZNNXRNFD.js +113 -0
- package/dist/chunk-ZNNXRNFD.js.map +1 -0
- package/dist/{chunk-FW75G2W4.js → chunk-ZURZHELF.js} +5 -5
- package/dist/{cli-D5OE3URZ.js → cli-E36SPKBW.js} +145 -64
- package/dist/{cli-D5OE3URZ.js.map → cli-E36SPKBW.js.map} +1 -1
- package/dist/{codex-event-PPNVRRDH.js → codex-event-ZO2GEFE6.js} +2 -2
- package/dist/{codex-host-2RJOJW2B.js → codex-host-KECJVTA2.js} +7 -6
- package/dist/codex-install-HQZDGFXW.js +436 -0
- package/dist/codex-install-HQZDGFXW.js.map +1 -0
- package/dist/{config-ZD4OB2DO.js → config-HY2E4GGW.js} +21 -17
- package/dist/doctor-I6XQEKWD.js +1323 -0
- package/dist/doctor-I6XQEKWD.js.map +1 -0
- package/dist/{env-proxy-XL4P73MZ.js → env-proxy-R6ZMLQTT.js} +6 -2
- package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js → ethersCompat-Df4a6QIZ-X6YZWAML.js} +3 -3
- package/dist/{fund-5ITKQGYF.js → fund-2QRO7OJL.js} +43 -37
- package/dist/{fund-5ITKQGYF.js.map → fund-2QRO7OJL.js.map} +1 -1
- package/dist/hook-command-2UBCSZG6.js +43 -0
- package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
- package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
- package/dist/hosts/claude/tenjin/hooks/register.tsx +51 -11
- package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +82 -0
- package/dist/hosts/claude/tenjin/types/index.d.ts +2 -1
- package/dist/hosts/codex/tenjin/.mcp.json +3 -0
- package/dist/hosts/codex/tenjin/hooks/hooks.json +51 -5
- package/dist/hosts-DVQJ32QC.js +38 -0
- package/dist/index.js +32 -11
- package/dist/index.js.map +1 -1
- package/dist/install-ILUX5C4A.js +107 -0
- package/dist/{install-identity-K7EJIQFP.js → install-identity-TZKGY6LQ.js} +11 -10
- package/dist/install-wallet-5M4OTYLX.js +281 -0
- package/dist/install-wallet-5M4OTYLX.js.map +1 -0
- package/dist/isows-native-Q2UDIVPT.js +9 -0
- package/dist/isows-native-Q2UDIVPT.js.map +1 -0
- package/dist/{mcp-3LIJSSJB.js → mcp-LE4DUS22.js} +785 -211
- package/dist/mcp-LE4DUS22.js.map +1 -0
- package/dist/{mine.wasm-6PIT3DK6.js → mine.wasm-QFAHIFPY.js} +2 -2
- package/dist/{mine.wasm-6PIT3DK6.js.map → mine.wasm-QFAHIFPY.js.map} +1 -1
- package/dist/{package-ZKQFDWLE.js → package-IJFGMWEV.js} +4 -2
- package/dist/passphrase-IFTDS3CU.js +44 -0
- package/dist/{paths-POPTXJO6.js → paths-XCSAKISU.js} +10 -2
- package/dist/{pay-WHBERZ3W.js → pay-WCG3IH4R.js} +29 -29
- package/dist/{payments-KVICEKD2.js → payments-HFPPWHTV.js} +15 -14
- package/dist/{payments-KVICEKD2.js.map → payments-HFPPWHTV.js.map} +1 -1
- package/dist/plugin-registration-PZFI5GZW.js +68 -0
- package/dist/{redact-6W23GGJC.js → redact-D7ASVWKL.js} +2 -2
- package/dist/runtime-UZOKSUZX.js +1321 -0
- package/dist/runtime-UZOKSUZX.js.map +1 -0
- package/dist/runtime-fetch-ZSSSK72Y.js +23 -0
- package/dist/runtime-layout-WIDILZ6K.js +25 -0
- package/dist/{send-7G7Y7DLN.js → send-GCVEAQKL.js} +24 -22
- package/dist/{send-7G7Y7DLN.js.map → send-GCVEAQKL.js.map} +1 -1
- package/dist/{status-OF7RH5HM.js → status-HCVAOCN7.js} +55 -25
- package/dist/status-HCVAOCN7.js.map +1 -0
- package/dist/{status-line-XOUE6MPL.js → status-line-OPCXDHL2.js} +10 -9
- package/dist/{status-line-XOUE6MPL.js.map → status-line-OPCXDHL2.js.map} +1 -1
- package/dist/uninstall-BAWRBXXQ.js +481 -0
- package/dist/uninstall-BAWRBXXQ.js.map +1 -0
- package/dist/update-CACXLQLR.js +56 -0
- package/dist/update-CACXLQLR.js.map +1 -0
- package/dist/{usdc-OGOGEHV2.js → usdc-VG4CIOUK.js} +6 -8
- package/dist/usdc-VG4CIOUK.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-S3DA7DFW.js → viemAdapter-By13KInL-DOFTEIJV.js} +3 -3
- package/dist/viemAdapter-By13KInL-DOFTEIJV.js.map +1 -0
- package/dist/wallet-QL4UUXEZ.js +55 -0
- package/dist/wallet-QL4UUXEZ.js.map +1 -0
- package/dist/wallet-kdf-worker.mjs +8 -8
- package/docs/agent-permissions.md +50 -28
- package/docs/safety-model.md +1 -1
- package/docs/troubleshooting.md +72 -1
- package/package.json +17 -4
- package/scripts/installers/install.ps1 +67 -0
- package/scripts/installers/install.sh +68 -0
- package/dist/_esm-C5CRWCYU.js +0 -3737
- package/dist/_esm-C5CRWCYU.js.map +0 -1
- package/dist/ccip-NLCSCHKI.js +0 -19
- package/dist/chunk-27EPWVOY.js.map +0 -1
- package/dist/chunk-2XLC3AEX.js.map +0 -1
- package/dist/chunk-4ZZO6ULA.js.map +0 -1
- package/dist/chunk-5C32RLTA.js.map +0 -1
- package/dist/chunk-5IEP5EGE.js +0 -5332
- package/dist/chunk-5IEP5EGE.js.map +0 -1
- package/dist/chunk-5MARFNSB.js.map +0 -1
- package/dist/chunk-77TCKDEC.js.map +0 -1
- package/dist/chunk-7EKYXMUO.js +0 -7536
- package/dist/chunk-7EKYXMUO.js.map +0 -1
- package/dist/chunk-7QKHZQKW.js.map +0 -1
- package/dist/chunk-AGZ7PJKY.js.map +0 -1
- package/dist/chunk-AKWGE6JQ.js.map +0 -1
- package/dist/chunk-BL3332HQ.js +0 -7611
- package/dist/chunk-BL3332HQ.js.map +0 -1
- package/dist/chunk-D65GNPS3.js.map +0 -1
- package/dist/chunk-EGELTSPU.js +0 -2865
- package/dist/chunk-EGELTSPU.js.map +0 -1
- package/dist/chunk-GA7JETVM.js +0 -150
- package/dist/chunk-GA7JETVM.js.map +0 -1
- package/dist/chunk-I3EQFHCD.js +0 -175
- package/dist/chunk-I3EQFHCD.js.map +0 -1
- package/dist/chunk-K3I7C2MO.js +0 -1185
- package/dist/chunk-K3I7C2MO.js.map +0 -1
- package/dist/chunk-K72RURN3.js.map +0 -1
- package/dist/chunk-KXVP2VKA.js.map +0 -1
- package/dist/chunk-LEFIX6RS.js.map +0 -1
- package/dist/chunk-MNXS2U45.js.map +0 -1
- package/dist/chunk-NEFNKLBE.js.map +0 -1
- package/dist/chunk-OHRR5OYM.js.map +0 -1
- package/dist/chunk-P4NH7OUK.js.map +0 -1
- package/dist/chunk-QSCPK4F5.js.map +0 -1
- package/dist/chunk-SJLTEINJ.js.map +0 -1
- package/dist/chunk-TTNESUPQ.js.map +0 -1
- package/dist/chunk-UKY4CHNC.js.map +0 -1
- package/dist/chunk-V6BSF6OC.js +0 -260
- package/dist/chunk-V6BSF6OC.js.map +0 -1
- package/dist/chunk-YVFXE7RR.js.map +0 -1
- package/dist/codex-install-UUZ6QMBQ.js +0 -221
- package/dist/codex-install-UUZ6QMBQ.js.map +0 -1
- package/dist/doctor-KBR34Q4B.js +0 -601
- package/dist/doctor-KBR34Q4B.js.map +0 -1
- package/dist/hook-command-4TYCHHRL.js +0 -39
- package/dist/hosts-FWZOV26H.js.map +0 -1
- package/dist/install-XWGE4Q7L.js +0 -77
- package/dist/install-wallet-XQ6XFZV4.js +0 -117
- package/dist/install-wallet-XQ6XFZV4.js.map +0 -1
- package/dist/mcp-3LIJSSJB.js.map +0 -1
- package/dist/plugin-registration-5TIA564H.js +0 -54
- package/dist/status-OF7RH5HM.js.map +0 -1
- package/dist/uninstall-JXUAFNDB.js +0 -158
- package/dist/uninstall-JXUAFNDB.js.map +0 -1
- package/dist/update-ZKUERSO2.js +0 -44
- package/dist/wallet-2HA6W4R4.js +0 -43
- /package/dist/{_esm-MEXZI5DL.js.map → _esm-BIN7VY2L.js.map} +0 -0
- /package/dist/{alive-J64H46HI.js.map → alive-GSOWKUOY.js.map} +0 -0
- /package/dist/{ccip-7RMRLAGV.js.map → auto-update-Y24UL56V.js.map} +0 -0
- /package/dist/{ccip-NLCSCHKI.js.map → ccip-DHDFKTQV.js.map} +0 -0
- /package/dist/{chunk-UQUOVWBG.js.map → chunk-4K7TQHNP.js.map} +0 -0
- /package/dist/{chunk-KXQ4UIP7.js.map → chunk-4USCZ2NI.js.map} +0 -0
- /package/dist/{chunk-YFPY4ONH.js.map → chunk-AGMVASXZ.js.map} +0 -0
- /package/dist/{chunk-5K5W4S66.js.map → chunk-GTTUCOPD.js.map} +0 -0
- /package/dist/{chunk-ORWL5BSN.js.map → chunk-HGZEPQUT.js.map} +0 -0
- /package/dist/{chunk-7Q5FDF65.js.map → chunk-IE7P2BZE.js.map} +0 -0
- /package/dist/{chunk-WK7F3B2E.js.map → chunk-SO3XRZPX.js.map} +0 -0
- /package/dist/{chunk-B7HUUJOK.js.map → chunk-TKPF35W6.js.map} +0 -0
- /package/dist/{chunk-7ZRL2LBQ.js.map → chunk-V2LQLN5H.js.map} +0 -0
- /package/dist/{chunk-FW75G2W4.js.map → chunk-ZURZHELF.js.map} +0 -0
- /package/dist/{codex-event-PPNVRRDH.js.map → codex-event-ZO2GEFE6.js.map} +0 -0
- /package/dist/{codex-host-2RJOJW2B.js.map → codex-host-KECJVTA2.js.map} +0 -0
- /package/dist/{config-ZD4OB2DO.js.map → config-HY2E4GGW.js.map} +0 -0
- /package/dist/{env-proxy-XL4P73MZ.js.map → env-proxy-R6ZMLQTT.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js.map → ethersCompat-Df4a6QIZ-X6YZWAML.js.map} +0 -0
- /package/dist/{hook-command-4TYCHHRL.js.map → hook-command-2UBCSZG6.js.map} +0 -0
- /package/dist/{install-XWGE4Q7L.js.map → hosts-DVQJ32QC.js.map} +0 -0
- /package/dist/{install-identity-K7EJIQFP.js.map → install-ILUX5C4A.js.map} +0 -0
- /package/dist/{package-ZKQFDWLE.js.map → install-identity-TZKGY6LQ.js.map} +0 -0
- /package/dist/{paths-POPTXJO6.js.map → package-IJFGMWEV.js.map} +0 -0
- /package/dist/{pay-WHBERZ3W.js.map → passphrase-IFTDS3CU.js.map} +0 -0
- /package/dist/{plugin-registration-5TIA564H.js.map → paths-XCSAKISU.js.map} +0 -0
- /package/dist/{redact-6W23GGJC.js.map → pay-WCG3IH4R.js.map} +0 -0
- /package/dist/{update-ZKUERSO2.js.map → plugin-registration-PZFI5GZW.js.map} +0 -0
- /package/dist/{usdc-OGOGEHV2.js.map → redact-D7ASVWKL.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-S3DA7DFW.js.map → runtime-fetch-ZSSSK72Y.js.map} +0 -0
- /package/dist/{wallet-2HA6W4R4.js.map → runtime-layout-WIDILZ6K.js.map} +0 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_RPC_URL
|
|
4
|
+
} from "./chunk-WXA2BWTE.js";
|
|
5
|
+
import {
|
|
6
|
+
PRODUCTION_ORIGIN
|
|
7
|
+
} from "./chunk-XQJXNMSB.js";
|
|
8
|
+
import {
|
|
9
|
+
external_exports
|
|
10
|
+
} from "./chunk-SNNSAGMT.js";
|
|
11
|
+
import {
|
|
12
|
+
CliError
|
|
13
|
+
} from "./chunk-3UCIG4TG.js";
|
|
14
|
+
import {
|
|
15
|
+
configPath
|
|
16
|
+
} from "./chunk-OJNTCYQQ.js";
|
|
17
|
+
|
|
18
|
+
// src/lib/config.ts
|
|
19
|
+
import { readFile } from "node:fs/promises";
|
|
20
|
+
|
|
21
|
+
// src/adapters/types.ts
|
|
22
|
+
var HARNESSES = ["claude", "codex"];
|
|
23
|
+
|
|
24
|
+
// src/lib/config.ts
|
|
25
|
+
var atomicString = external_exports.string().regex(/^\d+$/, "expected an atomic USDC integer string");
|
|
26
|
+
var PublishModeSchema = external_exports.enum(["review", "auto", "full-auto"]);
|
|
27
|
+
var AckServerWarningsSchema = external_exports.enum(["mode", "on", "off"]);
|
|
28
|
+
function parseAckServerWarnings(value, keyName) {
|
|
29
|
+
const parsed = AckServerWarningsSchema.safeParse(value);
|
|
30
|
+
if (parsed.success) return parsed.data;
|
|
31
|
+
throw new CliError("USAGE", `Invalid ${keyName} ${JSON.stringify(value)}`, {
|
|
32
|
+
fix: 'Use "mode", "on", or "off".'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
var PublishConfigSchema = external_exports.object({
|
|
36
|
+
mode: PublishModeSchema,
|
|
37
|
+
defaultPrice: atomicString,
|
|
38
|
+
ackServerWarnings: AckServerWarningsSchema
|
|
39
|
+
});
|
|
40
|
+
var HOOK_ARMS = [
|
|
41
|
+
"prompt",
|
|
42
|
+
"web-search",
|
|
43
|
+
"web-fetch",
|
|
44
|
+
"subagent",
|
|
45
|
+
"failure",
|
|
46
|
+
"publish",
|
|
47
|
+
"primer"
|
|
48
|
+
];
|
|
49
|
+
var HooksConfigSchema = external_exports.object({
|
|
50
|
+
prompt: external_exports.boolean(),
|
|
51
|
+
"web-search": external_exports.boolean(),
|
|
52
|
+
"web-fetch": external_exports.boolean(),
|
|
53
|
+
subagent: external_exports.boolean(),
|
|
54
|
+
failure: external_exports.boolean(),
|
|
55
|
+
publish: external_exports.boolean(),
|
|
56
|
+
primer: external_exports.boolean()
|
|
57
|
+
});
|
|
58
|
+
var ROUTER_CONTEXTS = ["session", "turn"];
|
|
59
|
+
var RouterLayerSchema = external_exports.object({
|
|
60
|
+
enabled: external_exports.boolean().optional(),
|
|
61
|
+
context: external_exports.enum(ROUTER_CONTEXTS).optional()
|
|
62
|
+
});
|
|
63
|
+
var RouterConfigSchema = RouterLayerSchema.required();
|
|
64
|
+
function parseRouterLayer(json, path) {
|
|
65
|
+
if (json === null || typeof json !== "object" || Array.isArray(json)) {
|
|
66
|
+
throw new CliError("CONFIG_INVALID", `Config at ${path} is not a JSON object`, {
|
|
67
|
+
fix: `Fix ${path}, or delete it.`
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const parsed = RouterLayerSchema.safeParse(json.router ?? {});
|
|
71
|
+
if (!parsed.success) {
|
|
72
|
+
throw new CliError("CONFIG_INVALID", `Config at ${path} has an invalid router block`, {
|
|
73
|
+
fix: `Use router.enabled true|false and router.context "session"|"turn" in ${path}, or delete it.`,
|
|
74
|
+
details: parsed.error.issues
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const { enabled, context } = parsed.data;
|
|
78
|
+
return {
|
|
79
|
+
...enabled !== void 0 ? { enabled } : {},
|
|
80
|
+
...context !== void 0 ? { context } : {}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
var UpdateModeSchema = external_exports.enum(["auto", "nudge", "off"]);
|
|
84
|
+
var positiveInt = external_exports.number().int().positive();
|
|
85
|
+
var LoopConfigSchema = external_exports.object({
|
|
86
|
+
human_wait_ms: positiveInt,
|
|
87
|
+
tool_wait_ms: positiveInt,
|
|
88
|
+
idle_exit_min: positiveInt,
|
|
89
|
+
port: external_exports.number().int().min(0).max(65535).nullable()
|
|
90
|
+
});
|
|
91
|
+
var PublicFallbackSchema = external_exports.enum(["on", "off"]);
|
|
92
|
+
var TeamConfigSchema = external_exports.object({ publicFallback: PublicFallbackSchema });
|
|
93
|
+
var ExperimentalConfigSchema = external_exports.object({ bazaar: PublicFallbackSchema });
|
|
94
|
+
function parsePublicFallbackFlag(value, keyName) {
|
|
95
|
+
const parsed = PublicFallbackSchema.safeParse(value);
|
|
96
|
+
if (parsed.success) return parsed.data;
|
|
97
|
+
throw new CliError("USAGE", `Invalid ${keyName}: ${JSON.stringify(value)}`, {
|
|
98
|
+
fix: 'Use "on" or "off".'
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function parseLoopValue(key, value) {
|
|
102
|
+
const field = key.slice("loop.".length);
|
|
103
|
+
if (field === "port" && (value === "null" || value === "auto")) return null;
|
|
104
|
+
const n = /^\d+$/.test(value.trim()) ? Number(value.trim()) : NaN;
|
|
105
|
+
const parsed = LoopConfigSchema.shape[field].safeParse(n);
|
|
106
|
+
if (parsed.success) return parsed.data;
|
|
107
|
+
throw new CliError("USAGE", `Invalid ${key}: ${JSON.stringify(value)}`, {
|
|
108
|
+
fix: field === "port" ? 'Use an integer from 0 to 65535, or "null" to derive one from the data dir.' : "Use a positive integer."
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
var UpdateConfigSchema = external_exports.object({
|
|
112
|
+
mode: UpdateModeSchema
|
|
113
|
+
});
|
|
114
|
+
function parseUpdateModeFlag(value, flagName) {
|
|
115
|
+
const parsed = UpdateModeSchema.safeParse(value);
|
|
116
|
+
if (parsed.success) return parsed.data;
|
|
117
|
+
throw new CliError("USAGE", `Invalid ${flagName} ${JSON.stringify(value)}`, {
|
|
118
|
+
fix: 'Use "auto", "nudge" or "off".'
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
var InstallConfigSchema = external_exports.object({
|
|
122
|
+
harness: external_exports.array(external_exports.enum(HARNESSES)),
|
|
123
|
+
/**
|
|
124
|
+
* The EXACT rule strings still pending the last time an install explicitly
|
|
125
|
+
* declined the free-verb allowlist (`--no-grant`), so `--refresh`
|
|
126
|
+
* can subtract them from what it would
|
|
127
|
+
* otherwise report as pending instead of recomputing from the settings file
|
|
128
|
+
* and nagging about a settled "no" on every refresh (tenjin-agent#234).
|
|
129
|
+
*
|
|
130
|
+
* A LIST, NOT A FLAG, on purpose: a boolean has no way to say "these were
|
|
131
|
+
* declined" without also silencing every rule a LATER version might add, so a
|
|
132
|
+
* genuinely new suggestion would never be reported again either. Per-rule
|
|
133
|
+
* suppression means only the rules that were actually offered and refused
|
|
134
|
+
* stay quiet; a new one still surfaces.
|
|
135
|
+
*
|
|
136
|
+
* Cleared back to `[]` the next time an install actually wires the allowlist,
|
|
137
|
+
* or finds it already fully satisfied, so a later legitimate grant (manual or
|
|
138
|
+
* otherwise) is never shadowed by a stale decline.
|
|
139
|
+
*/
|
|
140
|
+
grantDeclined: external_exports.array(external_exports.string()),
|
|
141
|
+
/**
|
|
142
|
+
* Absolute directories a `tenjin install --project` wired, so `tenjin update`
|
|
143
|
+
* can refresh them. It spawns `install --refresh` from the HOME directory,
|
|
144
|
+
* which is the one place a project install can never be found by looking
|
|
145
|
+
* around: without this list a project-only machine refreshed nothing and
|
|
146
|
+
* reported success while its hooks stayed on the old build.
|
|
147
|
+
*
|
|
148
|
+
* A LIST, because one machine can wire several projects, and entries are
|
|
149
|
+
* dropped by `tenjin uninstall --project` and by any refresh that finds the
|
|
150
|
+
* project's settings file no longer carries our entries.
|
|
151
|
+
*/
|
|
152
|
+
routerProjects: external_exports.array(external_exports.string())
|
|
153
|
+
});
|
|
154
|
+
var STORED_INSTALL_HARNESSES = [...HARNESSES, "shared"];
|
|
155
|
+
function resolveInstallHarness(value) {
|
|
156
|
+
const normalized = new Set(value?.map((harness) => harness === "shared" ? "codex" : harness));
|
|
157
|
+
return HARNESSES.filter((harness) => normalized.has(harness));
|
|
158
|
+
}
|
|
159
|
+
var RawInstallHarnessSchema = external_exports.array(external_exports.enum(STORED_INSTALL_HARNESSES)).transform(resolveInstallHarness);
|
|
160
|
+
var ConfigSchema = external_exports.object({
|
|
161
|
+
maxAutoSpend: atomicString,
|
|
162
|
+
sessionBudget: external_exports.union([atomicString, external_exports.literal("none")]),
|
|
163
|
+
/**
|
|
164
|
+
* Hard per-send cap for `tenjin wallet send`, NOT satisfiable by --yes or a prompt
|
|
165
|
+
* (the spend-policy posture): an atomic amount caps each send, "0" disables
|
|
166
|
+
* the verb entirely, and "none" = explicitly uncapped (send exists to drain
|
|
167
|
+
* the wallet, but uncapped is an opt-in, never a default). The key has NO
|
|
168
|
+
* usable default: absent from config.json, `tenjin wallet send` refuses until it is
|
|
169
|
+
* set (see resolveSendMaxAmount). Client-enforced like every spend key (see
|
|
170
|
+
* the note above).
|
|
171
|
+
*/
|
|
172
|
+
sendMaxAmount: external_exports.union([external_exports.literal("none"), atomicString]),
|
|
173
|
+
allowlistCreators: external_exports.array(external_exports.string()),
|
|
174
|
+
baseUrl: external_exports.url(),
|
|
175
|
+
/**
|
|
176
|
+
* The PUBLIC marketplace, consume-only, and the second shelf a team-mode
|
|
177
|
+
* lookup falls through to. Distinct from `baseUrl` because in team mode
|
|
178
|
+
* `baseUrl` is the team's own deployment: `publish`, `read` and the first leg
|
|
179
|
+
* of every search go there, and this is the shelf that still gets asked when
|
|
180
|
+
* the team's own has nothing. In public mode the two are the same origin and
|
|
181
|
+
* nothing falls through.
|
|
182
|
+
*/
|
|
183
|
+
publicShelfUrl: external_exports.url(),
|
|
184
|
+
/**
|
|
185
|
+
* The team shelf's Vercel "Protection Bypass for Automation" secret, and the
|
|
186
|
+
* ONE key that decides which mode this CLI is in: empty (the default) is
|
|
187
|
+
* public mode, byte-for-byte what it always did; non-empty is team mode.
|
|
188
|
+
*
|
|
189
|
+
* It is a DOOR KEY, not a credential of the operator's: it gets a request past
|
|
190
|
+
* Deployment Protection on the team's preview deployment and authenticates
|
|
191
|
+
* nobody. Stored in plain config.json alongside everything else for exactly
|
|
192
|
+
* that reason — anything that can read this file can already read the wallet's
|
|
193
|
+
* keystore path and rewrite `baseUrl`. It is redacted from `config get` and
|
|
194
|
+
* `config list` all the same, because those outputs are pasted into issues.
|
|
195
|
+
*
|
|
196
|
+
* Sent ONLY to `baseUrl`'s origin; see lib/http.ts's `bypass` option, which
|
|
197
|
+
* derives that from the request URL rather than from the caller's intent.
|
|
198
|
+
*/
|
|
199
|
+
shelfBypassSecret: external_exports.string(),
|
|
200
|
+
rpcUrl: external_exports.url(),
|
|
201
|
+
/**
|
|
202
|
+
* Evaluation-cohort opt-in (spec 09 §3): when true, search sends
|
|
203
|
+
* X-Tenjin-Eval-Cohort: 1 and the server stores the generalized question for
|
|
204
|
+
* 90 days. Off by default; no query text is retained server-side without it.
|
|
205
|
+
*/
|
|
206
|
+
evalCohort: external_exports.boolean(),
|
|
207
|
+
/** x402 discovery registries (facilitator base URLs) `discover` queries and
|
|
208
|
+
* the Bazaar pay lane verifies against. */
|
|
209
|
+
bazaarRegistries: external_exports.array(external_exports.url()),
|
|
210
|
+
publish: PublishConfigSchema,
|
|
211
|
+
install: InstallConfigSchema,
|
|
212
|
+
hooks: HooksConfigSchema,
|
|
213
|
+
update: UpdateConfigSchema,
|
|
214
|
+
loop: LoopConfigSchema,
|
|
215
|
+
team: TeamConfigSchema,
|
|
216
|
+
router: RouterConfigSchema,
|
|
217
|
+
experimental: ExperimentalConfigSchema
|
|
218
|
+
});
|
|
219
|
+
var RawInstallConfigSchema = InstallConfigSchema.partial().extend({
|
|
220
|
+
harness: RawInstallHarnessSchema.optional(),
|
|
221
|
+
grantDeclined: external_exports.array(external_exports.string()).optional()
|
|
222
|
+
}).passthrough();
|
|
223
|
+
var RawConfigSchema = ConfigSchema.partial().extend({
|
|
224
|
+
publish: PublishConfigSchema.partial().passthrough().optional(),
|
|
225
|
+
install: RawInstallConfigSchema.optional(),
|
|
226
|
+
hooks: HooksConfigSchema.partial().passthrough().optional(),
|
|
227
|
+
update: UpdateConfigSchema.partial().passthrough().optional(),
|
|
228
|
+
loop: LoopConfigSchema.partial().passthrough().optional(),
|
|
229
|
+
team: TeamConfigSchema.partial().passthrough().optional(),
|
|
230
|
+
router: RouterLayerSchema.passthrough().optional(),
|
|
231
|
+
experimental: ExperimentalConfigSchema.partial().passthrough().optional()
|
|
232
|
+
}).passthrough();
|
|
233
|
+
function resolveGrantDeclined(value) {
|
|
234
|
+
return value ?? [];
|
|
235
|
+
}
|
|
236
|
+
var SEND_MAX_UNSET = "unset";
|
|
237
|
+
var DEFAULT_BAZAAR_REGISTRIES = [
|
|
238
|
+
"https://api.cdp.coinbase.com/platform/v2/x402",
|
|
239
|
+
"https://facilitator.ultravioletadao.xyz",
|
|
240
|
+
"https://facilitator.payai.network"
|
|
241
|
+
];
|
|
242
|
+
var DEFAULT_MAX_AUTO_SPEND = "250000";
|
|
243
|
+
var DEFAULT_SESSION_BUDGET = "5000000";
|
|
244
|
+
var MAX_AUTO_SPEND_FLOOR_ATOMIC = 250000n;
|
|
245
|
+
var MAX_AUTO_SPEND_FLOOR_WHY = "The $0.25 minimum is the routing deposit: below it, routing cannot pay at all. To stop automatic payments, turn the router off with `tenjin config set router.enabled false`.";
|
|
246
|
+
var CONFIG_DEFAULTS = {
|
|
247
|
+
maxAutoSpend: DEFAULT_MAX_AUTO_SPEND,
|
|
248
|
+
sessionBudget: DEFAULT_SESSION_BUDGET,
|
|
249
|
+
// A type placeholder only, never honored: Config requires every key (and
|
|
250
|
+
// CONFIG_KEYS derives from these). resolveSendMaxAmount never reads it — an
|
|
251
|
+
// absent key resolves to SEND_MAX_UNSET and `tenjin wallet send` refuses until the
|
|
252
|
+
// cap is set. '0' (send disabled) rather than 'none' (uncapped) so that if a
|
|
253
|
+
// future caller ever DOES read the cap through loadConfig/fileOrDefault, the
|
|
254
|
+
// leak fails closed instead of silently running uncapped.
|
|
255
|
+
sendMaxAmount: "0",
|
|
256
|
+
allowlistCreators: [],
|
|
257
|
+
baseUrl: PRODUCTION_ORIGIN,
|
|
258
|
+
publicShelfUrl: PRODUCTION_ORIGIN,
|
|
259
|
+
// Empty = public mode. Setting it is the whole of "turn on team mode".
|
|
260
|
+
shelfBypassSecret: "",
|
|
261
|
+
rpcUrl: DEFAULT_RPC_URL,
|
|
262
|
+
evalCohort: false,
|
|
263
|
+
bazaarRegistries: DEFAULT_BAZAAR_REGISTRIES,
|
|
264
|
+
publish: { mode: "review", defaultPrice: "100000", ackServerWarnings: "mode" },
|
|
265
|
+
install: { harness: [], grantDeclined: [], routerProjects: [] },
|
|
266
|
+
// Every hook is on out of the box: a vanilla install turns the whole loop on,
|
|
267
|
+
// and the disclosure and the undo ride the install output. `false` leaves the
|
|
268
|
+
// registered entries inert without touching settings.json, so any of these is
|
|
269
|
+
// one `config set` away in either direction.
|
|
270
|
+
hooks: {
|
|
271
|
+
prompt: true,
|
|
272
|
+
"web-search": true,
|
|
273
|
+
"web-fetch": true,
|
|
274
|
+
subagent: true,
|
|
275
|
+
failure: true,
|
|
276
|
+
publish: true,
|
|
277
|
+
primer: true
|
|
278
|
+
},
|
|
279
|
+
update: { mode: "auto" },
|
|
280
|
+
loop: {
|
|
281
|
+
human_wait_ms: 2500,
|
|
282
|
+
tool_wait_ms: 4e3,
|
|
283
|
+
idle_exit_min: 30,
|
|
284
|
+
port: null
|
|
285
|
+
},
|
|
286
|
+
team: { publicFallback: "on" },
|
|
287
|
+
router: { enabled: true, context: "session" },
|
|
288
|
+
experimental: { bazaar: "off" }
|
|
289
|
+
};
|
|
290
|
+
var NESTED_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
291
|
+
"publish",
|
|
292
|
+
"install",
|
|
293
|
+
"hooks",
|
|
294
|
+
"update",
|
|
295
|
+
"loop",
|
|
296
|
+
"team",
|
|
297
|
+
"router",
|
|
298
|
+
"experimental"
|
|
299
|
+
]);
|
|
300
|
+
var CONFIG_KEYS = Object.keys(CONFIG_DEFAULTS).filter(
|
|
301
|
+
(key) => !NESTED_CONFIG_KEYS.has(key)
|
|
302
|
+
);
|
|
303
|
+
var PUBLISH_CONFIG_KEYS = [
|
|
304
|
+
"publish.mode",
|
|
305
|
+
"publish.defaultPrice",
|
|
306
|
+
"publish.ackServerWarnings"
|
|
307
|
+
];
|
|
308
|
+
var HOOKS_CONFIG_KEYS = HOOK_ARMS.map(
|
|
309
|
+
(arm) => `hooks.${arm}`
|
|
310
|
+
);
|
|
311
|
+
var UPDATE_CONFIG_KEYS = ["update.mode"];
|
|
312
|
+
var LOOP_CONFIG_KEYS = [
|
|
313
|
+
"loop.human_wait_ms",
|
|
314
|
+
"loop.tool_wait_ms",
|
|
315
|
+
"loop.idle_exit_min",
|
|
316
|
+
"loop.port"
|
|
317
|
+
];
|
|
318
|
+
var TEAM_CONFIG_KEYS = ["team.publicFallback"];
|
|
319
|
+
var EXPERIMENTAL_CONFIG_KEYS = ["experimental.bazaar"];
|
|
320
|
+
var ROUTER_CONFIG_KEYS = ["router.enabled", "router.context"];
|
|
321
|
+
var RETIRED_PAYMENT_KEYS = ["bazaarPay", "confirm"];
|
|
322
|
+
var RETIRED_PAYMENT_GUIDANCE = "Retired payment settings no longer control payments. Use router.enabled, maxAutoSpend and sessionBudget for automatic routing; manual pay always requires consent. Run tenjin install to remove retired keys.";
|
|
323
|
+
function retiredPaymentKeys(raw) {
|
|
324
|
+
return RETIRED_PAYMENT_KEYS.filter((key) => Object.hasOwn(raw, key));
|
|
325
|
+
}
|
|
326
|
+
async function loadRawConfig(dir) {
|
|
327
|
+
const path = configPath(dir);
|
|
328
|
+
let raw;
|
|
329
|
+
try {
|
|
330
|
+
raw = await readFile(path, "utf8");
|
|
331
|
+
} catch (err) {
|
|
332
|
+
if (isNotFound(err)) return {};
|
|
333
|
+
throw new CliError("CONFIG_INVALID", `Could not read config at ${path}`, {
|
|
334
|
+
fix: `Check file permissions on ${path}.`,
|
|
335
|
+
cause: err
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
let json;
|
|
339
|
+
try {
|
|
340
|
+
json = JSON.parse(raw);
|
|
341
|
+
} catch (err) {
|
|
342
|
+
throw new CliError("CONFIG_INVALID", `Config at ${path} is not valid JSON`, {
|
|
343
|
+
fix: `Fix the JSON syntax in ${path}, or delete it to restore defaults.`,
|
|
344
|
+
cause: err
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
const parsed = RawConfigSchema.safeParse(json);
|
|
348
|
+
if (!parsed.success) {
|
|
349
|
+
throw new CliError("CONFIG_INVALID", `Config at ${path} is invalid`, {
|
|
350
|
+
fix: `Correct the reported keys in ${path}, or delete it to restore defaults.`,
|
|
351
|
+
details: parsed.error.issues
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
return parsed.data;
|
|
355
|
+
}
|
|
356
|
+
async function loadConfig(dir) {
|
|
357
|
+
const raw = { ...await loadRawConfig(dir) };
|
|
358
|
+
for (const key of retiredPaymentKeys(raw)) delete raw[key];
|
|
359
|
+
return {
|
|
360
|
+
...CONFIG_DEFAULTS,
|
|
361
|
+
...raw,
|
|
362
|
+
publish: {
|
|
363
|
+
mode: raw.publish?.mode ?? CONFIG_DEFAULTS.publish.mode,
|
|
364
|
+
defaultPrice: raw.publish?.defaultPrice ?? CONFIG_DEFAULTS.publish.defaultPrice,
|
|
365
|
+
ackServerWarnings: raw.publish?.ackServerWarnings ?? CONFIG_DEFAULTS.publish.ackServerWarnings
|
|
366
|
+
},
|
|
367
|
+
install: {
|
|
368
|
+
harness: raw.install?.harness ?? CONFIG_DEFAULTS.install.harness,
|
|
369
|
+
routerProjects: raw.install?.routerProjects ?? CONFIG_DEFAULTS.install.routerProjects,
|
|
370
|
+
grantDeclined: resolveGrantDeclined(raw.install?.grantDeclined)
|
|
371
|
+
},
|
|
372
|
+
hooks: resolveHooksConfig(raw),
|
|
373
|
+
update: { mode: raw.update?.mode ?? CONFIG_DEFAULTS.update.mode },
|
|
374
|
+
loop: resolveLoopConfig(raw),
|
|
375
|
+
team: { publicFallback: raw.team?.publicFallback ?? CONFIG_DEFAULTS.team.publicFallback },
|
|
376
|
+
router: {
|
|
377
|
+
enabled: raw.router?.enabled ?? CONFIG_DEFAULTS.router.enabled,
|
|
378
|
+
context: raw.router?.context ?? CONFIG_DEFAULTS.router.context
|
|
379
|
+
},
|
|
380
|
+
experimental: {
|
|
381
|
+
bazaar: raw.experimental?.bazaar ?? CONFIG_DEFAULTS.experimental.bazaar
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function resolveLoopConfig(raw) {
|
|
386
|
+
const file = raw.loop ?? {};
|
|
387
|
+
return {
|
|
388
|
+
human_wait_ms: file.human_wait_ms ?? CONFIG_DEFAULTS.loop.human_wait_ms,
|
|
389
|
+
tool_wait_ms: file.tool_wait_ms ?? CONFIG_DEFAULTS.loop.tool_wait_ms,
|
|
390
|
+
idle_exit_min: file.idle_exit_min ?? CONFIG_DEFAULTS.loop.idle_exit_min,
|
|
391
|
+
port: file.port === void 0 ? CONFIG_DEFAULTS.loop.port : file.port
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function resolveSettings(input) {
|
|
395
|
+
const { config, flags, env, project } = input;
|
|
396
|
+
return {
|
|
397
|
+
maxAutoSpend: fileOrDefault("maxAutoSpend", config),
|
|
398
|
+
sessionBudget: fileOrDefault("sessionBudget", config),
|
|
399
|
+
sendMaxAmount: resolveSendMaxAmount(config),
|
|
400
|
+
allowlistCreators: fileOrDefault("allowlistCreators", config),
|
|
401
|
+
baseUrl: resolveBaseUrl(config, flags, env),
|
|
402
|
+
publicShelfUrl: fileOrDefault("publicShelfUrl", config),
|
|
403
|
+
shelfBypassSecret: fileOrDefault("shelfBypassSecret", config),
|
|
404
|
+
rpcUrl: fileOrDefault("rpcUrl", config),
|
|
405
|
+
evalCohort: fileOrDefault("evalCohort", config),
|
|
406
|
+
bazaarRegistries: fileOrDefault("bazaarRegistries", config),
|
|
407
|
+
publishMode: resolvePublishMode({ config, project, env }),
|
|
408
|
+
publishDefaultPrice: resolvePublishDefaultPrice({ config, project }),
|
|
409
|
+
publishAckServerWarnings: resolveAckServerWarnings(config),
|
|
410
|
+
hooks: resolveHookSettings(config),
|
|
411
|
+
updateMode: resolveUpdateMode(config),
|
|
412
|
+
loop: resolveLoopSettings(config),
|
|
413
|
+
teamPublicFallback: resolveTeamPublicFallback(config),
|
|
414
|
+
experimentalBazaar: resolveExperimentalBazaar(config)
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function resolveLoopSettings(config) {
|
|
418
|
+
const file = config.loop ?? {};
|
|
419
|
+
const one = (key) => {
|
|
420
|
+
const fromFile = file[key];
|
|
421
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
422
|
+
return { value: CONFIG_DEFAULTS.loop[key], source: "default" };
|
|
423
|
+
};
|
|
424
|
+
return {
|
|
425
|
+
human_wait_ms: one("human_wait_ms"),
|
|
426
|
+
tool_wait_ms: one("tool_wait_ms"),
|
|
427
|
+
idle_exit_min: one("idle_exit_min"),
|
|
428
|
+
port: one("port")
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function resolveExperimentalBazaar(config) {
|
|
432
|
+
const fromFile = config.experimental?.bazaar;
|
|
433
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
434
|
+
return { value: CONFIG_DEFAULTS.experimental.bazaar, source: "default" };
|
|
435
|
+
}
|
|
436
|
+
function resolveTeamPublicFallback(config) {
|
|
437
|
+
const fromFile = config.team?.publicFallback;
|
|
438
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
439
|
+
return { value: CONFIG_DEFAULTS.team.publicFallback, source: "default" };
|
|
440
|
+
}
|
|
441
|
+
function resolveAckServerWarnings(config) {
|
|
442
|
+
const fromFile = config.publish?.ackServerWarnings;
|
|
443
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
444
|
+
return { value: CONFIG_DEFAULTS.publish.ackServerWarnings, source: "default" };
|
|
445
|
+
}
|
|
446
|
+
function resolveUpdateMode(config) {
|
|
447
|
+
const fromFile = config.update?.mode;
|
|
448
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
449
|
+
return { value: CONFIG_DEFAULTS.update.mode, source: "default" };
|
|
450
|
+
}
|
|
451
|
+
function resolveHook(config, arm) {
|
|
452
|
+
const fromFile = config.hooks?.[arm];
|
|
453
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
454
|
+
return { value: CONFIG_DEFAULTS.hooks[arm], source: "default" };
|
|
455
|
+
}
|
|
456
|
+
function resolveHookSettings(config) {
|
|
457
|
+
return Object.fromEntries(
|
|
458
|
+
HOOK_ARMS.map((arm) => [arm, resolveHook(config, arm)])
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
function resolveHooksConfig(raw) {
|
|
462
|
+
return Object.fromEntries(
|
|
463
|
+
HOOK_ARMS.map((arm) => [arm, raw.hooks?.[arm] ?? CONFIG_DEFAULTS.hooks[arm]])
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
var FULL_AUTO_DOWNGRADE_WARNING = 'Ignoring publish.mode "full-auto" from a committed .tenjin.json (cloning a repo must not enable auto-publish); using "auto". Add .tenjin.json to .gitignore to opt in.';
|
|
467
|
+
function coercePublishMode(raw) {
|
|
468
|
+
if (raw === void 0 || raw.length === 0) return void 0;
|
|
469
|
+
const parsed = PublishModeSchema.safeParse(raw);
|
|
470
|
+
return parsed.success ? parsed.data : void 0;
|
|
471
|
+
}
|
|
472
|
+
function resolvePublishMode(input) {
|
|
473
|
+
const { config, project, env, flag } = input;
|
|
474
|
+
let winner = { value: CONFIG_DEFAULTS.publish.mode, source: "default" };
|
|
475
|
+
const fromFile = config.publish?.mode;
|
|
476
|
+
if (fromFile !== void 0) winner = { value: fromFile, source: "file" };
|
|
477
|
+
if (project !== void 0 && project.publish?.mode !== void 0) {
|
|
478
|
+
const fromProject = project.publish.mode;
|
|
479
|
+
if (fromProject === "full-auto" && !project.gitignored) {
|
|
480
|
+
winner = { value: "auto", source: "project", downgradedWarning: FULL_AUTO_DOWNGRADE_WARNING };
|
|
481
|
+
} else {
|
|
482
|
+
winner = { value: fromProject, source: "project" };
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
const fromEnv = coercePublishMode(env.TENJIN_PUBLISH_MODE);
|
|
486
|
+
if (fromEnv !== void 0) winner = { value: fromEnv, source: "env" };
|
|
487
|
+
const fromFlag = coercePublishMode(flag);
|
|
488
|
+
if (fromFlag !== void 0) winner = { value: fromFlag, source: "flag" };
|
|
489
|
+
return winner;
|
|
490
|
+
}
|
|
491
|
+
function resolvePublishDefaultPrice(input) {
|
|
492
|
+
const { config, project } = input;
|
|
493
|
+
let result = {
|
|
494
|
+
value: CONFIG_DEFAULTS.publish.defaultPrice,
|
|
495
|
+
source: "default"
|
|
496
|
+
};
|
|
497
|
+
if (config.publish?.defaultPrice !== void 0) {
|
|
498
|
+
result = { value: config.publish.defaultPrice, source: "file" };
|
|
499
|
+
}
|
|
500
|
+
if (project?.publish?.defaultPrice !== void 0) {
|
|
501
|
+
result = { value: project.publish.defaultPrice, source: "project" };
|
|
502
|
+
}
|
|
503
|
+
return result;
|
|
504
|
+
}
|
|
505
|
+
function resolveSendMaxAmount(config) {
|
|
506
|
+
if (config.sendMaxAmount !== void 0) return { value: config.sendMaxAmount, source: "file" };
|
|
507
|
+
return { value: SEND_MAX_UNSET, source: "default" };
|
|
508
|
+
}
|
|
509
|
+
function fileOrDefault(key, config) {
|
|
510
|
+
const fromFile = config[key];
|
|
511
|
+
if (fromFile !== void 0) return { value: fromFile, source: "file" };
|
|
512
|
+
return { value: CONFIG_DEFAULTS[key], source: "default" };
|
|
513
|
+
}
|
|
514
|
+
function resolveBaseUrl(config, flags, env) {
|
|
515
|
+
if (flags.baseUrl !== void 0 && flags.baseUrl.length > 0) {
|
|
516
|
+
return { value: flags.baseUrl, source: "flag" };
|
|
517
|
+
}
|
|
518
|
+
const fromEnv = env.TENJIN_BASE_URL;
|
|
519
|
+
if (fromEnv !== void 0 && fromEnv.length > 0) {
|
|
520
|
+
return { value: fromEnv, source: "env" };
|
|
521
|
+
}
|
|
522
|
+
if (config.baseUrl !== void 0) return { value: config.baseUrl, source: "file" };
|
|
523
|
+
return { value: CONFIG_DEFAULTS.baseUrl, source: "default" };
|
|
524
|
+
}
|
|
525
|
+
function isNotFound(err) {
|
|
526
|
+
return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export {
|
|
530
|
+
HARNESSES,
|
|
531
|
+
PublishModeSchema,
|
|
532
|
+
parseAckServerWarnings,
|
|
533
|
+
ROUTER_CONTEXTS,
|
|
534
|
+
parseRouterLayer,
|
|
535
|
+
parsePublicFallbackFlag,
|
|
536
|
+
parseLoopValue,
|
|
537
|
+
parseUpdateModeFlag,
|
|
538
|
+
RawConfigSchema,
|
|
539
|
+
SEND_MAX_UNSET,
|
|
540
|
+
DEFAULT_MAX_AUTO_SPEND,
|
|
541
|
+
DEFAULT_SESSION_BUDGET,
|
|
542
|
+
MAX_AUTO_SPEND_FLOOR_ATOMIC,
|
|
543
|
+
MAX_AUTO_SPEND_FLOOR_WHY,
|
|
544
|
+
CONFIG_DEFAULTS,
|
|
545
|
+
CONFIG_KEYS,
|
|
546
|
+
PUBLISH_CONFIG_KEYS,
|
|
547
|
+
HOOKS_CONFIG_KEYS,
|
|
548
|
+
UPDATE_CONFIG_KEYS,
|
|
549
|
+
LOOP_CONFIG_KEYS,
|
|
550
|
+
TEAM_CONFIG_KEYS,
|
|
551
|
+
EXPERIMENTAL_CONFIG_KEYS,
|
|
552
|
+
ROUTER_CONFIG_KEYS,
|
|
553
|
+
RETIRED_PAYMENT_GUIDANCE,
|
|
554
|
+
retiredPaymentKeys,
|
|
555
|
+
loadRawConfig,
|
|
556
|
+
loadConfig,
|
|
557
|
+
resolveSettings,
|
|
558
|
+
resolveExperimentalBazaar
|
|
559
|
+
};
|
|
560
|
+
//# sourceMappingURL=chunk-2M2VPI2E.js.map
|