tenjin-cli 0.1.0-alpha.27 → 0.1.0-alpha.28

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.
Files changed (125) hide show
  1. package/README.md +6 -17
  2. package/dist/alive-3J3CHOQP.js +21 -0
  3. package/dist/{chunk-SKQQOEWH.js → chunk-3QJREVMX.js} +5 -7
  4. package/dist/{chunk-SKQQOEWH.js.map → chunk-3QJREVMX.js.map} +1 -1
  5. package/dist/{chunk-BOAI23CX.js → chunk-6KA4HFX5.js} +21 -15
  6. package/dist/chunk-6KA4HFX5.js.map +1 -0
  7. package/dist/chunk-6W5GYG3W.js +128 -0
  8. package/dist/chunk-6W5GYG3W.js.map +1 -0
  9. package/dist/{chunk-4L7KMA7P.js → chunk-7H3RN4WJ.js} +7 -9
  10. package/dist/{chunk-4L7KMA7P.js.map → chunk-7H3RN4WJ.js.map} +1 -1
  11. package/dist/{chunk-O7CUHHYU.js → chunk-7R37M6WV.js} +7 -9
  12. package/dist/{chunk-O7CUHHYU.js.map → chunk-7R37M6WV.js.map} +1 -1
  13. package/dist/{chunk-LAIZ2AQA.js → chunk-A5H3E5QA.js} +2 -2
  14. package/dist/{update-RJDA5ZY3.js → chunk-AO54FM4H.js} +147 -26
  15. package/dist/chunk-AO54FM4H.js.map +1 -0
  16. package/dist/{chunk-VNNXAYJE.js → chunk-BRHREK7E.js} +2 -2
  17. package/dist/{chunk-YQOQ6XEI.js → chunk-DJYAPACT.js} +35 -33
  18. package/dist/chunk-DJYAPACT.js.map +1 -0
  19. package/dist/{chunk-GU4GGKYP.js → chunk-DYSDQE7S.js} +36 -2
  20. package/dist/chunk-DYSDQE7S.js.map +1 -0
  21. package/dist/{chunk-YKM2ZTA2.js → chunk-FQ6DHINU.js} +36 -38
  22. package/dist/{chunk-YKM2ZTA2.js.map → chunk-FQ6DHINU.js.map} +1 -1
  23. package/dist/{chunk-6ZSGER3A.js → chunk-FZTSGQVK.js} +2 -2
  24. package/dist/{chunk-AWKQSKUL.js → chunk-KAMRYUK2.js} +2 -2
  25. package/dist/{chunk-2TYQD22Q.js → chunk-MNTQMZJB.js} +6 -8
  26. package/dist/{chunk-2TYQD22Q.js.map → chunk-MNTQMZJB.js.map} +1 -1
  27. package/dist/{chunk-VIOUZW7Z.js → chunk-QTND6XWJ.js} +159 -35
  28. package/dist/chunk-QTND6XWJ.js.map +1 -0
  29. package/dist/chunk-RLPLYUME.js +115 -0
  30. package/dist/{chunk-HC3QEZKT.js.map → chunk-RLPLYUME.js.map} +1 -1
  31. package/dist/{chunk-5NEHH2E5.js → chunk-UEOWNDQG.js} +8 -10
  32. package/dist/{chunk-5NEHH2E5.js.map → chunk-UEOWNDQG.js.map} +1 -1
  33. package/dist/{chunk-OHZYNZSD.js → chunk-UOW5JXYY.js} +5 -7
  34. package/dist/{chunk-OHZYNZSD.js.map → chunk-UOW5JXYY.js.map} +1 -1
  35. package/dist/chunk-VSUHGRVB.js +1455 -0
  36. package/dist/chunk-VSUHGRVB.js.map +1 -0
  37. package/dist/{chunk-64SE3QC5.js → chunk-W6JX4LYF.js} +12 -4
  38. package/dist/chunk-W6JX4LYF.js.map +1 -0
  39. package/dist/{chunk-5FGO6TYT.js → chunk-XVTD7UWR.js} +3 -5
  40. package/dist/{chunk-5FGO6TYT.js.map → chunk-XVTD7UWR.js.map} +1 -1
  41. package/dist/{chunk-X7I343ZY.js → chunk-YFJJYHVG.js} +2 -2
  42. package/dist/{chunk-XVYATBKD.js → chunk-ZG6ZZLO7.js} +898 -521
  43. package/dist/chunk-ZG6ZZLO7.js.map +1 -0
  44. package/dist/{chunk-DATCR7AU.js → chunk-ZO3X5NPG.js} +4 -6
  45. package/dist/{chunk-DATCR7AU.js.map → chunk-ZO3X5NPG.js.map} +1 -1
  46. package/dist/{chunk-VXIBZ6W5.js → chunk-ZP5PV3JB.js} +3 -3
  47. package/dist/{chunk-G4AM2SOL.js → chunk-ZP7AHN7Z.js} +4 -6
  48. package/dist/{chunk-G4AM2SOL.js.map → chunk-ZP7AHN7Z.js.map} +1 -1
  49. package/dist/{cli-6JNIPZQ6.js → cli-234DNHN6.js} +54 -53
  50. package/dist/{cli-6JNIPZQ6.js.map → cli-234DNHN6.js.map} +1 -1
  51. package/dist/{config-G75YT6NC.js → config-IY2OJCAK.js} +10 -13
  52. package/dist/{doctor-3GMDOW4Y.js → doctor-2UZZF44A.js} +267 -242
  53. package/dist/doctor-2UZZF44A.js.map +1 -0
  54. package/dist/{fund-3IPR5YRJ.js → fund-RZ2QFULK.js} +92 -38
  55. package/dist/{fund-3IPR5YRJ.js.map → fund-RZ2QFULK.js.map} +1 -1
  56. package/dist/hook-command-PZHKS7ES.js +31 -0
  57. package/dist/hosts/claude/.claude-plugin/marketplace.json +19 -0
  58. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +14 -0
  59. package/dist/hosts/claude/tenjin/.mcp.json +11 -0
  60. package/dist/hosts/claude/tenjin/hooks/hooks.json +206 -0
  61. package/dist/index.js +12 -3
  62. package/dist/index.js.map +1 -1
  63. package/dist/install-O5FJ5EP3.js +48 -0
  64. package/dist/{install-identity-PM4AGFFX.js → install-identity-QM44IQ6Z.js} +7 -8
  65. package/dist/{install-wallet-6756NOB5.js → install-wallet-Z52EDLPB.js} +14 -15
  66. package/dist/{install-wallet-6756NOB5.js.map → install-wallet-Z52EDLPB.js.map} +1 -1
  67. package/dist/{mcp-33FAAZ7F.js → mcp-33HAADDF.js} +80 -67
  68. package/dist/{mcp-33FAAZ7F.js.map → mcp-33HAADDF.js.map} +1 -1
  69. package/dist/package-RT24HTTP.js +37 -0
  70. package/dist/{pay-XOYR4PCH.js → pay-IR2V76FX.js} +16 -17
  71. package/dist/{payments-UTQDBO7H.js → payments-GFV4HU5R.js} +9 -10
  72. package/dist/{payments-UTQDBO7H.js.map → payments-GFV4HU5R.js.map} +1 -1
  73. package/dist/{send-CVGNOQW3.js → send-PI4NUA7I.js} +12 -14
  74. package/dist/{send-CVGNOQW3.js.map → send-PI4NUA7I.js.map} +1 -1
  75. package/dist/{status-NACN4DGX.js → status-ZUHTJK46.js} +6 -7
  76. package/dist/{status-NACN4DGX.js.map → status-ZUHTJK46.js.map} +1 -1
  77. package/dist/{status-line-3IQKGRUH.js → status-line-2G5JPQAE.js} +6 -7
  78. package/dist/{status-line-3IQKGRUH.js.map → status-line-2G5JPQAE.js.map} +1 -1
  79. package/dist/uninstall-THKUH5ZT.js +136 -0
  80. package/dist/uninstall-THKUH5ZT.js.map +1 -0
  81. package/dist/update-NPZDP24E.js +18 -0
  82. package/dist/update-NPZDP24E.js.map +1 -0
  83. package/dist/{wallet-B3FVHNTS.js → wallet-53EFH4M5.js} +11 -12
  84. package/dist/wallet-53EFH4M5.js.map +1 -0
  85. package/docs/agent-permissions.md +27 -17
  86. package/package.json +1 -1
  87. package/dist/chunk-64SE3QC5.js.map +0 -1
  88. package/dist/chunk-BOAI23CX.js.map +0 -1
  89. package/dist/chunk-DSNXKUXI.js +0 -172
  90. package/dist/chunk-DSNXKUXI.js.map +0 -1
  91. package/dist/chunk-GU4GGKYP.js.map +0 -1
  92. package/dist/chunk-H2L33M7F.js +0 -944
  93. package/dist/chunk-H2L33M7F.js.map +0 -1
  94. package/dist/chunk-HC3QEZKT.js +0 -87
  95. package/dist/chunk-JLEF5WHM.js +0 -132
  96. package/dist/chunk-JLEF5WHM.js.map +0 -1
  97. package/dist/chunk-MAQUL5BD.js +0 -99
  98. package/dist/chunk-MAQUL5BD.js.map +0 -1
  99. package/dist/chunk-PY7MQUKP.js +0 -755
  100. package/dist/chunk-PY7MQUKP.js.map +0 -1
  101. package/dist/chunk-TGLKKLQG.js +0 -11
  102. package/dist/chunk-TGLKKLQG.js.map +0 -1
  103. package/dist/chunk-VIOUZW7Z.js.map +0 -1
  104. package/dist/chunk-XVYATBKD.js.map +0 -1
  105. package/dist/chunk-YQOQ6XEI.js.map +0 -1
  106. package/dist/doctor-3GMDOW4Y.js.map +0 -1
  107. package/dist/hook-command-ZXX4FT4N.js +0 -32
  108. package/dist/install-6OROTYHZ.js +0 -72
  109. package/dist/status-line-wiring-QXBOOY2T.js +0 -31
  110. package/dist/uninstall-NYFKSYW4.js +0 -175
  111. package/dist/uninstall-NYFKSYW4.js.map +0 -1
  112. package/dist/update-RJDA5ZY3.js.map +0 -1
  113. /package/dist/{config-G75YT6NC.js.map → alive-3J3CHOQP.js.map} +0 -0
  114. /package/dist/{chunk-LAIZ2AQA.js.map → chunk-A5H3E5QA.js.map} +0 -0
  115. /package/dist/{chunk-VNNXAYJE.js.map → chunk-BRHREK7E.js.map} +0 -0
  116. /package/dist/{chunk-6ZSGER3A.js.map → chunk-FZTSGQVK.js.map} +0 -0
  117. /package/dist/{chunk-AWKQSKUL.js.map → chunk-KAMRYUK2.js.map} +0 -0
  118. /package/dist/{chunk-X7I343ZY.js.map → chunk-YFJJYHVG.js.map} +0 -0
  119. /package/dist/{chunk-VXIBZ6W5.js.map → chunk-ZP5PV3JB.js.map} +0 -0
  120. /package/dist/{hook-command-ZXX4FT4N.js.map → config-IY2OJCAK.js.map} +0 -0
  121. /package/dist/{install-6OROTYHZ.js.map → hook-command-PZHKS7ES.js.map} +0 -0
  122. /package/dist/{install-identity-PM4AGFFX.js.map → install-O5FJ5EP3.js.map} +0 -0
  123. /package/dist/{pay-XOYR4PCH.js.map → install-identity-QM44IQ6Z.js.map} +0 -0
  124. /package/dist/{status-line-wiring-QXBOOY2T.js.map → package-RT24HTTP.js.map} +0 -0
  125. /package/dist/{wallet-B3FVHNTS.js.map → pay-IR2V76FX.js.map} +0 -0
@@ -0,0 +1,37 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ bin,
4
+ bugs,
5
+ description,
6
+ devDependencies,
7
+ engines,
8
+ files,
9
+ homepage,
10
+ keywords,
11
+ name,
12
+ packageManager,
13
+ package_default,
14
+ repository,
15
+ scripts,
16
+ type,
17
+ version
18
+ } from "./chunk-RLPLYUME.js";
19
+ import "./chunk-ZXTAQYNA.js";
20
+ export {
21
+ bin,
22
+ bugs,
23
+ package_default as default,
24
+ description,
25
+ devDependencies,
26
+ engines,
27
+ files,
28
+ homepage,
29
+ keywords,
30
+ name,
31
+ packageManager,
32
+ repository,
33
+ scripts,
34
+ type,
35
+ version
36
+ };
37
+ //# sourceMappingURL=package-RT24HTTP.js.map
@@ -4,20 +4,23 @@ import {
4
4
  paidLegTimeoutMs,
5
5
  runPay,
6
6
  settlementTx
7
- } from "./chunk-YKM2ZTA2.js";
7
+ } from "./chunk-FQ6DHINU.js";
8
+ import "./chunk-7EKYXMUO.js";
8
9
  import "./chunk-LHHMV4GU.js";
9
- import "./chunk-LAIZ2AQA.js";
10
+ import "./chunk-A5H3E5QA.js";
11
+ import "./chunk-BRHREK7E.js";
10
12
  import "./chunk-LFZJM56J.js";
11
- import "./chunk-7EKYXMUO.js";
12
13
  import "./chunk-EL56RW2J.js";
14
+ import "./chunk-7R37M6WV.js";
15
+ import "./chunk-ZP5PV3JB.js";
16
+ import "./chunk-YFJJYHVG.js";
13
17
  import "./chunk-TTNESUPQ.js";
14
18
  import "./chunk-HPWO4O6S.js";
15
19
  import "./chunk-POUWHWID.js";
16
20
  import "./chunk-XZKD7DIF.js";
17
- import "./chunk-VNNXAYJE.js";
18
- import "./chunk-O7CUHHYU.js";
19
- import "./chunk-VXIBZ6W5.js";
20
- import "./chunk-X7I343ZY.js";
21
+ import "./chunk-MEFB5KHA.js";
22
+ import "./chunk-B2L53TMK.js";
23
+ import "./chunk-XVTD7UWR.js";
21
24
  import "./chunk-AWQPGIR6.js";
22
25
  import "./chunk-N35E6CM2.js";
23
26
  import "./chunk-JRGFKVAZ.js";
@@ -27,17 +30,13 @@ import "./chunk-KG3D7FIF.js";
27
30
  import "./chunk-RBJPAZFI.js";
28
31
  import "./chunk-BPMWXTFX.js";
29
32
  import "./chunk-7QKHZQKW.js";
30
- import "./chunk-OHZYNZSD.js";
31
- import "./chunk-MEFB5KHA.js";
32
- import "./chunk-B2L53TMK.js";
33
- import "./chunk-5FGO6TYT.js";
34
- import "./chunk-HC3QEZKT.js";
33
+ import "./chunk-UOW5JXYY.js";
35
34
  import "./chunk-2I4QTOLB.js";
36
- import "./chunk-G4AM2SOL.js";
37
- import "./chunk-6ZSGER3A.js";
38
- import "./chunk-VIOUZW7Z.js";
39
- import "./chunk-JLEF5WHM.js";
35
+ import "./chunk-ZP7AHN7Z.js";
36
+ import "./chunk-FZTSGQVK.js";
37
+ import "./chunk-QTND6XWJ.js";
40
38
  import "./chunk-K6AXXYCG.js";
39
+ import "./chunk-RLPLYUME.js";
41
40
  import "./chunk-ZXTAQYNA.js";
42
41
  export {
43
42
  MAX_PAID_LEG_TIMEOUT_MS,
@@ -45,4 +44,4 @@ export {
45
44
  runPay,
46
45
  settlementTx
47
46
  };
48
- //# sourceMappingURL=pay-XOYR4PCH.js.map
47
+ //# sourceMappingURL=pay-IR2V76FX.js.map
@@ -1,22 +1,21 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  reconcilePayments
4
- } from "./chunk-5NEHH2E5.js";
5
- import "./chunk-LAIZ2AQA.js";
6
- import "./chunk-VXIBZ6W5.js";
7
- import "./chunk-X7I343ZY.js";
8
- import "./chunk-7QKHZQKW.js";
4
+ } from "./chunk-UEOWNDQG.js";
5
+ import "./chunk-A5H3E5QA.js";
6
+ import "./chunk-ZP5PV3JB.js";
7
+ import "./chunk-YFJJYHVG.js";
9
8
  import "./chunk-MEFB5KHA.js";
10
9
  import "./chunk-B2L53TMK.js";
10
+ import "./chunk-7QKHZQKW.js";
11
11
  import "./chunk-2I4QTOLB.js";
12
12
  import {
13
13
  resolveContextSettings
14
- } from "./chunk-G4AM2SOL.js";
14
+ } from "./chunk-ZP7AHN7Z.js";
15
15
  import {
16
16
  toMoney
17
- } from "./chunk-6ZSGER3A.js";
18
- import "./chunk-VIOUZW7Z.js";
19
- import "./chunk-JLEF5WHM.js";
17
+ } from "./chunk-FZTSGQVK.js";
18
+ import "./chunk-QTND6XWJ.js";
20
19
  import {
21
20
  paidLedgerPath
22
21
  } from "./chunk-K6AXXYCG.js";
@@ -45,4 +44,4 @@ async function runPaymentsReconcile(ctx, deps = {}) {
45
44
  export {
46
45
  runPaymentsReconcile
47
46
  };
48
- //# sourceMappingURL=payments-UTQDBO7H.js.map
47
+ //# sourceMappingURL=payments-GFV4HU5R.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/router/payments.ts"],"sourcesContent":["import { toMoney } from '../lib/money';\nimport { paidLedgerPath } from '../lib/paths';\nimport { resolveContextSettings } from '../lib/settings';\nimport type { CommandContext, CommandResult } from '../context';\nimport { reconcilePayments } from './paid';\n\n/**\n * `tenjin payments reconcile`: settle every \"settlement unknown\" record in the\n * paid ledger that the chain can now answer for. The `request` tool runs the\n * same pass, three records at a time, before each lookup; this one asks about\n * up to {@link MAX_COMMAND_CHECKS}.\n *\n * A record found not charged also gives its amount back to the daily budget,\n * when the spend ledger still holds that payment's exposure in this window.\n */\n\nconst MAX_COMMAND_CHECKS = 50;\n\nexport interface PaymentsDeps {\n fetchImpl?: typeof fetch;\n now?: () => number;\n}\n\nexport async function runPaymentsReconcile(\n ctx: CommandContext,\n deps: PaymentsDeps = {},\n): Promise<CommandResult> {\n const settings = await resolveContextSettings(ctx);\n const outcome = await reconcilePayments(ctx.dataDir, {\n rpcUrl: settings.rpcUrl,\n max: MAX_COMMAND_CHECKS,\n // Asked for by hand: every due record, however recently it was asked about.\n recheckMs: 0,\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n ...(deps.now !== undefined ? { now: deps.now } : {}),\n });\n return {\n data: { ledger: paidLedgerPath(ctx.dataDir), ...outcome },\n humanLines: [\n outcome.checked === 0\n ? 'No paid lookup is waiting on its settlement.'\n : `Checked ${outcome.checked}: ${outcome.settled} charged, ${outcome.notCharged} not charged.` +\n (outcome.releasedAtomic !== '0'\n ? ` ${toMoney(outcome.releasedAtomic).usd} USD went back to today's limit.`\n : ''),\n ...(outcome.unknown > 0\n ? [`${outcome.unknown} still unknown: not expired yet, or the chain could not say.`]\n : []),\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,qBAAqB;AAO3B,eAAsB,qBACpB,KACA,OAAqB,CAAC,GACE;AACxB,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,UAAU,MAAM,kBAAkB,IAAI,SAAS;AAAA,IACnD,QAAQ,SAAS;AAAA,IACjB,KAAK;AAAA;AAAA,IAEL,WAAW;AAAA,IACX,GAAI,KAAK,cAAc,SAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,IACpE,GAAI,KAAK,QAAQ,SAAY,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,EACpD,CAAC;AACD,SAAO;AAAA,IACL,MAAM,EAAE,QAAQ,eAAe,IAAI,OAAO,GAAG,GAAG,QAAQ;AAAA,IACxD,YAAY;AAAA,MACV,QAAQ,YAAY,IAChB,iDACA,WAAW,QAAQ,OAAO,KAAK,QAAQ,OAAO,aAAa,QAAQ,UAAU,mBAC5E,QAAQ,mBAAmB,MACxB,IAAI,QAAQ,QAAQ,cAAc,EAAE,GAAG,qCACvC;AAAA,MACR,GAAI,QAAQ,UAAU,IAClB,CAAC,GAAG,QAAQ,OAAO,8DAA8D,IACjF,CAAC;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/router/payments.ts"],"sourcesContent":["import { toMoney } from '../lib/money';\nimport { paidLedgerPath } from '../lib/paths';\nimport { resolveContextSettings } from '../lib/settings';\nimport type { CommandContext, CommandResult } from '../context';\nimport { reconcilePayments } from './paid';\n\n/**\n * `tenjin payments reconcile`: settle every \"settlement unknown\" record in the\n * paid ledger that the chain can now answer for. The `request` tool runs the\n * same pass, three records at a time, before each lookup; this one asks about\n * up to {@link MAX_COMMAND_CHECKS}.\n *\n * A record found not charged also gives its amount back to the daily budget,\n * when the spend ledger still holds that payment's exposure in this window.\n */\n\nconst MAX_COMMAND_CHECKS = 50;\n\nexport interface PaymentsDeps {\n fetchImpl?: typeof fetch;\n now?: () => number;\n}\n\nexport async function runPaymentsReconcile(\n ctx: CommandContext,\n deps: PaymentsDeps = {},\n): Promise<CommandResult> {\n const settings = await resolveContextSettings(ctx);\n const outcome = await reconcilePayments(ctx.dataDir, {\n rpcUrl: settings.rpcUrl,\n max: MAX_COMMAND_CHECKS,\n // Asked for by hand: every due record, however recently it was asked about.\n recheckMs: 0,\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n ...(deps.now !== undefined ? { now: deps.now } : {}),\n });\n return {\n data: { ledger: paidLedgerPath(ctx.dataDir), ...outcome },\n humanLines: [\n outcome.checked === 0\n ? 'No paid lookup is waiting on its settlement.'\n : `Checked ${outcome.checked}: ${outcome.settled} charged, ${outcome.notCharged} not charged.` +\n (outcome.releasedAtomic !== '0'\n ? ` ${toMoney(outcome.releasedAtomic).usd} USD went back to today's limit.`\n : ''),\n ...(outcome.unknown > 0\n ? [`${outcome.unknown} still unknown: not expired yet, or the chain could not say.`]\n : []),\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,qBAAqB;AAO3B,eAAsB,qBACpB,KACA,OAAqB,CAAC,GACE;AACxB,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,UAAU,MAAM,kBAAkB,IAAI,SAAS;AAAA,IACnD,QAAQ,SAAS;AAAA,IACjB,KAAK;AAAA;AAAA,IAEL,WAAW;AAAA,IACX,GAAI,KAAK,cAAc,SAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,IACpE,GAAI,KAAK,QAAQ,SAAY,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,EACpD,CAAC;AACD,SAAO;AAAA,IACL,MAAM,EAAE,QAAQ,eAAe,IAAI,OAAO,GAAG,GAAG,QAAQ;AAAA,IACxD,YAAY;AAAA,MACV,QAAQ,YAAY,IAChB,iDACA,WAAW,QAAQ,OAAO,KAAK,QAAQ,OAAO,aAAa,QAAQ,UAAU,mBAC5E,QAAQ,mBAAmB,MACxB,IAAI,QAAQ,QAAQ,cAAc,EAAE,GAAG,qCACvC;AAAA,MACR,GAAI,QAAQ,UAAU,IAClB,CAAC,GAAG,QAAQ,OAAO,8DAA8D,IACjF,CAAC;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
@@ -10,13 +10,16 @@ import {
10
10
  broadcastUsdcSend,
11
11
  getUsdcBalance,
12
12
  prepareUsdcSend
13
- } from "./chunk-VNNXAYJE.js";
13
+ } from "./chunk-BRHREK7E.js";
14
14
  import {
15
15
  describeWallet,
16
16
  resolveWalletProvider
17
- } from "./chunk-O7CUHHYU.js";
18
- import "./chunk-VXIBZ6W5.js";
19
- import "./chunk-X7I343ZY.js";
17
+ } from "./chunk-7R37M6WV.js";
18
+ import "./chunk-ZP5PV3JB.js";
19
+ import "./chunk-YFJJYHVG.js";
20
+ import "./chunk-MEFB5KHA.js";
21
+ import "./chunk-B2L53TMK.js";
22
+ import "./chunk-XVTD7UWR.js";
20
23
  import "./chunk-AWQPGIR6.js";
21
24
  import "./chunk-N35E6CM2.js";
22
25
  import "./chunk-JRGFKVAZ.js";
@@ -29,23 +32,18 @@ import {
29
32
  import "./chunk-KG3D7FIF.js";
30
33
  import "./chunk-RBJPAZFI.js";
31
34
  import "./chunk-BPMWXTFX.js";
32
- import "./chunk-MEFB5KHA.js";
33
- import "./chunk-B2L53TMK.js";
34
- import "./chunk-5FGO6TYT.js";
35
35
  import "./chunk-2I4QTOLB.js";
36
36
  import {
37
37
  resolveContextSettings
38
- } from "./chunk-G4AM2SOL.js";
38
+ } from "./chunk-ZP7AHN7Z.js";
39
39
  import {
40
40
  parseUsdToAtomic,
41
41
  toMoney
42
- } from "./chunk-6ZSGER3A.js";
42
+ } from "./chunk-FZTSGQVK.js";
43
43
  import {
44
+ CliError,
44
45
  SEND_MAX_UNSET
45
- } from "./chunk-VIOUZW7Z.js";
46
- import {
47
- CliError
48
- } from "./chunk-JLEF5WHM.js";
46
+ } from "./chunk-QTND6XWJ.js";
49
47
  import "./chunk-K6AXXYCG.js";
50
48
  import "./chunk-ZXTAQYNA.js";
51
49
 
@@ -222,4 +220,4 @@ This moves funds out of the agent wallet and cannot be undone. [y/N] `;
222
220
  export {
223
221
  runSend
224
222
  };
225
- //# sourceMappingURL=send-CVGNOQW3.js.map
223
+ //# sourceMappingURL=send-PI4NUA7I.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 wallet 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 wallet 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 wallet 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 wallet 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,GAAG;AACxE,iBAAe,cAAc,mBAAmB;AAEhD,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,eAAe,KAAK,SAAS,MAAM;AAAA,EACrD,SAAS,KAAK;AACZ,UAAM,IAAI,SAAS,aAAa,wCAAwC,MAAM,KAAK;AAAA,MACjF,KAAK;AAAA,MACL,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACA,MAAI,eAAe,SAAS;AAC1B,UAAM,IAAI,SAAS,WAAW,+CAA+C;AAAA,MAC3E,KAAK;AAAA,MACL,SAAS;AAAA,QACP,WAAW,QAAQ,aAAa,SAAS,CAAC;AAAA,QAC1C,SAAS,QAAQ,QAA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,CAAC,GAAG,KAAK,QAAQ,UAAU,SAAS,CAAC,EAAE;AAAA,IAC7F,CAAC;AAAA,EACH;AACF;AAGA,SAAS,YAAY,OAAqB;AACxC,MAAI,MAAM,KAAK,EAAE,YAAY,MAAM,OAAQ;AAC3C,QAAM,IAAI,SAAS,SAAS,sBAAsB,KAAK,UAAU,KAAK,CAAC,IAAI;AAAA,IACzE,KAAK;AAAA,EACP,CAAC;AACH;AAUA,SAAS,eAAe,KAAsB;AAC5C,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,CAAC,UAAU,OAAO,GAAG;AACvB,UAAM,IAAI,SAAS,SAAS,8BAA8B,KAAK,UAAU,GAAG,CAAC,IAAI;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,KAAK,WAAW,OAAO;AAC7B,MAAI,OAAO,gBAAgB,OAAO,gBAAgB,OAAO,cAAc;AACrE,UAAM,IAAI,SAAS,SAAS,qDAAqD;AAAA,MAC/E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAUA,eAAe,YACb,KACA,MACA,KACA,GACkB;AAClB,MAAI,IAAK,QAAO;AAChB,QAAM,SACJ,QAAQ,QAAQ,EAAE,aAAa,SAAS,CAAC,EAAE,GAAG;AAAA,SACpC,EAAE,IAAI;AAAA,SACN,EAAE,EAAE;AAAA,uBACU,YAAY,EAAE,MAAM,CAAC;AAAA;AAE/C,MAAI,KAAK,YAAY,OAAW,QAAO,KAAK,QAAQ,MAAM;AAE1D,MAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,MAAM,MAAO,QAAO;AAClD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
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 wallet 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 wallet 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 wallet 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 wallet 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,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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":[]}
@@ -1,24 +1,23 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
- import "./chunk-VXIBZ6W5.js";
2
+ import "./chunk-ZP5PV3JB.js";
3
3
  import {
4
4
  readSpendSummary,
5
5
  spentOf
6
- } from "./chunk-X7I343ZY.js";
6
+ } from "./chunk-YFJJYHVG.js";
7
7
  import "./chunk-MEFB5KHA.js";
8
8
  import "./chunk-B2L53TMK.js";
9
9
  import "./chunk-2I4QTOLB.js";
10
10
  import {
11
11
  resolveContextSettings
12
- } from "./chunk-G4AM2SOL.js";
12
+ } from "./chunk-ZP7AHN7Z.js";
13
13
  import {
14
14
  toMoney
15
- } from "./chunk-6ZSGER3A.js";
15
+ } from "./chunk-FZTSGQVK.js";
16
16
  import {
17
17
  RETIRED_PAYMENT_GUIDANCE,
18
18
  loadRawConfig,
19
19
  retiredPaymentKeys
20
- } from "./chunk-VIOUZW7Z.js";
21
- import "./chunk-JLEF5WHM.js";
20
+ } from "./chunk-QTND6XWJ.js";
22
21
  import "./chunk-K6AXXYCG.js";
23
22
  import "./chunk-ZXTAQYNA.js";
24
23
 
@@ -69,4 +68,4 @@ async function runRouterStatus(ctx, deps = {}) {
69
68
  export {
70
69
  runRouterStatus
71
70
  };
72
- //# sourceMappingURL=status-NACN4DGX.js.map
71
+ //# sourceMappingURL=status-ZUHTJK46.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/router/status.ts"],"sourcesContent":["import { toMoney } from '../lib/money';\nimport { loadRawConfig, retiredPaymentKeys, RETIRED_PAYMENT_GUIDANCE } from '../lib/config';\nimport { spentOf } from '../lib/spend-ledger';\nimport { resolveContextSettings } from '../lib/settings';\nimport { readSpendSummary } from '../lib/wallet/spend';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin status`: what this machine has spent and what it is still holding.\n *\n * IT READS `spend.json`, NOT THE BACKEND. The rolling window, the committed\n * total and the reservations still open are the local truth about money, and\n * the reservations are also the record of a request whose outcome is unknown:\n * an authorization that was transmitted is committed, so anything still open\n * here is either in flight or a crash that has not yet aged out.\n */\n\nexport interface StatusDeps {\n now?: () => number;\n}\n\nexport async function runRouterStatus(\n ctx: CommandContext,\n deps: StatusDeps = {},\n): Promise<CommandResult> {\n const now = deps.now ?? Date.now;\n const settings = await resolveContextSettings(ctx);\n // The same projection an authorization would make, so what this prints is\n // what the next lookup would actually be measured against.\n const ledger = await readSpendSummary(ctx.dataDir, { now });\n const committedAtomic = BigInt(ledger?.committedAtomic ?? '0');\n const reservedAtomic = (ledger?.reservations ?? []).reduce(\n (sum, r) => sum + BigInt(r.amountAtomic),\n 0n,\n );\n const retired = retiredPaymentKeys(await loadRawConfig(ctx.dataDir));\n const warnings = retired.length\n ? [`Ignored retired keys: ${retired.join(', ')}. ${RETIRED_PAYMENT_GUIDANCE}`]\n : [];\n const automaticAtomic = ledger === null ? 0n : spentOf(ledger);\n const budgetAtomic = settings.policy.sessionBudgetAtomic;\n const data = {\n baseUrl: settings.baseUrl,\n warnings,\n window: {\n startedAtMs: ledger?.windowStartMs ?? null,\n committed: toMoney(committedAtomic.toString()),\n automaticExposure: toMoney(automaticAtomic.toString()),\n reserved: toMoney(reservedAtomic.toString()),\n budget: budgetAtomic === null ? null : toMoney(budgetAtomic.toString()),\n },\n caps: {\n maxAutoSpend: toMoney(settings.policy.maxAutoSpendAtomic.toString()),\n },\n inFlight: (ledger?.reservations ?? []).map((r) => ({\n amount: toMoney(r.amountAtomic),\n ageSeconds: Math.max(0, Math.round((now() - r.atMs) / 1000)),\n ...(r.requestKey !== undefined ? { request: r.requestKey } : {}),\n })),\n };\n const budgetLine =\n budgetAtomic === null\n ? 'no daily limit'\n : `of ${toMoney(budgetAtomic.toString()).usd} USD in the rolling 24h window`;\n return {\n data,\n humanLines: [\n `spent ${toMoney(committedAtomic.toString()).usd} USD total; automatic exposure ${toMoney(automaticAtomic.toString()).usd} USD ${budgetLine}`,\n `reserved ${toMoney(reservedAtomic.toString()).usd} USD in ${data.inFlight.length} open request(s)`,\n `automatic router up to ${toMoney(settings.policy.maxAutoSpendAtomic.toString()).usd} USD per call; manual pay always requires consent`,\n ...warnings,\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBACpB,KACA,OAAmB,CAAC,GACI;AACxB,QAAM,MAAM,KAAK,OAAO,KAAK;AAC7B,QAAM,WAAW,MAAM,uBAAuB,GAAG;AAGjD,QAAM,SAAS,MAAM,iBAAiB,IAAI,SAAS,EAAE,IAAI,CAAC;AAC1D,QAAM,kBAAkB,OAAO,QAAQ,mBAAmB,GAAG;AAC7D,QAAM,kBAAkB,QAAQ,gBAAgB,CAAC,GAAG;AAAA,IAClD,CAAC,KAAK,MAAM,MAAM,OAAO,EAAE,YAAY;AAAA,IACvC;AAAA,EACF;AACA,QAAM,UAAU,mBAAmB,MAAM,cAAc,IAAI,OAAO,CAAC;AACnE,QAAM,WAAW,QAAQ,SACrB,CAAC,yBAAyB,QAAQ,KAAK,IAAI,CAAC,KAAK,wBAAwB,EAAE,IAC3E,CAAC;AACL,QAAM,kBAAkB,WAAW,OAAO,KAAK,QAAQ,MAAM;AAC7D,QAAM,eAAe,SAAS,OAAO;AACrC,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AYMENT_GUIDANCE } from '../lib/config';\nimport { spentOf } from '../lib/spend-ledger';\nimport { resolveContextSettings } from '../lib/settings';\nimport { readSpendSummary } from '../lib/wallet/spend';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin status`: what this machine has spent and what it is still holding.\n *\n * IT READS `spend.json`, NOT THE BACKEND. The rolling window, the committed\n * total and the reservations still open are the local truth about money, and\n * the reservations are also the record of a request whose outcome is unknown:\n * an authorization that was transmitted is committed, so anything still open\n * here is either in flight or a crash that has not yet aged out.\n */\n\nexport interface StatusDeps {\n now?: () => number;\n}\n\nexport async function runRouterStatus(\n ctx: CommandContext,\n deps: StatusDeps = {},\n): Promise<CommandResult> {\n const now = deps.now ?? Date.now;\n const settings = await resolveContextSettings(ctx);\n // The same projection an authorization would make, so what this prints is\n // what the next lookup would actually be measured against.\n const ledger = await readSpendSummary(ctx.dataDir, { now });\n const committedAtomic = BigInt(ledger?.committedAtomic ?? '0');\n const reservedAtomic = (ledger?.reservations ?? []).reduce(\n (sum, r) => sum + BigInt(r.amountAtomic),\n 0n,\n );\n const retired = retiredPaymentKeys(await loadRawConfig(ctx.dataDir));\n const warnings = retired.length\n ? [`Ignored retired keys: ${retired.join(', ')}. ${RETIRED_PAYMENT_GUIDANCE}`]\n : [];\n const automaticAtomic = ledger === null ? 0n : spentOf(ledger);\n const budgetAtomic = settings.policy.sessionBudgetAtomic;\n const data = {\n baseUrl: settings.baseUrl,\n warnings,\n window: {\n startedAtMs: ledger?.windowStartMs ?? null,\n committed: toMoney(committedAtomic.toString()),\n automaticExposure: toMoney(automaticAtomic.toString()),\n reserved: toMoney(reservedAtomic.toString()),\n budget: budgetAtomic === null ? null : toMoney(budgetAtomic.toString()),\n },\n caps: {\n maxAutoSpend: toMoney(settings.policy.maxAutoSpendAtomic.toString()),\n },\n inFlight: (ledger?.reservations ?? []).map((r) => ({\n amount: toMoney(r.amountAtomic),\n ageSeconds: Math.max(0, Math.round((now() - r.atMs) / 1000)),\n ...(r.requestKey !== undefined ? { request: r.requestKey } : {}),\n })),\n };\n const budgetLine =\n budgetAtomic === null\n ? 'no daily limit'\n : `of ${toMoney(budgetAtomic.toString()).usd} USD in the rolling 24h window`;\n return {\n data,\n humanLines: [\n `spent ${toMoney(committedAtomic.toString()).usd} USD total; automatic exposure ${toMoney(automaticAtomic.toString()).usd} USD ${budgetLine}`,\n `reserved ${toMoney(reservedAtomic.toString()).usd} USD in ${data.inFlight.length} open request(s)`,\n `automatic router up to ${toMoney(settings.policy.maxAutoSpendAtomic.toString()).usd} USD per call; manual pay always requires consent`,\n ...warnings,\n ],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,eAAsB,gBACpB,KACA,OAAmB,CAAC,GACI;AACxB,QAAM,MAAM,KAAK,OAAO,KAAK;AAC7B,QAAM,WAAW,MAAM,uBAAuB,GAAG;AAGjD,QAAM,SAAS,MAAM,iBAAiB,IAAI,SAAS,EAAE,IAAI,CAAC;AAC1D,QAAM,kBAAkB,OAAO,QAAQ,mBAAmB,GAAG;AAC7D,QAAM,kBAAkB,QAAQ,gBAAgB,CAAC,GAAG;AAAA,IAClD,CAAC,KAAK,MAAM,MAAM,OAAO,EAAE,YAAY;AAAA,IACvC;AAAA,EACF;AACA,QAAM,UAAU,mBAAmB,MAAM,cAAc,IAAI,OAAO,CAAC;AACnE,QAAM,WAAW,QAAQ,SACrB,CAAC,yBAAyB,QAAQ,KAAK,IAAI,CAAC,KAAK,wBAAwB,EAAE,IAC3E,CAAC;AACL,QAAM,kBAAkB,WAAW,OAAO,KAAK,QAAQ,MAAM;AAC7D,QAAM,eAAe,SAAS,OAAO;AACrC,QAAM,OAAO;AAAA,IACX,SAAS,SAAS;AAAA,IAClB;AAAA,IACA,QAAQ;AAAA,MACN,aAAa,QAAQ,iBAAiB;AAAA,MACtC,WAAW,QAAQ,gBAAgB,SAAS,CAAC;AAAA,MAC7C,mBAAmB,QAAQ,gBAAgB,SAAS,CAAC;AAAA,MACrD,UAAU,QAAQ,eAAe,SAAS,CAAC;AAAA,MAC3C,QAAQ,iBAAiB,OAAO,OAAO,QAAQ,aAAa,SAAS,CAAC;AAAA,IACxE;AAAA,IACA,MAAM;AAAA,MACJ,cAAc,QAAQ,SAAS,OAAO,mBAAmB,SAAS,CAAC;AAAA,IACrE;AAAA,IACA,WAAW,QAAQ,gBAAgB,CAAC,GAAG,IAAI,CAAC,OAAO;AAAA,MACjD,QAAQ,QAAQ,EAAE,YAAY;AAAA,MAC9B,YAAY,KAAK,IAAI,GAAG,KAAK,OAAO,IAAI,IAAI,EAAE,QAAQ,GAAI,CAAC;AAAA,MAC3D,GAAI,EAAE,eAAe,SAAY,EAAE,SAAS,EAAE,WAAW,IAAI,CAAC;AAAA,IAChE,EAAE;AAAA,EACJ;AACA,QAAM,aACJ,iBAAiB,OACb,mBACA,MAAM,QAAQ,aAAa,SAAS,CAAC,EAAE,GAAG;AAChD,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,MACV,SAAS,QAAQ,gBAAgB,SAAS,CAAC,EAAE,GAAG,kCAAkC,QAAQ,gBAAgB,SAAS,CAAC,EAAE,GAAG,QAAQ,UAAU;AAAA,MAC3I,YAAY,QAAQ,eAAe,SAAS,CAAC,EAAE,GAAG,WAAW,KAAK,SAAS,MAAM;AAAA,MACjF,0BAA0B,QAAQ,SAAS,OAAO,mBAAmB,SAAS,CAAC,EAAE,GAAG;AAAA,MACpF,GAAG;AAAA,IACL;AAAA,EACF;AACF;","names":[]}
@@ -1,14 +1,13 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  renderProgress
4
- } from "./chunk-AWKQSKUL.js";
4
+ } from "./chunk-KAMRYUK2.js";
5
5
  import {
6
6
  routerSettings
7
- } from "./chunk-DATCR7AU.js";
8
- import "./chunk-G4AM2SOL.js";
9
- import "./chunk-6ZSGER3A.js";
10
- import "./chunk-VIOUZW7Z.js";
11
- import "./chunk-JLEF5WHM.js";
7
+ } from "./chunk-ZO3X5NPG.js";
8
+ import "./chunk-ZP7AHN7Z.js";
9
+ import "./chunk-FZTSGQVK.js";
10
+ import "./chunk-QTND6XWJ.js";
12
11
  import "./chunk-K6AXXYCG.js";
13
12
  import "./chunk-ZXTAQYNA.js";
14
13
 
@@ -84,4 +83,4 @@ export {
84
83
  runStatusLine,
85
84
  statusLineMain
86
85
  };
87
- //# sourceMappingURL=status-line-3IQKGRUH.js.map
86
+ //# sourceMappingURL=status-line-2G5JPQAE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/router/status-line.ts"],"sourcesContent":["import { renderProgress } from './progress';\nimport { routerSettings } from './settings';\nimport type { Io } from '../lib/output';\n\n/**\n * `tenjin status-line`: the live footer Claude Code runs on its own refresh.\n *\n * CHEAP AND READ-ONLY. One JSON event on stdin for the session identity, the\n * router's own switch for its directory, one read of that session's progress\n * directory, one line out. No network call, no wallet, no write: it runs once a\n * second for as long as a session is open, so anything it touched would be\n * touched 3,600 times an hour.\n *\n * IT CANNOT FAIL LOUDLY either. Every error path writes nothing and returns, so\n * the command exits 0 with empty output and the harness shows no footer.\n */\n\n/** Claude Code's status event is small; anything larger is not one. */\nconst MAX_EVENT_BYTES = 64_000;\n/** The harness writes the event immediately, so this is a liveness check. */\nexport const STDIN_TIMEOUT_MS = 1_000;\n\nexport interface StatusLineDeps {\n dataDir: string;\n /** Test seam for the harness event; production reads stdin. */\n readEvent?: () => Promise<string>;\n env?: NodeJS.ProcessEnv;\n now?: () => number;\n}\n\n/**\n * The bin entry's fast path for a bare `tenjin status-line`, which runs on a\n * one-second timer: commander and the command tree cost about 120 ms of parse\n * per tick over this path. It does load zod, for the router's own switch\n * through the one config parser, about 17 ms a tick. `dist-chunks.test.ts`\n * pins what it may load.\n */\nexport async function statusLineMain(): Promise<void> {\n const { dataDir } = await import('../lib/paths');\n await runStatusLine(\n { stdout: process.stdout, stderr: process.stderr, isTTY: false },\n { dataDir: dataDir(process.env) },\n );\n}\n\nexport async function runStatusLine(io: Io, deps: StatusLineDeps): Promise<void> {\n let rendered: string;\n try {\n const raw = await (deps.readEvent ?? readStdin)();\n const event: unknown = JSON.parse(raw);\n const sessionId = sessionIdOf(event);\n if (sessionId === null) return;\n // Off here means no footer: the router is not running in this directory.\n const router = await routerSettings(\n { cwd: cwdOf(event) ?? process.cwd(), dataDir: deps.dataDir },\n { warn: () => undefined },\n );\n if (!router.enabled.value) return;\n const columns = Number((deps.env ?? process.env).COLUMNS);\n rendered = await renderProgress(deps.dataDir, sessionId, {\n ...(Number.isFinite(columns) && columns > 0 ? { columns } : {}),\n ...(deps.now !== undefined ? { now: deps.now() } : {}),\n });\n } catch {\n return;\n }\n if (rendered.length > 0) io.stdout.write(`${rendered}\\n`);\n}\n\n/**\n * The session identity, and nothing else off the event. A footer that showed\n * the wrong session's lookups would be a leak between two terminals, so an\n * event without a plain, bounded `session_id` renders nothing at all.\n */\nfunction sessionIdOf(event: unknown): string | null {\n if (event === null || typeof event !== 'object' || Array.isArray(event)) return null;\n const value = (event as { session_id?: unknown }).session_id;\n if (typeof value !== 'string' || value.length === 0 || value.length > 200) return null;\n return value;\n}\n\n/** The session's working directory, which `router.*` resolves from. */\nfunction cwdOf(event: unknown): string | null {\n const value = (event as { cwd?: unknown }).cwd;\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\nasync function readStdin(): Promise<string> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const timer = setTimeout(() => reject(new Error('no harness event')), STDIN_TIMEOUT_MS);\n process.stdin.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_EVENT_BYTES) {\n clearTimeout(timer);\n reject(new Error('harness event too large'));\n return;\n }\n chunks.push(chunk);\n });\n process.stdin.once('end', () => {\n clearTimeout(timer);\n resolve(Buffer.concat(chunks).toString('utf8'));\n });\n process.stdin.once('error', () => {\n clearTimeout(timer);\n reject(new Error('harness event unreadable'));\n });\n });\n}\n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M,WAAW,KAAK,MAAM,SAAS,IAAK,QAAO;AAClF,SAAO;AACT;AAGA,SAAS,MAAM,OAA+B;AAC5C,QAAM,QAAS,MAA4B;AAC3C,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;AACjE;AAEA,eAAe,YAA6B;AAC1C,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAmB,CAAC;AAC1B,QAAI,OAAO;AACX,UAAM,QAAQ,WAAW,MAAM,OAAO,IAAI,MAAM,kBAAkB,CAAC,GAAG,gBAAgB;AACtF,YAAQ,MAAM,GAAG,QAAQ,CAAC,UAAkB;AAC1C,cAAQ,MAAM;AACd,UAAI,OAAO,iBAAiB;AAC1B,qBAAa,KAAK;AAClB,eAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C;AAAA,MACF;AACA,aAAO,KAAK,KAAK;AAAA,IACnB,CAAC;AACD,YAAQ,MAAM,KAAK,OAAO,MAAM;AAC9B,mBAAa,KAAK;AAClB,cAAQ,OAAO,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC;AAAA,IAChD,CAAC;AACD,YAAQ,MAAM,KAAK,SAAS,MAAM;AAChC,mBAAa,KAAK;AAClB,aAAO,IAAI,MAAM,0BAA0B,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/router/status-line.ts"],"sourcesContent":["import { renderProgress } from './progress';\nimport { routerSettings } from './settings';\nimport type { Io } from '../lib/output';\n\n/**\n * `tenjin status-line`: the live footer Claude Code runs on its own refresh.\n *\n * CHEAP AND READ-ONLY. One JSON event on stdin for the session identity, the\n * router's own switch for its directory, one read of that session's progress\n * directory, one line out. No network call, no wallet, no write: it runs once a\n * second for as long as a session is open, so anything it touched would be\n * touched 3,600 times an hour.\n *\n * IT CANNOT FAIL LOUDLY either. Every error path writes nothing and returns, so\n * the command exits 0 with empty output and the harness shows no footer.\n */\n\n/** Claude Code's status event is small; anything larger is not one. */\nconst MAX_EVENT_BYTES = 64_000;\n/** The harness writes the event immediately, so this is a liveness check. */\nexport const STDIN_TIMEOUT_MS = 1_000;\n\nexport interface StatusLineDeps {\n dataDir: string;\n /** Test seam for the harness event; production reads stdin. */\n readEvent?: () => Promise<string>;\n env?: NodeJS.ProcessEnv;\n now?: () => number;\n}\n\n/**\n * The bin entry's fast path for a bare `tenjin status-line`, which runs on a\n * one-second timer: commander and the command tree cost about 120 ms of parse\n * per tick over this path. It does load zod, for the router's own switch\n * through the one config parser, about 17 ms a tick. `dist-chunks.test.ts`\n * pins what it may load.\n */\nexport async function statusLineMain(): Promise<void> {\n const { dataDir } = await import('../lib/paths');\n await runStatusLine(\n { stdout: process.stdout, stderr: process.stderr, isTTY: false },\n { dataDir: dataDir(process.env) },\n );\n}\n\nexport async function runStatusLine(io: Io, deps: StatusLineDeps): Promise<void> {\n let rendered: string;\n try {\n const raw = await (deps.readEvent ?? readStdin)();\n const event: unknown = JSON.parse(raw);\n const sessionId = sessionIdOf(event);\n if (sessionId === null) return;\n // Off here means no footer: the router is not running in this directory.\n const router = await routerSettings(\n { cwd: cwdOf(event) ?? process.cwd(), dataDir: deps.dataDir },\n { warn: () => undefined },\n );\n if (!router.enabled.value) return;\n const columns = Number((deps.env ?? process.env).COLUMNS);\n rendered = await renderProgress(deps.dataDir, sessionId, {\n ...(Number.isFinite(columns) && columns > 0 ? { columns } : {}),\n ...(deps.now !== undefined ? { now: deps.now() } : {}),\n });\n } catch {\n return;\n }\n if (rendered.length > 0) io.stdout.write(`${rendered}\\n`);\n}\n\n/**\n * The session identity, and nothing else off the event. A footer that showed\n * the wrong session's lookups would be a leak between two terminals, so an\n * event without a plain, bounded `session_id` renders nothing at all.\n */\nfunction sessionIdOf(event: unknown): string | null {\n if (event === null || typeof event !== 'object' || Array.isArray(event)) return null;\n const value = (event as { session_id?: unknown }).session_id;\n if (typeof value !== 'string' || value.length === 0 || value.length > 200) return null;\n return value;\n}\n\n/** The session's working directory, which `router.*` resolves from. */\nfunction cwdOf(event: unknown): string | null {\n const value = (event as { cwd?: unknown }).cwd;\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\nasync function readStdin(): Promise<string> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const timer = setTimeout(() => reject(new Error('no harness event')), STDIN_TIMEOUT_MS);\n process.stdin.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_EVENT_BYTES) {\n clearTimeout(timer);\n reject(new Error('harness event too large'));\n return;\n }\n chunks.push(chunk);\n });\n process.stdin.once('end', () => {\n clearTimeout(timer);\n resolve(Buffer.concat(chunks).toString('utf8'));\n });\n process.stdin.once('error', () => {\n clearTimeout(timer);\n reject(new Error('harness event unreadable'));\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,IAAM,kBAAkB;AAEjB,IAAM,mBAAmB;AAiBhC,eAAsB,iBAAgC;AACpD,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,qBAAc;AAC/C,QAAM;AAAA,IACJ,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,OAAO,MAAM;AAAA,IAC/D,EAAE,SAAS,QAAQ,QAAQ,GAAG,EAAE;AAAA,EAClC;AACF;AAEA,eAAsB,cAAc,IAAQ,MAAqC;AAC/E,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,OAAO,KAAK,aAAa,WAAW;AAChD,UAAM,QAAiB,KAAK,MAAM,GAAG;AACrC,UAAM,YAAY,YAAY,KAAK;AACnC,QAAI,cAAc,KAAM;AAExB,UAAM,SAAS,MAAM;AAAA,MACnB,EAAE,KAAK,MAAM,KAAK,KAAK,QAAQ,IAAI,GAAG,SAAS,KAAK,QAAQ;AAAA,MAC5D,EAAE,MAAM,MAAM,OAAU;AAAA,IAC1B;AACA,QAAI,CAAC,OAAO,QAAQ,MAAO;AAC3B,UAAM,UAAU,QAAQ,KAAK,OAAO,QAAQ,KAAK,OAAO;AACxD,eA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;AAClB,aAAO,IAAI,MAAM,0BAA0B,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -0,0 +1,136 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ findClaudeBinary,
4
+ folderFor,
5
+ inspectLegacyInstall,
6
+ jsonList,
7
+ jsonResult,
8
+ ownMarketplace,
9
+ removeLegacyInstall,
10
+ removePluginFolder,
11
+ runClaude,
12
+ settingsInstallPaths
13
+ } from "./chunk-VSUHGRVB.js";
14
+ import "./chunk-W6JX4LYF.js";
15
+ import {
16
+ persistRouterProject
17
+ } from "./chunk-ZG6ZZLO7.js";
18
+ import "./chunk-AKWGE6JQ.js";
19
+ import {
20
+ MARKETPLACE_NAME,
21
+ PLUGIN_ID
22
+ } from "./chunk-DYSDQE7S.js";
23
+ import "./chunk-A36LQPHV.js";
24
+ import "./chunk-P7LABKCW.js";
25
+ import "./chunk-MEFB5KHA.js";
26
+ import "./chunk-B2L53TMK.js";
27
+ import "./chunk-AO54FM4H.js";
28
+ import "./chunk-7H3RN4WJ.js";
29
+ import "./chunk-XVTD7UWR.js";
30
+ import "./chunk-ZO3X5NPG.js";
31
+ import {
32
+ removeAliveState
33
+ } from "./chunk-6W5GYG3W.js";
34
+ import "./chunk-S4SAZ7OD.js";
35
+ import "./chunk-UOW5JXYY.js";
36
+ import "./chunk-2I4QTOLB.js";
37
+ import "./chunk-ZP7AHN7Z.js";
38
+ import "./chunk-FZTSGQVK.js";
39
+ import "./chunk-QTND6XWJ.js";
40
+ import "./chunk-K6AXXYCG.js";
41
+ import "./chunk-RLPLYUME.js";
42
+ import "./chunk-ZXTAQYNA.js";
43
+
44
+ // src/router/uninstall.ts
45
+ import { homedir } from "node:os";
46
+ import { isAbsolute } from "node:path";
47
+ async function runRouterUninstall(args, ctx, deps = {}) {
48
+ const env = deps.env ?? process.env;
49
+ const home = deps.homeDir ?? homedir();
50
+ if (!isAbsolute(home)) throw new Error("The home directory is not an absolute path.");
51
+ const cwd = deps.cwd ?? process.cwd();
52
+ const project = args.project === true;
53
+ const scope = project ? "local" : "user";
54
+ const binary = (deps.findClaude ?? findClaudeBinary)(env);
55
+ const plugin = await removePlugin(binary, scope, env, home, cwd);
56
+ const paths = settingsInstallPaths(project, env, home, cwd);
57
+ const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
58
+ const settings = legacy.present ? await removeLegacyInstall(legacy, { binary, env, cwd, mcpScope: paths.mcpScope }) : null;
59
+ const alive = await removeAliveState(ctx.dataDir);
60
+ if (project) await persistRouterProject(ctx.dataDir, cwd, false).catch(() => void 0);
61
+ const data = {
62
+ plugin,
63
+ settings: { path: paths.settingsPath, found: legacy.present, removed: settings },
64
+ aliveRemoved: alive,
65
+ kept: ["wallet.json", "spend.json", "config.json"]
66
+ };
67
+ return { data, humanLines: uninstallLines(plugin, paths.settingsPath, settings) };
68
+ }
69
+ async function removePlugin(binary, scope, env, home, cwd) {
70
+ const folder = await removePluginFolder(folderFor(scope, env, home, cwd));
71
+ if (binary === null) {
72
+ return {
73
+ plugin: "kept",
74
+ marketplace: "kept",
75
+ folder,
76
+ reason: `no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so ${PLUGIN_ID} could not be checked; if Claude Code still lists it, type /plugin uninstall ${PLUGIN_ID} in a Claude Code session`
77
+ };
78
+ }
79
+ const run = (a) => runClaude(binary, a, { env, cwd });
80
+ const uninstall = await run(["plugin", "uninstall", PLUGIN_ID, "--scope", scope, "--json"]);
81
+ const result = jsonResult(uninstall.stdout);
82
+ const pluginState = uninstall.code === 0 ? "removed" : result?.failureCode === "not_installed" ? "absent" : "kept";
83
+ const listed = jsonList((await run(["plugin", "marketplace", "list", "--json"])).stdout) ?? [];
84
+ const row = listed.find((m) => m.name === MARKETPLACE_NAME);
85
+ let marketplace = "absent";
86
+ if (row !== void 0) {
87
+ if (await ownMarketplace(row)) {
88
+ const scoped = scope === "user" ? [] : ["--scope", scope];
89
+ const removed = await run([
90
+ "plugin",
91
+ "marketplace",
92
+ "remove",
93
+ MARKETPLACE_NAME,
94
+ ...scoped,
95
+ "--json"
96
+ ]);
97
+ marketplace = removed.code === 0 ? "removed" : "kept";
98
+ } else marketplace = "kept";
99
+ }
100
+ const message = typeof result?.message === "string" ? result.message : uninstall.stderr.trim().slice(0, 200);
101
+ return {
102
+ plugin: pluginState,
103
+ marketplace,
104
+ folder,
105
+ ...pluginState === "kept" ? { reason: `claude plugin uninstall did not succeed: ${message}` } : {}
106
+ };
107
+ }
108
+ function uninstallLines(plugin, settingsPath, settings) {
109
+ const lines = [
110
+ plugin.plugin === "removed" ? `removed the ${PLUGIN_ID} plugin` : plugin.plugin === "absent" ? `plugin: ${PLUGIN_ID} was not installed` : `plugin: ${plugin.reason ?? "left in place"}`
111
+ ];
112
+ if (plugin.marketplace === "removed") lines.push(`removed the ${MARKETPLACE_NAME} marketplace`);
113
+ if (plugin.folder.removed) {
114
+ lines.push(
115
+ plugin.folder.left.length === 0 ? `removed the plugin folder ${plugin.folder.path}` : `removed the plugin's files from ${plugin.folder.path}; kept what is not Tenjin's: ${plugin.folder.left.join(", ")}`
116
+ );
117
+ } else if (plugin.folder.reason !== void 0) lines.push(`folder: ${plugin.folder.reason}`);
118
+ if (settings !== null) {
119
+ const parts = [
120
+ ...settings.events.length > 0 ? [`hook entries (${settings.events.join(", ")})`] : [],
121
+ ...settings.allowRule || settings.denyRule ? ["the permission rules"] : [],
122
+ ...settings.statusLine !== "kept" ? ["the status line"] : [],
123
+ ...settings.mcp === "removed" ? ["the x402 MCP server"] : []
124
+ ];
125
+ if (parts.length > 0) {
126
+ lines.push(`removed the settings install's ${parts.join(", ")} from ${settingsPath}`);
127
+ }
128
+ lines.push(...settings.warnings.map((w) => `settings: ${w}`));
129
+ }
130
+ lines.push("Your wallet, spend ledger and config are kept.");
131
+ return lines;
132
+ }
133
+ export {
134
+ runRouterUninstall
135
+ };
136
+ //# sourceMappingURL=uninstall-THKUH5ZT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport { isAbsolute } from 'node:path';\nimport { persistRouterProject } from '../commands/config';\nimport type { CommandContext, CommandResult } from '../context';\nimport { removeAliveState } from './alive';\nimport { findClaudeBinary, jsonList, jsonResult, runClaude, type ClaudeBinary } from './claude-cli';\nimport { settingsInstallPaths } from './install';\nimport { inspectLegacyInstall, removeLegacyInstall, type LegacyRemoval } from './legacy-install';\nimport { MARKETPLACE_NAME, PLUGIN_ID } from './names';\nimport { removePluginFolder, type FolderRemoval } from './plugin-folder';\nimport { folderFor, ownMarketplace, type PluginScope } from './plugin-registration';\n\n/**\n * `tenjin uninstall`: take out the plugin and anything a settings install of\n * an earlier release left, and nothing else.\n *\n * THE PLUGIN goes through Claude Code's own commands (`claude plugin\n * uninstall`, then `claude plugin marketplace remove` for the marketplace\n * `install` added), and a plugin folder of ours loses its listed files. The\n * settings install's hook entries, rules, status line and `x402` server go\n * under the exact-shape rules of `legacy-install.ts`.\n *\n * THE WALLET AND `spend.json` STAY. Removing an integration is not a reason to\n * destroy a key that holds funds or a ledger that records what was spent; both\n * are the user's, and `tenjin wallet` is where they go to move either.\n */\n\nexport interface RouterUninstallArgs {\n project?: boolean;\n}\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n}\n\nexport interface PluginRemoval {\n /** `removed`, `absent` (it was not installed), or `kept` with the reason. */\n plugin: 'removed' | 'absent' | 'kept';\n marketplace: 'removed' | 'absent' | 'kept';\n folder: FolderRemoval;\n reason?: string;\n}\n\nexport async function runRouterUninstall(\n args: RouterUninstallArgs,\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n if (!isAbsolute(home)) throw new Error('The home directory is not an absolute path.');\n const cwd = deps.cwd ?? process.cwd();\n const project = args.project === true;\n const scope: PluginScope = project ? 'local' : 'user';\n const binary = (deps.findClaude ?? findClaudeBinary)(env);\n\n const plugin = await removePlugin(binary, scope, env, home, cwd);\n const paths = settingsInstallPaths(project, env, home, cwd);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n const settings: LegacyRemoval | null = legacy.present\n ? await removeLegacyInstall(legacy, { binary, env, cwd, mcpScope: paths.mcpScope })\n : null;\n const alive = await removeAliveState(ctx.dataDir);\n // Forgotten, so a later `tenjin update` does not go looking for a project\n // this machine no longer wires.\n if (project) await persistRouterProject(ctx.dataDir, cwd, false).catch(() => undefined);\n const data = {\n plugin,\n settings: { path: paths.settingsPath, found: legacy.present, removed: settings },\n aliveRemoved: alive,\n kept: ['wallet.json', 'spend.json', 'config.json'],\n };\n return { data, humanLines: uninstallLines(plugin, paths.settingsPath, settings) };\n}\n\nasync function removePlugin(\n binary: ClaudeBinary | null,\n scope: PluginScope,\n env: NodeJS.ProcessEnv,\n home: string,\n cwd: string,\n): Promise<PluginRemoval> {\n const folder = await removePluginFolder(folderFor(scope, env, home, cwd));\n if (binary === null) {\n return {\n plugin: 'kept',\n marketplace: 'kept',\n folder,\n reason: `no claude binary on PATH or in CLAUDE_CODE_EXECPATH, so ${PLUGIN_ID} could not be checked; if Claude Code still lists it, type /plugin uninstall ${PLUGIN_ID} in a Claude Code session`,\n };\n }\n const run = (a: string[]) => runClaude(binary, a, { env, cwd });\n const uninstall = await run(['plugin', 'uninstall', PLUGIN_ID, '--scope', scope, '--json']);\n const result = jsonResult(uninstall.stdout);\n const pluginState: PluginRemoval['plugin'] =\n uninstall.code === 0 ? 'removed' : result?.failureCode === 'not_installed' ? 'absent' : 'kept';\n // THE MARKETPLACE GOES ONLY WHEN IT IS THE ONE `install` ADDED. A marketplace\n // of the same name from anywhere else is somebody else's.\n const listed = jsonList((await run(['plugin', 'marketplace', 'list', '--json'])).stdout) ?? [];\n const row = listed.find((m) => m.name === MARKETPLACE_NAME);\n let marketplace: PluginRemoval['marketplace'] = 'absent';\n if (row !== undefined) {\n if (await ownMarketplace(row)) {\n // Named only for a project install, as `install` added it.\n const scoped = scope === 'user' ? [] : ['--scope', scope];\n const removed = await run([\n 'plugin',\n 'marketplace',\n 'remove',\n MARKETPLACE_NAME,\n ...scoped,\n '--json',\n ]);\n marketplace = removed.code === 0 ? 'removed' : 'kept';\n } else marketplace = 'kept';\n }\n const message =\n typeof result?.message === 'string' ? result.message : uninstall.stderr.trim().slice(0, 200);\n return {\n plugin: pluginState,\n marketplace,\n folder,\n ...(pluginState === 'kept'\n ? { reason: `claude plugin uninstall did not succeed: ${message}` }\n : {}),\n };\n}\n\nfunction uninstallLines(\n plugin: PluginRemoval,\n settingsPath: string,\n settings: LegacyRemoval | null,\n): string[] {\n const lines: string[] = [\n plugin.plugin === 'removed'\n ? `removed the ${PLUGIN_ID} plugin`\n : plugin.plugin === 'absent'\n ? `plugin: ${PLUGIN_ID} was not installed`\n : `plugin: ${plugin.reason ?? 'left in place'}`,\n ];\n if (plugin.marketplace === 'removed') lines.push(`removed the ${MARKETPLACE_NAME} marketplace`);\n if (plugin.folder.removed) {\n lines.push(\n plugin.folder.left.length === 0\n ? `removed the plugin folder ${plugin.folder.path}`\n : `removed the plugin's files from ${plugin.folder.path}; kept what is not Tenjin's: ${plugin.folder.left.join(', ')}`,\n );\n } else if (plugin.folder.reason !== undefined) lines.push(`folder: ${plugin.folder.reason}`);\n if (settings !== null) {\n const parts = [\n ...(settings.events.length > 0 ? [`hook entries (${settings.events.join(', ')})`] : []),\n ...(settings.allowRule || settings.denyRule ? ['the permission rules'] : []),\n ...(settings.statusLine !== 'kept' ? ['the status line'] : []),\n ...(settings.mcp === 'removed' ? ['the x402 MCP server'] : []),\n ];\n if (parts.length > 0) {\n lines.push(`removed the settings install's ${parts.join(', ')} from ${settingsPath}`);\n }\n lines.push(...settings.warnings.map((w) => `settings: ${w}`));\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ACtB,OAAO,WAAW,YACd,eAAe,SAAS,YACxB,OAAO,WAAW,WAChB,WAAW,SAAS,uBACpB,WAAW,OAAO,UAAU,eAAe;AAAA,EACnD;AACA,MAAI,OAAO,gBAAgB,UAAW,OAAM,KAAK,eAAe,gBAAgB,cAAc;AAC9F,MAAI,OAAO,OAAO,SAAS;AACzB,UAAM;AAAA,MACJ,OAAO,OAAO,KAAK,WAAW,IAC1B,6BAA6B,OAAO,OAAO,IAAI,KAC/C,mCAAmC,OAAO,OAAO,IAAI,gCAAgC,OAAO,OAAO,KAAK,KAAK,IAAI,CAAC;AAAA,IACxH;AAAA,EACF,WAAW,OAAO,OAAO,WAAW,OAAW,OAAM,KAAK,WAAW,OAAO,OAAO,MAAM,EAAE;AAC3F,MAAI,aAAa,MAAM;AACrB,UAAM,QAAQ;AAAA,MACZ,GAAI,SAAS,OAAO,SAAS,IAAI,CAAC,iBAAiB,SAAS,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;AAAA,MACrF,GAAI,SAAS,aAAa,SAAS,WAAW,CAAC,sBAAsB,IAAI,CAAC;AAAA,MAC1E,GAAI,SAAS,eAAe,SAAS,CAAC,iBAAiB,IAAI,CAAC;AAAA,MAC5D,GAAI,SAAS,QAAQ,YAAY,CAAC,qBAAqB,IAAI,CAAC;AAAA,IAC9D;AACA,QAAI,MAAM,SAAS,GAAG;AACpB,YAAM,KAAK,kCAAkC,MAAM,KAAK,IAAI,CAAC,SAAS,YAAY,EAAE;AAAA,IACtF;AACA,UAAM,KAAK,GAAG,SAAS,SAAS,IAAI,CAAC,MAAM,aAAa,CAAC,EAAE,CAAC;AAAA,EAC9D;AACA,QAAM,KAAK,gDAAgD;AAC3D,SAAO;AACT;","names":[]}
@@ -0,0 +1,18 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ runUpdate,
4
+ spawnCapture,
5
+ versionFreeEntry
6
+ } from "./chunk-AO54FM4H.js";
7
+ import "./chunk-7H3RN4WJ.js";
8
+ import "./chunk-XVTD7UWR.js";
9
+ import "./chunk-QTND6XWJ.js";
10
+ import "./chunk-K6AXXYCG.js";
11
+ import "./chunk-RLPLYUME.js";
12
+ import "./chunk-ZXTAQYNA.js";
13
+ export {
14
+ runUpdate,
15
+ spawnCapture,
16
+ versionFreeEntry
17
+ };
18
+ //# sourceMappingURL=update-NPZDP24E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -3,12 +3,15 @@ import {
3
3
  runWalletBalance,
4
4
  runWalletCreate,
5
5
  runWalletShow
6
- } from "./chunk-2TYQD22Q.js";
6
+ } from "./chunk-MNTQMZJB.js";
7
7
  import "./chunk-PZ5N6BAL.js";
8
- import "./chunk-VNNXAYJE.js";
9
- import "./chunk-O7CUHHYU.js";
10
- import "./chunk-VXIBZ6W5.js";
11
- import "./chunk-X7I343ZY.js";
8
+ import "./chunk-BRHREK7E.js";
9
+ import "./chunk-7R37M6WV.js";
10
+ import "./chunk-ZP5PV3JB.js";
11
+ import "./chunk-YFJJYHVG.js";
12
+ import "./chunk-MEFB5KHA.js";
13
+ import "./chunk-B2L53TMK.js";
14
+ import "./chunk-XVTD7UWR.js";
12
15
  import "./chunk-AWQPGIR6.js";
13
16
  import "./chunk-N35E6CM2.js";
14
17
  import "./chunk-JRGFKVAZ.js";
@@ -17,13 +20,9 @@ import "./chunk-EGELTSPU.js";
17
20
  import "./chunk-KG3D7FIF.js";
18
21
  import "./chunk-RBJPAZFI.js";
19
22
  import "./chunk-BPMWXTFX.js";
20
- import "./chunk-MEFB5KHA.js";
21
- import "./chunk-B2L53TMK.js";
22
- import "./chunk-5FGO6TYT.js";
23
23
  import "./chunk-2I4QTOLB.js";
24
- import "./chunk-6ZSGER3A.js";
25
- import "./chunk-VIOUZW7Z.js";
26
- import "./chunk-JLEF5WHM.js";
24
+ import "./chunk-FZTSGQVK.js";
25
+ import "./chunk-QTND6XWJ.js";
27
26
  import "./chunk-K6AXXYCG.js";
28
27
  import "./chunk-ZXTAQYNA.js";
29
28
  export {
@@ -31,4 +30,4 @@ export {
31
30
  runWalletCreate,
32
31
  runWalletShow
33
32
  };
34
- //# sourceMappingURL=wallet-B3FVHNTS.js.map
33
+ //# sourceMappingURL=wallet-53EFH4M5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}