nolo-cli 0.240.0-alpha.3 → 0.242.0-alpha.1

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 (206) hide show
  1. package/README.md +3 -5
  2. package/{_executeModel-5NA4USGG.js → _executeModel-IZ2MCXHO.js} +77 -77
  3. package/{action-X75O3XPH.js → action-VDEW6WLI.js} +9 -9
  4. package/{addContentAction-GVC77QSN.js → addContentAction-7YVXHIPQ.js} +14 -14
  5. package/{addDialogAgentAction-KKDVAMW3.js → addDialogAgentAction-BX7B47HF.js} +17 -17
  6. package/{agentDeleteCommand-2RFGKFAB.js → agentDeleteCommand-N7ELXPLD.js} +107 -108
  7. package/{agentEmailCommands-GQCQKKOR.js → agentEmailCommands-OFS477PV.js} +110 -111
  8. package/{agentListCommands-HSGLDPDQ.js → agentListCommands-IQQHJSXP.js} +202 -164
  9. package/{agentMachineCommands-BISF6PVV.js → agentMachineCommands-NS65BEW7.js} +52 -49
  10. package/{agentProviderCommands-O3Q25PKU.js → agentProviderCommands-SS6M6VGY.js} +2 -2
  11. package/{agentPullCommand-G6U2LHMW.js → agentPullCommand-QQQZSC6S.js} +1 -1
  12. package/{agentRecordCommands-AOXPGYAJ.js → agentRecordCommands-4VE7CNLC.js} +103 -104
  13. package/{agentRunCommand-AFAIP7U7.js → agentRunCommand-2MUXHKNW.js} +109 -108
  14. package/{agentRunControl-VBL7UFSG.js → agentRunControl-55GL6Q3M.js} +11 -9
  15. package/{agentRuntimeLocal-T7BX2WGL.js → agentRuntimeLocal-5DB2P4MU.js} +51 -43
  16. package/{agentSlice-XJNKE3PG.js → agentSlice-5VTAFG43.js} +14 -14
  17. package/{appDeleteCommands-LURUSPY7.js → appDeleteCommands-EDKUPHJM.js} +52 -49
  18. package/{appDeployCommands-SMEW4AK2.js → appDeployCommands-JO74GW4L.js} +52 -49
  19. package/{appDeployStatusCommands-VYPJTBJK.js → appDeployStatusCommands-U77ZUHX7.js} +52 -49
  20. package/{appGetCommands-N4NI5GGJ.js → appGetCommands-QCMHBYPX.js} +52 -49
  21. package/{appListCommands-5C6ONN3Z.js → appListCommands-ZQJYEXI6.js} +52 -49
  22. package/{authCommand-4CVBDADE.js → authCommand-W4KXRZLI.js} +23 -19
  23. package/{authCommands-EHU2BHOX.js → authCommands-6AUYO65N.js} +10 -6
  24. package/{builtinSkillRegistry-AYWYQVA4.js → builtinSkillRegistry-GHE3RD3V.js} +6 -6
  25. package/{chromeCommands-G5UDKVSV.js → chromeCommands-S7AW3AOD.js} +383 -6
  26. package/{chromeOpsCommands-CSDG2HYN.js → chromeOpsCommands-TBPM6MR4.js} +1 -1
  27. package/{chunk-7TTMMOKH.js → chunk-247AAJRK.js} +1 -1
  28. package/{chunk-4X5AVCM7.js → chunk-2BSLGODA.js} +258 -23
  29. package/{chunk-P3IZUMIC.js → chunk-2N4UBHUU.js} +4 -4
  30. package/{chunk-A74QP4FI.js → chunk-2T5BHLID.js} +572 -208
  31. package/{chunk-H7ZYKHAZ.js → chunk-3OQFXODL.js} +102 -31
  32. package/{chunk-BIABIPGW.js → chunk-3ORFJP2Z.js} +1 -1
  33. package/{chunk-3FBAVU2Y.js → chunk-3UNAGTBW.js} +19 -84
  34. package/{chunk-DNZ4JJ7C.js → chunk-4F7SWSWO.js} +19 -6
  35. package/{chunk-2X7WFDT6.js → chunk-4FE3IWRE.js} +1 -1
  36. package/{chunk-N2JROHD3.js → chunk-4UK6UBXF.js} +3 -3
  37. package/{chunk-XS5A3EKX.js → chunk-4YFC3DWW.js} +75 -1
  38. package/chunk-53W5BXLN.js +340 -0
  39. package/{chunk-E5KJOZWY.js → chunk-5GRWWUB4.js} +3 -3
  40. package/{chunk-HCNOO374.js → chunk-6326DRQY.js} +1 -1
  41. package/{chunk-RM4UMFY4.js → chunk-6MQWGA5F.js} +10 -10
  42. package/{chunk-TEMLHVGX.js → chunk-6MX6S6TE.js} +3 -3
  43. package/{chunk-6WOLPIPY.js → chunk-6RSNVJGO.js} +2 -102
  44. package/{chunk-Y5OWZQMJ.js → chunk-6S6CZUXK.js} +19 -19
  45. package/{chunk-PDCV7P5W.js → chunk-6XIE5ZGI.js} +1 -1
  46. package/{chunk-FZKA3XFA.js → chunk-6XLWUNZB.js} +27 -27
  47. package/{chunk-62HXNQVV.js → chunk-776CXKMX.js} +1 -1
  48. package/{chunk-MYPKBJJO.js → chunk-7AWKDRXG.js} +2 -2
  49. package/{chunk-GDUC4VS2.js → chunk-7GTXPS3D.js} +10 -10
  50. package/{chunk-Z2WZAE4P.js → chunk-7HUHOCIY.js} +36 -30
  51. package/{chunk-PWTNI4N7.js → chunk-ANUP75N2.js} +22 -0
  52. package/{chunk-ULLHVDTZ.js → chunk-BH7CEVOH.js} +4 -4
  53. package/{chunk-A3LUWRQK.js → chunk-C4KX626C.js} +5 -5
  54. package/chunk-C5A54QS7.js +108 -0
  55. package/{chunk-DXW5WDHZ.js → chunk-CHYYSFFM.js} +6 -6
  56. package/{chunk-O6IPRAVV.js → chunk-CJTB3OYB.js} +2 -2
  57. package/{chunk-AVJDELEA.js → chunk-DLT2DN4M.js} +1 -1
  58. package/{chunk-LKA64WH4.js → chunk-DMPZMYH4.js} +37 -1
  59. package/{chunk-MM73SP4K.js → chunk-DOK7GDRU.js} +1 -1
  60. package/{chunk-VREG6ANQ.js → chunk-DPAIQLAL.js} +16 -16
  61. package/{chunk-ANJRDS6U.js → chunk-EKXPHL7M.js} +3 -3
  62. package/{chunk-TWTJV35S.js → chunk-ENYTIRIO.js} +3 -3
  63. package/{chunk-PGKA77TZ.js → chunk-ER3P6MBT.js} +170 -107
  64. package/{chunk-EEOOBRA7.js → chunk-F4MCAOWN.js} +2 -2
  65. package/{chunk-7NIBQ4HY.js → chunk-FDZ2GBWO.js} +30 -2
  66. package/{chunk-VSRISJXZ.js → chunk-GAHJLSDO.js} +1 -1
  67. package/{chunk-U3G7RRXJ.js → chunk-GES5GIAU.js} +8 -8
  68. package/{chunk-4IQVE43Z.js → chunk-HQVNO7FH.js} +22 -22
  69. package/{chunk-DVYAFH2Q.js → chunk-HSWEFHFS.js} +1 -1
  70. package/{chunk-MECDGHLK.js → chunk-IIG3TT73.js} +43 -6
  71. package/{chunk-YGCOJNFZ.js → chunk-IZJFTY4R.js} +3 -3
  72. package/{chunk-BXSMFPTG.js → chunk-J25ESVUW.js} +10 -10
  73. package/{chunk-CVJRVBJL.js → chunk-J2XZZXIH.js} +4 -4
  74. package/{chunk-3EMIEC27.js → chunk-JVJ53XCH.js} +1 -1
  75. package/{chunk-AH5R7BYW.js → chunk-KC2QVCI7.js} +6 -6
  76. package/{chunk-MYOSN6BT.js → chunk-KF2DWSAH.js} +34 -13
  77. package/chunk-KK3FCYZM.js +647 -0
  78. package/{chunk-PRMEU7BT.js → chunk-KLD7K5FD.js} +7 -7
  79. package/{chunk-7AJRJGSQ.js → chunk-KMW5CRRM.js} +801 -381
  80. package/{chunk-Y2MF4DCJ.js → chunk-LELADM5Q.js} +1 -1
  81. package/{chunk-RTHFJZ6M.js → chunk-LMFMV5UC.js} +2 -2
  82. package/{chunk-2574ANSV.js → chunk-LZOOUQAZ.js} +4 -4
  83. package/{chunk-HOM6LTEW.js → chunk-M5EA44QU.js} +6 -6
  84. package/{chunk-IUMS6F53.js → chunk-MEDPR36J.js} +9 -5
  85. package/{chunk-6D25V6CB.js → chunk-MFXJY44K.js} +4 -4
  86. package/chunk-MVOZ22RZ.js +26 -0
  87. package/{chunk-CBUZ6DKA.js → chunk-N6EN3HK3.js} +1 -1
  88. package/{chunk-VS276URX.js → chunk-NEG5LYK5.js} +1 -1
  89. package/{chunk-B7DE5XJW.js → chunk-ODGSLWLO.js} +249 -66
  90. package/{chunk-S2MHR4PU.js → chunk-OGZE6BZG.js} +190 -118
  91. package/{chunk-CD3RU7XL.js → chunk-OJRTTERA.js} +62 -2
  92. package/{chunk-GXXY2NL3.js → chunk-OKPC4QNX.js} +37 -2
  93. package/{chunk-5QZSEQSK.js → chunk-ONFFUQYM.js} +1 -1
  94. package/{chunk-BGGAY6OK.js → chunk-P244EH4W.js} +3 -3
  95. package/chunk-P27E22MA.js +203 -0
  96. package/{chunk-UFC4J7OY.js → chunk-PK7VT4ZU.js} +3 -3
  97. package/{chunk-4FIO2S7Z.js → chunk-QLUYDJST.js} +1 -1
  98. package/{chunk-AEQMKYZN.js → chunk-QUJKDFZW.js} +7 -7
  99. package/{chunk-G22P367E.js → chunk-QXUVCIPB.js} +62 -18
  100. package/{chunk-IJTXNLQE.js → chunk-QYNABNNQ.js} +6 -6
  101. package/{chunk-TRHJ4NJB.js → chunk-RGUWOMXU.js} +626 -237
  102. package/{chunk-L32W3PRP.js → chunk-RH44TIHX.js} +165 -16
  103. package/{chunk-EBKHA63G.js → chunk-RIMFTQMC.js} +178 -46
  104. package/{chunk-OOJNQK6V.js → chunk-S25VJYXV.js} +8 -2
  105. package/{chunk-BGGV6B5O.js → chunk-SBRJOYND.js} +280 -139
  106. package/{chunk-KZPEGO6D.js → chunk-SBRSXY67.js} +6 -6
  107. package/chunk-SR4FE5VD.js +9 -0
  108. package/{chunk-4WVJLODK.js → chunk-T23G6PXQ.js} +8 -3
  109. package/{chunk-D374I563.js → chunk-T3WSFTBS.js} +1 -1
  110. package/{chunk-VP3BINY7.js → chunk-TOK555CQ.js} +31 -1
  111. package/{chunk-OBSEKCVK.js → chunk-U4VSBDO5.js} +88 -0
  112. package/{chunk-OX6GNNVT.js → chunk-U5LOKQ2R.js} +24 -13
  113. package/{chunk-LYDEFPQP.js → chunk-UDT4SI37.js} +1 -1
  114. package/{chunk-CKZPMJNU.js → chunk-UQXOORR3.js} +5 -5
  115. package/{chunk-FFYE5ATM.js → chunk-UR7555FE.js} +11 -11
  116. package/{chunk-F3XI6WQP.js → chunk-UWOCASVL.js} +5 -5
  117. package/{chunk-A5EVA6HU.js → chunk-V2V5Q6DU.js} +2 -2
  118. package/{chunk-PROOOQZ3.js → chunk-VCU5GV42.js} +1 -1
  119. package/{chunk-F6YWDVIB.js → chunk-VMWY7TUA.js} +1 -1
  120. package/{chunk-RETQOQ4D.js → chunk-VNALJT32.js} +2 -2
  121. package/{chunk-HGDKT2D6.js → chunk-VTHWBTRE.js} +177 -1
  122. package/{chunk-X7IA2B7R.js → chunk-WBSJAIZP.js} +7 -3
  123. package/{chunk-ZEKUFJLW.js → chunk-WVOZ35E4.js} +7 -7
  124. package/{chunk-B5SV4H3J.js → chunk-XDNXKFWF.js} +4 -4
  125. package/{chunk-4Q6HQORG.js → chunk-XLN2GD6Z.js} +4 -4
  126. package/{chunk-HBRDSQ3M.js → chunk-XNEDFWT4.js} +2 -2
  127. package/{chunk-6CKUO32A.js → chunk-Y22P6ASC.js} +11 -8
  128. package/{chunk-SRCCSTIM.js → chunk-Y3DOUQQQ.js} +4 -4
  129. package/{chunk-6WZVM33D.js → chunk-Y5EBOURK.js} +3 -3
  130. package/{chunk-6OVNSQHN.js → chunk-YLAHYLDQ.js} +5 -0
  131. package/{chunk-T6VROBY7.js → chunk-YTEY27GN.js} +2 -2
  132. package/{chunk-5ZUOVCKT.js → chunk-YUZ2DAIH.js} +3 -1
  133. package/{chunk-IUTUWIKE.js → chunk-ZCVBIIUE.js} +4 -4
  134. package/{chunk-VM72HKW2.js → chunk-ZCZLTJEW.js} +9 -36
  135. package/{cliAgentConfigHelpers-U5OAVAKQ.js → cliAgentConfigHelpers-6OFDHJFT.js} +8 -8
  136. package/{cliAuthorityBrokerClient-S42VMGB6.js → cliAuthorityBrokerClient-SFPC3WVK.js} +1 -1
  137. package/{cliLocalAgentRecordReader-HVZAQCUD.js → cliLocalAgentRecordReader-FHIMCBUK.js} +52 -45
  138. package/{commandRegistry-TME7INFU.js → commandRegistry-OKIWAJIS.js} +101 -93
  139. package/{contentThunks-U6OC4R2N.js → contentThunks-VF2DCU46.js} +33 -32
  140. package/{cooldownCommands-U7XSRVJP.js → cooldownCommands-QL6DWGVU.js} +1 -1
  141. package/{createAgentAutomationAction-IP4LFN3W.js → createAgentAutomationAction-BGET7Q6K.js} +34 -33
  142. package/{createDialogAction-IAGQJ3LH.js → createDialogAction-XYDQZETK.js} +34 -33
  143. package/{createPageAction-AZ3UIFKA.js → createPageAction-74S5RO7U.js} +38 -37
  144. package/{db-M7FU2GNK.js → db-6NRZLEW2.js} +1 -1
  145. package/{dbSlice-DKKMJJYY.js → dbSlice-FI7VNDR5.js} +13 -13
  146. package/{deleteFile-TQSONMVU.js → deleteFile-GD62MPZW.js} +8 -8
  147. package/{dialogCommands-PCDRMBWG.js → dialogCommands-Y6DHZUAM.js} +56 -54
  148. package/{dialogNotifyCommand-O35MWMOS.js → dialogNotifyCommand-MKXL4NGL.js} +10 -10
  149. package/{dialogSlice-QAKYN4DE.js → dialogSlice-XAUKSWZ4.js} +32 -31
  150. package/{dialogUsageCommand-2SSLTXKO.js → dialogUsageCommand-BZPKR3DW.js} +5 -5
  151. package/{docCreateCommands-CFQFZOAD.js → docCreateCommands-PHDFOQBM.js} +51 -48
  152. package/{docDeleteCommands-5CPNTIIS.js → docDeleteCommands-OSHJM67Y.js} +53 -50
  153. package/{docReadCommands-XQILYSAJ.js → docReadCommands-E6QYCFMS.js} +51 -48
  154. package/{docStore-GIVRT7TQ.js → docStore-ZZT2BEBU.js} +15 -15
  155. package/{docUpdateCommands-VETKSUDD.js → docUpdateCommands-DHIOPK2C.js} +51 -48
  156. package/fetchMessages-TQEUZD7H.js +1 -1
  157. package/{getPricing-LF5C4XSI.js → getPricing-RNRITFOP.js} +4 -4
  158. package/{handleSendMessageAction-HKIW4ZNO.js → handleSendMessageAction-ARUU6CNF.js} +71 -70
  159. package/{hostCredentialCreate-6VDJFNDO.js → hostCredentialCreate-SNQT73H4.js} +103 -104
  160. package/index.js +8 -8
  161. package/{localDialogRead-AV2VKKPG.js → localDialogRead-3T2KMCRC.js} +1 -1
  162. package/{localRuntimeAdapter-BQ4F5PZV.js → localRuntimeAdapter-MHI6Y2IZ.js} +112 -111
  163. package/{localRuntimeAuthority-WCNA4A3G.js → localRuntimeAuthority-7DKIT7UH.js} +2 -2
  164. package/{localRuntimeDb-CRNIBOOM.js → localRuntimeDb-5WZ4RJJO.js} +1 -1
  165. package/{machineCommands-K6XIGOAD.js → machineCommands-3O6Y27R4.js} +229 -321
  166. package/{machineWsRunDispatch-4OO7Z6UM.js → machineWsRunDispatch-5PFLR5XC.js} +101 -102
  167. package/markdownToSlate-KIYM7B3P.js +8 -0
  168. package/{mcpLocalAuthorizeCommand-ZP6ESAGE.js → mcpLocalAuthorizeCommand-BQCQ2KRJ.js} +15 -15
  169. package/{memberThunks-PBJPZ2JU.js → memberThunks-TU6A6OBV.js} +16 -16
  170. package/{models-H5NNZRLH.js → models-CINY5UZR.js} +2 -2
  171. package/package.json +1 -1
  172. package/{projectArchive-G7AOQPRW.js → projectArchive-X2EVXU3N.js} +40 -39
  173. package/{providerPresetApply-OPBCAONX.js → providerPresetApply-HUWNV2NI.js} +6 -6
  174. package/{providerRegistry-J2HCVTHE.js → providerRegistry-7FWKDKZJ.js} +6 -6
  175. package/{read-JEGPITEW.js → read-QAHEQID5.js} +8 -8
  176. package/{readDocTool-TE3XIU4Y.js → readDocTool-KG5DP6EM.js} +1 -1
  177. package/{readlineWorkspace-SOW5QUGZ.js → readlineWorkspace-SO3APHVP.js} +3300 -1518
  178. package/rememberExplicit-CPAPONSI.js +15 -0
  179. package/{removeDialogAgentAction-CX3OAH4Y.js → removeDialogAgentAction-QZCCVK2G.js} +19 -19
  180. package/{runAgentClientLoop-HQJPDFGQ.js → runAgentClientLoop-FLHHCOVH.js} +77 -77
  181. package/{runtimeDoctorCommands-GUH2YGMH.js → runtimeDoctorCommands-DN3I52C6.js} +8 -8
  182. package/{secretCommands-NJXFVHZU.js → secretCommands-36BCE3UE.js} +2 -2
  183. package/{setDialogExtraReferencesAction-CGM67EEQ.js → setDialogExtraReferencesAction-PDPTYSEW.js} +15 -15
  184. package/{setPrimaryDialogAgentAction-3ABWPPXR.js → setPrimaryDialogAgentAction-DOUIPR66.js} +19 -19
  185. package/{settingThunks-AY76OHYX.js → settingThunks-MHGGP6UE.js} +23 -23
  186. package/{spaceCommands-G63QGYQO.js → spaceCommands-JH7UYE3K.js} +54 -51
  187. package/{streamAgentChatTurn-E3XH2KFD.js → streamAgentChatTurn-VDDA2TX6.js} +118 -118
  188. package/{switchDialogAgentAction-G6EZRKCQ.js → switchDialogAgentAction-7USK3DAP.js} +17 -17
  189. package/{tableCommands-JI75ZHDI.js → tableCommands-UONBFC7L.js} +6 -6
  190. package/{toolApiClient-62UUPDUA.js → toolApiClient-53YMJ2G6.js} +7 -3
  191. package/{tools-7RSX22FT.js → tools-MIOCXKMG.js} +59 -60
  192. package/{tuiRestart-KAAA7TND.js → tuiRestart-ET3QISZ5.js} +10 -10
  193. package/{tuiSummaryLlmCaller-BVNHMWLR.js → tuiSummaryLlmCaller-MSINBP3M.js} +15 -14
  194. package/{updateCommands-ASK5XYPH.js → updateCommands-5OYND6EF.js} +3 -3
  195. package/{updateDialogTitleAction-SEWV252V.js → updateDialogTitleAction-2L4CC4YO.js} +35 -34
  196. package/{usageCommand-JVT5J3DC.js → usageCommand-JTKDAG6I.js} +2 -2
  197. package/{usageRebuildCommand-IZYYUTEW.js → usageRebuildCommand-4TFZCKXM.js} +3 -3
  198. package/{windowsSelfUpdate-BSDIS2J5.js → windowsSelfUpdate-HIYNL3VR.js} +2 -2
  199. package/{workContext-MM3P5GP5.js → workContext-Y3ADAPZU.js} +2 -1
  200. package/{workloadLifecycle-YIZ7KLUP.js → workloadLifecycle-ZCSQCHG3.js} +6 -6
  201. package/chunk-TUSTONB3.js +0 -81
  202. package/chunk-XBAEM4RI.js +0 -272
  203. package/{accountResolver-EK2S4PWF.js → accountResolver-QETKNC7T.js} +3 -3
  204. package/{chunk-W6RFEDN4.js → chunk-AETZ7AD6.js} +3 -3
  205. package/{chunk-VMJVAJ6W.js → chunk-TB5KTLNB.js} +3 -3
  206. /package/{chunk-FJ23FZXF.js → chunk-VIYVRPMJ.js} +0 -0
@@ -3,10 +3,11 @@ import {
3
3
  DEVIN_CONNECT_URL,
4
4
  parseSseDataLineJson,
5
5
  parseSseDataLineObject
6
- } from "./chunk-H7ZYKHAZ.js";
6
+ } from "./chunk-3OQFXODL.js";
7
7
  import {
8
+ ALWAYS_EXCLUDED_GLOBS,
8
9
  EXECUTION_BACKEND_KINDS
9
- } from "./chunk-PWTNI4N7.js";
10
+ } from "./chunk-ANUP75N2.js";
10
11
  import {
11
12
  formatImageSummary,
12
13
  readLocalImage
@@ -19,7 +20,7 @@ import {
19
20
  flushChatCompletionStream,
20
21
  providerHttpFailure,
21
22
  throwIfChatCompletionStreamFailed
22
- } from "./chunk-HOM6LTEW.js";
23
+ } from "./chunk-M5EA44QU.js";
23
24
  import {
24
25
  readSseFrames
25
26
  } from "./chunk-HNUWUO75.js";
@@ -31,14 +32,7 @@ import {
31
32
  evaluateRequestBudget,
32
33
  hasImageInRuntimeMessages,
33
34
  stripImagePartsFromMessages
34
- } from "./chunk-KZPEGO6D.js";
35
- import {
36
- resolveToolExecutionContract
37
- } from "./chunk-LKA64WH4.js";
38
- import {
39
- resolveAgentImageInputSupport,
40
- resolveToolImagePolicy
41
- } from "./chunk-BGGAY6OK.js";
35
+ } from "./chunk-SBRSXY67.js";
42
36
  import {
43
37
  applyShapingCounts,
44
38
  attachProjectionFacts,
@@ -49,7 +43,7 @@ import {
49
43
  projectUserPartForModel,
50
44
  resolveOutboundDiagnosticSink,
51
45
  writeThinkingFacts
52
- } from "./chunk-5QZSEQSK.js";
46
+ } from "./chunk-ONFFUQYM.js";
53
47
  import {
54
48
  createThinkParserState,
55
49
  createToolCallAccumulator,
@@ -58,16 +52,9 @@ import {
58
52
  finalizeAccumulatedToolCalls
59
53
  } from "./chunk-56GBUMO5.js";
60
54
  import {
61
- CREDENTIAL_HYGIENE_RULE,
62
- DELETE_SAFETY_RED_LINE,
63
- DISPATCH_BACKEND_POLICY,
64
- DISPATCH_CANDIDATE_POLICY,
65
- PARALLEL_DISPATCH_DEFAULT_RULE,
66
- PLATFORM_RISK_CONTROL_RULE,
67
55
  TOOL_GUIDED_SECTION_ORDER,
68
- VERIFY_BEFORE_CONCLUDING_RULE,
69
- buildConsultationModeBlock,
70
56
  buildIdentityBlock,
57
+ buildPlatformStaticScopedBlocks,
71
58
  buildRuntimeGuidanceBlocks,
72
59
  detectDispatchIntent,
73
60
  detectDispatchIntentFromMessages,
@@ -75,7 +62,22 @@ import {
75
62
  hashStablePrefixContent,
76
63
  resolveResponseGuidelines,
77
64
  resolveToolGuidedSections
78
- } from "./chunk-PGKA77TZ.js";
65
+ } from "./chunk-ER3P6MBT.js";
66
+ import {
67
+ BRIDGE_STREAM_MAX_CHARS,
68
+ CLI_NOLO_WORKSPACE_TOOL_NAMES,
69
+ DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
70
+ NOLO_WORKSPACE_TOOL_NAMES,
71
+ buildDialogReadEnvelope,
72
+ buildNoloWorkspaceCommandArgs,
73
+ buildNoloWorkspaceOpenAiTools,
74
+ createStreamingDialogReadProjector,
75
+ noloPositiveIntegerString,
76
+ noloStringArg,
77
+ parseNoloWorkspaceToolArguments,
78
+ readTextStreamUpToChars,
79
+ resolveNoloDialogInput
80
+ } from "./chunk-QXUVCIPB.js";
79
81
  import {
80
82
  classifyUnparsableToolArgs,
81
83
  collectStablePromptPrefix,
@@ -99,7 +101,7 @@ import {
99
101
  toOpenAiCompatibleMessages,
100
102
  toResponsesTools,
101
103
  transferDowngradedToolTurnOrigin
102
- } from "./chunk-EEOOBRA7.js";
104
+ } from "./chunk-F4MCAOWN.js";
103
105
  import {
104
106
  TOOL_HAD_IMAGES,
105
107
  TOOL_IMAGES,
@@ -114,24 +116,14 @@ import {
114
116
  withoutToolImages
115
117
  } from "./chunk-X4O7FJF5.js";
116
118
  import {
117
- BRIDGE_STREAM_MAX_CHARS,
118
- CLI_NOLO_WORKSPACE_TOOL_NAMES,
119
- DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
120
- NOLO_WORKSPACE_TOOL_NAMES,
121
- buildDialogReadEnvelope,
122
- buildNoloWorkspaceCommandArgs,
123
- buildNoloWorkspaceOpenAiTools,
124
- createStreamingDialogReadProjector,
125
- noloPositiveIntegerString,
126
- noloStringArg,
127
- parseNoloWorkspaceToolArguments,
128
- readTextStreamUpToChars,
129
- resolveNoloDialogInput
130
- } from "./chunk-G22P367E.js";
119
+ resolveToolExecutionContract
120
+ } from "./chunk-DMPZMYH4.js";
131
121
  import {
132
- applyToolSurfaceConstraints
133
- } from "./chunk-VS276URX.js";
122
+ resolveAgentImageInputSupport,
123
+ resolveToolImagePolicy
124
+ } from "./chunk-P244EH4W.js";
134
125
  import {
126
+ isContextOverflowText,
135
127
  isQuotaExhaustedError
136
128
  } from "./chunk-TLE77UJ5.js";
137
129
  import {
@@ -150,7 +142,7 @@ import {
150
142
  } from "./chunk-WFGNWWJI.js";
151
143
  import {
152
144
  isAgentSkillDisabled
153
- } from "./chunk-MM73SP4K.js";
145
+ } from "./chunk-DOK7GDRU.js";
154
146
  import {
155
147
  buildDialogFallbackTitleFromUserInput
156
148
  } from "./chunk-2MBTWINN.js";
@@ -162,16 +154,18 @@ import {
162
154
  resolveEmptyAssistantFallbackMessage,
163
155
  resolveEmptyAssistantOutcome,
164
156
  resolveTruncatedReasoningTailLog
165
- } from "./chunk-DNZ4JJ7C.js";
157
+ } from "./chunk-4F7SWSWO.js";
166
158
  import {
167
159
  COMPACTION_SUMMARY_SCHEMA_VERSION,
168
160
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
169
161
  buildBoundedCompactionRequest,
170
162
  buildCompactionMetricsFromPlan,
171
163
  buildSummarySourceDiagnostics,
164
+ buildSummarySourceSegments,
172
165
  classifySummaryError,
173
166
  computeSummarySourceMetadata,
174
167
  createSummaryBudget,
168
+ diffSummarySourceSegments,
175
169
  formatCompactionMetricsLog,
176
170
  getMessageTokenCount,
177
171
  getModelContextWindow,
@@ -183,10 +177,9 @@ import {
183
177
  resolveCompressionTriggerRatio,
184
178
  resolveEffectiveCompactionBudgets,
185
179
  runSummaryWithContract,
186
- sha256Hex,
187
180
  summaryCompletionTokens,
188
181
  truncateToolOutputForContext
189
- } from "./chunk-L32W3PRP.js";
182
+ } from "./chunk-RH44TIHX.js";
190
183
  import {
191
184
  createProviderCallTimingTracker,
192
185
  finalizeProviderCallTiming,
@@ -194,18 +187,15 @@ import {
194
187
  observeMeaningfulProviderResponse,
195
188
  withProviderCallTimingFields
196
189
  } from "./chunk-H57T64RA.js";
190
+ import {
191
+ sha256Hex
192
+ } from "./chunk-SR4FE5VD.js";
197
193
  import {
198
194
  clipCompactText
199
195
  } from "./chunk-5MMAK75Q.js";
200
196
  import {
201
197
  asRecordOrEmpty
202
198
  } from "./chunk-KX6YBIHG.js";
203
- import {
204
- isAbortError
205
- } from "./chunk-7DPNBQSV.js";
206
- import {
207
- isLevelNotFoundError
208
- } from "./chunk-OW765XBU.js";
209
199
  import {
210
200
  TOOL_OUTPUT_SPILL_BYTES,
211
201
  TOOL_OUTPUT_SPILL_LINES,
@@ -233,27 +223,49 @@ import {
233
223
  spillToolOutput,
234
224
  toProcessTaskView,
235
225
  truncateToolOutput
236
- } from "./chunk-VMJVAJ6W.js";
226
+ } from "./chunk-TB5KTLNB.js";
237
227
  import {
238
228
  estimateTokenCount
239
229
  } from "./chunk-PSCNXBYA.js";
230
+ import {
231
+ isLevelNotFoundError
232
+ } from "./chunk-OW765XBU.js";
233
+ import {
234
+ isAbortError
235
+ } from "./chunk-7DPNBQSV.js";
236
+ import {
237
+ buildAgentsMdLayer,
238
+ buildAgentsMdLayerHeader,
239
+ buildDialogSummaryLayer,
240
+ hasMemoryTools
241
+ } from "./chunk-5HUO7SEX.js";
242
+ import {
243
+ MEMORY_USE_GUIDANCE,
244
+ buildUserResponseLanguageContext
245
+ } from "./chunk-YGDYYFRX.js";
240
246
  import {
241
247
  resolveNoloStateDir
242
248
  } from "./chunk-6UBGXX2W.js";
249
+ import {
250
+ isTombstoneRecord
251
+ } from "./chunk-BV3FLP2L.js";
243
252
  import {
244
253
  dialogMessageRecordToAgentRuntimeMessage
245
254
  } from "./chunk-4ZCTKB27.js";
246
- import {
247
- WORKTREE_ISOLATION_PRELUDE
248
- } from "./chunk-EBKHA63G.js";
249
- import {
250
- canonicalizeToolName,
251
- canonicalizeToolNames
252
- } from "./chunk-6OVNSQHN.js";
253
255
  import {
254
256
  dialogMessageKey,
255
257
  dialogMessageRange
256
258
  } from "./chunk-OJKUU3LP.js";
259
+ import {
260
+ resolveLocalUserId
261
+ } from "./chunk-LZOOUQAZ.js";
262
+ import {
263
+ applyToolSurfaceConstraints
264
+ } from "./chunk-NEG5LYK5.js";
265
+ import {
266
+ canonicalizeToolName,
267
+ canonicalizeToolNames
268
+ } from "./chunk-YLAHYLDQ.js";
257
269
  import {
258
270
  asTrimmedNonEmptyStringArray
259
271
  } from "./chunk-I42VC5KR.js";
@@ -261,22 +273,12 @@ import {
261
273
  asOptionalPositiveFiniteNumber
262
274
  } from "./chunk-U6VC4MU4.js";
263
275
  import {
264
- buildAgentsMdLayer,
265
- buildAgentsMdLayerHeader,
266
- buildDialogSummaryLayer,
267
- hasMemoryTools
268
- } from "./chunk-5HUO7SEX.js";
269
- import {
270
- MEMORY_USE_GUIDANCE,
271
- buildUserResponseLanguageContext
272
- } from "./chunk-YGDYYFRX.js";
276
+ toErrorMessage
277
+ } from "./chunk-HNMXYYJR.js";
273
278
  import {
274
279
  buildProviderAuthHeaders,
275
280
  buildProviderExecutionPlan
276
- } from "./chunk-RTHFJZ6M.js";
277
- import {
278
- toErrorMessage
279
- } from "./chunk-HNMXYYJR.js";
281
+ } from "./chunk-LMFMV5UC.js";
280
282
  import {
281
283
  asTrimmedString
282
284
  } from "./chunk-3EUW3WEO.js";
@@ -291,7 +293,7 @@ import {
291
293
  } from "./chunk-CF7PE763.js";
292
294
  import {
293
295
  PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL
294
- } from "./chunk-OBSEKCVK.js";
296
+ } from "./chunk-U4VSBDO5.js";
295
297
  import {
296
298
  asTrimmedLowercaseString
297
299
  } from "./chunk-QSJ3HFEF.js";
@@ -13898,7 +13900,7 @@ function buildToolResultsSignature(toolExecutions) {
13898
13900
  function resolveProgressGuardConfig(options, env = typeof process !== "undefined" ? process.env : {}) {
13899
13901
  const envDisabled = env.NOLO_LOOP_PROGRESS_GUARD_DISABLED === "true" || env.NOLO_LOOP_PROGRESS_GUARD_DISABLED === "1";
13900
13902
  const disabled = options?.disabled ?? envDisabled ?? false;
13901
- const parsePositiveInt = (val, fallback) => {
13903
+ const parsePositiveInt = (val, fallback2) => {
13902
13904
  if (typeof val === "number" && Number.isFinite(val) && val >= 1) {
13903
13905
  return Math.floor(val);
13904
13906
  }
@@ -13908,7 +13910,7 @@ function resolveProgressGuardConfig(options, env = typeof process !== "undefined
13908
13910
  return parsed;
13909
13911
  }
13910
13912
  }
13911
- return fallback;
13913
+ return fallback2;
13912
13914
  };
13913
13915
  const maxConsecutiveIdenticalRounds = parsePositiveInt(
13914
13916
  options?.maxConsecutiveIdenticalRounds ?? env.NOLO_LOOP_MAX_IDENTICAL_ROUNDS,
@@ -14666,9 +14668,9 @@ function normalizeExecShellInput(input) {
14666
14668
  const record2 = input;
14667
14669
  let rawCommand = resolveShellCommandArg(record2);
14668
14670
  if (typeof rawCommand !== "string" || !rawCommand.trim()) {
14669
- const fallback = record2.command ?? record2.cmd;
14670
- if (typeof fallback === "string" && fallback.trim()) {
14671
- rawCommand = fallback;
14671
+ const fallback2 = record2.command ?? record2.cmd;
14672
+ if (typeof fallback2 === "string" && fallback2.trim()) {
14673
+ rawCommand = fallback2;
14672
14674
  }
14673
14675
  }
14674
14676
  const command = typeof rawCommand === "string" ? rawCommand.trim() : "";
@@ -15558,6 +15560,8 @@ async function hasRootGitignore(workspaceRoot) {
15558
15560
  var normalizePath = (value) => value.replaceAll("\\", "/");
15559
15561
  var pathFor = (root, file, absolute = false) => absolute ? normalizePath(file) : normalizePath(relative2(root, file) || basename2(file));
15560
15562
  var COMMAND_LIMIT_HEADROOM = 1;
15563
+ var MAX_SEARCH_FILE_BYTES = 8 * 1024 * 1024;
15564
+ var MAX_SEARCH_LINE_CHARS = 2e3;
15561
15565
  async function runCommand(binary, args2, cwd, maxResults) {
15562
15566
  const recordLimit = maxResults === void 0 ? 0 : Math.max(0, maxResults) + COMMAND_LIMIT_HEADROOM;
15563
15567
  return await new Promise((done4) => {
@@ -15565,7 +15569,12 @@ async function runCommand(binary, args2, cwd, maxResults) {
15565
15569
  try {
15566
15570
  const child = spawnChildProcess(binary, args2, { cwd, stdio: ["ignore", "pipe", "pipe"], windowsHide: true });
15567
15571
  child.stdout.on("data", (chunk) => {
15568
- stdout += chunk.toString();
15572
+ const room = MAX_SEARCH_FILE_BYTES - stdout.length;
15573
+ stdout += chunk.toString().slice(0, Math.max(0, room));
15574
+ if (stdout.length >= MAX_SEARCH_FILE_BYTES && !stopped) {
15575
+ stopped = true;
15576
+ child.kill();
15577
+ }
15569
15578
  recordCount = parseMatches(cwd, stdout).length;
15570
15579
  if (recordLimit > 0 && recordCount >= recordLimit && !stopped) {
15571
15580
  stopped = true;
@@ -15595,14 +15604,14 @@ function isGrepExpressibleExclude(pattern) {
15595
15604
  }
15596
15605
  function commandArgs(o, binary, target) {
15597
15606
  const args2 = binary === "rg" ? ["--line-number", "--no-heading", "--color", "never", "--null"] : ["-RIn", "--binary-files=without-match", "--null"];
15598
- if (binary === "rg") args2.push("--no-require-git");
15607
+ if (binary === "rg") args2.push("--no-require-git", "--max-columns", String(MAX_SEARCH_LINE_CHARS), "--max-columns-preview");
15599
15608
  if (o.regex !== true) args2.push(binary === "rg" ? "--fixed-strings" : "-F");
15600
15609
  else if (binary === "grep") args2.push("-E");
15601
15610
  if (o.caseSensitive === false) args2.push("-i");
15602
15611
  if (binary === "rg") {
15603
15612
  if (o.includeIgnored) args2.push("--no-ignore");
15604
15613
  for (const x of o.exclude ?? []) args2.push("--glob", `!${x}`);
15605
- if (o.include) args2.push("--glob", o.include);
15614
+ if (o.include) args2.push("--type-add", `noloSearch:${o.include}`, "--type", "noloSearch");
15606
15615
  } else {
15607
15616
  for (const x of o.exclude ?? []) {
15608
15617
  const clean = extractGrepExcludeDir(x);
@@ -15622,24 +15631,32 @@ function parseMatches(root, output) {
15622
15631
  return records;
15623
15632
  }
15624
15633
  async function decorate(root, raw, context3, absolute = false) {
15625
- const cache = /* @__PURE__ */ new Map(), out = [];
15634
+ const out = [];
15626
15635
  for (const x of raw) {
15627
- let lines = cache.get(x.file);
15628
- if (!lines) {
15636
+ let lines = [];
15637
+ if (context3 > 0) {
15629
15638
  try {
15630
- lines = (await readFile3(x.file, "utf8")).split(/\r\n|\r|\n/);
15639
+ if ((await stat3(x.file)).size <= MAX_SEARCH_FILE_BYTES) {
15640
+ lines = (await readFile3(x.file, "utf8")).split(/\r\n|\r|\n/);
15641
+ }
15631
15642
  } catch {
15632
- continue;
15633
15643
  }
15634
- cache.set(x.file, lines);
15635
15644
  }
15636
15645
  const i = x.line - 1;
15637
- out.push({ path: pathFor(root, x.file, absolute), line: x.line, text: lines[i] ?? x.text, before: lines.slice(Math.max(0, i - context3), i), after: lines.slice(i + 1, i + context3 + 1) });
15646
+ out.push({
15647
+ path: pathFor(root, x.file, absolute),
15648
+ line: x.line,
15649
+ text: (lines[i] ?? x.text).slice(0, MAX_SEARCH_LINE_CHARS),
15650
+ before: lines.slice(Math.max(0, i - context3), i).map((line) => line.slice(0, MAX_SEARCH_LINE_CHARS)),
15651
+ after: lines.slice(i + 1, i + context3 + 1).map((line) => line.slice(0, MAX_SEARCH_LINE_CHARS))
15652
+ });
15638
15653
  }
15639
15654
  return out;
15640
15655
  }
15641
15656
  function globMatch(pattern, value) {
15642
15657
  const p = normalizePath(pattern).replace(/^!/, "");
15658
+ const brace = /\{([^{}]+)\}/.exec(p);
15659
+ if (brace) return brace[1].split(",").some((part) => globMatch(p.slice(0, brace.index) + part + p.slice(brace.index + brace[0].length), value));
15643
15660
  let source = "";
15644
15661
  for (let i = 0; i < p.length; i++) {
15645
15662
  const c = p[i];
@@ -15689,6 +15706,8 @@ async function jsSearch(o, targetPath) {
15689
15706
  const needle = o.caseSensitive === false ? o.query.toLowerCase() : o.query;
15690
15707
  const out = [], context3 = o.contextLines ?? 0;
15691
15708
  for (const file of files) {
15709
+ const info = await stat3(file).catch(() => null);
15710
+ if (!info || info.size > MAX_SEARCH_FILE_BYTES) continue;
15692
15711
  const text2 = await readText(file);
15693
15712
  if (!text2 || text2.includes("\0")) continue;
15694
15713
  const lines = text2.split(/\r\n|\r|\n/);
@@ -15697,7 +15716,7 @@ async function jsSearch(o, targetPath) {
15697
15716
  const hit = matcher ? matcher.test(line) : o.caseSensitive === false ? line.toLowerCase().includes(needle) : line.includes(needle);
15698
15717
  if (!hit) continue;
15699
15718
  if (out.length >= max4) return { matches: out, totalMatches: max4, truncated: true, engine: "js" };
15700
- out.push({ path: pathFor(o.root, file, o.absolutePaths === true), line: i + 1, text: line, before: lines.slice(Math.max(0, i - context3), i), after: lines.slice(i + 1, i + context3 + 1) });
15719
+ out.push({ path: pathFor(o.root, file, o.absolutePaths === true), line: i + 1, text: line.slice(0, MAX_SEARCH_LINE_CHARS), before: lines.slice(Math.max(0, i - context3), i).map((line2) => line2.slice(0, MAX_SEARCH_LINE_CHARS)), after: lines.slice(i + 1, i + context3 + 1).map((line2) => line2.slice(0, MAX_SEARCH_LINE_CHARS)) });
15701
15720
  }
15702
15721
  }
15703
15722
  return { matches: out, totalMatches: out.length, truncated: false, engine: "js" };
@@ -15730,6 +15749,7 @@ async function searchFileTextMatches(o) {
15730
15749
  if (targetStat.isFile()) return jsSearch(o, targetPath);
15731
15750
  const run2 = o.runCommand ?? runCommand, max4 = o.maxResults;
15732
15751
  for (const entry of COMMAND_ENGINES) {
15752
+ if (entry.engine === "ripgrep" && o.include && /[/\\]/.test(o.include)) continue;
15733
15753
  if (entry.engine === "grep" && !await canGrepFulfillOptions(o)) continue;
15734
15754
  const injectedResolver = o[entry.binaryOption];
15735
15755
  const binary = injectedResolver ? injectedResolver() : resolveExecutableOnPath(entry.binaryName);
@@ -15777,6 +15797,7 @@ var TASK_WAIT_DEFAULT_TIMEOUT_MS = 5 * 6e4;
15777
15797
  var TASK_WAIT_MAX_TIMEOUT_MS = 5 * 6e4;
15778
15798
  var TASK_WAIT_POLL_INTERVAL_MS = 250;
15779
15799
  var TASK_STOP_GRACE_MS = 2e3;
15800
+ var TASK_STOP_POLL_INTERVAL_MS = 40;
15780
15801
  function resolveCleanupReport(evidence, previousStatus) {
15781
15802
  const diagnostic = evidence.diagnostic ? { diagnostic: evidence.diagnostic } : {};
15782
15803
  if (evidence.confirmedStopped) {
@@ -15998,8 +16019,17 @@ async function runTaskStop(args2) {
15998
16019
  )
15999
16020
  };
16000
16021
  }
16001
- if (graceMs > 0) await sleep3(graceMs);
16002
- if (!isProcessGroupAlive(record2.pgid, kill)) {
16022
+ let alive = isProcessGroupAlive(record2.pgid, kill);
16023
+ if (alive && graceMs > 0) {
16024
+ let remaining = graceMs;
16025
+ while (remaining > 0 && alive) {
16026
+ const step = Math.min(TASK_STOP_POLL_INTERVAL_MS, remaining);
16027
+ await sleep3(step);
16028
+ remaining -= step;
16029
+ alive = isProcessGroupAlive(record2.pgid, kill);
16030
+ }
16031
+ }
16032
+ if (!alive) {
16003
16033
  return {
16004
16034
  outcome: "stopped",
16005
16035
  taskId,
@@ -16044,6 +16074,7 @@ var WORKSPACE_TOOL_NAMES = [
16044
16074
  "writeFile",
16045
16075
  "editFile",
16046
16076
  "globFiles",
16077
+ "searchFiles",
16047
16078
  "captureVisualState",
16048
16079
  "execShell",
16049
16080
  "launchProcess",
@@ -16393,6 +16424,31 @@ function buildWorkspaceToolDefinition(toolName) {
16393
16424
  if (toolName === "editFile") {
16394
16425
  return buildReplaceWorkspaceTextTool();
16395
16426
  }
16427
+ if (toolName === "searchFiles") {
16428
+ return {
16429
+ type: "function",
16430
+ function: {
16431
+ name: "searchFiles",
16432
+ description: "Search UTF-8 text files in the workspace by literal string or regex (works across code, docs, notes, and data files on Windows/macOS/Linux; respects .gitignore by default and stops early at maxResults). Prefer searchFiles over shell grep/rg/Select-String.",
16433
+ parameters: {
16434
+ type: "object",
16435
+ properties: {
16436
+ query: { type: "string", minLength: 1, description: "Search text. Also accepts pattern when query is omitted (grep/rg alias compatibility)." },
16437
+ path: buildWorkspacePathProperty(),
16438
+ regex: { type: "boolean", description: "Default false: search for a literal string. Set true for regex." },
16439
+ caseSensitive: { type: "boolean", description: "Default true." },
16440
+ include: { type: "string", description: "File glob filter, e.g. *.{ts,md}." },
16441
+ exclude: { type: "array", items: { type: "string" } },
16442
+ contextLines: { type: "integer", minimum: 0, maximum: 5 },
16443
+ maxResults: { type: "integer", minimum: 1, maximum: 1e3, description: "Default 100; stop early after this many matches." },
16444
+ includeIgnored: { type: "boolean", description: "Default false: respect .gitignore." }
16445
+ },
16446
+ required: ["query"],
16447
+ additionalProperties: false
16448
+ }
16449
+ }
16450
+ };
16451
+ }
16396
16452
  if (toolName === "globFiles") {
16397
16453
  return buildGlobWorkspaceFilesTool();
16398
16454
  }
@@ -16721,25 +16777,6 @@ async function readRootGitignorePatterns2(workspaceRoot) {
16721
16777
  return readRootGitignorePatterns(workspaceRoot);
16722
16778
  }
16723
16779
  var DEFAULT_LOCAL_API_ORIGIN = "http://127.0.0.1:38123";
16724
- var ALWAYS_EXCLUDED_GLOBS = [
16725
- ".git/**",
16726
- ".nolo/**",
16727
- "node_modules/**",
16728
- "*.tsbuildinfo",
16729
- "dist/**",
16730
- "build/**",
16731
- "out/**",
16732
- "coverage/**",
16733
- ".next/**",
16734
- ".turbo/**",
16735
- "public/assets/**",
16736
- "*.min.js",
16737
- "*.min.css",
16738
- "*.map",
16739
- "*.lock",
16740
- "bun.lockb",
16741
- "*.ldb"
16742
- ];
16743
16780
  function readTrimmedString(value) {
16744
16781
  return asOptionalTrimmedString(value);
16745
16782
  }
@@ -17616,22 +17653,24 @@ async function internalSearchWorkspace(args2) {
17616
17653
  root: inside ? workspaceRoot : searchPath,
17617
17654
  target: inside ? normalizeWorkspaceRelativePath({ workspaceRoot, targetPath: searchPath }) : ".",
17618
17655
  query: args2.query,
17619
- regex: true,
17656
+ regex: args2.regex ?? true,
17620
17657
  caseSensitive: args2.caseSensitive !== false,
17621
17658
  contextLines: args2.contextLines,
17622
17659
  maxResults: args2.maxResults ?? 200,
17623
- includeIgnored: args2.workspaceRoot.includes(".worktrees") || !inside,
17660
+ includeIgnored: args2.includeIgnored ?? (args2.workspaceRoot.includes(".worktrees") || !inside),
17624
17661
  absolutePaths: !inside,
17625
- exclude: inside ? [...ALWAYS_EXCLUDED_GLOBS] : []
17662
+ exclude: [...inside ? ALWAYS_EXCLUDED_GLOBS : [], ...args2.exclude ?? []],
17663
+ include: args2.include,
17664
+ resolveRipgrepBinary: args2.resolveRipgrepBinary,
17665
+ resolveGrepBinary: args2.resolveGrepBinary
17626
17666
  });
17627
17667
  const outputLines = result4.matches.flatMap((match7) => [
17628
17668
  ...match7.before.map((line, index) => `${match7.path}:${Math.max(1, match7.line - match7.before.length + index)}-${line}`),
17629
17669
  `${match7.path}:${match7.line}:${match7.text}`,
17630
17670
  ...match7.after.map((line, index) => `${match7.path}:${match7.line + index + 1}-${line}`)
17631
17671
  ]);
17632
- const rawContent = outputLines.join("\n");
17672
+ const rawContent = scrubSecrets(outputLines.join("\n")).cleaned;
17633
17673
  const content = truncateToolOutput(rawContent, SEARCH_OUTPUT_CHAR_LIMIT);
17634
- const matchLines = result4.matches.map((match7) => `${match7.path}:${match7.line}:${match7.text}`);
17635
17674
  return {
17636
17675
  content,
17637
17676
  metadata: {
@@ -17640,6 +17679,7 @@ async function internalSearchWorkspace(args2) {
17640
17679
  searchedPath: inside ? normalizeWorkspaceRelativePath({ workspaceRoot, targetPath: searchPath }) : ".",
17641
17680
  count: outputLines.length,
17642
17681
  matchCount: result4.totalMatches,
17682
+ totalMatches: result4.totalMatches,
17643
17683
  matchedFiles: Array.from(new Set(result4.matches.map((match7) => match7.path))),
17644
17684
  truncated: result4.truncated || content.length !== rawContent.length,
17645
17685
  limitedByMaxResults: result4.truncated,
@@ -18256,6 +18296,36 @@ function createLocalWorkspaceToolExecutors(args2) {
18256
18296
  workspaceRoot: args2.workspaceRoot,
18257
18297
  ...fileAccess
18258
18298
  }),
18299
+ searchFiles: async (call) => {
18300
+ const parsed = parseWorkspaceToolArguments(call.arguments);
18301
+ const query = parsed.query === void 0 ? parsed.pattern : parsed.query;
18302
+ if (typeof query !== "string" || !query.length) throw new Error("searchFiles requires a non-empty query.");
18303
+ for (const key of ["regex", "caseSensitive", "includeIgnored"]) {
18304
+ if (parsed[key] !== void 0 && typeof parsed[key] !== "boolean") throw new Error(`${key} must be a boolean.`);
18305
+ }
18306
+ for (const key of ["path", "include"]) {
18307
+ if (parsed[key] !== void 0 && typeof parsed[key] !== "string") throw new Error(`${key} must be a string.`);
18308
+ }
18309
+ if (parsed.exclude !== void 0 && (!Array.isArray(parsed.exclude) || !parsed.exclude.every((item) => typeof item === "string"))) throw new Error("exclude must be an array of strings.");
18310
+ for (const [key, min4, max4] of [["contextLines", 0, 5], ["maxResults", 1, 1e3]]) {
18311
+ if (parsed[key] !== void 0 && (!Number.isInteger(parsed[key]) || Number(parsed[key]) < min4 || Number(parsed[key]) > max4)) throw new Error(`${key} must be an integer from ${min4} to ${max4}.`);
18312
+ }
18313
+ return internalSearchWorkspace({
18314
+ workspaceRoot: args2.workspaceRoot,
18315
+ query,
18316
+ path: parsed.path,
18317
+ regex: parsed.regex === true,
18318
+ caseSensitive: parsed.caseSensitive !== false,
18319
+ include: parsed.include,
18320
+ exclude: parsed.exclude ?? [],
18321
+ contextLines: parsed.contextLines,
18322
+ maxResults: parsed.maxResults ?? 100,
18323
+ includeIgnored: parsed.includeIgnored === true,
18324
+ confirmExternalFileAccess: args2.confirmExternalFileAccess,
18325
+ resolveRipgrepBinary: args2.resolveRipgrepBinary,
18326
+ resolveGrepBinary: args2.resolveGrepBinary
18327
+ });
18328
+ },
18259
18329
  globFiles: (call) => globFilesTool({
18260
18330
  call,
18261
18331
  workspaceRoot: args2.workspaceRoot,
@@ -18476,6 +18546,9 @@ function validateToolArguments(args2) {
18476
18546
  }
18477
18547
  record2 = parsed;
18478
18548
  }
18549
+ if (toolName === "searchFiles" && record2.query === void 0 && typeof record2.pattern === "string" && record2.pattern.length) {
18550
+ record2 = { ...record2, query: record2.pattern };
18551
+ }
18479
18552
  for (const field of requiredFields) {
18480
18553
  if (record2[field] !== void 0) continue;
18481
18554
  if (isAliasSatisfied(record2, field)) continue;
@@ -18560,6 +18633,7 @@ var DEFAULT_LOCAL_TOOLS = /* @__PURE__ */ new Set([
18560
18633
  "writeFile",
18561
18634
  "editFile",
18562
18635
  "globFiles",
18636
+ "searchFiles",
18563
18637
  "execShell",
18564
18638
  "launchProcess",
18565
18639
  "listProcesses",
@@ -19315,6 +19389,137 @@ function createTurnUsageLedger(args2) {
19315
19389
  };
19316
19390
  }
19317
19391
 
19392
+ // packages/agent-runtime/agentRunIsolation.ts
19393
+ var ORCHESTRATION_TOOL_NAMES = /* @__PURE__ */ new Set([
19394
+ "startAgentRun",
19395
+ "controlAgentRun",
19396
+ "listAgents",
19397
+ "readAgent",
19398
+ "runStreamingAgent"
19399
+ ]);
19400
+ var INTERACTION_REQUIRED_TOOL_NAMES = /* @__PURE__ */ new Set([
19401
+ "ask_user",
19402
+ // 凭据请求:需要宿主交互面板(Block 1a);desktop 无通道时同 ask_user 剥离。
19403
+ "secret-request"
19404
+ ]);
19405
+ var SELF_MUTATION_TOOL_NAMES = /* @__PURE__ */ new Set([
19406
+ "updateSelf",
19407
+ "updateAgent"
19408
+ ]);
19409
+ var SUBTASK_REMOVED_TOOL_NAMES = /* @__PURE__ */ new Set([
19410
+ ...ORCHESTRATION_TOOL_NAMES,
19411
+ ...INTERACTION_REQUIRED_TOOL_NAMES,
19412
+ ...SELF_MUTATION_TOOL_NAMES
19413
+ ]);
19414
+ function isSubtaskRun(env) {
19415
+ if (!env) return false;
19416
+ const value = env.NOLO_AGENT_RUN_CHILD;
19417
+ return typeof value === "string" && value.length > 0 && value !== "0";
19418
+ }
19419
+ var RUN_WAKE_CHANNEL_ENV = "NOLO_RUN_WAKE";
19420
+ function hasRunWakeChannel(env) {
19421
+ if (!env) return false;
19422
+ const value = env[RUN_WAKE_CHANNEL_ENV];
19423
+ return typeof value === "string" && value.length > 0 && value !== "0";
19424
+ }
19425
+ function filterToolNamesForRunKind(toolNames, isSubtask) {
19426
+ if (!isSubtask) return [...toolNames];
19427
+ return toolNames.filter((name) => !SUBTASK_REMOVED_TOOL_NAMES.has(name));
19428
+ }
19429
+
19430
+ // packages/agent-runtime/subtaskBudget.ts
19431
+ var DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_1_TOOL_CALLS = 40;
19432
+ var DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_2_TOOL_CALLS = 80;
19433
+ var SUBTASK_SOFT_BUDGET_MILESTONE_1_PREFIX = "[\u7CFB\u7EDF\u63D0\u793A \xB7 \u5B50\u4EFB\u52A1\u8F6F\u9884\u7B97\u63D0\u9192]";
19434
+ var SUBTASK_SOFT_BUDGET_MILESTONE_2_PREFIX = "[\u7CFB\u7EDF\u63D0\u793A \xB7 \u5B50\u4EFB\u52A1\u5F3A\u6536\u655B\u63D0\u9192]";
19435
+ function buildSubtaskSoftBudgetMilestone1Prompt(toolCallCount) {
19436
+ return `${SUBTASK_SOFT_BUDGET_MILESTONE_1_PREFIX} \u5F53\u524D\u5B50\u4EFB\u52A1\u5DF2\u7D2F\u8BA1\u6267\u884C ${toolCallCount} \u6B21\u5DE5\u5177\u8C03\u7528\uFF0C\u8BF7\u505A\u4E00\u6B21\u6536\u655B\u81EA\u68C0\uFF1A\u82E5\u6838\u5FC3\u76EE\u6807\u4E0E\u5FC5\u9700\u9A8C\u8BC1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u5C3D\u5FEB\u6574\u7406\u7ED3\u679C\u5E76\u6536\u655B\u4EA4\u4ED8\uFF1B\u82E5\u540C\u4E00\u62A5\u9519\u5DF2\u8FDE\u7EED\u91CD\u8BD5\u4E14\u65E0\u65B0\u8BC1\u636E\uFF0C\u8BF7\u505C\u6B62\u76F2\u8BD5\u5E76\u5728\u7ED3\u679C\u4E2D\u5982\u5B9E\u62A5\u544A\u6839\u56E0\u4E0E\u963B\u788D\uFF1B\u82E5\u786E\u7CFB\u6B63\u5E38\u7684\u591A\u6587\u4EF6\u4FEE\u6539\u6216\u9A8C\u8BC1\u5DE5\u4F5C\uFF0C\u53EF\u7EE7\u7EED\u7A33\u6B65\u5B8C\u6210\u3002`;
19437
+ }
19438
+ function buildSubtaskSoftBudgetMilestone2Prompt(toolCallCount) {
19439
+ return `${SUBTASK_SOFT_BUDGET_MILESTONE_2_PREFIX} \u5F53\u524D\u5B50\u4EFB\u52A1\u5DF2\u7D2F\u8BA1\u6267\u884C ${toolCallCount} \u6B21\u5DE5\u5177\u8C03\u7528\u3002\u5EFA\u8BAE\u5728\u5B8C\u6210\u5F53\u524D\u624B\u5934\u6700\u540E\u4E00\u6B65\u5FC5\u8981\u9A8C\u8BC1\u540E\uFF0C\u7ACB\u5373\u6574\u7406\u5DF2\u6709\u6210\u679C\u3001\u672A\u5B8C\u6210\u9879\u4E0E\u5EFA\u8BAE\u7684\u4E0B\u4E00\u6B65\u76F4\u63A5\u4EA4\u4ED8\u7236\u5BF9\u8BDD\uFF0C\u907F\u514D\u5355\u6B21\u5B50\u4EFB\u52A1\u8FC7\u5EA6\u6D88\u8017\u914D\u989D\u4E0E\u4E0A\u4E0B\u6587\u3002`;
19440
+ }
19441
+ function resolveSoftBudgetEnv(explicitEnv) {
19442
+ if (explicitEnv !== void 0) return explicitEnv;
19443
+ if (typeof process !== "undefined" && process.env) return process.env;
19444
+ return void 0;
19445
+ }
19446
+ function isEnvSoftBudgetDisabled(env) {
19447
+ const raw = env?.NOLO_SUBTASK_SOFT_BUDGET?.trim().toLowerCase();
19448
+ return raw === "0" || raw === "false";
19449
+ }
19450
+ function hasParentDialogEnvSignal(env) {
19451
+ const raw = env?.NOLO_PARENT_DIALOG_ID;
19452
+ return typeof raw === "string" && raw.trim().length > 0;
19453
+ }
19454
+ function normalizeThreshold(value) {
19455
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
19456
+ return void 0;
19457
+ }
19458
+ return Math.floor(value);
19459
+ }
19460
+ function createSubtaskSoftBudgetAdvisor(options) {
19461
+ const env = resolveSoftBudgetEnv(options?.env);
19462
+ const envDisabled = isEnvSoftBudgetDisabled(env);
19463
+ const configDisabled = options?.softBudget === false || typeof options?.softBudget === "object" && options.softBudget !== null && options.softBudget.enabled === false;
19464
+ const configEnabled = options?.softBudget === true || typeof options?.softBudget === "object" && options.softBudget !== null && options.softBudget.enabled !== false;
19465
+ const hasSubtaskContext = options?.isSubtask === true || options?.runKind === "subtask" || hasParentDialogEnvSignal(env) || isSubtaskRun(env);
19466
+ const enabled = !envDisabled && !configDisabled && (configEnabled || hasSubtaskContext);
19467
+ const rawConfig = typeof options?.softBudget === "object" && options.softBudget !== null ? options.softBudget : void 0;
19468
+ const milestone1ToolCalls = normalizeThreshold(rawConfig?.milestone1ToolCalls) ?? DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_1_TOOL_CALLS;
19469
+ const explicitMilestone2 = normalizeThreshold(rawConfig?.milestone2ToolCalls);
19470
+ const milestone2ToolCalls = explicitMilestone2 !== void 0 ? Math.max(milestone1ToolCalls + 1, explicitMilestone2) : Math.max(
19471
+ DEFAULT_SUBTASK_SOFT_BUDGET_MILESTONE_2_TOOL_CALLS,
19472
+ milestone1ToolCalls * 2
19473
+ );
19474
+ let milestone1Triggered = false;
19475
+ let milestone2Triggered = false;
19476
+ let lastObservedToolCallCount = 0;
19477
+ function observeToolCalls(toolCallCount) {
19478
+ const normalized = typeof toolCallCount === "number" && Number.isFinite(toolCallCount) && toolCallCount > 0 ? Math.floor(toolCallCount) : 0;
19479
+ if (normalized > lastObservedToolCallCount) {
19480
+ lastObservedToolCallCount = normalized;
19481
+ }
19482
+ if (!enabled) return null;
19483
+ if (!milestone2Triggered && normalized >= milestone2ToolCalls) {
19484
+ milestone1Triggered = true;
19485
+ milestone2Triggered = true;
19486
+ return {
19487
+ milestone: 2,
19488
+ threshold: milestone2ToolCalls,
19489
+ toolCallCount: normalized,
19490
+ message: buildSubtaskSoftBudgetMilestone2Prompt(normalized)
19491
+ };
19492
+ }
19493
+ if (!milestone1Triggered && normalized >= milestone1ToolCalls) {
19494
+ milestone1Triggered = true;
19495
+ return {
19496
+ milestone: 1,
19497
+ threshold: milestone1ToolCalls,
19498
+ toolCallCount: normalized,
19499
+ message: buildSubtaskSoftBudgetMilestone1Prompt(normalized)
19500
+ };
19501
+ }
19502
+ return null;
19503
+ }
19504
+ function getState2() {
19505
+ return {
19506
+ enabled,
19507
+ milestone1ToolCalls,
19508
+ milestone2ToolCalls,
19509
+ milestone1Triggered,
19510
+ milestone2Triggered,
19511
+ lastObservedToolCallCount
19512
+ };
19513
+ }
19514
+ return {
19515
+ enabled,
19516
+ milestone1ToolCalls,
19517
+ milestone2ToolCalls,
19518
+ observeToolCalls,
19519
+ getState: getState2
19520
+ };
19521
+ }
19522
+
19318
19523
  // packages/agent-runtime/leafFinalHandoff.ts
19319
19524
  var LEAF_FINAL_HANDOFF_INSTRUCTIONS = `Leaf subtask final: return only the result, blockers/findings, and minimal evidence the parent needs. Do not narrate your process or restate the task. Keep success concise without dropping the current delivery scope, unresolved blockers or evidence references; on failure include the blocker, severity when relevant, and an evidence reference (file:line, test command, commit, artifact, or run/dialog). If the task explicitly requires a long-form deliverable (document, translation, dataset, code, or other artifact), provide that deliverable in full and keep only the handoff around it concise. During execution, follow the brief as given: keep progress updates incremental to the brief; the final report must stand alone with the complete current delivery scope, unresolved blockers and evidence references, including on continuation; only when new evidence would materially change the goal, risk, irreversibility, or DoD should you surface it as a blocker/finding \u2014 do not silently expand scope or re-litigate the settled direction. Own investigation, implementation, related checks and failure fixes within the brief\u2019s scope and budget; leave goals and critical decisions to the parent. For required DoD checks, include the worktree, checked version (including uncommitted change scope), command, check scope, pass/fail and original-output reference; explicitly mark checks not run or evidence unavailable. Reuse valid same-version evidence; additional checks are warranted for version changes, missing/conflicting evidence or integration risk. Do not invent version metadata. Process done/exit 0 and assistant claims do not establish passing tests, user acceptance, independent review approval, integration or release; runtime acceptance is observations only and unknown remains unknown. Preserve a requested reviewer JSON/checkVerdict format; do not wrap it in another report. Keep success concise without omitting required evidence.`;
19320
19525
 
@@ -19379,8 +19584,17 @@ function findSummaryAnchorIndex(bridged, anchorId) {
19379
19584
  const index = Number(legacy[1]);
19380
19585
  return Number.isSafeInteger(index) && index < bridged.length ? index : -1;
19381
19586
  }
19382
- function logSummarySourceDiagnostics(phase, dialogId, history, anchor) {
19587
+ function logSummarySourceDiagnostics(phase, dialogId, history, anchor, segmentDiff) {
19383
19588
  const sourceHash = hashSummarySourceSlice(history, anchor)?.slice(0, 16);
19589
+ if (phase === "invalidated" && segmentDiff) {
19590
+ console.log(`[compaction-source] ${JSON.stringify({
19591
+ phase,
19592
+ dialogId,
19593
+ sourceHash,
19594
+ kind: "segment-diff",
19595
+ ...segmentDiff
19596
+ })}`);
19597
+ }
19384
19598
  const rows = buildSummarySourceDiagnostics(toPlanCompressionMessages(history), anchor);
19385
19599
  for (const row of rows) console.log(`[compaction-source] ${JSON.stringify({
19386
19600
  phase,
@@ -19578,13 +19792,15 @@ async function maybeAutoCompactLocalHistory(args2) {
19578
19792
  let reason;
19579
19793
  if (invalidStored?.schemaVersion !== void 0 && invalidStored.schemaVersion !== COMPACTION_SUMMARY_SCHEMA_VERSION) {
19580
19794
  reason = "schema-version-mismatch";
19581
- } else if (typeof invalidStored?.summarizedBeforeId !== "string" || !bridged.some((m) => m.id === invalidStored.summarizedBeforeId)) {
19795
+ } else if (typeof invalidStored?.summarizedBeforeId !== "string" || findSummaryAnchorIndex(bridged, invalidStored.summarizedBeforeId) === -1) {
19582
19796
  reason = "anchor-not-found";
19583
19797
  } else if (typeof invalidStored?.sourceCount === "number" && history.length < invalidStored.sourceCount) {
19584
19798
  reason = "history-trimmed";
19585
19799
  } else {
19586
19800
  reason = "hash-mismatch";
19587
19801
  }
19802
+ const currentSegments = buildSummarySourceSegments(bridged, invalidStored?.summarizedBeforeId);
19803
+ const segmentDiff = reason === "hash-mismatch" ? diffSummarySourceSegments(invalidStored?.sourceSegments, currentSegments) : void 0;
19588
19804
  console.warn(
19589
19805
  `[localLoop] invalidated dialog summary for ${dialogId} (${reason}); discarding and re-compressing`,
19590
19806
  // 诊断分项(**仅加日志,不改任何哈希/校验/重锚语义**):区分「历史真被改写」
@@ -19597,10 +19813,17 @@ async function maybeAutoCompactLocalHistory(args2) {
19597
19813
  storedSourceCount: typeof invalidStored?.sourceCount === "number" ? invalidStored.sourceCount : null,
19598
19814
  summarizedBeforeId: typeof invalidStored?.summarizedBeforeId === "string" ? invalidStored.summarizedBeforeId : null,
19599
19815
  recomputedHashPrefix: hashSummarySourceSlice(history, invalidStored?.summarizedBeforeId)?.slice(0, 8) ?? null,
19600
- storedHashPrefix: typeof invalidStored?.sourceHash === "string" && invalidStored.sourceHash ? invalidStored.sourceHash.slice(0, 8) : null
19816
+ storedHashPrefix: typeof invalidStored?.sourceHash === "string" && invalidStored.sourceHash ? invalidStored.sourceHash.slice(0, 8) : null,
19817
+ ...segmentDiff ? { segmentDiff } : {}
19601
19818
  }
19602
19819
  );
19603
- logSummarySourceDiagnostics("invalidated", dialogId, history, invalidStored?.summarizedBeforeId);
19820
+ logSummarySourceDiagnostics(
19821
+ "invalidated",
19822
+ dialogId,
19823
+ history,
19824
+ invalidStored?.summarizedBeforeId,
19825
+ segmentDiff
19826
+ );
19604
19827
  stored = null;
19605
19828
  }
19606
19829
  const existingSummary = typeof stored?.summary === "string" ? stored.summary : "";
@@ -19610,7 +19833,7 @@ async function maybeAutoCompactLocalHistory(args2) {
19610
19833
  const contextWindow = typeof args2.contextWindow === "number" && Number.isFinite(args2.contextWindow) && args2.contextWindow > 0 ? args2.contextWindow : getModelContextWindow(args2.model ?? "");
19611
19834
  const allMsgs = toPlanCompressionMessages(prepareHistoryForNextTurn(history, args2.contextReferenceResolver));
19612
19835
  const maxInputItems = resolveProviderInputItemLimit({ provider: args2.provider, endpoint: args2.providerEndpoint });
19613
- const force = args2.force === true || args2.requestOverBudget?.(
19836
+ const force = args2.force === true || invalidSummary || args2.requestOverBudget?.(
19614
19837
  existingSummary ? projectHistoryWithSummary({ history, summary: existingSummary, summarizedBeforeId }) : history
19615
19838
  ) === true;
19616
19839
  const plan = planCompression({
@@ -19847,20 +20070,20 @@ async function maybeAutoCompactLocalHistory(args2) {
19847
20070
  });
19848
20071
  }
19849
20072
  };
19850
- const fallback = args2.summaryFallback?.preferPlatform ? args2.summaryFallback : void 0;
20073
+ const fallback2 = args2.summaryFallback?.preferPlatform ? args2.summaryFallback : void 0;
19851
20074
  let eligibility;
19852
- const routedFallback = fallback ? Object.assign(
20075
+ const routedFallback = fallback2 ? Object.assign(
19853
20076
  async (content, options) => {
19854
20077
  summaryModel = PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL;
19855
20078
  summaryProvider = "nolo";
19856
- return physicalRequest("platform", () => fallback(content, { ...options, attemptId: compactionAttemptId }));
20079
+ return physicalRequest("platform", () => fallback2(content, { ...options, attemptId: compactionAttemptId }));
19857
20080
  },
19858
20081
  {
19859
- preferPlatform: (options) => eligibility ??= fallback.preferPlatform(options),
19860
- ...fallback.complete ? { complete: async (content, options) => {
20082
+ preferPlatform: (options) => eligibility ??= fallback2.preferPlatform(options),
20083
+ ...fallback2.complete ? { complete: async (content, options) => {
19861
20084
  summaryModel = PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL;
19862
20085
  summaryProvider = "nolo";
19863
- return physicalRequest("platform", () => fallback.complete(content, { ...options, attemptId: compactionAttemptId }));
20086
+ return physicalRequest("platform", () => fallback2.complete(content, { ...options, attemptId: compactionAttemptId }));
19864
20087
  } } : {}
19865
20088
  }
19866
20089
  ) : void 0;
@@ -20034,8 +20257,13 @@ async function maybeAutoCompactLocalHistory(args2) {
20034
20257
  }
20035
20258
  };
20036
20259
  }
20260
+ const bridgedHistory = toPlanCompressionMessages(history);
20037
20261
  const sourceMeta = await computeSummarySourceMetadata(
20038
- toPlanCompressionMessages(history),
20262
+ bridgedHistory,
20263
+ bounded3.summarizedBeforeId
20264
+ );
20265
+ const sourceSegments = buildSummarySourceSegments(
20266
+ bridgedHistory,
20039
20267
  bounded3.summarizedBeforeId
20040
20268
  );
20041
20269
  if (Date.now() >= summaryDeadlineMs) throw Object.assign(new Error("Summary deadline exceeded"), { compactionReason: "timeout" });
@@ -20043,7 +20271,7 @@ async function maybeAutoCompactLocalHistory(args2) {
20043
20271
  throw Object.assign(new Error("auto-compaction aborted"), { compactionReason: "aborted" });
20044
20272
  }
20045
20273
  const saveT0 = Date.now();
20046
- await adapter.saveDialogSummary({
20274
+ const summarySavePayload = {
20047
20275
  dialogId,
20048
20276
  summary: newSummary,
20049
20277
  summarizedBeforeId: bounded3.summarizedBeforeId,
@@ -20051,12 +20279,14 @@ async function maybeAutoCompactLocalHistory(args2) {
20051
20279
  sourceHash: sourceMeta?.sourceHash,
20052
20280
  sourceCount: sourceMeta?.sourceCount ?? 0,
20053
20281
  schemaVersion: COMPACTION_SUMMARY_SCHEMA_VERSION,
20282
+ ...sourceSegments.length > 0 ? { sourceSegments } : {},
20054
20283
  referenceKeys: Array.from(
20055
20284
  new Set(
20056
20285
  history.slice(0, sourceMeta?.sourceCount ?? 0).flatMap((message) => extractReferenceKeysFromMessage(message))
20057
20286
  )
20058
20287
  )
20059
- });
20288
+ };
20289
+ await adapter.saveDialogSummary(summarySavePayload);
20060
20290
  saveElapsedMs = Date.now() - saveT0;
20061
20291
  logSummarySourceDiagnostics("saved", dialogId, history, bounded3.summarizedBeforeId);
20062
20292
  console.log(formatCompactionMetricsLog(metrics));
@@ -20239,7 +20469,7 @@ function createTurnCompactionController(args2) {
20239
20469
  return { history: result4.history, applied: result4.history !== history, usage: result4.usage };
20240
20470
  };
20241
20471
  let lastCompactionOutcome;
20242
- const prepareRequest = async (requestOverBudget, initial = false, availableHistoryTokens) => {
20472
+ const prepareRequest = async (requestOverBudget, initial = false, availableHistoryTokens, force = false) => {
20243
20473
  lastCompactionOutcome = void 0;
20244
20474
  const contextUsage = args2.getContextUsage();
20245
20475
  let inputTokens = contextUsage ? normalizeUsage(contextUsage).input_tokens : 0;
@@ -20251,8 +20481,8 @@ function createTurnCompactionController(args2) {
20251
20481
  }
20252
20482
  }
20253
20483
  const ratio = inputTokens > 0 ? Math.min(1, inputTokens / args2.contextWindow) : void 0;
20254
- if (!requestOverBudget && ratio !== void 0 && ratio < args2.compressionTriggerRatio * 0.85 && resolveProviderInputItemLimit({ provider: args2.provider, endpoint: args2.providerEndpoint }) === void 0) {
20255
- return;
20484
+ if (!force && !requestOverBudget && ratio !== void 0 && ratio < args2.compressionTriggerRatio * 0.85 && resolveProviderInputItemLimit({ provider: args2.provider, endpoint: args2.providerEndpoint }) === void 0) {
20485
+ return false;
20256
20486
  }
20257
20487
  try {
20258
20488
  const compacted = await maybeAutoCompactLocalHistory({
@@ -20272,6 +20502,7 @@ function createTurnCompactionController(args2) {
20272
20502
  providerEndpoint: args2.providerEndpoint,
20273
20503
  resolveProvider: args2.resolveProvider,
20274
20504
  contextWindow: args2.contextWindow,
20505
+ ...force ? { force: true } : {},
20275
20506
  ...ratio !== void 0 ? { realContextUsagePercent: ratio } : {},
20276
20507
  abortSignal: args2.abortSignal,
20277
20508
  timeoutMs: args2.timeoutMs,
@@ -20298,12 +20529,16 @@ function createTurnCompactionController(args2) {
20298
20529
  args2.onSelectedSummary?.(compacted.selectedSummary ?? { outcome: initial ? "absent" : "unknown" });
20299
20530
  }
20300
20531
  emitObservation(compacted);
20532
+ return Boolean(compacted.compressed && compacted.summaryGenerated);
20301
20533
  } catch (error) {
20302
20534
  lastCompactionOutcome = { ...lastCompactionOutcome, error: classifySummaryError(error) };
20303
20535
  console.warn("[localLoop] in-loop auto-compaction failed:", error);
20536
+ return false;
20304
20537
  }
20305
20538
  };
20306
- return { getLastCompactionOutcome: () => lastCompactionOutcome, runInitial, maybeCompactInLoop: () => prepareRequest(), forceCompact, prepareRequest };
20539
+ return { getLastCompactionOutcome: () => lastCompactionOutcome, runInitial, maybeCompactInLoop: async () => {
20540
+ await prepareRequest();
20541
+ }, forceCompact, prepareRequest };
20307
20542
  }
20308
20543
 
20309
20544
  // packages/agent-runtime/providerCallTelemetry.ts
@@ -20824,7 +21059,8 @@ async function runLocalAgentTurn(input) {
20824
21059
  // 防止 session-scope 的 agentCollaboration 段逐轮翻转击穿前缀缓存。
20825
21060
  dispatchIntent: detectDispatchIntentFromMessages(history) || detectDispatchIntent(
20826
21061
  typeof input.input === "string" ? input.input : void 0
20827
- )
21062
+ ),
21063
+ runKind: input.runKind
20828
21064
  });
20829
21065
  const callerScopes = normalizeContextBlockScopes(
20830
21066
  input.contextBlocks,
@@ -20862,24 +21098,8 @@ async function runLocalAgentTurn(input) {
20862
21098
  ] : []
20863
21099
  ];
20864
21100
  const mergedContextBlockScopes = [
20865
- // 删除安全红线:系统层最高优先级约束,位于所有块之前(含身份信息块),
20866
- // owner 要求常驻「根本提示词」的最顶部(2026-09-26 批量误删事故)。
20867
- { content: DELETE_SAFETY_RED_LINE, cacheScope: "session" },
20868
- // 凭据纪律:与红线同为系统层固定块,紧随其后(四条装配线同源)。
20869
- { content: CREDENTIAL_HYGIENE_RULE, cacheScope: "session" },
20870
- // 并行是默认:系统层固定块,紧随红线(localLoop 无 static 作用域,用 session 占位,
20871
- // 「最顶」由数组首位保证——与红线同一约定)。
20872
- { content: VERIFY_BEFORE_CONCLUDING_RULE, cacheScope: "session" },
20873
- { content: PARALLEL_DISPATCH_DEFAULT_RULE, cacheScope: "session" },
20874
- // 派发落点:并行派发纪律的下一层(派到哪个执行后端),沿用 session 占位约定。
20875
- { content: DISPATCH_BACKEND_POLICY, cacheScope: "session" },
20876
- { content: DISPATCH_CANDIDATE_POLICY, cacheScope: "session" },
20877
- // 平台风控纪律:无条件系统层块,沿用 session 占位约定。
20878
- { content: PLATFORM_RISK_CONTROL_RULE, cacheScope: "session" },
20879
- { content: buildConsultationModeBlock(), cacheScope: "session" },
20880
- // Git 任务隔离:系统层固定前置,四条装配线同序(请教模式之后、身份信息之前;
20881
- // skill 配置 disabled 也注入)。
20882
- { content: WORKTREE_ISOLATION_PRELUDE, cacheScope: "session" },
21101
+ // 顶部固定平台层(唯一真源见 platformStaticPromptLayers.ts;localLoop 无 static 作用域,session 占位)。
21102
+ ...buildPlatformStaticScopedBlocks(),
20883
21103
  { content: identityBlock, cacheScope: "session" },
20884
21104
  ...guidanceScopes,
20885
21105
  // 回复行为准则:local 线(CLI 非交互 / 桌面 / TUI)的唯一注入边界。
@@ -21031,6 +21251,12 @@ async function runLocalAgentTurn(input) {
21031
21251
  let skipFinalAppend = false;
21032
21252
  let partialContent = "";
21033
21253
  const progressGuard = createLocalLoopProgressGuard(input.progressGuardConfig);
21254
+ const softBudgetAdvisor = createSubtaskSoftBudgetAdvisor({
21255
+ softBudget: input.softBudget,
21256
+ isSubtask: input.isSubtask,
21257
+ runKind: input.runKind,
21258
+ ...input.softBudgetEnv ? { env: input.softBudgetEnv } : {}
21259
+ });
21034
21260
  let pendingInjectionCommits = [];
21035
21261
  let inFlightTransactions = [];
21036
21262
  let rollbackInjectionCommits = async () => {
@@ -21152,7 +21378,7 @@ async function runLocalAgentTurn(input) {
21152
21378
  });
21153
21379
  imageDowngradeEmitted = true;
21154
21380
  }
21155
- const requestMessages = projectRequest(transcript.working());
21381
+ let requestMessages = projectRequest(transcript.working());
21156
21382
  if (requestOverBudget(requestMessages)) {
21157
21383
  const budget = evaluateLocalRequestBudget({
21158
21384
  messages: requestMessages,
@@ -21173,7 +21399,7 @@ async function runLocalAgentTurn(input) {
21173
21399
  }));
21174
21400
  }
21175
21401
  budgetTrimPhase = contextPhase("budget-trim", requestMessages, { droppedCount: 0 });
21176
- const contextMetrics = {
21402
+ let contextMetrics = {
21177
21403
  ...preparedMessages.metrics,
21178
21404
  messageCount: requestMessages.length,
21179
21405
  contentChars: requestMessages.reduce(
@@ -21195,8 +21421,8 @@ async function runLocalAgentTurn(input) {
21195
21421
  input.onToolEvent || input.onObservationEvent || input.observationBoundary
21196
21422
  );
21197
21423
  let llmStreamActivity = 0;
21198
- const callStartedAt = Date.now();
21199
- const requestTelemetry = buildRequestTelemetry({
21424
+ let callStartedAt = Date.now();
21425
+ let requestTelemetry = buildRequestTelemetry({
21200
21426
  // 无 dialogId 的新对话用本 turn 唯一键,避免不同新对话共用一个槽误报漂移。
21201
21427
  dialogKey: input.continueDialogId || newDialogTelemetryKey,
21202
21428
  messages: requestMessages,
@@ -21235,83 +21461,148 @@ async function runLocalAgentTurn(input) {
21235
21461
  throw error;
21236
21462
  }
21237
21463
  }
21238
- let providerInvoked = false;
21239
- try {
21240
- result4 = await runCompleteWithTimeout({
21241
- provider: { complete: (messages2, options) => {
21242
- providerInvoked = true;
21243
- inFlightTransactions = [];
21244
- return provider.complete(messages2, options);
21245
- } },
21464
+ const tryOverflowRescueCompaction = async () => {
21465
+ const beforeTokens = estimateLocalRequestInput(requestMessages);
21466
+ const compacted = await compaction.prepareRequest((source) => {
21467
+ const projected = composeProviderMessages({
21468
+ prefix: transcript.working().slice(0, prefixCount),
21469
+ history: source,
21470
+ contextReferenceResolver: input.adapter.host === "cli" ? input.contextReferenceResolver : void 0
21471
+ });
21472
+ return requestOverBudget(projectRequest(projected.messages));
21473
+ }, false, availableHistoryTokens, true);
21474
+ if (!compacted) return false;
21475
+ const nextPrepared = prepareMessagesForProviderCall(transcript.working());
21476
+ const nextRequestMessages = projectRequest(transcript.working());
21477
+ const afterTokens = estimateLocalRequestInput(nextRequestMessages);
21478
+ if (afterTokens >= beforeTokens || requestOverBudget(nextRequestMessages)) return false;
21479
+ requestMessages = nextRequestMessages;
21480
+ contextMetrics = {
21481
+ ...nextPrepared.metrics,
21482
+ messageCount: requestMessages.length,
21483
+ contentChars: requestMessages.reduce(
21484
+ (total, message) => total + contentCharCount(message.content),
21485
+ 0
21486
+ ),
21487
+ stableContextChars: builtMessages.stableContextChars,
21488
+ dynamicContextChars: builtMessages.dynamicContextChars
21489
+ };
21490
+ callStartedAt = Date.now();
21491
+ requestTelemetry = buildRequestTelemetry({
21492
+ dialogKey: input.continueDialogId || newDialogTelemetryKey,
21246
21493
  messages: requestMessages,
21247
- options: {
21248
- timeoutMs: resolveLlmRequestTimeoutMs(input),
21249
- // 用户取消信号穿进 provider options:providerStreamRetry 据此在
21250
- // 取消后跳过重试,provider 分支(如 antigravity/openai-compatible)
21251
- // 也可把 fetch 绑定到同一信号,实现真正的传输层取消。
21252
- ...input.abortSignal ? { signal: input.abortSignal } : {},
21253
- // 计费归因:续聊轮次带上 dialogId,platform proxy 才能把 token 记录
21254
- // 归到具体对话而不是 chat-proxy 兜底桶。新对话首轮 id 尚未分配。
21255
- ...input.continueDialogId ? { dialogId: input.continueDialogId } : {},
21256
- ...shouldStreamDeltas ? { onTextDelta: (chunk) => {
21257
- llmStreamActivity += 1;
21258
- partialContent += chunk;
21259
- observationBoundary.emit({
21260
- kind: "text-delta",
21261
- chunk,
21262
- round,
21263
- atMs: Date.now()
21264
- });
21265
- } } : {},
21266
- ...shouldStreamReasoning ? { onReasoningDelta: (chunk) => {
21267
- llmStreamActivity += 1;
21268
- observationBoundary.emit({
21269
- kind: "reasoning-delta",
21270
- chunk,
21271
- round,
21272
- atMs: Date.now()
21273
- });
21274
- } } : {},
21275
- ...shouldPassToolEvents ? { onToolEvent: (event) => {
21276
- llmStreamActivity += 1;
21277
- observationBoundary.emit({
21278
- kind: "tool-event",
21279
- event,
21280
- round,
21281
- atMs: Date.now()
21282
- });
21283
- } } : {},
21284
- ...shouldPassToolEvents ? { toolEventRound: round } : {}
21494
+ provenance: {
21495
+ schemaVersion: 1,
21496
+ transport: provider.transport ?? "unknown",
21497
+ phases: [historyLoadedPhase, summaryProjectedPhase, budgetTrimPhase, contextPhase("final-request", requestMessages)],
21498
+ summary: selectedSummary
21285
21499
  },
21286
- timeoutMs: resolveLlmRequestTimeoutMs(input),
21287
- activityVersion: () => llmStreamActivity,
21288
- round,
21289
- input,
21290
- boundary: observationBoundary,
21291
- context: contextMetrics,
21292
- providerName: agentConfig.provider,
21293
- model: provider.model
21500
+ toolsHash: safeToolNamesHash(agentTools)
21294
21501
  });
21295
- } catch (error) {
21296
- if (!providerInvoked && inFlightTransactions.length > 0) {
21297
- const toRollback = inFlightTransactions;
21298
- inFlightTransactions = [];
21299
- try {
21300
- await rollbackInjectionCommits(toRollback);
21301
- } catch (rbErr) {
21302
- error = combineRollbackError(error, rbErr);
21502
+ resetToolImageDelivery(requestMessages.flatMap(toolImages));
21503
+ return true;
21504
+ };
21505
+ let overflowRescueAttempted = false;
21506
+ while (true) {
21507
+ llmStreamActivity = 0;
21508
+ partialContent = "";
21509
+ let providerInvoked = false;
21510
+ try {
21511
+ result4 = await runCompleteWithTimeout({
21512
+ provider: { complete: (messages2, options) => {
21513
+ providerInvoked = true;
21514
+ inFlightTransactions = [];
21515
+ return provider.complete(messages2, options);
21516
+ } },
21517
+ messages: requestMessages,
21518
+ options: {
21519
+ timeoutMs: resolveLlmRequestTimeoutMs(input),
21520
+ // 用户取消信号穿进 provider options:providerStreamRetry 据此在
21521
+ // 取消后跳过重试,provider 分支(如 antigravity/openai-compatible)
21522
+ // 也可把 fetch 绑定到同一信号,实现真正的传输层取消。
21523
+ ...input.abortSignal ? { signal: input.abortSignal } : {},
21524
+ // 计费归因:续聊轮次带上 dialogId,platform proxy 才能把 token 记录
21525
+ // 归到具体对话而不是 chat-proxy 兜底桶。新对话首轮 id 尚未分配。
21526
+ ...input.continueDialogId ? { dialogId: input.continueDialogId } : {},
21527
+ ...shouldStreamDeltas ? { onTextDelta: (chunk) => {
21528
+ llmStreamActivity += 1;
21529
+ partialContent += chunk;
21530
+ observationBoundary.emit({
21531
+ kind: "text-delta",
21532
+ chunk,
21533
+ round,
21534
+ atMs: Date.now()
21535
+ });
21536
+ } } : {},
21537
+ ...shouldStreamReasoning ? { onReasoningDelta: (chunk) => {
21538
+ llmStreamActivity += 1;
21539
+ observationBoundary.emit({
21540
+ kind: "reasoning-delta",
21541
+ chunk,
21542
+ round,
21543
+ atMs: Date.now()
21544
+ });
21545
+ } } : {},
21546
+ ...shouldPassToolEvents ? { onToolEvent: (event) => {
21547
+ llmStreamActivity += 1;
21548
+ observationBoundary.emit({
21549
+ kind: "tool-event",
21550
+ event,
21551
+ round,
21552
+ atMs: Date.now()
21553
+ });
21554
+ } } : {},
21555
+ ...shouldPassToolEvents ? { toolEventRound: round } : {}
21556
+ },
21557
+ timeoutMs: resolveLlmRequestTimeoutMs(input),
21558
+ activityVersion: () => llmStreamActivity,
21559
+ round,
21560
+ input,
21561
+ boundary: observationBoundary,
21562
+ context: contextMetrics,
21563
+ providerName: agentConfig.provider,
21564
+ model: provider.model
21565
+ });
21566
+ } catch (error) {
21567
+ if (!providerInvoked && inFlightTransactions.length > 0) {
21568
+ const toRollback = inFlightTransactions;
21569
+ inFlightTransactions = [];
21570
+ try {
21571
+ await rollbackInjectionCommits(toRollback);
21572
+ } catch (rbErr) {
21573
+ error = combineRollbackError(error, rbErr);
21574
+ }
21575
+ }
21576
+ if (providerInvoked) usageLedger.recordProviderCall({
21577
+ model: agentConfig.model,
21578
+ telemetry: {
21579
+ ...requestTelemetry,
21580
+ round,
21581
+ endTs: Date.now(),
21582
+ requestState: input.abortSignal?.aborted ? "cancelled" : "failed"
21583
+ }
21584
+ });
21585
+ if (providerInvoked && !overflowRescueAttempted && llmStreamActivity === 0 && !input.abortSignal?.aborted && isContextOverflowText(toErrorMessage(error))) {
21586
+ overflowRescueAttempted = true;
21587
+ if (await tryOverflowRescueCompaction()) {
21588
+ continue;
21589
+ }
21303
21590
  }
21591
+ throw error;
21304
21592
  }
21305
- if (providerInvoked) usageLedger.recordProviderCall({
21306
- model: agentConfig.model,
21307
- telemetry: {
21308
- ...requestTelemetry,
21309
- round,
21310
- endTs: Date.now(),
21311
- requestState: input.abortSignal?.aborted ? "cancelled" : "failed"
21593
+ if ((result4.error || result4.runtimeProviderFailure) && !overflowRescueAttempted && llmStreamActivity === 0 && !input.abortSignal?.aborted && isContextOverflowText(result4.runtimeProviderFailure?.message ?? result4.errorMessage ?? "")) {
21594
+ overflowRescueAttempted = true;
21595
+ usageLedger.recordProviderCall({
21596
+ usage: result4.usage,
21597
+ model: result4.model ?? agentConfig.model,
21598
+ provider: result4.provider,
21599
+ telemetry: { ...finalizeCallTelemetry(requestTelemetry, result4, round, callStartedAt), requestState: "failed" }
21600
+ });
21601
+ if (await tryOverflowRescueCompaction()) {
21602
+ continue;
21312
21603
  }
21313
- });
21314
- throw error;
21604
+ }
21605
+ break;
21315
21606
  }
21316
21607
  acceptToolImages.discard(requestMessages.flatMap(toolImages).filter((image) => toolImageDelivery(image) === "impossible"));
21317
21608
  acceptToolImages.commit(
@@ -21607,6 +21898,15 @@ ${reasoningTailLog}
21607
21898
  };
21608
21899
  break;
21609
21900
  }
21901
+ if (!input.abortSignal?.aborted) {
21902
+ const softBudgetAdvisory = softBudgetAdvisor.observeToolCalls(toolCallCount);
21903
+ if (softBudgetAdvisory) {
21904
+ transcript.push({
21905
+ role: "user",
21906
+ content: softBudgetAdvisory.message
21907
+ });
21908
+ }
21909
+ }
21610
21910
  loopTiming.mark("roundEnd", round);
21611
21911
  round += 1;
21612
21912
  }
@@ -23418,7 +23718,7 @@ async function saveCliPendingUserMessages(args2) {
23418
23718
  if (ops.length) await args2.store.batch(ops);
23419
23719
  }
23420
23720
  async function readCliPendingUserMessages(store, dialogId) {
23421
- const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-HVZAQCUD.js");
23721
+ const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-FHIMCBUK.js");
23422
23722
  const rows = await readDialogMessageRecords({ store, dialogId });
23423
23723
  const uncertain = rows.filter(({ record: record2 }) => record2.metadata?.cliBatchPhase === "requested" && !record2.metadata?.cliBatchResolution);
23424
23724
  const recovery = uncertain.length ? {
@@ -23547,7 +23847,15 @@ async function runNoloWorkspaceCliTool(call, args2) {
23547
23847
  }
23548
23848
  };
23549
23849
  }
23550
- async function readDialogInProcess(call, store, env) {
23850
+ function isLocalExclusiveDialog(dialogId, meta, localChildDialogIds) {
23851
+ if (localChildDialogIds?.has(dialogId)) return true;
23852
+ const record2 = meta;
23853
+ if (!record2 || typeof record2 !== "object") return false;
23854
+ if (record2.triggerType === "cli-agent-run") return true;
23855
+ return Boolean(record2.localRuntime) && record2.executionMode === "background";
23856
+ }
23857
+ var fallback = (reason) => ({ outcome: "fallback", reason });
23858
+ async function readDialogInProcess(call, store, ctx) {
23551
23859
  const args2 = parseNoloWorkspaceToolArguments(call.arguments);
23552
23860
  const dialogInput = noloStringArg(args2.dialog ?? args2.dialogId ?? args2.id);
23553
23861
  if (!dialogInput) throw new Error("readDialog requires dialog.");
@@ -23555,9 +23863,18 @@ async function readDialogInProcess(call, store, env) {
23555
23863
  if (mode && mode !== "full" && mode !== "status") {
23556
23864
  throw new Error(`readDialog mode must be "full" or "status", got "${mode}".`);
23557
23865
  }
23558
- const userId = noloStringArg(args2.user ?? args2.userId ?? args2.owner) || env?.NOLO_LOCAL_USER_ID || env?.NOLO_USER_ID || "";
23559
- const { dbKey: dialogKey, dialogId } = resolveNoloDialogInput(dialogInput, userId);
23560
- const meta = await store.read(dialogKey, { remote: false });
23866
+ if (noloStringArg(args2.user ?? args2.userId ?? args2.owner)) return fallback("explicit-user");
23867
+ if (noloStringArg(args2.server ?? args2.serverBase ?? args2.serverUrl)) return fallback("explicit-server");
23868
+ const currentUserId = ctx.currentUserId;
23869
+ if (!currentUserId) return fallback("no-current-user");
23870
+ const { dbKey: dialogKey, dialogId, ownerId } = resolveNoloDialogInput(dialogInput, currentUserId);
23871
+ if (ownerId !== currentUserId) return fallback("foreign-owner");
23872
+ const meta = await store.read(dialogKey);
23873
+ if (!meta) return fallback("local-miss");
23874
+ if (isTombstoneRecord(meta)) return fallback("tombstone");
23875
+ if (!isLocalExclusiveDialog(dialogId, meta, ctx.localChildDialogIds)) {
23876
+ return fallback("cross-device-sync");
23877
+ }
23561
23878
  if (mode === "status") {
23562
23879
  const result4 = {
23563
23880
  dialogId,
@@ -23568,8 +23885,11 @@ async function readDialogInProcess(call, store, env) {
23568
23885
  source: "in-process"
23569
23886
  };
23570
23887
  return {
23571
- content: JSON.stringify(result4, null, 2),
23572
- metadata: { noloWorkspaceTool: true, readDialog: true, inProcess: true, mode: "status" }
23888
+ outcome: "hit",
23889
+ result: {
23890
+ content: JSON.stringify(result4, null, 2),
23891
+ metadata: { noloWorkspaceTool: true, readDialog: true, inProcess: true, mode: "status" }
23892
+ }
23573
23893
  };
23574
23894
  }
23575
23895
  const limitNum = noloPositiveIntegerString(args2.limit);
@@ -23578,15 +23898,18 @@ async function readDialogInProcess(call, store, env) {
23578
23898
  maxResponseChars: DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
23579
23899
  ...limit !== void 0 ? { maxMessages: limit } : {}
23580
23900
  });
23901
+ let hasMessages = false;
23581
23902
  if (store.iterator) {
23582
23903
  const { start, end: end3 } = dialogMessageRange(dialogId);
23583
23904
  for await (const [, value] of store.iterator({ gte: start, lte: end3 })) {
23584
23905
  const message = localDialogMessageRecordToRuntimeMessage(value) ?? value;
23585
23906
  if (message) {
23907
+ hasMessages = true;
23586
23908
  projector.addMessage(message);
23587
23909
  }
23588
23910
  }
23589
23911
  }
23912
+ if (!hasMessages) return fallback("no-local-messages");
23590
23913
  const projected = projector.finish(meta);
23591
23914
  const built = buildDialogReadEnvelope({
23592
23915
  meta: projected.meta,
@@ -23600,22 +23923,83 @@ async function readDialogInProcess(call, store, env) {
23600
23923
  }
23601
23924
  });
23602
23925
  return {
23603
- content: built.serialized,
23604
- metadata: { noloWorkspaceTool: true, readDialog: true, inProcess: true }
23926
+ outcome: "hit",
23927
+ result: {
23928
+ content: built.serialized,
23929
+ metadata: { noloWorkspaceTool: true, readDialog: true, inProcess: true }
23930
+ }
23605
23931
  };
23606
23932
  }
23607
23933
  function buildNoloWorkspaceCliToolExecutors(args2) {
23608
23934
  const executors = {};
23609
23935
  for (const toolName of CLI_NOLO_WORKSPACE_TOOL_NAMES) {
23610
23936
  if (toolName === "loadSkill") continue;
23611
- if (toolName === "readDialog" && args2.store) {
23612
- executors[toolName] = (call) => readDialogInProcess(call, args2.store, args2.env);
23937
+ const inProcess = args2.inProcessExecutors?.[toolName];
23938
+ const storeBackedRead = toolName === "readDialog" && Boolean(args2.store || args2.resolveDialogStore);
23939
+ if (inProcess || storeBackedRead) {
23940
+ executors[toolName] = createInProcessWithCliFallback(args2, inProcess);
23613
23941
  continue;
23614
23942
  }
23615
23943
  executors[toolName] = (call) => runNoloWorkspaceCliTool(call, args2);
23616
23944
  }
23617
23945
  return executors;
23618
23946
  }
23947
+ function createInProcessWithCliFallback(args2, inProcess) {
23948
+ return async (call) => {
23949
+ let fallbackReason;
23950
+ try {
23951
+ if (inProcess) {
23952
+ const result4 = await inProcess(call, { env: args2.env });
23953
+ if (result4) return result4;
23954
+ fallbackReason = "local-miss";
23955
+ } else {
23956
+ const currentUserId = resolveHostCurrentUserId(args2);
23957
+ const store = await resolveInProcessDialogStore(args2);
23958
+ const outcome = store ? await readDialogInProcess(call, store, {
23959
+ env: args2.env,
23960
+ currentUserId,
23961
+ localChildDialogIds: resolveLocalChildDialogIds(args2)
23962
+ }) : { outcome: "fallback", reason: "no-store" };
23963
+ if (outcome.outcome === "hit") return outcome.result;
23964
+ fallbackReason = outcome.reason;
23965
+ }
23966
+ } catch (error) {
23967
+ fallbackReason = error instanceof Error ? error.message : String(error);
23968
+ }
23969
+ const bridged = await runNoloWorkspaceCliTool(call, args2);
23970
+ return {
23971
+ ...bridged,
23972
+ metadata: { ...bridged.metadata, inProcessFallback: fallbackReason }
23973
+ };
23974
+ };
23975
+ }
23976
+ async function resolveInProcessDialogStore(args2) {
23977
+ if (args2.store) return args2.store;
23978
+ if (!args2.resolveDialogStore) return void 0;
23979
+ try {
23980
+ return await args2.resolveDialogStore();
23981
+ } catch {
23982
+ return void 0;
23983
+ }
23984
+ }
23985
+ function resolveLocalChildDialogIds(args2) {
23986
+ try {
23987
+ return args2.resolveLocalChildDialogIds?.();
23988
+ } catch {
23989
+ return void 0;
23990
+ }
23991
+ }
23992
+ function resolveHostCurrentUserId(args2) {
23993
+ try {
23994
+ const injected = args2.resolveCurrentUserId?.();
23995
+ if (injected && injected.trim()) return injected.trim();
23996
+ if (args2.resolveCurrentUserId) return void 0;
23997
+ const derived = resolveLocalUserId(args2.env ?? {});
23998
+ return derived && derived.trim() ? derived.trim() : void 0;
23999
+ } catch {
24000
+ return void 0;
24001
+ }
24002
+ }
23619
24003
  var nodeSpawnFallback = (options) => {
23620
24004
  return spawnToWebStreams({ cmd: options.cmd, env: options.env });
23621
24005
  };
@@ -23636,7 +24020,7 @@ function buildLoadSkillExecutor(args2) {
23636
24020
  const { resolveSkillByName } = await import("./skillDiscovery-MDDKPTW3.js");
23637
24021
  const resolved = resolveSkillByName(args2.cwd, name);
23638
24022
  if (!resolved) {
23639
- const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-AYWYQVA4.js");
24023
+ const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-GHE3RD3V.js");
23640
24024
  const builtin = resolveBuiltinSkillByName(name);
23641
24025
  if (builtin) {
23642
24026
  const denied = await rejectDisabledBuiltin(args2.agentSkillSource, builtin.slug, name, args2.resolveAgentSkillSource);
@@ -23715,7 +24099,7 @@ async function loadPreciseSkill(cwd, parsed, agentSkillSource, resolveAgentSkill
23715
24099
  if (!nonEmpty(parsed.slug) || has2("projectBinding") || has2("relativePath")) {
23716
24100
  return reject("builtin requires only an exact slug.");
23717
24101
  }
23718
- const { listBuiltinSkills } = await import("./builtinSkillRegistry-AYWYQVA4.js");
24102
+ const { listBuiltinSkills } = await import("./builtinSkillRegistry-GHE3RD3V.js");
23719
24103
  const builtin = listBuiltinSkills().find((entry) => entry.slug === parsed.slug);
23720
24104
  if (!builtin) return reject("builtin slug not found.");
23721
24105
  const denied = await rejectDisabledBuiltin(agentSkillSource, builtin.slug, builtin.slug, resolveAgentSkillSource);
@@ -24453,6 +24837,11 @@ export {
24453
24837
  runExecShellGates,
24454
24838
  executeLocalToolWithPolicy,
24455
24839
  LOCAL_TURN_ABORTED_CODE,
24840
+ isSubtaskRun,
24841
+ RUN_WAKE_CHANNEL_ENV,
24842
+ hasRunWakeChannel,
24843
+ filterToolNamesForRunKind,
24844
+ findSummaryAnchorIndex,
24456
24845
  validateStoredSummary,
24457
24846
  projectContextProvenance,
24458
24847
  hashToolDefinitions,