nolo-cli 0.227.0-alpha.1 → 0.228.0-alpha.2

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 (199) hide show
  1. package/{_executeModel-JKQGZ3HU.js → _executeModel-VYCHHZVT.js} +78 -77
  2. package/{action-CK64LS6S.js → action-GDZDXPMB.js} +9 -9
  3. package/{addContentAction-CARFID6E.js → addContentAction-7RO4AMRI.js} +14 -14
  4. package/{addDialogAgentAction-APLZLFW5.js → addDialogAgentAction-EVYBGTXB.js} +16 -16
  5. package/{agentDeleteCommand-NVR2V2HH.js → agentDeleteCommand-QWQKT54A.js} +116 -115
  6. package/{agentEmailCommands-UCVOWD3S.js → agentEmailCommands-EISMBIRE.js} +119 -118
  7. package/{agentFavoriteCommands-4PDOP3GW.js → agentFavoriteCommands-7LOP3HUD.js} +6 -6
  8. package/{agentGrantCommands-FLCEXLUH.js → agentGrantCommands-L6O2HVJI.js} +7 -7
  9. package/{agentListCommands-C65UESYM.js → agentListCommands-4WLG32IW.js} +79 -470
  10. package/{agentMachineCommands-V3DGEJU4.js → agentMachineCommands-DC6NKWTU.js} +59 -57
  11. package/{agentProviderCommands-7QBFRFRK.js → agentProviderCommands-STI3DQ6A.js} +7 -7
  12. package/{agentPullCommand-E6JBGBVG.js → agentPullCommand-KHV4EELF.js} +6 -6
  13. package/{agentRecordCommands-6RCJS2EY.js → agentRecordCommands-IZYUVHME.js} +107 -106
  14. package/{agentRunCommand-P3GRKXKS.js → agentRunCommand-QM7ETUTX.js} +113 -112
  15. package/{agentRunControl-SNZZ5XP4.js → agentRunControl-MBG4U6SL.js} +23 -17
  16. package/{agentRuntimeLocal-GOX2DIY7.js → agentRuntimeLocal-HOXKWCYO.js} +46 -45
  17. package/{agentSlice-N7H2FRJA.js → agentSlice-UG76KEBH.js} +17 -17
  18. package/{appDeleteCommands-LZDN26FU.js → appDeleteCommands-WWCC6WA5.js} +54 -52
  19. package/{appDeployCommands-6IO6TTZH.js → appDeployCommands-AU4IUN33.js} +54 -52
  20. package/{appDeployStatusCommands-FG3LX24J.js → appDeployStatusCommands-STUW7WXL.js} +54 -52
  21. package/{appGetCommands-NAKVDVD4.js → appGetCommands-BGTLIQ4K.js} +54 -52
  22. package/{appListCommands-KL56RN73.js → appListCommands-CUCPRUXW.js} +54 -52
  23. package/{authCommand-AUN5MXV2.js → authCommand-OZ2KTP4Z.js} +30 -31
  24. package/{authCommands-D2IPS6ES.js → authCommands-55OGQGCR.js} +12 -13
  25. package/{builtinSkillRegistry-UQGLKRYP.js → builtinSkillRegistry-BAE2LDXF.js} +4 -4
  26. package/{chromeOpsCommands-UJWN5HWH.js → chromeOpsCommands-WAA45NCS.js} +8 -8
  27. package/{chunk-OB6DVWPF.js → chunk-262R3XNN.js} +16 -2
  28. package/{chunk-UN7HIYMH.js → chunk-2X7WFDT6.js} +1 -1
  29. package/{chunk-XI2BWJM5.js → chunk-324FWHUA.js} +20 -3
  30. package/{chunk-CVERLOJM.js → chunk-3QIYD3VM.js} +639 -513
  31. package/{chunk-RU6DULV4.js → chunk-3U44JB3O.js} +1 -1
  32. package/{chunk-IAJJYHIB.js → chunk-3VZLEKV2.js} +7 -7
  33. package/{chunk-JWXITTQB.js → chunk-42OKN2LI.js} +1 -1
  34. package/{chunk-UAPNPNSG.js → chunk-45CAVC35.js} +1072 -859
  35. package/{chunk-EUCFKKDM.js → chunk-4I2MXV5Q.js} +38 -10
  36. package/{chunk-SW6OD4KE.js → chunk-4QYJPWHH.js} +123 -12
  37. package/{chunk-PLPLH2XZ.js → chunk-4ZGPHFLE.js} +2 -2
  38. package/{chunk-NO3VBWTL.js → chunk-547ENH5T.js} +1 -1
  39. package/{chunk-CKT6QUE2.js → chunk-5YMA6DDZ.js} +1 -1
  40. package/chunk-5ZUOVCKT.js +32 -0
  41. package/{chunk-XZODOEKU.js → chunk-6QHKRARD.js} +2 -2
  42. package/{chunk-YGMBIXCF.js → chunk-6XRPBZRS.js} +4 -2
  43. package/{chunk-PVAWNHP5.js → chunk-7BCG67EI.js} +295 -102
  44. package/{chunk-VZW34YUL.js → chunk-7FEP5USX.js} +8 -5
  45. package/{chunk-VPAZ6BEN.js → chunk-7JGMNKKG.js} +18 -14
  46. package/{chunk-5HL4KC4A.js → chunk-ALAES342.js} +57 -86
  47. package/{chunk-VREDDN25.js → chunk-ATEKLSLR.js} +1 -1
  48. package/chunk-BIDSIRTS.js +307 -0
  49. package/chunk-BIWI5M4E.js +62 -0
  50. package/{chunk-UCFPVYP7.js → chunk-BP5ZJ6B4.js} +1 -1
  51. package/{chunk-2G3YSVO6.js → chunk-CBUZ6DKA.js} +3 -3
  52. package/{chunk-KYH7XW3K.js → chunk-CD3RU7XL.js} +16 -1
  53. package/{chunk-SFTTXGPM.js → chunk-CMMI3DAT.js} +16 -16
  54. package/{chunk-VIHDJ3FK.js → chunk-CNMY2XM6.js} +14 -14
  55. package/{chunk-UVUVQVZ6.js → chunk-DBUR22G5.js} +2 -2
  56. package/{chunk-G6HJUMST.js → chunk-DEA37IUY.js} +2 -2
  57. package/{chunk-5RKRXQ2H.js → chunk-DGYCDA6W.js} +2 -2
  58. package/{chunk-FKEZOMIF.js → chunk-DLXMMTGM.js} +523 -202
  59. package/{chunk-3HTP4WZQ.js → chunk-DUUDXSLX.js} +21 -7
  60. package/{chunk-KFHREHUQ.js → chunk-DXWGFL2Z.js} +89 -1
  61. package/{chunk-TOKPHZ55.js → chunk-EEOOBRA7.js} +5 -5
  62. package/{chunk-ZI5SZ3MV.js → chunk-EGHP7KOY.js} +20 -20
  63. package/{chunk-OXA5GWHU.js → chunk-F6Z6ZCUV.js} +2 -2
  64. package/{chunk-X2KRQP7V.js → chunk-FJSNBZXR.js} +1 -1
  65. package/{chunk-3VFYQH3I.js → chunk-FPBJM2BW.js} +17 -39
  66. package/{chunk-KRRE4A7D.js → chunk-G7IUT2V3.js} +3 -2
  67. package/{chunk-LXTC53TN.js → chunk-GAYNXB6T.js} +184 -153
  68. package/{chunk-45LZIYXB.js → chunk-HBRDSQ3M.js} +1 -1
  69. package/{chunk-GRXSJR2Z.js → chunk-HF7BLF3F.js} +21 -21
  70. package/{chunk-T5N6NHAT.js → chunk-HHFGE2WF.js} +3 -3
  71. package/{chunk-IX2BXN2K.js → chunk-HSSBDZLD.js} +3 -3
  72. package/{chunk-TINJKQSO.js → chunk-HXB4VDGK.js} +20 -20
  73. package/{chunk-MWHOH4RJ.js → chunk-HYLRQDEE.js} +4 -4
  74. package/{chunk-L5I543VB.js → chunk-JQZRSXS5.js} +23 -23
  75. package/{chunk-T2BEPTAG.js → chunk-L32W3PRP.js} +47 -17
  76. package/{chunk-LA7JYAKF.js → chunk-LYD6C7OU.js} +3 -3
  77. package/{chunk-PHOSZT3E.js → chunk-M3OZRQNH.js} +1 -1
  78. package/{chunk-M3Y4IBIR.js → chunk-M4SFKP5L.js} +4 -4
  79. package/{chunk-7Z3WUZ4Q.js → chunk-MJI3UAXN.js} +52 -28
  80. package/{chunk-YOT437BH.js → chunk-MNEZUL5S.js} +137 -118
  81. package/{chunk-GOLPOTG5.js → chunk-MZG5CETE.js} +3 -3
  82. package/{chunk-KJAAPGBE.js → chunk-OBIC6EG7.js} +6 -6
  83. package/{chunk-CLCXHIBS.js → chunk-OJ45MEEI.js} +1 -1
  84. package/{chunk-AXYH4734.js → chunk-OOJNQK6V.js} +13 -13
  85. package/{chunk-2SKTCNWO.js → chunk-OTKSESZR.js} +2 -2
  86. package/{chunk-XIEYGCN6.js → chunk-OWKNSIXL.js} +149 -48
  87. package/{chunk-6XIE5ZGI.js → chunk-PDCV7P5W.js} +1 -1
  88. package/{chunk-HOCHUZQ7.js → chunk-QJTZ76CP.js} +24 -6
  89. package/{chunk-YQETUZ5V.js → chunk-QRGDJA4B.js} +11 -11
  90. package/{chunk-ULAQPRHX.js → chunk-QYB23WUH.js} +1 -1
  91. package/{chunk-CSW7IPVD.js → chunk-R6Z5S5GA.js} +11 -11
  92. package/{chunk-MK2Q7ZJD.js → chunk-R7XWZDOH.js} +58 -24
  93. package/{chunk-GUVXQSFZ.js → chunk-RBPUNSG5.js} +1 -1
  94. package/{chunk-GOQ6ZVTN.js → chunk-RG2DGNL6.js} +3 -3
  95. package/{chunk-F5AY2UZL.js → chunk-RRDRQOEC.js} +515 -9
  96. package/{chunk-6EDAMVG6.js → chunk-RTHFJZ6M.js} +10 -10
  97. package/{chunk-WJP4TH6U.js → chunk-S6FDXXZV.js} +1 -1
  98. package/{chunk-LJSNEV7M.js → chunk-SRCCSTIM.js} +7 -7
  99. package/{chunk-KMRKZNGT.js → chunk-TCZ2VJZQ.js} +13 -12
  100. package/{chunk-AK5O76CC.js → chunk-TI2EPRHE.js} +2 -2
  101. package/{chunk-5LQDHFBN.js → chunk-TQEKUOTI.js} +14 -11
  102. package/{chunk-SRG5CNLC.js → chunk-TSPMLCWI.js} +6 -6
  103. package/{chunk-YGILMZ7N.js → chunk-TUSTONB3.js} +1 -1
  104. package/{chunk-YPPKC6FL.js → chunk-U2HBB7RS.js} +17 -17
  105. package/{chunk-HVUDBOQG.js → chunk-VMJVAJ6W.js} +9 -6
  106. package/{chunk-CQVGR3MX.js → chunk-VQ5N5GSV.js} +8 -8
  107. package/{chunk-ABGULE7H.js → chunk-WCFFRBL5.js} +12 -12
  108. package/{chunk-NAOO4PVX.js → chunk-WFDNADFX.js} +16 -16
  109. package/chunk-WFGNWWJI.js +326 -0
  110. package/{chunk-FIYSMXHY.js → chunk-WWTSEBDF.js} +1 -1
  111. package/{chunk-JHF6VLVL.js → chunk-X3E6EHJW.js} +32 -31
  112. package/{chunk-E2BESSAW.js → chunk-X4O7FJF5.js} +2 -0
  113. package/{chunk-C2B7M567.js → chunk-XAG3FWBE.js} +15 -4
  114. package/{chunk-4OKTPFNX.js → chunk-XFXFPUO7.js} +105 -37
  115. package/{chunk-HYKGIXNO.js → chunk-XSW4EXQV.js} +85 -21
  116. package/{chunk-ZADGPNTV.js → chunk-XTJKU3Z4.js} +29 -29
  117. package/{chunk-T43K75CK.js → chunk-YKY4OVOX.js} +15 -15
  118. package/{chunk-ZYA2YDB6.js → chunk-YVFH2MFB.js} +16 -16
  119. package/{chunk-L42CBKBZ.js → chunk-ZEVQHCLM.js} +3 -3
  120. package/{chunk-5RKUPJYL.js → chunk-ZH3KXFHS.js} +11 -3
  121. package/chunk-ZOHO6MOF.js +376 -0
  122. package/{chunk-PXKF5CV4.js → chunk-ZXF6D3I6.js} +10 -8
  123. package/{cliAgentConfigHelpers-QVSQYTKC.js → cliAgentConfigHelpers-BTRHMPW2.js} +14 -14
  124. package/{cliEnvHelpers-D6HMC46Z.js → cliEnvHelpers-CNMP3RDX.js} +2 -2
  125. package/{cliExecutor-4MAX3PZL.js → cliExecutor-K6FDZTQ2.js} +3 -1
  126. package/{cliLocalAgentRecordReader-SPKAJYME.js → cliLocalAgentRecordReader-H3HYQRRR.js} +48 -47
  127. package/{commandRegistry-TKR6OWXP.js → commandRegistry-FVYPE2IN.js} +93 -93
  128. package/{contentThunks-BQWRPCTM.js → contentThunks-GNFPG32S.js} +36 -35
  129. package/{cooldownCommands-FZYQOWI5.js → cooldownCommands-YB5H5BBK.js} +3 -3
  130. package/{createAgentAutomationAction-GFI6SJZV.js → createAgentAutomationAction-PB4QIFQ4.js} +36 -35
  131. package/{createDialogAction-MMBIHFFU.js → createDialogAction-EVTOPY7A.js} +37 -37
  132. package/{createPageAction-EEYUE5FB.js → createPageAction-2UYF2IDZ.js} +39 -38
  133. package/{db-CS4ZJQKV.js → db-M7FU2GNK.js} +9 -6
  134. package/{dbSlice-X4Z4E4QU.js → dbSlice-XRUZOGSU.js} +13 -13
  135. package/{deleteFile-QOOP2UK7.js → deleteFile-6URDHYRB.js} +9 -9
  136. package/{dialogCommands-OXBQ73DD.js → dialogCommands-6SZD4TYP.js} +58 -57
  137. package/{dialogNotifyCommand-VWS5G4OO.js → dialogNotifyCommand-SHGPCU22.js} +17 -17
  138. package/{dialogSlice-KGYIABDY.js → dialogSlice-5EQ2A6LY.js} +34 -33
  139. package/{dialogUsageCommand-FEWCN7IA.js → dialogUsageCommand-W2WCSGKF.js} +6 -6
  140. package/{docCreateCommands-LS32VKY3.js → docCreateCommands-25E6PGN3.js} +53 -51
  141. package/{docDeleteCommands-JTYR5RPH.js → docDeleteCommands-F7ZVGEHW.js} +55 -53
  142. package/{docReadCommands-E5LTVKWN.js → docReadCommands-JY2E5XEN.js} +53 -51
  143. package/{docStore-TVS2FNER.js → docStore-OKKIKLT3.js} +15 -15
  144. package/{docUpdateCommands-I3J3JDZ2.js → docUpdateCommands-OZ4CUSIQ.js} +53 -51
  145. package/{fetchMessages-Q3INLN5F.js → fetchMessages-TQEUZD7H.js} +3 -3
  146. package/{getPricing-VNGFM4PN.js → getPricing-LF5C4XSI.js} +6 -6
  147. package/{handleSendMessageAction-SSON36TJ.js → handleSendMessageAction-LNT7SZND.js} +68 -67
  148. package/{hostCredentialCreate-WTW4THJF.js → hostCredentialCreate-XUU2CSHI.js} +107 -106
  149. package/index.js +54 -16
  150. package/keys-RWF7UCB4.js +1 -1
  151. package/{localDialogRead-V36DX2Q2.js → localDialogRead-CCOCVGAP.js} +2 -2
  152. package/{localRuntimeAdapter-MI2JGXSF.js → localRuntimeAdapter-IBSTMSX7.js} +114 -113
  153. package/{machineCommands-3LROJZDK.js → machineCommands-HSQHDHOT.js} +135 -119
  154. package/{machineWsRunDispatch-BUUJRUUB.js → machineWsRunDispatch-L6H7J66T.js} +105 -104
  155. package/{memberThunks-CFEPHAND.js → memberThunks-7Y3OYSJQ.js} +17 -17
  156. package/{memoryCommands-JQMEJO7J.js → memoryCommands-BC6REPQB.js} +6 -6
  157. package/{overlay-THLKYIWY.js → overlay-BBQZXGYI.js} +5 -3
  158. package/package.json +1 -1
  159. package/{projectArchive-3X54XFVN.js → projectArchive-FQO654Z3.js} +44 -43
  160. package/{providerPresetApply-FO36N5TX.js → providerPresetApply-WHAMP2D5.js} +9 -9
  161. package/{providerRegistry-U2BSFE6K.js → providerRegistry-ZI2KORJ7.js} +9 -9
  162. package/{read-KA3L2V7O.js → read-TYMBGEXO.js} +9 -9
  163. package/{readDocTool-AMAZAPAW.js → readDocTool-SKQVHBLO.js} +1 -1
  164. package/{readlineWorkspace-Z3YUH4SX.js → readlineWorkspace-7U272DSA.js} +4398 -4165
  165. package/{removeDialogAgentAction-JQOJSUM7.js → removeDialogAgentAction-F5QE2O2B.js} +19 -19
  166. package/{runAgentClientLoop-4FCFLMDJ.js → runAgentClientLoop-AF4JQIJ7.js} +72 -71
  167. package/{runtimeDoctorCommands-CXOCVDPU.js → runtimeDoctorCommands-RRKPBGVO.js} +16 -16
  168. package/{secretCommands-GGUAWAE7.js → secretCommands-KZWBZIYS.js} +2 -2
  169. package/{setDialogExtraReferencesAction-YXQTGXIN.js → setDialogExtraReferencesAction-72L27ERM.js} +15 -15
  170. package/{setPrimaryDialogAgentAction-YNLB66WE.js → setPrimaryDialogAgentAction-GJJDUSGJ.js} +19 -19
  171. package/{settingThunks-E6N7RSSS.js → settingThunks-ZRGWVGZD.js} +18 -18
  172. package/{skillDiscovery-B5V23AXP.js → skillDiscovery-BHHPCUHZ.js} +3 -3
  173. package/{spaceCommands-DB5DKC2J.js → spaceCommands-5VNWMDBE.js} +55 -53
  174. package/{store-JRVN62NM.js → store-Z53ICFL3.js} +3 -1
  175. package/{streamAgentChatTurn-FCBGMD4D.js → streamAgentChatTurn-YSPEFY4K.js} +97 -95
  176. package/{switchDialogAgentAction-LAHLUECU.js → switchDialogAgentAction-IIJBPND3.js} +16 -16
  177. package/{tableCommands-VNSXHAMG.js → tableCommands-FTAOCBTX.js} +12 -12
  178. package/{tools-6JD36D6K.js → tools-M35PTIFB.js} +61 -60
  179. package/tuiRestart-2IL37YIB.js +41 -0
  180. package/{tuiSummaryLlmCaller-UHZIPGAX.js → tuiSummaryLlmCaller-W2QN4VAC.js} +21 -21
  181. package/{updateCommands-KZ54HCU5.js → updateCommands-CPATDG6J.js} +8 -6
  182. package/{updateDialogTitleAction-RV3EUEN3.js → updateDialogTitleAction-IMIRJRQQ.js} +36 -35
  183. package/{usageCommand-KFVV6UL3.js → usageCommand-2BF74MKF.js} +2 -2
  184. package/{usageRebuildCommand-HHFSNK46.js → usageRebuildCommand-UHB55BQM.js} +3 -3
  185. package/{windowsSelfUpdate-KERHIAB4.js → windowsSelfUpdate-ZFD6J5HF.js} +2 -2
  186. package/chunk-2WZXXAQD.js +0 -57
  187. package/chunk-BJF2MHJ3.js +0 -118
  188. package/chunk-KEPOVMF4.js +0 -91
  189. package/chunk-PMDVQBGA.js +0 -100
  190. package/chunk-WACI5I6V.js +0 -147
  191. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +4 -4
  192. package/{chunk-AGP3YSEC.js → chunk-4N6G2CKP.js} +3 -3
  193. package/{chunk-VXL2FZTP.js → chunk-HXER7YJF.js} +3 -3
  194. package/{chunk-BLVSFYQ3.js → chunk-LISC7BD4.js} +3 -3
  195. package/{chunk-SSGTV4FC.js → chunk-USGHJSGO.js} +5 -5
  196. package/{chunk-IC2I373Q.js → chunk-VS276URX.js} +3 -3
  197. package/{chunk-AETZ7AD6.js → chunk-W6RFEDN4.js} +3 -3
  198. package/{offlineMarxistsAgentCommand-AGA2X5E4.js → offlineMarxistsAgentCommand-XVXUE6G5.js} +5 -5
  199. package/{workloadLifecycle-O2I3NZ2Q.js → workloadLifecycle-HFJIN5IZ.js} +8 -8
@@ -1,13 +1,13 @@
1
+ import {
2
+ deriveCredentialGroup
3
+ } from "./chunk-RRDRQOEC.js";
1
4
  import {
2
5
  listUserRecordsFromServers,
3
6
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-PHOSZT3E.js";
7
+ } from "./chunk-M3OZRQNH.js";
5
8
  import {
6
9
  agentRecordHasConfiguredCredential
7
- } from "./chunk-5LQDHFBN.js";
8
- import {
9
- deriveCredentialGroup
10
- } from "./chunk-F5AY2UZL.js";
10
+ } from "./chunk-TQEKUOTI.js";
11
11
  import {
12
12
  isTombstoneRecord
13
13
  } from "./chunk-BV3FLP2L.js";
@@ -110,6 +110,9 @@ function parseAgentListArgs(args) {
110
110
  // --verbose 拿回完整字段集排障。
111
111
  verbose: args.includes("--verbose"),
112
112
  compact: args.includes("--compact"),
113
+ fragmentOffset: readArgValue(args, "--fragment-offset"),
114
+ fragmentAgentKey: readArgValue(args, "--fragment-agent-key"),
115
+ fragmentDigest: readArgValue(args, "--fragment-digest"),
113
116
  limit: readArgValue(args, "--limit") ?? void 0,
114
117
  offset: readArgValue(args, "--offset") ?? void 0
115
118
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-6EDAMVG6.js";
3
+ } from "./chunk-RTHFJZ6M.js";
4
4
  import {
5
5
  toErrorMessage
6
6
  } from "./chunk-HNMXYYJR.js";
@@ -14,7 +14,13 @@ import {
14
14
  qwenTokenPlanModels,
15
15
  stepfunModels,
16
16
  stepfunStepPlanModels
17
- } from "./chunk-KYH7XW3K.js";
17
+ } from "./chunk-CD3RU7XL.js";
18
+ import {
19
+ asOptionalFiniteNumber
20
+ } from "./chunk-WWC7I6TA.js";
21
+ import {
22
+ asOptionalTrimmedString
23
+ } from "./chunk-G3SUCT4W.js";
18
24
  import {
19
25
  PLATFORM_HOSTED_DEEPSEEK_FLASH_OFF_PEAK_PRICE,
20
26
  PLATFORM_HOSTED_DEEPSEEK_FLASH_PEAK_PRICE,
@@ -24,12 +30,6 @@ import {
24
30
  import {
25
31
  asTrimmedLowercaseString
26
32
  } from "./chunk-QSJ3HFEF.js";
27
- import {
28
- asOptionalFiniteNumber
29
- } from "./chunk-WWC7I6TA.js";
30
- import {
31
- asOptionalTrimmedString
32
- } from "./chunk-G3SUCT4W.js";
33
33
 
34
34
  // packages/agent-runtime/antigravityOAuth.ts
35
35
  var decodeBase64 = (s) => typeof Buffer !== "undefined" ? Buffer.from(s, "base64").toString("utf8") : typeof atob === "function" ? atob(s) : s;
@@ -301,11 +301,11 @@ var KIMI_CODE_MODEL_OPTIONS = kimiCodeModels.map((m, i) => ({
301
301
  hasVision: m.hasVision,
302
302
  ...i === 0 ? { recommended: true } : {}
303
303
  }));
304
- var OPENCODE_GO_MODEL_OPTIONS = opencodeGoModels.map((m, i) => ({
304
+ var OPENCODE_GO_MODEL_OPTIONS = opencodeGoModels.map((m) => ({
305
305
  id: m.name,
306
306
  label: m.displayName ?? m.name,
307
307
  hasVision: m.hasVision,
308
- ...i === 0 ? { recommended: true } : {}
308
+ ...m.name === "deepseek-v4.1-flash" ? { recommended: true } : {}
309
309
  }));
310
310
  var COMMAND_CODE_MODEL_OPTIONS = commandCodeModels.map((m, i) => ({
311
311
  id: m.name,
@@ -417,6 +417,10 @@ var SUBSCRIPTION_OAUTH_PROVIDERS = [
417
417
  // 非 Ultra 账号 discovery 返回 gemini-4-argon-disabled,选中后调用 404。标签明示门槛,
418
418
  // 让不具备资格的 Antigravity 用户不会误选;3.1 Pro 保留为所有档位可用的回退。
419
419
  { id: "gemini-4-argon", label: "Gemini 4 Argon\uFF08\u9700 Ultra\uFF09", hasVision: true },
420
+ // Exact wire IDs observed in Antigravity discovery with supportsImages=true.
421
+ { id: "gemini-4-hydrogen-medium", label: "Gemini 4 Hydrogen Medium", hasVision: true },
422
+ { id: "claude-opus-5-5-medium", label: "Claude Opus 5.5 Medium", hasVision: true },
423
+ { id: "claude-sonnet-5-5-high", label: "Claude Sonnet 5.5 High", hasVision: true },
420
424
  { id: "gemini-3.1-pro", label: "Gemini 3.1 Pro", hasVision: true },
421
425
  { id: "gemini-2.5-pro", label: "Gemini 2.5 Pro", hasVision: true },
422
426
  { id: "claude-sonnet-5", label: "Claude Sonnet 5", hasVision: true },
@@ -594,7 +598,7 @@ var CUSTOM_API_KEY_TEMPLATES = [
594
598
  description: "OpenCode Go \u8BA2\u9605\uFF08$5 \u9996\u6708 / $10 \u6708\uFF0C\u805A\u5408 Grok/Kimi/Qwen/GLM/MiMo/MiniMax/DeepSeek\uFF09",
595
599
  provider: "opencode-go",
596
600
  baseUrl: "https://opencode.ai/zen/go/v1",
597
- defaultModel: "qwen3.8-max",
601
+ defaultModel: "deepseek-v4.1-flash",
598
602
  modelOptions: OPENCODE_GO_MODEL_OPTIONS,
599
603
  commercialKind: "subscription",
600
604
  accessVariant: "token_plan_endpoint"
@@ -696,12 +700,12 @@ var CUSTOM_API_KEY_TEMPLATES = [
696
700
  description: "open-design.ai \u805A\u5408\u8BA2\u9605\uFF08\u4E00\u4E2A Key \u805A\u5408 GPT/Claude/DeepSeek/GLM/Kimi/MiMo\uFF0COpenAI \u517C\u5BB9\uFF09",
697
701
  provider: "opendesign",
698
702
  baseUrl: "https://amr-link.open-design.ai/v1",
699
- defaultModel: "gpt-6-luna",
703
+ defaultModel: "deepseek-v4.1-flash",
700
704
  modelOptions: [
701
- { id: "gpt-6-luna", label: "GPT-6 Luna", hasVision: true, recommended: true },
705
+ { id: "gpt-6-luna", label: "GPT-6 Luna", hasVision: true },
702
706
  { id: "claude-haiku-5.5", label: "Claude Haiku 5.5", hasVision: true },
703
707
  { id: "deepseek-v4-pro", label: "DeepSeek V4 Pro" },
704
- { id: "deepseek-v4.1-flash", label: "DeepSeek V4.1 Flash", hasVision: true },
708
+ { id: "deepseek-v4.1-flash", label: "DeepSeek V4.1 Flash", hasVision: true, recommended: true },
705
709
  { id: "deepseek-v4-flash", label: "DeepSeek V4 Flash" },
706
710
  { id: "deepseek-v4-flash-vision-exp", label: "DeepSeek V4 Flash Vision Exp", hasVision: true },
707
711
  { id: "glm-5.3-flashx", label: "GLM 5.3 FlashX", hasVision: true },
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  isCompiledBinary
3
- } from "./chunk-WACI5I6V.js";
3
+ } from "./chunk-BIDSIRTS.js";
4
4
  import {
5
5
  DEFAULT_NOLO_SERVER_URL
6
6
  } from "./chunk-OLZBQWZU.js";
7
- import {
8
- normalizeServerOrigin
9
- } from "./chunk-CF7PE763.js";
10
7
  import {
11
8
  loadProfileConfig
12
9
  } from "./chunk-R5GO3YZP.js";
@@ -15,19 +12,22 @@ import {
15
12
  } from "./chunk-4O22PGNQ.js";
16
13
  import {
17
14
  scheduleWindowsSelfUpdate
18
- } from "./chunk-5RKUPJYL.js";
15
+ } from "./chunk-ZH3KXFHS.js";
19
16
  import {
20
17
  t
21
- } from "./chunk-OB6DVWPF.js";
18
+ } from "./chunk-262R3XNN.js";
19
+ import {
20
+ normalizeServerOrigin
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";
@@ -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
+ };