nolo-cli 0.16.0 → 0.18.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 (134) hide show
  1. package/{_executeModel-AVCA2NAV.js → _executeModel-X5PCIZN6.js} +50 -44
  2. package/{action-F5JACQBG.js → action-LT7BRFLK.js} +10 -9
  3. package/{addContentAction-AQXEYRBE.js → addContentAction-PL3KKBDH.js} +9 -8
  4. package/{addDialogAgentAction-EJHHJZWW.js → addDialogAgentAction-FCMSKYAF.js} +8 -7
  5. package/{agentDeleteCommand-QW5PUMDQ.js → agentDeleteCommand-2BZDQV36.js} +32 -29
  6. package/{agentEmailCommands-4ORVLGVQ.js → agentEmailCommands-2QJDGRMB.js} +62 -56
  7. package/{agentListCommands-YWBYRTYC.js → agentListCommands-6VEPTKBI.js} +31 -28
  8. package/{agentMachineCommands-JSQW4FOA.js → agentMachineCommands-NVVHNWYI.js} +30 -27
  9. package/{agentPullCommand-6HWUT3SW.js → agentPullCommand-ZZGU5KOY.js} +4 -4
  10. package/{agentRecordCommands-AASIWOBT.js → agentRecordCommands-4GGRDMD4.js} +57 -51
  11. package/{agentRunCommand-TB5BHXUH.js → agentRunCommand-XOLQNKBZ.js} +63 -54
  12. package/{agentRunControl-6ADXVYMR.js → agentRunControl-Y5AFH5PQ.js} +24 -1
  13. package/{agentRuntimeLocal-QNPNJRVH.js → agentRuntimeLocal-7WYWCGL4.js} +25 -22
  14. package/{agentSlice-RUNXC62Y.js → agentSlice-EAXPGEYV.js} +9 -8
  15. package/appDeleteCommands-77KR2RJ4.js +127 -0
  16. package/appDeployCommands-K7CAHGBI.js +166 -0
  17. package/appDeployStatusCommands-4OEKLTBT.js +147 -0
  18. package/appGetCommands-VM2WDLAZ.js +122 -0
  19. package/appListCommands-GX6BBA6U.js +125 -0
  20. package/{authCommand-YFTR3347.js → authCommand-DY6UUL6O.js} +16 -9
  21. package/{authCommands-YXGOXNBZ.js → authCommands-XTBV7OFZ.js} +6 -5
  22. package/{chunk-DPAB4FQ7.js → chunk-23FZYPLC.js} +1608 -212
  23. package/{chunk-LPEUV5RE.js → chunk-34WPV75U.js} +23 -2
  24. package/{chunk-XPC5C7BK.js → chunk-3ND52WIL.js} +2 -2
  25. package/{chunk-SOTZ6RDN.js → chunk-3Q7WHGCB.js} +1 -1
  26. package/{chunk-3OIRVWXA.js → chunk-3ZX7PERL.js} +10 -1
  27. package/{chunk-KKY4B2Q2.js → chunk-4PWB7JRR.js} +4 -1
  28. package/{chunk-6N4KODMN.js → chunk-4T5F7YZQ.js} +1 -1
  29. package/chunk-7BUYEZ6U.js +671 -0
  30. package/{chunk-AS3ZQ3O2.js → chunk-7OBMZCRD.js} +1 -1
  31. package/{chunk-IGXREZW2.js → chunk-AHCY2S2I.js} +1 -1
  32. package/{chunk-QLUFR47U.js → chunk-AL2V7U3E.js} +1 -1
  33. package/{chunk-MTU75CZ2.js → chunk-B5TOXZAK.js} +1 -1
  34. package/{chunk-AUURUT6L.js → chunk-BV4VEE3W.js} +264 -424
  35. package/{chunk-FRV6A633.js → chunk-CZ6NYQTV.js} +13 -4
  36. package/{chunk-PCTUYVUM.js → chunk-DFCFMCY6.js} +10 -3
  37. package/{chunk-JTMNCCWF.js → chunk-DKZFOK24.js} +16 -87
  38. package/chunk-DL6EPNIK.js +50 -0
  39. package/{chunk-ZQBL7LIC.js → chunk-EDV7EBOI.js} +317 -216
  40. package/{chunk-IWLUTMYX.js → chunk-ELT65PZW.js} +2 -2
  41. package/chunk-FQZZLA3C.js +223 -0
  42. package/{chunk-55NSNCFM.js → chunk-FXUSIQC2.js} +1 -1
  43. package/{chunk-MR6ISAGB.js → chunk-G5U6LDLG.js} +6 -6
  44. package/chunk-GFUIQ4RY.js +136 -0
  45. package/{chunk-NVEWUJVX.js → chunk-HEGV7BH3.js} +1 -1
  46. package/{chunk-BEBNFWDU.js → chunk-HWW2M4SN.js} +3 -3
  47. package/{chunk-4L2OJPCU.js → chunk-I2ZJKTG5.js} +58 -8
  48. package/{chunk-Z5JQNBNY.js → chunk-IYEXFJPC.js} +34 -15
  49. package/{setDialogExtraReferencesAction-LR6MSIXO.js → chunk-JLA4FXYC.js} +2 -17
  50. package/chunk-KFEVY3ST.js +255 -0
  51. package/{chunk-4FX6NVDW.js → chunk-L4F3I4SR.js} +3 -136
  52. package/{chunk-XBS2WYJ2.js → chunk-LLWKHDG4.js} +1 -1
  53. package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
  54. package/{chunk-6EVITP2G.js → chunk-MHSGJW4Z.js} +2 -251
  55. package/{chunk-O6W2O2DA.js → chunk-MKA6QE5E.js} +6 -2
  56. package/{chunk-DGEYDWEZ.js → chunk-MPVYDS7I.js} +3 -3
  57. package/{chunk-KFHN5NGJ.js → chunk-MVQ4TBSD.js} +1 -1
  58. package/{chunk-AVVZUXXC.js → chunk-N54HIJVJ.js} +34 -13
  59. package/{chunk-EHLHSX7R.js → chunk-OK6YSWLH.js} +9 -2
  60. package/{chunk-33BJUVK4.js → chunk-PIZYJVHQ.js} +5 -5
  61. package/{chunk-RLCXU7A5.js → chunk-PJSV3IZ5.js} +1 -1
  62. package/{chunk-7UKFVQ5W.js → chunk-R35XMF6F.js} +126 -41
  63. package/{chunk-OOSFSFMA.js → chunk-R5V5G73M.js} +2 -0
  64. package/{chunk-S2LXHNHG.js → chunk-REA4JLBH.js} +6 -6
  65. package/chunk-RQN4SEKL.js +107 -0
  66. package/{chunk-EABWT43X.js → chunk-RVOUXDFU.js} +5 -5
  67. package/{chunk-NSCHQQPU.js → chunk-SCTYAHYK.js} +470 -325
  68. package/{chunk-JTINRTBT.js → chunk-SKDNBYZK.js} +2 -2
  69. package/{chunk-M43KDE25.js → chunk-SWDPIPOY.js} +2 -8
  70. package/{chunk-KMQPSTMJ.js → chunk-TRT4I4UD.js} +2 -2
  71. package/{chunk-66X4VSRC.js → chunk-UAIVG4J6.js} +42 -2
  72. package/{chunk-3663CXZN.js → chunk-UBHAWFQ6.js} +143 -31
  73. package/{chunk-YJKXGHJ6.js → chunk-UGUW3FHG.js} +4 -4
  74. package/{chunk-P3RIAYGG.js → chunk-V3ED5AWK.js} +3 -3
  75. package/chunk-V5R4NZP2.js +78 -0
  76. package/{chunk-4IJYA27C.js → chunk-VDXCXCXH.js} +1 -1
  77. package/{chunk-MYMMNKYL.js → chunk-VNAEBGDK.js} +156 -6
  78. package/{chunk-FY233ZFU.js → chunk-VYHDJEQD.js} +110 -192
  79. package/{chunk-W4NVOSFF.js → chunk-WFHXMLHZ.js} +1 -1
  80. package/{chunk-H33743XH.js → chunk-WJRJDX2W.js} +1 -1
  81. package/chunk-X4Q4UZEY.js +26 -0
  82. package/{chunk-RPDGJO4D.js → chunk-XHG22OEX.js} +4 -4
  83. package/{chunk-DVRHHFEA.js → chunk-XMLRJUU5.js} +1 -1
  84. package/{chunk-3S2VOMIF.js → chunk-XRZJGPFI.js} +7 -7
  85. package/{chunk-GSINCD4P.js → chunk-YGW4G5W5.js} +25 -12
  86. package/chunk-ZZ2MH7LE.js +84 -0
  87. package/{cliExecutor-K3F7DMRO.js → cliExecutor-DNE7TCC4.js} +2 -2
  88. package/codingSkills-36KN5NQT.js +48 -0
  89. package/{createAgentAutomationAction-FNHPSKKO.js → createAgentAutomationAction-GNFF524X.js} +20 -19
  90. package/{createDialogAction-TZCVQ3NU.js → createDialogAction-RB55KCLO.js} +22 -21
  91. package/{createPageAction-EIGZ3BKT.js → createPageAction-Y7343GLU.js} +26 -25
  92. package/{db-HCJ5PRB5.js → db-W3O47YGF.js} +38 -12
  93. package/{dbSlice-7KQH6GOU.js → dbSlice-CGSRFJN3.js} +8 -7
  94. package/{deleteFile-WPWVZE4B.js → deleteFile-WDZ3VM7B.js} +3 -3
  95. package/{dialogCommands-FO77J5DQ.js → dialogCommands-IAZK6YHQ.js} +30 -27
  96. package/{dialogSlice-MM5U4KE2.js → dialogSlice-UQAXF23P.js} +20 -19
  97. package/{docCreateCommands-I3BS3AZI.js → docCreateCommands-I2EWZGCI.js} +33 -28
  98. package/{docDeleteCommands-Q2OPV52P.js → docDeleteCommands-IZ45UZKG.js} +32 -27
  99. package/{docReadCommands-YOOFACYZ.js → docReadCommands-R6Z4QJYU.js} +31 -26
  100. package/{docStore-NGYQ2JTR.js → docStore-5HOJ4D7D.js} +21 -20
  101. package/{docUpdateCommands-2B32ITHN.js → docUpdateCommands-2LRBKQPY.js} +32 -27
  102. package/{fetchMessages-KTNM7QAR.js → fetchMessages-BMGVZVSE.js} +4 -3
  103. package/{getPricing-P4XRJRZB.js → getPricing-G7DLAST6.js} +3 -3
  104. package/{handleSendMessageAction-JRZWWBKP.js → handleSendMessageAction-Q4HY35WX.js} +21 -20
  105. package/index.js +95 -64
  106. package/{localDialogRead-2VRI24F4.js → localDialogRead-4H3QJFLW.js} +2 -2
  107. package/{localRuntimeDb-LGDF6FQP.js → localRuntimeDb-THJZGAOJ.js} +1 -1
  108. package/{machineCommands-WRWF2ICZ.js → machineCommands-PKBPQKTY.js} +63 -57
  109. package/{machineWsRunDispatch-ZX7Q3TWZ.js → machineWsRunDispatch-UZAW4OXJ.js} +55 -49
  110. package/{models-WQ5N4OJM.js → models-DJFSJ7SW.js} +2 -2
  111. package/package.json +1 -1
  112. package/queryRunOverlay-O4LOMMPO.js +161 -0
  113. package/{read-CN3TNXIP.js → read-3FMPZPER.js} +3 -3
  114. package/{readDocTool-WF3675ED.js → readDocTool-VSYHKK3V.js} +1 -1
  115. package/{readlineWorkspace-ZTGRGW46.js → readlineWorkspace-Y2RDOFZG.js} +762 -218
  116. package/{removeDialogAgentAction-YDHBFEGI.js → removeDialogAgentAction-OAGA2G3U.js} +10 -9
  117. package/{runAgentClientLoop-JZCOP7LG.js → runAgentClientLoop-NBPIKJ6J.js} +44 -38
  118. package/runOverlayPresentation-ZO4VCWEU.js +11 -0
  119. package/{runtimeDoctorCommands-THIHX2SY.js → runtimeDoctorCommands-E2OUORHK.js} +6 -6
  120. package/setDialogExtraReferencesAction-JZEXA5SL.js +27 -0
  121. package/{setPrimaryDialogAgentAction-IIVDCY5C.js → setPrimaryDialogAgentAction-4ZUQQKDG.js} +26 -17
  122. package/{settingSlice-O23YDK2O.js → settingSlice-7MNKHZ6R.js} +9 -8
  123. package/{skillDiscovery-6M2BZUFN.js → skillDiscovery-KJWT7JBU.js} +3 -3
  124. package/{spaceCommands-VV4GTPQK.js → spaceCommands-DHCZ7J5I.js} +31 -28
  125. package/{spaceSlice-DRWWZJP7.js → spaceSlice-ZXLLG3CR.js} +20 -19
  126. package/{streamAgentChatTurn-Y6WGATQR.js → streamAgentChatTurn-L3YW6LSB.js} +98 -57
  127. package/{tableCommands-3P7MJ3PF.js → tableCommands-BEQAGE4I.js} +1 -1
  128. package/{tools-PUNBY3AH.js → tools-ECGXR5QF.js} +33 -28
  129. package/{tuiSummaryLlmCaller-F64WLSAF.js → tuiSummaryLlmCaller-OMSCNHXA.js} +6 -5
  130. package/types-ZSTJ7MPR.js +7 -0
  131. package/{updateDialogTitleAction-YSR4TCMB.js → updateDialogTitleAction-HQ2EUDFT.js} +23 -22
  132. package/{chunk-O4BU24WZ.js → chunk-6Y7A3OQQ.js} +3 -3
  133. package/{chunk-CMKUBIGW.js → chunk-X7W4TNB4.js} +3 -3
  134. package/{localRuntimeAuthority-TEGCOWX4.js → localRuntimeAuthority-4IXJCHZ7.js} +3 -3
@@ -3,7 +3,20 @@ import {
3
3
  normalizeDialogRecord,
4
4
  readDialogSnapshot,
5
5
  sortDialogs
6
- } from "./chunk-P3RIAYGG.js";
6
+ } from "./chunk-V3ED5AWK.js";
7
+ import {
8
+ listFavoriteAgentIdsAcrossServers,
9
+ listLocalCachedAgents,
10
+ listRemoteAgents,
11
+ listRemoteAgentsAcrossServers
12
+ } from "./chunk-HWW2M4SN.js";
13
+ import "./chunk-ID4G2MAR.js";
14
+ import {
15
+ listUserRecordsFromServers
16
+ } from "./chunk-HEGV7BH3.js";
17
+ import {
18
+ buildOverlayPresentation
19
+ } from "./chunk-V5R4NZP2.js";
7
20
  import {
8
21
  ANSI_ESCAPE_REGEX,
9
22
  CLI_AUTO_TIER_AGENT_KEYS,
@@ -15,10 +28,12 @@ import {
15
28
  applyDetectedBackground,
16
29
  applyTerminalOutputToText,
17
30
  buildSkillContextBlocks,
31
+ buildWindowTitle,
18
32
  classifyCliAutoRoute,
19
33
  clearCollapsedPasteStore,
20
34
  countPhysicalLines,
21
35
  createCollapsedPasteStore,
36
+ detectSystemBrightnessFromEnv,
22
37
  dimCliText,
23
38
  displayWidth,
24
39
  expandRangeToCollapsedPasteChips,
@@ -30,8 +45,6 @@ import {
30
45
  getActiveDensity,
31
46
  getActiveThemeName,
32
47
  isBalanceExhaustedError,
33
- isQuotaExhaustedError,
34
- normalizeThinkingDisplayMode,
35
48
  normalizeToolDisplayMode,
36
49
  padOrTruncateToWidth,
37
50
  releaseCollapsedPaste,
@@ -58,119 +71,125 @@ import {
58
71
  visibleWidth,
59
72
  wrapTextToLines,
60
73
  wrapTranscriptLine
61
- } from "./chunk-AUURUT6L.js";
74
+ } from "./chunk-BV4VEE3W.js";
62
75
  import "./chunk-DZ3XJVET.js";
63
- import "./chunk-6HYVJV7B.js";
64
76
  import {
65
- listFavoriteAgentIdsAcrossServers,
66
- listLocalCachedAgents,
67
- listRemoteAgents,
68
- listRemoteAgentsAcrossServers
69
- } from "./chunk-BEBNFWDU.js";
70
- import "./chunk-ID4G2MAR.js";
77
+ getReadableCliDb
78
+ } from "./chunk-WFHXMLHZ.js";
71
79
  import {
72
- listUserRecordsFromServers
73
- } from "./chunk-NVEWUJVX.js";
80
+ deleteDbRecord,
81
+ queryUserRecords,
82
+ readDbRecord
83
+ } from "./chunk-DFCFMCY6.js";
74
84
  import {
75
85
  createCliLocalRuntimeAdapter,
76
86
  initCliLocale,
87
+ isQuotaExhaustedError,
77
88
  parseCliLocale,
89
+ readTimestamp,
78
90
  setCliLocale,
79
91
  t
80
- } from "./chunk-DPAB4FQ7.js";
81
- import "./chunk-EHLHSX7R.js";
82
- import {
83
- getReadableCliDb
84
- } from "./chunk-W4NVOSFF.js";
85
- import {
86
- deleteDbRecord,
87
- queryUserRecords,
88
- readDbRecord
89
- } from "./chunk-PCTUYVUM.js";
90
- import "./chunk-M43KDE25.js";
92
+ } from "./chunk-23FZYPLC.js";
93
+ import "./chunk-OK6YSWLH.js";
94
+ import "./chunk-SWDPIPOY.js";
91
95
  import {
92
96
  resolveCliAgentKeyInput
93
97
  } from "./chunk-VHBWHNVT.js";
94
98
  import "./chunk-LTRXGFMS.js";
95
- import "./chunk-KFHN5NGJ.js";
99
+ import "./chunk-MVQ4TBSD.js";
100
+ import "./chunk-6HYVJV7B.js";
96
101
  import "./chunk-JEXVIMYZ.js";
97
102
  import {
98
103
  prepareTools
99
- } from "./chunk-FRV6A633.js";
100
- import "./chunk-55NSNCFM.js";
104
+ } from "./chunk-CZ6NYQTV.js";
105
+ import "./chunk-FXUSIQC2.js";
101
106
  import {
102
107
  expandEnabledPacks
103
- } from "./chunk-ZQBL7LIC.js";
108
+ } from "./chunk-EDV7EBOI.js";
104
109
  import "./chunk-RQSOAMPJ.js";
105
- import "./chunk-3OIRVWXA.js";
110
+ import "./chunk-3ZX7PERL.js";
106
111
  import "./chunk-KQHGZWSV.js";
107
- import "./chunk-MR6ISAGB.js";
108
- import "./chunk-6N4KODMN.js";
112
+ import "./chunk-4T5F7YZQ.js";
109
113
  import "./chunk-3LY4F7SV.js";
110
- import "./chunk-VP4WJWKW.js";
111
- import "./chunk-63W5N6P3.js";
112
114
  import "./chunk-VF4K2QE6.js";
113
- import "./chunk-Z5JQNBNY.js";
114
- import "./chunk-VC6OZXO5.js";
115
+ import "./chunk-G5U6LDLG.js";
116
+ import {
117
+ initialRunOverlayState,
118
+ reduceRunOverlay
119
+ } from "./chunk-DL6EPNIK.js";
115
120
  import "./chunk-OWOHNGCN.js";
121
+ import "./chunk-JLA4FXYC.js";
122
+ import "./chunk-VP4WJWKW.js";
123
+ import "./chunk-63W5N6P3.js";
124
+ import "./chunk-WJRJDX2W.js";
125
+ import "./chunk-LM6IYQ3F.js";
126
+ import "./chunk-IYEXFJPC.js";
116
127
  import {
117
128
  extractReferenceKeysFromMessage
118
- } from "./chunk-NSCHQQPU.js";
129
+ } from "./chunk-SCTYAHYK.js";
119
130
  import {
120
131
  buildBuiltinSummaryContent
121
132
  } from "./chunk-XOIF2TNF.js";
133
+ import "./chunk-B5TOXZAK.js";
122
134
  import "./chunk-MRC4Q34M.js";
123
- import "./chunk-MTU75CZ2.js";
135
+ import "./chunk-REA4JLBH.js";
124
136
  import "./chunk-CWMSB67P.js";
125
- import "./chunk-S2LXHNHG.js";
126
- import "./chunk-RPDGJO4D.js";
127
- import "./chunk-SOTZ6RDN.js";
137
+ import "./chunk-XHG22OEX.js";
128
138
  import "./chunk-Z4NR32XR.js";
129
139
  import "./chunk-M76ECQRD.js";
140
+ import "./chunk-3Q7WHGCB.js";
130
141
  import {
131
142
  buildSkillDiscoveryContextBlock
132
- } from "./chunk-AS3ZQ3O2.js";
143
+ } from "./chunk-7OBMZCRD.js";
144
+ import "./chunk-7BUYEZ6U.js";
145
+ import "./chunk-VC6OZXO5.js";
133
146
  import "./chunk-WZSRQNQG.js";
134
147
  import {
135
148
  buildLocalWorkspaceOpenAiTools,
136
149
  buildLocalWorkspaceToolset,
137
150
  getProcessRegistry
138
- } from "./chunk-7UKFVQ5W.js";
151
+ } from "./chunk-R35XMF6F.js";
139
152
  import "./chunk-ZNFJWEN4.js";
140
- import "./chunk-AVVZUXXC.js";
153
+ import "./chunk-N54HIJVJ.js";
141
154
  import "./chunk-OIQPORYI.js";
142
155
  import {
143
156
  readCommandActionGatePayload,
144
157
  resolveAgentImageInputSupport
145
- } from "./chunk-GSINCD4P.js";
146
- import "./chunk-3WGLLTK4.js";
158
+ } from "./chunk-YGW4G5W5.js";
159
+ import "./chunk-LSFAWXKC.js";
147
160
  import {
148
161
  buildCurrentTimeBlock,
149
162
  buildIdentityBlock,
150
163
  buildRuntimeGuidanceBlocks
151
- } from "./chunk-LPEUV5RE.js";
164
+ } from "./chunk-34WPV75U.js";
165
+ import "./chunk-KFEVY3ST.js";
152
166
  import {
153
167
  resolvePlatformAuthToken
154
- } from "./chunk-6EVITP2G.js";
155
- import {
156
- canonicalizeToolNames
157
- } from "./chunk-JTMNCCWF.js";
168
+ } from "./chunk-MHSGJW4Z.js";
169
+ import "./chunk-DKZFOK24.js";
158
170
  import {
159
171
  DEFAULT_CONTEXT_WINDOW,
160
172
  estimateTokenCount,
161
173
  getModelContextWindow,
162
174
  planCompression,
163
175
  serializeMessageContent
164
- } from "./chunk-4L2OJPCU.js";
176
+ } from "./chunk-I2ZJKTG5.js";
165
177
  import {
166
178
  clipCompactText
167
179
  } from "./chunk-5MMAK75Q.js";
168
- import "./chunk-66X4VSRC.js";
169
180
  import "./chunk-5CS33IBL.js";
170
181
  import "./chunk-JZPBVBIY.js";
182
+ import "./chunk-UAIVG4J6.js";
171
183
  import "./chunk-ZHXJ6M7T.js";
172
- import "./chunk-QLUFR47U.js";
173
- import "./chunk-KKY4B2Q2.js";
184
+ import {
185
+ toErrorMessage
186
+ } from "./chunk-HNMXYYJR.js";
187
+ import "./chunk-ELT65PZW.js";
188
+ import "./chunk-AL2V7U3E.js";
189
+ import "./chunk-4PWB7JRR.js";
190
+ import {
191
+ canonicalizeToolNames
192
+ } from "./chunk-ZZ2MH7LE.js";
174
193
  import "./chunk-5MIDPSSK.js";
175
194
  import {
176
195
  extractCustomId
@@ -179,15 +198,25 @@ import "./chunk-3ASDTTEI.js";
179
198
  import {
180
199
  compactWhitespace
181
200
  } from "./chunk-DWLEOOGR.js";
182
- import "./chunk-MYMMNKYL.js";
183
- import "./chunk-CMKUBIGW.js";
184
- import "./chunk-JBTJAPUF.js";
185
- import "./chunk-ATNTHIZI.js";
186
201
  import {
187
- toErrorMessage
188
- } from "./chunk-HNMXYYJR.js";
189
- import "./chunk-H33743XH.js";
190
- import "./chunk-LM6IYQ3F.js";
202
+ checkStaleRun,
203
+ queryRunRecords,
204
+ readRunRecord
205
+ } from "./chunk-VNAEBGDK.js";
206
+ import {
207
+ clipText,
208
+ formatDuration,
209
+ formatRunAge,
210
+ getAgentRunStatusIcon,
211
+ isAgentNameFallback,
212
+ isAgentRunTerminalStatus,
213
+ resolveRunLabel,
214
+ runShowsLogTail,
215
+ shortRunId
216
+ } from "./chunk-FQZZLA3C.js";
217
+ import "./chunk-X7W4TNB4.js";
218
+ import "./chunk-ATNTHIZI.js";
219
+ import "./chunk-JBTJAPUF.js";
191
220
  import {
192
221
  runSelfUpdate
193
222
  } from "./chunk-K6EUAOW3.js";
@@ -208,24 +237,24 @@ import {
208
237
  import {
209
238
  DEFAULT_NOLO_SERVER_URL
210
239
  } from "./chunk-OLZBQWZU.js";
211
- import "./chunk-XBS2WYJ2.js";
212
- import "./chunk-O6W2O2DA.js";
213
- import "./chunk-YJKXGHJ6.js";
214
- import "./chunk-EABWT43X.js";
240
+ import "./chunk-LLWKHDG4.js";
241
+ import "./chunk-MKA6QE5E.js";
242
+ import "./chunk-UGUW3FHG.js";
243
+ import "./chunk-RVOUXDFU.js";
215
244
  import "./chunk-Y5GCAMGP.js";
216
245
  import "./chunk-KX6YBIHG.js";
217
- import "./chunk-IWLUTMYX.js";
218
- import "./chunk-3S2VOMIF.js";
219
- import "./chunk-O4BU24WZ.js";
220
- import "./chunk-I42VC5KR.js";
246
+ import "./chunk-XRZJGPFI.js";
247
+ import "./chunk-6Y7A3OQQ.js";
221
248
  import "./chunk-WWC7I6TA.js";
222
- import "./chunk-JTINRTBT.js";
249
+ import "./chunk-SKDNBYZK.js";
250
+ import "./chunk-I42VC5KR.js";
223
251
  import {
224
252
  asTrimmedLowercaseString
225
253
  } from "./chunk-QSJ3HFEF.js";
226
- import "./chunk-XPC5C7BK.js";
227
- import "./chunk-DVRHHFEA.js";
228
- import "./chunk-OOSFSFMA.js";
254
+ import "./chunk-X4Q4UZEY.js";
255
+ import "./chunk-3ND52WIL.js";
256
+ import "./chunk-XMLRJUU5.js";
257
+ import "./chunk-R5V5G73M.js";
229
258
  import "./chunk-GBRG75BQ.js";
230
259
  import "./chunk-3EUW3WEO.js";
231
260
  import "./chunk-U6VC4MU4.js";
@@ -249,7 +278,7 @@ import { existsSync, readFileSync } from "node:fs";
249
278
  import { join } from "node:path";
250
279
  var DEFAULT_CLI_PACKS = ["code", "agent-orchestration", "skills"];
251
280
  var DEFAULT_CLI_PLATFORM_TOOLS = [
252
- "ui_ask_choice",
281
+ "ask_user",
253
282
  "exa_search",
254
283
  "fetchWebpage"
255
284
  ];
@@ -757,7 +786,7 @@ function createRawKeyReader(input) {
757
786
  let buffer = "";
758
787
  const tryParseSequence = () => {
759
788
  if (!buffer) return null;
760
- if (isSubmit(buffer) || isCancel(buffer)) {
789
+ if (isSubmit(buffer)) {
761
790
  const sequence2 = buffer;
762
791
  buffer = "";
763
792
  return sequence2;
@@ -780,6 +809,7 @@ function createRawKeyReader(input) {
780
809
  return candidate;
781
810
  }
782
811
  }
812
+ if (buffer === "\x1B") return void 0;
783
813
  if (buffer.length >= 8) {
784
814
  buffer = "";
785
815
  return null;
@@ -791,16 +821,38 @@ function createRawKeyReader(input) {
791
821
  return sequence;
792
822
  };
793
823
  let waiter = null;
824
+ let escTimer = null;
794
825
  const tryDeliver = () => {
795
826
  if (!waiter || !buffer) return;
796
827
  const parsed = tryParseSequence();
797
- if (parsed === void 0) return;
828
+ if (parsed === void 0) {
829
+ if (buffer === "\x1B" && !escTimer) {
830
+ escTimer = setTimeout(() => {
831
+ escTimer = null;
832
+ if (waiter && buffer === "\x1B") {
833
+ const resolve3 = waiter;
834
+ waiter = null;
835
+ buffer = "";
836
+ resolve3("\x1B");
837
+ }
838
+ }, 30);
839
+ }
840
+ return;
841
+ }
842
+ if (escTimer) {
843
+ clearTimeout(escTimer);
844
+ escTimer = null;
845
+ }
798
846
  const resolve2 = waiter;
799
847
  waiter = null;
800
848
  resolve2(parsed);
801
849
  };
802
850
  const onData = (chunk) => {
803
851
  buffer += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
852
+ if (escTimer) {
853
+ clearTimeout(escTimer);
854
+ escTimer = null;
855
+ }
804
856
  tryDeliver();
805
857
  };
806
858
  input.on("data", onData);
@@ -810,6 +862,10 @@ function createRawKeyReader(input) {
810
862
  tryDeliver();
811
863
  });
812
864
  reader.dispose = () => {
865
+ if (escTimer) {
866
+ clearTimeout(escTimer);
867
+ escTimer = null;
868
+ }
813
869
  waiter = null;
814
870
  input.off("data", onData);
815
871
  };
@@ -832,7 +888,6 @@ async function runSelectDialog(args) {
832
888
  const output = args.output ?? process.stdout;
833
889
  const input = args.input ?? process.stdin;
834
890
  const readKey = args.readKey ?? createRawKeyReader(input);
835
- output.write("\x1B[?1006h\x1B[?1000h");
836
891
  const wasRaw = Boolean(input.isTTY && input.isRaw);
837
892
  let renderedLineCount = 0;
838
893
  const bottomAnchored = Boolean(args.bottomAnchored && args.bottomRow);
@@ -883,14 +938,15 @@ async function runSelectDialog(args) {
883
938
  };
884
939
  const resizeTarget = output;
885
940
  const onOutputResize = () => paint();
886
- if (input.isTTY && !wasRaw) {
887
- input.setRawMode?.(true);
888
- }
889
- if (bottomAnchored && outputIsTty(output)) {
890
- resizeTarget.on?.("resize", onOutputResize);
891
- }
892
- paint();
893
941
  try {
942
+ output.write("\x1B[?1006h\x1B[?1000h");
943
+ if (input.isTTY && !wasRaw) {
944
+ input.setRawMode?.(true);
945
+ }
946
+ if (bottomAnchored && outputIsTty(output)) {
947
+ resizeTarget.on?.("resize", onOutputResize);
948
+ }
949
+ paint();
894
950
  while (true) {
895
951
  const sequence = await readKey();
896
952
  if (sequence == null) {
@@ -898,6 +954,9 @@ async function runSelectDialog(args) {
898
954
  }
899
955
  const scrollAction = parseScrollAction(sequence);
900
956
  if (scrollAction === "wheel-up" || scrollAction === "wheel-down") {
957
+ if (args.wheelPolicy === "ignore") {
958
+ continue;
959
+ }
901
960
  selectedIndex = Math.min(
902
961
  Math.max(
903
962
  selectedIndex + (scrollAction === "wheel-up" ? -1 : 1),
@@ -1013,6 +1072,11 @@ async function runConfirmDialog(args) {
1013
1072
  titleLines,
1014
1073
  input,
1015
1074
  output,
1075
+ // confirm is a non-list modal: a wheel scroll must do nothing at all — no
1076
+ // highlight move, no repaint, no cancel (spec). Without this it would
1077
+ // inherit runSelectDialog's default "move" and let the wheel flip
1078
+ // Allow/Deny, which is the opposite of the intended silent-swallow.
1079
+ wheelPolicy: "ignore",
1016
1080
  ...args.readKey ? { readKey: args.readKey } : {},
1017
1081
  ...args.bottomAnchored ? { bottomAnchored: args.bottomAnchored } : {},
1018
1082
  ...args.bottomRow ? { bottomRow: args.bottomRow } : {}
@@ -1366,7 +1430,6 @@ async function runAskChoiceDialog(args) {
1366
1430
  const output = args.output ?? process.stdout;
1367
1431
  const input = args.input ?? process.stdin;
1368
1432
  const readKey = args.readKey ?? createRawKeyReader(input);
1369
- output.write("\x1B[?1006h\x1B[?1000h");
1370
1433
  const wasRaw = Boolean(input.isTTY && input.isRaw);
1371
1434
  let renderedLineCount = 0;
1372
1435
  const bottomAnchored = Boolean(args.bottomAnchored && args.bottomRow);
@@ -1443,14 +1506,15 @@ async function runAskChoiceDialog(args) {
1443
1506
  };
1444
1507
  const resizeTarget = output;
1445
1508
  const onOutputResize = () => paint();
1446
- if (input.isTTY && !wasRaw) {
1447
- input.setRawMode?.(true);
1448
- }
1449
- if (bottomAnchored && outputIsTty(output)) {
1450
- resizeTarget.on?.("resize", onOutputResize);
1451
- }
1452
- paint();
1453
1509
  try {
1510
+ output.write("\x1B[?1006h\x1B[?1000h");
1511
+ if (input.isTTY && !wasRaw) {
1512
+ input.setRawMode?.(true);
1513
+ }
1514
+ if (bottomAnchored && outputIsTty(output)) {
1515
+ resizeTarget.on?.("resize", onOutputResize);
1516
+ }
1517
+ paint();
1454
1518
  while (state.phase === "active") {
1455
1519
  const sequence = await readKey();
1456
1520
  if (sequence == null) {
@@ -1466,6 +1530,9 @@ async function runAskChoiceDialog(args) {
1466
1530
  paint();
1467
1531
  continue;
1468
1532
  }
1533
+ if (SGR_MOUSE_REGEX.test(sequence)) {
1534
+ continue;
1535
+ }
1469
1536
  let action = null;
1470
1537
  const qs = state.questionStates[state.activeIndex];
1471
1538
  const q = state.questions[state.activeIndex];
@@ -1609,6 +1676,274 @@ function createDialogHost(args) {
1609
1676
  };
1610
1677
  }
1611
1678
 
1679
+ // packages/cli/tui/runSnapshotDisplay.ts
1680
+ function runStatusTone(status) {
1681
+ if (!isAgentRunTerminalStatus(status)) return "warning";
1682
+ return status === "done" ? "success" : "danger";
1683
+ }
1684
+ function formatInFlightFact(inFlight, now, maxNameLength = 20) {
1685
+ const label = inFlight.kind === "llm" ? "thinking" : clipText(inFlight.name, maxNameLength);
1686
+ return `${label} ${formatDuration(Math.max(0, now - inFlight.startedAt))}`;
1687
+ }
1688
+ function activeInFlight(snapshot) {
1689
+ if (isAgentRunTerminalStatus(snapshot.status)) return null;
1690
+ return snapshot.inFlight ?? null;
1691
+ }
1692
+
1693
+ // packages/cli/tui/agentRunPanelLines.ts
1694
+ function formatPanelProgress(snapshot, now) {
1695
+ const parts = [];
1696
+ if (typeof snapshot.toolCallCount === "number" && Number.isFinite(snapshot.toolCallCount)) {
1697
+ parts.push(`${snapshot.toolCallCount} tools`);
1698
+ }
1699
+ const inFlight = activeInFlight(snapshot);
1700
+ if (inFlight) {
1701
+ parts.push(formatInFlightFact(inFlight, now));
1702
+ } else if (snapshot.lastToolNames && snapshot.lastToolNames.length > 0) {
1703
+ parts.push(snapshot.lastToolNames.join(", "));
1704
+ }
1705
+ return parts.length > 0 ? ` \xB7 ${parts.join(" \xB7 ")}` : "";
1706
+ }
1707
+ function formatPanelDetail(snapshot) {
1708
+ const note = snapshot.lastAssistantText?.trim();
1709
+ if (note) return note;
1710
+ if (!runShowsLogTail(snapshot.status)) return "";
1711
+ const lines = snapshot.logLines;
1712
+ if (!lines || lines.length === 0) return "";
1713
+ return lines[lines.length - 1]?.trim() ?? "";
1714
+ }
1715
+ function formatAgentRunPanelLines(snapshot, colorEnabled, now = Date.now()) {
1716
+ const lines = [];
1717
+ const name = snapshot.agentName || "sub-agent";
1718
+ const short = shortRunId(snapshot.runId);
1719
+ const runId = short ? ` (${short})` : "";
1720
+ const status = snapshot.status || "running";
1721
+ const statusSymbol = getAgentRunStatusIcon(status);
1722
+ const statusColor = runStatusTone(status);
1723
+ const errPart = snapshot.errorMessage ? ` \xB7 ${snapshot.errorMessage}` : "";
1724
+ const progressPart = formatPanelProgress(snapshot, now);
1725
+ const age = formatRunAge(snapshot, now);
1726
+ const agePart = age ? ` \xB7 ${age}` : "";
1727
+ if (!colorEnabled) {
1728
+ lines.push(
1729
+ `\u{1F916} Sub-Agent: ${name}${runId} \xB7 ${statusSymbol} ${status}${agePart}${progressPart}${errPart}`
1730
+ );
1731
+ } else {
1732
+ const botIcon = themeText("\u{1F916}", "accent", true);
1733
+ const labelText = themeText(" Sub-Agent: ", "muted", true);
1734
+ const nameText = themeText(`${name}${runId}`, "chrome", true);
1735
+ const statusText = themeText(` \xB7 ${statusSymbol} ${status}`, statusColor, true);
1736
+ const ageText = agePart ? themeText(agePart, "chrome") : "";
1737
+ const progressText = progressPart ? themeText(progressPart, "chrome") : "";
1738
+ const errorText = errPart ? themeText(errPart, "danger") : "";
1739
+ lines.push(`${botIcon}${labelText}${nameText}${statusText}${ageText}${progressText}${errorText}`);
1740
+ }
1741
+ const detail = formatPanelDetail(snapshot);
1742
+ if (detail) {
1743
+ if (!colorEnabled) {
1744
+ lines.push(` \u2514 ${detail}`);
1745
+ } else {
1746
+ lines.push(`${themeText(" \u2514 ", "muted")}${themeText(detail, "chrome")}`);
1747
+ }
1748
+ }
1749
+ return lines;
1750
+ }
1751
+
1752
+ // packages/cli/tui/runDock.ts
1753
+ var RUN_DOCK_TICK_INTERVAL_MS = 1e3;
1754
+ var RUN_DOCK_LINGER_MS = 8e3;
1755
+ var RUN_DOCK_STALE_MS = 5 * 6e4;
1756
+ var RUN_DOCK_MAX_ROWS = 3;
1757
+ var RETIRED_MEMORY = 64;
1758
+ function mergeSnapshot(prev, next) {
1759
+ const merged = { ...prev, ...next };
1760
+ if (merged.errorMessage && next.errorMessage === void 0 && !isAgentRunTerminalStatus(merged.status)) {
1761
+ delete merged.errorMessage;
1762
+ }
1763
+ if (next.inFlight === void 0) {
1764
+ if (prev.inFlight !== void 0) merged.inFlight = prev.inFlight;
1765
+ }
1766
+ return merged;
1767
+ }
1768
+ function createRunDock(deps) {
1769
+ const now = deps.now ?? (() => Date.now());
1770
+ const tickIntervalMs = deps.tickIntervalMs ?? RUN_DOCK_TICK_INTERVAL_MS;
1771
+ const lingerMs = deps.lingerMs ?? RUN_DOCK_LINGER_MS;
1772
+ const staleMs = deps.staleMs ?? RUN_DOCK_STALE_MS;
1773
+ const maxRows = deps.maxRows ?? RUN_DOCK_MAX_ROWS;
1774
+ const setIntervalFn = deps.setIntervalFn ?? ((cb, ms) => setInterval(cb, ms));
1775
+ const clearIntervalFn = deps.clearIntervalFn ?? ((handle) => clearInterval(handle));
1776
+ const entries = /* @__PURE__ */ new Map();
1777
+ const retired = /* @__PURE__ */ new Set();
1778
+ let seqCounter = 0;
1779
+ let timer = null;
1780
+ let disposed = false;
1781
+ const stopTimer = () => {
1782
+ if (timer !== null) {
1783
+ clearIntervalFn(timer);
1784
+ timer = null;
1785
+ }
1786
+ };
1787
+ const prune = () => {
1788
+ const at = now();
1789
+ let changed = false;
1790
+ for (const [runId, entry] of entries) {
1791
+ const expiredTerminal = entry.terminalAt !== null && at - entry.terminalAt >= lingerMs;
1792
+ const stale = at - entry.updatedAt >= staleMs;
1793
+ if (!expiredTerminal && !stale) continue;
1794
+ entries.delete(runId);
1795
+ changed = true;
1796
+ if (expiredTerminal) {
1797
+ retired.add(runId);
1798
+ if (retired.size > RETIRED_MEMORY) {
1799
+ const oldest = retired.values().next().value;
1800
+ if (oldest !== void 0) retired.delete(oldest);
1801
+ }
1802
+ }
1803
+ }
1804
+ if (entries.size === 0) stopTimer();
1805
+ return changed;
1806
+ };
1807
+ const tick = () => {
1808
+ prune();
1809
+ deps.onRepaint();
1810
+ };
1811
+ const ensureTimer = () => {
1812
+ if (timer === null && entries.size > 0) {
1813
+ timer = setIntervalFn(tick, tickIntervalMs);
1814
+ }
1815
+ };
1816
+ const update = (snapshot) => {
1817
+ if (disposed) return;
1818
+ const runId = snapshot.runId;
1819
+ if (!runId) return;
1820
+ if (snapshot.status === "not_found") {
1821
+ remove(runId);
1822
+ return;
1823
+ }
1824
+ if (retired.has(runId)) return;
1825
+ const at = now();
1826
+ const prev = entries.get(runId);
1827
+ const merged = prev ? mergeSnapshot(prev.snapshot, snapshot) : snapshot;
1828
+ const terminal = isAgentRunTerminalStatus(merged.status);
1829
+ entries.set(runId, {
1830
+ snapshot: merged,
1831
+ seq: prev ? prev.seq : seqCounter++,
1832
+ updatedAt: at,
1833
+ // terminalAt 只在首次进入终态时记一次:终态 run 后续还会被轮询到,
1834
+ // 每次都刷新的话 linger 永远走不完,面板会一直挂着已完成的 run。
1835
+ terminalAt: terminal ? prev?.terminalAt ?? at : null
1836
+ });
1837
+ ensureTimer();
1838
+ deps.onRepaint();
1839
+ };
1840
+ const remove = (runId) => {
1841
+ if (!entries.delete(runId)) return;
1842
+ if (entries.size === 0) stopTimer();
1843
+ deps.onRepaint();
1844
+ };
1845
+ const clear = () => {
1846
+ if (entries.size === 0) return;
1847
+ entries.clear();
1848
+ stopTimer();
1849
+ deps.onRepaint();
1850
+ };
1851
+ const orderedEntries = () => [...entries.values()].sort((a, b) => {
1852
+ const aTerminal = a.terminalAt !== null ? 1 : 0;
1853
+ const bTerminal = b.terminalAt !== null ? 1 : 0;
1854
+ if (aTerminal !== bTerminal) return aTerminal - bTerminal;
1855
+ return a.seq - b.seq;
1856
+ });
1857
+ const getRuns = () => orderedEntries().map((entry) => entry.snapshot);
1858
+ const getLines = (colorEnabled) => {
1859
+ prune();
1860
+ const ordered = orderedEntries();
1861
+ if (ordered.length === 0) return [];
1862
+ const at = now();
1863
+ if (ordered.length === 1) {
1864
+ return formatAgentRunPanelLines(ordered[0].snapshot, colorEnabled, at);
1865
+ }
1866
+ return formatRunDockLines(
1867
+ ordered.map((entry) => entry.snapshot),
1868
+ colorEnabled,
1869
+ at,
1870
+ maxRows
1871
+ );
1872
+ };
1873
+ return {
1874
+ update,
1875
+ remove,
1876
+ clear,
1877
+ getRuns,
1878
+ getLines,
1879
+ dispose() {
1880
+ disposed = true;
1881
+ entries.clear();
1882
+ retired.clear();
1883
+ stopTimer();
1884
+ }
1885
+ };
1886
+ }
1887
+ function summarize(snapshots) {
1888
+ let running = 0;
1889
+ const terminal = /* @__PURE__ */ new Map();
1890
+ for (const snapshot of snapshots) {
1891
+ if (!isAgentRunTerminalStatus(snapshot.status)) {
1892
+ running += 1;
1893
+ continue;
1894
+ }
1895
+ terminal.set(snapshot.status, (terminal.get(snapshot.status) ?? 0) + 1);
1896
+ }
1897
+ const parts = [];
1898
+ if (running > 0) parts.push(`${running} running`);
1899
+ for (const [status, count] of terminal) parts.push(`${count} ${status}`);
1900
+ return parts.join(" \xB7 ");
1901
+ }
1902
+ function formatRunDockLines(snapshots, colorEnabled, now = Date.now(), maxRows = RUN_DOCK_MAX_ROWS) {
1903
+ if (snapshots.length === 0) return [];
1904
+ const lines = [];
1905
+ const summary = summarize(snapshots);
1906
+ const header = `\u{1F916} runs \xB7 ${summary}`;
1907
+ lines.push(colorEnabled ? themeText(header, "muted", true) : header);
1908
+ const shown = snapshots.slice(0, Math.max(1, maxRows));
1909
+ for (const snapshot of shown) {
1910
+ lines.push(formatRunDockRow(snapshot, colorEnabled, now));
1911
+ }
1912
+ const hidden = snapshots.length - shown.length;
1913
+ if (hidden > 0) {
1914
+ const more = ` +${hidden} more`;
1915
+ lines.push(colorEnabled ? themeText(more, "chrome") : more);
1916
+ }
1917
+ return lines;
1918
+ }
1919
+ function formatRunDockRow(snapshot, colorEnabled, now) {
1920
+ const name = snapshot.agentName || "sub-agent";
1921
+ const short = shortRunId(snapshot.runId);
1922
+ const icon = getAgentRunStatusIcon(snapshot.status);
1923
+ const terminal = isAgentRunTerminalStatus(snapshot.status);
1924
+ const statusColor = runStatusTone(snapshot.status);
1925
+ const facts = [];
1926
+ const age = formatRunAge(snapshot, now);
1927
+ if (terminal) facts.push(age ? `${snapshot.status} ${age}` : snapshot.status);
1928
+ else if (age) facts.push(age);
1929
+ if (typeof snapshot.toolCallCount === "number" && Number.isFinite(snapshot.toolCallCount)) {
1930
+ facts.push(`${snapshot.toolCallCount} tools`);
1931
+ }
1932
+ const inFlight = activeInFlight(snapshot);
1933
+ if (inFlight) {
1934
+ facts.push(formatInFlightFact(inFlight, now));
1935
+ } else {
1936
+ const lastTool = snapshot.lastToolNames?.[snapshot.lastToolNames.length - 1];
1937
+ if (lastTool) facts.push(clipText(lastTool, 20));
1938
+ }
1939
+ if (snapshot.errorMessage) facts.push(clipText(snapshot.errorMessage, 40));
1940
+ const label = `${name}${short ? ` #${short}` : ""}`;
1941
+ const factsPart = facts.length > 0 ? ` \xB7 ${facts.join(" \xB7 ")}` : "";
1942
+ if (!colorEnabled) return ` ${icon} ${label}${factsPart}`;
1943
+ const errorTail = snapshot.errorMessage;
1944
+ return themeText(" ", "chrome") + themeText(icon, statusColor, true) + " " + themeText(label, "chrome", true) + themeText(factsPart, errorTail ? "danger" : "chrome");
1945
+ }
1946
+
1612
1947
  // packages/cli/tui/activityIndicator.ts
1613
1948
  var ACTIVITY_FRAMES = ["\xB7", "~", "\u2248", "\u223F", "\u2248", "~"];
1614
1949
  var ACTIVITY_FRAME_INTERVAL_MS = 150;
@@ -1692,16 +2027,19 @@ function createActivityIndicator(deps) {
1692
2027
  }
1693
2028
  return null;
1694
2029
  };
1695
- let agentRunSnapshot = null;
2030
+ const runDock = deps.runDock ?? createRunDock({
2031
+ onRepaint: deps.onRepaint,
2032
+ now,
2033
+ setIntervalFn,
2034
+ clearIntervalFn
2035
+ });
1696
2036
  const updateAgentRun = (snapshot) => {
1697
- agentRunSnapshot = snapshot;
1698
- deps.onRepaint();
2037
+ runDock.update(snapshot);
1699
2038
  };
1700
2039
  const clearAgentRun = () => {
1701
- agentRunSnapshot = null;
1702
- deps.onRepaint();
2040
+ runDock.clear();
1703
2041
  };
1704
- const getAgentRun = () => agentRunSnapshot;
2042
+ const getAgentRuns = () => runDock.getRuns();
1705
2043
  const getActivityLines = (colorEnabled = resolveCliColorEnabled()) => {
1706
2044
  const lines = [];
1707
2045
  const baseView = getView();
@@ -1717,9 +2055,7 @@ function createActivityIndicator(deps) {
1717
2055
  );
1718
2056
  }
1719
2057
  }
1720
- if (agentRunSnapshot) {
1721
- lines.push(...formatAgentRunPanelLines(agentRunSnapshot, colorEnabled));
1722
- }
2058
+ lines.push(...runDock.getLines(colorEnabled));
1723
2059
  return lines.length > 0 ? lines : null;
1724
2060
  };
1725
2061
  const stop = () => {
@@ -1733,69 +2069,134 @@ function createActivityIndicator(deps) {
1733
2069
  fallbackStartedAt = 0;
1734
2070
  lastActivityAt = 0;
1735
2071
  stopping = false;
1736
- agentRunSnapshot = null;
1737
2072
  };
1738
2073
  return {
1739
2074
  report,
1740
2075
  updateAgentRun,
1741
2076
  clearAgentRun,
1742
- getAgentRun,
2077
+ getAgentRuns,
1743
2078
  getView,
1744
2079
  getActivityLines,
1745
2080
  markStopping,
1746
2081
  isStopping,
1747
- stop
2082
+ stop,
2083
+ dispose() {
2084
+ stop();
2085
+ runDock.dispose();
2086
+ }
1748
2087
  };
1749
2088
  }
1750
- function formatAgentRunPanelLines(snapshot, colorEnabled) {
1751
- const lines = [];
1752
- const name = snapshot.agentName || "sub-agent";
1753
- const runId = snapshot.runId ? ` (${snapshot.runId.slice(0, 8)})` : "";
1754
- const status = snapshot.status || "running";
1755
- let statusSymbol = "\u231B";
1756
- let statusColor = "warning";
1757
- if (status === "completed" || status === "finished" || status === "success") {
1758
- statusSymbol = "\u2713";
1759
- statusColor = "success";
1760
- } else if (status === "killed" || status === "cancelled" || status === "failed" || status === "stopped") {
1761
- statusSymbol = "\u{1F534}";
1762
- statusColor = "danger";
1763
- }
1764
- const pollPart = snapshot.polls !== void 0 ? ` (polls: ${snapshot.polls})` : "";
1765
- const errPart = snapshot.errorMessage ? ` \xB7 ${snapshot.errorMessage}` : "";
1766
- if (!colorEnabled) {
1767
- lines.push(`\u{1F916} Sub-Agent: ${name}${runId} \xB7 ${statusSymbol} ${status}${pollPart}${errPart}`);
1768
- } else {
1769
- const botIcon = themeText("\u{1F916}", "accent", true);
1770
- const labelText = themeText(" Sub-Agent: ", "muted", true);
1771
- const nameText = themeText(`${name}${runId}`, "chrome", true);
1772
- const statusText = themeText(` \xB7 ${statusSymbol} ${status}`, statusColor, true);
1773
- const pollsText = pollPart ? themeText(pollPart, "chrome") : "";
1774
- const errorText = errPart ? themeText(errPart, "danger") : "";
1775
- lines.push(`${botIcon}${labelText}${nameText}${statusText}${pollsText}${errorText}`);
2089
+
2090
+ // packages/cli/tui/runRegistryPoller.ts
2091
+ var RUN_POLL_INTERVAL_MS = 1e3;
2092
+ var RUN_RECONCILE_SILENCE_MS = 15e3;
2093
+ function snapshotFromRunRecord(record, now) {
2094
+ const label = resolveRunLabel(record);
2095
+ const startedAt = readTimestamp(record.startedAt);
2096
+ const endedAt = readTimestamp(record.endedAt);
2097
+ const activity = record.activity;
2098
+ const counters = activity?.counters;
2099
+ let inFlight = null;
2100
+ const raw = activity?.inFlight;
2101
+ if (raw && !isAgentRunTerminalStatus(record.status)) {
2102
+ const updatedAt = activity?.updatedAt ? Date.parse(activity.updatedAt) : NaN;
2103
+ const base = Number.isFinite(updatedAt) ? updatedAt : now;
2104
+ const startedFrom = base - (Number.isFinite(raw.sinceMs) ? raw.sinceMs : 0);
2105
+ const usable = Number.isFinite(startedFrom) && startedFrom > 0 ? Math.min(startedFrom, now) : now;
2106
+ inFlight = { kind: raw.kind, name: raw.name, startedAt: usable };
1776
2107
  }
1777
- let logLine;
1778
- if (snapshot.logTail) {
1779
- const trimmed = snapshot.logTail.trim();
1780
- if (trimmed) {
1781
- const parts = trimmed.split(/\r?\n/);
1782
- logLine = parts[parts.length - 1];
2108
+ return {
2109
+ runId: record.runId,
2110
+ status: record.status,
2111
+ ...isAgentNameFallback(label) ? {} : { agentName: label },
2112
+ ...startedAt !== void 0 ? { startedAt } : {},
2113
+ ...endedAt !== void 0 ? { finishedAt: endedAt } : {},
2114
+ ...typeof counters?.toolCalls === "number" ? { toolCallCount: counters.toolCalls } : {},
2115
+ // note 在终态时是死因("orphaned: process gone…"),非终态时只是备注。
2116
+ ...record.note && isAgentRunTerminalStatus(record.status) ? { errorMessage: record.note } : {},
2117
+ inFlight,
2118
+ logKey: ""
2119
+ };
2120
+ }
2121
+ function fingerprint(snapshot) {
2122
+ return JSON.stringify([
2123
+ snapshot.status,
2124
+ snapshot.agentName ?? "",
2125
+ snapshot.toolCallCount ?? -1,
2126
+ snapshot.errorMessage ?? "",
2127
+ snapshot.finishedAt ?? 0,
2128
+ snapshot.inFlight ? [snapshot.inFlight.kind, snapshot.inFlight.name, snapshot.inFlight.startedAt] : null
2129
+ ]);
2130
+ }
2131
+ function createRunRegistryPoller(deps) {
2132
+ const now = deps.now ?? (() => Date.now());
2133
+ const intervalMs = deps.intervalMs ?? RUN_POLL_INTERVAL_MS;
2134
+ const reconcileSilenceMs = deps.reconcileSilenceMs ?? RUN_RECONCILE_SILENCE_MS;
2135
+ const setIntervalFn = deps.setIntervalFn ?? ((cb, ms) => setInterval(cb, ms));
2136
+ const clearIntervalFn = deps.clearIntervalFn ?? ((handle) => clearInterval(handle));
2137
+ let timer = null;
2138
+ let disposed = false;
2139
+ const lastEmitted = /* @__PURE__ */ new Map();
2140
+ const lastReconciledAt = /* @__PURE__ */ new Map();
2141
+ const stop = () => {
2142
+ if (timer !== null) {
2143
+ clearIntervalFn(timer);
2144
+ timer = null;
1783
2145
  }
1784
- } else if (snapshot.logLines && snapshot.logLines.length > 0) {
1785
- logLine = snapshot.logLines[snapshot.logLines.length - 1];
1786
- }
1787
- if (logLine && logLine.trim()) {
1788
- const cleanLog = logLine.trim();
1789
- if (!colorEnabled) {
1790
- lines.push(` \u2514 Log: ${cleanLog}`);
1791
- } else {
1792
- const branchChar = themeText(" \u2514 ", "muted");
1793
- const logTag = themeText("Log: ", "muted");
1794
- const logContent = themeText(cleanLog, "chrome");
1795
- lines.push(`${branchChar}${logTag}${logContent}`);
2146
+ lastEmitted.clear();
2147
+ lastReconciledAt.clear();
2148
+ };
2149
+ const freshnessOf = (record) => {
2150
+ return readTimestamp(record.activity?.updatedAt) ?? readTimestamp(record.startedAt) ?? 0;
2151
+ };
2152
+ const poll = () => {
2153
+ const at = now();
2154
+ const active = deps.getDockedRuns().filter(
2155
+ (run) => run.runId && !isAgentRunTerminalStatus(run.status)
2156
+ );
2157
+ if (active.length === 0) {
2158
+ stop();
2159
+ return;
1796
2160
  }
1797
- }
1798
- return lines;
2161
+ const alive = /* @__PURE__ */ new Set();
2162
+ for (const run of active) {
2163
+ alive.add(run.runId);
2164
+ let record;
2165
+ try {
2166
+ record = deps.readRecord(run.runId);
2167
+ if (deps.reconcile && record && !isAgentRunTerminalStatus(record.status) && at - freshnessOf(record) >= reconcileSilenceMs && at - (lastReconciledAt.get(run.runId) ?? 0) >= reconcileSilenceMs) {
2168
+ lastReconciledAt.set(run.runId, at);
2169
+ record = deps.reconcile(run.runId) ?? record;
2170
+ }
2171
+ } catch {
2172
+ continue;
2173
+ }
2174
+ if (!record) continue;
2175
+ const snapshot = snapshotFromRunRecord(record, at);
2176
+ const mark = fingerprint(snapshot);
2177
+ if (lastEmitted.get(run.runId) === mark) continue;
2178
+ lastEmitted.set(run.runId, mark);
2179
+ deps.update(snapshot);
2180
+ }
2181
+ for (const runId of [...lastEmitted.keys()]) {
2182
+ if (!alive.has(runId)) lastEmitted.delete(runId);
2183
+ }
2184
+ for (const runId of [...lastReconciledAt.keys()]) {
2185
+ if (!alive.has(runId)) lastReconciledAt.delete(runId);
2186
+ }
2187
+ };
2188
+ return {
2189
+ ensureRunning() {
2190
+ if (disposed || timer !== null) return;
2191
+ timer = setIntervalFn(poll, intervalMs);
2192
+ },
2193
+ poll,
2194
+ stop,
2195
+ dispose() {
2196
+ disposed = true;
2197
+ stop();
2198
+ }
2199
+ };
1799
2200
  }
1800
2201
 
1801
2202
  // packages/ai/agent/utils/sortUtils.ts
@@ -1931,6 +2332,7 @@ function mergeCatalogEntries(currentKey, platformAgents, privateAgents, favorite
1931
2332
  }
1932
2333
  var agentCatalogCache = null;
1933
2334
  var agentCatalogRefreshInFlight = null;
2335
+ var agentCatalogRawLoadInFlight = null;
1934
2336
  var AGENT_CATALOG_FRESH_MS = 15e3;
1935
2337
  async function loadAgentCatalog(args) {
1936
2338
  const env = args.env ?? process.env;
@@ -1944,13 +2346,38 @@ async function loadAgentCatalog(args) {
1944
2346
  }
1945
2347
  return cached.entries;
1946
2348
  }
1947
- const entries = await fetchAgentCatalog(args, env);
2349
+ let rawData;
2350
+ if (agentCatalogRawLoadInFlight) {
2351
+ rawData = await agentCatalogRawLoadInFlight;
2352
+ } else {
2353
+ const promise = fetchRawCatalogData(args, env);
2354
+ agentCatalogRawLoadInFlight = promise;
2355
+ try {
2356
+ rawData = await promise;
2357
+ } catch (error) {
2358
+ agentCatalogRawLoadInFlight = null;
2359
+ throw error;
2360
+ }
2361
+ agentCatalogRawLoadInFlight = null;
2362
+ }
2363
+ const entries = mergeCatalogEntries(
2364
+ args.currentKey,
2365
+ resolveCatalogPlatformAgents(env),
2366
+ rawData.privateAgents,
2367
+ rawData.favoritedAtByKey
2368
+ );
1948
2369
  agentCatalogCache = { cacheKey, at: Date.now(), entries };
1949
2370
  return entries;
1950
2371
  }
1951
2372
  function refreshAgentCatalogInBackground(args, env, cacheKey) {
1952
2373
  if (agentCatalogRefreshInFlight) return;
1953
- agentCatalogRefreshInFlight = fetchAgentCatalog(args, env).then((entries) => {
2374
+ agentCatalogRefreshInFlight = fetchRawCatalogData(args, env).then((rawData) => {
2375
+ const entries = mergeCatalogEntries(
2376
+ args.currentKey,
2377
+ resolveCatalogPlatformAgents(env),
2378
+ rawData.privateAgents,
2379
+ rawData.favoritedAtByKey
2380
+ );
1954
2381
  agentCatalogCache = { cacheKey, at: Date.now(), entries };
1955
2382
  }).catch(() => {
1956
2383
  }).finally(() => {
@@ -1961,17 +2388,13 @@ function prefetchAgentCatalog(args) {
1961
2388
  void loadAgentCatalog({ ...args, currentKey: "" }).catch(() => {
1962
2389
  });
1963
2390
  }
1964
- async function fetchAgentCatalog(args, env) {
2391
+ async function fetchRawCatalogData(args, env) {
1965
2392
  const fetchImpl = args.fetchImpl ?? fetch;
1966
2393
  const fallbackFetchImpl = args.fallbackFetchImpl;
1967
2394
  const authToken = resolveAuthToken([], env);
1968
2395
  const userId = authToken ? parseUserIdFromAuthToken(authToken) : null;
1969
2396
  if (!authToken || !userId) {
1970
- return mergeCatalogEntries(
1971
- args.currentKey,
1972
- resolveCatalogPlatformAgents(env),
1973
- []
1974
- );
2397
+ return { privateAgents: [], favoritedAtByKey: {} };
1975
2398
  }
1976
2399
  const serverUrl = resolveServerUrl(env);
1977
2400
  const serverUrls = resolveServerCandidates([], env, serverUrl);
@@ -2009,12 +2432,7 @@ async function fetchAgentCatalog(args, env) {
2009
2432
  }
2010
2433
  }
2011
2434
  const favoritedAtByKey = await favoritesPromise;
2012
- return mergeCatalogEntries(
2013
- args.currentKey,
2014
- resolveCatalogPlatformAgents(env),
2015
- privateAgents,
2016
- favoritedAtByKey
2017
- );
2435
+ return { privateAgents, favoritedAtByKey };
2018
2436
  }
2019
2437
  function renderAgentCatalogList(entries, currentKey) {
2020
2438
  const lines = ["Agents:"];
@@ -2076,12 +2494,23 @@ async function runAgentPicker(args) {
2076
2494
  const output = args.output ?? process.stdout;
2077
2495
  const input = args.input ?? process.stdin;
2078
2496
  const interactive = args.interactive ?? ("isTTY" in input && Boolean(input.isTTY) && "isTTY" in output && Boolean(output.isTTY));
2079
- const entries = await loadAgentCatalog({
2080
- env: args.env,
2081
- currentKey: args.currentKey,
2082
- fetchImpl: args.fetchImpl,
2083
- fallbackFetchImpl: args.fallbackFetchImpl
2084
- });
2497
+ const isTty = outputIsTty(output);
2498
+ if (isTty) {
2499
+ output.write(t("agentPickerLoading"));
2500
+ }
2501
+ let entries;
2502
+ try {
2503
+ entries = await loadAgentCatalog({
2504
+ env: args.env,
2505
+ currentKey: args.currentKey,
2506
+ fetchImpl: args.fetchImpl,
2507
+ fallbackFetchImpl: args.fallbackFetchImpl
2508
+ });
2509
+ } finally {
2510
+ if (isTty) {
2511
+ output.write("\r\x1B[2K");
2512
+ }
2513
+ }
2085
2514
  if (!interactive) {
2086
2515
  return {
2087
2516
  kind: "list",
@@ -2709,7 +3138,6 @@ function renderContextPanel(state, colorEnabled = resolveCliColorEnabled()) {
2709
3138
  t("contextFieldProfile"),
2710
3139
  t("contextFieldRuntime"),
2711
3140
  t("contextFieldTools"),
2712
- t("contextFieldThinking"),
2713
3141
  t("contextFieldServer")
2714
3142
  ];
2715
3143
  let maxW = 0;
@@ -2740,8 +3168,7 @@ function renderContextPanel(state, colorEnabled = resolveCliColorEnabled()) {
2740
3168
  field(labels[5], state.profileName),
2741
3169
  field(labels[6], state.runtimeMode),
2742
3170
  field(labels[7], state.toolDisplay),
2743
- field(labels[8], state.thinkingDisplay),
2744
- field(labels[9], state.serverUrl),
3171
+ field(labels[8], state.serverUrl),
2745
3172
  "",
2746
3173
  themeText(t("contextNext"), "chrome", colorEnabled),
2747
3174
  next("/agents ", ` ${t("contextNextAgents")}`),
@@ -3079,10 +3506,6 @@ function createInitialTuiState(env = process.env) {
3079
3506
  runtimeMode,
3080
3507
  modeLabel: asOptionalTrimmedString(env.NOLO_CLI_STATUS_MODE) ?? runtimeMode,
3081
3508
  gitStatus: void 0,
3082
- thinkingDisplay: normalizeThinkingDisplayMode(
3083
- env.NOLO_CLI_THINKING ?? env.NOLO_THINKING,
3084
- "hide"
3085
- ),
3086
3509
  toolDisplay: normalizeToolDisplayMode(env.NOLO_CLI_TOOLS ?? env.NOLO_TOOLS, "compact"),
3087
3510
  contextWindow: resolveAgentContextWindow({
3088
3511
  agentKey,
@@ -3269,26 +3692,6 @@ function handleTuiInput(input, state) {
3269
3692
  output: t("toolsSet", nextMode)
3270
3693
  };
3271
3694
  }
3272
- case "/thinking": {
3273
- if (!argText) {
3274
- return {
3275
- nextState: state,
3276
- output: t("thinkingCurrent", state.thinkingDisplay)
3277
- };
3278
- }
3279
- const normalizedArg = asTrimmedLowercaseString(argText);
3280
- if (!["hide", "marker", "show", "on", "off"].includes(normalizedArg)) {
3281
- return {
3282
- nextState: state,
3283
- output: t("thinkingUsage")
3284
- };
3285
- }
3286
- const nextMode = normalizeThinkingDisplayMode(normalizedArg, state.thinkingDisplay);
3287
- return {
3288
- nextState: { ...state, thinkingDisplay: nextMode },
3289
- output: t("thinkingSet", nextMode)
3290
- };
3291
- }
3292
3695
  case "/tasks":
3293
3696
  case "/jobs":
3294
3697
  case "/procs": {
@@ -3324,7 +3727,7 @@ function handleTuiInput(input, state) {
3324
3727
  }
3325
3728
  if (argText === "all") {
3326
3729
  const before = registry.list().filter((p) => p.status === "running").length;
3327
- registry.stopAll();
3730
+ registry.stopAll(void 0, { includePersist: true });
3328
3731
  return { nextState: state, output: t("stopAllDone", String(before)) };
3329
3732
  }
3330
3733
  if (/^\d+$/.test(argText)) {
@@ -3599,6 +4002,7 @@ function handleTuiInput(input, state) {
3599
4002
  }
3600
4003
 
3601
4004
  // packages/cli/tui/detectBackground.ts
4005
+ import { execFileSync } from "node:child_process";
3602
4006
  import { ReadStream } from "node:tty";
3603
4007
  var OSC11_QUERY = "\x1B]11;?\x07";
3604
4008
  var OSC11_REPLY_RE = /\x1b\]11;rgb:([0-9a-f]+)\/([0-9a-f]+)\/([0-9a-f]+)/i;
@@ -3627,7 +4031,7 @@ function parseOsc11Background(reply) {
3627
4031
  function isTerminalDevice(stream) {
3628
4032
  return stream instanceof ReadStream;
3629
4033
  }
3630
- async function detectTerminalBackground(args = {}) {
4034
+ async function probeTerminalBackground(args = {}) {
3631
4035
  const stdin = args.stdin ?? process.stdin;
3632
4036
  const stdout = args.stdout ?? process.stdout;
3633
4037
  const timeoutMs = args.timeoutMs ?? 100;
@@ -3670,6 +4074,48 @@ async function detectTerminalBackground(args = {}) {
3670
4074
  timer = setTimeout(() => finish(null), timeoutMs);
3671
4075
  });
3672
4076
  }
4077
+ async function detectTerminalBackground(args = {}) {
4078
+ const r = await probeTerminalBackground(args);
4079
+ if (r || !args.allowSystemFallback) return r;
4080
+ const brightness = detectSystemBrightness(process.env, { allowSubprocess: true });
4081
+ return brightness ? { brightness, hex: "" } : null;
4082
+ }
4083
+ function detectSystemBrightness(env = process.env, options = {}) {
4084
+ const envResult = detectSystemBrightnessFromEnv(env);
4085
+ if (envResult) return envResult;
4086
+ const allowSubprocess = options.allowSubprocess ?? false;
4087
+ if (!allowSubprocess) {
4088
+ return null;
4089
+ }
4090
+ if (process.platform === "darwin") {
4091
+ try {
4092
+ const out = execFileSync("defaults", ["read", "-g", "AppleInterfaceStyle"], {
4093
+ encoding: "utf8",
4094
+ stdio: ["ignore", "pipe", "ignore"],
4095
+ timeout: 200
4096
+ }).trim();
4097
+ if (out.toLowerCase() === "dark") return "dark";
4098
+ } catch {
4099
+ }
4100
+ } else if (process.platform === "linux") {
4101
+ try {
4102
+ const out = execFileSync(
4103
+ "gsettings",
4104
+ ["get", "org.gnome.desktop.interface", "color-scheme"],
4105
+ {
4106
+ encoding: "utf8",
4107
+ stdio: ["ignore", "pipe", "ignore"],
4108
+ timeout: 200
4109
+ }
4110
+ ).trim();
4111
+ const val = out.toLowerCase();
4112
+ if (/(?:^|[\s\-_:])dark(?:$|[\s\-_:])/i.test(val)) return "dark";
4113
+ if (/(?:^|[\s\-_:])light(?:$|[\s\-_:])/i.test(val)) return "light";
4114
+ } catch {
4115
+ }
4116
+ }
4117
+ return null;
4118
+ }
3673
4119
 
3674
4120
  // packages/core/chat/chatQueueMachine.ts
3675
4121
  var initialChatQueueState = {
@@ -4765,6 +5211,52 @@ ${content}`;
4765
5211
  return null;
4766
5212
  }
4767
5213
  var autoRouteByDialog = /* @__PURE__ */ new Map();
5214
+ function toOverlayStatus(status) {
5215
+ switch (status) {
5216
+ case "running":
5217
+ return "running";
5218
+ case "done":
5219
+ return "done";
5220
+ case "failed":
5221
+ case "timeout":
5222
+ case "killed":
5223
+ return "failed";
5224
+ case "orphaned":
5225
+ return "orphaned";
5226
+ default:
5227
+ return "running";
5228
+ }
5229
+ }
5230
+ function buildTuiRunOverlay(parentDialogId, reported) {
5231
+ if (!parentDialogId) return null;
5232
+ let runs;
5233
+ try {
5234
+ runs = queryRunRecords({ parentDialogId }, { env: process.env }).runs;
5235
+ } catch {
5236
+ return null;
5237
+ }
5238
+ if (runs.length === 0) return null;
5239
+ if (reported) {
5240
+ runs = runs.filter((run) => reported.get(run.runId) !== run.status);
5241
+ for (const run of runs) reported.set(run.runId, run.status);
5242
+ if (runs.length === 0) return null;
5243
+ }
5244
+ let overlay = initialRunOverlayState;
5245
+ for (const run of runs) {
5246
+ overlay = reduceRunOverlay(overlay, {
5247
+ type: "run-state-chg",
5248
+ runId: run.runId,
5249
+ info: {
5250
+ name: run.agentName ?? run.agentKey ?? run.runId,
5251
+ status: toOverlayStatus(run.status),
5252
+ batchId: run.batchId,
5253
+ parentDialogId: run.parentDialogId,
5254
+ ...run.status === "failed" && run.note ? { errorMessage: run.note } : {}
5255
+ }
5256
+ });
5257
+ }
5258
+ return buildOverlayPresentation(overlay);
5259
+ }
4768
5260
  async function runAgentChat(scriptDir, state, message, env, output, agentRunner = runAgentTurn, options = {}) {
4769
5261
  let effectiveAgentKey = state.agentKey;
4770
5262
  let effectiveAgentName = state.agentName;
@@ -4888,12 +5380,12 @@ async function runAgentChat(scriptDir, state, message, env, output, agentRunner
4888
5380
  serverUrl: state.serverUrl,
4889
5381
  message: effectiveMessage,
4890
5382
  continueDialogId: state.dialogId,
5383
+ ...state.agentKey === DEFAULT_TUI_AGENT_KEY && env.NOLO_AUTO_ROUTE !== "0" ? { dialogAgentMode: "auto" } : { dialogAgentMode: "fixed" },
4891
5384
  runtimeMode: state.runtimeMode,
4892
5385
  localRuntimeCwd: process.cwd(),
4893
5386
  scriptDir,
4894
5387
  env: {
4895
5388
  ...env,
4896
- NOLO_CLI_THINKING: state.thinkingDisplay,
4897
5389
  NOLO_CLI_TOOLS: state.toolDisplay
4898
5390
  },
4899
5391
  output,
@@ -4902,14 +5394,21 @@ async function runAgentChat(scriptDir, state, message, env, output, agentRunner
4902
5394
  ...options.confirmDestructiveAction ? { confirmDestructiveAction: options.confirmDestructiveAction } : {},
4903
5395
  ...options.requestUserChoice ? { requestUserChoice: options.requestUserChoice } : {},
4904
5396
  ...options.abortSignal ? { abortSignal: options.abortSignal } : {},
4905
- ...options.pastedTextStore?.items.size ? {
4906
- pastedTextStore: options.pastedTextStore,
4907
- localRuntimeAdapterFactory: (factoryEnv, factoryOptions) => createCliLocalRuntimeAdapter({
4908
- env: factoryEnv,
4909
- cwd: factoryOptions?.cwd ?? state.cwd,
4910
- pastedTextStore: options.pastedTextStore
4911
- })
4912
- } : {},
5397
+ // Always inject a local adapter factory so background run delegations from
5398
+ // inside a TUI turn are stamped with the current conversation. Previously
5399
+ // this factory only existed when pasted text was present, which meant a
5400
+ // plain (no-paste) turn had no injection point for parentDialogId and the
5401
+ // run-overlay could never see runs spawned this turn.
5402
+ ...options.pastedTextStore?.items.size ? { pastedTextStore: options.pastedTextStore } : {},
5403
+ localRuntimeAdapterFactory: (factoryEnv, factoryOptions) => createCliLocalRuntimeAdapter({
5404
+ env: factoryEnv,
5405
+ cwd: factoryOptions?.cwd ?? state.cwd,
5406
+ ...options.pastedTextStore ? { pastedTextStore: options.pastedTextStore } : {},
5407
+ // Stamp spawned background runs with the current TUI dialog so the
5408
+ // run-overlay can filter runs belonging to this conversation.
5409
+ ...state.dialogId ? { parentDialogId: state.dialogId } : {},
5410
+ ...options.activityReporter ? { activityReporter: options.activityReporter } : {}
5411
+ }),
4913
5412
  ...options.activityReporter ? { activityReporter: options.activityReporter } : {},
4914
5413
  ...skillAllowedTools !== void 0 ? { allowedToolNames: skillAllowedTools } : {},
4915
5414
  ...contextBlockScopes.length > 0 ? { contextBlockScopes } : {}
@@ -5151,7 +5650,8 @@ async function startTuiWorkspace(options) {
5151
5650
  }
5152
5651
  const detected = await detectTerminalBackground({
5153
5652
  stdin: input,
5154
- stdout: output
5653
+ stdout: output,
5654
+ allowSystemFallback: true
5155
5655
  });
5156
5656
  if (detected) {
5157
5657
  setActiveBrightness(detected.brightness);
@@ -5159,6 +5659,18 @@ async function startTuiWorkspace(options) {
5159
5659
  }
5160
5660
  const bannerColumns = output.columns;
5161
5661
  output.write(renderWelcome(state, 0, 0, bannerColumns));
5662
+ let lastSentTitle = null;
5663
+ const syncWindowTitle = () => {
5664
+ if (!output.isTTY) return;
5665
+ const env = options.env ?? process.env;
5666
+ const rawSetting = (env.NOLO_TUI_TITLE ?? "").trim().toLowerCase();
5667
+ if (rawSetting === "0" || rawSetting === "false") return;
5668
+ const currentTitle = state.dialogLabel?.trim() ?? "";
5669
+ if (currentTitle === lastSentTitle) return;
5670
+ lastSentTitle = currentTitle;
5671
+ output.write(buildWindowTitle(currentTitle));
5672
+ };
5673
+ syncWindowTitle();
5162
5674
  let fixedInput = createNoopFixedInput();
5163
5675
  let buffer = "";
5164
5676
  let cursorPos = 0;
@@ -5184,6 +5696,13 @@ async function startTuiWorkspace(options) {
5184
5696
  }
5185
5697
  });
5186
5698
  const activityReporter = (label) => activityIndicator.report(label);
5699
+ const reportedRunStatuses = /* @__PURE__ */ new Map();
5700
+ const runRegistryPoller = createRunRegistryPoller({
5701
+ getDockedRuns: () => activityIndicator.getAgentRuns(),
5702
+ update: (snapshot) => activityIndicator.updateAgentRun(snapshot),
5703
+ readRecord: (runId) => readRunRecord(runId),
5704
+ reconcile: (runId) => checkStaleRun(runId)
5705
+ });
5187
5706
  let explicitAgentSwitch = false;
5188
5707
  let copyViewExitResolver = null;
5189
5708
  let copyViewRender = null;
@@ -5317,7 +5836,8 @@ async function startTuiWorkspace(options) {
5317
5836
  if (!isInteractiveInput(input)) return;
5318
5837
  const detected2 = await detectTerminalBackground({
5319
5838
  stdin: input,
5320
- stdout: output
5839
+ stdout: output,
5840
+ allowSystemFallback: true
5321
5841
  });
5322
5842
  if (sessionEnded) return;
5323
5843
  if (!detected2) {
@@ -5348,6 +5868,7 @@ async function startTuiWorkspace(options) {
5348
5868
  forcedStop = false;
5349
5869
  turnEpoch += 1;
5350
5870
  const myEpoch = turnEpoch;
5871
+ const turnParentDialogId = state.dialogId;
5351
5872
  history.followBottom = true;
5352
5873
  startTurn(history, "user");
5353
5874
  appendToCurrentTurn(history, message);
@@ -5397,6 +5918,7 @@ async function startTuiWorkspace(options) {
5397
5918
  onAgentRunStatus: (snapshot) => {
5398
5919
  if (snapshot) {
5399
5920
  activityIndicator.updateAgentRun(snapshot);
5921
+ runRegistryPoller.ensureRunning();
5400
5922
  } else {
5401
5923
  activityIndicator.clearAgentRun();
5402
5924
  }
@@ -5463,6 +5985,14 @@ async function startTuiWorkspace(options) {
5463
5985
  emitCommandOutput(t("dialogNotSavedHint"));
5464
5986
  }
5465
5987
  }
5988
+ if (!wasAborted) {
5989
+ const overlayText = buildTuiRunOverlay(turnParentDialogId, reportedRunStatuses);
5990
+ if (overlayText) {
5991
+ emitCommandOutput(`
5992
+ \u4F60\u7684 run \u8FDB\u5C55\uFF1A
5993
+ ${overlayText}`);
5994
+ }
5995
+ }
5466
5996
  return { ok: !wasAborted, aborted: wasAborted };
5467
5997
  } finally {
5468
5998
  activityIndicator.stop();
@@ -5613,7 +6143,8 @@ async function startTuiWorkspace(options) {
5613
6143
  if (result.action?.type === "theme-refresh") {
5614
6144
  const detected2 = await detectTerminalBackground({
5615
6145
  stdin: input,
5616
- stdout: output
6146
+ stdout: output,
6147
+ allowSystemFallback: true
5617
6148
  });
5618
6149
  if (detected2 && applyDetectedBackground(detected2)) {
5619
6150
  emitCommandOutput(t("themeRefreshed", detected2.brightness));
@@ -5878,11 +6409,7 @@ ${err.message}` : ""}`
5878
6409
  let busy = false;
5879
6410
  let done = false;
5880
6411
  let resolveDone = null;
5881
- fixedInput = createFixedInput(output, {
5882
- getTitleLine: () => {
5883
- const title = state.dialogLabel?.trim();
5884
- return title ? themeText(`\u{1F4AC} ${title}`, "accent", resolveCliColorEnabled()) : null;
5885
- },
6412
+ const baseFixedInput = createFixedInput(output, {
5886
6413
  getStatusLine: () => {
5887
6414
  let base = renderStatusLine(state);
5888
6415
  if (chatQueueBinding && chatQueueBinding.queueLength() > 0) {
@@ -5912,6 +6439,13 @@ ${err.message}` : ""}`
5912
6439
  renderHistoryToOutput();
5913
6440
  }
5914
6441
  });
6442
+ fixedInput = {
6443
+ ...baseFixedInput,
6444
+ repaint(draft, cursorPos2) {
6445
+ syncWindowTitle();
6446
+ return baseFixedInput.repaint(draft, cursorPos2);
6447
+ }
6448
+ };
5915
6449
  fixedInput.init();
5916
6450
  const paintFrame = (draft) => {
5917
6451
  renderHistoryToOutput();
@@ -5941,6 +6475,8 @@ ${err.message}` : ""}`
5941
6475
  clearInterval(autoThemeTimer);
5942
6476
  autoThemeTimer = null;
5943
6477
  }
6478
+ runRegistryPoller.dispose();
6479
+ activityIndicator.dispose();
5944
6480
  resolveDone?.();
5945
6481
  clearCollapsedPasteStore(pasteStore);
5946
6482
  resizeTarget.off?.("resize", onResize);
@@ -6319,7 +6855,13 @@ ${renderStatusLine(state)}
6319
6855
  rl.prompt();
6320
6856
  }
6321
6857
  } finally {
6322
- getProcessRegistry().stopAll();
6858
+ const registry = getProcessRegistry();
6859
+ const persistentCount = registry.list().filter((p) => p.persist && p.status === "running").length;
6860
+ registry.stopAll();
6861
+ if (persistentCount > 0) {
6862
+ output.write(`[nolo] ${t("persistentProcessesLeft", String(persistentCount))}
6863
+ `);
6864
+ }
6323
6865
  rl.close();
6324
6866
  }
6325
6867
  }
@@ -6329,6 +6871,8 @@ export {
6329
6871
  applyOutputChunkToCurrentTurn,
6330
6872
  applyScrollAction,
6331
6873
  applyTerminalOutputToText,
6874
+ buildTuiRunOverlay,
6875
+ buildWindowTitle,
6332
6876
  countPhysicalLines,
6333
6877
  createFixedInput,
6334
6878
  createHistoryOutputStream,