nolo-cli 0.153.2 → 0.154.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 (136) hide show
  1. package/{_executeModel-7PZNF3KM.js → _executeModel-3HHZYHHB.js} +44 -42
  2. package/accountResolver-55EDKEIK.js +1 -1
  3. package/action-GPPJC5TI.js +1 -1
  4. package/{addContentAction-BI6RDRTQ.js → addContentAction-XJQEJ4XW.js} +6 -6
  5. package/{addDialogAgentAction-4RJYUSIK.js → addDialogAgentAction-5WZX5CAY.js} +5 -5
  6. package/{agentDeleteCommand-52SBFMA4.js → agentDeleteCommand-ON2KVSJ5.js} +60 -60
  7. package/{agentEmailCommands-FLTHAK4Y.js → agentEmailCommands-2QPD5VP3.js} +63 -63
  8. package/{agentListCommands-LKFRVROH.js → agentListCommands-L33M3I6V.js} +33 -33
  9. package/{agentMachineCommands-V3E6STQ6.js → agentMachineCommands-V44DPSED.js} +30 -28
  10. package/{agentProviderCommands-MKG2OOEY.js → agentProviderCommands-CXBHNONN.js} +5 -5
  11. package/{agentPullCommand-FA43RBRU.js → agentPullCommand-GXXEDOSA.js} +4 -4
  12. package/{agentRecordCommands-KAOY56RD.js → agentRecordCommands-CKILCNQZ.js} +57 -57
  13. package/{agentRunCommand-FXAN65RN.js → agentRunCommand-6IN7NK7H.js} +59 -59
  14. package/{agentRunControl-2C5GM3BW.js → agentRunControl-XBSNHHZE.js} +7 -7
  15. package/{agentRuntimeLocal-V4URZOQL.js → agentRuntimeLocal-XCKO5FVP.js} +20 -18
  16. package/{agentSlice-LAV5TJXT.js → agentSlice-YT3VCCEW.js} +6 -6
  17. package/{appDeleteCommands-7EZRTNIP.js → appDeleteCommands-2PJFNLAJ.js} +28 -26
  18. package/{appDeployCommands-3U6MEES7.js → appDeployCommands-AZCMCMK6.js} +28 -26
  19. package/{appDeployStatusCommands-TAC6BYC6.js → appDeployStatusCommands-HSIKPVJN.js} +28 -26
  20. package/{appGetCommands-MFNPLXGO.js → appGetCommands-IUZCPAP7.js} +28 -26
  21. package/{appListCommands-QVZAUEUU.js → appListCommands-JLFVS44M.js} +28 -26
  22. package/{authCommand-NIV3DKPF.js → authCommand-3Z52KJID.js} +19 -19
  23. package/{authCommands-AMNIAKEG.js → authCommands-QOCKVPX3.js} +5 -5
  24. package/{builtinSkillRegistry-H3AY27TR.js → builtinSkillRegistry-LJV7FHNI.js} +4 -4
  25. package/{chunk-4RJJDA57.js → chunk-2ODX2C4E.js} +154 -30
  26. package/{chunk-UCLSOLX4.js → chunk-2XDQAWBM.js} +12 -12
  27. package/{chunk-XJOBYJWN.js → chunk-2ZYCNT2O.js} +72 -33
  28. package/{chunk-YIIQNHJW.js → chunk-3GTVM7NJ.js} +19 -19
  29. package/{chunk-US6MKPE7.js → chunk-3L5MSPWX.js} +1 -1
  30. package/{chunk-SGJRNVYF.js → chunk-4L4K6YR7.js} +16 -2
  31. package/{chunk-P5QACQDK.js → chunk-62TBKWTV.js} +1 -1
  32. package/{chunk-TRW43TSC.js → chunk-6EQD4AQL.js} +41 -1
  33. package/{chunk-YLMMECCH.js → chunk-6XIE5ZGI.js} +1 -1
  34. package/{chunk-J2ATF74A.js → chunk-BAWAKW7X.js} +1 -1
  35. package/{chunk-ZVQHBIWV.js → chunk-CDLP56BS.js} +7 -7
  36. package/{chunk-JPJGMOIM.js → chunk-DD2EOI6S.js} +1 -1
  37. package/{chunk-OON4OBWI.js → chunk-DLV3H464.js} +7 -7
  38. package/{chunk-RWSOTHY4.js → chunk-DT7EWFTY.js} +5 -5
  39. package/{chunk-IRTOYSA2.js → chunk-ESMZW5PE.js} +1 -1
  40. package/{chunk-V6P4AYYJ.js → chunk-EVPKKBSI.js} +13 -13
  41. package/{chunk-HB4XPBC7.js → chunk-EWO77ZGF.js} +9 -11
  42. package/{chunk-KJ7MT3UC.js → chunk-F3SOW2EU.js} +81 -1
  43. package/{chunk-T64RZQBO.js → chunk-F5WASHQA.js} +247 -132
  44. package/{chunk-WUGRUG5Z.js → chunk-FB5WLEOD.js} +12 -12
  45. package/{chunk-SOEJSA7I.js → chunk-FCUKCVKN.js} +4 -4
  46. package/{chunk-FY4SDK2E.js → chunk-FDLDMJTM.js} +1 -1
  47. package/{chunk-ICRRXBRN.js → chunk-FFHV45HO.js} +3 -3
  48. package/{chunk-BUCB3RT4.js → chunk-FZYKQFBQ.js} +3 -3
  49. package/{chunk-IE5PXKVU.js → chunk-G3VYRPTV.js} +5 -5
  50. package/{chunk-3CHPRXKY.js → chunk-HW7EBEC5.js} +26 -194
  51. package/{chunk-UFYBYB26.js → chunk-I7S63QUU.js} +1 -1
  52. package/{chunk-CON6SI7N.js → chunk-IF7V3CBU.js} +1 -1
  53. package/{chunk-RAEBIT7A.js → chunk-JDKSYQQN.js} +4 -4
  54. package/{chunk-K43ZF2C3.js → chunk-JPPQ3GUO.js} +1 -1
  55. package/{chunk-QJJQZ4EK.js → chunk-JSB2OPQT.js} +115 -119
  56. package/{chunk-M2P3OGXZ.js → chunk-JWEXJ573.js} +2 -2
  57. package/{chunk-7G4KH3C4.js → chunk-K25WQPP3.js} +220 -54
  58. package/{chunk-ZEY4NJRE.js → chunk-KABQ74UQ.js} +4 -4
  59. package/{chunk-3C2QLERX.js → chunk-KMDDG73K.js} +1 -1
  60. package/{chunk-SPKLALBU.js → chunk-MAYW6V3E.js} +1 -1
  61. package/{chunk-IPAW7XLD.js → chunk-MFVOJ6KF.js} +2 -2
  62. package/{chunk-NDZOXXIM.js → chunk-NHEWV5FD.js} +1 -1
  63. package/{chunk-QPY264HO.js → chunk-O2IWR23M.js} +1 -1
  64. package/{chunk-TFPOD4YZ.js → chunk-OLVOR45M.js} +2 -2
  65. package/{chunk-SUKSWFLP.js → chunk-PIG2IUVZ.js} +1 -1
  66. package/{chunk-AAMWEIEP.js → chunk-QA2C5NKI.js} +3 -3
  67. package/{chunk-3WIXU4XO.js → chunk-QI2WVWXV.js} +13 -1
  68. package/{chunk-VSJIIKGY.js → chunk-QXZH5UDF.js} +3 -3
  69. package/{chunk-SQ73U3BG.js → chunk-QZIOZDM6.js} +9 -9
  70. package/{chunk-MJ54WBLO.js → chunk-R2KWTENX.js} +3 -3
  71. package/{chunk-C3OK72G3.js → chunk-RIHQGFFA.js} +1 -1
  72. package/{chunk-DC3SZCRR.js → chunk-SH3XD4E2.js} +2 -2
  73. package/{chunk-MM3662RS.js → chunk-SNAWGDXT.js} +263 -4
  74. package/{chunk-JGRPBIZZ.js → chunk-SQX235S2.js} +1 -1
  75. package/chunk-TT644UJD.js +188 -0
  76. package/{chunk-IYBIRCQV.js → chunk-U34KT53V.js} +29 -11
  77. package/{chunk-ZJZGF77K.js → chunk-ULQAD7ZY.js} +18 -43
  78. package/{chunk-DJKBZYMR.js → chunk-UY73HNIN.js} +53 -49
  79. package/{chunk-I2RMFLLH.js → chunk-V7PCFWX3.js} +1 -1
  80. package/{chunk-KLA62VVE.js → chunk-VXS4YYJ2.js} +8 -8
  81. package/{chunk-JZX2XLKC.js → chunk-YCRROBDY.js} +1 -1
  82. package/{chunk-C5A3GWRG.js → chunk-YR47Y7CN.js} +6 -6
  83. package/{chunk-AXYXKGPN.js → chunk-ZAV4YVEA.js} +1 -1
  84. package/{chunk-YANF2RR4.js → chunk-ZPKUJROL.js} +1 -1
  85. package/{chunk-AWY25K65.js → chunk-ZSLIYVIQ.js} +7 -7
  86. package/{commandRegistry-BZGZP4AW.js → commandRegistry-4LWXIPNX.js} +83 -83
  87. package/{contentThunks-56AWRCC4.js → contentThunks-QBL5NK2W.js} +17 -17
  88. package/{createAgentAutomationAction-W5D4IHHK.js → createAgentAutomationAction-5UWBLR2N.js} +17 -17
  89. package/{createDialogAction-YMU646CH.js → createDialogAction-NJ2LE7KC.js} +21 -21
  90. package/{createPageAction-T4WRPDOH.js → createPageAction-7T3RINS2.js} +19 -19
  91. package/{dbSlice-DC2J53RC.js → dbSlice-6PVPY44C.js} +5 -5
  92. package/{deleteFile-KYWEMNFX.js → deleteFile-YM6NDPAR.js} +3 -3
  93. package/{dialogCommands-3T3LM566.js → dialogCommands-KMECTGCW.js} +30 -28
  94. package/{dialogSlice-Z5KOY4CC.js → dialogSlice-GQMTD4HR.js} +16 -16
  95. package/{docCreateCommands-OLNS64OJ.js → docCreateCommands-4IT5PUAL.js} +30 -28
  96. package/{docDeleteCommands-U4UOLXZQ.js → docDeleteCommands-QS66YNZV.js} +31 -29
  97. package/{docReadCommands-WUYVWGOH.js → docReadCommands-3SAI46YC.js} +30 -28
  98. package/{docStore-2EN5A7PW.js → docStore-PM5PYKPZ.js} +6 -6
  99. package/{docUpdateCommands-RKVB6XAQ.js → docUpdateCommands-OGYG5BRC.js} +30 -28
  100. package/{getPricing-TX35D7PI.js → getPricing-XQ3N3RBP.js} +2 -2
  101. package/{handleSendMessageAction-EF3LOTXW.js → handleSendMessageAction-EQ3U6K5N.js} +35 -31
  102. package/index.js +7 -7
  103. package/{localRuntimeAdapter-OAHN57AM.js → localRuntimeAdapter-MO64KEOS.js} +53 -53
  104. package/{localRuntimeAuthority-JDAD7CB6.js → localRuntimeAuthority-BPN5OAQG.js} +2 -2
  105. package/{localRuntimeDb-CVC62PM5.js → localRuntimeDb-QIVAXMUL.js} +1 -1
  106. package/{machineCommands-RTYX5UN3.js → machineCommands-7MBJJY4K.js} +60 -60
  107. package/{machineWsRunDispatch-ELDKKIHF.js → machineWsRunDispatch-T4LFRJL3.js} +55 -55
  108. package/{memberThunks-2DWKLE6W.js → memberThunks-AZINUM4S.js} +8 -8
  109. package/package.json +1 -1
  110. package/{providerPresetApply-GSJI4JBJ.js → providerPresetApply-PKUOHQJT.js} +5 -5
  111. package/{providerRegistry-TSSTPGWF.js → providerRegistry-HNQLIFN2.js} +5 -5
  112. package/{read-L7QEJETH.js → read-7JPIWRBQ.js} +3 -3
  113. package/{readDocTool-QELXV2GW.js → readDocTool-AAQTB2Y3.js} +1 -1
  114. package/{readlineWorkspace-BUEUGN7D.js → readlineWorkspace-2DR5GHLQ.js} +92 -126
  115. package/{removeDialogAgentAction-376XSUP2.js → removeDialogAgentAction-RMVRILLK.js} +6 -6
  116. package/{runAgentClientLoop-BDN5VYZN.js → runAgentClientLoop-EXIQDX7G.js} +42 -40
  117. package/{runtimeDoctorCommands-56NWKNON.js → runtimeDoctorCommands-MMCP4B4U.js} +12 -12
  118. package/{setDialogExtraReferencesAction-QBDSH63D.js → setDialogExtraReferencesAction-L3V7JTMG.js} +6 -6
  119. package/{setPrimaryDialogAgentAction-537QFGW3.js → setPrimaryDialogAgentAction-X52JQGTJ.js} +6 -6
  120. package/{settingThunks-4Z43ZSAT.js → settingThunks-N6XFWPOU.js} +5 -5
  121. package/{spaceCommands-KHCPOFEB.js → spaceCommands-WQMUCGV7.js} +27 -25
  122. package/{streamAgentChatTurn-WFNIELXS.js → streamAgentChatTurn-DI2334G3.js} +142 -81
  123. package/{switchDialogAgentAction-CSO6AKRL.js → switchDialogAgentAction-ZJ5CGU7J.js} +5 -5
  124. package/{tools-2LGM37M4.js → tools-23VQGJOX.js} +32 -32
  125. package/{tuiSummaryLlmCaller-NBEHCAFU.js → tuiSummaryLlmCaller-FESHBDTT.js} +7 -7
  126. package/{updateCommands-LXZLG44Y.js → updateCommands-ODWC7SK7.js} +5 -3
  127. package/{updateDialogTitleAction-IFC2MM4P.js → updateDialogTitleAction-AGAYHWS7.js} +17 -17
  128. package/chunk-UKZX3NHN.js +0 -48
  129. package/{agentGrantCommands-HOJ3JBBQ.js → agentGrantCommands-5DPHYEKP.js} +3 -3
  130. package/{chromeOpsCommands-3Z34RKSE.js → chromeOpsCommands-GZVVK7HU.js} +4 -4
  131. package/{chunk-2SGAI64X.js → chunk-43OFVLWJ.js} +4 -4
  132. package/{chunk-XETG4RIX.js → chunk-AETZ7AD6.js} +4 -4
  133. package/{chunk-2IXDJNZI.js → chunk-GAGGEA7D.js} +3 -3
  134. package/{memoryCommands-CUNBFRVS.js → memoryCommands-ZS3VQJAL.js} +3 -3
  135. package/{offlineMarxistsAgentCommand-2QTHJCHV.js → offlineMarxistsAgentCommand-3GLX4QQY.js} +3 -3
  136. package/{tableCommands-LBH3QPPO.js → tableCommands-IVC5S7Y3.js} +11 -11
@@ -9,10 +9,10 @@ import {
9
9
  resolveRawAgentInput,
10
10
  resolveServerUrl,
11
11
  writeUsage
12
- } from "./chunk-AXYXKGPN.js";
12
+ } from "./chunk-ZAV4YVEA.js";
13
13
  import {
14
14
  getReadableCliDb
15
- } from "./chunk-P5QACQDK.js";
15
+ } from "./chunk-62TBKWTV.js";
16
16
  import {
17
17
  createCliLocalRuntimeAdapter,
18
18
  detectCurrentMachineId,
@@ -27,7 +27,7 @@ import {
27
27
  resolveBoundMachineId,
28
28
  resolveFileWriteGateEnabled,
29
29
  resolveLocalUserId
30
- } from "./chunk-DJKBZYMR.js";
30
+ } from "./chunk-UY73HNIN.js";
31
31
  import {
32
32
  clearCredentialAvailability,
33
33
  readCredentialEntry,
@@ -60,7 +60,7 @@ import {
60
60
  import {
61
61
  readDbRecord,
62
62
  resolveAgentRecordFromHybridStore
63
- } from "./chunk-ZEY4NJRE.js";
63
+ } from "./chunk-KABQ74UQ.js";
64
64
  import {
65
65
  isLocalCliAgentKey
66
66
  } from "./chunk-NBTY7YJF.js";
@@ -75,14 +75,14 @@ import {
75
75
  } from "./chunk-BMQ2MJUK.js";
76
76
  import {
77
77
  resolveCliLocalRuntimeKeyCapability
78
- } from "./chunk-XJOBYJWN.js";
78
+ } from "./chunk-2ZYCNT2O.js";
79
79
  import {
80
80
  isTransientFetchError
81
81
  } from "./chunk-KFHREHUQ.js";
82
82
  import {
83
83
  parseUiCard,
84
84
  uiCardFallback
85
- } from "./chunk-SOEJSA7I.js";
85
+ } from "./chunk-FCUKCVKN.js";
86
86
  import {
87
87
  isGatewayHttpStatus
88
88
  } from "./chunk-NF64D32W.js";
@@ -91,30 +91,30 @@ import {
91
91
  chooseMemoryOwners,
92
92
  loadMemoryCandidatesFromDb,
93
93
  resolveAgentMemoryPolicy
94
- } from "./chunk-RAEBIT7A.js";
94
+ } from "./chunk-JDKSYQQN.js";
95
95
  import {
96
96
  API_REPORTED_COST_MULTIPLIER,
97
- parseUiAskChoiceContent
98
- } from "./chunk-T64RZQBO.js";
97
+ estimateMessagesTokens,
98
+ parseUiAskChoiceContent,
99
+ resolveAgentContextWindow,
100
+ resolveOccupancy,
101
+ resolveOccupancyWindow
102
+ } from "./chunk-F5WASHQA.js";
99
103
  import {
100
- isOAuthApiKeyRef
101
- } from "./chunk-UKZX3NHN.js";
104
+ buildSkillDiscoveryContextLayer
105
+ } from "./chunk-AU7AXHUL.js";
102
106
  import {
103
107
  parseExternalSkillMarkdown,
104
108
  parseSkillDocProtocol
105
- } from "./chunk-XETG4RIX.js";
109
+ } from "./chunk-AETZ7AD6.js";
106
110
  import {
107
111
  LOCAL_AGENT_CONFIG_MISSING_CODE,
108
112
  LOCAL_TURN_ABORTED_CODE,
109
113
  readActionGate
110
- } from "./chunk-7G4KH3C4.js";
114
+ } from "./chunk-K25WQPP3.js";
111
115
  import {
112
- devinChannelContextWindow,
113
116
  resolveAgentRuntimeConfigFromRecord
114
- } from "./chunk-ZJZGF77K.js";
115
- import {
116
- isDevinOAuthAgent
117
- } from "./chunk-5ZUL4CUO.js";
117
+ } from "./chunk-ULQAD7ZY.js";
118
118
  import {
119
119
  createThinkParserState,
120
120
  flushThinkParser,
@@ -136,11 +136,9 @@ import {
136
136
  resolveCredentialKeyWithFallback
137
137
  } from "./chunk-3MZAGMYY.js";
138
138
  import {
139
+ isOAuthApiKeyRef,
139
140
  normalizeUsage
140
- } from "./chunk-KJ7MT3UC.js";
141
- import {
142
- findModelContextWindow
143
- } from "./chunk-AAMWEIEP.js";
141
+ } from "./chunk-F3SOW2EU.js";
144
142
  import {
145
143
  clipCompactText
146
144
  } from "./chunk-5MMAK75Q.js";
@@ -151,6 +149,13 @@ import {
151
149
  normalizeRuntimeToolPolicyOverride,
152
150
  resolveEffectiveRuntimeToolPolicy
153
151
  } from "./chunk-LIQJTQRN.js";
152
+ import {
153
+ buildAgentsMdLayer,
154
+ buildMemoryOverlayLayer,
155
+ buildMemoryUseGuidanceLayer,
156
+ partitionScopedBlocks,
157
+ renderTurnContextBlocksWithScope
158
+ } from "./chunk-VEA7H5FG.js";
154
159
  import {
155
160
  BUILTIN_NOLO_AGENT_KEY,
156
161
  BUILTIN_NOLO_AGENT_NAME,
@@ -164,9 +169,6 @@ import {
164
169
  createMemoryKey,
165
170
  ulid
166
171
  } from "./chunk-5EMSBTQ6.js";
167
- import {
168
- isAntigravityOAuthAgent
169
- } from "./chunk-JGRPBIZZ.js";
170
172
  import {
171
173
  createRunActivityTracker,
172
174
  createShellApprovalChild,
@@ -179,7 +181,7 @@ import {
179
181
  serverOriginForDialog,
180
182
  settleRunTerminalAuthoritatively,
181
183
  spawnLocalBackgroundRun
182
- } from "./chunk-MM3662RS.js";
184
+ } from "./chunk-SNAWGDXT.js";
183
185
  import {
184
186
  formatAgentListCard,
185
187
  formatFinishedRunCard,
@@ -190,29 +192,14 @@ import {
190
192
  formatStopRunCard,
191
193
  isAgentRunTerminalStatus
192
194
  } from "./chunk-PJNFNEJE.js";
193
- import {
194
- estimateTokenCount
195
- } from "./chunk-PSCNXBYA.js";
196
- import {
197
- resolveClientVersion
198
- } from "./chunk-SUKSWFLP.js";
199
- import {
200
- findModelConfig
201
- } from "./chunk-TRW43TSC.js";
202
- import {
203
- asTrimmedString
204
- } from "./chunk-3EUW3WEO.js";
205
195
  import {
206
196
  isCliAuthorityBrokerProtocolError,
207
197
  isCliAuthorityBrokerTimeoutError,
208
198
  isCliAuthorityBrokerUnavailableError
209
199
  } from "./chunk-EXAJ6DCR.js";
210
- import {
211
- toErrorMessage
212
- } from "./chunk-HNMXYYJR.js";
213
200
  import {
214
201
  getDefaultCliLocalRuntimeDb
215
- } from "./chunk-FY4SDK2E.js";
202
+ } from "./chunk-FDLDMJTM.js";
216
203
  import {
217
204
  getLogger,
218
205
  normalizeError
@@ -220,13 +207,28 @@ import {
220
207
  import {
221
208
  resolveAuthToken
222
209
  } from "./chunk-A7GB5UGH.js";
223
- import {
224
- asOptionalTrimmedString
225
- } from "./chunk-G3SUCT4W.js";
226
210
  import {
227
211
  readPipeText,
228
212
  spawnProcess
229
213
  } from "./chunk-Y6ROFCZO.js";
214
+ import {
215
+ isAntigravityOAuthAgent
216
+ } from "./chunk-SQX235S2.js";
217
+ import {
218
+ resolveClientVersion
219
+ } from "./chunk-PIG2IUVZ.js";
220
+ import {
221
+ findModelConfig
222
+ } from "./chunk-6EQD4AQL.js";
223
+ import {
224
+ asTrimmedString
225
+ } from "./chunk-3EUW3WEO.js";
226
+ import {
227
+ toErrorMessage
228
+ } from "./chunk-HNMXYYJR.js";
229
+ import {
230
+ asOptionalTrimmedString
231
+ } from "./chunk-G3SUCT4W.js";
230
232
  import {
231
233
  CLIENT_VERSION_TOO_OLD_CODE,
232
234
  NOLO_CLIENT_VERSION_HEADER,
@@ -235,16 +237,6 @@ import {
235
237
  import {
236
238
  asTrimmedLowercaseString
237
239
  } from "./chunk-QSJ3HFEF.js";
238
- import {
239
- buildSkillDiscoveryContextLayer
240
- } from "./chunk-AU7AXHUL.js";
241
- import {
242
- buildAgentsMdLayer,
243
- buildMemoryOverlayLayer,
244
- buildMemoryUseGuidanceLayer,
245
- partitionScopedBlocks,
246
- renderTurnContextBlocksWithScope
247
- } from "./chunk-VEA7H5FG.js";
248
240
 
249
241
  // packages/agent-runtime/modelLayerOverride.ts
250
242
  var MODEL_LAYER_KEYS = [
@@ -434,40 +426,6 @@ ${cardText}` : cardText;
434
426
  // packages/chat/messages/attachmentWriteRollout.ts
435
427
  var ENABLE_REMOTE_ATTACHMENT_PART_WRITES = false;
436
428
 
437
- // packages/ai/context/contextOccupancy.ts
438
- function estimateMessagesTokens(messages) {
439
- return messages.reduce((total, message) => {
440
- const content = typeof message.content === "string" ? message.content : message.content == null ? "" : JSON.stringify(message.content);
441
- return total + estimateTokenCount(content) + 4;
442
- }, 0);
443
- }
444
- function historyTokensBeforeLatestAssistant(messages) {
445
- const total = estimateMessagesTokens(messages);
446
- const latest = messages[messages.length - 1];
447
- if (latest?.role !== "assistant") return total;
448
- return Math.max(0, total - estimateMessagesTokens([latest]));
449
- }
450
- function resolveOccupancy(input) {
451
- if (input.authoritativeInput !== void 0 && input.authoritativeInput > 0) {
452
- const generated = Math.max(0, input.generatedSinceAuthority ?? 0);
453
- return {
454
- tokens: input.authoritativeInput + generated,
455
- estimated: generated > 0
456
- };
457
- }
458
- return {
459
- tokens: Math.max(0, input.baselineEstimate ?? 0),
460
- estimated: true
461
- };
462
- }
463
- function resolveOccupancyWindow(ref) {
464
- if (!ref.model) return void 0;
465
- if (isDevinOAuthAgent(ref)) {
466
- return devinChannelContextWindow(ref.model) ?? findModelContextWindow(ref.model, ref.provider);
467
- }
468
- return findModelContextWindow(ref.model, ref.provider);
469
- }
470
-
471
429
  // packages/cli/client/tokenUsage.ts
472
430
  var PLATFORM_CREDIT_UNIT = "credits";
473
431
  var isUsableModelId = (model) => {
@@ -491,34 +449,10 @@ function resolveAgentModelIdentity(opts) {
491
449
  ...model ? { model } : {}
492
450
  };
493
451
  }
494
- function resolveAgentContextWindow(opts) {
452
+ function resolveAgentContextWindow2(opts) {
495
453
  const model = resolveEffectiveModel(opts);
496
454
  if (model) return resolveContextWindow(model);
497
- const byName = opts.agentName?.trim() ? resolveOccupancyWindow({ model: opts.agentName }) : void 0;
498
- if (byName !== void 0) return byName;
499
- const candidates = [
500
- ...modelSlugCandidates(opts.agentKey, 2),
501
- ...modelSlugCandidates(opts.agentName, 1)
502
- ];
503
- for (const candidate of candidates) {
504
- const window = resolveOccupancyWindow({ model: candidate });
505
- if (window !== void 0) return window;
506
- }
507
- return void 0;
508
- }
509
- var AGENT_KEY_PREFIX = /^agent-[a-z0-9]+-/i;
510
- function modelSlugCandidates(source, maxDrop) {
511
- const raw = source?.trim();
512
- if (!raw) return [];
513
- const base = raw.replace(/\s+/g, "-").toLowerCase();
514
- const seed = base.replace(AGENT_KEY_PREFIX, "");
515
- const out = [seed];
516
- if (seed !== base) out.push(base);
517
- const segments = seed.split("-");
518
- for (let drop = 1; drop <= maxDrop && drop < segments.length; drop++) {
519
- out.push(segments.slice(drop).join("-"));
520
- }
521
- return [...new Set(out.filter(Boolean))];
455
+ return resolveAgentContextWindow(opts);
522
456
  }
523
457
  var PROVIDER_LOOKUP_ORDER = [
524
458
  "openrouter",
@@ -11204,6 +11138,51 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
11204
11138
  return null;
11205
11139
  }
11206
11140
 
11141
+ // packages/cli/idleHeapRelease.ts
11142
+ var IDLE_HEAP_RELEASE_DELAY_MS = 2e3;
11143
+ function releaseHeapPages(options = {}) {
11144
+ const env = options.env ?? process.env;
11145
+ if (env.NOLO_TUI_IDLE_HEAP_RELEASE === "0") return;
11146
+ const bun = "bun" in options ? options.bun : globalThis.Bun;
11147
+ if (typeof bun?.gc !== "function" || typeof bun?.shrink !== "function") return;
11148
+ try {
11149
+ bun.gc(true);
11150
+ bun.shrink();
11151
+ } catch {
11152
+ }
11153
+ }
11154
+ function createIdleHeapReleaser(options = {}) {
11155
+ const env = options.env ?? process.env;
11156
+ const bun = "bun" in options ? options.bun : globalThis.Bun;
11157
+ const disabled = env.NOLO_TUI_IDLE_HEAP_RELEASE === "0" || typeof bun?.gc !== "function" || typeof bun?.shrink !== "function";
11158
+ if (disabled) return { schedule() {
11159
+ }, cancel() {
11160
+ } };
11161
+ const delayMs = options.delayMs ?? IDLE_HEAP_RELEASE_DELAY_MS;
11162
+ const setTimer = options.setTimer ?? ((fn, ms) => {
11163
+ const handle = setTimeout(fn, ms);
11164
+ handle.unref?.();
11165
+ return handle;
11166
+ });
11167
+ const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
11168
+ let pending = null;
11169
+ const release = () => {
11170
+ pending = null;
11171
+ releaseHeapPages({ env, bun });
11172
+ };
11173
+ return {
11174
+ schedule() {
11175
+ if (pending !== null) clearTimer(pending);
11176
+ pending = setTimer(release, delayMs);
11177
+ },
11178
+ cancel() {
11179
+ if (pending === null) return;
11180
+ clearTimer(pending);
11181
+ pending = null;
11182
+ }
11183
+ };
11184
+ }
11185
+
11207
11186
  // packages/cli/client/agentRun.ts
11208
11187
  import { ulid as ulid2 } from "ulid";
11209
11188
 
@@ -11245,7 +11224,7 @@ function isBalanceExhaustedError(error) {
11245
11224
 
11246
11225
  // packages/cli/client/agentRun.ts
11247
11226
  async function loadRunLocalAgentTurn() {
11248
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-V4URZOQL.js");
11227
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-XCKO5FVP.js");
11249
11228
  return runLocalAgentTurn;
11250
11229
  }
11251
11230
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -12249,6 +12228,24 @@ async function runLocalAgentTurnForCli(options, settings) {
12249
12228
  }
12250
12229
  }
12251
12230
  async function runLocalAgentTurnForCliWithAdapter(options, settings, resolvedBaseAdapter) {
12231
+ try {
12232
+ return await executeLocalAgentTurnForCliWithAdapter(
12233
+ options,
12234
+ settings,
12235
+ resolvedBaseAdapter
12236
+ );
12237
+ } finally {
12238
+ try {
12239
+ if (typeof options.releaseHeapPages === "function") {
12240
+ options.releaseHeapPages();
12241
+ } else {
12242
+ releaseHeapPages({ env: options.env });
12243
+ }
12244
+ } catch {
12245
+ }
12246
+ }
12247
+ }
12248
+ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolvedBaseAdapter) {
12252
12249
  const baseAdapter = (() => {
12253
12250
  let adapter2 = resolvedBaseAdapter && options.modelOverride ? wrapLoadAgentConfigWithModelOverride(
12254
12251
  resolvedBaseAdapter,
@@ -16071,10 +16068,8 @@ export {
16071
16068
  redactSecrets,
16072
16069
  safeAskText,
16073
16070
  TUI_TREE_MARKER,
16074
- estimateMessagesTokens,
16075
- historyTokensBeforeLatestAssistant,
16076
16071
  resolveAgentModelIdentity,
16077
- resolveAgentContextWindow,
16072
+ resolveAgentContextWindow2 as resolveAgentContextWindow,
16078
16073
  platformCreditsFromUsage,
16079
16074
  formatCreditsChip,
16080
16075
  formatTokenCount,
@@ -16082,6 +16077,7 @@ export {
16082
16077
  computeBaselineContextTokens,
16083
16078
  resolveContextUsage,
16084
16079
  renderTokenStatus,
16080
+ createIdleHeapReleaser,
16085
16081
  COLLAPSED_PASTE_PLACEHOLDER_RE,
16086
16082
  shouldCollapsePaste,
16087
16083
  createCollapsedPasteStore,
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  patch,
6
6
  read
7
- } from "./chunk-ZVQHBIWV.js";
7
+ } from "./chunk-CDLP56BS.js";
8
8
  import {
9
9
  DEVICE_LOCAL_OWNER_ID,
10
10
  isDeviceLocalSpaceBody
11
- } from "./chunk-2SGAI64X.js";
11
+ } from "./chunk-43OFVLWJ.js";
12
12
  import {
13
13
  selectIdentityUserId
14
14
  } from "./chunk-PXYBUFDB.js";