tenjin-cli 0.1.0-alpha.32 → 0.1.0-alpha.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +42 -23
  2. package/dist/{_esm-RLLC72MS.js → _esm-BIN7VY2L.js} +2 -2
  3. package/dist/{alive-MROUMFH3.js → alive-GSOWKUOY.js} +4 -4
  4. package/dist/{auto-update-OPWMRZLS.js → auto-update-Y24UL56V.js} +5 -3
  5. package/dist/{chunk-2GNOFONN.js → chunk-2M2VPI2E.js} +2 -2
  6. package/dist/chunk-2M2VPI2E.js.map +1 -0
  7. package/dist/{chunk-VUGQTZ2L.js → chunk-2RWB7RKE.js} +89 -33
  8. package/dist/chunk-2RWB7RKE.js.map +1 -0
  9. package/dist/{chunk-OTWLERSW.js → chunk-36RVGZNY.js} +2 -2
  10. package/dist/{chunk-B7EM4GGF.js → chunk-3GNJXKIT.js} +2 -2
  11. package/dist/{chunk-DRDUIZIA.js → chunk-4K7TQHNP.js} +4 -4
  12. package/dist/{chunk-SYOS5CAC.js → chunk-4YOZGGTZ.js} +73 -2
  13. package/dist/chunk-4YOZGGTZ.js.map +1 -0
  14. package/dist/{chunk-AD226HDR.js → chunk-A5GKIG5O.js} +5 -5
  15. package/dist/{chunk-JEVQ5LKO.js → chunk-AGMVASXZ.js} +3 -3
  16. package/dist/{chunk-ADV4LDTB.js → chunk-BF4XHEQK.js} +12 -2
  17. package/dist/chunk-BF4XHEQK.js.map +1 -0
  18. package/dist/{chunk-IDTRSAHE.js → chunk-C2Q76BVM.js} +48 -49
  19. package/dist/chunk-C2Q76BVM.js.map +1 -0
  20. package/dist/{chunk-VJUVFZ2D.js → chunk-FVIGCDSV.js} +1 -1
  21. package/dist/chunk-FVIGCDSV.js.map +1 -0
  22. package/dist/{chunk-QF3LSMGS.js → chunk-GTTUCOPD.js} +2 -2
  23. package/dist/{chunk-3DIL66VX.js → chunk-HGGWCP7W.js} +2 -2
  24. package/dist/{chunk-D5TOQSO4.js → chunk-HMWYAUA6.js} +10 -6
  25. package/dist/{chunk-D5TOQSO4.js.map → chunk-HMWYAUA6.js.map} +1 -1
  26. package/dist/{chunk-445VQTVM.js → chunk-IE7P2BZE.js} +2 -2
  27. package/dist/{chunk-VOZA6O7K.js → chunk-ILNIZ5I2.js} +190 -96
  28. package/dist/chunk-ILNIZ5I2.js.map +1 -0
  29. package/dist/{chunk-TF5HCP33.js → chunk-INTFHMU4.js} +4 -4
  30. package/dist/{chunk-HREHWL32.js → chunk-J57UC3DD.js} +2 -2
  31. package/dist/{chunk-AV5NZMYO.js → chunk-KM7RY2ZS.js} +2 -2
  32. package/dist/{chunk-TAW4UFFF.js → chunk-L6JEXB3E.js} +132 -132
  33. package/dist/chunk-L6JEXB3E.js.map +1 -0
  34. package/dist/{chunk-E7LGOMH6.js → chunk-LRW6S53P.js} +4 -3
  35. package/dist/chunk-LRW6S53P.js.map +1 -0
  36. package/dist/{chunk-PKHI276N.js → chunk-LXAYUOXI.js} +18 -9
  37. package/dist/chunk-LXAYUOXI.js.map +1 -0
  38. package/dist/{chunk-WOM257PW.js → chunk-NDGZDTSJ.js} +3 -3
  39. package/dist/{chunk-SFASB5FL.js → chunk-P3LFTKE7.js} +3 -14
  40. package/dist/chunk-P3LFTKE7.js.map +1 -0
  41. package/dist/{chunk-YUY4SAGM.js → chunk-RVPYTUP4.js} +5 -5
  42. package/dist/chunk-RVPYTUP4.js.map +1 -0
  43. package/dist/{chunk-GAKUQHKA.js → chunk-TC2WZLSC.js} +3 -3
  44. package/dist/{chunk-D3ZURCG7.js → chunk-TKPF35W6.js} +2 -2
  45. package/dist/{chunk-I5TDIUKM.js → chunk-U3IKUGRP.js} +23 -5
  46. package/dist/chunk-U3IKUGRP.js.map +1 -0
  47. package/dist/{chunk-BI673VEJ.js → chunk-UXZONNEQ.js} +3 -3
  48. package/dist/{chunk-PJNENX2A.js → chunk-WFSPCCVW.js} +2 -2
  49. package/dist/{chunk-PJNENX2A.js.map → chunk-WFSPCCVW.js.map} +1 -1
  50. package/dist/{chunk-DW4YTVR3.js → chunk-WXA2BWTE.js} +6 -2
  51. package/dist/chunk-WXA2BWTE.js.map +1 -0
  52. package/dist/{chunk-JRZBBPO6.js → chunk-ZDZERB6L.js} +56 -228
  53. package/dist/chunk-ZDZERB6L.js.map +1 -0
  54. package/dist/{chunk-G75OPGAK.js → chunk-ZNNXRNFD.js} +5 -3
  55. package/dist/chunk-ZNNXRNFD.js.map +1 -0
  56. package/dist/{chunk-CISYM4EO.js → chunk-ZURZHELF.js} +2 -2
  57. package/dist/{cli-FB4LOA5A.js → cli-E36SPKBW.js} +44 -44
  58. package/dist/{cli-FB4LOA5A.js.map → cli-E36SPKBW.js.map} +1 -1
  59. package/dist/{codex-event-TYVES3UX.js → codex-event-ZO2GEFE6.js} +2 -2
  60. package/dist/{codex-host-WW4H2SKT.js → codex-host-KECJVTA2.js} +3 -3
  61. package/dist/{codex-install-2C623HPW.js → codex-install-HQZDGFXW.js} +90 -47
  62. package/dist/codex-install-HQZDGFXW.js.map +1 -0
  63. package/dist/{config-HOVJFEKD.js → config-HY2E4GGW.js} +8 -8
  64. package/dist/{doctor-NKU4V5OV.js → doctor-I6XQEKWD.js} +42 -31
  65. package/dist/doctor-I6XQEKWD.js.map +1 -0
  66. package/dist/{fund-WEBHTZGN.js → fund-2QRO7OJL.js} +16 -11
  67. package/dist/{fund-WEBHTZGN.js.map → fund-2QRO7OJL.js.map} +1 -1
  68. package/dist/{hook-command-ZA2PNKS6.js → hook-command-2UBCSZG6.js} +12 -13
  69. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  70. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  71. package/dist/hosts/claude/tenjin/hooks/register.tsx +51 -11
  72. package/dist/hosts/claude/tenjin/types/index.d.ts +2 -1
  73. package/dist/{hosts-AV5MHBAU.js → hosts-DVQJ32QC.js} +2 -2
  74. package/dist/index.js +16 -15
  75. package/dist/index.js.map +1 -1
  76. package/dist/{install-PT4EZS4R.js → install-ILUX5C4A.js} +24 -17
  77. package/dist/{install-identity-5A4OE6YC.js → install-identity-TZKGY6LQ.js} +7 -7
  78. package/dist/{install-wallet-SAAPKB73.js → install-wallet-5M4OTYLX.js} +13 -13
  79. package/dist/isows-native-Q2UDIVPT.js +9 -0
  80. package/dist/isows-native-Q2UDIVPT.js.map +1 -0
  81. package/dist/{mcp-HAWKCTPQ.js → mcp-LE4DUS22.js} +23 -24
  82. package/dist/{mcp-HAWKCTPQ.js.map → mcp-LE4DUS22.js.map} +1 -1
  83. package/dist/{package-SR2WB6MK.js → package-IJFGMWEV.js} +2 -2
  84. package/dist/{pay-OXC3WKYV.js → pay-WCG3IH4R.js} +13 -13
  85. package/dist/{payments-3KHMP2MG.js → payments-HFPPWHTV.js} +6 -6
  86. package/dist/{plugin-registration-N3GRIZVM.js → plugin-registration-PZFI5GZW.js} +18 -17
  87. package/dist/{runtime-UVNUA3AS.js → runtime-UZOKSUZX.js} +145 -27
  88. package/dist/runtime-UZOKSUZX.js.map +1 -0
  89. package/dist/{runtime-fetch-EKFRNR6Z.js → runtime-fetch-ZSSSK72Y.js} +5 -2
  90. package/dist/{runtime-layout-BDWZG2TQ.js → runtime-layout-WIDILZ6K.js} +2 -2
  91. package/dist/{send-HMKJLT34.js → send-GCVEAQKL.js} +8 -8
  92. package/dist/{status-RWXIIWYS.js → status-HCVAOCN7.js} +10 -10
  93. package/dist/{status-line-77XYZP7E.js → status-line-OPCXDHL2.js} +6 -6
  94. package/dist/{uninstall-D5G67UJH.js → uninstall-BAWRBXXQ.js} +19 -18
  95. package/dist/{uninstall-D5G67UJH.js.map → uninstall-BAWRBXXQ.js.map} +1 -1
  96. package/dist/{update-LRNOEGSB.js → update-CACXLQLR.js} +20 -17
  97. package/dist/{usdc-D6X7EIQ2.js → usdc-VG4CIOUK.js} +4 -4
  98. package/dist/{viemAdapter-By13KInL-RL742ETX.js → viemAdapter-By13KInL-DOFTEIJV.js} +2 -2
  99. package/dist/{wallet-XFYC27BR.js → wallet-QL4UUXEZ.js} +11 -11
  100. package/docs/agent-permissions.md +16 -12
  101. package/docs/troubleshooting.md +5 -5
  102. package/package.json +4 -4
  103. package/scripts/installers/install.ps1 +67 -0
  104. package/scripts/installers/install.sh +68 -0
  105. package/dist/_esm-C5CRWCYU.js +0 -3737
  106. package/dist/_esm-C5CRWCYU.js.map +0 -1
  107. package/dist/chunk-2GNOFONN.js.map +0 -1
  108. package/dist/chunk-ADV4LDTB.js.map +0 -1
  109. package/dist/chunk-DW4YTVR3.js.map +0 -1
  110. package/dist/chunk-E7LGOMH6.js.map +0 -1
  111. package/dist/chunk-G75OPGAK.js.map +0 -1
  112. package/dist/chunk-I5TDIUKM.js.map +0 -1
  113. package/dist/chunk-IDTRSAHE.js.map +0 -1
  114. package/dist/chunk-JRZBBPO6.js.map +0 -1
  115. package/dist/chunk-PKHI276N.js.map +0 -1
  116. package/dist/chunk-SFASB5FL.js.map +0 -1
  117. package/dist/chunk-SYOS5CAC.js.map +0 -1
  118. package/dist/chunk-TAW4UFFF.js.map +0 -1
  119. package/dist/chunk-VJUVFZ2D.js.map +0 -1
  120. package/dist/chunk-VOZA6O7K.js.map +0 -1
  121. package/dist/chunk-VUGQTZ2L.js.map +0 -1
  122. package/dist/chunk-YUY4SAGM.js.map +0 -1
  123. package/dist/codex-install-2C623HPW.js.map +0 -1
  124. package/dist/doctor-NKU4V5OV.js.map +0 -1
  125. package/dist/runtime-UVNUA3AS.js.map +0 -1
  126. /package/dist/{_esm-RLLC72MS.js.map → _esm-BIN7VY2L.js.map} +0 -0
  127. /package/dist/{alive-MROUMFH3.js.map → alive-GSOWKUOY.js.map} +0 -0
  128. /package/dist/{auto-update-OPWMRZLS.js.map → auto-update-Y24UL56V.js.map} +0 -0
  129. /package/dist/{chunk-OTWLERSW.js.map → chunk-36RVGZNY.js.map} +0 -0
  130. /package/dist/{chunk-B7EM4GGF.js.map → chunk-3GNJXKIT.js.map} +0 -0
  131. /package/dist/{chunk-DRDUIZIA.js.map → chunk-4K7TQHNP.js.map} +0 -0
  132. /package/dist/{chunk-AD226HDR.js.map → chunk-A5GKIG5O.js.map} +0 -0
  133. /package/dist/{chunk-JEVQ5LKO.js.map → chunk-AGMVASXZ.js.map} +0 -0
  134. /package/dist/{chunk-QF3LSMGS.js.map → chunk-GTTUCOPD.js.map} +0 -0
  135. /package/dist/{chunk-3DIL66VX.js.map → chunk-HGGWCP7W.js.map} +0 -0
  136. /package/dist/{chunk-445VQTVM.js.map → chunk-IE7P2BZE.js.map} +0 -0
  137. /package/dist/{chunk-TF5HCP33.js.map → chunk-INTFHMU4.js.map} +0 -0
  138. /package/dist/{chunk-HREHWL32.js.map → chunk-J57UC3DD.js.map} +0 -0
  139. /package/dist/{chunk-AV5NZMYO.js.map → chunk-KM7RY2ZS.js.map} +0 -0
  140. /package/dist/{chunk-WOM257PW.js.map → chunk-NDGZDTSJ.js.map} +0 -0
  141. /package/dist/{chunk-GAKUQHKA.js.map → chunk-TC2WZLSC.js.map} +0 -0
  142. /package/dist/{chunk-D3ZURCG7.js.map → chunk-TKPF35W6.js.map} +0 -0
  143. /package/dist/{chunk-BI673VEJ.js.map → chunk-UXZONNEQ.js.map} +0 -0
  144. /package/dist/{chunk-CISYM4EO.js.map → chunk-ZURZHELF.js.map} +0 -0
  145. /package/dist/{codex-event-TYVES3UX.js.map → codex-event-ZO2GEFE6.js.map} +0 -0
  146. /package/dist/{codex-host-WW4H2SKT.js.map → codex-host-KECJVTA2.js.map} +0 -0
  147. /package/dist/{config-HOVJFEKD.js.map → config-HY2E4GGW.js.map} +0 -0
  148. /package/dist/{hook-command-ZA2PNKS6.js.map → hook-command-2UBCSZG6.js.map} +0 -0
  149. /package/dist/{hosts-AV5MHBAU.js.map → hosts-DVQJ32QC.js.map} +0 -0
  150. /package/dist/{install-PT4EZS4R.js.map → install-ILUX5C4A.js.map} +0 -0
  151. /package/dist/{install-identity-5A4OE6YC.js.map → install-identity-TZKGY6LQ.js.map} +0 -0
  152. /package/dist/{install-wallet-SAAPKB73.js.map → install-wallet-5M4OTYLX.js.map} +0 -0
  153. /package/dist/{package-SR2WB6MK.js.map → package-IJFGMWEV.js.map} +0 -0
  154. /package/dist/{pay-OXC3WKYV.js.map → pay-WCG3IH4R.js.map} +0 -0
  155. /package/dist/{payments-3KHMP2MG.js.map → payments-HFPPWHTV.js.map} +0 -0
  156. /package/dist/{plugin-registration-N3GRIZVM.js.map → plugin-registration-PZFI5GZW.js.map} +0 -0
  157. /package/dist/{runtime-fetch-EKFRNR6Z.js.map → runtime-fetch-ZSSSK72Y.js.map} +0 -0
  158. /package/dist/{runtime-layout-BDWZG2TQ.js.map → runtime-layout-WIDILZ6K.js.map} +0 -0
  159. /package/dist/{send-HMKJLT34.js.map → send-GCVEAQKL.js.map} +0 -0
  160. /package/dist/{status-RWXIIWYS.js.map → status-HCVAOCN7.js.map} +0 -0
  161. /package/dist/{status-line-77XYZP7E.js.map → status-line-OPCXDHL2.js.map} +0 -0
  162. /package/dist/{update-LRNOEGSB.js.map → update-CACXLQLR.js.map} +0 -0
  163. /package/dist/{usdc-D6X7EIQ2.js.map → usdc-VG4CIOUK.js.map} +0 -0
  164. /package/dist/{viemAdapter-By13KInL-RL742ETX.js.map → viemAdapter-By13KInL-DOFTEIJV.js.map} +0 -0
  165. /package/dist/{wallet-XFYC27BR.js.map → wallet-QL4UUXEZ.js.map} +0 -0
package/README.md CHANGED
@@ -44,17 +44,36 @@ Paste this into Claude Code:
44
44
  Install Tenjin from tenjin.sh
45
45
  ```
46
46
 
47
- Your agent asks before it installs or spends anything, then sets everything up. Start a new Claude Code session, and the router is on.
47
+ Your install request gives the agent permission to handle setup. It briefly explains task-context sharing before activation and asks about spending limits and adding funds. Follow its final activation instruction, then continue your task.
48
48
 
49
- Or from a terminal:
49
+ Or from a terminal (Node and npm are not required):
50
50
 
51
- ```bash
52
- npm i -g tenjin-cli
53
- tenjin install # adds the plugin and creates your wallet
54
- tenjin wallet fund 5 # optional: add $5 with a card, via Coinbase
51
+ ```sh
52
+ (
53
+ tenjin_install_dir="$(mktemp -d ./.tenjin-install.XXXXXXXX)" || exit
54
+ trap 'rm -f "$tenjin_install_dir/install.sh"; rmdir "$tenjin_install_dir"' EXIT
55
+ curl -fsSL https://tenjin.sh/install.sh -o "$tenjin_install_dir/install.sh" &&
56
+ sh "$tenjin_install_dir/install.sh"
57
+ )
55
58
  ```
56
59
 
57
- Needs Claude Code 2.1.287+, and Node.js 22+ with npm to install. Install copies Tenjin, with its own Node, into `~/.tenjin/runtime` and puts the `tenjin` command in `~/.local/bin`, so switching or removing Node later doesn't stop it. Add `--project` to set it up for one project only.
60
+ On Windows, in PowerShell:
61
+
62
+ ```powershell
63
+ irm https://tenjin.sh/install.ps1 | iex
64
+ ```
65
+
66
+ The installer downloads a pinned Node and Tenjin, verifies both, and sets up
67
+ the plugin. Supports macOS 13.5+, Windows and glibc Linux 2.28+ on x64/arm64.
68
+ Musl/Alpine and other platforms are unsupported. Needs Claude Code 2.1.287+.
69
+ Tenjin runs from `~/.tenjin/runtime`; changing or removing your system's Node
70
+ later does not stop it. Add `--project` to `tenjin install` for one project.
71
+ Plugin installation uses the default data directory; run without
72
+ `TENJIN_DATA_DIR`. Other CLI commands can still use a custom data directory.
73
+
74
+ Already use npm? Run `npm i -g tenjin-cli`, then `tenjin install`. It sets up
75
+ the same private runtime. An installation failure keeps your existing plugin
76
+ registration. Check the reported cause, then retry the install.
58
77
 
59
78
  **Codex (experimental):** run `tenjin install` in Codex or a terminal, and it sets up Codex too. [How it hooks in →](./docs/agent-permissions.md#codex)
60
79
 
@@ -75,21 +94,21 @@ The router names the tool and its price, and your agent calls it.
75
94
 
76
95
  ## What your agent can do
77
96
 
78
- | Your agent needs | With | Per call |
79
- | -------------------------------------- | ------------------------------- | ------------- |
80
- | Library docs | Context7 | free |
81
- | Web search and page reads | Exa, Firecrawl | 0.1¢ to 1.5¢ |
82
- | Math and live crypto prices | Wolfram Alpha, CoinMarketCap | 1¢ to 2¢ |
83
- | People, companies and emails | Apollo, Hunter, CompanyEnrich | 0.8¢ to 15¢ |
84
- | X and Reddit | glim | 0.1¢ to 1¢ |
85
- | Images | GPT Image, Nano Banana, Recraft | 0.1¢ to 14.4¢ |
86
- | Voiceovers, sound effects, music | ElevenLabs, Google Lyria | 1¢ to 12¢ |
87
- | Video clips | MiniMax Hailuo, Google Veo | 15.5¢ to 45¢ |
88
- | Papers and SEC filings | arXiv, PubMed, SEC EDGAR | 0.3¢ to 4¢ |
89
- | Instagram, TikTok and Google Maps | Scrape Creators, Google Maps | 2¢ |
90
- | PDFs, OCR, screenshots, hosting, email | Cloudflare and others | 0.2¢ to 50¢ |
91
-
92
- We review every tool by hand. [Every tool and its current price →](https://tenjin.sh/tools)
97
+ | Your agent needs | With | Provider price |
98
+ | -------------------------------------- | ------------------------------- | -------------- |
99
+ | Library docs | Context7 | free |
100
+ | Web search and page reads | Exa, Firecrawl | 0.1¢ to 1.5¢ |
101
+ | Math and live crypto prices | Wolfram Alpha, CoinMarketCap | 1¢ to 2¢ |
102
+ | People, companies and emails | Apollo, Hunter, CompanyEnrich | 0.8¢ to 15¢ |
103
+ | X and Reddit | glim | 0.1¢ to 1¢ |
104
+ | Images | GPT Image, Nano Banana, Recraft | 0.1¢ to 14.4¢ |
105
+ | Voiceovers, sound effects, music | ElevenLabs, Google Lyria | 1¢ to 12¢ |
106
+ | Video clips | MiniMax Hailuo, Google Veo | 15.5¢ to 45¢ |
107
+ | Papers and SEC filings | arXiv, PubMed, SEC EDGAR | 0.3¢ to 4¢ |
108
+ | Instagram, TikTok and Google Maps | Scrape Creators, Google Maps | 2¢ |
109
+ | PDFs, OCR, screenshots, hosting, email | Cloudflare and others | 0.2¢ to 50¢ |
110
+
111
+ Provider prices above exclude Tenjin's $0.003 fee per paid routing call. We review every tool by hand. [Every tool and its current price →](https://tenjin.sh/tools)
93
112
 
94
113
  ## How it works
95
114
 
@@ -109,7 +128,7 @@ The router sees your prompt and up to six earlier messages, with secrets masked,
109
128
  | Per call | $0.25 | `tenjin config set maxAutoSpend 0.50` |
110
129
 
111
130
  - A call over a limit pays nothing until you say yes. The per-call limit can't go below $0.25.
112
- - Routing costs $0.003 a call, on top of the tool's price. $5 covers about 500 web searches, 130 images or 40 voiceovers.
131
+ - Each paid routing call costs $0.003, even when no tool is suggested, separate from provider charges. Browsing tools and their specs is free.
113
132
  - Add funds with `tenjin wallet fund 5`, or send USDC on Base to the address `tenjin wallet address` prints.
114
133
 
115
134
  [How the limits and the fee work →](./docs/agent-permissions.md#what-bounds-a-payment)
@@ -125,7 +125,7 @@ import {
125
125
  withTimeout,
126
126
  zeroAddress,
127
127
  zeroHash
128
- } from "./chunk-PJNENX2A.js";
128
+ } from "./chunk-WFSPCCVW.js";
129
129
  import "./chunk-JRGFKVAZ.js";
130
130
  import {
131
131
  AbiConstructorNotFoundError,
@@ -873,4 +873,4 @@ export {
873
873
  zeroAddress,
874
874
  zeroHash
875
875
  };
876
- //# sourceMappingURL=_esm-RLLC72MS.js.map
876
+ //# sourceMappingURL=_esm-BIN7VY2L.js.map
@@ -10,13 +10,13 @@ import {
10
10
  sessionServedByPlugin,
11
11
  walletAtStart,
12
12
  walletNotice
13
- } from "./chunk-WOM257PW.js";
13
+ } from "./chunk-NDGZDTSJ.js";
14
14
  import "./chunk-BFDQ4WNW.js";
15
15
  import "./chunk-3AIHRXKO.js";
16
16
  import "./chunk-X5ZBP3IY.js";
17
17
  import "./chunk-2I4QTOLB.js";
18
- import "./chunk-2GNOFONN.js";
19
- import "./chunk-DW4YTVR3.js";
18
+ import "./chunk-2M2VPI2E.js";
19
+ import "./chunk-WXA2BWTE.js";
20
20
  import "./chunk-XQJXNMSB.js";
21
21
  import "./chunk-SNNSAGMT.js";
22
22
  import "./chunk-7WEQQJLG.js";
@@ -35,4 +35,4 @@ export {
35
35
  walletAtStart,
36
36
  walletNotice
37
37
  };
38
- //# sourceMappingURL=alive-MROUMFH3.js.map
38
+ //# sourceMappingURL=alive-GSOWKUOY.js.map
@@ -2,21 +2,23 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
2
2
  import {
3
3
  AUTO_UPDATE_FILE,
4
4
  AUTO_UPDATE_LOG,
5
+ TLS_OFF,
5
6
  autoUpdateLine,
6
7
  maybeAutoUpdate,
7
8
  readAutoUpdate,
8
9
  recordAutoUpdate
9
- } from "./chunk-ADV4LDTB.js";
10
- import "./chunk-G75OPGAK.js";
10
+ } from "./chunk-BF4XHEQK.js";
11
+ import "./chunk-ZNNXRNFD.js";
11
12
  import "./chunk-EDJWHDDL.js";
12
13
  import "./chunk-OJNTCYQQ.js";
13
14
  import "./chunk-ZXTAQYNA.js";
14
15
  export {
15
16
  AUTO_UPDATE_FILE,
16
17
  AUTO_UPDATE_LOG,
18
+ TLS_OFF,
17
19
  autoUpdateLine,
18
20
  maybeAutoUpdate,
19
21
  readAutoUpdate,
20
22
  recordAutoUpdate
21
23
  };
22
- //# sourceMappingURL=auto-update-OPWMRZLS.js.map
24
+ //# sourceMappingURL=auto-update-Y24UL56V.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  DEFAULT_RPC_URL
4
- } from "./chunk-DW4YTVR3.js";
4
+ } from "./chunk-WXA2BWTE.js";
5
5
  import {
6
6
  PRODUCTION_ORIGIN
7
7
  } from "./chunk-XQJXNMSB.js";
@@ -557,4 +557,4 @@ export {
557
557
  resolveSettings,
558
558
  resolveExperimentalBazaar
559
559
  };
560
- //# sourceMappingURL=chunk-2GNOFONN.js.map
560
+ //# sourceMappingURL=chunk-2M2VPI2E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/config.ts","../src/adapters/types.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { z } from 'zod';\nimport { CliError } from './errors';\nimport { PRODUCTION_ORIGIN } from './production-origin';\nimport { configPath } from './paths';\nimport { HARNESSES } from '../adapters/types';\nimport type { Harness } from '../adapters/types';\nimport { writeFileAtomic } from './atomic-json';\nimport { DEFAULT_RPC_URL } from './usdc-balance';\n\n/** A non-negative integer string in USDC atomic units (6-decimal base). */\nconst atomicString = z.string().regex(/^\\d+$/, 'expected an atomic USDC integer string');\n\n/** The publish consent mode (B3, D38). `full-auto` is loosening-gated, below. */\nexport const PublishModeSchema = z.enum(['review', 'auto', 'full-auto']);\nexport type PublishMode = z.infer<typeof PublishModeSchema>;\n\n/**\n * Validate a publish-mode value at a command edge (`--mode`, `--publish-mode`):\n * an unrecognized value is USAGE (exit 2), never silently dropped. `flagName` is\n * woven into the message so the failing flag is named.\n */\nexport function parsePublishModeFlag(value: string, flagName: string): PublishMode {\n const parsed = PublishModeSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n throw new CliError('USAGE', `Invalid ${flagName} ${JSON.stringify(value)}`, {\n fix: 'Use \"review\", \"auto\", or \"full-auto\".',\n });\n}\n\n/**\n * The standing answer to the MARKETPLACE gate's warn tier (lib/consent.ts,\n * `acksServerWarnings`), which is a different question from `publish.mode`: the\n * mode decides what a run asks about the findings it can see locally, and this\n * decides whether a yes already given also covers findings only the server\n * found.\n *\n * `mode` (the default) derives the answer: `full-auto` acks, and anything else\n * acks only when the server contributed nothing the local pass had not already\n * rendered. `off` never acks, whatever the mode says, which is the off switch a\n * `full-auto` machine has without changing its mode. `on` is the operator's\n * standing yes for server findings, and it still needs a yes for the run: it\n * restores the pre-gate reading of `--yes` rather than manufacturing one.\n */\nexport const AckServerWarningsSchema = z.enum(['mode', 'on', 'off']);\nexport type AckServerWarnings = z.infer<typeof AckServerWarningsSchema>;\n\n/**\n * Validate an ack-setting value at a command edge: an unrecognized value is\n * USAGE (exit 2), never silently dropped onto the looser reading.\n */\nexport function parseAckServerWarnings(value: string, keyName: string): AckServerWarnings {\n const parsed = AckServerWarningsSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n throw new CliError('USAGE', `Invalid ${keyName} ${JSON.stringify(value)}`, {\n fix: 'Use \"mode\", \"on\", or \"off\".',\n });\n}\n\n/**\n * The publish block (B3): `mode` governs the confirm cascade a `publish` runs,\n * `defaultPrice` is the atomic USDC price a card is published at when no\n * per-publish price is given (stored atomic like the spend keys), and\n * `ackServerWarnings` is the standing answer to the server gate's warn tier.\n */\nconst PublishConfigSchema = z.object({\n mode: PublishModeSchema,\n defaultPrice: atomicString,\n ackServerWarnings: AckServerWarningsSchema,\n});\n\n/**\n * The seven hook arms, one boolean each. Named by what the arm does, with the\n * harness event it answers beside it: `prompt` (UserPromptSubmit), `web-search`\n * (WebSearch), `web-fetch` (WebFetch), `subagent` (the dispatch and the child's\n * own start), `failure` (a failing command), `publish` (the turn-end ask on\n * Stop and SubagentStop), `primer` (SessionStart). The context arm is\n * bookkeeping for `failure` and `publish` and runs when either is on.\n */\nexport const HOOK_ARMS = [\n 'prompt',\n 'web-search',\n 'web-fetch',\n 'subagent',\n 'failure',\n 'publish',\n 'primer',\n] as const;\nexport type HookArm = (typeof HOOK_ARMS)[number];\n\n/**\n * The harness-hook block. EVERY key is read by the daemon at run time, which is\n * what makes them runtime toggles rather than install-time choices:\n * `tenjin config set hooks.web-search false` silences that arm immediately,\n * with no re-install and nothing to unwire. The entries stay registered and the\n * arm no-ops, which is also what lets turning one back on be a single\n * `config set`.\n */\nconst HooksConfigSchema = z.object({\n prompt: z.boolean(),\n 'web-search': z.boolean(),\n 'web-fetch': z.boolean(),\n subagent: z.boolean(),\n failure: z.boolean(),\n publish: z.boolean(),\n primer: z.boolean(),\n});\n\n/** How much conversation a router hook packet carries. */\nexport const ROUTER_CONTEXTS = ['session', 'turn'] as const;\nexport type RouterContext = (typeof ROUTER_CONTEXTS)[number];\n\n/**\n * The router's own block, separate from the shelf's `hooks.*`: `enabled` is the\n * off switch every router hook and the `request` tool honour, and `context` is how\n * much conversation a hook packet carries (`session`, up to six prior messages,\n * or `turn`, none). THE ONE SCHEMA for it: the global file validates it here,\n * and a project's `.tenjin/config.json` and `config.local.json` go through\n * {@link parseRouterLayer}. Both keys only ever tighten, which is why a\n * project file may carry them; a key that loosens (spend, allowlist, enabling,\n * base URL) must never join this object. `routerSettings` in\n * router/settings.ts is the one reader of the resolved values.\n */\nexport const RouterLayerSchema = z.object({\n enabled: z.boolean().optional(),\n context: z.enum(ROUTER_CONTEXTS).optional(),\n});\nexport type RouterLayer = z.infer<typeof RouterLayerSchema>;\nconst RouterConfigSchema = RouterLayerSchema.required();\n\n/**\n * The `router` block of one project file's parsed JSON, and nothing else: an\n * unknown key, inside the block or beside it, is never read. CONFIG_INVALID,\n * naming the file, when the file is not an object or a key has the wrong type.\n */\nexport function parseRouterLayer(json: unknown, path: string): RouterLayer {\n if (json === null || typeof json !== 'object' || Array.isArray(json)) {\n throw new CliError('CONFIG_INVALID', `Config at ${path} is not a JSON object`, {\n fix: `Fix ${path}, or delete it.`,\n });\n }\n const parsed = RouterLayerSchema.safeParse((json as { router?: unknown }).router ?? {});\n if (!parsed.success) {\n throw new CliError('CONFIG_INVALID', `Config at ${path} has an invalid router block`, {\n fix: `Use router.enabled true|false and router.context \"session\"|\"turn\" in ${path}, or delete it.`,\n details: parsed.error.issues,\n });\n }\n const { enabled, context } = parsed.data;\n return {\n ...(enabled !== undefined ? { enabled } : {}),\n ...(context !== undefined ? { context } : {}),\n };\n}\n\n/**\n * What the daily update check is allowed to do about a newer version.\n *\n * `auto` installs it in the background where Tenjin's runtime is set up for the\n * default data dir (see lib/auto-update), and elsewhere behaves as `nudge`: the\n * runtime is the deferred-activation window a self-update needs, since versions\n * sit side by side and a running session keeps the one it started on. `nudge`\n * only reports it — one dim line for a human at a terminal, and an\n * `updateAvailable` field on the JSON envelope for everyone else, which is how\n * an agent learns to run `tenjin update` itself. `off` neither reports nor asks\n * npm.\n */\nexport const UpdateModeSchema = z.enum(['auto', 'nudge', 'off']);\n\n/**\n * The loop daemon's numbers (tenjin-notes loop-redesign/02-redesign.md §7). TWO\n * budget numbers and two daemon knobs; every other bound is a formula over\n * these or a constant with a stated reason in `src/hooks/constants.ts`.\n *\n * `human_wait_ms`: a fire the human is waiting on (prompt, Stop, SessionStart).\n * `tool_wait_ms`: a fire a tool call is waiting on. There is no third budget:\n * a client-side rate limit rationed the research panel the loop exists to\n * capture, so the runaway stop is the server's own 429. `idle_exit_min`: the\n * daemon exits after this long with no request. `port`: null derives one from\n * the data dir path; set it only when doctor reports a foreign listener.\n */\nconst positiveInt = z.number().int().positive();\nexport const LoopConfigSchema = z.object({\n human_wait_ms: positiveInt,\n tool_wait_ms: positiveInt,\n idle_exit_min: positiveInt,\n port: z.number().int().min(0).max(65535).nullable(),\n});\nexport type LoopConfig = z.infer<typeof LoopConfigSchema>;\n\n/**\n * `team.publicFallback` (tenjin-agent#229): `off` drops every public-only stage\n * from every lookup plan, so a team-mode miss never reaches tenjin.blog. Plain\n * config read by the daemon per fire; install against a team shelf writes `off`.\n */\nexport const PublicFallbackSchema = z.enum(['on', 'off']);\nexport type PublicFallback = z.infer<typeof PublicFallbackSchema>;\nexport const TeamConfigSchema = z.object({ publicFallback: PublicFallbackSchema });\nexport type TeamConfig = z.infer<typeof TeamConfigSchema>;\n\n/**\n * `experimental.*`: features that ship off. `bazaar` widens the third-party\n * services the router may offer from Tenjin's reviewed list (always on) to the\n * open x402 Bazaar: unreviewed sellers. Off, the client never asks for them.\n */\nexport const ExperimentalConfigSchema = z.object({ bazaar: PublicFallbackSchema });\nexport type ExperimentalConfig = z.infer<typeof ExperimentalConfigSchema>;\n\nexport function parsePublicFallbackFlag(value: string, keyName: string): PublicFallback {\n const parsed = PublicFallbackSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n throw new CliError('USAGE', `Invalid ${keyName}: ${JSON.stringify(value)}`, {\n fix: 'Use \"on\" or \"off\".',\n });\n}\n\n/** A `loop.*` value from `config set`: a positive integer, or for `loop.port`\n * also `0`..`65535` or `null` (derive). */\nexport function parseLoopValue(key: LoopConfigKey, value: string): number | null {\n const field = key.slice('loop.'.length) as keyof LoopConfig;\n if (field === 'port' && (value === 'null' || value === 'auto')) return null;\n const n = /^\\d+$/.test(value.trim()) ? Number(value.trim()) : NaN;\n const parsed = LoopConfigSchema.shape[field].safeParse(n);\n if (parsed.success) return parsed.data;\n throw new CliError('USAGE', `Invalid ${key}: ${JSON.stringify(value)}`, {\n fix:\n field === 'port'\n ? 'Use an integer from 0 to 65535, or \"null\" to derive one from the data dir.'\n : 'Use a positive integer.',\n });\n}\nexport type UpdateMode = z.infer<typeof UpdateModeSchema>;\n\nconst UpdateConfigSchema = z.object({\n mode: UpdateModeSchema,\n});\n\nexport function parseUpdateModeFlag(value: string, flagName: string): UpdateMode {\n const parsed = UpdateModeSchema.safeParse(value);\n if (parsed.success) return parsed.data;\n throw new CliError('USAGE', `Invalid ${flagName} ${JSON.stringify(value)}`, {\n fix: 'Use \"auto\", \"nudge\" or \"off\".',\n });\n}\n\n/**\n * What `install` recorded about its own targets. `harness` is the last settled\n * prompt or explicit `--harness` selection, so `doctor` keeps judging every\n * directory the operator chose even when later detection cannot see it. Written\n * by `install`, not a `config set` key.\n */\nconst InstallConfigSchema = z.object({\n harness: z.array(z.enum(HARNESSES)),\n /**\n * The EXACT rule strings still pending the last time an install explicitly\n * declined the free-verb allowlist (`--no-grant`), so `--refresh`\n * can subtract them from what it would\n * otherwise report as pending instead of recomputing from the settings file\n * and nagging about a settled \"no\" on every refresh (tenjin-agent#234).\n *\n * A LIST, NOT A FLAG, on purpose: a boolean has no way to say \"these were\n * declined\" without also silencing every rule a LATER version might add, so a\n * genuinely new suggestion would never be reported again either. Per-rule\n * suppression means only the rules that were actually offered and refused\n * stay quiet; a new one still surfaces.\n *\n * Cleared back to `[]` the next time an install actually wires the allowlist,\n * or finds it already fully satisfied, so a later legitimate grant (manual or\n * otherwise) is never shadowed by a stale decline.\n */\n grantDeclined: z.array(z.string()),\n /**\n * Absolute directories a `tenjin install --project` wired, so `tenjin update`\n * can refresh them. It spawns `install --refresh` from the HOME directory,\n * which is the one place a project install can never be found by looking\n * around: without this list a project-only machine refreshed nothing and\n * reported success while its hooks stayed on the old build.\n *\n * A LIST, because one machine can wire several projects, and entries are\n * dropped by `tenjin uninstall --project` and by any refresh that finds the\n * project's settings file no longer carries our entries.\n */\n routerProjects: z.array(z.string()),\n});\n\n/**\n * `shared` was a real `install --harness` value before the harness selector was\n * narrowed to actual harnesses. It targeted the same ~/.agents/skills directory\n * as Codex, so the lossless upgrade is `codex`. Normalize at the raw parse edge:\n * commands that intentionally consume loadRawConfig directly must never see the\n * superseded value, and a later merge-write naturally persists the current shape.\n */\nconst STORED_INSTALL_HARNESSES = [...HARNESSES, 'shared'] as const;\ntype StoredInstallHarness = (typeof STORED_INSTALL_HARNESSES)[number];\n\nexport function resolveInstallHarness(\n value: readonly StoredInstallHarness[] | undefined,\n): Harness[] {\n const normalized = new Set(value?.map((harness) => (harness === 'shared' ? 'codex' : harness)));\n return HARNESSES.filter((harness) => normalized.has(harness));\n}\n\nconst RawInstallHarnessSchema = z\n .array(z.enum(STORED_INSTALL_HARNESSES))\n .transform(resolveInstallHarness);\n\n/**\n * The persisted config shape. Spend keys are stored atomic (accepted as decimal\n * USD at the command edge, see lib/money). These are client-enforced guardrails, not a\n * security boundary — any process that runs the CLI can also edit this file.\n */\nexport const ConfigSchema = z.object({\n maxAutoSpend: atomicString,\n sessionBudget: z.union([atomicString, z.literal('none')]),\n /**\n * Hard per-send cap for `tenjin wallet send`, NOT satisfiable by --yes or a prompt\n * (the spend-policy posture): an atomic amount caps each send, \"0\" disables\n * the verb entirely, and \"none\" = explicitly uncapped (send exists to drain\n * the wallet, but uncapped is an opt-in, never a default). The key has NO\n * usable default: absent from config.json, `tenjin wallet send` refuses until it is\n * set (see resolveSendMaxAmount). Client-enforced like every spend key (see\n * the note above).\n */\n sendMaxAmount: z.union([z.literal('none'), atomicString]),\n allowlistCreators: z.array(z.string()),\n baseUrl: z.url(),\n /**\n * The PUBLIC marketplace, consume-only, and the second shelf a team-mode\n * lookup falls through to. Distinct from `baseUrl` because in team mode\n * `baseUrl` is the team's own deployment: `publish`, `read` and the first leg\n * of every search go there, and this is the shelf that still gets asked when\n * the team's own has nothing. In public mode the two are the same origin and\n * nothing falls through.\n */\n publicShelfUrl: z.url(),\n /**\n * The team shelf's Vercel \"Protection Bypass for Automation\" secret, and the\n * ONE key that decides which mode this CLI is in: empty (the default) is\n * public mode, byte-for-byte what it always did; non-empty is team mode.\n *\n * It is a DOOR KEY, not a credential of the operator's: it gets a request past\n * Deployment Protection on the team's preview deployment and authenticates\n * nobody. Stored in plain config.json alongside everything else for exactly\n * that reason — anything that can read this file can already read the wallet's\n * keystore path and rewrite `baseUrl`. It is redacted from `config get` and\n * `config list` all the same, because those outputs are pasted into issues.\n *\n * Sent ONLY to `baseUrl`'s origin; see lib/http.ts's `bypass` option, which\n * derives that from the request URL rather than from the caller's intent.\n */\n shelfBypassSecret: z.string(),\n rpcUrl: z.url(),\n /**\n * Evaluation-cohort opt-in (spec 09 §3): when true, search sends\n * X-Tenjin-Eval-Cohort: 1 and the server stores the generalized question for\n * 90 days. Off by default; no query text is retained server-side without it.\n */\n evalCohort: z.boolean(),\n /** x402 discovery registries (facilitator base URLs) `discover` queries and\n * the Bazaar pay lane verifies against. */\n bazaarRegistries: z.array(z.url()),\n publish: PublishConfigSchema,\n install: InstallConfigSchema,\n hooks: HooksConfigSchema,\n update: UpdateConfigSchema,\n loop: LoopConfigSchema,\n team: TeamConfigSchema,\n router: RouterConfigSchema,\n experimental: ExperimentalConfigSchema,\n});\nexport type Config = z.infer<typeof ConfigSchema>;\n\n/**\n * `install`'s raw shape. The decline is a list of exact rules rather than a\n * boolean so a later version can still report a rule the operator was never\n * offered. The key is intentionally not aliased from its pre-release name.\n */\nconst RawInstallConfigSchema = InstallConfigSchema.partial()\n .extend({\n harness: RawInstallHarnessSchema.optional(),\n grantDeclined: z.array(z.string()).optional(),\n })\n .passthrough();\n\n/**\n * Values as they may appear in config.json — every known key optional; absent =\n * default. `.passthrough()` PRESERVES unknown keys through load + persist: without\n * it an older binary's `config set` would strip (and re-serialize away) any newer\n * block a later CLI wrote, e.g. B3's `publish.*`. Known keys are still validated;\n * unknown keys ride along untouched.\n */\nexport const RawConfigSchema = ConfigSchema.partial()\n // The publish block is itself partial + passthrough: `config set publish.mode`\n // writes only the one subkey, and a subkey a newer CLI adds (e.g. publish.*\n // beyond mode/defaultPrice) survives an older binary's set, same reason the\n // outer object passes unknown keys through.\n .extend({\n publish: PublishConfigSchema.partial().passthrough().optional(),\n install: RawInstallConfigSchema.optional(),\n hooks: HooksConfigSchema.partial().passthrough().optional(),\n update: UpdateConfigSchema.partial().passthrough().optional(),\n loop: LoopConfigSchema.partial().passthrough().optional(),\n team: TeamConfigSchema.partial().passthrough().optional(),\n router: RouterLayerSchema.passthrough().optional(),\n experimental: ExperimentalConfigSchema.partial().passthrough().optional(),\n })\n .passthrough();\nexport type PartialConfig = z.infer<typeof RawConfigSchema>;\n\n/**\n * Normalize `install.grantDeclined` as read from config.json. An absent key is\n * an empty set; a present key is already validated as exact rule strings.\n */\nexport function resolveGrantDeclined(value: string[] | undefined): string[] {\n return value ?? [];\n}\n\n/**\n * The resolved-view sentinel for an absent sendMaxAmount. Never a persistable\n * value (ConfigSchema rejects it, and `config set` has no way to produce it);\n * while the resolved value is this sentinel, `tenjin wallet send` refuses —\n * require-set-before-first-send.\n */\nexport const SEND_MAX_UNSET = 'unset';\n\n/**\n * Registries verified keyless (CDP/UV on 2026-08-14, PayAI on 2026-08-18): all\n * answer GET /discovery/resources with no credential in the Bazaar envelope\n * the sweep parses. CDP's Bazaar is settlement-derived (it indexes what its\n * facilitator settles, Tenjin's endpoints included); UltraVioleta is the\n * registry Tenjin also announces to; PayAI's facilitator is settlement-derived\n * like CDP's (26k+ listings at verification). PayAI's /discovery/search is\n * keyword-only (measured 2026-10-02), so a natural-language query finds nothing\n * there. It also ignores payTo filters, as UV and CDP do, which the query\n * sweep's per-registry errors and the stored-sweep evidence cover.\n */\nexport const DEFAULT_BAZAAR_REGISTRIES = [\n 'https://api.cdp.coinbase.com/platform/v2/x402',\n 'https://facilitator.ultravioletadao.xyz',\n 'https://facilitator.payai.network',\n];\n\n/**\n * THE TWO SPEND LIMITS, IN EFFECT WHETHER OR NOT ANYONE ANSWERED. The daily\n * budget ($5) is the control; the per-call ceiling ($0.25) is the runaway\n * guard; the wallet balance is the hard stop. Install asks once, these or your\n * own limits, and an install nobody answered still runs on these. A call\n * priced above the ceiling is approved once, for that call.\n */\nexport const DEFAULT_MAX_AUTO_SPEND = '250000';\nexport const DEFAULT_SESSION_BUDGET = '5000000';\n\n/** The lowest per-call ceiling anyone can set, atomic USDC ($0.25): the\n * routing deposit (`CHANNEL_DEPOSIT_ATOMIC`), below which routing cannot pay. */\nexport const MAX_AUTO_SPEND_FLOOR_ATOMIC = 250_000n;\n/** Why: said by install, `config set` and doctor wherever the floor refuses. */\nexport const MAX_AUTO_SPEND_FLOOR_WHY =\n 'The $0.25 minimum is the routing deposit: below it, routing cannot pay at all. To stop automatic payments, turn the router off with `tenjin config set router.enabled false`.';\n\nexport const CONFIG_DEFAULTS: Config = {\n maxAutoSpend: DEFAULT_MAX_AUTO_SPEND,\n sessionBudget: DEFAULT_SESSION_BUDGET,\n // A type placeholder only, never honored: Config requires every key (and\n // CONFIG_KEYS derives from these). resolveSendMaxAmount never reads it — an\n // absent key resolves to SEND_MAX_UNSET and `tenjin wallet send` refuses until the\n // cap is set. '0' (send disabled) rather than 'none' (uncapped) so that if a\n // future caller ever DOES read the cap through loadConfig/fileOrDefault, the\n // leak fails closed instead of silently running uncapped.\n sendMaxAmount: '0',\n allowlistCreators: [],\n baseUrl: PRODUCTION_ORIGIN,\n publicShelfUrl: PRODUCTION_ORIGIN,\n // Empty = public mode. Setting it is the whole of \"turn on team mode\".\n shelfBypassSecret: '',\n rpcUrl: DEFAULT_RPC_URL,\n evalCohort: false,\n bazaarRegistries: DEFAULT_BAZAAR_REGISTRIES,\n publish: { mode: 'review', defaultPrice: '100000', ackServerWarnings: 'mode' },\n install: { harness: [], grantDeclined: [], routerProjects: [] },\n // Every hook is on out of the box: a vanilla install turns the whole loop on,\n // and the disclosure and the undo ride the install output. `false` leaves the\n // registered entries inert without touching settings.json, so any of these is\n // one `config set` away in either direction.\n hooks: {\n prompt: true,\n 'web-search': true,\n 'web-fetch': true,\n subagent: true,\n failure: true,\n publish: true,\n primer: true,\n },\n update: { mode: 'auto' },\n loop: {\n human_wait_ms: 2500,\n tool_wait_ms: 4000,\n idle_exit_min: 30,\n port: null,\n },\n team: { publicFallback: 'on' },\n router: { enabled: true, context: 'session' },\n experimental: { bazaar: 'off' },\n};\n\n/**\n * Scalar keys `config get/set/list` render one line each. The nested blocks are\n * excluded: `publish` and `hooks` are addressed by their dotted keys (see\n * PUBLISH_CONFIG_KEYS / HOOKS_CONFIG_KEYS), and `install` is a record `install`\n * writes about itself rather than a setting to hand-edit, so none is ever a bare\n * scalar.\n */\nexport type ScalarConfigKey = Exclude<\n keyof Config,\n 'publish' | 'install' | 'hooks' | 'update' | 'loop' | 'team' | 'router' | 'experimental'\n>;\nconst NESTED_CONFIG_KEYS: ReadonlySet<string> = new Set([\n 'publish',\n 'install',\n 'hooks',\n 'update',\n 'loop',\n 'team',\n 'router',\n 'experimental',\n]);\nexport const CONFIG_KEYS = (Object.keys(CONFIG_DEFAULTS) as Array<keyof Config>).filter(\n (key): key is ScalarConfigKey => !NESTED_CONFIG_KEYS.has(key),\n);\n\n/** The dotted keys `config get/set` accept for the nested publish block. */\nexport const PUBLISH_CONFIG_KEYS = [\n 'publish.mode',\n 'publish.defaultPrice',\n 'publish.ackServerWarnings',\n] as const;\nexport type PublishConfigKey = (typeof PUBLISH_CONFIG_KEYS)[number];\n\n/** The dotted keys `config get/set` accept for the nested hooks block. */\nexport type HooksConfigKey = `hooks.${HookArm}`;\nexport const HOOKS_CONFIG_KEYS: readonly HooksConfigKey[] = HOOK_ARMS.map(\n (arm) => `hooks.${arm}` as const,\n);\n\n/** The dotted key `config get/set` accepts for the nested update block. */\nexport const UPDATE_CONFIG_KEYS = ['update.mode'] as const;\nexport type UpdateConfigKey = (typeof UPDATE_CONFIG_KEYS)[number];\n\n/** The dotted keys `config get/set` accept for the loop daemon's block. */\nexport const LOOP_CONFIG_KEYS = [\n 'loop.human_wait_ms',\n 'loop.tool_wait_ms',\n 'loop.idle_exit_min',\n 'loop.port',\n] as const;\nexport type LoopConfigKey = (typeof LOOP_CONFIG_KEYS)[number];\n\n/** The dotted key `config get/set` accepts for the team block. */\nexport const TEAM_CONFIG_KEYS = ['team.publicFallback'] as const;\nexport type TeamConfigKey = (typeof TEAM_CONFIG_KEYS)[number];\n\n/** The dotted key `config get/set` accepts for the experimental block. */\nexport const EXPERIMENTAL_CONFIG_KEYS = ['experimental.bazaar'] as const;\nexport type ExperimentalConfigKey = (typeof EXPERIMENTAL_CONFIG_KEYS)[number];\n\n/** The dotted keys `config get/set` accept for the router block. */\nexport const ROUTER_CONFIG_KEYS = ['router.enabled', 'router.context'] as const;\nexport type RouterConfigKey = (typeof ROUTER_CONFIG_KEYS)[number];\n\nexport const RETIRED_PAYMENT_KEYS = ['bazaarPay', 'confirm'] as const;\nexport const RETIRED_PAYMENT_GUIDANCE =\n 'Retired payment settings no longer control payments. Use router.enabled, maxAutoSpend and sessionBudget for automatic routing; manual pay always requires consent. Run tenjin install to remove retired keys.';\n\nexport function retiredPaymentKeys(raw: PartialConfig): string[] {\n return RETIRED_PAYMENT_KEYS.filter((key) => Object.hasOwn(raw, key));\n}\n\n/**\n * Read and validate config.json WITHOUT applying defaults, so provenance can\n * distinguish \"present in file\" from \"absent\". Missing file is fine (returns\n * {}); malformed JSON or a failed schema is CONFIG_INVALID with a fix.\n */\nexport async function loadRawConfig(dir: string): Promise<PartialConfig> {\n const path = configPath(dir);\n let raw: string;\n try {\n raw = await readFile(path, 'utf8');\n } catch (err) {\n if (isNotFound(err)) return {};\n throw new CliError('CONFIG_INVALID', `Could not read config at ${path}`, {\n fix: `Check file permissions on ${path}.`,\n cause: err,\n });\n }\n let json: unknown;\n try {\n json = JSON.parse(raw);\n } catch (err) {\n throw new CliError('CONFIG_INVALID', `Config at ${path} is not valid JSON`, {\n fix: `Fix the JSON syntax in ${path}, or delete it to restore defaults.`,\n cause: err,\n });\n }\n const parsed = RawConfigSchema.safeParse(json);\n if (!parsed.success) {\n throw new CliError('CONFIG_INVALID', `Config at ${path} is invalid`, {\n fix: `Correct the reported keys in ${path}, or delete it to restore defaults.`,\n details: parsed.error.issues,\n });\n }\n return parsed.data;\n}\n\n/** File values merged over defaults — the effective persisted config. The nested\n * publish block is merged per-subkey so a file that sets only publish.mode keeps\n * the default defaultPrice (a shallow spread would drop it). */\nexport async function loadConfig(dir: string): Promise<Config> {\n const raw = { ...(await loadRawConfig(dir)) };\n for (const key of retiredPaymentKeys(raw)) delete raw[key];\n // loadConfig's job is the effective Config object, so an absent key is its\n // default here; the provenance question lives in resolve* below.\n return {\n ...CONFIG_DEFAULTS,\n ...raw,\n publish: {\n mode: raw.publish?.mode ?? CONFIG_DEFAULTS.publish.mode,\n defaultPrice: raw.publish?.defaultPrice ?? CONFIG_DEFAULTS.publish.defaultPrice,\n ackServerWarnings:\n raw.publish?.ackServerWarnings ?? CONFIG_DEFAULTS.publish.ackServerWarnings,\n },\n install: {\n harness: raw.install?.harness ?? CONFIG_DEFAULTS.install.harness,\n routerProjects: raw.install?.routerProjects ?? CONFIG_DEFAULTS.install.routerProjects,\n grantDeclined: resolveGrantDeclined(raw.install?.grantDeclined),\n },\n hooks: resolveHooksConfig(raw),\n update: { mode: raw.update?.mode ?? CONFIG_DEFAULTS.update.mode },\n loop: resolveLoopConfig(raw),\n team: { publicFallback: raw.team?.publicFallback ?? CONFIG_DEFAULTS.team.publicFallback },\n router: {\n enabled: raw.router?.enabled ?? CONFIG_DEFAULTS.router.enabled,\n context: raw.router?.context ?? CONFIG_DEFAULTS.router.context,\n },\n experimental: {\n bazaar: raw.experimental?.bazaar ?? CONFIG_DEFAULTS.experimental.bazaar,\n },\n };\n}\n\n/** Per-subkey merge over the defaults; an unknown key a newer CLI wrote is\n * dropped from the EFFECTIVE object (it still rides through persist). */\nexport function resolveLoopConfig(raw: PartialConfig): LoopConfig {\n const file = raw.loop ?? {};\n return {\n human_wait_ms: file.human_wait_ms ?? CONFIG_DEFAULTS.loop.human_wait_ms,\n tool_wait_ms: file.tool_wait_ms ?? CONFIG_DEFAULTS.loop.tool_wait_ms,\n idle_exit_min: file.idle_exit_min ?? CONFIG_DEFAULTS.loop.idle_exit_min,\n port: file.port === undefined ? CONFIG_DEFAULTS.loop.port : file.port,\n };\n}\n\n/** `local` is a project's personal `.tenjin/config.local.json` (router keys only). */\nexport type Provenance = 'default' | 'file' | 'project' | 'local' | 'env' | 'flag';\n\nexport interface ResolvedSetting<T> {\n value: T;\n source: Provenance;\n}\n\n/**\n * The per-project `.tenjin.json` layer (B3, D38): publish overrides discovered by\n * walking up from cwd, plus whether that file is gitignored. `gitignored` gates\n * `full-auto` — a committed file requesting it is downgraded (loosening gate).\n */\nexport interface ProjectPublishLayer {\n publish?: { mode?: PublishMode; defaultPrice?: string };\n gitignored: boolean;\n /** The file named `publish.ackServerWarnings`, which this layer never supplies. */\n ignoredAckServerWarnings?: boolean;\n}\n\n/** publish.mode resolution: value, source, and the downgrade warning (if any). */\nexport interface PublishModeResolution {\n value: PublishMode;\n source: Provenance;\n /** Set when a committed `.tenjin.json`'s `full-auto` was downgraded to `auto`. */\n downgradedWarning?: string;\n}\n\n/** Effective value + where it came from, per key. What `config` (bare) renders. */\nexport interface EffectiveSettings {\n maxAutoSpend: ResolvedSetting<string>;\n sessionBudget: ResolvedSetting<string>;\n sendMaxAmount: ResolvedSetting<string>;\n allowlistCreators: ResolvedSetting<string[]>;\n baseUrl: ResolvedSetting<string>;\n publicShelfUrl: ResolvedSetting<string>;\n shelfBypassSecret: ResolvedSetting<string>;\n rpcUrl: ResolvedSetting<string>;\n evalCohort: ResolvedSetting<boolean>;\n bazaarRegistries: ResolvedSetting<string[]>;\n publishMode: PublishModeResolution;\n publishDefaultPrice: ResolvedSetting<string>;\n publishAckServerWarnings: ResolvedSetting<AckServerWarnings>;\n hooks: { [K in HookArm]: ResolvedSetting<boolean> };\n updateMode: ResolvedSetting<UpdateMode>;\n loop: { [K in keyof LoopConfig]: ResolvedSetting<LoopConfig[K]> };\n teamPublicFallback: ResolvedSetting<PublicFallback>;\n experimentalBazaar: ResolvedSetting<PublicFallback>;\n}\n\n/** CLI flags that participate in settings precedence (`--base-url`). */\nexport interface SettingsFlags {\n baseUrl?: string;\n}\n\nexport interface ResolveSettingsInput {\n /** Raw file values (present keys only) — from loadRawConfig, not loadConfig. */\n config: PartialConfig;\n flags: SettingsFlags;\n env: NodeJS.ProcessEnv;\n /** The nearest `.tenjin.json` layer, when one was found (see publish-settings). */\n project?: ProjectPublishLayer;\n}\n\n/**\n * Apply precedence flag > env > file > default per key, returning each effective\n * value with its source. In B1 only baseUrl has flag/env overrides\n * (`--base-url`, TENJIN_BASE_URL); the rest resolve file-or-default. B3 adds the\n * publish keys, which additionally fold in the per-project `.tenjin.json` layer.\n */\nexport function resolveSettings(input: ResolveSettingsInput): EffectiveSettings {\n const { config, flags, env, project } = input;\n return {\n maxAutoSpend: fileOrDefault('maxAutoSpend', config),\n sessionBudget: fileOrDefault('sessionBudget', config),\n sendMaxAmount: resolveSendMaxAmount(config),\n allowlistCreators: fileOrDefault('allowlistCreators', config),\n baseUrl: resolveBaseUrl(config, flags, env),\n publicShelfUrl: fileOrDefault('publicShelfUrl', config),\n shelfBypassSecret: fileOrDefault('shelfBypassSecret', config),\n rpcUrl: fileOrDefault('rpcUrl', config),\n evalCohort: fileOrDefault('evalCohort', config),\n bazaarRegistries: fileOrDefault('bazaarRegistries', config),\n publishMode: resolvePublishMode({ config, project, env }),\n publishDefaultPrice: resolvePublishDefaultPrice({ config, project }),\n publishAckServerWarnings: resolveAckServerWarnings(config),\n hooks: resolveHookSettings(config),\n updateMode: resolveUpdateMode(config),\n loop: resolveLoopSettings(config),\n teamPublicFallback: resolveTeamPublicFallback(config),\n experimentalBazaar: resolveExperimentalBazaar(config),\n };\n}\n\nfunction resolveLoopSettings(config: PartialConfig): EffectiveSettings['loop'] {\n const file = config.loop ?? {};\n const one = <K extends keyof LoopConfig>(key: K): ResolvedSetting<LoopConfig[K]> => {\n const fromFile = file[key];\n if (fromFile !== undefined) return { value: fromFile as LoopConfig[K], source: 'file' };\n return { value: CONFIG_DEFAULTS.loop[key], source: 'default' };\n };\n return {\n human_wait_ms: one('human_wait_ms'),\n tool_wait_ms: one('tool_wait_ms'),\n idle_exit_min: one('idle_exit_min'),\n port: one('port'),\n };\n}\n\n/** experimental.bazaar: file or default (off), no env or flag. */\nexport function resolveExperimentalBazaar(config: PartialConfig): ResolvedSetting<PublicFallback> {\n const fromFile = config.experimental?.bazaar;\n if (fromFile !== undefined) return { value: fromFile, source: 'file' };\n return { value: CONFIG_DEFAULTS.experimental.bazaar, source: 'default' };\n}\n\n/** team.publicFallback: file or default, no env or flag. */\nexport function resolveTeamPublicFallback(config: PartialConfig): ResolvedSetting<PublicFallback> {\n const fromFile = config.team?.publicFallback;\n if (fromFile !== undefined) return { value: fromFile, source: 'file' };\n return { value: CONFIG_DEFAULTS.team.publicFallback, source: 'default' };\n}\n\n/**\n * publish.ackServerWarnings: the GLOBAL config file or the default, deliberately\n * with no project `.tenjin.json` layer and no env override. The other two publish\n * keys take the project layer because a repo may reasonably state its own price\n * and its own mode; this one only ever LOOSENS what a yes covers, so a file\n * checked into a repo the operator cloned must not be able to set it. That is the\n * same reason `resolvePublishMode` gates `full-auto` out of the project layer,\n * applied one step earlier: here there is no benign reading of the key at all.\n *\n * Exported because `resolvePublishSettings` (lib/settings.ts) resolves the same\n * key for the two writing commands, and two global-only readings that disagreed\n * would disagree about consent.\n */\nexport function resolveAckServerWarnings(\n config: PartialConfig,\n): ResolvedSetting<AckServerWarnings> {\n const fromFile = config.publish?.ackServerWarnings;\n if (fromFile !== undefined) return { value: fromFile, source: 'file' };\n return { value: CONFIG_DEFAULTS.publish.ackServerWarnings, source: 'default' };\n}\n\n/** update.mode: file or default, no env or flag. Every surface that reports a\n * newer version reads this one resolved value, so they cannot disagree. */\nfunction resolveUpdateMode(config: PartialConfig): ResolvedSetting<UpdateMode> {\n const fromFile = config.update?.mode;\n if (fromFile !== undefined) return { value: fromFile, source: 'file' };\n return { value: CONFIG_DEFAULTS.update.mode, source: 'default' };\n}\n\n/** One hook arm: file or default. Read per fire by the daemon, so a `config\n * set` takes effect on the next prompt with no re-install. */\nexport function resolveHook(config: PartialConfig, arm: HookArm): ResolvedSetting<boolean> {\n const fromFile = config.hooks?.[arm];\n if (fromFile !== undefined) return { value: fromFile, source: 'file' };\n return { value: CONFIG_DEFAULTS.hooks[arm], source: 'default' };\n}\n\nfunction resolveHookSettings(config: PartialConfig): EffectiveSettings['hooks'] {\n return Object.fromEntries(\n HOOK_ARMS.map((arm) => [arm, resolveHook(config, arm)]),\n ) as EffectiveSettings['hooks'];\n}\n\n/** Per-arm merge over the defaults, for the effective Config object. */\nfunction resolveHooksConfig(raw: PartialConfig): Config['hooks'] {\n return Object.fromEntries(\n HOOK_ARMS.map((arm) => [arm, raw.hooks?.[arm] ?? CONFIG_DEFAULTS.hooks[arm]]),\n ) as Config['hooks'];\n}\n\n/**\n * The loosening gate (D38): a committed (not-gitignored) `.tenjin.json` requesting\n * `full-auto` is downgraded to `auto`, never silently honored — cloning a repo\n * must not enable auto-publish. `full-auto` from global config / env / flag (all\n * inherently local, not cloned) is always honored.\n */\nconst FULL_AUTO_DOWNGRADE_WARNING =\n 'Ignoring publish.mode \"full-auto\" from a committed .tenjin.json (cloning a repo must not enable auto-publish); using \"auto\". Add .tenjin.json to .gitignore to opt in.';\n\nfunction coercePublishMode(raw: string | undefined): PublishMode | undefined {\n if (raw === undefined || raw.length === 0) return undefined;\n const parsed = PublishModeSchema.safeParse(raw);\n return parsed.success ? parsed.data : undefined;\n}\n\n/**\n * Resolve publish.mode through global file < project `.tenjin.json` < env\n * (TENJIN_PUBLISH_MODE) < flag (`--mode`). Total: an invalid env/flag value is\n * ignored (validation lives at the command edge, like baseUrl). The project\n * layer's `full-auto` is gated on that file being gitignored.\n */\nexport function resolvePublishMode(input: {\n config: PartialConfig;\n project?: ProjectPublishLayer;\n env: NodeJS.ProcessEnv;\n flag?: string;\n}): PublishModeResolution {\n const { config, project, env, flag } = input;\n let winner: PublishModeResolution = { value: CONFIG_DEFAULTS.publish.mode, source: 'default' };\n\n const fromFile = config.publish?.mode;\n if (fromFile !== undefined) winner = { value: fromFile, source: 'file' };\n\n if (project !== undefined && project.publish?.mode !== undefined) {\n const fromProject = project.publish.mode;\n if (fromProject === 'full-auto' && !project.gitignored) {\n winner = { value: 'auto', source: 'project', downgradedWarning: FULL_AUTO_DOWNGRADE_WARNING };\n } else {\n winner = { value: fromProject, source: 'project' };\n }\n }\n\n const fromEnv = coercePublishMode(env.TENJIN_PUBLISH_MODE);\n if (fromEnv !== undefined) winner = { value: fromEnv, source: 'env' };\n\n const fromFlag = coercePublishMode(flag);\n if (fromFlag !== undefined) winner = { value: fromFlag, source: 'flag' };\n\n return winner;\n}\n\n/** Resolve publish.defaultPrice (atomic) through global file < project < default. */\nexport function resolvePublishDefaultPrice(input: {\n config: PartialConfig;\n project?: ProjectPublishLayer;\n}): ResolvedSetting<string> {\n const { config, project } = input;\n let result: ResolvedSetting<string> = {\n value: CONFIG_DEFAULTS.publish.defaultPrice,\n source: 'default',\n };\n if (config.publish?.defaultPrice !== undefined) {\n result = { value: config.publish.defaultPrice, source: 'file' };\n }\n if (project?.publish?.defaultPrice !== undefined) {\n result = { value: project.publish.defaultPrice, source: 'project' };\n }\n return result;\n}\n\n/**\n * Persist a full, validated config via the atomic writer (0700 dir, 0600 file).\n *\n * 0600 BECAUSE config.json NOW HOLDS A CREDENTIAL: `shelfBypassSecret` is the\n * team shelf's shared door key, and every other secret in this tree is 0600\n * (the wallet, the passphrase, the session key, the spend ledger, the daemon\n * token) — wallet/local.ts even warns when it finds one that is not.\n * `dirMode: 0o700` is not a substitute: node's recursive mkdir does not chmod a\n * directory that already exists, so a `~/.tenjin` or `TENJIN_DATA_DIR` created\n * at 0755 by a devcontainer volume, a restored backup or a shared CI image left\n * the key world-readable. `config --json` already redacts it, which is the same\n * care applied one layer up. Keep this in step with `persist` in commands/config.ts,\n * the other writer of this file.\n */\nexport async function writeConfig(dir: string, config: Config): Promise<void> {\n const validated = ConfigSchema.parse(config);\n await writeFileAtomic(configPath(dir), `${JSON.stringify(validated, null, 2)}\\n`, {\n mode: 0o600,\n dirMode: 0o700,\n });\n}\n\n/**\n * sendMaxAmount deliberately bypasses fileOrDefault: it has no usable default\n * (the operator's require-set-before-first-send posture). Absent from\n * config.json it resolves to the SEND_MAX_UNSET sentinel with source 'default',\n * which `tenjin wallet send` refuses outright — the cap must be set to an amount, \"0\"\n * (disable), or an explicit \"none\" (uncapped opt-in) before the first send.\n */\nfunction resolveSendMaxAmount(config: PartialConfig): ResolvedSetting<string> {\n if (config.sendMaxAmount !== undefined) return { value: config.sendMaxAmount, source: 'file' };\n return { value: SEND_MAX_UNSET, source: 'default' };\n}\n\nfunction fileOrDefault<K extends keyof Config>(\n key: K,\n config: PartialConfig,\n): ResolvedSetting<Config[K]> {\n const fromFile = config[key];\n // PartialConfig[K] is Config[K] | undefined; narrowing an indexed access of a\n // type parameter doesn't refine K, so assert the excluded-undefined type.\n if (fromFile !== undefined) return { value: fromFile as Config[K], source: 'file' };\n return { value: CONFIG_DEFAULTS[key], source: 'default' };\n}\n\nfunction resolveBaseUrl(\n config: PartialConfig,\n flags: SettingsFlags,\n env: NodeJS.ProcessEnv,\n): ResolvedSetting<string> {\n if (flags.baseUrl !== undefined && flags.baseUrl.length > 0) {\n return { value: flags.baseUrl, source: 'flag' };\n }\n const fromEnv = env.TENJIN_BASE_URL;\n if (fromEnv !== undefined && fromEnv.length > 0) {\n return { value: fromEnv, source: 'env' };\n }\n if (config.baseUrl !== undefined) return { value: config.baseUrl, source: 'file' };\n return { value: CONFIG_DEFAULTS.baseUrl, source: 'default' };\n}\n\nfunction isNotFound(err: unknown): boolean {\n return (\n typeof err === 'object' &&\n err !== null &&\n 'code' in err &&\n (err as { code?: unknown }).code === 'ENOENT'\n );\n}\n","/**\n * The harness adapter contract (tenjin-notes loop-redesign/04-harness-adapters.md).\n *\n * This and `error-markers.ts` (data both sides read) are the ONLY files the\n * kernel (`src/hooks/*`) imports from `src/adapters/`.\n * A harness is one module exporting a {@link HarnessAdapter}: a pure `decode`\n * from its native payload to {@link HookInput}, a pure `encode` from the\n * kernel's {@link Emit} to its native response, and a {@link Registrar} the\n * installer uses to write its hook entries. The daemon holds one adapter per\n * member of {@link Harness} and one route, `POST /hook/:harness`.\n *\n * Adding a harness is an adapter file plus a transport; nothing in `src/hooks`\n * or `src/daemon` changes. The union gains a member when an adapter lands, not\n * before.\n */\n\nimport type { PublishMode } from '../lib/config';\nimport type {\n CodexGrantResult,\n HarnessPermissions,\n PermissionsResult,\n} from '../lib/harness-permissions';\nimport type { CodexTrustReport, TrustProbeOptions, TrustResult } from '../lib/codex-trust';\n\n/** Harnesses with an adapter in this build. */\nexport type Harness = 'claude' | 'codex';\n\n/** The same union at run time: the installer's ownership predicate matches a\n * registered URL against `/hook/<harness>`, and a list it cannot iterate would\n * have to be spelled a second time. */\nexport const HARNESSES: readonly Harness[] = ['claude', 'codex'];\n\n/**\n * The canonical event vocabulary every adapter maps its native events onto.\n * `session.end` is deliberately absent: no arm registers on it and retention\n * never runs there (a daemon serves many sessions; one ending is not the\n * machine going quiet).\n */\nexport type Event =\n | 'session.start'\n | 'prompt'\n | 'tool.before'\n | 'tool.after'\n | 'agent.start'\n | 'agent.stop'\n | 'turn.end';\n\nexport const EVENTS: readonly Event[] = [\n 'session.start',\n 'prompt',\n 'tool.before',\n 'tool.after',\n 'agent.start',\n 'agent.stop',\n 'turn.end',\n];\n\n/**\n * What a tool IS to the arms. Anything unmatched is `'other'`, never a key.\n *\n * `web` and `fetch` are separate kinds because they are separate arms: a page\n * fetch and a real web search ask different questions, and one agent's six page\n * fetches must not spend the budget its search needed.\n */\nexport type ToolKind = 'web' | 'fetch' | 'dispatch' | 'shell' | 'edit' | 'read';\n\nexport interface ToolResult {\n stdout?: string;\n stderr?: string;\n error?: string;\n text?: string;\n}\n\ninterface ToolBase {\n /** The native tool name, verbatim. */\n name: string;\n callId?: string;\n /**\n * `tool.after` only, and DECIDED IN DECODE, never by an arm reading the\n * result text. `false` is a failure the harness stated or an error marker in\n * a shell's output; `true` is a completion the harness vouched for;\n * `undefined` is unknown, which is what a harness that reports no exit status\n * leaves behind. No marker never means success.\n */\n ok?: boolean;\n result?: ToolResult;\n interrupted?: boolean;\n}\n\n/**\n * The fields the arms read, canonical per kind. Native argument shapes (a\n * `file_path`, a patch body, a `message`) stop at the adapter; an arm never\n * reads a vendor field. One native invocation is one tool value, so an edit\n * that touches several files carries them all in `paths` and the context arm\n * marks every one in a single fire.\n */\nexport type HookTool = ToolBase &\n (\n | { kind: 'shell'; command: string }\n | { kind: 'edit'; paths: string[] }\n | { kind: 'read'; paths: string[] }\n | { kind: 'dispatch'; task: string; description?: string }\n | { kind: 'web'; query: string }\n | { kind: 'fetch'; url: string; prompt: string }\n | { kind: 'other' }\n );\n\n/** The normalized payload the kernel runs on. */\nexport interface HookInput {\n harness: Harness;\n event: Event;\n /** `hook_event_name` verbatim; `encode` stamps its response with it. */\n native: { event: string };\n /** The ROOT session as the harness names it: the id the lead and all its\n * children share. `actorOf` namespaces it by harness before anything is\n * stored, so equal native ids across harnesses never share state. */\n session: string;\n /** Child id; undefined = the lead. Present-but-invalid makes `decode` return null. */\n agent?: string;\n /** Required; '' is allowed and recorded. */\n cwd: string;\n /** Claude `prompt_id`, Codex `turn_id`. */\n turn?: string;\n tool?: HookTool;\n /** The prompt on `prompt`; the spawn prompt on `agent.start` when the harness has it. */\n prompt?: string;\n agentType?: string;\n lastMessage?: string;\n /** Claude/Codex `stop_hook_active`: this stop was raised by a hook's own\n * feedback rather than by the agent finishing. The capture arm reads it to\n * tell an ask turn from the answer turn after one. */\n stopFuse?: boolean;\n transcript?: { path?: string; agentPath?: string };\n /** `session.start` source (`startup`, `clear`, `compact`, `resume`). */\n source?: string;\n /** The native payload. Ledger `question` on error rows and tests only; never read by arms. */\n raw: unknown;\n}\n\n/**\n * What the kernel hands back to the harness. `null` is \"nothing to say\" (204).\n *\n * ONE CHANNEL. Everything an arm says is context beside the turn, including the\n * turn-end ask: on Stop and SubagentStop `additionalContext` keeps the\n * conversation going through the same loop protections a blocking decision\n * would, and shows in the transcript as hook feedback rather than a hook error.\n * A second channel with a red banner said the same words for a worse price.\n */\nexport interface Emit {\n context?: string;\n}\n\n/**\n * What the installer needs to register a harness, and nothing the daemon runs\n * on: `selectArm` reads the event and tool kind off the decoded input, so a\n * registrar carries no event or tool metadata that would claim an enforcement\n * nothing performs.\n */\nexport interface Registrar {\n /** The harness's own hooks file under `home`. */\n configPath(home: string, env?: NodeJS.ProcessEnv): string;\n /**\n * Entries the installer merges additively into that file, each\n * `{ event, matcher?, hooks }` in the harness's own JSON shape.\n */\n plan(target: { url: string; token: string; shimPath: string; timeoutSeconds: number }): unknown[];\n /**\n * The steps left to a PERSON once the file is written, for a harness that\n * gates entries it has not been told to trust. Takes the path actually\n * written, because a machine on `$CODEX_HOME` is not reading `~/.codex`.\n * One sentence was not enough: as a clause on the undo line, operators\n * finished an install reporting \"7 entries\" with a loop that never fired\n * (tenjin-agent#342).\n */\n activation?(hooksPath: string): string[];\n /** The harness-native persistent command grant, when this harness has one. */\n grant?: {\n path(home: string, env?: NodeJS.ProcessEnv): string;\n inspect(home: string, mode: PublishMode, env?: NodeJS.ProcessEnv): Promise<HarnessPermissions>;\n write(\n home: string,\n mode: PublishMode,\n env?: NodeJS.ProcessEnv,\n ): Promise<PermissionsResult | CodexGrantResult>;\n remove?(home: string, env?: NodeJS.ProcessEnv): Promise<{ path: string; removed: boolean }>;\n };\n /** A harness-native trust gate for registered hook handlers. */\n trust?: {\n ensure(\n home: string,\n keys: readonly string[],\n ownedBy: (row: { command?: unknown; sourcePath?: unknown }) => boolean,\n opts?: TrustProbeOptions,\n ): Promise<TrustResult>;\n read(\n home: string,\n keys: readonly string[],\n opts?: TrustProbeOptions,\n ): Promise<CodexTrustReport>;\n };\n}\n\nexport interface HarnessAdapter {\n id: Harness;\n /** Pure. `null` = drop the fire quietly (unknown event, invalid identity). */\n decode(raw: unknown): HookInput | null;\n /** Pure. `null` = respond 204 with no body. */\n encode(emit: Emit | null, input: HookInput): unknown;\n registrar: Registrar;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;;;AC8BlB,IAAM,YAAgC,CAAC,UAAU,OAAO;;;ADnB/D,IAAM,eAAe,iBAAE,OAAO,EAAE,MAAM,SAAS,wCAAwC;AAGhF,IAAM,oBAAoB,iBAAE,KAAK,CAAC,UAAU,QAAQ,WAAW,CAAC;AA8BhE,IAAM,0BAA0B,iBAAE,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC;AAO5D,SAAS,uBAAuB,OAAe,SAAoC;AACxF,QAAM,SAAS,wBAAwB,UAAU,KAAK;AACtD,MAAI,OAAO,QAAS,QAAO,OAAO;AAClC,QAAM,IAAI,SAAS,SAAS,WAAW,OAAO,IAAI,KAAK,UAAU,KAAK,CAAC,IAAI;AAAA,IACzE,KAAK;AAAA,EACP,CAAC;AACH;AAQA,IAAM,sBAAsB,iBAAE,OAAO;AAAA,EACnC,MAAM;AAAA,EACN,cAAc;AAAA,EACd,mBAAmB;AACrB,CAAC;AAUM,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAWA,IAAM,oBAAoB,iBAAE,OAAO;AAAA,EACjC,QAAQ,iBAAE,QAAQ;AAAA,EAClB,cAAc,iBAAE,QAAQ;AAAA,EACxB,aAAa,iBAAE,QAAQ;AAAA,EACvB,UAAU,i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I,OAAO,kBAAkB,OAAW,QAAO,EAAE,OAAO,OAAO,eAAe,QAAQ,OAAO;AAC7F,SAAO,EAAE,OAAO,gBAAgB,QAAQ,UAAU;AACpD;AAEA,SAAS,cACP,KACA,QAC4B;AAC5B,QAAM,WAAW,OAAO,GAAG;AAG3B,MAAI,aAAa,OAAW,QAAO,EAAE,OAAO,UAAuB,QAAQ,OAAO;AAClF,SAAO,EAAE,OAAO,gBAAgB,GAAG,GAAG,QAAQ,UAAU;AAC1D;AAEA,SAAS,eACP,QACA,OACA,KACyB;AACzB,MAAI,MAAM,YAAY,UAAa,MAAM,QAAQ,SAAS,GAAG;AAC3D,WAAO,EAAE,OAAO,MAAM,SAAS,QAAQ,OAAO;AAAA,EAChD;AACA,QAAM,UAAU,IAAI;AACpB,MAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAC/C,WAAO,EAAE,OAAO,SAAS,QAAQ,MAAM;AAAA,EACzC;AACA,MAAI,OAAO,YAAY,OAAW,QAAO,EAAE,OAAO,OAAO,SAAS,QAAQ,OAAO;AACjF,SAAO,EAAE,OAAO,gBAAgB,SAAS,QAAQ,UAAU;AAC7D;AAEA,SAAS,WAAW,KAAuB;AACzC,SACE,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACT,IAA2B,SAAS;AAEzC;","names":[]}
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-JKKAIPTU.js";
27
27
  import {
28
28
  USDC_ADDRESS
29
- } from "./chunk-GAKUQHKA.js";
29
+ } from "./chunk-TC2WZLSC.js";
30
30
  import {
31
31
  BATCH_SETTLEMENT_ADDRESS,
32
32
  BATCH_SETTLEMENT_SCHEME,
@@ -46,19 +46,19 @@ import {
46
46
  normalizeChannelId,
47
47
  receiveAuthorizationTypes,
48
48
  voucherTypes
49
- } from "./chunk-445VQTVM.js";
49
+ } from "./chunk-IE7P2BZE.js";
50
50
  import {
51
51
  describeWallet,
52
52
  resolveSpendAuthorizer,
53
53
  resolveWalletProvider
54
- } from "./chunk-BI673VEJ.js";
54
+ } from "./chunk-UXZONNEQ.js";
55
55
  import {
56
56
  readSpendSummary,
57
57
  spentOf
58
58
  } from "./chunk-SO3XRZPX.js";
59
59
  import {
60
60
  sanitizeForTerminal
61
- } from "./chunk-VJUVFZ2D.js";
61
+ } from "./chunk-FVIGCDSV.js";
62
62
  import {
63
63
  evaluatePlan
64
64
  } from "./chunk-2SNUOHAT.js";
@@ -69,12 +69,12 @@ import {
69
69
  fetchFailureToCliError,
70
70
  httpRequest,
71
71
  requestHeaderProblem
72
- } from "./chunk-OTWLERSW.js";
72
+ } from "./chunk-36RVGZNY.js";
73
73
  import {
74
74
  createPublicClient,
75
75
  http,
76
76
  recoverTypedDataAddress
77
- } from "./chunk-PJNENX2A.js";
77
+ } from "./chunk-WFSPCCVW.js";
78
78
  import {
79
79
  encodeAbiParameters,
80
80
  encodeFunctionData,
@@ -88,14 +88,14 @@ import {
88
88
  } from "./chunk-IADZOXKN.js";
89
89
  import {
90
90
  resolveContextSettings
91
- } from "./chunk-AV5NZMYO.js";
91
+ } from "./chunk-KM7RY2ZS.js";
92
92
  import {
93
93
  parseUsdToAtomic,
94
94
  toMoney
95
95
  } from "./chunk-Y527D4TV.js";
96
96
  import {
97
97
  readUsdcBalanceWithFallback
98
- } from "./chunk-DW4YTVR3.js";
98
+ } from "./chunk-WXA2BWTE.js";
99
99
  import {
100
100
  isSameDeployment
101
101
  } from "./chunk-XQJXNMSB.js";
@@ -3186,9 +3186,9 @@ var require_data = __commonJS({
3186
3186
  }
3187
3187
  });
3188
3188
 
3189
- // node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
3189
+ // node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/utils.js
3190
3190
  var require_utils = __commonJS({
3191
- "node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js"(exports, module) {
3191
+ "node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/utils.js"(exports, module) {
3192
3192
  "use strict";
3193
3193
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3194
3194
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
@@ -3420,6 +3420,37 @@ var require_utils = __commonJS({
3420
3420
  }
3421
3421
  return output.join("");
3422
3422
  }
3423
+ function removeDotSegmentsRelative(path) {
3424
+ if (path === "" || path[0] === "/") {
3425
+ return removeDotSegments(path);
3426
+ }
3427
+ const segments = path.split("/");
3428
+ const last = segments.length - 1;
3429
+ const output = [];
3430
+ let trailingDirectory = false;
3431
+ for (let i = 0; i <= last; i++) {
3432
+ const segment = segments[i];
3433
+ if (segment === "." || segment === "..") {
3434
+ if (segment === "..") {
3435
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3436
+ output.pop();
3437
+ } else {
3438
+ output.push("..");
3439
+ }
3440
+ }
3441
+ trailingDirectory = i === last;
3442
+ } else {
3443
+ output.push(segment);
3444
+ }
3445
+ }
3446
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3447
+ output.push("");
3448
+ }
3449
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3450
+ output.unshift(".");
3451
+ }
3452
+ return output.join("/");
3453
+ }
3423
3454
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3424
3455
  var HOST_DELIM_RE = /[@/?#:]/g;
3425
3456
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3680,6 +3711,7 @@ var require_utils = __commonJS({
3680
3711
  encodeFragment,
3681
3712
  escapePreservingEscapes,
3682
3713
  removeDotSegments,
3714
+ removeDotSegmentsRelative,
3683
3715
  isIPv4,
3684
3716
  isUUID,
3685
3717
  normalizeIPv6,
@@ -3688,9 +3720,9 @@ var require_utils = __commonJS({
3688
3720
  }
3689
3721
  });
3690
3722
 
3691
- // node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
3723
+ // node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/schemes.js
3692
3724
  var require_schemes = __commonJS({
3693
- "node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3725
+ "node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3694
3726
  "use strict";
3695
3727
  var { isUUID } = require_utils();
3696
3728
  var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
@@ -3899,20 +3931,22 @@ var require_schemes = __commonJS({
3899
3931
  }
3900
3932
  });
3901
3933
 
3902
- // node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
3934
+ // node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/index.js
3903
3935
  var require_fast_uri = __commonJS({
3904
- "node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js"(exports, module) {
3936
+ "node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/index.js"(exports, module) {
3905
3937
  "use strict";
3906
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3938
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3907
3939
  var { SCHEMES, getSchemeHandler } = require_schemes();
3908
3940
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3909
3941
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3910
- function decodeValidScheme(scheme) {
3911
- const decodedScheme = unescape(String(scheme));
3912
- if (!VALID_SCHEME.test(decodedScheme)) {
3942
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3943
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3944
+ function validateScheme(scheme) {
3945
+ const stringScheme = String(scheme);
3946
+ if (!VALID_SCHEME.test(stringScheme)) {
3913
3947
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3914
3948
  }
3915
- return decodedScheme;
3949
+ return stringScheme;
3916
3950
  }
3917
3951
  function normalize(uri, options) {
3918
3952
  if (typeof uri === "string") {
@@ -3949,6 +3983,9 @@ var require_fast_uri = __commonJS({
3949
3983
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3950
3984
  const resolvedHost = resolved.host;
3951
3985
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3986
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3987
+ throw new Error(MALFORMED_HOST_ERROR);
3988
+ }
3952
3989
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3953
3990
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3954
3991
  if (resolved.error && !encodedASCIIHost) {
@@ -3990,14 +4027,15 @@ var require_fast_uri = __commonJS({
3990
4027
  if (relative.path[0] === "/") {
3991
4028
  target.path = removeDotSegments(relative.path);
3992
4029
  } else {
3993
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
4030
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
4031
+ if (baseHasAuthority && !base.path) {
3994
4032
  target.path = "/" + relative.path;
3995
4033
  } else if (!base.path) {
3996
4034
  target.path = relative.path;
3997
4035
  } else {
3998
4036
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3999
4037
  }
4000
- target.path = removeDotSegments(target.path);
4038
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
4001
4039
  }
4002
4040
  target.query = relative.query;
4003
4041
  }
@@ -4035,12 +4073,13 @@ var require_fast_uri = __commonJS({
4035
4073
  const options = Object.assign({}, opts);
4036
4074
  const uriTokens = [];
4037
4075
  if (component.scheme) {
4038
- component.scheme = decodeValidScheme(component.scheme);
4076
+ component.scheme = validateScheme(component.scheme);
4039
4077
  }
4040
4078
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
4041
4079
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
4042
4080
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
4043
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4081
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4082
+ const pathNoScheme = !options.skipEscape && schemelessReference;
4044
4083
  if (component.path !== void 0) {
4045
4084
  if (!options.skipEscape) {
4046
4085
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -4049,7 +4088,7 @@ var require_fast_uri = __commonJS({
4049
4088
  }
4050
4089
  }
4051
4090
  if (options.reference !== "suffix" && component.scheme) {
4052
- component.scheme = decodeValidScheme(component.scheme);
4091
+ component.scheme = validateScheme(component.scheme);
4053
4092
  uriTokens.push(component.scheme, ":");
4054
4093
  }
4055
4094
  const authority = recomposeAuthority(component);
@@ -4065,9 +4104,9 @@ var require_fast_uri = __commonJS({
4065
4104
  if (component.path !== void 0) {
4066
4105
  let s = component.path;
4067
4106
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
4068
- s = removeDotSegments(s);
4107
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
4069
4108
  }
4070
- if (pathNoScheme) {
4109
+ if (schemelessReference) {
4071
4110
  s = serializePathEncoding(s, true);
4072
4111
  }
4073
4112
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4114,16 +4153,34 @@ var require_fast_uri = __commonJS({
4114
4153
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4115
4154
  }
4116
4155
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4156
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4157
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4158
+ return true;
4159
+ }
4117
4160
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4161
+ let url;
4118
4162
  try {
4119
- parsed.host = new URL("http://" + parsed.host).hostname;
4163
+ url = new URL("http://" + parsed.host);
4120
4164
  } catch (e) {
4121
4165
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4122
4166
  return true;
4123
4167
  }
4168
+ if (!isHostOnlyURL(url)) {
4169
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4170
+ return true;
4171
+ }
4172
+ parsed.host = url.hostname;
4124
4173
  }
4125
4174
  return false;
4126
4175
  }
4176
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4177
+ return Boolean(
4178
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4179
+ );
4180
+ }
4181
+ function isHostOnlyURL(url) {
4182
+ return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
4183
+ }
4127
4184
  function parseWithStatus(uri, opts) {
4128
4185
  const options = Object.assign({}, opts);
4129
4186
  const parsed = {
@@ -4178,9 +4235,8 @@ var require_fast_uri = __commonJS({
4178
4235
  parsed.query = matches[7];
4179
4236
  parsed.fragment = matches[8];
4180
4237
  if (parsed.scheme !== void 0) {
4181
- const decodedScheme = unescape(parsed.scheme);
4182
- if (VALID_SCHEME.test(decodedScheme)) {
4183
- parsed.scheme = decodedScheme.toLowerCase();
4238
+ if (VALID_SCHEME.test(parsed.scheme)) {
4239
+ parsed.scheme = parsed.scheme.toLowerCase();
4184
4240
  } else {
4185
4241
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4186
4242
  malformedScheme = true;
@@ -4208,7 +4264,7 @@ var require_fast_uri = __commonJS({
4208
4264
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4209
4265
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4210
4266
  if (malformedIPLiteral) {
4211
- parsed.error = parsed.error || "URI host is malformed.";
4267
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4212
4268
  malformedAuthorityOrPort = true;
4213
4269
  }
4214
4270
  } else {
@@ -4236,7 +4292,7 @@ var require_fast_uri = __commonJS({
4236
4292
  if (!isIP) {
4237
4293
  host = normalizePercentEncoding(host.toLowerCase());
4238
4294
  }
4239
- parsed.host = reescapeHostDelimiters(host, isIP);
4295
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4240
4296
  }
4241
4297
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4242
4298
  if (parsed.path) {
@@ -12829,4 +12885,4 @@ export {
12829
12885
  sellerLine,
12830
12886
  settlementTx
12831
12887
  };
12832
- //# sourceMappingURL=chunk-VUGQTZ2L.js.map
12888
+ //# sourceMappingURL=chunk-2RWB7RKE.js.map