nolo-cli 0.219.0 → 0.221.0

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 (201) hide show
  1. package/{_executeModel-WW57SJN4.js → _executeModel-WZKT6XEU.js} +74 -74
  2. package/{action-CK64LS6S.js → action-GDZDXPMB.js} +7 -7
  3. package/{addContentAction-EQXMFNPR.js → addContentAction-7RO4AMRI.js} +12 -12
  4. package/{addDialogAgentAction-RSDZDASD.js → addDialogAgentAction-EVYBGTXB.js} +14 -14
  5. package/{agentDeleteCommand-X2VWEKUA.js → agentDeleteCommand-PZWRHNXY.js} +114 -115
  6. package/{agentEmailCommands-6IE773VW.js → agentEmailCommands-QTKMEICX.js} +115 -116
  7. package/{agentFavoriteCommands-2LKGKSUD.js → agentFavoriteCommands-7LOP3HUD.js} +5 -5
  8. package/{agentGrantCommands-QQV4N4JW.js → agentGrantCommands-L6O2HVJI.js} +5 -5
  9. package/{agentListCommands-5UNM7CGG.js → agentListCommands-GUGMORTK.js} +84 -70
  10. package/{agentMachineCommands-EVWFKK6Q.js → agentMachineCommands-7QGICJLM.js} +56 -55
  11. package/{agentProviderCommands-ZCH37KAL.js → agentProviderCommands-STI3DQ6A.js} +6 -6
  12. package/{agentPullCommand-XN6ZPBUW.js → agentPullCommand-KHV4EELF.js} +5 -5
  13. package/{agentRecordCommands-DX2WE6BH.js → agentRecordCommands-SLLADS5C.js} +102 -103
  14. package/{agentRunCommand-KGOT2AFB.js → agentRunCommand-OFQLOF5Y.js} +113 -112
  15. package/{agentRunControl-QDFW5P2T.js → agentRunControl-MBG4U6SL.js} +20 -14
  16. package/{agentRuntimeLocal-SD7U2EGY.js → agentRuntimeLocal-TU4LA353.js} +39 -39
  17. package/{agentSlice-ACZGTZVW.js → agentSlice-L4SBGWTB.js} +16 -16
  18. package/{appDeleteCommands-NE3NQQJL.js → appDeleteCommands-JWP3XPUA.js} +50 -49
  19. package/{appDeployCommands-2BAHY522.js → appDeployCommands-6E4TQCWI.js} +50 -49
  20. package/{appDeployStatusCommands-JTW6LZNC.js → appDeployStatusCommands-ALU4SADG.js} +50 -49
  21. package/{appGetCommands-WKFEJO6A.js → appGetCommands-JEY4L6L4.js} +50 -49
  22. package/{appListCommands-HNAZZLFX.js → appListCommands-PCAVHU7M.js} +50 -49
  23. package/{authCommand-4FDPL7WG.js → authCommand-CGRIIOOV.js} +26 -23
  24. package/{authCommands-GAJ3NIXO.js → authCommands-55OGQGCR.js} +9 -6
  25. package/{builtinSkillRegistry-PXH7EGQB.js → builtinSkillRegistry-BAE2LDXF.js} +4 -4
  26. package/{chromeOpsCommands-YKX2QX3A.js → chromeOpsCommands-WAA45NCS.js} +6 -6
  27. package/{chunk-OB6DVWPF.js → chunk-262R3XNN.js} +16 -2
  28. package/{chunk-5OZC7R7Y.js → chunk-2MCB7CD7.js} +13 -12
  29. package/{chunk-IWH5SOU4.js → chunk-2NPD3FTX.js} +3 -3
  30. package/{chunk-OGHP3CTL.js → chunk-2X7WFDT6.js} +1 -1
  31. package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
  32. package/{chunk-JWXITTQB.js → chunk-3P54D2E4.js} +1 -1
  33. package/{chunk-EGXPAWLG.js → chunk-3U44JB3O.js} +1 -1
  34. package/{chunk-YL3EFYL3.js → chunk-4D4QD7FT.js} +3 -1
  35. package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
  36. package/{chunk-C4WTX5TU.js → chunk-4ZGPHFLE.js} +2 -2
  37. package/{chunk-MOMR7NMG.js → chunk-547ENH5T.js} +1 -1
  38. package/chunk-5ZUOVCKT.js +32 -0
  39. package/{chunk-TRWT3EE3.js → chunk-62HXNQVV.js} +1 -1
  40. package/{chunk-KOXKKHFE.js → chunk-6QHKRARD.js} +2 -2
  41. package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
  42. package/{chunk-JC5XLWZK.js → chunk-7JGMNKKG.js} +19 -15
  43. package/{chunk-FRSBYNWI.js → chunk-AGYPUBFW.js} +31 -205
  44. package/{chunk-UYOICCYG.js → chunk-ALAES342.js} +59 -88
  45. package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
  46. package/{chunk-6NKA6RKF.js → chunk-AUAJTAFM.js} +8 -8
  47. package/chunk-BIDSIRTS.js +307 -0
  48. package/chunk-BIWI5M4E.js +62 -0
  49. package/{chunk-L5I543VB.js → chunk-BNMPUQW6.js} +1 -1
  50. package/{chunk-BGGHA5DV.js → chunk-BP5ZJ6B4.js} +1 -1
  51. package/{chunk-Q6HOUF4O.js → chunk-CBUZ6DKA.js} +3 -3
  52. package/{chunk-LE6LGAJE.js → chunk-CD3RU7XL.js} +17 -2
  53. package/{chunk-AVHRSJUH.js → chunk-CMMI3DAT.js} +13 -13
  54. package/{chunk-H7R3365N.js → chunk-CYWNWA77.js} +5 -5
  55. package/{chunk-6D7NVU66.js → chunk-D6YNCNM6.js} +17 -14
  56. package/{chunk-6RQFZCKH.js → chunk-DBUR22G5.js} +6 -6
  57. package/{chunk-MKQ2UTTX.js → chunk-DDC6P6EH.js} +22 -19
  58. package/{chunk-PVZY6P3S.js → chunk-DEA37IUY.js} +2 -2
  59. package/{chunk-QLFCTYRH.js → chunk-DGYCDA6W.js} +3 -3
  60. package/{chunk-SRL56PI2.js → chunk-DUUDXSLX.js} +21 -7
  61. package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
  62. package/{chunk-PFJNLBRU.js → chunk-EEOOBRA7.js} +6 -6
  63. package/{chunk-KN3HEZIQ.js → chunk-EVGU5P4U.js} +1 -1
  64. package/{chunk-O2CYENYJ.js → chunk-EXJK7TQO.js} +2113 -1090
  65. package/{chunk-CXDPIPZ4.js → chunk-F6Z6ZCUV.js} +2 -2
  66. package/{chunk-EOWLBDY6.js → chunk-FJSNBZXR.js} +1 -1
  67. package/{chunk-GNHMRBYZ.js → chunk-G7IUT2V3.js} +4 -3
  68. package/{chunk-7WPAI5JJ.js → chunk-GACR7H6T.js} +14 -14
  69. package/{chunk-65XXHYZ5.js → chunk-GOCSSER3.js} +3 -3
  70. package/{chunk-4NMHE7CX.js → chunk-GPOV42YM.js} +14 -14
  71. package/{chunk-SASHAZ67.js → chunk-GUXZK7SE.js} +2 -2
  72. package/{chunk-F3TQURKK.js → chunk-GYS5FUYR.js} +19 -19
  73. package/{chunk-VHPAA6MT.js → chunk-H6L2NFHY.js} +6 -6
  74. package/{chunk-G2EJ7NL4.js → chunk-HBRDSQ3M.js} +2 -2
  75. package/{chunk-OOF7XDZF.js → chunk-HHFGE2WF.js} +6 -6
  76. package/{chunk-DJSTBAOU.js → chunk-HSSBDZLD.js} +4 -4
  77. package/{chunk-GIABSSWQ.js → chunk-HYLRQDEE.js} +4 -4
  78. package/{chunk-N3J4VDGV.js → chunk-IAAIUH64.js} +15 -15
  79. package/{chunk-UJKTI5PG.js → chunk-ILHQ2AXT.js} +0 -1
  80. package/{chunk-T3O6BLYU.js → chunk-IXG6YXQM.js} +147 -115
  81. package/{chunk-TVFRV3UQ.js → chunk-JUSHVFNF.js} +238 -185
  82. package/{chunk-QWYFFHCJ.js → chunk-K67C2JUC.js} +10 -10
  83. package/{chunk-HCJFGH6Y.js → chunk-L32W3PRP.js} +46 -16
  84. package/{chunk-2KTUDBG7.js → chunk-M4SFKP5L.js} +1 -1
  85. package/{chunk-KAVGK4ES.js → chunk-MDZWUD3R.js} +18 -18
  86. package/{chunk-OXKUPBAQ.js → chunk-NHY322ZU.js} +151 -10
  87. package/{chunk-UMRI2IRY.js → chunk-OBIC6EG7.js} +6 -6
  88. package/{chunk-VALBGPM6.js → chunk-OBSEKCVK.js} +17 -20
  89. package/{chunk-SYQR7FQS.js → chunk-OG6MQOQG.js} +96 -28
  90. package/{chunk-AMEOV5VZ.js → chunk-OOJNQK6V.js} +33 -33
  91. package/{chunk-K5FNYHZC.js → chunk-OWKNSIXL.js} +149 -54
  92. package/{chunk-XFJ4ZPFC.js → chunk-OYU2MA5S.js} +25 -25
  93. package/{chunk-CKT6QUE2.js → chunk-Q3IVPFVO.js} +1 -1
  94. package/{chunk-AFHOCBSP.js → chunk-QBZCGP34.js} +1 -1
  95. package/{chunk-2ZKFCIJJ.js → chunk-QCB42576.js} +1 -1
  96. package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
  97. package/{chunk-XWGDCWXY.js → chunk-QRGDJA4B.js} +9 -9
  98. package/{chunk-4A2JIXR2.js → chunk-QYB23WUH.js} +1 -1
  99. package/{chunk-FVZW66K4.js → chunk-R3NEQZ53.js} +288 -95
  100. package/{chunk-2VUZSVAS.js → chunk-R6Z5S5GA.js} +7 -7
  101. package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
  102. package/{chunk-GGKNJ42M.js → chunk-RBPUNSG5.js} +2 -2
  103. package/{chunk-GVGOEMNV.js → chunk-RG2DGNL6.js} +3 -3
  104. package/{chunk-2OLYKYNY.js → chunk-RTHFJZ6M.js} +8 -8
  105. package/{chunk-C4VAR65S.js → chunk-RYOLWYBK.js} +120 -116
  106. package/{chunk-D726I5AZ.js → chunk-S6FDXXZV.js} +2 -2
  107. package/{chunk-JVRQ6YVK.js → chunk-S6K5F3KP.js} +1 -1
  108. package/{chunk-7UH3DGV6.js → chunk-SMJEXX2S.js} +7 -7
  109. package/{chunk-IWQAOW2X.js → chunk-SRCCSTIM.js} +8 -8
  110. package/{chunk-KO63FPG3.js → chunk-STJ6LSQE.js} +750 -2523
  111. package/{chunk-Q7WP5RPC.js → chunk-TGNIKIHR.js} +5 -5
  112. package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
  113. package/{chunk-5R63B62U.js → chunk-TSPMLCWI.js} +7 -7
  114. package/{chunk-QVBXJNZ2.js → chunk-TUSTONB3.js} +1 -1
  115. package/{chunk-3ESU44FG.js → chunk-UE2EVEYS.js} +3 -3
  116. package/{chunk-S7SB7L2I.js → chunk-UWAIJOF2.js} +19 -19
  117. package/{chunk-KEN3N2TN.js → chunk-VMJVAJ6W.js} +13 -10
  118. package/{chunk-SOF4OWDM.js → chunk-VS276URX.js} +0 -2
  119. package/{chunk-N7HVLYOY.js → chunk-VSYTM22R.js} +3 -3
  120. package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
  121. package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
  122. package/{chunk-3N4ASIP6.js → chunk-XJPLSAPJ.js} +11 -11
  123. package/{chunk-J6T25AJ6.js → chunk-XSW4EXQV.js} +82 -18
  124. package/{chunk-DVQH4BTR.js → chunk-YKY4OVOX.js} +14 -10
  125. package/{chunk-5RKUPJYL.js → chunk-ZH3KXFHS.js} +11 -3
  126. package/chunk-ZOHO6MOF.js +376 -0
  127. package/{chunk-652XYZGP.js → chunk-ZXF6D3I6.js} +13 -6
  128. package/{cliAgentConfigHelpers-PO3MVDME.js → cliAgentConfigHelpers-BTRHMPW2.js} +12 -12
  129. package/{cliEnvHelpers-VPSJ4XWC.js → cliEnvHelpers-CNMP3RDX.js} +1 -1
  130. package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
  131. package/{cliLocalAgentRecordReader-Z7CH4K4R.js → cliLocalAgentRecordReader-M3F76NIP.js} +45 -45
  132. package/{commandRegistry-SDSYBKMC.js → commandRegistry-ZLWHQVAI.js} +93 -93
  133. package/{contentThunks-G3TRPEAU.js → contentThunks-4ZX2TO7C.js} +36 -35
  134. package/{cooldownCommands-X7P5M2V5.js → cooldownCommands-YB5H5BBK.js} +4 -4
  135. package/{createAgentAutomationAction-KHA4MXUJ.js → createAgentAutomationAction-L4CYUZJG.js} +36 -35
  136. package/{createDialogAction-KWSBNAPJ.js → createDialogAction-QTU2R2Q3.js} +37 -36
  137. package/{createPageAction-HXKJ7OFG.js → createPageAction-F3GJTHW2.js} +37 -36
  138. package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
  139. package/{dbSlice-ZJPDIFER.js → dbSlice-XRUZOGSU.js} +11 -11
  140. package/{deleteFile-Q3YDB4ML.js → deleteFile-6URDHYRB.js} +7 -7
  141. package/{dialogCommands-6KQEBHSG.js → dialogCommands-NRLCOPJR.js} +52 -52
  142. package/{dialogNotifyCommand-WIZFFEY3.js → dialogNotifyCommand-SHGPCU22.js} +13 -13
  143. package/{dialogSlice-HXPKFGRL.js → dialogSlice-P2S4LXQD.js} +34 -33
  144. package/{dialogUsageCommand-HTVPR2CX.js → dialogUsageCommand-W2WCSGKF.js} +1 -1
  145. package/{docCreateCommands-XZOLWBRC.js → docCreateCommands-YJRDA3RX.js} +48 -47
  146. package/{docDeleteCommands-ZSO4LGWE.js → docDeleteCommands-A5QIHZNF.js} +50 -49
  147. package/{docReadCommands-TTMXCDER.js → docReadCommands-CF2LTMYH.js} +48 -47
  148. package/{docStore-A2B3GH33.js → docStore-6O7NYL6A.js} +12 -12
  149. package/{docUpdateCommands-PRG6WOXL.js → docUpdateCommands-QRKV4ZXE.js} +48 -47
  150. package/fetchMessages-TQEUZD7H.js +1 -1
  151. package/{getPricing-YH3VMSVU.js → getPricing-LF5C4XSI.js} +5 -5
  152. package/{handleSendMessageAction-NWYG3Q72.js → handleSendMessageAction-7IHLR37A.js} +65 -65
  153. package/{hostCredentialCreate-WS6D3EHT.js → hostCredentialCreate-VNCQUAFT.js} +102 -103
  154. package/index.js +56 -18
  155. package/keys-RWF7UCB4.js +1 -1
  156. package/{localDialogRead-SVTPA5GY.js → localDialogRead-CCOCVGAP.js} +1 -1
  157. package/{localRecall-2J6QPOK2.js → localRecall-BDYKXB46.js} +3 -1
  158. package/{localRuntimeAdapter-TFYOA6YE.js → localRuntimeAdapter-FOWVNMIK.js} +109 -110
  159. package/{machineCommands-WFWV25IR.js → machineCommands-ZGC3J4JB.js} +111 -112
  160. package/{machineWsRunDispatch-ZGXC3F2R.js → machineWsRunDispatch-KK5U4M3G.js} +100 -101
  161. package/{memberThunks-JRYNONYV.js → memberThunks-7Y3OYSJQ.js} +15 -15
  162. package/{memoryCommands-5WC3T66U.js → memoryCommands-BC6REPQB.js} +4 -4
  163. package/{models-CXINDUJA.js → models-H5NNZRLH.js} +2 -2
  164. package/{overlay-THLKYIWY.js → overlay-BBQZXGYI.js} +5 -3
  165. package/package.json +1 -1
  166. package/{projectArchive-ULJDLUA6.js → projectArchive-7ZDYBXAX.js} +42 -41
  167. package/{providerPresetApply-SHT2SUVB.js → providerPresetApply-WHAMP2D5.js} +6 -6
  168. package/{providerRegistry-TA7EGCVZ.js → providerRegistry-ZI2KORJ7.js} +6 -6
  169. package/{read-Q7GOHGNP.js → read-TYMBGEXO.js} +8 -8
  170. package/{readDocTool-Z5OQ6422.js → readDocTool-SKQVHBLO.js} +1 -1
  171. package/{readlineWorkspace-LTCV2BFW.js → readlineWorkspace-YHT4SX2C.js} +3946 -4393
  172. package/{removeDialogAgentAction-U3F2MNAY.js → removeDialogAgentAction-F5QE2O2B.js} +16 -16
  173. package/{runAgentClientLoop-BVIEQUB3.js → runAgentClientLoop-H4ED5V3K.js} +71 -67
  174. package/{runtimeDoctorCommands-I47JN4HS.js → runtimeDoctorCommands-RRKPBGVO.js} +14 -14
  175. package/{secretCommands-LJXOOYA7.js → secretCommands-KZWBZIYS.js} +4 -4
  176. package/{setDialogExtraReferencesAction-G3WSJ7EM.js → setDialogExtraReferencesAction-72L27ERM.js} +13 -13
  177. package/{setPrimaryDialogAgentAction-6FHAHZBB.js → setPrimaryDialogAgentAction-GJJDUSGJ.js} +16 -16
  178. package/{settingThunks-AXTBX3Q5.js → settingThunks-ZRGWVGZD.js} +15 -15
  179. package/{skillDiscovery-B5V23AXP.js → skillDiscovery-I37M5KJC.js} +3 -3
  180. package/{spaceCommands-IB6FKWIC.js → spaceCommands-MEH3HJBC.js} +53 -52
  181. package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
  182. package/{streamAgentChatTurn-DNYFHBJM.js → streamAgentChatTurn-ZXPOXU33.js} +89 -128
  183. package/{switchDialogAgentAction-UOFIAGPL.js → switchDialogAgentAction-IIJBPND3.js} +14 -14
  184. package/{tableCommands-HITDSLHS.js → tableCommands-FTAOCBTX.js} +11 -11
  185. package/{tools-JVOJ5HC4.js → tools-2MRWA2PP.js} +58 -58
  186. package/tuiRestart-2IL37YIB.js +41 -0
  187. package/{tuiSummaryLlmCaller-7LWYTHLM.js → tuiSummaryLlmCaller-W2QN4VAC.js} +18 -18
  188. package/{updateCommands-RJVCRSBP.js → updateCommands-CPATDG6J.js} +8 -6
  189. package/{updateDialogTitleAction-Q57BOSXG.js → updateDialogTitleAction-RZ3KZSGQ.js} +36 -35
  190. package/{usageCommand-RVKHEPLU.js → usageCommand-2BF74MKF.js} +2 -2
  191. package/{usageRebuildCommand-GRAFOZF2.js → usageRebuildCommand-UHB55BQM.js} +3 -3
  192. package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-ZFD6J5HF.js} +2 -2
  193. package/chunk-2THCNKE4.js +0 -147
  194. package/chunk-KEPOVMF4.js +0 -91
  195. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  196. package/{chunk-AGP3YSEC.js → chunk-4N6G2CKP.js} +3 -3
  197. package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
  198. package/{chunk-SNBZZPYH.js → chunk-OQHIVPG4.js} +3 -3
  199. package/{chunk-47ITIXO7.js → chunk-USGHJSGO.js} +3 -3
  200. package/{offlineMarxistsAgentCommand-4IC3Y4C6.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +3 -3
  201. package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
@@ -1,3 +1,9 @@
1
+ import {
2
+ isCompiledBinary
3
+ } from "./chunk-BIDSIRTS.js";
4
+ import {
5
+ DEFAULT_NOLO_SERVER_URL
6
+ } from "./chunk-OLZBQWZU.js";
1
7
  import {
2
8
  loadProfileConfig
3
9
  } from "./chunk-R5GO3YZP.js";
@@ -6,28 +12,22 @@ import {
6
12
  } from "./chunk-4O22PGNQ.js";
7
13
  import {
8
14
  scheduleWindowsSelfUpdate
9
- } from "./chunk-5RKUPJYL.js";
15
+ } from "./chunk-ZH3KXFHS.js";
10
16
  import {
11
17
  t
12
- } from "./chunk-OB6DVWPF.js";
13
- import {
14
- isCompiledBinary
15
- } from "./chunk-2THCNKE4.js";
16
- import {
17
- DEFAULT_NOLO_SERVER_URL
18
- } from "./chunk-OLZBQWZU.js";
18
+ } from "./chunk-262R3XNN.js";
19
19
  import {
20
20
  normalizeServerOrigin
21
21
  } from "./chunk-CF7PE763.js";
22
22
 
23
23
  // packages/cli/updateCommands.ts
24
- import { existsSync, readFileSync, accessSync, constants } from "node:fs";
24
+ import { existsSync, readFileSync, accessSync, constants, realpathSync } from "node:fs";
25
25
  import { homedir } from "node:os";
26
26
  import { dirname, join } from "node:path";
27
27
  import { fileURLToPath } from "node:url";
28
28
  function resolvePackageJsonPath() {
29
29
  if (isCompiledBinary()) {
30
- const execDir = dirname(process.execPath);
30
+ const execDir = dirname(realpathSync(process.execPath));
31
31
  const candidate2 = join(execDir, "package.json");
32
32
  if (existsSync(candidate2)) return candidate2;
33
33
  return null;
@@ -212,6 +212,34 @@ async function runShellScript(script, {
212
212
  ]);
213
213
  return exitCode;
214
214
  }
215
+ function buildManagedNpmUpdateScript(channel) {
216
+ return `set -eu
217
+ PREFIX=$(npm prefix -g)
218
+ ENTRY="$PREFIX/bin/nolo"
219
+ ROOT="\${NOLO_HOME:-$HOME/.nolo}/cli/versions"
220
+ mkdir -p "$ROOT" "\${ENTRY%/*}"
221
+ STAGING=$(mktemp -d "$ROOT/npm.XXXXXXXX")
222
+ # npm writes only into the newly reserved prefix, never the global package.
223
+ npm install -g --prefix "$STAGING" ${shellQuote(`nolo-cli@${channel}`)} --progress
224
+ PACKAGE="$STAGING/lib/node_modules/nolo-cli"
225
+ node -e 'const p=require(process.argv[1]); if(p.name!=="nolo-cli" || !/^[0-9]+\\.[0-9]+\\.[0-9]+(?:[-+][0-9A-Za-z.+-]+)?$/.test(p.version)) process.exit(1)' "$PACKAGE/package.json"
226
+ VERSION_TEXT=$("$PACKAGE/index.js" -v)
227
+ case "$VERSION_TEXT" in
228
+ "nolo-cli "*) ;;
229
+ *) echo "Error: invalid staged CLI version" >&2; exit 1 ;;
230
+ esac
231
+ # Fail before touching the live entry. Version is a health check, not identity:
232
+ # every install has a unique permanent prefix, including same-version builds.
233
+ EXPECTED=$(node -p 'require(process.argv[1]).version' "$PACKAGE/package.json")
234
+ [ "$VERSION_TEXT" = "nolo-cli $EXPECTED" ]
235
+ if [ -d "$ENTRY" ] || { [ -e "$ENTRY" ] && [ ! -L "$ENTRY" ]; }; then echo "Error: refusing non-symlink entrypoint; retain it and migrate explicitly" >&2; exit 1; fi
236
+ LINK="$ENTRY.new.$$"
237
+ if [ -e "$LINK" ] || [ -L "$LINK" ]; then exit 1; fi
238
+ ln -s "$PACKAGE/index.js" "$LINK"
239
+ mv -f "$LINK" "$ENTRY"
240
+ echo "nolo updated to $ENTRY"
241
+ `;
242
+ }
215
243
  function shellQuote(value) {
216
244
  return "'" + value.replace(/'/g, "'\\''") + "'";
217
245
  }
@@ -221,39 +249,19 @@ function buildStandaloneUpdateScript(args) {
221
249
  EXTRACT_DIR=${shellQuote(args.extractDir)}
222
250
  ENTRY=${shellQuote(args.symlinkPath)}
223
251
  CURRENT_VERSION=${shellQuote(args.currentVersion)}
224
- STAGING="$EXTRACT_DIR.new.$$"
225
- BACKUP="$EXTRACT_DIR.old.$$"
252
+ if [ -L "$EXTRACT_DIR" ]; then
253
+ echo "Error: refusing symlink bundle directory" >&2
254
+ exit 1
255
+ fi
256
+ # mktemp reserves a fresh directory even for rebuilds of the same version.
257
+ mkdir -p "$EXTRACT_DIR.versions"
258
+ STAGING=$(mktemp -d "$EXTRACT_DIR.versions/build.XXXXXXXX")
226
259
  LINK="$ENTRY.new.$$"
227
- old_moved=0
228
- new_moved=0
229
- committed=0
230
- cleanup() {
231
- status=$?
232
- trap - 0 HUP INT TERM
233
- if [ "$committed" = 0 ]; then
234
- if [ "$new_moved" = 1 ] && [ -d "$EXTRACT_DIR" ]; then
235
- mv "$EXTRACT_DIR" "$STAGING" || exit 1
236
- fi
237
- if [ "$old_moved" = 1 ] && [ -d "$BACKUP" ]; then
238
- mv "$BACKUP" "$EXTRACT_DIR" || exit 1
239
- fi
240
- fi
241
- rm -rf "$STAGING" || true
242
- rm -f "$LINK" || true
243
- exit "$status"
244
- }
245
- # Refuse collisions before installing cleanup: never remove somebody else's path.
246
- if [ -e "$STAGING" ] || [ -L "$STAGING" ] ||
247
- [ -e "$BACKUP" ] || [ -L "$BACKUP" ] ||
248
- [ -e "$LINK" ] || [ -L "$LINK" ]; then
249
- echo "Error: update staging path already exists" >&2
260
+ if [ -e "$LINK" ] || [ -L "$LINK" ]; then
261
+ echo "Error: update link staging path already exists" >&2
250
262
  exit 1
251
263
  fi
252
- mkdir -p "\${EXTRACT_DIR%/*}"
253
- mkdir "$STAGING"
254
- trap cleanup 0
255
- trap 'exit 1' HUP INT TERM
256
-
264
+ # Failed staged bundles are retained too; no old runtime is ever removed.
257
265
  echo ${shellQuote(`Downloading nolo from ${args.tarballUrl}...`)}
258
266
  if ! ${curl} ${shellQuote(args.tarballUrl)} -o "$STAGING/bundle.tar.gz"; then
259
267
  ${args.tarballUrl !== args.fallbackUrl ? `echo ${shellQuote(`Primary source unavailable, trying ${args.fallbackUrl}...`)}
@@ -264,7 +272,6 @@ if ! ${curl} ${shellQuote(args.tarballUrl)} -o "$STAGING/bundle.tar.gz"; then
264
272
  exit 1`}
265
273
  fi
266
274
  tar -xzf "$STAGING/bundle.tar.gz" -C "$STAGING"
267
- rm -f "$STAGING/bundle.tar.gz"
268
275
  chmod +x "$STAGING/nolo"
269
276
  # A failing, empty or malformed version response must not touch the live install.
270
277
  VERSION_TEXT=$("$STAGING/nolo" -v)
@@ -321,32 +328,14 @@ if [ -n "$CUR_MAJOR" ] && [ -n "$CUR_MINOR" ] && [ -n "$CUR_PATCH" ]; then
321
328
  ;;
322
329
  esac
323
330
  fi
324
- if [ "$VERSION" = "$CURRENT_VERSION" ]; then
325
- echo "\u2713 Already up to date (nolo-cli $VERSION)."
326
- exit 10
327
- fi
328
331
  mkdir -p "\${ENTRY%/*}"
329
- # mv without -T is portable only when the destination is not a directory.
330
- if [ -d "$ENTRY" ] || [ -L "$EXTRACT_DIR" ]; then
331
- echo "Error: refusing directory entrypoint or symlink bundle directory" >&2
332
+ if [ -d "$ENTRY" ] || { [ -e "$ENTRY" ] && [ ! -L "$ENTRY" ]; }; then
333
+ echo "Error: refusing non-symlink entrypoint; retain it and migrate explicitly" >&2
332
334
  exit 1
333
335
  fi
334
- ln -s "$EXTRACT_DIR/nolo" "$LINK"
335
- if [ -e "$EXTRACT_DIR" ]; then
336
- old_moved=1
337
- mv "$EXTRACT_DIR" "$BACKUP"
338
- fi
339
- new_moved=1
340
- mv "$STAGING" "$EXTRACT_DIR"
336
+ # The staged path becomes permanent. Never rename the running bundle.
337
+ ln -s "$STAGING/nolo" "$LINK"
341
338
  mv -f "$LINK" "$ENTRY"
342
- committed=1
343
- # Retain only the newest recovery copy from this run; prune older backups.
344
- for old_copy in "$EXTRACT_DIR.old."*; do
345
- if [ -d "$old_copy" ] && [ ! -L "$old_copy" ] && [ "$old_copy" != "$BACKUP" ]; then
346
- rm -rf "$old_copy" || true
347
- fi
348
- done
349
- # Retain the previous bundle as a recovery copy; never unlink the live entry.
350
339
  echo "nolo updated to $ENTRY"
351
340
  `;
352
341
  }
@@ -369,7 +358,7 @@ async function runStandaloneBundleUpdate(options) {
369
358
  const tarballUrl = `${repoBase}/public/downloads/${bundleName}`;
370
359
  const fallbackUrl = `https://nolo.chat/public/downloads/${bundleName}`;
371
360
  const extractDir = join(homedir(), ".nolo", extractSubdir);
372
- const installDir = resolveStandaloneInstallDir();
361
+ const installDir = env.NOLO_INSTALL_DIR || resolveStandaloneInstallDir();
373
362
  const symlinkPath = join(installDir, "nolo");
374
363
  const script = buildStandaloneUpdateScript({
375
364
  tarballUrl,
@@ -543,31 +532,12 @@ ${t("updateInstallerTitle")}
543
532
  `);
544
533
  output.write(`${t("updateNpmDownloading")}
545
534
  `);
546
- const useCustomSink = options.output !== void 0;
547
- const proc = spawn({
548
- cmd: command,
549
- // Capture mode (TUI sink): ignore stdin — see runShellScript.
550
- stdin: useCustomSink ? "ignore" : "inherit",
551
- stdout: useCustomSink ? "pipe" : "inherit",
552
- stderr: useCustomSink ? "pipe" : "inherit",
553
- env
535
+ const exitCode = await runShellScript(buildManagedNpmUpdateScript(channel), {
536
+ output,
537
+ spawn,
538
+ env,
539
+ useCustomSink: options.output !== void 0
554
540
  });
555
- if (!useCustomSink) {
556
- const exitCode2 = await proc.exited;
557
- if (exitCode2 === 0) {
558
- output.write(` ${renderProgressBar(100)}
559
- `);
560
- output.write(`${t("updateCompleted")}
561
-
562
- `);
563
- }
564
- return { exitCode: exitCode2, disposition: "completed" };
565
- }
566
- const [exitCode] = await Promise.all([
567
- proc.exited,
568
- forwardSpawnOutput(proc.stdout, output),
569
- forwardSpawnOutput(proc.stderr, output)
570
- ]);
571
541
  if (exitCode === 0) {
572
542
  output.write(` ${renderProgressBar(100)}
573
543
  `);
@@ -594,6 +564,7 @@ export {
594
564
  buildSelfUpdateCommand,
595
565
  resolveSelfUpdateServerUrl,
596
566
  buildCliDoctorText,
567
+ buildManagedNpmUpdateScript,
597
568
  buildStandaloneUpdateScript,
598
569
  runStandaloneBundleUpdate,
599
570
  NOLO_UPDATE_CHECK_KILL_SWITCH,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getAllServers,
6
6
  getIsDesktopApp
7
- } from "./chunk-AGP3YSEC.js";
7
+ } from "./chunk-4N6G2CKP.js";
8
8
  import {
9
9
  SERVERS
10
10
  } from "./chunk-LCBAMY2M.js";
@@ -1,22 +1,19 @@
1
- import {
2
- readDbRecord,
3
- writeAgentRecord
4
- } from "./chunk-6D7NVU66.js";
5
1
  import {
6
2
  buildSkillSummaryMarker
7
3
  } from "./chunk-VF4K2QE6.js";
4
+ import {
5
+ readDbRecord,
6
+ writeAgentRecord
7
+ } from "./chunk-D6YNCNM6.js";
8
8
  import {
9
9
  createSpaceKey
10
10
  } from "./chunk-UAD2WT54.js";
11
- import {
12
- asTrimmedLowercaseString
13
- } from "./chunk-QSJ3HFEF.js";
14
11
  import {
15
12
  parseUserIdFromAuthToken,
16
13
  readOption,
17
14
  resolveAuthToken,
18
15
  resolveServerUrl
19
- } from "./chunk-2THCNKE4.js";
16
+ } from "./chunk-BIDSIRTS.js";
20
17
  import {
21
18
  NOLO_CLUSTER_SERVERS
22
19
  } from "./chunk-LCBAMY2M.js";
@@ -26,6 +23,9 @@ import {
26
23
  import {
27
24
  normalizeServerOrigin
28
25
  } from "./chunk-CF7PE763.js";
26
+ import {
27
+ asTrimmedLowercaseString
28
+ } from "./chunk-QSJ3HFEF.js";
29
29
 
30
30
  // packages/cli/docSpaceHelpers.ts
31
31
  async function ensurePageAttachedToSpace(params) {
@@ -0,0 +1,307 @@
1
+ import {
2
+ DEFAULT_NOLO_SERVER_URL
3
+ } from "./chunk-OLZBQWZU.js";
4
+ import {
5
+ NOLO_CLUSTER_SERVERS
6
+ } from "./chunk-LCBAMY2M.js";
7
+ import {
8
+ asOptionalTrimmedString
9
+ } from "./chunk-G3SUCT4W.js";
10
+ import {
11
+ DEFAULT_LOCAL_API_ORIGIN
12
+ } from "./chunk-4SN6J65J.js";
13
+ import {
14
+ normalizeServerOrigin
15
+ } from "./chunk-CF7PE763.js";
16
+
17
+ // packages/cli/agentRunProtocol.ts
18
+ import { createHash } from "node:crypto";
19
+ import { existsSync, lstatSync, statSync, readFileSync, readdirSync, realpathSync } from "node:fs";
20
+ import { dirname, extname, join, relative } from "node:path";
21
+ import { fileURLToPath } from "node:url";
22
+ var AGENT_RUN_PROTOCOL = "nolo-agent-run/2";
23
+ var RuntimeProtocolMismatchError = class extends Error {
24
+ code = "runtime_protocol_mismatch";
25
+ constructor() {
26
+ super("runtime_protocol_mismatch: parent and child agent-run protocols differ");
27
+ }
28
+ };
29
+ function validateAgentRunProtocol(expected) {
30
+ if (expected !== AGENT_RUN_PROTOCOL) throw new RuntimeProtocolMismatchError();
31
+ }
32
+ var RuntimeVersionMismatchError = class extends Error {
33
+ code = "runtime_version_mismatch";
34
+ constructor(detail) {
35
+ super(`runtime_version_mismatch: ${detail}; restart CLI/desktop before retrying`);
36
+ }
37
+ };
38
+ var ignoredDirectories = /* @__PURE__ */ new Set([
39
+ "node_modules",
40
+ ".git",
41
+ ".nolo",
42
+ ".worktrees",
43
+ "data",
44
+ "nolodata",
45
+ "credentials",
46
+ "dist",
47
+ "build",
48
+ "public",
49
+ "assets",
50
+ "docs",
51
+ "logs",
52
+ "artifacts",
53
+ "coverage",
54
+ "__tests__",
55
+ "__fixtures__",
56
+ "fixtures",
57
+ "testHelpers",
58
+ "test-helpers"
59
+ ]);
60
+ var codeFile = /\.[cm]?[jt]sx?$/;
61
+ var testFile = /(?:\.(?:test|spec)\.[^.]+$|^tsconfig\.)/;
62
+ function captureRuntimeContent(root, source) {
63
+ const hash = createHash("sha256");
64
+ const active = /* @__PURE__ */ new Set();
65
+ const visit = (directory) => {
66
+ const canonical = realpathSync(directory);
67
+ if (active.has(canonical)) throw new RuntimeVersionMismatchError("runtime code contains a symlink cycle");
68
+ active.add(canonical);
69
+ for (const name of readdirSync(directory).sort()) {
70
+ if (name.startsWith(".") || ignoredDirectories.has(name)) continue;
71
+ const path = join(directory, name);
72
+ let stat = lstatSync(path);
73
+ if (stat.isSymbolicLink()) {
74
+ try {
75
+ stat = statSync(path);
76
+ } catch {
77
+ if (codeFile.test(name) || name === "package.json") throw new RuntimeVersionMismatchError("runtime code link is unreadable");
78
+ continue;
79
+ }
80
+ }
81
+ if (stat.isDirectory()) visit(path);
82
+ else if (codeFile.test(name) && !testFile.test(name) || name === "package.json") {
83
+ const bytes = readFileSync(path);
84
+ hash.update(JSON.stringify([relative(root, path), bytes.length]));
85
+ hash.update(bytes);
86
+ }
87
+ }
88
+ active.delete(canonical);
89
+ };
90
+ if (source) {
91
+ visit(join(root, "packages"));
92
+ for (const name of ["package.json", "bun.lock", "bun.lockb", "bunfig.toml", "tsconfig.json"]) {
93
+ hash.update(name);
94
+ const path = join(root, name);
95
+ hash.update(existsSync(path) ? readFileSync(path) : "<absent>");
96
+ }
97
+ } else visit(root);
98
+ return hash.digest("hex");
99
+ }
100
+ function createRuntimeContentGuard(root, source) {
101
+ const canonical = realpathSync(root);
102
+ const startupContent = captureRuntimeContent(canonical, source);
103
+ return Object.assign(() => {
104
+ try {
105
+ if (captureRuntimeContent(canonical, source) !== startupContent) {
106
+ throw new RuntimeVersionMismatchError("runtime content changed since host startup");
107
+ }
108
+ } catch (error) {
109
+ if (error instanceof RuntimeVersionMismatchError) throw error;
110
+ throw new RuntimeVersionMismatchError("startup runtime content is no longer readable");
111
+ }
112
+ }, { identity: startupContent });
113
+ }
114
+ function captureHostRuntimeGuard() {
115
+ try {
116
+ const url = import.meta.url;
117
+ if (url.includes("/$bunfs/")) {
118
+ const executable = getHostRuntimeExecutable();
119
+ const digest = createHash("sha256").update(readFileSync(executable)).digest("hex");
120
+ return Object.assign(() => {
121
+ try {
122
+ if (createHash("sha256").update(readFileSync(executable)).digest("hex") !== digest) {
123
+ throw new RuntimeVersionMismatchError("host executable changed since startup");
124
+ }
125
+ } catch (error) {
126
+ if (error instanceof RuntimeVersionMismatchError) throw error;
127
+ throw new RuntimeVersionMismatchError("startup executable is no longer readable");
128
+ }
129
+ }, { identity: digest });
130
+ }
131
+ const modulePath = fileURLToPath(url);
132
+ const source = extname(modulePath) === ".ts";
133
+ return createRuntimeContentGuard(source ? dirname(dirname(dirname(modulePath))) : dirname(modulePath), source);
134
+ } catch {
135
+ return Object.assign(() => {
136
+ throw new RuntimeVersionMismatchError("host startup identity unavailable");
137
+ }, { identity: "unavailable" });
138
+ }
139
+ }
140
+ var hostExecutable;
141
+ function getHostRuntimeExecutable() {
142
+ return hostExecutable ?? realpathSync(process.execPath);
143
+ }
144
+ var hostGuard;
145
+ var HOST_RUNTIME_CONTENT_IDENTITY = "uninitialized";
146
+ function initializeHostRuntimeIdentity() {
147
+ if (hostGuard) return;
148
+ hostExecutable = realpathSync(process.execPath);
149
+ hostGuard = captureHostRuntimeGuard();
150
+ HOST_RUNTIME_CONTENT_IDENTITY = hostGuard.identity;
151
+ }
152
+ function isAgentRuntimeHostCommand(args, interactive) {
153
+ if (args.some((arg) => ["--help", "-h", "--version", "-v"].includes(arg))) return false;
154
+ if (!args.length) return interactive;
155
+ return args[0] === "chat" || args[0] === "tui" || args[0] === "connect" || args[0] === "agent" && ["run", "continue", "smoke-current"].includes(args[1]);
156
+ }
157
+ function resolveExactRuntimeEntrypoint(path) {
158
+ try {
159
+ if (!existsSync(path)) throw new Error("missing");
160
+ return realpathSync(path);
161
+ } catch {
162
+ throw new RuntimeVersionMismatchError("explicit runtime entrypoint is missing or unreadable");
163
+ }
164
+ }
165
+
166
+ // packages/cli/cliEnvHelpers.ts
167
+ import { dirname as dirname2, extname as extname2, join as join2 } from "node:path";
168
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
169
+ import { existsSync as existsSync2, realpathSync as realpathSync2 } from "node:fs";
170
+ function resolveServerUrlFromEnv(env) {
171
+ return normalizeServerOrigin(
172
+ env.NOLO_SERVER || env.BASE_URL || DEFAULT_NOLO_SERVER_URL
173
+ );
174
+ }
175
+ function isCliArgs(value) {
176
+ return Array.isArray(value);
177
+ }
178
+ function buildServerCandidates(values) {
179
+ return [...new Set(
180
+ values.filter((value) => typeof value === "string" && value.trim().length > 0).map((value) => normalizeServerOrigin(value))
181
+ )];
182
+ }
183
+ function resolveServerUrl(input, env) {
184
+ if (isCliArgs(input)) {
185
+ const explicit = readOption(input, "--server-url") || readOption(input, "--server");
186
+ return normalizeServerOrigin(explicit) || resolveServerUrlFromEnv(env ?? {});
187
+ }
188
+ return resolveServerUrlFromEnv(input);
189
+ }
190
+ function resolveServerCandidates(input, envOrPreferred, preferred) {
191
+ if (isCliArgs(input)) {
192
+ const env2 = envOrPreferred ?? {};
193
+ const explicitServer = resolveServerUrl(input, env2);
194
+ return buildServerCandidates([
195
+ explicitServer,
196
+ preferred?.trim(),
197
+ env2.NOLO_SERVER,
198
+ env2.BASE_URL,
199
+ env2.NOLO_SERVER_URL,
200
+ DEFAULT_NOLO_SERVER_URL,
201
+ ...NOLO_CLUSTER_SERVERS
202
+ ]);
203
+ }
204
+ const env = input;
205
+ return buildServerCandidates([
206
+ asOptionalTrimmedString(envOrPreferred),
207
+ env.NOLO_SERVER,
208
+ env.BASE_URL,
209
+ env.NOLO_SERVER_URL,
210
+ DEFAULT_NOLO_SERVER_URL,
211
+ ...NOLO_CLUSTER_SERVERS
212
+ ]);
213
+ }
214
+ function resolveDeleteServerCandidatesFromEnv(env, ...preferredValues) {
215
+ return buildServerCandidates([
216
+ ...preferredValues,
217
+ env.NOLO_SERVER,
218
+ env.BASE_URL,
219
+ env.NOLO_SERVER_URL,
220
+ env.READ_DIALOG_BASE,
221
+ DEFAULT_NOLO_SERVER_URL,
222
+ ...NOLO_CLUSTER_SERVERS,
223
+ DEFAULT_LOCAL_API_ORIGIN
224
+ ]);
225
+ }
226
+ function resolveDeleteServerCandidates(input, envOrPreferred, preferred) {
227
+ if (isCliArgs(input)) {
228
+ const env2 = envOrPreferred ?? {};
229
+ const explicitServer = resolveServerUrl(input, env2);
230
+ return resolveDeleteServerCandidatesFromEnv(env2, explicitServer, preferred?.trim());
231
+ }
232
+ const env = input;
233
+ return resolveDeleteServerCandidatesFromEnv(
234
+ env,
235
+ asOptionalTrimmedString(envOrPreferred)
236
+ );
237
+ }
238
+ function resolveAuthTokenFromEnv(env, extraEnvKeys = []) {
239
+ for (const key of ["AUTH_TOKEN", "AUTH", "NOLO_MACHINE_API_KEY", ...extraEnvKeys]) {
240
+ const value = env[key];
241
+ if (typeof value === "string" && value.trim()) return value;
242
+ }
243
+ return "";
244
+ }
245
+ function resolveAuthToken(input, envOrExtraEnvKeys, extraEnvKeys = []) {
246
+ if (isCliArgs(input)) {
247
+ const env = envOrExtraEnvKeys ?? {};
248
+ return readOption(input, "--token") || readOption(input, "--machine-key") || resolveAuthTokenFromEnv(env, extraEnvKeys);
249
+ }
250
+ return resolveAuthTokenFromEnv(input, envOrExtraEnvKeys ?? []);
251
+ }
252
+ function parseUserIdFromAuthToken(token) {
253
+ const parts = token.trim().split(".").filter(Boolean);
254
+ const payloadCandidates = parts.length >= 3 ? [parts[1], parts[0]] : [parts[0]];
255
+ for (const payload of payloadCandidates) {
256
+ if (!payload) continue;
257
+ try {
258
+ const parsed = JSON.parse(Buffer.from(payload, "base64").toString("utf8"));
259
+ if (typeof parsed?.userId === "string") return parsed.userId;
260
+ } catch {
261
+ }
262
+ }
263
+ return "";
264
+ }
265
+ function readOption(args, flag) {
266
+ const index = args.indexOf(flag);
267
+ return index >= 0 ? args[index + 1] : void 0;
268
+ }
269
+ function isCompiledBinary() {
270
+ try {
271
+ const url = import.meta.url;
272
+ return url.startsWith("file:///$bunfs/root/") || url.startsWith("/$bunfs/root/");
273
+ } catch {
274
+ return false;
275
+ }
276
+ }
277
+ function resolveCliEntrypointPath(fromModuleUrl = import.meta.url) {
278
+ if (isCompiledBinary()) {
279
+ return getHostRuntimeExecutable();
280
+ }
281
+ const modulePath = fileURLToPath2(fromModuleUrl);
282
+ const sourcePath = existsSync2(modulePath) ? realpathSync2(modulePath) : modulePath;
283
+ const ext = extname2(sourcePath) || ".ts";
284
+ return join2(dirname2(sourcePath), `index${ext}`);
285
+ }
286
+
287
+ export {
288
+ AGENT_RUN_PROTOCOL,
289
+ RuntimeProtocolMismatchError,
290
+ validateAgentRunProtocol,
291
+ RuntimeVersionMismatchError,
292
+ getHostRuntimeExecutable,
293
+ HOST_RUNTIME_CONTENT_IDENTITY,
294
+ initializeHostRuntimeIdentity,
295
+ isAgentRuntimeHostCommand,
296
+ resolveExactRuntimeEntrypoint,
297
+ resolveServerUrlFromEnv,
298
+ resolveServerUrl,
299
+ resolveServerCandidates,
300
+ resolveDeleteServerCandidates,
301
+ resolveAuthTokenFromEnv,
302
+ resolveAuthToken,
303
+ parseUserIdFromAuthToken,
304
+ readOption,
305
+ isCompiledBinary,
306
+ resolveCliEntrypointPath
307
+ };
@@ -0,0 +1,62 @@
1
+ import {
2
+ isPidGone
3
+ } from "./chunk-OWKNSIXL.js";
4
+
5
+ // packages/cli/tui/tuiRestart.ts
6
+ import { realpathSync } from "node:fs";
7
+ import { isAbsolute, resolve } from "node:path";
8
+ function getRestartBlocker(state, checks) {
9
+ if (!checks.supported) return "\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u539F\u5730\u91CD\u542F\u3002";
10
+ if (checks.activeProcesses || checks.activeRuns) return "\u540E\u53F0\u4EFB\u52A1\u4ECD\u5728\u8FD0\u884C\u6216\u72B6\u6001\u672A\u786E\u8BA4\uFF0C\u4E0D\u80FD\u91CD\u542F\uFF1B\u8BF7\u7B49\u5F85\u4EFB\u52A1\u7ED3\u675F\u3002";
11
+ if (state.attachedImages.length || state.attachedDocs.length || state.attachedSkills.length || state.pendingCwdNotice || state.pendingTranscripts?.length || state.pendingChildRunNotices?.length || state.pendingProcessNotices?.length) {
12
+ return "\u6709\u672A\u53D1\u9001\u9644\u4EF6\u6216\u5F85\u5904\u7406\u901A\u77E5\uFF0C\u4E0D\u80FD\u91CD\u542F\uFF1B\u8BF7\u5148\u5904\u7406\u3002";
13
+ }
14
+ return void 0;
15
+ }
16
+ function buildRestartEnv(env, state) {
17
+ return {
18
+ ...env,
19
+ // Override the startup snapshot, including an empty value after revocation.
20
+ // Omitting the key would let the next process inherit stale grants.
21
+ NOLO_PERMISSION_GRANTS: ["local", "remote"].filter((bucket) => state.permissionGrants?.[bucket] === true).join(","),
22
+ NOLO_CWD: state.cwd,
23
+ NOLO_AGENT: state.agentKey,
24
+ NOLO_AGENT_NAME: state.agentName,
25
+ NOLO_SERVER: state.serverUrl,
26
+ NOLO_RUNTIME_MODE: state.runtimeMode,
27
+ NOLO_DIALOG_ID: state.dialogId ?? "",
28
+ NOLO_DIALOG_KEY: state.dialogKey ?? "",
29
+ NOLO_DIALOG: state.dialogLabel,
30
+ NOLO_TUI_RESTART: "1"
31
+ };
32
+ }
33
+ function hasRestartBlockingRuns(records, pidGone = isPidGone) {
34
+ return records.some((run) => run.status === "running" && (typeof run.pid !== "number" || run.pid <= 0 || !pidGone(run.pid)));
35
+ }
36
+ function buildRestartArgv(args) {
37
+ return args.compiled ? [args.executable, "tui"] : [args.executable, ...args.execArgv, args.entrypoint, "tui"];
38
+ }
39
+ function replaceTuiProcess(executable, argv, env, execve = process.execve) {
40
+ try {
41
+ execve(executable, argv, env);
42
+ } catch (error) {
43
+ throw new Error(`\u539F\u5730\u91CD\u542F\u5931\u8D25\uFF1B\u672A\u542F\u52A8\u65B0\u8FDB\u7A0B\u3002\u5BF9\u8BDD ${env.NOLO_DIALOG_ID || "(new)"}\uFF1Bcwd ${env.NOLO_CWD}\uFF1B${String(error)}`, { cause: error });
44
+ }
45
+ }
46
+ function captureRestartExecutable(executable, invocation, lookup = (name) => Bun.which(name), realpath = realpathSync) {
47
+ const candidate = isAbsolute(invocation) ? invocation : invocation.includes("/") ? resolve(invocation) : lookup(invocation);
48
+ try {
49
+ if (candidate && realpath(candidate) === realpath(executable)) return candidate;
50
+ } catch {
51
+ }
52
+ return executable;
53
+ }
54
+
55
+ export {
56
+ getRestartBlocker,
57
+ buildRestartEnv,
58
+ hasRestartBlockingRuns,
59
+ buildRestartArgv,
60
+ replaceTuiProcess,
61
+ captureRestartExecutable
62
+ };
@@ -80,7 +80,7 @@ var MEMORY_USE_GUIDANCE = `--- \u8BB0\u5FC6\u4F7F\u7528\u65B9\u5F0F ---
80
80
  - \u8BB0\u5FC6\u542B\u7528\u6237\u8EAB\u4EFD/\u79F0\u547C/\u5173\u7CFB/\u957F\u671F\u504F\u597D/\u9879\u76EE\u80CC\u666F\u65F6\uFF0C\u76F8\u5173\u5904\u81EA\u7136\u4F53\u73B0\uFF08\u5F00\u573A\u79F0\u547C\u3001\u4E0A\u4E0B\u6587\u786E\u8BA4\u3001\u56DE\u7B54\u7ED3\u6784\u3001\u53D6\u820D\u6807\u51C6\uFF09\uFF0C\u4E0D\u8981\u6BCF\u53E5\u673A\u68B0\u79F0\u547C\u7528\u6237\u3002
81
81
  - \u201C\u4E0A\u6B21/\u7EE7\u7EED/\u8FD9\u4E2A\u9879\u76EE\u201D\u7B49\u6307\u4EE3\u4F18\u5148\u6309\u5F53\u524D dialog/space/project/agent/sourceDialog \u7B49 KV \u8DEF\u5F84\u548C\u65F6\u95F4\u7EBF\u5B9A\u4F4D\uFF0C\u4E0D\u8981\u53EA\u6309\u8BED\u4E49\u76F8\u4F3C\u5EA6\u635E\u4E00\u6761\u3002
82
82
  - \u63A8\u65AD\u578B\u8BB0\u5FC6\uFF08inferred\uFF09\u53EA\u7528\u4E8E\u628A\u63E1\u8BED\u6C14\u3001\u72B6\u6001\u548C\u672A\u5B8C\u6210\u4E8B\u9879\uFF0C\u4E0D\u8981\u8BF4\u6210\u201C\u4F60\u660E\u786E\u544A\u8BC9\u8FC7\u6211\u201D\u6216\u5F53\u6210\u7528\u6237\u5DF2\u6388\u6743\u4FDD\u5B58\u7684\u4E8B\u5B9E\uFF1B\u51B2\u7A81\u6216\u573A\u666F\u4E0D\u660E\u65F6\u8BF4\u660E\u4F9D\u636E\u6216\u7B80\u77ED\u786E\u8BA4\uFF0C\u4E0D\u8981\u786C\u5957\u3002
83
- - \u7F6E\u4FE1\u5EA6\uFF08verified/stated/inferred\uFF09\u3001\u53EC\u56DE\u4E0A\u4E0B\u6587\u8981\u6C42\u4E0E\u964D\u6743/\u5220\u9664\u8FB9\u754C\u4EE5\u8BB0\u5FC6\u5DE5\u5177\uFF08rememberMemory / queryMemory / deleteMemory\uFF09schema \u4E3A\u51C6\u3002
83
+ - \u7F6E\u4FE1\u5EA6\uFF08verified/stated/inferred\uFF09\u3001\u53EC\u56DE\u4E0A\u4E0B\u6587\u8981\u6C42\u4E0E\u5220\u9664\u6743\u9650\u8FB9\u754C\u4EE5\u8BB0\u5FC6\u5DE5\u5177\uFF08rememberMemory / queryMemory / deleteMemory\uFF09schema \u4E3A\u51C6\u3002
84
84
  - \u7528\u6237\u660E\u786E\u8868\u8FBE**\u8DE8\u4F1A\u8BDD**\u7684\u6253\u6270\u5F3A\u5EA6\u504F\u597D\u65F6\uFF08\u5982\u300C\u4EE5\u540E\u90FD\u53EA\u62A5\u7ED3\u679C\u300D\u300C\u6BCF\u6B21\u90FD\u7ED9\u6211\u770B\u8BE6\u7EC6\u8FC7\u7A0B\u300D\uFF0C\u800C\u975E\u4E00\u6B21\u4EFB\u52A1\u91CC\u7684\u300C\u8FD9\u6B21\u522B\u70E6\u6211\u300D\uFF09\uFF0C\u7528 rememberMemory \u8BB0\u4E3A\u7528\u6237\u504F\u597D\uFF1B\u4E4B\u540E\u6309\u5B83\u8C03\u6574 ignore / FYI / important \u7684\u8BE6\u7565\u3002\u8BB0\u5FC6\u504F\u597D\u7EDD\u4E0D\u80FD\u53D6\u6D88 decision / blocked / failed \u4E09\u7C7B\u5FC5\u987B\u62A5\u7684\u5185\u5BB9\u3002`;
85
85
 
86
86
  export {
@@ -206,7 +206,7 @@ async function readDocFunc(args, thunkApi) {
206
206
  throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
207
207
  }
208
208
  try {
209
- const { readAction } = await import("./read-Q7GOHGNP.js");
209
+ const { readAction } = await import("./read-TYMBGEXO.js");
210
210
  const pageData = await readAction({ dbKey: id }, thunkApi);
211
211
  if (!pageData) {
212
212
  throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
@@ -1,9 +1,9 @@
1
- import {
2
- resolvePlatformAuthToken
3
- } from "./chunk-2OLYKYNY.js";
4
1
  import {
5
2
  getCredentialsDir
6
3
  } from "./chunk-G7Y4GXTY.js";
4
+ import {
5
+ resolvePlatformAuthToken
6
+ } from "./chunk-RTHFJZ6M.js";
7
7
 
8
8
  // packages/cli/client/authGuidance.ts
9
9
  import { readdirSync } from "node:fs";