tenjin-cli 0.1.0-alpha.12 → 0.1.0-alpha.13
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 +1 -0
- package/dist/{buy-3DTBFZ4B.js → buy-X4VPHFUA.js} +20 -20
- package/dist/{chunk-V5UHKC46.js → chunk-3NZCU6SD.js} +7 -7
- package/dist/{chunk-Y7ERTA7D.js → chunk-3P3ES4XU.js} +4 -6
- package/dist/chunk-3P3ES4XU.js.map +1 -0
- package/dist/{chunk-OZHJ3FLR.js → chunk-47YKYDOF.js} +5 -5
- package/dist/{chunk-WWIKAJFO.js → chunk-6JKD46OJ.js} +12 -10
- package/dist/{chunk-WWIKAJFO.js.map → chunk-6JKD46OJ.js.map} +1 -1
- package/dist/chunk-736DW4V3.js +65 -0
- package/dist/chunk-736DW4V3.js.map +1 -0
- package/dist/{chunk-IB63U6BM.js → chunk-B676GPS2.js} +34 -11
- package/dist/chunk-B676GPS2.js.map +1 -0
- package/dist/{chunk-4NTZETIL.js → chunk-BRAVLUGI.js} +2 -2
- package/dist/{chunk-HWHYPCCH.js → chunk-CA3JV7FX.js} +2 -2
- package/dist/{chunk-HWHYPCCH.js.map → chunk-CA3JV7FX.js.map} +1 -1
- package/dist/{chunk-ALUNME53.js → chunk-ELVDOTU7.js} +50 -66
- package/dist/chunk-ELVDOTU7.js.map +1 -0
- package/dist/{chunk-ILDVGY7K.js → chunk-GCGMXA2O.js} +13 -11
- package/dist/{chunk-ILDVGY7K.js.map → chunk-GCGMXA2O.js.map} +1 -1
- package/dist/{chunk-L3I2MVKR.js → chunk-IAR25V2E.js} +6 -6
- package/dist/{chunk-6UY2UQMY.js → chunk-IFPKA32J.js} +4 -4
- package/dist/{chunk-JTYIX6OD.js → chunk-IGHSLJUF.js} +6 -4
- package/dist/{chunk-JTYIX6OD.js.map → chunk-IGHSLJUF.js.map} +1 -1
- package/dist/{chunk-7MJVNALU.js → chunk-IKAJSA7E.js} +12 -10
- package/dist/{chunk-7MJVNALU.js.map → chunk-IKAJSA7E.js.map} +1 -1
- package/dist/{chunk-NUF2PKJO.js → chunk-J6FUAIRR.js} +4 -6
- package/dist/{chunk-NUF2PKJO.js.map → chunk-J6FUAIRR.js.map} +1 -1
- package/dist/{chunk-CNUXRXI2.js → chunk-JVBMPU5G.js} +5 -7
- package/dist/{chunk-CNUXRXI2.js.map → chunk-JVBMPU5G.js.map} +1 -1
- package/dist/{chunk-6RMEX74N.js → chunk-L4XNT3UW.js} +21 -16
- package/dist/chunk-L4XNT3UW.js.map +1 -0
- package/dist/{chunk-X2WZPGCF.js → chunk-NKN4YC5C.js} +5 -5
- package/dist/{chunk-P74I3WH4.js → chunk-OC3EIDCP.js} +3 -5
- package/dist/{chunk-P74I3WH4.js.map → chunk-OC3EIDCP.js.map} +1 -1
- package/dist/{chunk-E6YOODH7.js → chunk-OE36HRWG.js} +31 -5
- package/dist/{chunk-E6YOODH7.js.map → chunk-OE36HRWG.js.map} +1 -1
- package/dist/chunk-OUJDDY5L.js +189 -0
- package/dist/chunk-OUJDDY5L.js.map +1 -0
- package/dist/{chunk-6BGYHARE.js → chunk-OWVVI4VQ.js} +15 -15
- package/dist/{chunk-4TCU3YRD.js → chunk-OXUJ3FXU.js} +5 -1
- package/dist/{chunk-4TCU3YRD.js.map → chunk-OXUJ3FXU.js.map} +1 -1
- package/dist/{chunk-PZRAAAY2.js → chunk-PAOVPSP6.js} +10 -3
- package/dist/chunk-PAOVPSP6.js.map +1 -0
- package/dist/{chunk-TUXKOIOU.js → chunk-SPUORKD7.js} +3 -3
- package/dist/{chunk-UFPJBS4C.js → chunk-T4UWMVKV.js} +9 -7
- package/dist/{chunk-UFPJBS4C.js.map → chunk-T4UWMVKV.js.map} +1 -1
- package/dist/{chunk-CLOEU7RA.js → chunk-TXVC46SA.js} +8 -8
- package/dist/{chunk-SFGXAZ3M.js → chunk-UUARTUY2.js} +42 -9
- package/dist/chunk-UUARTUY2.js.map +1 -0
- package/dist/{chunk-ROAK2DOX.js → chunk-WMFRCSNC.js} +8 -8
- package/dist/{chunk-TDDN5GXR.js → chunk-WU5CZPLD.js} +5 -5
- package/dist/{chunk-RSBN67PA.js → chunk-WVHPGQH5.js} +4 -6
- package/dist/{chunk-RSBN67PA.js.map → chunk-WVHPGQH5.js.map} +1 -1
- package/dist/{chunk-PZSUWDF2.js → chunk-XGZ5EVMB.js} +2 -2
- package/dist/{chunk-MBKFZBB2.js → chunk-XXY77EZJ.js} +24 -24
- package/dist/{chunk-CBNXUQGM.js → chunk-YMUJZWHB.js} +10 -8
- package/dist/{chunk-CBNXUQGM.js.map → chunk-YMUJZWHB.js.map} +1 -1
- package/dist/{cli-3WZGLZDP.js → cli-XK5JZWU6.js} +51 -146
- package/dist/cli-XK5JZWU6.js.map +1 -0
- package/dist/{config-WDGMZKHU.js → config-CNK7MYUR.js} +7 -7
- package/dist/doctor-R7N7FUX5.js +27 -0
- package/dist/{edit-4UZQVFCK.js → edit-QSUEG7CL.js} +19 -19
- package/dist/{fund-JAPOFTUG.js → fund-JF6A76YS.js} +16 -16
- package/dist/index.js +1 -1
- package/dist/{inspect-IEV75A42.js → inspect-NFNAA4LA.js} +17 -17
- package/dist/{install-WXTOHDWC.js → install-YQVM3SUW.js} +20 -21
- package/dist/{install-WXTOHDWC.js.map → install-YQVM3SUW.js.map} +1 -1
- package/dist/outcome-IUSYFJTN.js +22 -0
- package/dist/{publish-6QNARH7E.js → publish-O2I6IAEL.js} +20 -20
- package/dist/{read-UAZGZ4UL.js → read-UF7QVQOU.js} +21 -21
- package/dist/{run-AJNCOT5R.js → run-GDZWHNWZ.js} +30 -30
- package/dist/search-JVOHEF3E.js +23 -0
- package/dist/{send-F34ZDXDZ.js → send-SI254H3R.js} +11 -10
- package/dist/{send-F34ZDXDZ.js.map → send-SI254H3R.js.map} +1 -1
- package/dist/{session-4N4ZT3AH.js → session-GJZJEXLJ.js} +14 -14
- package/dist/{skill-heal-XBEK272G.js → skill-heal-BPFT22XS.js} +5 -6
- package/dist/{skill-heal-XBEK272G.js.map → skill-heal-BPFT22XS.js.map} +1 -1
- package/dist/{uninstall-BTKPHPDL.js → uninstall-7ZZG6WQ5.js} +6 -7
- package/dist/{uninstall-BTKPHPDL.js.map → uninstall-7ZZG6WQ5.js.map} +1 -1
- package/dist/update-FPSBITLB.js +315 -0
- package/dist/update-FPSBITLB.js.map +1 -0
- package/dist/{wallet-UL4P2JRO.js → wallet-NS7TYWNN.js} +5 -6
- package/dist/{wallet-WJ6UP5OU.js → wallet-TZVD2M4I.js} +9 -9
- package/docs/agent-permissions.md +11 -0
- package/docs/command-reference.md +47 -0
- package/package.json +1 -1
- package/skills/tenjin-publish/SKILL.md +15 -2
- package/dist/chunk-2I4QTOLB.js +0 -11
- package/dist/chunk-2I4QTOLB.js.map +0 -1
- package/dist/chunk-6RMEX74N.js.map +0 -1
- package/dist/chunk-ALUNME53.js.map +0 -1
- package/dist/chunk-IB63U6BM.js.map +0 -1
- package/dist/chunk-PZRAAAY2.js.map +0 -1
- package/dist/chunk-SFGXAZ3M.js.map +0 -1
- package/dist/chunk-Y7ERTA7D.js.map +0 -1
- package/dist/cli-3WZGLZDP.js.map +0 -1
- package/dist/doctor-EKVCP7JP.js +0 -27
- package/dist/outcome-FYOFDOUK.js +0 -22
- package/dist/search-EEKTW6VK.js +0 -23
- /package/dist/{buy-3DTBFZ4B.js.map → buy-X4VPHFUA.js.map} +0 -0
- /package/dist/{chunk-V5UHKC46.js.map → chunk-3NZCU6SD.js.map} +0 -0
- /package/dist/{chunk-OZHJ3FLR.js.map → chunk-47YKYDOF.js.map} +0 -0
- /package/dist/{chunk-4NTZETIL.js.map → chunk-BRAVLUGI.js.map} +0 -0
- /package/dist/{chunk-L3I2MVKR.js.map → chunk-IAR25V2E.js.map} +0 -0
- /package/dist/{chunk-6UY2UQMY.js.map → chunk-IFPKA32J.js.map} +0 -0
- /package/dist/{chunk-X2WZPGCF.js.map → chunk-NKN4YC5C.js.map} +0 -0
- /package/dist/{chunk-6BGYHARE.js.map → chunk-OWVVI4VQ.js.map} +0 -0
- /package/dist/{chunk-TUXKOIOU.js.map → chunk-SPUORKD7.js.map} +0 -0
- /package/dist/{chunk-CLOEU7RA.js.map → chunk-TXVC46SA.js.map} +0 -0
- /package/dist/{chunk-ROAK2DOX.js.map → chunk-WMFRCSNC.js.map} +0 -0
- /package/dist/{chunk-TDDN5GXR.js.map → chunk-WU5CZPLD.js.map} +0 -0
- /package/dist/{chunk-PZSUWDF2.js.map → chunk-XGZ5EVMB.js.map} +0 -0
- /package/dist/{chunk-MBKFZBB2.js.map → chunk-XXY77EZJ.js.map} +0 -0
- /package/dist/{config-WDGMZKHU.js.map → config-CNK7MYUR.js.map} +0 -0
- /package/dist/{doctor-EKVCP7JP.js.map → doctor-R7N7FUX5.js.map} +0 -0
- /package/dist/{edit-4UZQVFCK.js.map → edit-QSUEG7CL.js.map} +0 -0
- /package/dist/{fund-JAPOFTUG.js.map → fund-JF6A76YS.js.map} +0 -0
- /package/dist/{inspect-IEV75A42.js.map → inspect-NFNAA4LA.js.map} +0 -0
- /package/dist/{outcome-FYOFDOUK.js.map → outcome-IUSYFJTN.js.map} +0 -0
- /package/dist/{publish-6QNARH7E.js.map → publish-O2I6IAEL.js.map} +0 -0
- /package/dist/{read-UAZGZ4UL.js.map → read-UF7QVQOU.js.map} +0 -0
- /package/dist/{run-AJNCOT5R.js.map → run-GDZWHNWZ.js.map} +0 -0
- /package/dist/{search-EEKTW6VK.js.map → search-JVOHEF3E.js.map} +0 -0
- /package/dist/{session-4N4ZT3AH.js.map → session-GJZJEXLJ.js.map} +0 -0
- /package/dist/{wallet-UL4P2JRO.js.map → wallet-NS7TYWNN.js.map} +0 -0
- /package/dist/{wallet-WJ6UP5OU.js.map → wallet-TZVD2M4I.js.map} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runOutcome
|
|
4
|
+
} from "./chunk-3NZCU6SD.js";
|
|
5
|
+
import "./chunk-BRAVLUGI.js";
|
|
6
|
+
import "./chunk-NKN4YC5C.js";
|
|
7
|
+
import "./chunk-SPUORKD7.js";
|
|
8
|
+
import "./chunk-XGZ5EVMB.js";
|
|
9
|
+
import "./chunk-CA3JV7FX.js";
|
|
10
|
+
import "./chunk-B676GPS2.js";
|
|
11
|
+
import "./chunk-IGHSLJUF.js";
|
|
12
|
+
import "./chunk-FKSAUOJU.js";
|
|
13
|
+
import "./chunk-736DW4V3.js";
|
|
14
|
+
import "./chunk-ELVDOTU7.js";
|
|
15
|
+
import "./chunk-ZQIQ55KK.js";
|
|
16
|
+
import "./chunk-OC3EIDCP.js";
|
|
17
|
+
import "./chunk-PAOVPSP6.js";
|
|
18
|
+
import "./chunk-ZXTAQYNA.js";
|
|
19
|
+
export {
|
|
20
|
+
runOutcome
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=outcome-IUSYFJTN.js.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
runPublish
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-IKAJSA7E.js";
|
|
5
|
+
import "./chunk-GCGMXA2O.js";
|
|
6
|
+
import "./chunk-WU5CZPLD.js";
|
|
6
7
|
import "./chunk-SGK2B724.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-TDDN5GXR.js";
|
|
10
|
-
import "./chunk-6BGYHARE.js";
|
|
8
|
+
import "./chunk-OWVVI4VQ.js";
|
|
9
|
+
import "./chunk-KZAAWQNP.js";
|
|
11
10
|
import "./chunk-S5RYMCV6.js";
|
|
12
11
|
import "./chunk-POJRB2AE.js";
|
|
13
12
|
import "./chunk-YLYINX2H.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-BRAVLUGI.js";
|
|
14
|
+
import "./chunk-NKN4YC5C.js";
|
|
15
|
+
import "./chunk-JVBMPU5G.js";
|
|
16
|
+
import "./chunk-J6FUAIRR.js";
|
|
17
|
+
import "./chunk-SPUORKD7.js";
|
|
18
|
+
import "./chunk-XGZ5EVMB.js";
|
|
19
|
+
import "./chunk-3P3ES4XU.js";
|
|
20
|
+
import "./chunk-CA3JV7FX.js";
|
|
21
|
+
import "./chunk-B676GPS2.js";
|
|
22
|
+
import "./chunk-IGHSLJUF.js";
|
|
23
23
|
import "./chunk-FKSAUOJU.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-736DW4V3.js";
|
|
25
|
+
import "./chunk-ELVDOTU7.js";
|
|
25
26
|
import "./chunk-ZQIQ55KK.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-PZRAAAY2.js";
|
|
27
|
+
import "./chunk-OC3EIDCP.js";
|
|
28
|
+
import "./chunk-PAOVPSP6.js";
|
|
29
29
|
import "./chunk-M2O56UK7.js";
|
|
30
30
|
import "./chunk-UHTVXQ2O.js";
|
|
31
31
|
import "./chunk-W6R3HAAG.js";
|
|
@@ -37,4 +37,4 @@ import "./chunk-ZXTAQYNA.js";
|
|
|
37
37
|
export {
|
|
38
38
|
runPublish
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=publish-
|
|
40
|
+
//# sourceMappingURL=publish-O2I6IAEL.js.map
|
|
@@ -3,50 +3,50 @@ import {
|
|
|
3
3
|
deliverExisting,
|
|
4
4
|
deliverFresh,
|
|
5
5
|
parseSectionsBudget
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-47YKYDOF.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchRead
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WMFRCSNC.js";
|
|
10
10
|
import "./chunk-SGK2B724.js";
|
|
11
|
+
import "./chunk-OWVVI4VQ.js";
|
|
12
|
+
import "./chunk-KZAAWQNP.js";
|
|
13
|
+
import "./chunk-S5RYMCV6.js";
|
|
14
|
+
import "./chunk-POJRB2AE.js";
|
|
15
|
+
import "./chunk-YLYINX2H.js";
|
|
11
16
|
import {
|
|
12
17
|
findDelivered,
|
|
13
18
|
findDeliveredByUrl,
|
|
14
19
|
resolveResourceRef
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-6BGYHARE.js";
|
|
19
|
-
import "./chunk-S5RYMCV6.js";
|
|
20
|
-
import "./chunk-POJRB2AE.js";
|
|
21
|
-
import "./chunk-YLYINX2H.js";
|
|
22
|
-
import "./chunk-TUXKOIOU.js";
|
|
23
|
-
import "./chunk-HWHYPCCH.js";
|
|
20
|
+
} from "./chunk-IFPKA32J.js";
|
|
21
|
+
import "./chunk-BRAVLUGI.js";
|
|
22
|
+
import "./chunk-NKN4YC5C.js";
|
|
24
23
|
import {
|
|
25
24
|
isSessionPresentable,
|
|
26
25
|
loadSessionFile,
|
|
27
26
|
signWithSession
|
|
28
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-J6FUAIRR.js";
|
|
28
|
+
import "./chunk-SPUORKD7.js";
|
|
29
29
|
import {
|
|
30
30
|
originOf
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-XGZ5EVMB.js";
|
|
32
|
+
import "./chunk-CA3JV7FX.js";
|
|
33
33
|
import {
|
|
34
34
|
sanitizeForTerminal
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-B676GPS2.js";
|
|
36
36
|
import {
|
|
37
37
|
resolveContextSettings
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-IGHSLJUF.js";
|
|
39
39
|
import "./chunk-FKSAUOJU.js";
|
|
40
40
|
import {
|
|
41
41
|
formatUsdDisplay,
|
|
42
42
|
toMoney
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-736DW4V3.js";
|
|
44
|
+
import "./chunk-ELVDOTU7.js";
|
|
44
45
|
import "./chunk-ZQIQ55KK.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-2I4QTOLB.js";
|
|
46
|
+
import "./chunk-OC3EIDCP.js";
|
|
47
47
|
import {
|
|
48
48
|
CliError
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-PAOVPSP6.js";
|
|
50
50
|
import "./chunk-UHTVXQ2O.js";
|
|
51
51
|
import "./chunk-W6R3HAAG.js";
|
|
52
52
|
import "./chunk-XJN5WUKL.js";
|
|
@@ -155,4 +155,4 @@ function refusal(ref, requirement, check) {
|
|
|
155
155
|
export {
|
|
156
156
|
runRead
|
|
157
157
|
};
|
|
158
|
-
//# sourceMappingURL=read-
|
|
158
|
+
//# sourceMappingURL=read-UF7QVQOU.js.map
|
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
runBuy
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XXY77EZJ.js";
|
|
5
5
|
import {
|
|
6
6
|
runPublish
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IKAJSA7E.js";
|
|
8
8
|
import {
|
|
9
9
|
runEdit
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-YMUJZWHB.js";
|
|
11
|
+
import "./chunk-GCGMXA2O.js";
|
|
12
12
|
import {
|
|
13
13
|
runOutcome
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3NZCU6SD.js";
|
|
15
15
|
import {
|
|
16
16
|
runFund
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6JKD46OJ.js";
|
|
18
|
+
import "./chunk-WU5CZPLD.js";
|
|
18
19
|
import "./chunk-QW2Q2KAH.js";
|
|
19
20
|
import {
|
|
20
21
|
runSearch
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TXVC46SA.js";
|
|
22
23
|
import {
|
|
23
24
|
runInspect
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-IAR25V2E.js";
|
|
26
|
+
import "./chunk-47YKYDOF.js";
|
|
27
|
+
import "./chunk-WMFRCSNC.js";
|
|
27
28
|
import "./chunk-SGK2B724.js";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-X2WZPGCF.js";
|
|
31
|
-
import "./chunk-TDDN5GXR.js";
|
|
32
|
-
import "./chunk-6BGYHARE.js";
|
|
29
|
+
import "./chunk-OWVVI4VQ.js";
|
|
30
|
+
import "./chunk-KZAAWQNP.js";
|
|
33
31
|
import "./chunk-S5RYMCV6.js";
|
|
34
32
|
import "./chunk-POJRB2AE.js";
|
|
35
33
|
import "./chunk-YLYINX2H.js";
|
|
34
|
+
import "./chunk-IFPKA32J.js";
|
|
35
|
+
import "./chunk-BRAVLUGI.js";
|
|
36
|
+
import "./chunk-NKN4YC5C.js";
|
|
36
37
|
import {
|
|
37
38
|
runWalletBalance,
|
|
38
39
|
runWalletCreate,
|
|
39
40
|
runWalletShow
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-T4UWMVKV.js";
|
|
41
42
|
import "./chunk-MJZZTKCC.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-JVBMPU5G.js";
|
|
44
|
+
import "./chunk-J6FUAIRR.js";
|
|
45
|
+
import "./chunk-SPUORKD7.js";
|
|
46
|
+
import "./chunk-XGZ5EVMB.js";
|
|
47
|
+
import "./chunk-3P3ES4XU.js";
|
|
44
48
|
import {
|
|
45
49
|
package_default
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-NUF2PKJO.js";
|
|
48
|
-
import "./chunk-PZSUWDF2.js";
|
|
49
|
-
import "./chunk-Y7ERTA7D.js";
|
|
50
|
-
import "./chunk-KZAAWQNP.js";
|
|
50
|
+
} from "./chunk-CA3JV7FX.js";
|
|
51
51
|
import {
|
|
52
52
|
buildFailureEnvelope,
|
|
53
53
|
buildSuccessEnvelope,
|
|
54
54
|
normalizeError
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
55
|
+
} from "./chunk-B676GPS2.js";
|
|
56
|
+
import "./chunk-IGHSLJUF.js";
|
|
57
57
|
import "./chunk-FKSAUOJU.js";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-736DW4V3.js";
|
|
59
|
+
import "./chunk-ELVDOTU7.js";
|
|
59
60
|
import {
|
|
60
61
|
dataDir
|
|
61
62
|
} from "./chunk-ZQIQ55KK.js";
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-2I4QTOLB.js";
|
|
63
|
+
import "./chunk-OC3EIDCP.js";
|
|
64
64
|
import {
|
|
65
65
|
$ZodObject,
|
|
66
66
|
$ZodType,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
toJSONSchema,
|
|
94
94
|
union,
|
|
95
95
|
unknown
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-PAOVPSP6.js";
|
|
97
97
|
import "./chunk-7FK2UN2T.js";
|
|
98
98
|
import "./chunk-M2O56UK7.js";
|
|
99
99
|
import "./chunk-UHTVXQ2O.js";
|
|
@@ -16880,4 +16880,4 @@ async function runMcpServer(opts = {}) {
|
|
|
16880
16880
|
export {
|
|
16881
16881
|
runMcpServer
|
|
16882
16882
|
};
|
|
16883
|
-
//# sourceMappingURL=run-
|
|
16883
|
+
//# sourceMappingURL=run-GDZWHNWZ.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runSearch
|
|
4
|
+
} from "./chunk-TXVC46SA.js";
|
|
5
|
+
import "./chunk-IFPKA32J.js";
|
|
6
|
+
import "./chunk-BRAVLUGI.js";
|
|
7
|
+
import "./chunk-NKN4YC5C.js";
|
|
8
|
+
import "./chunk-SPUORKD7.js";
|
|
9
|
+
import "./chunk-XGZ5EVMB.js";
|
|
10
|
+
import "./chunk-CA3JV7FX.js";
|
|
11
|
+
import "./chunk-B676GPS2.js";
|
|
12
|
+
import "./chunk-IGHSLJUF.js";
|
|
13
|
+
import "./chunk-FKSAUOJU.js";
|
|
14
|
+
import "./chunk-736DW4V3.js";
|
|
15
|
+
import "./chunk-ELVDOTU7.js";
|
|
16
|
+
import "./chunk-ZQIQ55KK.js";
|
|
17
|
+
import "./chunk-OC3EIDCP.js";
|
|
18
|
+
import "./chunk-PAOVPSP6.js";
|
|
19
|
+
import "./chunk-ZXTAQYNA.js";
|
|
20
|
+
export {
|
|
21
|
+
runSearch
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=search-JVOHEF3E.js.map
|
|
@@ -14,24 +14,25 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
describeWallet,
|
|
16
16
|
resolveWalletProvider
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-JVBMPU5G.js";
|
|
18
|
+
import "./chunk-3P3ES4XU.js";
|
|
19
|
+
import "./chunk-B676GPS2.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveContextSettings
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IGHSLJUF.js";
|
|
23
23
|
import "./chunk-FKSAUOJU.js";
|
|
24
24
|
import {
|
|
25
|
-
SEND_MAX_UNSET,
|
|
26
25
|
parseUsdToAtomic,
|
|
27
26
|
toMoney
|
|
28
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-736DW4V3.js";
|
|
28
|
+
import {
|
|
29
|
+
SEND_MAX_UNSET
|
|
30
|
+
} from "./chunk-ELVDOTU7.js";
|
|
29
31
|
import "./chunk-ZQIQ55KK.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-2I4QTOLB.js";
|
|
32
|
+
import "./chunk-OC3EIDCP.js";
|
|
32
33
|
import {
|
|
33
34
|
CliError
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-PAOVPSP6.js";
|
|
35
36
|
import "./chunk-7FK2UN2T.js";
|
|
36
37
|
import "./chunk-M2O56UK7.js";
|
|
37
38
|
import "./chunk-UHTVXQ2O.js";
|
|
@@ -220,4 +221,4 @@ This moves funds out of the agent wallet and cannot be undone. [y/N] `;
|
|
|
220
221
|
export {
|
|
221
222
|
runSend
|
|
222
223
|
};
|
|
223
|
-
//# sourceMappingURL=send-
|
|
224
|
+
//# sourceMappingURL=send-SI254H3R.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/send.ts"],"sourcesContent":["import { formatEther, getAddress, isAddress, type Address } from 'viem';\nimport { SEND_MAX_UNSET } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { parseUsdToAtomic, toMoney } from '../lib/money';\nimport { promptYesNo } from '../lib/prompt';\nimport { resolveContextSettings } from '../lib/settings';\nimport {\n broadcastUsdcSend,\n FeeCapExceededError,\n getUsdcBalance,\n prepareUsdcSend,\n SendPendingError,\n SendRevertedError,\n USDC_ADDRESS,\n} from '../lib/usdc';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin send <amount> <token> <to>`: the escape hatch that moves funds OUT of\n * the agent wallet, complementary to delegation (which redirects future revenue\n * off the hot key; this is for a balance already on it). Invariants a reader\n * cannot derive from the code order alone:\n * - the confirm (buy's posture: interactive y/N, `--yes` bypasses the prompt\n * only, headless without it refuses) runs BEFORE the signer is resolved, so\n * no refusal branch ever touches key material;\n * - `sendMaxAmount` is a spend-policy gate, NOT satisfiable by --yes, and it\n * has NO default: unset refuses until `config set sendMaxAmount` is run\n * (require-set-before-first-send; \"none\" is an explicit uncapped opt-in);\n * - the verb is deliberately absent from the MCP toolset (spec 10's narrow\n * toolset) and the skill adapters — human-invoked only, both pinned by tests.\n */\n\nexport interface SendArgs {\n /** Decimal USD at the edge (O1 convention); converted to atomic exactly once. */\n amount: string;\n token: string;\n /** Recipient address, 0x-prefixed; checksummed or all-lowercase. */\n to: string;\n /** Skip the interactive confirm. REQUIRED to send when not at a TTY. */\n yes?: boolean;\n}\n\nexport interface SendDeps {\n /** Test seam: bypass the local wallet provider. */\n provider?: WalletProvider;\n /** Interactive-confirm seam; defaults to a TTY y/n prompt (same shape as buy). */\n confirm?: (prompt: string) => Promise<boolean>;\n}\n\nconst ZERO_ADDRESS: Address = '0x0000000000000000000000000000000000000000';\nconst DEAD_ADDRESS: Address = '0x000000000000000000000000000000000000dEaD';\n\nexport async function runSend(\n args: SendArgs,\n ctx: CommandContext,\n deps: SendDeps = {},\n): Promise<CommandResult> {\n requireUsdc(args.token);\n const amountAtomic = BigInt(parseUsdToAtomic(args.amount));\n if (amountAtomic === 0n) {\n throw new CliError('USAGE', 'The send amount must be greater than zero.', {\n fix: 'Pass a positive decimal USDC amount, e.g. `tenjin send 5 usdc <to>`.',\n });\n }\n const to = parseRecipient(args.to);\n\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // Address + posture only; surfaces WALLET_MISSING. No key material yet.\n const desc = await describeWallet(provider);\n if (to.toLowerCase() === desc.address.toLowerCase()) {\n throw new CliError('USAGE', 'The recipient is this wallet itself.', {\n fix: 'Pass the destination wallet address, not the sending one.',\n });\n }\n\n const { rpcUrl, sendMaxAmountAtomic } = await resolveContextSettings(ctx);\n enforceSendCap(amountAtomic, sendMaxAmountAtomic);\n\n let balance: bigint;\n try {\n balance = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (amountAtomic > balance) {\n throw new CliError('REFUSED', 'The amount exceeds the wallet USDC balance.', {\n fix: 'Check `tenjin wallet balance` and send at most that amount.',\n details: {\n requested: toMoney(amountAtomic.toString()),\n balance: toMoney(balance.toString()),\n },\n });\n }\n\n // Read-only chain prep before the confirm, so the prompt can show the fee and\n // a wallet without gas refuses before asking anyone to approve anything.\n let prepared;\n try {\n prepared = await prepareUsdcSend({ from: desc.address, to, amountAtomic, rpcUrl });\n } catch (err) {\n if (err instanceof FeeCapExceededError) {\n throw new CliError('REFUSED', 'The RPC gas/fee estimate is abnormal for Base; refusing.', {\n fix: 'Check `tenjin config get rpcUrl` points at a trusted Base RPC; if the RPC is fine, Base fees are spiking — wait and retry.',\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'Could not prepare the transfer on Base.', {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (prepared.ethBalanceWei < prepared.feeWei) {\n throw new CliError('REFUSED', 'The wallet has no ETH on Base to pay the network fee.', {\n fix: `Send a little ETH on Base to ${desc.address} (about ${formatEther(prepared.feeWei)} ETH needed), then retry.`,\n details: {\n ethBalanceWei: prepared.ethBalanceWei.toString(),\n feeWei: prepared.feeWei.toString(),\n },\n });\n }\n\n const approved = await confirmSend(ctx, deps, args.yes === true, {\n amountAtomic,\n to,\n from: desc.address,\n feeWei: prepared.feeWei,\n });\n if (!approved) {\n throw new CliError('REFUSED', 'Send not confirmed.', {\n fix: 'Verify the recipient and amount, then re-run with --yes to approve this transfer.',\n details: { to, amount: toMoney(amountAtomic.toString()) },\n });\n }\n\n // The only door to the key; a missing passphrase entry refuses here with the\n // provider's coded error. The signer must be the wallet the human just saw:\n // the local provider guarantees it, a hosted one is only trusted after this.\n const signer = await provider.getSigner();\n if (signer.address.toLowerCase() !== desc.address.toLowerCase()) {\n throw new CliError(\n 'PROVIDER_ERROR',\n `The signer address ${signer.address} does not match the confirmed wallet ${desc.address}.`,\n { fix: 'The wallet changed between preview and signing; re-run `tenjin send`.' },\n );\n }\n\n let txHash: string;\n try {\n txHash = await broadcastUsdcSend({ signer, prepared, rpcUrl });\n } catch (err) {\n if (err instanceof SendRevertedError) {\n throw new CliError('SEND_FAILED', 'The transfer was mined but reverted; no USDC moved.', {\n fix: 'Check the transaction on a Base explorer, then retry if the cause is transient.',\n details: { txHash: err.txHash },\n cause: err,\n });\n }\n if (err instanceof SendPendingError) {\n throw new CliError('SEND_FAILED', 'The transfer was broadcast but not confirmed in time.', {\n fix: 'Check the transaction on a Base explorer before retrying: it may still mine, and an immediate retry could double-send.',\n details: { txHash: err.txHash, pending: true },\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'The transfer could not be sent on Base.', {\n fix: 'Check the network and RPC, then retry.',\n cause: err,\n });\n }\n\n const amount = toMoney(amountAtomic.toString());\n return {\n data: { txHash, from: signer.address, to, token: 'USDC', network: 'base', amount },\n humanLines: [`Sent ${amount.usd} USDC on Base to ${to}`, `Tx: ${txHash}`],\n };\n}\n\n/**\n * The hard per-send cap (`config set sendMaxAmount`): a policy gate, not a\n * confirm — no branch here is satisfiable by --yes. There is no default cap:\n * an unset key refuses (require-set-before-first-send), exactly as strict as\n * the set-cap refusals below.\n */\nfunction enforceSendCap(\n amountAtomic: bigint,\n capAtomic: bigint | null | typeof SEND_MAX_UNSET,\n): void {\n if (capAtomic === SEND_MAX_UNSET) {\n throw new CliError(\n 'POLICY_REFUSED',\n 'No sendMaxAmount is configured; a per-send cap must be set before the first send.',\n {\n fix: 'Run `tenjin config set sendMaxAmount <usd>` (or `0` to disable send, or `none` to opt in to uncapped), then retry. --yes does not bypass this.',\n },\n );\n }\n if (capAtomic === null) return;\n if (capAtomic === 0n) {\n throw new CliError('POLICY_REFUSED', 'Sending is disabled by sendMaxAmount = 0.', {\n fix: 'Run `tenjin config set sendMaxAmount <usd|none>` to allow sends.',\n });\n }\n if (amountAtomic > capAtomic) {\n throw new CliError('POLICY_REFUSED', 'The amount exceeds the sendMaxAmount cap.', {\n fix: 'Send a smaller amount, or raise the cap with `tenjin config set sendMaxAmount <usd>`.',\n details: { requested: toMoney(amountAtomic.toString()), cap: toMoney(capAtomic.toString()) },\n });\n }\n}\n\n/** USDC on Base only; anything else is a usage error, not a guess. */\nfunction requireUsdc(token: string): void {\n if (token.trim().toLowerCase() === 'usdc') return;\n throw new CliError('USAGE', `Unsupported token: ${JSON.stringify(token)}`, {\n fix: 'Only USDC on Base is supported: `tenjin send <amount> usdc <to>`.',\n });\n}\n\n/**\n * Validate and resolve the recipient. Strict `isAddress` refuses malformed input\n * and a bad EIP-55 checksum on MIXED-CASE input (all-lowercase input carries no\n * checksum to verify — that limit is inherent to the format); `getAddress` then\n * yields the checksummed form the preview shows and the transfer targets. Known\n * fund-destroying destinations (the USDC contract, the zero address, the burn\n * address) refuse outright.\n */\nfunction parseRecipient(raw: string): Address {\n const trimmed = raw.trim();\n if (!isAddress(trimmed)) {\n throw new CliError('USAGE', `Invalid recipient address: ${JSON.stringify(raw)}`, {\n fix: 'Pass a 0x-prefixed 20-byte address, checksummed or all-lowercase (lowercase skips the checksum typo check).',\n });\n }\n const to = getAddress(trimmed);\n if (to === USDC_ADDRESS || to === ZERO_ADDRESS || to === DEAD_ADDRESS) {\n throw new CliError('USAGE', 'The recipient is a known fund-destroying address.', {\n fix: 'Tokens sent to the token contract, the zero address, or the burn address are unrecoverable. Pass the destination wallet address.',\n });\n }\n return to;\n}\n\ninterface ConfirmDetails {\n amountAtomic: bigint;\n to: Address;\n from: Address;\n feeWei: bigint;\n}\n\n/** Buy's confirm posture; the preview names the resolved recipient, amount, and fee. */\nasync function confirmSend(\n ctx: CommandContext,\n deps: SendDeps,\n yes: boolean,\n d: ConfirmDetails,\n): Promise<boolean> {\n if (yes) return true;\n const prompt =\n `Send ${toMoney(d.amountAtomic.toString()).usd} USDC on Base\\n` +\n ` from ${d.from}\\n` +\n ` to ${d.to}\\n` +\n ` network fee up to ~${formatEther(d.feeWei)} ETH\\n` +\n `This moves funds out of the agent wallet and cannot be undone. [y/N] `;\n if (deps.confirm !== undefined) return deps.confirm(prompt);\n // Both streams must be real TTYs; piped stdin/stdout without --yes refuses.\n if (!ctx.io.isTTY || !process.stdin.isTTY) return false;\n return promptYesNo(prompt);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAM,eAAwB;AAC9B,IAAM,eAAwB;AAE9B,eAAsB,QACpB,MACA,KACA,OAAiB,CAAC,GACM;AACxB,cAAY,KAAK,KAAK;AACtB,QAAM,eAAe,OAAO,iBAAiB,KAAK,MAAM,CAAC;AACzD,MAAI,iBAAiB,IAAI;AACvB,UAAM,IAAI,SAAS,SAAS,8CAA8C;AAAA,MACxE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,KAAK,eAAe,KAAK,EAAE;AAEjC,QAAM,WAAW;AAAA,IACf;AAAA,IACA,KAAK,aAAa,SAAY,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;AAAA,EAC/D;AAEA,QAAM,OAAO,MAAM,eAAe,QAAQ;AAC1C,MAAI,GAAG,YAAY,MAAM,KAAK,QAAQ,YAAY,GAAG;AACnD,UAAM,IAAI,SAAS,SAAS,wCAAwC;AAAA,MAClE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,EAAE,QAAQ,oBAAoB,IAAI,MAAM,uBAAuB,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N,EAAE,EAAE;AAAA,uBACU,YAAY,EAAE,MAAM,CAAC;AAAA;AAE/C,MAAI,KAAK,YAAY,OAAW,QAAO,KAAK,QAAQ,MAAM;AAE1D,MAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,MAAM,MAAO,QAAO;AAClD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/send.ts"],"sourcesContent":["import { formatEther, getAddress, isAddress, type Address } from 'viem';\nimport { SEND_MAX_UNSET } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { parseUsdToAtomic, toMoney } from '../lib/money';\nimport { promptYesNo } from '../lib/prompt';\nimport { resolveContextSettings } from '../lib/settings';\nimport {\n broadcastUsdcSend,\n FeeCapExceededError,\n getUsdcBalance,\n prepareUsdcSend,\n SendPendingError,\n SendRevertedError,\n USDC_ADDRESS,\n} from '../lib/usdc';\nimport { describeWallet, resolveWalletProvider, type WalletProvider } from '../lib/wallet';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin send <amount> <token> <to>`: the escape hatch that moves funds OUT of\n * the agent wallet, complementary to delegation (which redirects future revenue\n * off the hot key; this is for a balance already on it). Invariants a reader\n * cannot derive from the code order alone:\n * - the confirm (buy's posture: interactive y/N, `--yes` bypasses the prompt\n * only, headless without it refuses) runs BEFORE the signer is resolved, so\n * no refusal branch ever touches key material;\n * - `sendMaxAmount` is a spend-policy gate, NOT satisfiable by --yes, and it\n * has NO default: unset refuses until `config set sendMaxAmount` is run\n * (require-set-before-first-send; \"none\" is an explicit uncapped opt-in);\n * - the verb is deliberately absent from the MCP toolset (spec 10's narrow\n * toolset) and the skill adapters — human-invoked only, both pinned by tests.\n */\n\nexport interface SendArgs {\n /** Decimal USD at the edge (O1 convention); converted to atomic exactly once. */\n amount: string;\n token: string;\n /** Recipient address, 0x-prefixed; checksummed or all-lowercase. */\n to: string;\n /** Skip the interactive confirm. REQUIRED to send when not at a TTY. */\n yes?: boolean;\n}\n\nexport interface SendDeps {\n /** Test seam: bypass the local wallet provider. */\n provider?: WalletProvider;\n /** Interactive-confirm seam; defaults to a TTY y/n prompt (same shape as buy). */\n confirm?: (prompt: string) => Promise<boolean>;\n}\n\nconst ZERO_ADDRESS: Address = '0x0000000000000000000000000000000000000000';\nconst DEAD_ADDRESS: Address = '0x000000000000000000000000000000000000dEaD';\n\nexport async function runSend(\n args: SendArgs,\n ctx: CommandContext,\n deps: SendDeps = {},\n): Promise<CommandResult> {\n requireUsdc(args.token);\n const amountAtomic = BigInt(parseUsdToAtomic(args.amount));\n if (amountAtomic === 0n) {\n throw new CliError('USAGE', 'The send amount must be greater than zero.', {\n fix: 'Pass a positive decimal USDC amount, e.g. `tenjin send 5 usdc <to>`.',\n });\n }\n const to = parseRecipient(args.to);\n\n const provider = resolveWalletProvider(\n ctx,\n deps.provider !== undefined ? { provider: deps.provider } : {},\n );\n // Address + posture only; surfaces WALLET_MISSING. No key material yet.\n const desc = await describeWallet(provider);\n if (to.toLowerCase() === desc.address.toLowerCase()) {\n throw new CliError('USAGE', 'The recipient is this wallet itself.', {\n fix: 'Pass the destination wallet address, not the sending one.',\n });\n }\n\n const { rpcUrl, sendMaxAmountAtomic } = await resolveContextSettings(ctx);\n enforceSendCap(amountAtomic, sendMaxAmountAtomic);\n\n let balance: bigint;\n try {\n balance = await getUsdcBalance(desc.address, rpcUrl);\n } catch (err) {\n throw new CliError('RPC_ERROR', `Could not read the USDC balance from ${rpcUrl}.`, {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (amountAtomic > balance) {\n throw new CliError('REFUSED', 'The amount exceeds the wallet USDC balance.', {\n fix: 'Check `tenjin wallet balance` and send at most that amount.',\n details: {\n requested: toMoney(amountAtomic.toString()),\n balance: toMoney(balance.toString()),\n },\n });\n }\n\n // Read-only chain prep before the confirm, so the prompt can show the fee and\n // a wallet without gas refuses before asking anyone to approve anything.\n let prepared;\n try {\n prepared = await prepareUsdcSend({ from: desc.address, to, amountAtomic, rpcUrl });\n } catch (err) {\n if (err instanceof FeeCapExceededError) {\n throw new CliError('REFUSED', 'The RPC gas/fee estimate is abnormal for Base; refusing.', {\n fix: 'Check `tenjin config get rpcUrl` points at a trusted Base RPC; if the RPC is fine, Base fees are spiking — wait and retry.',\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'Could not prepare the transfer on Base.', {\n fix: 'Check your network, or set a working RPC with `tenjin config set rpcUrl <url>`.',\n cause: err,\n });\n }\n if (prepared.ethBalanceWei < prepared.feeWei) {\n throw new CliError('REFUSED', 'The wallet has no ETH on Base to pay the network fee.', {\n fix: `Send a little ETH on Base to ${desc.address} (about ${formatEther(prepared.feeWei)} ETH needed), then retry.`,\n details: {\n ethBalanceWei: prepared.ethBalanceWei.toString(),\n feeWei: prepared.feeWei.toString(),\n },\n });\n }\n\n const approved = await confirmSend(ctx, deps, args.yes === true, {\n amountAtomic,\n to,\n from: desc.address,\n feeWei: prepared.feeWei,\n });\n if (!approved) {\n throw new CliError('REFUSED', 'Send not confirmed.', {\n fix: 'Verify the recipient and amount, then re-run with --yes to approve this transfer.',\n details: { to, amount: toMoney(amountAtomic.toString()) },\n });\n }\n\n // The only door to the key; a missing passphrase entry refuses here with the\n // provider's coded error. The signer must be the wallet the human just saw:\n // the local provider guarantees it, a hosted one is only trusted after this.\n const signer = await provider.getSigner();\n if (signer.address.toLowerCase() !== desc.address.toLowerCase()) {\n throw new CliError(\n 'PROVIDER_ERROR',\n `The signer address ${signer.address} does not match the confirmed wallet ${desc.address}.`,\n { fix: 'The wallet changed between preview and signing; re-run `tenjin send`.' },\n );\n }\n\n let txHash: string;\n try {\n txHash = await broadcastUsdcSend({ signer, prepared, rpcUrl });\n } catch (err) {\n if (err instanceof SendRevertedError) {\n throw new CliError('SEND_FAILED', 'The transfer was mined but reverted; no USDC moved.', {\n fix: 'Check the transaction on a Base explorer, then retry if the cause is transient.',\n details: { txHash: err.txHash },\n cause: err,\n });\n }\n if (err instanceof SendPendingError) {\n throw new CliError('SEND_FAILED', 'The transfer was broadcast but not confirmed in time.', {\n fix: 'Check the transaction on a Base explorer before retrying: it may still mine, and an immediate retry could double-send.',\n details: { txHash: err.txHash, pending: true },\n cause: err,\n });\n }\n throw new CliError('RPC_ERROR', 'The transfer could not be sent on Base.', {\n fix: 'Check the network and RPC, then retry.',\n cause: err,\n });\n }\n\n const amount = toMoney(amountAtomic.toString());\n return {\n data: { txHash, from: signer.address, to, token: 'USDC', network: 'base', amount },\n humanLines: [`Sent ${amount.usd} USDC on Base to ${to}`, `Tx: ${txHash}`],\n };\n}\n\n/**\n * The hard per-send cap (`config set sendMaxAmount`): a policy gate, not a\n * confirm — no branch here is satisfiable by --yes. There is no default cap:\n * an unset key refuses (require-set-before-first-send), exactly as strict as\n * the set-cap refusals below.\n */\nfunction enforceSendCap(\n amountAtomic: bigint,\n capAtomic: bigint | null | typeof SEND_MAX_UNSET,\n): void {\n if (capAtomic === SEND_MAX_UNSET) {\n throw new CliError(\n 'POLICY_REFUSED',\n 'No sendMaxAmount is configured; a per-send cap must be set before the first send.',\n {\n fix: 'Run `tenjin config set sendMaxAmount <usd>` (or `0` to disable send, or `none` to opt in to uncapped), then retry. --yes does not bypass this.',\n },\n );\n }\n if (capAtomic === null) return;\n if (capAtomic === 0n) {\n throw new CliError('POLICY_REFUSED', 'Sending is disabled by sendMaxAmount = 0.', {\n fix: 'Run `tenjin config set sendMaxAmount <usd|none>` to allow sends.',\n });\n }\n if (amountAtomic > capAtomic) {\n throw new CliError('POLICY_REFUSED', 'The amount exceeds the sendMaxAmount cap.', {\n fix: 'Send a smaller amount, or raise the cap with `tenjin config set sendMaxAmount <usd>`.',\n details: { requested: toMoney(amountAtomic.toString()), cap: toMoney(capAtomic.toString()) },\n });\n }\n}\n\n/** USDC on Base only; anything else is a usage error, not a guess. */\nfunction requireUsdc(token: string): void {\n if (token.trim().toLowerCase() === 'usdc') return;\n throw new CliError('USAGE', `Unsupported token: ${JSON.stringify(token)}`, {\n fix: 'Only USDC on Base is supported: `tenjin send <amount> usdc <to>`.',\n });\n}\n\n/**\n * Validate and resolve the recipient. Strict `isAddress` refuses malformed input\n * and a bad EIP-55 checksum on MIXED-CASE input (all-lowercase input carries no\n * checksum to verify — that limit is inherent to the format); `getAddress` then\n * yields the checksummed form the preview shows and the transfer targets. Known\n * fund-destroying destinations (the USDC contract, the zero address, the burn\n * address) refuse outright.\n */\nfunction parseRecipient(raw: string): Address {\n const trimmed = raw.trim();\n if (!isAddress(trimmed)) {\n throw new CliError('USAGE', `Invalid recipient address: ${JSON.stringify(raw)}`, {\n fix: 'Pass a 0x-prefixed 20-byte address, checksummed or all-lowercase (lowercase skips the checksum typo check).',\n });\n }\n const to = getAddress(trimmed);\n if (to === USDC_ADDRESS || to === ZERO_ADDRESS || to === DEAD_ADDRESS) {\n throw new CliError('USAGE', 'The recipient is a known fund-destroying address.', {\n fix: 'Tokens sent to the token contract, the zero address, or the burn address are unrecoverable. Pass the destination wallet address.',\n });\n }\n return to;\n}\n\ninterface ConfirmDetails {\n amountAtomic: bigint;\n to: Address;\n from: Address;\n feeWei: bigint;\n}\n\n/** Buy's confirm posture; the preview names the resolved recipient, amount, and fee. */\nasync function confirmSend(\n ctx: CommandContext,\n deps: SendDeps,\n yes: boolean,\n d: ConfirmDetails,\n): Promise<boolean> {\n if (yes) return true;\n const prompt =\n `Send ${toMoney(d.amountAtomic.toString()).usd} USDC on Base\\n` +\n ` from ${d.from}\\n` +\n ` to ${d.to}\\n` +\n ` network fee up to ~${formatEther(d.feeWei)} ETH\\n` +\n `This moves funds out of the agent wallet and cannot be undone. [y/N] `;\n if (deps.confirm !== undefined) return deps.confirm(prompt);\n // Both streams must be real TTYs; piped stdin/stdout without --yes refuses.\n if (!ctx.io.isTTY || !process.stdin.isTTY) return false;\n return promptYesNo(prompt);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,I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S,SAAS,sBAAsB,KAAK,UAAU,KAAK,CAAC,IAAI;AAAA,IACzE,KAAK;AAAA,EACP,CAAC;AACH;AAUA,SAAS,eAAe,KAAsB;AAC5C,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,CAAC,UAAU,OAAO,GAAG;AACvB,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,GAAG,CAAC,IAAI;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,KAAK,WAAW,OAAO;AAC7B,MAAI,OAAO,gBAAgB,OAAO,gBAAgB,OAAO,cAAc;AACrE,UAAM,IAAI,SAAS,SAAS,qDAAqD;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAUA,eAAe,YACb,KACA,MACA,KACA,GACkB;AAClB,MAAI,IAAK,QAAO;AAChB,QAAM,SACJ,QAAQ,QAAQ,EAAE,aAAa,SAAS,CAAC,EAAE,GAAG;AAAA,SACpC,EAAE,IAAI;AAAA,SACN,EAAE,EAAE;AAAA,uBACU,YAAY,EAAE,MAAM,CAAC;AAAA;AAE/C,MAAI,KAAK,YAAY,OAAW,QAAO,KAAK,QAAQ,MAAM;AAE1D,MAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,MAAM,MAAO,QAAO;AAClD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
|
|
@@ -2,36 +2,36 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
SESSION_CHAIN_ID,
|
|
4
4
|
establishSession
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-WU5CZPLD.js";
|
|
6
|
+
import "./chunk-OWVVI4VQ.js";
|
|
7
|
+
import "./chunk-KZAAWQNP.js";
|
|
7
8
|
import "./chunk-S5RYMCV6.js";
|
|
8
9
|
import "./chunk-POJRB2AE.js";
|
|
9
10
|
import "./chunk-YLYINX2H.js";
|
|
10
11
|
import {
|
|
11
12
|
describeWallet,
|
|
12
13
|
resolveWalletProvider
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JVBMPU5G.js";
|
|
14
15
|
import {
|
|
15
16
|
isSessionUsable,
|
|
16
17
|
loadSessionFile
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-J6FUAIRR.js";
|
|
18
19
|
import {
|
|
19
20
|
originOf
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-IB63U6BM.js";
|
|
21
|
+
} from "./chunk-XGZ5EVMB.js";
|
|
22
|
+
import "./chunk-3P3ES4XU.js";
|
|
23
|
+
import "./chunk-B676GPS2.js";
|
|
24
24
|
import {
|
|
25
25
|
resolveContextSettings
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IGHSLJUF.js";
|
|
27
27
|
import "./chunk-FKSAUOJU.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-736DW4V3.js";
|
|
29
|
+
import "./chunk-ELVDOTU7.js";
|
|
29
30
|
import "./chunk-ZQIQ55KK.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-2I4QTOLB.js";
|
|
31
|
+
import "./chunk-OC3EIDCP.js";
|
|
32
32
|
import {
|
|
33
33
|
CliError
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-PAOVPSP6.js";
|
|
35
35
|
import "./chunk-M2O56UK7.js";
|
|
36
36
|
import "./chunk-UHTVXQ2O.js";
|
|
37
37
|
import "./chunk-W6R3HAAG.js";
|
|
@@ -85,4 +85,4 @@ function receipt(file, minted) {
|
|
|
85
85
|
export {
|
|
86
86
|
runSessionStart
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=session-
|
|
88
|
+
//# sourceMappingURL=session-GJZJEXLJ.js.map
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
installSkill
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WVHPGQH5.js";
|
|
5
5
|
import {
|
|
6
6
|
emitWriteNotice
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-B676GPS2.js";
|
|
8
8
|
import {
|
|
9
9
|
CLI_SKILL_NAMES,
|
|
10
10
|
readSkillFile,
|
|
11
11
|
resolveSkillsSource,
|
|
12
12
|
skillFrontmatterName,
|
|
13
13
|
skillsDirsFor
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-PZRAAAY2.js";
|
|
14
|
+
} from "./chunk-OC3EIDCP.js";
|
|
15
|
+
import "./chunk-PAOVPSP6.js";
|
|
17
16
|
import "./chunk-ZXTAQYNA.js";
|
|
18
17
|
|
|
19
18
|
// src/lib/skill-heal.ts
|
|
@@ -82,4 +81,4 @@ function noticeFor(updated) {
|
|
|
82
81
|
export {
|
|
83
82
|
healWiredSkills
|
|
84
83
|
};
|
|
85
|
-
//# sourceMappingURL=skill-heal-
|
|
84
|
+
//# sourceMappingURL=skill-heal-BPFT22XS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/skill-heal.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { emitWriteNotice } from './output';\nimport type { Io } from './output';\nimport { installSkill } from './skill-writer';\nimport {\n CLI_SKILL_NAMES,\n readSkillFile,\n skillFrontmatterName,\n skillsDirsFor,\n} from './skill-wiring';\nimport { resolveSkillsSource } from './skills-source';\n\nexport interface HealDeps {\n io: Io;\n /** Environment for the CI and opt-out checks. Defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Home whose skills directories are healed. Tests inject a temp dir. */\n homeDir?: string;\n /**\n * The packaged skills source. Defaults to this build's own, and only that\n * default is checked for being a working tree: passing one is a deliberate act.\n */\n skillsSourceDir?: string;\n}\n\n/** The opt-out, in the shape the CLI's other `TENJIN_NO_*` switches take. */\nconst OPT_OUT = 'TENJIN_NO_SKILL_HEAL';\n\n/**\n * Refresh the CLI adapter skills ALREADY in a harness skills directory, so\n * updating the CLI updates the copies `install` wrote instead of leaving an agent\n * on an older version's instructions. Subordinate to the command that ran, like\n * the update nudge: after the envelope, never on stdout, never a failure.\n *\n * It is an UNATTENDED writer into the operator's home, so it is strictly more\n * conservative than `install`, which a human ran on purpose. What it declines to\n * touch is listed on {@link healable}, and it heals only the two CLI adapters:\n * the hosted `tenjin` skill mirrors tenjin.blog/skills.md, so the copy on disk\n * may be a NEWER fetch than this package ships, and rewriting it would undo that\n * and make install's \"re-fetch it from tenjin.blog/skills.md\" false. Same domain\n * `doctor`'s staleness check compares.\n *\n * Unlocked, on purpose. Concurrent healers write byte-identical content to the\n * same paths through per-file atomic renames, so there is nothing to serialize;\n * a lock here could only make things worse, because one left behind by a killed\n * process would silently disable healing on this machine forever.\n */\nexport async function healWiredSkills(deps: HealDeps): Promise<void> {\n try {\n const env = deps.env ?? process.env;\n // The same two doors the update nudge uses: a build log cannot act on this,\n // and an operator who wants their skills left alone says so once.\n if (env.CI !== undefined && env.CI.length > 0) return;\n if (env[OPT_OUT] === '1') return;\n\n const home = deps.homeDir ?? homedir();\n // An empty or relative HOME (sudo/docker env_reset, systemd units) would make\n // every target below relative, healing paths under the working directory.\n if (!isAbsolute(home)) return;\n\n const source = deps.skillsSourceDir ?? packagedSource();\n if (source === null) return;\n const targets = healable(home);\n if (targets.length === 0) return;\n await heal(targets, source, deps.io);\n } catch {\n // Whatever it was, it is the next command's to retry; this one is finished.\n }\n}\n\n/**\n * This build's packaged skills, or null when they are a working tree's. The\n * published package ships `dist/` and `skills/` with no `src/` beside them, so a\n * `src/` sibling means a checkout, whose skills may be half-edited and are not\n * what anyone agreed to install.\n */\nfunction packagedSource(): string | null {\n const dir = resolveSkillsSource(fileURLToPath(new URL('.', import.meta.url)));\n return existsSync(join(dirname(dir), 'src')) ? null : dir;\n}\n\ninterface Target {\n dir: string;\n name: string;\n /** The SKILL.md itself: what the gates judged, and what the notice names. */\n path: string;\n}\n\n/**\n * The (directory, skill) pairs this may rewrite, which is a deliberately narrow\n * set. A skill that is not there is never created, because presence is the\n * operator's consent to a directory.\n *\n * Nothing here is reached THROUGH a symlink. `install` follows one on purpose,\n * since the operator pointed it somewhere; unattended, following one means a\n * write landing wherever it points and a notice naming a path that is not where\n * it landed. That argument does not get weaker one directory up, so every\n * component this CLI creates is checked with `lstat`, not `stat`: the skills\n * directory, the skill directory, and SKILL.md. Above them is the harness's own\n * home, which every tool including the harness reaches through, so a link there\n * is the operator's name for the place rather than a redirect around us.\n *\n * Gating SKILL.md gates the whole write, because it is the only file these skills\n * ship. The other gate, that the file is ours at all, needs its content and so\n * lives at the write itself.\n */\nfunction healable(home: string): Target[] {\n const found: Target[] = [];\n for (const dir of skillsDirsFor(home)) {\n if (!isRealDirectory(dir)) continue;\n for (const name of CLI_SKILL_NAMES) {\n if (!isRealDirectory(join(dir, name))) continue;\n const path = join(dir, name, 'SKILL.md');\n if (lstatSync(path, { throwIfNoEntry: false })?.isFile() !== true) continue;\n found.push({ dir, name, path });\n }\n }\n return found;\n}\n\n/** A directory, and not a symlink to one. */\nfunction isRealDirectory(path: string): boolean {\n return lstatSync(path, { throwIfNoEntry: false })?.isDirectory() === true;\n}\n\nasync function heal(targets: readonly Target[], source: string, io: Io): Promise<void> {\n const updated: string[] = [];\n for (const { dir, name, path } of targets) {\n try {\n if (!(await isOurs(path, name))) continue;\n const { status } = await installSkill(join(source, name), join(dir, name), false, name, {\n followSymlinks: false,\n });\n if (status === 'up-to-date') continue;\n updated.push(path);\n } catch {\n // A denied write, a case collision, a file swapped under us: that skill keeps\n // what it has and the others are still healed, and NOTHING is said about it.\n // A cause the next command cannot clear either (a directory at 0500) would\n // otherwise print the same line forever, on every command, with no state to\n // suppress it and no way to dismiss it. `tenjin doctor` is where a skill that\n // is wired but not from this build gets reported, which is exactly this.\n }\n }\n if (updated.length > 0) emitWriteNotice(io, noticeFor(updated));\n}\n\n/** Does this file claim to BE the skill we would write over it? Somebody else's\n * skill is not ours to replace just for sitting at one of our paths. */\nasync function isOurs(path: string, name: string): Promise<boolean> {\n const read = await readSkillFile(path);\n return read.kind === 'ok' && skillFrontmatterName(read.bytes.toString('utf8')) === name;\n}\n\n/**\n * Files, not directories: this line is the only notice that content in the\n * operator's home changed unasked, so it has to say which content. It claims\n * nothing about edits being lost, because it cannot know. Every routine upgrade\n * rewrites these same files, and telling someone their edits are gone when they\n * made none is worse than saying nothing.\n */\nfunction noticeFor(updated: readonly string[]): string {\n return `Updated ${updated.join(' and ')} to match this CLI.`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/lib/skill-heal.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { emitWriteNotice } from './output';\nimport type { Io } from './output';\nimport { installSkill } from './skill-writer';\nimport {\n CLI_SKILL_NAMES,\n readSkillFile,\n skillFrontmatterName,\n skillsDirsFor,\n} from './skill-wiring';\nimport { resolveSkillsSource } from './skills-source';\n\nexport interface HealDeps {\n io: Io;\n /** Environment for the CI and opt-out checks. Defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Home whose skills directories are healed. Tests inject a temp dir. */\n homeDir?: string;\n /**\n * The packaged skills source. Defaults to this build's own, and only that\n * default is checked for being a working tree: passing one is a deliberate act.\n */\n skillsSourceDir?: string;\n}\n\n/** The opt-out, in the shape the CLI's other `TENJIN_NO_*` switches take. */\nconst OPT_OUT = 'TENJIN_NO_SKILL_HEAL';\n\n/**\n * Refresh the CLI adapter skills ALREADY in a harness skills directory, so\n * updating the CLI updates the copies `install` wrote instead of leaving an agent\n * on an older version's instructions. Subordinate to the command that ran, like\n * the update nudge: after the envelope, never on stdout, never a failure.\n *\n * It is an UNATTENDED writer into the operator's home, so it is strictly more\n * conservative than `install`, which a human ran on purpose. What it declines to\n * touch is listed on {@link healable}, and it heals only the two CLI adapters:\n * the hosted `tenjin` skill mirrors tenjin.blog/skills.md, so the copy on disk\n * may be a NEWER fetch than this package ships, and rewriting it would undo that\n * and make install's \"re-fetch it from tenjin.blog/skills.md\" false. Same domain\n * `doctor`'s staleness check compares.\n *\n * Unlocked, on purpose. Concurrent healers write byte-identical content to the\n * same paths through per-file atomic renames, so there is nothing to serialize;\n * a lock here could only make things worse, because one left behind by a killed\n * process would silently disable healing on this machine forever.\n */\nexport async function healWiredSkills(deps: HealDeps): Promise<void> {\n try {\n const env = deps.env ?? process.env;\n // The same two doors the update nudge uses: a build log cannot act on this,\n // and an operator who wants their skills left alone says so once.\n if (env.CI !== undefined && env.CI.length > 0) return;\n if (env[OPT_OUT] === '1') return;\n\n const home = deps.homeDir ?? homedir();\n // An empty or relative HOME (sudo/docker env_reset, systemd units) would make\n // every target below relative, healing paths under the working directory.\n if (!isAbsolute(home)) return;\n\n const source = deps.skillsSourceDir ?? packagedSource();\n if (source === null) return;\n const targets = healable(home);\n if (targets.length === 0) return;\n await heal(targets, source, deps.io);\n } catch {\n // Whatever it was, it is the next command's to retry; this one is finished.\n }\n}\n\n/**\n * This build's packaged skills, or null when they are a working tree's. The\n * published package ships `dist/` and `skills/` with no `src/` beside them, so a\n * `src/` sibling means a checkout, whose skills may be half-edited and are not\n * what anyone agreed to install.\n */\nfunction packagedSource(): string | null {\n const dir = resolveSkillsSource(fileURLToPath(new URL('.', import.meta.url)));\n return existsSync(join(dirname(dir), 'src')) ? null : dir;\n}\n\ninterface Target {\n dir: string;\n name: string;\n /** The SKILL.md itself: what the gates judged, and what the notice names. */\n path: string;\n}\n\n/**\n * The (directory, skill) pairs this may rewrite, which is a deliberately narrow\n * set. A skill that is not there is never created, because presence is the\n * operator's consent to a directory.\n *\n * Nothing here is reached THROUGH a symlink. `install` follows one on purpose,\n * since the operator pointed it somewhere; unattended, following one means a\n * write landing wherever it points and a notice naming a path that is not where\n * it landed. That argument does not get weaker one directory up, so every\n * component this CLI creates is checked with `lstat`, not `stat`: the skills\n * directory, the skill directory, and SKILL.md. Above them is the harness's own\n * home, which every tool including the harness reaches through, so a link there\n * is the operator's name for the place rather than a redirect around us.\n *\n * Gating SKILL.md gates the whole write, because it is the only file these skills\n * ship. The other gate, that the file is ours at all, needs its content and so\n * lives at the write itself.\n */\nfunction healable(home: string): Target[] {\n const found: Target[] = [];\n for (const dir of skillsDirsFor(home)) {\n if (!isRealDirectory(dir)) continue;\n for (const name of CLI_SKILL_NAMES) {\n if (!isRealDirectory(join(dir, name))) continue;\n const path = join(dir, name, 'SKILL.md');\n if (lstatSync(path, { throwIfNoEntry: false })?.isFile() !== true) continue;\n found.push({ dir, name, path });\n }\n }\n return found;\n}\n\n/** A directory, and not a symlink to one. */\nfunction isRealDirectory(path: string): boolean {\n return lstatSync(path, { throwIfNoEntry: false })?.isDirectory() === true;\n}\n\nasync function heal(targets: readonly Target[], source: string, io: Io): Promise<void> {\n const updated: string[] = [];\n for (const { dir, name, path } of targets) {\n try {\n if (!(await isOurs(path, name))) continue;\n const { status } = await installSkill(join(source, name), join(dir, name), false, name, {\n followSymlinks: false,\n });\n if (status === 'up-to-date') continue;\n updated.push(path);\n } catch {\n // A denied write, a case collision, a file swapped under us: that skill keeps\n // what it has and the others are still healed, and NOTHING is said about it.\n // A cause the next command cannot clear either (a directory at 0500) would\n // otherwise print the same line forever, on every command, with no state to\n // suppress it and no way to dismiss it. `tenjin doctor` is where a skill that\n // is wired but not from this build gets reported, which is exactly this.\n }\n }\n if (updated.length > 0) emitWriteNotice(io, noticeFor(updated));\n}\n\n/** Does this file claim to BE the skill we would write over it? Somebody else's\n * skill is not ours to replace just for sitting at one of our paths. */\nasync function isOurs(path: string, name: string): Promise<boolean> {\n const read = await readSkillFile(path);\n return read.kind === 'ok' && skillFrontmatterName(read.bytes.toString('utf8')) === name;\n}\n\n/**\n * Files, not directories: this line is the only notice that content in the\n * operator's home changed unasked, so it has to say which content. It claims\n * nothing about edits being lost, because it cannot know. Every routine upgrade\n * rewrites these same files, and telling someone their edits are gone when they\n * made none is worse than saying nothing.\n */\nfunction noticeFor(updated: readonly string[]): string {\n return `Updated ${updated.join(' and ')} to match this CLI.`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,iBAAiB;AACtC,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY,YAAY;AAC1C,SAAS,qBAAqB;AA0B9B,IAAM,UAAU;AAqBhB,eAAsB,gBAAgB,MAA+B;AACnE,MAAI;AACF,UAAM,MAAM,KAAK,OAAO,QAAQ;AAGhC,QAAI,IAAI,OAAO,UAAa,IAAI,GAAG,SAAS,EAAG;AAC/C,QAAI,IAAI,OAAO,MAAM,IAAK;AAE1B,UAAM,OAAO,KAAK,WAAW,QAAQ;AAGrC,QAAI,CAAC,WAAW,IAAI,EAAG;AAEvB,UAAM,SAAS,KAAK,mBAAmB,eAAe;AACtD,QAAI,WAAW,KAAM;AACrB,UAAM,UAAU,SAAS,IAAI;AAC7B,QAAI,QAAQ,WAAW,EAAG;AAC1B,UAAM,KAAK,SAAS,QAAQ,KAAK,EAAE;AAAA,EACrC,QAAQ;AAAA,EAER;AACF;AAQA,SAAS,iBAAgC;AACvC,QAAM,MAAM,oBAAoB,cAAc,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC,CAAC;AAC5E,SAAO,WAAW,KAAK,QAAQ,GAAG,GAAG,KAAK,CAAC,IAAI,OAAO;AACxD;AA2BA,SAAS,SAAS,MAAwB;AACxC,QAAM,QAAkB,CAAC;AACzB,aAAW,OAAO,cAAc,IAAI,GAAG;AACrC,QAAI,CAAC,gBAAgB,GAAG,EAAG;AAC3B,eAAW,QAAQ,iBAAiB;AA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36HRWG.js";
|
|
9
|
+
import "./chunk-WVHPGQH5.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeForTerminal
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B676GPS2.js";
|
|
13
13
|
import "./chunk-ZQIQ55KK.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-PZRAAAY2.js";
|
|
14
|
+
import "./chunk-OC3EIDCP.js";
|
|
15
|
+
import "./chunk-PAOVPSP6.js";
|
|
17
16
|
import "./chunk-ZXTAQYNA.js";
|
|
18
17
|
|
|
19
18
|
// src/commands/uninstall.ts
|
|
@@ -65,4 +64,4 @@ function humanLines(report) {
|
|
|
65
64
|
export {
|
|
66
65
|
runUninstall
|
|
67
66
|
};
|
|
68
|
-
//# sourceMappingURL=uninstall-
|
|
67
|
+
//# sourceMappingURL=uninstall-7ZZG6WQ5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/uninstall.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport {\n KEPT_ITEMS,\n removeFromSettings,\n removeHookScripts,\n removeMarkerLines,\n removeSkills,\n type UninstallReport,\n} from '../lib/uninstall';\nimport { sanitizeForTerminal } from '../lib/output';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin uninstall`: undo exactly what `tenjin install` wrote, and nothing else.\n *\n * The shape of this command is the promise it makes. It removes the skills, the\n * hook scripts, our hook entries and permission rules in the harness's\n * settings.json, and the legacy pointer line older versions wrote into\n * CLAUDE.md/AGENTS.md. It does NOT remove the wallet, the config, the library,\n * the search ledger, or parked candidates — `install` did not create those, and\n * a wallet holds funds while a candidate is unpublished work. The receipt names\n * what was kept on every run, so the operator learns the boundary from the\n * command rather than from the docs.\n *\n * IDEMPOTENT BY CONSTRUCTION. Every step is \"remove it if it is ours and there\",\n * so a half-installed machine, an already-uninstalled one, and a machine that\n * never ran install all succeed and report what was (not) found. There is no\n * confirmation prompt and no --force: nothing here is unrecoverable, since a\n * `tenjin install` puts all of it back.\n */\n\nexport interface UninstallDeps {\n /** Home whose harness directories are cleaned; tests inject a temp dir. */\n home?: string;\n}\n\nexport async function runUninstall(\n ctx: CommandContext,\n deps: UninstallDeps = {},\n): Promise<CommandResult> {\n const home = deps.home ?? homedir();\n\n // Settings first: it is the only step with a concurrency guard, and the only\n // one that can refuse. Doing it before the scripts are deleted means a refusal\n // leaves a registered hook still pointing at a script that exists, rather than\n // at one that does not.\n const settings = await removeFromSettings(home);\n const scripts = await removeHookScripts(ctx.dataDir);\n const skills = await removeSkills(home);\n const markers = await removeMarkerLines(home);\n\n const report: UninstallReport = {\n settings,\n skills,\n scripts: scripts.scripts,\n ...(scripts.removedDir !== undefined ? { hooksDir: scripts.removedDir } : {}),\n markers,\n kept: [...KEPT_ITEMS],\n };\n\n return { data: report, humanLines: humanLines(report) };\n}\n\nfunction humanLines(report: UninstallReport): string[] {\n const { settings } = report;\n const removed: string[] = [];\n for (const dir of report.skills) removed.push(`skill ${sanitizeForTerminal(dir)}`);\n for (const script of report.scripts) removed.push(`hook script ${sanitizeForTerminal(script)}`);\n if (report.hooksDir !== undefined) {\n removed.push(`empty hooks directory ${sanitizeForTerminal(report.hooksDir)}`);\n }\n for (const event of settings.hooks) {\n removed.push(`${event} hook entry in ${sanitizeForTerminal(settings.path)}`);\n }\n if (settings.rules.length > 0) {\n removed.push(\n `${settings.rules.length} tenjin permission rule(s) in ${sanitizeForTerminal(settings.path)}`,\n );\n }\n for (const path of report.markers) {\n removed.push(`legacy pointer line in ${sanitizeForTerminal(path)}`);\n }\n\n const lines =\n removed.length === 0\n ? ['Nothing to remove; tenjin was not installed here.']\n : ['Removed:', ...removed.map((r) => ` - ${r}`)];\n\n // Named on EVERY run, including the nothing-to-remove one: the boundary is the\n // point of the command, and an operator reaching for it is usually worried\n // about exactly these five things.\n lines.push('Kept (uninstall never touches these):');\n for (const item of report.kept) lines.push(` - ${item}`);\n\n if (settings.warning !== undefined) {\n lines.push(`! ${sanitizeForTerminal(settings.warning)}`);\n }\n lines.push('Reinstall anytime: tenjin install');\n return lines;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/commands/uninstall.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport {\n KEPT_ITEMS,\n removeFromSettings,\n removeHookScripts,\n removeMarkerLines,\n removeSkills,\n type UninstallReport,\n} from '../lib/uninstall';\nimport { sanitizeForTerminal } from '../lib/output';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin uninstall`: undo exactly what `tenjin install` wrote, and nothing else.\n *\n * The shape of this command is the promise it makes. It removes the skills, the\n * hook scripts, our hook entries and permission rules in the harness's\n * settings.json, and the legacy pointer line older versions wrote into\n * CLAUDE.md/AGENTS.md. It does NOT remove the wallet, the config, the library,\n * the search ledger, or parked candidates — `install` did not create those, and\n * a wallet holds funds while a candidate is unpublished work. The receipt names\n * what was kept on every run, so the operator learns the boundary from the\n * command rather than from the docs.\n *\n * IDEMPOTENT BY CONSTRUCTION. Every step is \"remove it if it is ours and there\",\n * so a half-installed machine, an already-uninstalled one, and a machine that\n * never ran install all succeed and report what was (not) found. There is no\n * confirmation prompt and no --force: nothing here is unrecoverable, since a\n * `tenjin install` puts all of it back.\n */\n\nexport interface UninstallDeps {\n /** Home whose harness directories are cleaned; tests inject a temp dir. */\n home?: string;\n}\n\nexport async function runUninstall(\n ctx: CommandContext,\n deps: UninstallDeps = {},\n): Promise<CommandResult> {\n const home = deps.home ?? homedir();\n\n // Settings first: it is the only step with a concurrency guard, and the only\n // one that can refuse. Doing it before the scripts are deleted means a refusal\n // leaves a registered hook still pointing at a script that exists, rather than\n // at one that does not.\n const settings = await removeFromSettings(home);\n const scripts = await removeHookScripts(ctx.dataDir);\n const skills = await removeSkills(home);\n const markers = await removeMarkerLines(home);\n\n const report: UninstallReport = {\n settings,\n skills,\n scripts: scripts.scripts,\n ...(scripts.removedDir !== undefined ? { hooksDir: scripts.removedDir } : {}),\n markers,\n kept: [...KEPT_ITEMS],\n };\n\n return { data: report, humanLines: humanLines(report) };\n}\n\nfunction humanLines(report: UninstallReport): string[] {\n const { settings } = report;\n const removed: string[] = [];\n for (const dir of report.skills) removed.push(`skill ${sanitizeForTerminal(dir)}`);\n for (const script of report.scripts) removed.push(`hook script ${sanitizeForTerminal(script)}`);\n if (report.hooksDir !== undefined) {\n removed.push(`empty hooks directory ${sanitizeForTerminal(report.hooksDir)}`);\n }\n for (const event of settings.hooks) {\n removed.push(`${event} hook entry in ${sanitizeForTerminal(settings.path)}`);\n }\n if (settings.rules.length > 0) {\n removed.push(\n `${settings.rules.length} tenjin permission rule(s) in ${sanitizeForTerminal(settings.path)}`,\n );\n }\n for (const path of report.markers) {\n removed.push(`legacy pointer line in ${sanitizeForTerminal(path)}`);\n }\n\n const lines =\n removed.length === 0\n ? ['Nothing to remove; tenjin was not installed here.']\n : ['Removed:', ...removed.map((r) => ` - ${r}`)];\n\n // Named on EVERY run, including the nothing-to-remove one: the boundary is the\n // point of the command, and an operator reaching for it is usually worried\n // about exactly these five things.\n lines.push('Kept (uninstall never touches these):');\n for (const item of report.kept) lines.push(` - ${item}`);\n\n if (settings.warning !== undefined) {\n lines.push(`! ${sanitizeForTerminal(settings.warning)}`);\n }\n lines.push('Reinstall anytime: tenjin install');\n return lines;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AAoCxB,eAAsB,aACpB,KACA,OAAsB,CAAC,GACC;AACxB,QAAM,OAAO,KAAK,QAAQ,QAAQ;AAMlC,QAAM,WAAW,MAAM,mBAAmB,IAAI;AAC9C,QAAM,UAAU,MAAM,kBAAkB,IAAI,OAAO;AACnD,QAAM,SAAS,MAAM,aAAa,IAAI;AACtC,QAAM,UAAU,MAAM,kBAAkB,IAAI;AAE5C,QAAM,SAA0B;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,SAAS,QAAQ;AAAA,IACjB,GAAI,QAAQ,eAAe,SAAY,EA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