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
@@ -3,17 +3,18 @@ import {
3
3
  NUDGE_OPT_OUT,
4
4
  channelTag,
5
5
  fetchDistTags,
6
+ fetchPublishTime,
6
7
  resolveTarget
7
- } from "./chunk-I5TDIUKM.js";
8
+ } from "./chunk-U3IKUGRP.js";
8
9
  import {
9
10
  underAgentHarness
10
11
  } from "./chunk-KOGZDMHO.js";
11
12
  import {
12
13
  ROUTER_PATH
13
- } from "./chunk-PKHI276N.js";
14
+ } from "./chunk-LXAYUOXI.js";
14
15
  import {
15
16
  readMcpServers
16
- } from "./chunk-B7EM4GGF.js";
17
+ } from "./chunk-3GNJXKIT.js";
17
18
  import {
18
19
  CLI_SKILL_NAMES,
19
20
  FEE_APPROVAL,
@@ -31,12 +32,12 @@ import {
31
32
  skillsDirsFor,
32
33
  spendChoiceQuestion,
33
34
  spendOptions
34
- } from "./chunk-AD226HDR.js";
35
+ } from "./chunk-A5GKIG5O.js";
35
36
  import {
36
37
  emitWriteNotice,
37
38
  paint,
38
39
  sanitizeForTerminal
39
- } from "./chunk-VJUVFZ2D.js";
40
+ } from "./chunk-FVIGCDSV.js";
40
41
  import {
41
42
  SUGGESTED_FUND_USD
42
43
  } from "./chunk-HDPUXS3Z.js";
@@ -48,17 +49,20 @@ import {
48
49
  MANAGERS,
49
50
  classifyManager,
50
51
  inspectPluginFolder,
52
+ isSourceCheckout,
51
53
  pluginFolderPath,
52
54
  readModSources,
53
55
  refuse,
54
56
  removePluginFolder,
55
57
  resolveManagerScript,
56
58
  writePluginFolder
57
- } from "./chunk-TAW4UFFF.js";
59
+ } from "./chunk-L6JEXB3E.js";
58
60
  import {
59
61
  PLUGIN_DIR,
60
- renderPluginFiles
61
- } from "./chunk-E7LGOMH6.js";
62
+ RUNTIME_MISSING_FIX,
63
+ renderPluginFiles,
64
+ shQuote
65
+ } from "./chunk-LRW6S53P.js";
62
66
  import {
63
67
  LEGACY_HOOK_TOOL,
64
68
  LEGACY_MCP_SERVER_NAME,
@@ -69,6 +73,10 @@ import {
69
73
  PLUGIN_NAME,
70
74
  SKILLS_DIR_PLUGIN_ID
71
75
  } from "./chunk-MPZUYCAP.js";
76
+ import {
77
+ runningGlibc,
78
+ unpinnedPlatform
79
+ } from "./chunk-4YOZGGTZ.js";
72
80
  import {
73
81
  envProxySupported,
74
82
  proxyNodeStep,
@@ -77,7 +85,7 @@ import {
77
85
  } from "./chunk-3FMZGI7I.js";
78
86
  import {
79
87
  httpRequest
80
- } from "./chunk-OTWLERSW.js";
88
+ } from "./chunk-36RVGZNY.js";
81
89
  import {
82
90
  CLAUDE_CODE_FLOOR,
83
91
  claudeConfigDir,
@@ -91,17 +99,17 @@ import {
91
99
  } from "./chunk-QXP3Z3JN.js";
92
100
  import {
93
101
  package_default
94
- } from "./chunk-YUY4SAGM.js";
102
+ } from "./chunk-RVPYTUP4.js";
95
103
  import {
96
104
  resolveContextSettings
97
- } from "./chunk-AV5NZMYO.js";
105
+ } from "./chunk-KM7RY2ZS.js";
98
106
  import {
99
107
  parseUsdToAtomic,
100
108
  toMoney
101
109
  } from "./chunk-Y527D4TV.js";
102
110
  import {
103
111
  readAliveStamp
104
- } from "./chunk-WOM257PW.js";
112
+ } from "./chunk-NDGZDTSJ.js";
105
113
  import {
106
114
  WALLET_REASONS,
107
115
  agentFixFor
@@ -116,7 +124,7 @@ import {
116
124
  MAX_AUTO_SPEND_FLOOR_ATOMIC,
117
125
  MAX_AUTO_SPEND_FLOOR_WHY,
118
126
  loadRawConfig
119
- } from "./chunk-2GNOFONN.js";
127
+ } from "./chunk-2M2VPI2E.js";
120
128
  import {
121
129
  PRODUCTION_ORIGIN,
122
130
  isSameDeployment
@@ -130,7 +138,7 @@ import {
130
138
  import {
131
139
  runtimeBuild,
132
140
  runtimeStatePath
133
- } from "./chunk-G75OPGAK.js";
141
+ } from "./chunk-ZNNXRNFD.js";
134
142
  import {
135
143
  isNewer
136
144
  } from "./chunk-EDJWHDDL.js";
@@ -809,14 +817,17 @@ function proxyCredentialsFix(env) {
809
817
 
810
818
  // src/router/install.ts
811
819
  var DISCLOSURE = [
812
- "What leaves this machine: the bounded text of each prompt, each native search query or URL (and, when one came back short, its status, size or error), each task handed to a subagent, and each question your assistant asks you with your answers, sent to Tenjin for the free routing gate, beside this session's id. When the gate offers free library docs for a search, that search query also goes to Tenjin's docs lookup, which asks Context7.",
820
+ "What leaves this machine: the bounded text of each prompt, each native search query or URL (and, when one came back short, its status, size or error), each task handed to a subagent, and each question your assistant asks you with your answers, sent to Tenjin for the free routing gate, beside this session's id. When your assistant calls the free library docs lookup, its query goes to Tenjin's docs lookup, which asks Context7.",
813
821
  "What is kept when a lookup is paid: the capability chosen, a hash of the contract, a hash of the arguments, and your wallet address. No prompt text, no arguments, no hint text.",
814
822
  "What never leaves: your private key. It is decrypted in this CLI to sign, and never sent anywhere."
815
823
  ];
816
824
  var NEW_SESSION_STEP = "start a new Claude Code session so Tenjin loads";
817
- var RELOAD_STEP = NEW_SESSION_STEP;
818
- function loadStep(_settingsInstallPresent) {
819
- return NEW_SESSION_STEP;
825
+ var RELOAD_STEP = "run `/reload-plugins` in this conversation so Tenjin loads, then continue your task";
826
+ function loadStep(settingsInstallPresent, env = {}, command = "tenjin") {
827
+ if (env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop" || env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop-3p") {
828
+ return `choose New session in Claude Desktop's Code tab for this same folder so Tenjin loads. Before switching, give the person one short ready-to-paste continuation prompt filled with this conversation's task, progress and next action; carry over the person's funding and spending choices, and have the next session check Tenjin with \`${command} doctor\`${process.platform === "win32" ? " in PowerShell" : ""} before continuing`;
829
+ }
830
+ return settingsInstallPresent ? NEW_SESSION_STEP : RELOAD_STEP;
820
831
  }
821
832
  function settingsInstallPaths(project, env, home, cwd) {
822
833
  return project ? {
@@ -901,6 +912,7 @@ async function runRouterInstall(args, ctx, deps = {}) {
901
912
  fix: "Set HOME to your home directory (`export HOME=...`), then re-run `tenjin install`."
902
913
  });
903
914
  }
915
+ assertPluginInstallation(ctx.dataDir, home, env);
904
916
  const config = await loadRawConfig(ctx.dataDir);
905
917
  const named = namedLimits(args);
906
918
  const cwd = deps.cwd ?? process.cwd();
@@ -909,9 +921,6 @@ async function runRouterInstall(args, ctx, deps = {}) {
909
921
  const claude = await readClaudeCode(env, cwd, deps.findClaude ?? findClaudeBinary);
910
922
  const paths = settingsInstallPaths(project, env, home, cwd);
911
923
  const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
912
- if (!project) {
913
- await recordClaudeProjects(ctx.dataDir, config.install?.routerProjects ?? [], env, home);
914
- }
915
924
  const setUpRuntime = () => (deps.runtime ?? defaultRuntime)({
916
925
  dataDir: ctx.dataDir,
917
926
  home,
@@ -923,11 +932,15 @@ async function runRouterInstall(args, ctx, deps = {}) {
923
932
  if (args.refresh === true && !await somethingToRefresh(claude, scope, legacy, env, home, cwd)) {
924
933
  if (!project && hasRuntime(ctx.dataDir, home)) {
925
934
  const rt2 = await setUpRuntime();
935
+ requireRuntime(rt2);
936
+ await recordClaudeProjects(ctx.dataDir, config.install?.routerProjects ?? [], env, home);
926
937
  if (runtimeLaunch(rt2) !== null) {
927
938
  await collectRuntime(rt2.root, await fallbackFolders(ctx.dataDir, env, home, cwd, false));
928
939
  }
929
940
  return runtimeOnlyRefresh(ctx, rt2, home);
930
941
  }
942
+ if (!project)
943
+ await recordClaudeProjects(ctx.dataDir, config.install?.routerProjects ?? [], env, home);
931
944
  throw new CliError(
932
945
  "REFUSED",
933
946
  `${NOTHING_TO_REFRESH}: neither the ${PLUGIN_ID} plugin nor a settings install of Tenjin is registered here.`,
@@ -939,13 +952,17 @@ async function runRouterInstall(args, ctx, deps = {}) {
939
952
  const answered = args.yes === true || named.keys.length > 0;
940
953
  const unasked = config.maxAutoSpend === void 0 && config.sessionBudget === void 0;
941
954
  const limits = args.refresh === true ? void 0 : named.keys.length > 0 ? { ...shownLimits(config), ...named.limits } : args.yes === true ? shownLimits(config) : canPrompt && unasked ? await approveLimits(deps) : {};
955
+ const deferred = !claude.meetsFloor && legacy.present;
956
+ const rt = deferred ? null : await setUpRuntime();
957
+ requireRuntime(rt);
958
+ if (!project) {
959
+ await recordClaudeProjects(ctx.dataDir, config.install?.routerProjects ?? [], env, home);
960
+ }
942
961
  const spend = await persistRouterDefaults(ctx.dataDir, args.refresh === true, limits, named.keys);
943
962
  const removedKeysLines = spend.removed.length > 0 ? [
944
963
  `Removed retired settings: ${spend.removed.join(", ")}. Automatic router limits remain in effect; manual pay always requires consent.`
945
964
  ] : [];
946
965
  const removedSkills = await removeRetiredSkills(home, project ? cwd : void 0);
947
- const deferred = !claude.meetsFloor && legacy.present;
948
- const rt = deferred ? null : await setUpRuntime();
949
966
  const launch = runtimeLaunch(rt);
950
967
  const plugin = deferred ? deferredRegistration(scope, claude) : await registerPlugin({
951
968
  binary: claude.binary,
@@ -1012,12 +1029,13 @@ async function runRouterInstall(args, ctx, deps = {}) {
1012
1029
  ]
1013
1030
  };
1014
1031
  }
1015
- const { resolveWallet } = await import("./install-wallet-SAAPKB73.js");
1032
+ const { resolveWallet } = await import("./install-wallet-5M4OTYLX.js");
1016
1033
  const wallet = await resolveWallet(ctx, deps, args.noWallet === true ? "flag" : void 0, false);
1017
1034
  const effective = await resolveContextSettings(ctx);
1018
- const spendAsk = !canPrompt && !answered && unasked ? spendStep(args) : void 0;
1035
+ const command = continuationCommand(rt);
1036
+ const spendAsk = !canPrompt && !answered && unasked ? spendStep(args, command) : void 0;
1019
1037
  const asksAgent = !canPrompt && underAgentHarness(env);
1020
- const [router, fund] = await Promise.all([
1038
+ const [router, funding] = await Promise.all([
1021
1039
  probeRouter(effective.baseUrl, {
1022
1040
  timeoutMs: ctx.flags.timeout,
1023
1041
  env,
@@ -1025,8 +1043,9 @@ async function runRouterInstall(args, ctx, deps = {}) {
1025
1043
  }),
1026
1044
  // The spend question comes first, because its answer picks the install
1027
1045
  // command. The funding question rides on the install that follows it.
1028
- asksAgent && spendAsk === void 0 ? fundStep(wallet, effective.rpcUrl, deps) : Promise.resolve(void 0)
1046
+ asksAgent && spendAsk === void 0 ? fundStep(wallet, effective.rpcUrl, deps, `${command} wallet fund ${SUGGESTED_FUND_USD}`) : Promise.resolve(void 0)
1029
1047
  ]);
1048
+ const fund = funding?.step;
1030
1049
  const nextSteps = [
1031
1050
  ...spendAsk !== void 0 ? [spendAsk] : [],
1032
1051
  ...fund !== void 0 ? [fund] : []
@@ -1041,12 +1060,15 @@ async function runRouterInstall(args, ctx, deps = {}) {
1041
1060
  wallet,
1042
1061
  migration,
1043
1062
  asksAgent && nextSteps.length > 0,
1044
- ctx.io.isTTY
1063
+ ctx.io.isTTY,
1064
+ command,
1065
+ env
1045
1066
  ),
1046
1067
  nextSteps,
1068
+ ...funding?.warning !== void 0 ? { fundingWarning: funding.warning } : {},
1047
1069
  // The check for this scope, said outright; a bare doctor in the project
1048
1070
  // also finds it from what the project holds.
1049
- ...project ? { doctor: "tenjin doctor --project" } : {},
1071
+ ...project ? { doctor: `${command} doctor --project` } : {},
1050
1072
  spend: { ...spend, effective: effectiveLimits(effective.policy) },
1051
1073
  wallet,
1052
1074
  router: {
@@ -1069,12 +1091,14 @@ async function runRouterInstall(args, ctx, deps = {}) {
1069
1091
  migration,
1070
1092
  wallet,
1071
1093
  ...fund !== void 0 ? { fund } : {},
1094
+ ...funding?.warning !== void 0 ? { fundingWarning: funding.warning } : {},
1072
1095
  asks: asksAgent && nextSteps.length > 0,
1073
1096
  policy: effective.policy,
1074
1097
  ...spendAsk !== void 0 ? { spendAsk } : {},
1075
1098
  router,
1076
1099
  rt,
1077
- home
1100
+ home,
1101
+ env
1078
1102
  }),
1079
1103
  ...removedKeysLines,
1080
1104
  ...serverLines
@@ -1082,7 +1106,7 @@ async function runRouterInstall(args, ctx, deps = {}) {
1082
1106
  };
1083
1107
  }
1084
1108
  async function defaultRuntime(o) {
1085
- const { setupRuntime } = await import("./runtime-UVNUA3AS.js");
1109
+ const { setupRuntime } = await import("./runtime-UZOKSUZX.js");
1086
1110
  return setupRuntime(o);
1087
1111
  }
1088
1112
  var sharedResults = /* @__PURE__ */ new WeakSet();
@@ -1090,10 +1114,24 @@ function runtimeOncePerRun(setup = defaultRuntime) {
1090
1114
  let first;
1091
1115
  return async (o) => {
1092
1116
  if (first === void 0) {
1093
- first = setup(o);
1117
+ first = setup(o).then((rt2) => {
1118
+ const restore = rt2.restore;
1119
+ if (restore === void 0) return rt2;
1120
+ return {
1121
+ ...rt2,
1122
+ restore: async () => {
1123
+ try {
1124
+ await restore();
1125
+ } finally {
1126
+ first = void 0;
1127
+ }
1128
+ }
1129
+ };
1130
+ });
1094
1131
  return first;
1095
1132
  }
1096
1133
  const rt = { ...await first };
1134
+ delete rt.restore;
1097
1135
  sharedResults.add(rt);
1098
1136
  return rt;
1099
1137
  };
@@ -1119,7 +1157,7 @@ function runtimeOnlyRefresh(ctx, rt, home) {
1119
1157
  }
1120
1158
  async function collectRuntime(root, folders) {
1121
1159
  try {
1122
- const { collect } = await import("./runtime-UVNUA3AS.js");
1160
+ const { collect } = await import("./runtime-UZOKSUZX.js");
1123
1161
  await collect(root, { lockWaitMs: 5e3, keep: await folderPointers(root, folders) });
1124
1162
  } catch {
1125
1163
  }
@@ -1150,6 +1188,41 @@ async function folderPointers(root, folders) {
1150
1188
  }
1151
1189
  return pointers;
1152
1190
  }
1191
+ function assertPluginInstallation(dataDir, home, env) {
1192
+ if (env.TENJIN_DATA_DIR && resolve(dataDir) !== resolve(defaultDataDir(home))) {
1193
+ throw new CliError("REFUSED", "Plugin installation needs the default data directory.", {
1194
+ fix: "Run without TENJIN_DATA_DIR. Other CLI commands still support it."
1195
+ });
1196
+ }
1197
+ if (!isSourceCheckout(dirname3(fileURLToPath2(import.meta.url)))) {
1198
+ const unsupported = unpinnedPlatform(process.platform, process.arch, runningGlibc());
1199
+ if (unsupported !== null)
1200
+ throw new CliError("REFUSED", `Plugin installation is unsupported on ${unsupported}.`, {
1201
+ fix: "Use macOS, Windows or glibc Linux 2.28+ on x64/arm64. Your existing setup was kept."
1202
+ });
1203
+ }
1204
+ }
1205
+ function continuationCommand(rt, platform = process.platform) {
1206
+ if (rt === null || rt.state === "skipped" || rt.node === void 0 || rt.entry === void 0)
1207
+ return "tenjin";
1208
+ const launcher = rt.launcher;
1209
+ const verifiedLauncher = launcher?.state === "written" || launcher?.state === "current";
1210
+ const path = verifiedLauncher ? launcher.paths.find((p) => platform !== "win32" || p.endsWith(".cmd")) : void 0;
1211
+ const parts = path === void 0 ? [rt.node, rt.entry] : [path];
1212
+ return platform === "win32" ? `& ${parts.map((part) => `'${part.replaceAll("'", "''")}'`).join(" ")}` : parts.map(shQuote).join(" ");
1213
+ }
1214
+ function requireRuntime(rt) {
1215
+ if (rt === null || rt.state === "skipped") return;
1216
+ if (rt.state === "failed" || rt.state === "kept" && rt.reason !== void 0 && rt.newer !== true) {
1217
+ throw new CliError(
1218
+ "UPDATE_FAILED",
1219
+ `Tenjin could not finish installation: ${rt.reason ?? "runtime setup failed"}. Your existing plugin registration was kept.`,
1220
+ {
1221
+ fix: rt.fix ?? (rt.unpinned ? "Use macOS, Windows or glibc Linux 2.28+ on x64/arm64." : "Check your connection and run tenjin install again.")
1222
+ }
1223
+ );
1224
+ }
1225
+ }
1153
1226
  function runtimeLaunch(rt) {
1154
1227
  if (rt === null || rt.state !== "active" && rt.state !== "current" && rt.state !== "kept") {
1155
1228
  return null;
@@ -1191,20 +1264,6 @@ function runtimeSentence(rt, home) {
1191
1264
  if (rt.state !== "active" || !rt.firstTime) return null;
1192
1265
  return `Runs from ${tilde(rt.root, home)} on its own Node ${rt.nodeVersion ?? ""}, so a Node upgrade or \`npm rm -g tenjin-cli\` no longer stops it.`;
1193
1266
  }
1194
- function fallbackSentence(rt) {
1195
- if (rt.state === "fallback" && rt.unpinned !== void 0) {
1196
- return `Tenjin pins no Node for this platform (${rt.unpinned}), so the plugin runs from npm's copy on the Node on your PATH, as before.`;
1197
- }
1198
- const next = rt.fix ?? "run `tenjin install` again to retry";
1199
- if (rt.state === "fallback") {
1200
- return `Tenjin's own runtime could not be set up (${rt.reason ?? "unknown reason"}), so the plugin still runs on the Node on your PATH; ${next}.`;
1201
- }
1202
- if (rt.state === "kept" && rt.reason !== void 0 && rt.newer !== true) {
1203
- const retry = rt.unpinned === void 0 ? `; ${next}` : "";
1204
- return `tenjin-cli ${package_default.version} could not be set up (${rt.reason}), so Tenjin keeps running ${rt.cli ?? "the runtime it has"}${retry}.`;
1205
- }
1206
- return null;
1207
- }
1208
1267
  function launcherSentence(launcher, home) {
1209
1268
  if (launcher === null) return null;
1210
1269
  if (launcher.state === "foreign") {
@@ -1224,13 +1283,8 @@ function runtimeLines(ctx, rt, home) {
1224
1283
  if (rt === null || sharedResults.has(rt)) return [];
1225
1284
  const warn = (text) => paint(ctx.io, "yellow", `! ${text}`);
1226
1285
  const runs = runtimeSentence(rt, home);
1227
- const fallback = fallbackSentence(rt);
1228
1286
  const launcher = launcherSentence(rt.launcher, home);
1229
- return [
1230
- ...runs !== null ? [` ${runs}`] : [],
1231
- ...fallback !== null ? [warn(fallback)] : [],
1232
- ...launcher !== null ? [warn(launcher)] : []
1233
- ];
1287
+ return [...runs !== null ? [` ${runs}`] : [], ...launcher !== null ? [warn(launcher)] : []];
1234
1288
  }
1235
1289
  function claudeCodeData(claude) {
1236
1290
  return {
@@ -1259,31 +1313,31 @@ var REPAIRABLE = /* @__PURE__ */ new Set([
1259
1313
  function repairStep(tty) {
1260
1314
  return tty ? `run \`tenjin wallet repair\` yourself ${REPAIR_CLAUSE}` : "ask the person to run `tenjin wallet repair` in their own terminal (never ask for the passphrase)";
1261
1315
  }
1262
- function nextStep(plugin, claude, wallet, migration, asksQuestion, tty) {
1316
+ function nextStep(plugin, claude, wallet, migration, asksQuestion, tty, command, env) {
1263
1317
  if (plugin.state === "failed") return registrationFix(plugin);
1264
- const steps = todaysSteps(plugin, claude, wallet, migration, asksQuestion);
1318
+ const steps = todaysSteps(plugin, claude, wallet, migration, asksQuestion, command, env);
1265
1319
  const signing = wallet.signing;
1266
1320
  if (signing?.status === "blocked" && REPAIRABLE.has(signing.reason)) {
1267
1321
  steps.unshift(repairStep(tty));
1268
1322
  }
1269
1323
  return steps.join(", then ");
1270
1324
  }
1271
- function todaysSteps(plugin, claude, wallet, migration, asksQuestion) {
1325
+ function todaysSteps(plugin, claude, wallet, migration, asksQuestion, command, env) {
1272
1326
  const steps = [];
1273
1327
  if (asksQuestion) {
1274
1328
  steps.push("ask the person the question in nextSteps, then run what the answer names");
1275
1329
  } else if (wallet.status === "created") {
1276
- steps.push("fund the wallet with `tenjin wallet fund`");
1330
+ steps.push(`fund the wallet with \`${command} wallet fund ${SUGGESTED_FUND_USD}\``);
1277
1331
  }
1278
1332
  if (plugin.state === "deferred") {
1279
1333
  steps.unshift("run `claude update`");
1280
1334
  steps.push(
1281
- "run `tenjin install` again; until then the earlier Tenjin setup keeps routing as before"
1335
+ `run \`${command} install\` again; until then the earlier Tenjin setup keeps routing as before`
1282
1336
  );
1283
1337
  return steps;
1284
1338
  }
1285
1339
  if (!claude.meetsFloor) steps.unshift("run `claude update`");
1286
- steps.push(loadStep(settingsInstallStays(migration)));
1340
+ steps.push(loadStep(settingsInstallStays(migration) || !claude.meetsFloor, env, command));
1287
1341
  return steps;
1288
1342
  }
1289
1343
  function settingsInstallStays(migration) {
@@ -1330,14 +1384,13 @@ function runtimeNotices(rt, home) {
1330
1384
  const out = [];
1331
1385
  const runs = runtimeSentence(rt, home);
1332
1386
  if (runs !== null) out.push(`Tenjin ${runs.charAt(0).toLowerCase()}${runs.slice(1)}`);
1333
- for (const sentence of [fallbackSentence(rt), launcherSentence(rt.launcher, home)]) {
1334
- if (sentence !== null) out.push(sentence);
1335
- }
1387
+ const launcher = launcherSentence(rt.launcher, home);
1388
+ if (launcher !== null) out.push(launcher);
1336
1389
  return out;
1337
1390
  }
1338
1391
  var SHOW_NOT_RUN = "Show the person addresses as written, and never ask them to run a command.";
1339
- function spendStep(args) {
1340
- return spendStepFor(installCommand(args));
1392
+ function spendStep(args, command) {
1393
+ return spendStepFor(installCommand(args, command));
1341
1394
  }
1342
1395
  function spendStepFor(command) {
1343
1396
  const options = spendOptions(command);
@@ -1346,12 +1399,12 @@ function spendStepFor(command) {
1346
1399
  id: "spend",
1347
1400
  question: spendChoiceQuestion(),
1348
1401
  options,
1349
- next: `In this session, ask the person this question with your question tool, offering these two options in order with the defaults marked recommended. The defaults are already in effect. Use the defaults: run \`${byDefault.command}\`. Set my own limits: ask for the most per day in USD (or none for no daily limit) and the most per call in USD (at least 0.25), then run \`${custom.command}\` with their amounts. Run the command alone, never joined with another command, and do not ask again a question its output repeats. ${SHOW_NOT_RUN}`
1402
+ next: `${process.platform === "win32" ? "Use PowerShell for these commands. " : ""}In this session, ask the person this question with your question tool, offering these two options in order with the defaults marked recommended. The defaults are already in effect. Use the defaults: run \`${byDefault.command}\`. Set my own limits: ask for the most per day in USD (or none for no daily limit) and the most per call in USD (at least 0.25), then run \`${custom.command}\` with their amounts. Run the command alone, never joined with another command, and do not ask again a question its output repeats. ${SHOW_NOT_RUN}`
1350
1403
  };
1351
1404
  }
1352
- function installCommand(args) {
1405
+ function installCommand(args, command) {
1353
1406
  return [
1354
- "tenjin install",
1407
+ `${command} install`,
1355
1408
  ...args.project === true ? ["--project"] : [],
1356
1409
  ...args.noWallet === true ? ["--no-wallet"] : []
1357
1410
  ].join(" ");
@@ -1381,9 +1434,9 @@ function namedLimits(args) {
1381
1434
  }
1382
1435
  return { limits, keys };
1383
1436
  }
1384
- var FUND_QUESTION = `Do you want to add $${SUGGESTED_FUND_USD} to your Tenjin wallet now?`;
1437
+ var FUND_QUESTION = `Add $${SUGGESTED_FUND_USD} to Tenjin now?`;
1385
1438
  var FUND_COMMAND = `tenjin wallet fund ${SUGGESTED_FUND_USD}`;
1386
- async function fundStep(wallet, rpcUrl, deps) {
1439
+ async function fundStep(wallet, rpcUrl, deps, command) {
1387
1440
  const address = wallet.address;
1388
1441
  if (address === void 0 || wallet.status !== "created" && wallet.status !== "existing") {
1389
1442
  return void 0;
@@ -1393,32 +1446,39 @@ async function fundStep(wallet, rpcUrl, deps) {
1393
1446
  () => null
1394
1447
  );
1395
1448
  if (funded === true) return void 0;
1396
- const show = `To add funds, send USDC on Base to ${address}.`;
1449
+ if (funded === null) {
1450
+ return {
1451
+ warning: "Could not check your Tenjin funds. Your usual tools keep working. Ask your agent to check your funds later; this check failing does not mean you need to add money again."
1452
+ };
1453
+ }
1454
+ const show = "You can ask your agent to add funds to Tenjin later. Paid tools need funds; your usual tools keep working.";
1397
1455
  return {
1398
- id: "fund",
1399
- question: FUND_QUESTION,
1400
- options: [
1401
- {
1402
- id: "fund",
1403
- label: "Yes, open the funding page",
1404
- recommended: false,
1405
- command: FUND_COMMAND
1406
- },
1407
- { id: "later", label: "Not now", recommended: false, command: null }
1408
- ],
1409
- next: `The install is done. Ask the person this question with your question tool. On "Yes, open the funding page", run \`${FUND_COMMAND}\` alone, in the same turn. On "Not now", run nothing and show the person this for later: ${show} Never run \`${FUND_COMMAND}\` without this yes. ${SHOW_NOT_RUN}`,
1410
- address,
1411
- show
1456
+ step: {
1457
+ id: "fund",
1458
+ question: FUND_QUESTION,
1459
+ options: [
1460
+ {
1461
+ id: "fund",
1462
+ label: `Add $${SUGGESTED_FUND_USD}`,
1463
+ recommended: false,
1464
+ command
1465
+ },
1466
+ { id: "later", label: "Not now", recommended: false, command: null }
1467
+ ],
1468
+ next: `${process.platform === "win32" ? "Use PowerShell for this command. " : ""}The install is done. Ask the person this question with your question tool. On "Add $${SUGGESTED_FUND_USD}", run \`${command}\` alone, in the same turn, then follow its nextStep. On "Not now", run nothing and show the person this for later: ${show} The address is an alternative only if they ask to transfer funds directly. Never run \`${command}\` without this yes. ${SHOW_NOT_RUN}`,
1469
+ address,
1470
+ show
1471
+ }
1412
1472
  };
1413
1473
  }
1414
1474
  async function defaultBalance(address, rpcUrl) {
1415
- const { getUsdcBalance } = await import("./usdc-D6X7EIQ2.js");
1475
+ const { getUsdcBalance } = await import("./usdc-VG4CIOUK.js");
1416
1476
  return getUsdcBalance(address, rpcUrl);
1417
1477
  }
1418
1478
  function fundLines(fund) {
1419
1479
  return [
1420
1480
  ` Ask the person: ${fund.question}`,
1421
- ` Yes, open the funding page: ${FUND_COMMAND}`,
1481
+ ` Add $${SUGGESTED_FUND_USD}: ${fund.options[0]?.command ?? FUND_COMMAND}`,
1422
1482
  ` Not now: run nothing, show them: ${fund.show}`
1423
1483
  ];
1424
1484
  }
@@ -1610,17 +1670,18 @@ function lines(ctx, s) {
1610
1670
  ];
1611
1671
  return [
1612
1672
  s.plugin.state === "failed" ? warn("Tenjin could not finish setting up Claude Code") : s.plugin.state === "deferred" ? warn("Tenjin keeps its earlier Claude Code setup until Claude Code is updated") : `${ok} Tenjin is set up for Claude Code (plugin ${s.plugin.id ?? PLUGIN_ID})`,
1613
- ...s.plugin.scope === "local" && s.plugin.state !== "failed" ? [" For this project only; check it with: tenjin doctor --project"] : [],
1673
+ ...s.plugin.scope === "local" && s.plugin.state !== "failed" ? [` For this project only; check it with: ${continuationCommand(s.rt)} doctor --project`] : [],
1614
1674
  ...runtimeLines(ctx, s.rt, s.home),
1615
1675
  ...walletLines(ctx, ok, s.wallet),
1616
1676
  ...spend,
1617
1677
  ...s.fund !== void 0 ? fundLines(s.fund) : [],
1678
+ ...s.fundingWarning !== void 0 ? [warn(s.fundingWarning)] : [],
1618
1679
  ...pluginLines(ctx, s.plugin),
1619
1680
  ...claudeLines(ctx, s.claude),
1620
1681
  ...migrationLines(ctx, s.migration),
1621
1682
  ...router,
1622
1683
  "",
1623
- `Next: ${nextStep(s.plugin, s.claude, s.wallet, s.migration, s.asks, ctx.io.isTTY)}`
1684
+ `Next: ${nextStep(s.plugin, s.claude, s.wallet, s.migration, s.asks, ctx.io.isTTY, continuationCommand(s.rt), s.env)}`
1624
1685
  ];
1625
1686
  }
1626
1687
  function refreshLines(ctx, plugin, claude, migration, rt, home) {
@@ -1638,6 +1699,7 @@ function refreshLines(ctx, plugin, claude, migration, rt, home) {
1638
1699
  var INSTALL_TIMEOUT_MS = 3e5;
1639
1700
  var STAGE_TIMEOUT_MS = 12e4;
1640
1701
  var NODE_TIMEOUT_MS = 3e5;
1702
+ var BACKGROUND_COOLDOWN_MS = 24 * 60 * 6e4;
1641
1703
  function resolveManager(manager, deps) {
1642
1704
  const script = deps.managerScript !== void 0 ? deps.managerScript : resolveManagerScript(manager, process.execPath);
1643
1705
  return script === null ? { cmd: MANAGERS[manager].bin, prefix: [] } : { cmd: process.execPath, prefix: [script] };
@@ -1646,8 +1708,8 @@ async function runUpdate(opts, ctx, deps = {}) {
1646
1708
  if (opts.background !== true) return update(opts, ctx, deps);
1647
1709
  const root = deps.runtimeRoot ?? runtimeDir(ctx.dataDir);
1648
1710
  const [{ recordAutoUpdate }, { readRuntimeState }] = await Promise.all([
1649
- import("./auto-update-OPWMRZLS.js"),
1650
- import("./runtime-layout-BDWZG2TQ.js")
1711
+ import("./auto-update-Y24UL56V.js"),
1712
+ import("./runtime-layout-WIDILZ6K.js")
1651
1713
  ]);
1652
1714
  const from = readRuntimeState(root)?.current.cli;
1653
1715
  const record = (r) => {
@@ -1737,12 +1799,26 @@ async function update(opts, ctx, deps) {
1737
1799
  ]
1738
1800
  };
1739
1801
  }
1802
+ if (opts.background === true) {
1803
+ const wait = await tooNewForBackground(latest, ctx, deps);
1804
+ if (wait !== null) {
1805
+ return {
1806
+ data: { ...data(false), skipped: wait },
1807
+ humanLines: [`${wait}; the background update takes a release a day after it is published.`]
1808
+ };
1809
+ }
1810
+ }
1740
1811
  if (runtime !== null) {
1741
1812
  return runtimeUpdate(ctx, deps, { ...runtime, base, latest, current, moduleDir, data });
1742
1813
  }
1743
1814
  await refuseRuntimeElsewhere(ctx, moduleDir, deps.homeDir ?? homedir2());
1744
1815
  const spec = `tenjin-cli@${latest}`;
1745
1816
  refuse(moduleDir, { check: false, spec });
1817
+ const { checkReleaseProvenance } = await import("./runtime-UZOKSUZX.js");
1818
+ await checkReleaseProvenance(latest, {
1819
+ timeoutMs: ctx.flags.timeout,
1820
+ fetchImpl: deps.fetchImpl
1821
+ });
1746
1822
  const human = ctx.io.isTTY && !ctx.flags.json;
1747
1823
  let tail = "";
1748
1824
  const onOutput = (chunk) => {
@@ -1806,15 +1882,29 @@ async function updated(deps, data, refresh, head, version) {
1806
1882
  }
1807
1883
  async function runtimeHere(ctx, deps, moduleDir) {
1808
1884
  if (resolve2(ctx.dataDir) !== resolve2(defaultDataDir(deps.homeDir ?? homedir2()))) return null;
1809
- const { readRuntimeState, runtimeBuild: runtimeBuild2 } = await import("./runtime-layout-BDWZG2TQ.js");
1885
+ const { readRuntimeState, runtimeBuild: runtimeBuild2 } = await import("./runtime-layout-WIDILZ6K.js");
1810
1886
  const root = deps.runtimeRoot ?? runtimeDir(ctx.dataDir);
1811
1887
  const state = readRuntimeState(root);
1812
1888
  const inRuntime = runtimeBuild2(moduleDir) !== null;
1813
1889
  if (state === null && !inRuntime) return null;
1814
1890
  return { root, current: state?.current.cli ?? null, inRuntime };
1815
1891
  }
1892
+ async function tooNewForBackground(latest, ctx, deps) {
1893
+ const answer = await fetchPublishTime(latest, {
1894
+ fetchImpl: deps.fetchImpl,
1895
+ timeoutMs: ctx.flags.timeout
1896
+ });
1897
+ if (answer === null) {
1898
+ throw new CliError("NETWORK_ERROR", `Could not read when tenjin-cli ${latest} was published`, {
1899
+ fix: "Check access to registry.npmjs.org and retry"
1900
+ });
1901
+ }
1902
+ if (answer.publishedAt === null) return `npm names no publish time for tenjin-cli ${latest}`;
1903
+ const age = (deps.now ?? Date.now)() - answer.publishedAt;
1904
+ return age >= BACKGROUND_COOLDOWN_MS ? null : `tenjin-cli ${latest} was published under 24 hours ago`;
1905
+ }
1816
1906
  async function refuseRuntimeElsewhere(ctx, moduleDir, home) {
1817
- const { runtimeBuild: runtimeBuild2 } = await import("./runtime-layout-BDWZG2TQ.js");
1907
+ const { runtimeBuild: runtimeBuild2 } = await import("./runtime-layout-WIDILZ6K.js");
1818
1908
  if (runtimeBuild2(moduleDir) === null) return;
1819
1909
  throw new CliError(
1820
1910
  "REFUSED",
@@ -1827,8 +1917,8 @@ async function refuseRuntimeElsewhere(ctx, moduleDir, home) {
1827
1917
  async function runtimeUpdate(ctx, deps, o) {
1828
1918
  const { root, base, latest } = o;
1829
1919
  const [rt, layout] = await Promise.all([
1830
- import("./runtime-UVNUA3AS.js"),
1831
- import("./runtime-layout-BDWZG2TQ.js")
1920
+ import("./runtime-UZOKSUZX.js"),
1921
+ import("./runtime-layout-WIDILZ6K.js")
1832
1922
  ]);
1833
1923
  const stays = `so ${base} stays`;
1834
1924
  let stage;
@@ -1839,7 +1929,7 @@ async function runtimeUpdate(ctx, deps, o) {
1839
1929
  "UPDATE_FAILED",
1840
1930
  `tenjin-cli ${latest} cannot find its own package, ${stays}`,
1841
1931
  {
1842
- fix: "Run `npx -y tenjin-cli@latest install`."
1932
+ fix: RUNTIME_MISSING_FIX
1843
1933
  }
1844
1934
  );
1845
1935
  }
@@ -2131,6 +2221,7 @@ var spawnCapture = (cmd, args, opts, onOutput) => new Promise((res) => {
2131
2221
  export {
2132
2222
  inspectLegacyInstall,
2133
2223
  removeLegacyInstall,
2224
+ BACKGROUND_COOLDOWN_MS,
2134
2225
  runUpdate,
2135
2226
  versionFreeEntry,
2136
2227
  spawnCapture,
@@ -2159,6 +2250,9 @@ export {
2159
2250
  defaultRuntime,
2160
2251
  runtimeOncePerRun,
2161
2252
  hasRuntime,
2253
+ assertPluginInstallation,
2254
+ continuationCommand,
2255
+ requireRuntime,
2162
2256
  runtimeData,
2163
2257
  tilde,
2164
2258
  runtimeLines,
@@ -2170,4 +2264,4 @@ export {
2170
2264
  approveLimits,
2171
2265
  effectiveLimits
2172
2266
  };
2173
- //# sourceMappingURL=chunk-VOZA6O7K.js.map
2267
+ //# sourceMappingURL=chunk-ILNIZ5I2.js.map