nolo-cli 0.246.0-alpha.1 → 0.247.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/{_executeModel-5FOV5A3C.js → _executeModel-GIFVXKDT.js} +35 -35
  2. package/{accountResolver-QETKNC7T.js → accountResolver-NGICIMEE.js} +1 -1
  3. package/{action-R2EIXR7I.js → action-WZTKEF5H.js} +5 -5
  4. package/{addContentAction-W6JVLQ6H.js → addContentAction-MLI6GOBV.js} +8 -8
  5. package/{addDialogAgentAction-LVNKMXKZ.js → addDialogAgentAction-ARGQM22H.js} +7 -7
  6. package/{agentDeleteCommand-EKGFL4M7.js → agentDeleteCommand-UF7XVELS.js} +53 -53
  7. package/{agentEmailCommands-YHEW42IW.js → agentEmailCommands-SFHRPQYC.js} +53 -53
  8. package/{agentListCommands-CVYNO54Q.js → agentListCommands-IXKBP3W5.js} +15 -15
  9. package/{agentMachineCommands-2XWZXMAN.js → agentMachineCommands-7NX6PWQ6.js} +11 -11
  10. package/{agentPullCommand-QQQZSC6S.js → agentPullCommand-4EQZYHU4.js} +1 -1
  11. package/{agentRecordCommands-25R5YL5N.js → agentRecordCommands-IUNX6XD6.js} +52 -52
  12. package/{agentRunCommand-TW4YOXIV.js → agentRunCommand-LCR4XADM.js} +53 -53
  13. package/{agentRunControl-CSMSJFFB.js → agentRunControl-RN2P6AOD.js} +2 -2
  14. package/{agentRuntimeLocal-NC6CTZED.js → agentRuntimeLocal-LVXPQ7QA.js} +7 -7
  15. package/{agentSlice-6V2DXM4I.js → agentSlice-ZGMOH6TE.js} +8 -8
  16. package/{appDeleteCommands-LH7LQ6IZ.js → appDeleteCommands-BESCJOQM.js} +12 -12
  17. package/{appDeployCommands-HLXUS5WI.js → appDeployCommands-LPTR6IOX.js} +12 -12
  18. package/{appDeployStatusCommands-6IGCM32K.js → appDeployStatusCommands-BZ7KZ5RD.js} +12 -12
  19. package/{appGetCommands-G7PYU6CW.js → appGetCommands-EDWGJV4S.js} +12 -12
  20. package/{appListCommands-YWFISFO3.js → appListCommands-OPRWYPM6.js} +12 -12
  21. package/{authCommand-PVZ45QRO.js → authCommand-3C3RN4OU.js} +7 -7
  22. package/{authCommands-6AUYO65N.js → authCommands-ZMVEDCQD.js} +3 -3
  23. package/{builtinSkillRegistry-K7XDZWQJ.js → builtinSkillRegistry-VRCMQ77Q.js} +1 -1
  24. package/{chromeCommands-S7AW3AOD.js → chromeCommands-O4IIKTBD.js} +1 -1
  25. package/{chromeOpsCommands-TBPM6MR4.js → chromeOpsCommands-NZITLHWO.js} +3 -3
  26. package/{chunk-ZMRPZPEZ.js → chunk-2BKNICGK.js} +1 -1
  27. package/{chunk-3Z7YM7RQ.js → chunk-3DJJ4CFG.js} +4 -4
  28. package/{chunk-QIVE5WJE.js → chunk-4IQN6FWY.js} +1 -1
  29. package/{chunk-MU2PJQ4K.js → chunk-6CXQ3YNJ.js} +10 -10
  30. package/{chunk-AKKID57M.js → chunk-6MTVACLN.js} +47 -10
  31. package/{chunk-XGWRH3OF.js → chunk-6TVYUQRM.js} +22 -6
  32. package/{chunk-QOURTDZL.js → chunk-6XVPMGXK.js} +1 -1
  33. package/{chunk-MEDPR36J.js → chunk-73PZD7JZ.js} +2 -2
  34. package/{chunk-7GZY6HB7.js → chunk-7UVVLYKC.js} +2 -2
  35. package/{chunk-VEVLLBFK.js → chunk-ADOOL3PG.js} +1 -1
  36. package/{chunk-XKV53E4E.js → chunk-AEZBAFC6.js} +21 -6
  37. package/{chunk-AVSZ6PBM.js → chunk-ARFCL53U.js} +3 -3
  38. package/{chunk-MECW2HJG.js → chunk-BAH3BAUZ.js} +4 -4
  39. package/{chunk-LELADM5Q.js → chunk-BFKJ2RS3.js} +1 -1
  40. package/{chunk-56O2J2Y4.js → chunk-BVEDT6DM.js} +2 -2
  41. package/{chunk-IFWXH7LH.js → chunk-CD64YXRB.js} +1 -1
  42. package/{chunk-EQZZASCD.js → chunk-CIGCTSBF.js} +1 -1
  43. package/{chunk-X3XNXLHF.js → chunk-CIUZXD5D.js} +2 -2
  44. package/{chunk-TB5KTLNB.js → chunk-CTIEJRTP.js} +25 -1
  45. package/{chunk-DLT2DN4M.js → chunk-D25ONVOH.js} +1 -1
  46. package/{chunk-OGZE6BZG.js → chunk-E5RYFR7E.js} +29 -16
  47. package/{chunk-R7PFDD5L.js → chunk-EQZQUQ33.js} +4 -4
  48. package/{chunk-2YGBI2XB.js → chunk-FE7G6DSP.js} +11 -1
  49. package/{chunk-RXTZB2DH.js → chunk-FFFKAOJN.js} +1 -1
  50. package/{chunk-PUNGLYNR.js → chunk-FTWAOKFU.js} +29 -29
  51. package/{chunk-YRIRQSEP.js → chunk-HCCQEMTK.js} +9 -9
  52. package/{chunk-PDAXMBLW.js → chunk-HZDK56EK.js} +7 -7
  53. package/{chunk-7VNVB4OY.js → chunk-IIOSZAJX.js} +2 -2
  54. package/{chunk-Z6YTCDU4.js → chunk-IIRJ4P4I.js} +1 -1
  55. package/{chunk-UJUDZCJ7.js → chunk-IJZC2KIJ.js} +1 -1
  56. package/{chunk-2DWSICJH.js → chunk-ITBX27W6.js} +1 -1
  57. package/{chunk-X5QZF3ZS.js → chunk-J2VIGDJN.js} +3 -3
  58. package/{chunk-WPXDXATD.js → chunk-JEWMQR6J.js} +1 -1
  59. package/{chunk-KMDHRVS7.js → chunk-JFRJEPFI.js} +2 -2
  60. package/{chunk-RC3ZT4AH.js → chunk-JU7VN4LF.js} +6 -6
  61. package/{chunk-ZYKJBRZ3.js → chunk-K7VIXYTZ.js} +1 -3
  62. package/{chunk-5QX6DBZP.js → chunk-KLAMJNKQ.js} +2 -2
  63. package/{chunk-JRRDP7EB.js → chunk-KXOPLLFP.js} +16 -0
  64. package/{chunk-XOZNL36S.js → chunk-KZ5OD2MO.js} +2 -2
  65. package/{chunk-IOIWS357.js → chunk-LMGFVH65.js} +10 -10
  66. package/{chunk-76HAJUOJ.js → chunk-MTM4LRVG.js} +2 -2
  67. package/{chunk-XWJXQLQB.js → chunk-N74XL3NI.js} +6 -6
  68. package/{chunk-QRZZV4NY.js → chunk-OAZP4TSA.js} +1 -1
  69. package/{chunk-E4BAGLDK.js → chunk-ODBYGVO2.js} +4 -4
  70. package/{chunk-SESKIWB4.js → chunk-OLGFIQN2.js} +1 -1
  71. package/{chunk-F26GAEH3.js → chunk-OYUMJMC5.js} +5 -0
  72. package/{chunk-4TVOZGOS.js → chunk-PBPXXMWZ.js} +1 -1
  73. package/{chunk-NYLA6SRJ.js → chunk-QMNVV3YM.js} +8 -8
  74. package/{chunk-Y7N45DS6.js → chunk-R5NRFXGD.js} +3 -3
  75. package/{chunk-T23G6PXQ.js → chunk-RHBD22LV.js} +1 -1
  76. package/{chunk-2TIH3JQK.js → chunk-RMWDKLBE.js} +479 -102
  77. package/{chunk-UTGHPMQL.js → chunk-RR3MB26M.js} +2 -2
  78. package/{chunk-TGFFUUVC.js → chunk-SCMYAGQE.js} +103 -62
  79. package/{chunk-KC2QVCI7.js → chunk-SPU3L3OR.js} +5 -4
  80. package/{chunk-QLUYDJST.js → chunk-TMRJGSK2.js} +1 -1
  81. package/{chunk-UAIHKQIA.js → chunk-U6RD332P.js} +18 -2
  82. package/{chunk-KB5RQRSJ.js → chunk-UF6J7NXV.js} +1 -1
  83. package/{chunk-EQ7LQZ6U.js → chunk-UOUMPHS5.js} +1 -0
  84. package/{chunk-CJQBWHNM.js → chunk-V4IYI3SB.js} +2 -2
  85. package/{chunk-EXZBHOTV.js → chunk-VKCPKCSS.js} +4 -4
  86. package/{chunk-2BSLGODA.js → chunk-W6T4FNZP.js} +1 -1
  87. package/{chunk-FMYNIAI6.js → chunk-WQDTSK5U.js} +2 -2
  88. package/{chunk-QE5WJFUT.js → chunk-X22AUZKL.js} +9 -9
  89. package/{chunk-2IPR4PBB.js → chunk-X3OZ655T.js} +2 -2
  90. package/{chunk-VX5ABJWX.js → chunk-XCA4WHX5.js} +1 -1
  91. package/{chunk-LC5CVWP2.js → chunk-XJSEST7D.js} +3 -3
  92. package/{chunk-O72CE7QS.js → chunk-XNTZD4AE.js} +201 -57
  93. package/{chunk-TIZSX3UY.js → chunk-XSRSAU3O.js} +3 -3
  94. package/{chunk-TCQ27BXD.js → chunk-Y4NPF2UN.js} +3 -3
  95. package/{chunk-VHXADZ32.js → chunk-YDRRGVT5.js} +1 -1
  96. package/{chunk-PPIQDGJT.js → chunk-YFW4H6DL.js} +20 -20
  97. package/{chunk-5PASH2MB.js → chunk-YHNUDTU4.js} +4 -3
  98. package/{chunk-WBSJAIZP.js → chunk-YJPK35HB.js} +5 -0
  99. package/{chunk-EJYSKGP2.js → chunk-Z7KE4K3H.js} +2 -2
  100. package/{chunk-5VVP7DW3.js → chunk-ZM5AZTQG.js} +2 -2
  101. package/{cliLocalAgentRecordReader-P2DQNSEC.js → cliLocalAgentRecordReader-MCQVRWBR.js} +9 -9
  102. package/{commandRegistry-LDTVFRZB.js → commandRegistry-NTH5IAN5.js} +86 -86
  103. package/{contentThunks-7NW3FSQG.js → contentThunks-SPXTX5U2.js} +14 -14
  104. package/{cooldownCommands-QL6DWGVU.js → cooldownCommands-TIFCHCUN.js} +1 -1
  105. package/{createAgentAutomationAction-TGVXPVGN.js → createAgentAutomationAction-KUQKCOXB.js} +14 -14
  106. package/{createDialogAction-RJHKOVR6.js → createDialogAction-HJN5U3XS.js} +15 -15
  107. package/{createPageAction-ITSOI5CP.js → createPageAction-ZAHRDOAU.js} +15 -15
  108. package/{db-6NRZLEW2.js → db-CMUTP3W5.js} +2 -2
  109. package/{dbSlice-5MQ3ELID.js → dbSlice-656PMWR2.js} +7 -7
  110. package/{deleteFile-VCCHS72Y.js → deleteFile-ZCQESEEQ.js} +5 -5
  111. package/{dialogCommands-NL4R34MT.js → dialogCommands-KZTZLWPZ.js} +16 -16
  112. package/{dialogSlice-Q7G57NZU.js → dialogSlice-BXIERQHO.js} +12 -12
  113. package/{dialogUsageCommand-BZPKR3DW.js → dialogUsageCommand-6RW2FY6K.js} +1 -1
  114. package/{docCreateCommands-ZBB6DEY3.js → docCreateCommands-26HJ5NAY.js} +11 -11
  115. package/{docDeleteCommands-2Z5BTK3R.js → docDeleteCommands-UAOHH5XK.js} +12 -12
  116. package/{docReadCommands-GQIS4TGE.js → docReadCommands-4ADG7YE6.js} +11 -11
  117. package/{docStore-623WNKKR.js → docStore-FZ75HWP2.js} +8 -8
  118. package/{docUpdateCommands-NZ7B235E.js → docUpdateCommands-OGFJZENF.js} +11 -11
  119. package/{handleSendMessageAction-JR7DIXB3.js → handleSendMessageAction-KP6GGBFY.js} +26 -26
  120. package/{hostCredentialCreate-TNV4AR2P.js → hostCredentialCreate-23TX56G7.js} +52 -52
  121. package/index.js +8 -8
  122. package/{localDialogRead-3T2KMCRC.js → localDialogRead-CIOTQM5T.js} +1 -1
  123. package/{localRuntimeAdapter-AE5LKWC7.js → localRuntimeAdapter-MTUWOYPN.js} +50 -50
  124. package/{localRuntimeAuthority-7DKIT7UH.js → localRuntimeAuthority-TYHQCTZN.js} +2 -2
  125. package/{localRuntimeDb-5WZ4RJJO.js → localRuntimeDb-BO7IVWAZ.js} +1 -1
  126. package/{machineCommands-Q62F6WLR.js → machineCommands-4WJUJQHW.js} +51 -51
  127. package/{machineWsRunDispatch-N23VJDOE.js → machineWsRunDispatch-V3U4JM67.js} +51 -51
  128. package/{mcpLocalAuthorizeCommand-DA6DT6B6.js → mcpLocalAuthorizeCommand-TI656UWC.js} +4 -4
  129. package/{memberThunks-KC3WJGL3.js → memberThunks-JFYC4Z5L.js} +9 -9
  130. package/package.json +1 -1
  131. package/{projectArchive-SJ72VBM2.js → projectArchive-NU2Z5HOR.js} +15 -15
  132. package/{read-T7VU2IMO.js → read-BRZHXUJ6.js} +5 -5
  133. package/{readDocTool-BPQ3QJSD.js → readDocTool-N7RVFQEE.js} +1 -1
  134. package/{readlineWorkspace-YCPJTRW5.js → readlineWorkspace-T56MRMS5.js} +589 -217
  135. package/{removeDialogAgentAction-FEUUVMYC.js → removeDialogAgentAction-J7XU7OUX.js} +9 -9
  136. package/{runAgentClientLoop-4Y6A5RP2.js → runAgentClientLoop-O2GRCGRZ.js} +33 -33
  137. package/{runtimeDoctorCommands-XQD4MN4I.js → runtimeDoctorCommands-RDRJXMXC.js} +2 -2
  138. package/{secretCommands-LH7QTJO2.js → secretCommands-2FEMRUFM.js} +2 -2
  139. package/{setDialogExtraReferencesAction-JSTQJPXL.js → setDialogExtraReferencesAction-Q4V2ZZW2.js} +8 -8
  140. package/{setPrimaryDialogAgentAction-Z2BQE3IY.js → setPrimaryDialogAgentAction-742H5S6T.js} +9 -9
  141. package/{settingThunks-VP3E3JRQ.js → settingThunks-T4FXSV6M.js} +11 -11
  142. package/{spaceCommands-DT7C6IJY.js → spaceCommands-W5TAVFDT.js} +11 -11
  143. package/{streamAgentChatTurn-CO345TNB.js → streamAgentChatTurn-OWDJMU5E.js} +36 -36
  144. package/{switchDialogAgentAction-G7XVAOGH.js → switchDialogAgentAction-HLDLHRRA.js} +7 -7
  145. package/{tableCommands-UHEA5QNL.js → tableCommands-44GC4N6J.js} +2 -2
  146. package/{tools-DYRSY7A7.js → tools-O7SGGVA3.js} +29 -29
  147. package/{tuiRestart-3J7LRMPR.js → tuiRestart-EOGC2BYY.js} +3 -3
  148. package/{tuiSummaryLlmCaller-2J6NG53N.js → tuiSummaryLlmCaller-TM5BU73J.js} +2 -2
  149. package/{updateCommands-5OYND6EF.js → updateCommands-FBYA5WVG.js} +3 -3
  150. package/{updateDialogTitleAction-SHVYVWSO.js → updateDialogTitleAction-EXSZGTLL.js} +14 -14
  151. package/{usageCommand-SK7JTEPC.js → usageCommand-L4OFWXEU.js} +2 -2
  152. package/{usageRebuildCommand-DF3HUP6F.js → usageRebuildCommand-7JR33UHS.js} +2 -2
  153. package/{windowsSelfUpdate-HIYNL3VR.js → windowsSelfUpdate-M4V77OUB.js} +2 -2
  154. package/{workContextAccess-UZHDLBUR.js → workContextAccess-VU5I4LKZ.js} +1 -1
@@ -12,7 +12,7 @@ import {
12
12
  runXaiOAuthDeviceCode,
13
13
  runXaiOAuthLogin,
14
14
  syncCredentialToServer
15
- } from "./chunk-MECW2HJG.js";
15
+ } from "./chunk-BAH3BAUZ.js";
16
16
  import {
17
17
  createAccountSessionCore,
18
18
  createDeviceAuthorizationProtocol,
@@ -20,17 +20,17 @@ import {
20
20
  parseStoredTokenEntries,
21
21
  parseUserToken,
22
22
  saveTokenLogin
23
- } from "./chunk-KC2QVCI7.js";
23
+ } from "./chunk-SPU3L3OR.js";
24
24
  import {
25
25
  listFavoriteAgentIdsAcrossServers,
26
26
  listLocalCachedAgents,
27
27
  listRemoteAgents,
28
28
  listRemoteAgentsAcrossServers,
29
29
  normalizeListedAgent
30
- } from "./chunk-TCQ27BXD.js";
30
+ } from "./chunk-Y4NPF2UN.js";
31
31
  import {
32
32
  runCloudflareOAuthLogin
33
- } from "./chunk-KB5RQRSJ.js";
33
+ } from "./chunk-UF6J7NXV.js";
34
34
  import {
35
35
  COLLAPSED_PASTE_PLACEHOLDER_RE,
36
36
  MAX_URL_LENGTH,
@@ -83,6 +83,7 @@ import {
83
83
  resolveAgentModelIdentity,
84
84
  resolveAuthorityTurnCount,
85
85
  resolveCliColorEnabled,
86
+ resolveCliHyperlinkEnabled,
86
87
  resolveCliMemory,
87
88
  resolveCliWorkContext,
88
89
  resolveContextUsage,
@@ -95,6 +96,7 @@ import {
95
96
  resolveTuiThemeMode,
96
97
  runAgentTurn,
97
98
  safeApprovalMultilineText,
99
+ safeApprovalSingleLineText,
98
100
  safeAskText,
99
101
  setActiveBrightness,
100
102
  setActiveThemeMode,
@@ -107,7 +109,7 @@ import {
107
109
  themeText,
108
110
  toolRowDetailLine,
109
111
  tuiRenderThemeFingerprint
110
- } from "./chunk-2TIH3JQK.js";
112
+ } from "./chunk-RMWDKLBE.js";
111
113
  import "./chunk-6QDYSCPW.js";
112
114
  import "./chunk-GAHJLSDO.js";
113
115
  import {
@@ -115,7 +117,7 @@ import {
115
117
  } from "./chunk-P27E22MA.js";
116
118
  import {
117
119
  getReadableCliDb
118
- } from "./chunk-DLT2DN4M.js";
120
+ } from "./chunk-D25ONVOH.js";
119
121
  import {
120
122
  buildCliNoticeText,
121
123
  buildNoticeTasksFromRuns,
@@ -131,13 +133,13 @@ import {
131
133
  renderNoticeElements,
132
134
  resolveNoticeTitle,
133
135
  setTurnNoticeMeta
134
- } from "./chunk-TGFFUUVC.js";
136
+ } from "./chunk-SCMYAGQE.js";
135
137
  import {
136
138
  createHostApprovalCardQueue,
137
139
  formatApprovalRemaining,
138
140
  registerHostApprovalRenderer
139
- } from "./chunk-5QX6DBZP.js";
140
- import "./chunk-2YGBI2XB.js";
141
+ } from "./chunk-KLAMJNKQ.js";
142
+ import "./chunk-FE7G6DSP.js";
141
143
  import {
142
144
  ANSI_ESCAPE_REGEX,
143
145
  anthropicGrantRemainingMs,
@@ -155,6 +157,7 @@ import {
155
157
  runOpenAiCodexBrowserPkce,
156
158
  runOpenAiCodexDeviceCode,
157
159
  stripAnsi,
160
+ stripAnsiKeepingOsc8,
158
161
  takeDisplayWidth,
159
162
  tokenizeAnsiLine,
160
163
  truncateAnsi,
@@ -162,20 +165,20 @@ import {
162
165
  wrapTextToLines,
163
166
  wrapTranscriptLine,
164
167
  wrapTranscriptLineWithLayout
165
- } from "./chunk-XGWRH3OF.js";
168
+ } from "./chunk-6TVYUQRM.js";
166
169
  import "./chunk-WWTSEBDF.js";
167
170
  import "./chunk-VTHWBTRE.js";
168
- import "./chunk-UAIHKQIA.js";
171
+ import "./chunk-U6RD332P.js";
169
172
  import "./chunk-WOAZVUSN.js";
170
173
  import {
171
174
  getRestartBlocker,
172
175
  hasRestartBlockingRuns
173
- } from "./chunk-4TVOZGOS.js";
176
+ } from "./chunk-PBPXXMWZ.js";
174
177
  import "./chunk-4D4QD7FT.js";
175
178
  import "./chunk-PVFYPUIM.js";
176
179
  import "./chunk-53W5BXLN.js";
177
180
  import "./chunk-QHEN7NZ7.js";
178
- import "./chunk-Z6YTCDU4.js";
181
+ import "./chunk-IIRJ4P4I.js";
179
182
  import "./chunk-C5A54QS7.js";
180
183
  import "./chunk-6RSNVJGO.js";
181
184
  import "./chunk-324FWHUA.js";
@@ -194,11 +197,11 @@ import {
194
197
  import {
195
198
  defaultPromptReader,
196
199
  setSecret
197
- } from "./chunk-VEVLLBFK.js";
200
+ } from "./chunk-ADOOL3PG.js";
198
201
  import {
199
202
  createTuiSummaryLlmCaller
200
- } from "./chunk-QIVE5WJE.js";
201
- import "./chunk-F26GAEH3.js";
203
+ } from "./chunk-4IQN6FWY.js";
204
+ import "./chunk-OYUMJMC5.js";
202
205
  import "./chunk-R7XWZDOH.js";
203
206
  import "./chunk-S73EPYNC.js";
204
207
  import "./chunk-ZEZC7IIM.js";
@@ -207,31 +210,31 @@ import "./chunk-ATNTHIZI.js";
207
210
  import "./chunk-JEXVIMYZ.js";
208
211
  import {
209
212
  prepareTools
210
- } from "./chunk-7VNVB4OY.js";
213
+ } from "./chunk-IIOSZAJX.js";
211
214
  import "./chunk-HS7MLR74.js";
212
- import "./chunk-PUNGLYNR.js";
213
- import "./chunk-VX5ABJWX.js";
215
+ import "./chunk-FTWAOKFU.js";
216
+ import "./chunk-XCA4WHX5.js";
214
217
  import "./chunk-AMWMV56B.js";
215
218
  import "./chunk-MVOZ22RZ.js";
216
219
  import "./chunk-WDWZPASX.js";
217
- import "./chunk-QRZZV4NY.js";
218
- import "./chunk-KMDHRVS7.js";
220
+ import "./chunk-OAZP4TSA.js";
221
+ import "./chunk-JFRJEPFI.js";
219
222
  import {
220
223
  formatSkillSlashReference,
221
224
  parseSkillSlashReference,
222
225
  resolveSkillSlashUserPrompt
223
226
  } from "./chunk-PRJ473FK.js";
224
227
  import "./chunk-BMQ2MJUK.js";
225
- import "./chunk-TIZSX3UY.js";
226
- import "./chunk-IOIWS357.js";
228
+ import "./chunk-XSRSAU3O.js";
229
+ import "./chunk-LMGFVH65.js";
227
230
  import "./chunk-NF64D32W.js";
228
- import "./chunk-EQ7LQZ6U.js";
229
- import "./chunk-X5QZF3ZS.js";
231
+ import "./chunk-UOUMPHS5.js";
232
+ import "./chunk-J2VIGDJN.js";
230
233
  import "./chunk-VF4K2QE6.js";
231
- import "./chunk-SESKIWB4.js";
232
- import "./chunk-IFWXH7LH.js";
233
- import "./chunk-E4BAGLDK.js";
234
- import "./chunk-YRIRQSEP.js";
234
+ import "./chunk-OLGFIQN2.js";
235
+ import "./chunk-CD64YXRB.js";
236
+ import "./chunk-ODBYGVO2.js";
237
+ import "./chunk-HCCQEMTK.js";
235
238
  import {
236
239
  createChatQueueRuntime,
237
240
  createTurnRequest,
@@ -239,49 +242,49 @@ import {
239
242
  historyTokensBeforeLatestAssistant,
240
243
  initialChatQueueState,
241
244
  normalizeRunCompletionShape
242
- } from "./chunk-PPIQDGJT.js";
245
+ } from "./chunk-YFW4H6DL.js";
243
246
  import "./chunk-TZXPT53C.js";
244
247
  import "./chunk-BUDVRYES.js";
245
248
  import {
246
249
  BUILTIN_DIALOG_LLM_FALLBACK_MODEL,
247
250
  BUILTIN_SUMMARY_LLM_CONFIG
248
251
  } from "./chunk-523DITKR.js";
249
- import "./chunk-XWJXQLQB.js";
250
- import "./chunk-RXTZB2DH.js";
252
+ import "./chunk-N74XL3NI.js";
253
+ import "./chunk-FFFKAOJN.js";
251
254
  import "./chunk-BYXBJQAS.js";
252
- import "./chunk-AVSZ6PBM.js";
255
+ import "./chunk-ARFCL53U.js";
253
256
  import {
254
257
  getActiveDialogAgentId
255
258
  } from "./chunk-5RGU3J7P.js";
256
259
  import "./chunk-UVLYNWIE.js";
257
260
  import "./chunk-YNIYE47Z.js";
258
- import "./chunk-CJQBWHNM.js";
261
+ import "./chunk-V4IYI3SB.js";
259
262
  import "./chunk-UAD2WT54.js";
260
- import "./chunk-PDAXMBLW.js";
263
+ import "./chunk-HZDK56EK.js";
261
264
  import "./chunk-3PVYUPXK.js";
262
- import "./chunk-2IPR4PBB.js";
265
+ import "./chunk-X3OZ655T.js";
263
266
  import "./chunk-HXER7YJF.js";
264
267
  import {
265
268
  isHiddenFromDialogList,
266
269
  normalizeDialogRecord,
267
270
  readDialogSnapshot,
268
271
  sortDialogs
269
- } from "./chunk-NYLA6SRJ.js";
272
+ } from "./chunk-QMNVV3YM.js";
270
273
  import "./chunk-ID4G2MAR.js";
271
274
  import {
272
275
  listUserRecordsFromServers,
273
276
  readLiveDbRecordAfterTombstoneMerge
274
- } from "./chunk-WPXDXATD.js";
277
+ } from "./chunk-JEWMQR6J.js";
275
278
  import "./chunk-Y5GCAMGP.js";
276
279
  import {
277
280
  loadLocalRunChildDialogIds
278
- } from "./chunk-EQZZASCD.js";
281
+ } from "./chunk-CIGCTSBF.js";
279
282
  import "./chunk-LKZPX6YH.js";
280
283
  import {
281
284
  deleteDbRecord,
282
285
  queryUserRecords,
283
286
  readDbRecord
284
- } from "./chunk-X3XNXLHF.js";
287
+ } from "./chunk-CIUZXD5D.js";
285
288
  import "./chunk-FGHEF6WI.js";
286
289
  import "./chunk-DXWGFL2Z.js";
287
290
  import "./chunk-3L2WKC3W.js";
@@ -295,7 +298,7 @@ import {
295
298
  listRunRecordsAsync,
296
299
  readRunRecord,
297
300
  runAgentStopCommand
298
- } from "./chunk-XKV53E4E.js";
301
+ } from "./chunk-AEZBAFC6.js";
299
302
  import {
300
303
  clipText,
301
304
  formatDuration,
@@ -311,14 +314,16 @@ import "./chunk-KQHEGELM.js";
311
314
  import "./chunk-QYPE3TS3.js";
312
315
  import "./chunk-U35UUM5K.js";
313
316
  import "./chunk-RD3QLZQV.js";
314
- import "./chunk-5VVP7DW3.js";
315
- import "./chunk-FMYNIAI6.js";
317
+ import "./chunk-ZM5AZTQG.js";
318
+ import "./chunk-WQDTSK5U.js";
316
319
  import "./chunk-UEILX4EV.js";
317
- import "./chunk-LC5CVWP2.js";
318
- import "./chunk-76HAJUOJ.js";
319
- import "./chunk-QOURTDZL.js";
320
- import "./chunk-5PASH2MB.js";
321
- import "./chunk-WBSJAIZP.js";
320
+ import "./chunk-XJSEST7D.js";
321
+ import "./chunk-MTM4LRVG.js";
322
+ import "./chunk-6XVPMGXK.js";
323
+ import "./chunk-YHNUDTU4.js";
324
+ import {
325
+ isExternalSessionKind
326
+ } from "./chunk-YJPK35HB.js";
322
327
  import "./chunk-QQ56R7KS.js";
323
328
  import "./chunk-PXYBUFDB.js";
324
329
  import {
@@ -327,20 +332,20 @@ import {
327
332
  discoverSkills
328
333
  } from "./chunk-UHW6SCVK.js";
329
334
  import "./chunk-GBWGPTA7.js";
330
- import "./chunk-2BSLGODA.js";
331
- import "./chunk-ZYKJBRZ3.js";
335
+ import "./chunk-W6T4FNZP.js";
336
+ import "./chunk-K7VIXYTZ.js";
332
337
  import "./chunk-KK3FCYZM.js";
333
338
  import "./chunk-CVMMWN6P.js";
334
339
  import {
335
340
  getDefaultCliLocalRuntimeDb
336
- } from "./chunk-LELADM5Q.js";
341
+ } from "./chunk-BFKJ2RS3.js";
337
342
  import "./chunk-GLKOYSRU.js";
338
343
  import {
339
344
  readDialogMessageRecords
340
- } from "./chunk-7GZY6HB7.js";
345
+ } from "./chunk-7UVVLYKC.js";
341
346
  import "./chunk-MZVCFV3T.js";
342
347
  import "./chunk-JP2BH4NC.js";
343
- import "./chunk-UJUDZCJ7.js";
348
+ import "./chunk-IJZC2KIJ.js";
344
349
  import {
345
350
  RUN_WAKE_CHANNEL_ENV,
346
351
  buildLoadSkillExecutor,
@@ -358,7 +363,7 @@ import {
358
363
  runTaskStop,
359
364
  saveCliPendingUserMessages,
360
365
  validateStoredSummary
361
- } from "./chunk-O72CE7QS.js";
366
+ } from "./chunk-XNTZD4AE.js";
362
367
  import "./chunk-LHCGKAFO.js";
363
368
  import "./chunk-ZNFJWEN4.js";
364
369
  import "./chunk-MYYNZG2M.js";
@@ -377,9 +382,9 @@ import {
377
382
  buildRuntimeGuidanceBlocks,
378
383
  resolveResponseGuidelines,
379
384
  resolveToolGuidedSections
380
- } from "./chunk-EJYSKGP2.js";
381
- import "./chunk-2DWSICJH.js";
382
- import "./chunk-JRRDP7EB.js";
385
+ } from "./chunk-Z7KE4K3H.js";
386
+ import "./chunk-ITBX27W6.js";
387
+ import "./chunk-KXOPLLFP.js";
383
388
  import {
384
389
  classifyFailureSubclass,
385
390
  formatQuotaSummary
@@ -394,7 +399,7 @@ import {
394
399
  scrubSecrets
395
400
  } from "./chunk-WFGNWWJI.js";
396
401
  import "./chunk-VUHKG4KS.js";
397
- import "./chunk-VHXADZ32.js";
402
+ import "./chunk-YDRRGVT5.js";
398
403
  import "./chunk-2MBTWINN.js";
399
404
  import {
400
405
  extractReferenceKeysFromMessage
@@ -428,7 +433,7 @@ import "./chunk-KX6YBIHG.js";
428
433
  import {
429
434
  formatToolOverflowMarker,
430
435
  getProcessRegistry
431
- } from "./chunk-TB5KTLNB.js";
436
+ } from "./chunk-CTIEJRTP.js";
432
437
  import {
433
438
  isQuotaExhaustedError
434
439
  } from "./chunk-EWQ3HGNZ.js";
@@ -464,7 +469,7 @@ import {
464
469
  import {
465
470
  expandEnabledPacks,
466
471
  listBuiltinSkills
467
- } from "./chunk-AKKID57M.js";
472
+ } from "./chunk-6MTVACLN.js";
468
473
  import {
469
474
  parseExternalSkillMarkdown
470
475
  } from "./chunk-AETZ7AD6.js";
@@ -512,7 +517,7 @@ import {
512
517
  getCliInstallChannel,
513
518
  probeCliUpdate,
514
519
  runSelfUpdateDetailed
515
- } from "./chunk-MEDPR36J.js";
520
+ } from "./chunk-73PZD7JZ.js";
516
521
  import {
517
522
  parseUserIdFromAuthToken,
518
523
  resolveAuthToken,
@@ -541,7 +546,7 @@ import {
541
546
  resolveDefaultSpawn,
542
547
  spawnProcess
543
548
  } from "./chunk-4O22PGNQ.js";
544
- import "./chunk-QLUYDJST.js";
549
+ import "./chunk-TMRJGSK2.js";
545
550
  import {
546
551
  dailyWelcomeTip,
547
552
  getCliLocale,
@@ -549,9 +554,9 @@ import {
549
554
  parseCliLocale,
550
555
  setCliLocale,
551
556
  t,
552
- toolIcon,
553
- toolLabel
554
- } from "./chunk-OGZE6BZG.js";
557
+ toolFamilyOf,
558
+ toolLabelVariants
559
+ } from "./chunk-E5RYFR7E.js";
555
560
  import "./chunk-6ASGEP5D.js";
556
561
  import "./chunk-CTWCZKNS.js";
557
562
  import {
@@ -2599,7 +2604,10 @@ function applyTreeRewrite(text, chunk) {
2599
2604
  const bodyLines = body.split("\n");
2600
2605
  const plainLines = bodyLines.map((line) => stripAnsi(line));
2601
2606
  const tail = plainLines.at(-1) ?? "";
2602
- const labels = TUI_TREE_TOOLS[payload.kind].flatMap((name) => [toolIcon(name), toolLabel(name)]);
2607
+ const labels = TUI_TREE_TOOLS[payload.kind].flatMap((name) => {
2608
+ const fam = toolFamilyOf(name);
2609
+ return [fam.icon, fam.en, fam.zh, ...toolLabelVariants(name)];
2610
+ });
2603
2611
  const flatLabel = tail.match(/^▸ (.+?)(?: · .*?)? ✓(?: \d+(?:\.\d+)?(?:ms|s))*$/)?.[1];
2604
2612
  const summaryLabel = tail.match(/^▸ (.+?) \(\d+\) · .* ✓$/)?.[1];
2605
2613
  if (payload.previousRow !== void 0) {
@@ -2654,7 +2662,7 @@ function styleAssistantTurn(content, colorEnabled, state = assistantLayoutState(
2654
2662
  content = content.split("\n").map(
2655
2663
  (line) => /^[●▸✦✗]/.test(stripAnsi(line)) && /\x1b\[(?:48;2;[0-9;]+|100)m/.test(line) ? line.replace(/ +(?=(?:\x1b\[[0-9;]*m)*$)/, "") : line
2656
2664
  ).join("\n");
2657
- const highlighted = colorEnabled ? formatAssistantDisplay(content, { trimEdges: false }) : stripAnsi(formatAssistantDisplay(content, { trimEdges: false }));
2665
+ const highlighted = colorEnabled ? formatAssistantDisplay(content, { trimEdges: false }) : resolveCliHyperlinkEnabled() ? stripAnsiKeepingOsc8(formatAssistantDisplay(content, { trimEdges: false })) : stripAnsi(formatAssistantDisplay(content, { trimEdges: false }));
2658
2666
  const rawLines = highlighted.split("\n");
2659
2667
  let { anchored, inToolBlock } = state;
2660
2668
  const styledLines = rawLines.map((line) => {
@@ -3627,13 +3635,13 @@ function createDialogHost(args) {
3627
3635
  };
3628
3636
  let operationRunning = false;
3629
3637
  const operations = [];
3630
- const exclusive = (body, cancellation) => new Promise((resolve5, reject) => {
3638
+ const exclusive = (body, cancellation) => new Promise((resolve4, reject) => {
3631
3639
  const abortQueued = () => {
3632
3640
  const index = operations.indexOf(start);
3633
3641
  if (index < 0) return;
3634
3642
  operations.splice(index, 1);
3635
3643
  cancellation?.signal.removeEventListener("abort", abortQueued);
3636
- resolve5(cancellation.cancelled());
3644
+ resolve4(cancellation.cancelled());
3637
3645
  };
3638
3646
  const start = () => {
3639
3647
  cancellation?.signal.removeEventListener("abort", abortQueued);
@@ -3654,7 +3662,7 @@ function createDialogHost(args) {
3654
3662
  void Promise.resolve(result).then(
3655
3663
  (value) => {
3656
3664
  release();
3657
- resolve5(value);
3665
+ resolve4(value);
3658
3666
  },
3659
3667
  (error) => {
3660
3668
  release();
@@ -3663,7 +3671,7 @@ function createDialogHost(args) {
3663
3671
  );
3664
3672
  };
3665
3673
  if (cancellation?.signal.aborted) {
3666
- resolve5(cancellation.cancelled());
3674
+ resolve4(cancellation.cancelled());
3667
3675
  return;
3668
3676
  }
3669
3677
  if (operationRunning) {
@@ -4040,9 +4048,9 @@ function createRawKeyReader(input, options) {
4040
4048
  };
4041
4049
  const resolveWaiter = (value) => {
4042
4050
  if (!waiter) return;
4043
- const resolve5 = waiter;
4051
+ const resolve4 = waiter;
4044
4052
  waiter = null;
4045
- resolve5(value);
4053
+ resolve4(value);
4046
4054
  };
4047
4055
  const tryDeliver = () => {
4048
4056
  if (!waiter) return;
@@ -4101,12 +4109,12 @@ function createRawKeyReader(input, options) {
4101
4109
  input.on("close", onClose);
4102
4110
  input.on("end", onClose);
4103
4111
  input.resume?.();
4104
- const reader = () => new Promise((resolve5) => {
4112
+ const reader = () => new Promise((resolve4) => {
4105
4113
  if (closed) {
4106
- resolve5(drainClosed());
4114
+ resolve4(drainClosed());
4107
4115
  return;
4108
4116
  }
4109
- waiter = resolve5;
4117
+ waiter = resolve4;
4110
4118
  tryDeliver();
4111
4119
  });
4112
4120
  reader.dispose = () => {
@@ -4141,8 +4149,8 @@ async function runSelectDialog(args) {
4141
4149
  const input = args.input ?? process.stdin;
4142
4150
  const readKey = args.readKey ?? createRawKeyReader(input, hotkeys ? { preserveBracketedPaste: true } : void 0);
4143
4151
  let cancelRead;
4144
- const cancelled = new Promise((resolve5) => {
4145
- cancelRead = () => resolve5(STREAM_CLOSED);
4152
+ const cancelled = new Promise((resolve4) => {
4153
+ cancelRead = () => resolve4(STREAM_CLOSED);
4146
4154
  });
4147
4155
  args.signal?.addEventListener("abort", cancelRead, { once: true });
4148
4156
  if (args.signal?.aborted) cancelRead();
@@ -4686,7 +4694,7 @@ var AccountSessionService = class {
4686
4694
  } catch {
4687
4695
  throw new Error("invalid_session_token");
4688
4696
  }
4689
- if (!secret || extra !== void 0 || typeof payload !== "object" || payload === null || Array.isArray(payload) || Object.keys(payload).some((key) => !["authKind", "userId", "username", "exp"].includes(key)) || payload.authKind !== "google-session-v1") {
4697
+ if (!secret || extra !== void 0 || typeof payload !== "object" || payload === null || Array.isArray(payload) || Object.keys(payload).some((key) => !["authKind", "userId", "username", "exp"].includes(key)) || !isExternalSessionKind(payload.authKind)) {
4690
4698
  throw new Error("invalid_session_token");
4691
4699
  }
4692
4700
  await this.persistAndActivate(result.token);
@@ -6051,11 +6059,11 @@ function createSecretInputCoordinator() {
6051
6059
  };
6052
6060
  return {
6053
6061
  enqueue(start, options) {
6054
- return new Promise((resolve5) => {
6055
- const entry = { start, settle: resolve5, cancelled: options.cancelled, controller: new AbortController(), detach: () => options.signal?.removeEventListener("abort", abort) };
6062
+ return new Promise((resolve4) => {
6063
+ const entry = { start, settle: resolve4, cancelled: options.cancelled, controller: new AbortController(), detach: () => options.signal?.removeEventListener("abort", abort) };
6056
6064
  const abort = () => cancel(entry);
6057
6065
  if (closed || options.signal?.aborted) {
6058
- resolve5(options.cancelled());
6066
+ resolve4(options.cancelled());
6059
6067
  return;
6060
6068
  }
6061
6069
  queue.push(entry);
@@ -6067,9 +6075,9 @@ function createSecretInputCoordinator() {
6067
6075
  if (active) {
6068
6076
  if (!active.controller.signal.aborted) {
6069
6077
  if (waiter) {
6070
- const resolve5 = waiter;
6078
+ const resolve4 = waiter;
6071
6079
  waiter = null;
6072
- resolve5(token);
6080
+ resolve4(token);
6073
6081
  } else inbox.push(token);
6074
6082
  }
6075
6083
  return true;
@@ -6078,10 +6086,10 @@ function createSecretInputCoordinator() {
6078
6086
  const entry = queue[0];
6079
6087
  active = entry;
6080
6088
  inbox = [];
6081
- const readKey = () => new Promise((resolve5) => {
6082
- if (entry.controller.signal.aborted) resolve5(STREAM_CLOSED);
6083
- else if (inbox.length) resolve5(inbox.shift());
6084
- else waiter = resolve5;
6089
+ const readKey = () => new Promise((resolve4) => {
6090
+ if (entry.controller.signal.aborted) resolve4(STREAM_CLOSED);
6091
+ else if (inbox.length) resolve4(inbox.shift());
6092
+ else waiter = resolve4;
6085
6093
  });
6086
6094
  readKey.dispose = closeInbox;
6087
6095
  let operation;
@@ -6158,8 +6166,8 @@ async function runSecretInputDialog(args) {
6158
6166
  wakeAbort?.();
6159
6167
  readKey?.dispose?.();
6160
6168
  };
6161
- const aborted = new Promise((resolve5) => {
6162
- wakeAbort = () => resolve5(STREAM_CLOSED);
6169
+ const aborted = new Promise((resolve4) => {
6170
+ wakeAbort = () => resolve4(STREAM_CLOSED);
6163
6171
  });
6164
6172
  try {
6165
6173
  readKey = args.readKey ?? createRawKeyReader(input, { preserveBracketedPaste: true });
@@ -6245,9 +6253,30 @@ async function runSecretInputDialog(args) {
6245
6253
  }
6246
6254
  }
6247
6255
 
6256
+ // packages/cli/client/browserApprovalCopy.ts
6257
+ var actions = /* @__PURE__ */ new Map([
6258
+ ["click", "Click a control"],
6259
+ ["type", "Enter text"],
6260
+ ["press", "Press a key"],
6261
+ ["set_select_value", "Select an option"],
6262
+ ["file_upload", "Attach files"],
6263
+ ["eval_script", "Run a script"]
6264
+ ]);
6265
+ function describeBrowserApproval(action, target) {
6266
+ const isScript = action === "eval_script";
6267
+ const label = actions.get(action);
6268
+ return {
6269
+ action: label ? `${label} (${action})` : "Unknown browser action",
6270
+ target: isScript ? "Script in the target tab" : target || "Unknown control",
6271
+ impact: isScript ? "May read or modify the page and cause changes outside the page." : "May modify the page or cause changes outside the page.",
6272
+ detailLabel: isScript ? "Script preview" : "Details"
6273
+ };
6274
+ }
6275
+
6248
6276
  // packages/cli/tui/hostApprovalCard.ts
6249
- var ALLOW_KEYS = /* @__PURE__ */ new Set(["y", "Y"]);
6250
- var DENY_KEYS = /* @__PURE__ */ new Set(["n", "N"]);
6277
+ var SELECT_ALLOW = /* @__PURE__ */ new Set(["\x1B[C", "\x1BOC"]);
6278
+ var SELECT_CANCEL = /* @__PURE__ */ new Set(["\x1B[D", "\x1BOD"]);
6279
+ var ENTER = /* @__PURE__ */ new Set(["\r", "\n"]);
6251
6280
  var ESCAPE_KEYS = /* @__PURE__ */ new Set(["\x1B", "\x1B\x1B", "\x1B[27~"]);
6252
6281
  var FALLBACK_COLUMNS = 80;
6253
6282
  var LABEL_COLUMN = 9;
@@ -6292,19 +6321,65 @@ function wrapCardLine(text, width) {
6292
6321
  rows.push(row);
6293
6322
  return rows;
6294
6323
  }
6295
- function fieldRows(label, text, contentWidth, glyphs) {
6324
+ function wrapProseLine(text, width) {
6325
+ const budget = Math.max(8, width);
6326
+ if (displayWidth(text) <= budget) return [text];
6327
+ const tokens = text.split(/(\s+)/);
6328
+ const rows = [];
6329
+ let row = "";
6330
+ let rowWidth = 0;
6331
+ const pushRow = () => {
6332
+ if (row) {
6333
+ rows.push(row.trimEnd());
6334
+ row = "";
6335
+ rowWidth = 0;
6336
+ }
6337
+ };
6338
+ for (const token of tokens) {
6339
+ if (!token) continue;
6340
+ if (/^\s+$/.test(token)) {
6341
+ if (!row) continue;
6342
+ const spaceWidth = displayWidth(token);
6343
+ if (rowWidth + spaceWidth <= budget) {
6344
+ row += token;
6345
+ rowWidth += spaceWidth;
6346
+ } else {
6347
+ pushRow();
6348
+ }
6349
+ continue;
6350
+ }
6351
+ const tokenWidth = displayWidth(token);
6352
+ if (row && rowWidth + tokenWidth > budget) {
6353
+ pushRow();
6354
+ }
6355
+ if (tokenWidth <= budget) {
6356
+ row += token;
6357
+ rowWidth += tokenWidth;
6358
+ } else {
6359
+ const broken = wrapCardLine(token, budget);
6360
+ for (let i = 0; i < broken.length - 1; i++) {
6361
+ rows.push(broken[i]);
6362
+ }
6363
+ row = broken[broken.length - 1];
6364
+ rowWidth = displayWidth(row);
6365
+ }
6366
+ }
6367
+ pushRow();
6368
+ return rows.length ? rows : [""];
6369
+ }
6370
+ function fieldRows(label, text, contentWidth) {
6296
6371
  const first = ` ${label.padEnd(LABEL_COLUMN, " ")}`;
6297
6372
  const rest = " ".repeat(CONTENT_INDENT);
6298
6373
  return wrapCardLine(text, contentWidth).map(
6299
- (row, index) => `${glyphs.v}${index === 0 ? first : rest}${row}`
6374
+ (row, index) => `${index === 0 ? first : rest}${row}`
6300
6375
  );
6301
6376
  }
6302
- function detailRows(summary, contentWidth, glyphs) {
6377
+ function detailRows(summary, contentWidth) {
6303
6378
  const text = summary && summary.trim() ? summary : "(no summary)";
6304
6379
  const rows = text.split("\n").flatMap((line) => wrapCardLine(line, contentWidth));
6305
6380
  const first = ` ${"detail".padEnd(LABEL_COLUMN, " ")}`;
6306
6381
  const rest = " ".repeat(CONTENT_INDENT);
6307
- const withPrefix = (row, index) => `${glyphs.v}${index === 0 ? first : rest}${row}`;
6382
+ const withPrefix = (row, index) => `${index === 0 ? first : rest}${row}`;
6308
6383
  if (rows.length <= DETAIL_MAX_ROWS) return rows.map(withPrefix);
6309
6384
  const omission = (hidden2) => `\u2026\uFF08\u4E2D\u95F4 ${hidden2} \u884C\u672A\u663E\u793A\uFF0C\u4EE5\u4E0B\u662F\u811A\u672C\u7ED3\u5C3E\uFF09`;
6310
6385
  const reserved = wrapCardLine(omission(rows.length), contentWidth).length;
@@ -6320,25 +6395,41 @@ function detailRows(summary, contentWidth, glyphs) {
6320
6395
  }
6321
6396
  function renderHostApprovalCardLines(card, opts) {
6322
6397
  const columns = Math.max(20, opts.columns ?? FALLBACK_COLUMNS);
6323
- const contentWidth = Math.max(16, columns - CONTENT_INDENT - 2);
6398
+ const contentWidth = Math.max(1, columns - CONTENT_INDENT - 2);
6324
6399
  const expired = card.expiresAt <= opts.now;
6325
- const expiryLabel = expired ? "expired \u2014 this action was not run and will not be retried" : `${formatApprovalRemaining(card.expiresAt, opts.now)} left`;
6326
- const glyphs = boxGlyphs(resolveBoxCharset());
6400
+ const isMcp = card.actionLabel === "callMcpTool";
6401
+ const copy = describeBrowserApproval(card.actionLabel, safeApprovalSingleLineText(card.target));
6402
+ const detail = safeApprovalMultilineText(card.summary);
6403
+ const heading = isMcp ? "Call a read tool (callMcpTool)" : copy.action;
6404
+ const impact = isMcp ? "A connected service will receive the shown arguments." : copy.impact;
6405
+ const browserParts = !isMcp ? [
6406
+ safeApprovalSingleLineText(card.browser),
6407
+ safeApprovalSingleLineText(card.tabId) ? `tab ${safeApprovalSingleLineText(card.tabId)}` : ""
6408
+ ].filter(Boolean) : [];
6409
+ const actionBar = " \u276F Cancel (Enter) Allow once (\u2192 then Enter)";
6410
+ const actionRows = displayWidth(actionBar) <= columns - 1 ? [actionBar] : [
6411
+ ...wrapProseLine("\u276F Cancel (Enter)", columns - 2).map((line) => ` ${line}`),
6412
+ ...wrapProseLine("Allow once (\u2192 then Enter)", columns - 4).map((line) => ` ${line}`)
6413
+ ];
6327
6414
  const lines = [
6328
- `${glyphs.tl}${glyphs.h} Browser action needs your approval ${glyphs.h.repeat(13)}`,
6329
- ...fieldRows("action", card.actionLabel, contentWidth, glyphs),
6330
- ...fieldRows("site", card.origin || "(origin unknown)", contentWidth, glyphs),
6331
- ...detailRows(card.summary, contentWidth, glyphs),
6332
- ...fieldRows("expires", expiryLabel, contentWidth, glyphs),
6333
- // The precondition comes first so it reads before the options: with text in the composer, y/n
6334
- // are ordinary letters and the card cannot be answered.
6335
- ...fieldRows(
6336
- "keys",
6337
- expired ? "disabled (expired)" : "empty the input line first, then: y = allow once \xB7 n / Esc = deny",
6338
- contentWidth,
6339
- glyphs
6340
- ),
6341
- `${glyphs.bl}${glyphs.h.repeat(50)}`
6415
+ renderDialogRule(columns, false),
6416
+ ...wrapProseLine(heading, columns - 2).map((line) => ` ${line}`),
6417
+ "",
6418
+ ...fieldRows("target", isMcp ? safeApprovalSingleLineText(card.target) || "Unknown tool" : copy.target, contentWidth),
6419
+ ...fieldRows(isMcp ? "scope" : "site", safeApprovalSingleLineText(card.origin) || (isMcp ? "Unknown scope" : "Unknown site"), contentWidth),
6420
+ ...browserParts.length ? fieldRows("browser", browserParts.join(" \xB7 "), contentWidth) : [],
6421
+ ...wrapProseLine(impact, contentWidth).map((row, index) => `${index === 0 ? ` ${"impact".padEnd(LABEL_COLUMN, " ")}` : " ".repeat(CONTENT_INDENT)}${row}`),
6422
+ ...detail ? ["", ...detailRows(detail, contentWidth)] : [],
6423
+ "",
6424
+ ...expired ? [
6425
+ ...fieldRows("expired", "This action was not run and will not be retried.", contentWidth),
6426
+ ...fieldRows("keys", "disabled", contentWidth)
6427
+ ] : [
6428
+ ...fieldRows("expires", `${formatApprovalRemaining(card.expiresAt, opts.now)} left`, contentWidth),
6429
+ ...wrapProseLine("With an empty input line:", columns - 2).map((line) => ` ${line}`),
6430
+ ...actionRows
6431
+ ],
6432
+ renderDialogRule(columns, false)
6342
6433
  ];
6343
6434
  return lines.map((line) => clipCardLine(line, columns));
6344
6435
  }
@@ -6363,19 +6454,19 @@ function createInlineHostApprovalPrompt(args) {
6363
6454
  finishing.finish(decision);
6364
6455
  }
6365
6456
  };
6366
- const presentOne = (card, context = {}) => new Promise((resolve5) => {
6457
+ const presentOne = (card, context = {}) => new Promise((resolve4) => {
6367
6458
  if (disposed || context.signal?.aborted) {
6368
- resolve5(disposed ? "deny" : "cancelled");
6459
+ resolve4(disposed ? "deny" : "cancelled");
6369
6460
  return;
6370
6461
  }
6371
6462
  const abort = () => settle(context.signal?.reason === "expired" ? "expired" : "cancelled", "\u2716 approval ended \u2014 the action was not run");
6372
- active = { card, finish: (result) => {
6463
+ active = { card, allowSelected: false, finish: (result) => {
6373
6464
  context.signal?.removeEventListener("abort", abort);
6374
- resolve5(result);
6465
+ resolve4(result);
6375
6466
  } };
6376
6467
  context.signal?.addEventListener("abort", abort, { once: true });
6377
6468
  try {
6378
- const lines = renderHostApprovalCardLines(card, { now: now(), columns: columns(), keyboardOwned: !!args.dialogHost });
6469
+ const lines = renderHostApprovalCardLines(card, { now: now(), columns: columns() });
6379
6470
  args.write(`${lines.join("\n")}
6380
6471
  `);
6381
6472
  } catch {
@@ -6394,17 +6485,41 @@ function createInlineHostApprovalPrompt(args) {
6394
6485
  isActive: () => active !== null,
6395
6486
  handleKey(sequence, context) {
6396
6487
  if (!active || disposed) return false;
6397
- const keys = sequence;
6398
- const isAllow = ALLOW_KEYS.has(keys);
6399
- const isDeny = DENY_KEYS.has(keys);
6400
- const isEscape = ESCAPE_KEYS.has(keys);
6401
- if (!isAllow && !isDeny && !isEscape) return false;
6402
- if (!context.draftEmpty) return false;
6403
- if (isEscape && context.busy) return false;
6488
+ const isConfirm = ENTER.has(sequence);
6489
+ const selectAllow = SELECT_ALLOW.has(sequence);
6490
+ const selectCancel = SELECT_CANCEL.has(sequence);
6491
+ const isEscape = ESCAPE_KEYS.has(sequence);
6492
+ if (!context.draftEmpty || !(isConfirm || selectAllow || selectCancel || isEscape)) {
6493
+ if (active.allowSelected) {
6494
+ active.allowSelected = false;
6495
+ try {
6496
+ args.write(" Cancel selected (default).\n");
6497
+ } catch {
6498
+ }
6499
+ }
6500
+ return false;
6501
+ }
6502
+ if (isEscape && context.busy) {
6503
+ active.allowSelected = false;
6504
+ return false;
6505
+ }
6404
6506
  if (active.card.expiresAt <= now()) {
6405
6507
  settle("expired", "\u231B approval expired \u2014 the action was not run");
6406
6508
  return true;
6407
6509
  }
6510
+ if (selectAllow || selectCancel) {
6511
+ if (active.allowSelected !== selectAllow) {
6512
+ active.allowSelected = false;
6513
+ try {
6514
+ args.write(selectAllow ? " Allow once selected \xB7 Enter confirms \xB7 \u2190 selects Cancel\n" : " Cancel selected \xB7 Enter cancels\n");
6515
+ active.allowSelected = selectAllow;
6516
+ } catch {
6517
+ settle("deny", "\u2716 selection could not be shown \u2014 the action was not run");
6518
+ }
6519
+ }
6520
+ return true;
6521
+ }
6522
+ const isAllow = isConfirm && active.allowSelected;
6408
6523
  settle(
6409
6524
  isAllow ? "allow_once" : "deny",
6410
6525
  isAllow ? "\u2714 allowed once (this action only)" : "\u2716 denied"
@@ -8523,12 +8638,12 @@ function mergeAttachedImages(existing, incoming) {
8523
8638
  return out;
8524
8639
  }
8525
8640
  async function readImagePaths(paths, options = {}) {
8526
- const resolve5 = options.resolve ?? ((p) => p);
8641
+ const resolve4 = options.resolve ?? ((p) => p);
8527
8642
  const reportedFailures = /* @__PURE__ */ new Set();
8528
8643
  const images = [];
8529
8644
  const failures = [];
8530
8645
  for (const raw of paths) {
8531
- const absolute = resolve5(raw);
8646
+ const absolute = resolve4(raw);
8532
8647
  try {
8533
8648
  const img = await readImageAsDataUrl(absolute, {
8534
8649
  ...options.maxBytes !== void 0 ? { maxBytes: options.maxBytes } : {}
@@ -8634,7 +8749,7 @@ async function probeMedia(filePath, opts = {}) {
8634
8749
  const runner = opts.execFileImpl ?? execFile;
8635
8750
  const ffmpegPath = opts.ffmpegPath ?? DEFAULT_FFMPEG_PATH;
8636
8751
  const ffprobePath = ffmpegPath.replace(/ffmpeg$/, "ffprobe");
8637
- return new Promise((resolve5, reject) => {
8752
+ return new Promise((resolve4, reject) => {
8638
8753
  runner(
8639
8754
  ffprobePath,
8640
8755
  [
@@ -8665,7 +8780,7 @@ async function probeMedia(filePath, opts = {}) {
8665
8780
  const hasAudio = /^codec_type=audio$/m.test(text);
8666
8781
  const rateMatch = text.match(/sample_rate=(\d+)/);
8667
8782
  const sampleRate = rateMatch ? parseInt(rateMatch[1], 10) : null;
8668
- resolve5({ durationSec, hasAudio, sampleRate });
8783
+ resolve4({ durationSec, hasAudio, sampleRate });
8669
8784
  }
8670
8785
  );
8671
8786
  });
@@ -8752,7 +8867,7 @@ async function preprocessMedia(inputPath, opts = {}) {
8752
8867
  args.push("-af", filter);
8753
8868
  }
8754
8869
  args.push("-c:a", "libopus", "-b:a", OPUS_BITRATE, outPath);
8755
- await new Promise((resolve5, reject) => {
8870
+ await new Promise((resolve4, reject) => {
8756
8871
  runner(ffmpegPath, args, { encoding: "utf8", maxBuffer: 8 * 1024 * 1024 }, (error, _stdout, stderr) => {
8757
8872
  if (error) {
8758
8873
  reject(
@@ -8762,7 +8877,7 @@ async function preprocessMedia(inputPath, opts = {}) {
8762
8877
  );
8763
8878
  return;
8764
8879
  }
8765
- resolve5();
8880
+ resolve4();
8766
8881
  });
8767
8882
  }).catch((err) => {
8768
8883
  if (ownOutDir) {
@@ -9460,7 +9575,7 @@ function parseStatusOutput(branch, status) {
9460
9575
  return { branch, modified, untracked };
9461
9576
  }
9462
9577
  function execFileUtf8(file, args, cwd) {
9463
- return new Promise((resolve5, reject) => {
9578
+ return new Promise((resolve4, reject) => {
9464
9579
  execFile3(
9465
9580
  file,
9466
9581
  args,
@@ -9470,7 +9585,7 @@ function execFileUtf8(file, args, cwd) {
9470
9585
  reject(err);
9471
9586
  return;
9472
9587
  }
9473
- resolve5(typeof stdout === "string" ? stdout : String(stdout ?? ""));
9588
+ resolve4(typeof stdout === "string" ? stdout : String(stdout ?? ""));
9474
9589
  }
9475
9590
  );
9476
9591
  });
@@ -9539,7 +9654,7 @@ function extractConversationLinks(turns, options = {}) {
9539
9654
  }
9540
9655
  return { links: [...seen.values()], total, hasMore: total > seen.size };
9541
9656
  }
9542
- function renderConversationLinks(extracted, t3) {
9657
+ function renderConversationLinks(extracted, t3, target = "pipe") {
9543
9658
  const { links, total } = extracted;
9544
9659
  if (links.length === 0) return t3("noConversationLinks");
9545
9660
  const lines = links.map((link) => {
@@ -9547,7 +9662,8 @@ function renderConversationLinks(extracted, t3) {
9547
9662
  return ` ${String(link.index).padStart(2)} [${who}] ${link.url}`;
9548
9663
  });
9549
9664
  const heading = t3("conversationLinksShowing", links.length, total);
9550
- return [heading, ...lines, "", t3("conversationLinksCopyHint")].join("\n");
9665
+ const hint = target === "history" ? t3("conversationLinksCopyHint") : t3("conversationLinksCopyHintPipe");
9666
+ return [heading, ...lines, "", hint].join("\n");
9551
9667
  }
9552
9668
 
9553
9669
  // packages/cli/tui/sessionDispatch.ts
@@ -10567,7 +10683,7 @@ ${t("cdUsage")}`
10567
10683
  const extracted = extractConversationLinks(historyTurns ?? []);
10568
10684
  return {
10569
10685
  nextState: state,
10570
- output: `${renderConversationLinks(extracted, t)}
10686
+ output: `${renderConversationLinks(extracted, t, deps?.linksTarget)}
10571
10687
  `
10572
10688
  };
10573
10689
  }
@@ -11272,7 +11388,7 @@ async function probeTerminalBackground(args = {}) {
11272
11388
  if (typeof stdin.setRawMode !== "function") return null;
11273
11389
  if (!isTerminal(stdin)) return null;
11274
11390
  const wasRaw = Boolean(stdin.isRaw);
11275
- return await new Promise((resolve5) => {
11391
+ return await new Promise((resolve4) => {
11276
11392
  let buffer = "";
11277
11393
  let settled = false;
11278
11394
  let timer;
@@ -11290,7 +11406,7 @@ async function probeTerminalBackground(args = {}) {
11290
11406
  if (!wasRaw) stdin.setRawMode?.(false);
11291
11407
  } catch {
11292
11408
  }
11293
- resolve5(result);
11409
+ resolve4(result);
11294
11410
  };
11295
11411
  const onData = (chunk) => {
11296
11412
  buffer += chunk.toString("latin1");
@@ -11488,13 +11604,13 @@ function startCiDeployEventStream(args) {
11488
11604
  let controller = null;
11489
11605
  const timers = /* @__PURE__ */ new Set();
11490
11606
  const sleepWaiters = /* @__PURE__ */ new Set();
11491
- const sleepWithRegisteredTimer = (ms) => new Promise((resolve5) => {
11607
+ const sleepWithRegisteredTimer = (ms) => new Promise((resolve4) => {
11492
11608
  let settled = false;
11493
11609
  const wake = () => {
11494
11610
  if (settled) return;
11495
11611
  settled = true;
11496
11612
  sleepWaiters.delete(wake);
11497
- resolve5();
11613
+ resolve4();
11498
11614
  };
11499
11615
  const timer = setTimeout(() => {
11500
11616
  timers.delete(timer);
@@ -12536,11 +12652,11 @@ async function runAskChoiceDialog(args) {
12536
12652
  }
12537
12653
  paint();
12538
12654
  while (state.phase === "active") {
12539
- const sequence = await new Promise((resolve5, reject) => {
12540
- const abort = () => resolve5(STREAM_CLOSED);
12655
+ const sequence = await new Promise((resolve4, reject) => {
12656
+ const abort = () => resolve4(STREAM_CLOSED);
12541
12657
  if (request.signal?.aborted) return abort();
12542
12658
  request.signal?.addEventListener("abort", abort, { once: true });
12543
- Promise.resolve(readKey()).then(resolve5, reject).finally(() => request.signal?.removeEventListener("abort", abort));
12659
+ Promise.resolve(readKey()).then(resolve4, reject).finally(() => request.signal?.removeEventListener("abort", abort));
12544
12660
  });
12545
12661
  if (sequence === STREAM_CLOSED) {
12546
12662
  state = askChoiceReducer(state, { type: "CANCEL" });
@@ -13464,12 +13580,12 @@ async function detectTrailingSilenceSuggestion(filePath, durationSec, opts = {})
13464
13580
  "-"
13465
13581
  ];
13466
13582
  try {
13467
- const stderr = await new Promise((resolve5, reject) => {
13583
+ const stderr = await new Promise((resolve4, reject) => {
13468
13584
  runner(
13469
13585
  opts.ffmpegPath ?? resolveFfmpegPath(),
13470
13586
  args,
13471
13587
  { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 },
13472
- (error, _stdout, stderrText) => error ? reject(error) : resolve5(String(stderrText ?? ""))
13588
+ (error, _stdout, stderrText) => error ? reject(error) : resolve4(String(stderrText ?? ""))
13473
13589
  );
13474
13590
  });
13475
13591
  return buildTrailingSilenceSuggestion(
@@ -14655,6 +14771,7 @@ async function runAgentChat(scriptDir, state, message, env, output, agentRunner
14655
14771
  getProcessCausalDepth: options.getProcessCausalDepth,
14656
14772
  continueDialogId: state.dialogId,
14657
14773
  freshDialog: options.freshDialog,
14774
+ internalTurn: options.internalTurn,
14658
14775
  userMessages: options.userMessages,
14659
14776
  ...options.cliBatchId ? { cliBatchId: options.cliBatchId } : {},
14660
14777
  // accountTaskUserSource 已移除:它专为 host task 证据链服务,
@@ -14736,6 +14853,7 @@ async function runAgentChat(scriptDir, state, message, env, output, agentRunner
14736
14853
  // 转发 dock 订阅:runAgentTurn 的输出层靠它判断「有面板」从而抑制
14737
14854
  // transcript 的进展卡片;dock 本身也靠它接收模型轮询带回来的快照。
14738
14855
  ...options.onAgentRunStatus ? { onAgentRunStatus: options.onAgentRunStatus } : {},
14856
+ ...options.onToolImageArtifacts ? { onToolImageArtifacts: options.onToolImageArtifacts } : {},
14739
14857
  ...options.drainInjections ? { drainInjections: options.drainInjections } : {},
14740
14858
  ...options.drainInjectedBatches ? { drainInjectedBatches: options.drainInjectedBatches } : {},
14741
14859
  // 轮内实时积分:llm-end 带原始 usage 时按平台计费口径逐帧折算上报。
@@ -14828,14 +14946,14 @@ function waitForActionGate(rl, input, output, gate, spawnRunner) {
14828
14946
  const meta = deriveGateMeta(gate);
14829
14947
  const { commandPayload, isConfirmation, displayCommand } = meta;
14830
14948
  writeGatePrompt(output, meta);
14831
- return new Promise((resolve5) => {
14949
+ return new Promise((resolve4) => {
14832
14950
  let settled = false;
14833
14951
  const finish = (result) => {
14834
14952
  if (settled) return;
14835
14953
  settled = true;
14836
14954
  rl.off("close", onClose);
14837
14955
  rl.off("SIGINT", onSigint);
14838
- resolve5(result);
14956
+ resolve4(result);
14839
14957
  };
14840
14958
  const cancelResult = (reason) => buildGateCancelledResult(gate, reason);
14841
14959
  const failResult = (message) => buildGateFailedResult(gate, message);
@@ -14899,7 +15017,7 @@ function waitForRawActionGate(input, output, gate, spawnRunner, hooks) {
14899
15017
  const meta = deriveGateMeta(gate);
14900
15018
  const { commandPayload, isConfirmation, displayCommand } = meta;
14901
15019
  writeGatePrompt(output, meta);
14902
- return new Promise((resolve5) => {
15020
+ return new Promise((resolve4) => {
14903
15021
  const rawInput = input;
14904
15022
  let settled = false;
14905
15023
  let commandRunning = false;
@@ -14911,7 +15029,7 @@ function waitForRawActionGate(input, output, gate, spawnRunner, hooks) {
14911
15029
  input.off("data", onData);
14912
15030
  input.off?.("end", onEnd);
14913
15031
  input.off?.("close", onEnd);
14914
- resolve5(result);
15032
+ resolve4(result);
14915
15033
  };
14916
15034
  const cancel = (reason) => finish(buildGateCancelledResult(gate, reason));
14917
15035
  const fail = (message) => finish(buildGateFailedResult(gate, message));
@@ -15142,14 +15260,14 @@ function buildWakeRetryContinuationMessage(event) {
15142
15260
  }
15143
15261
  function waitForWakeRetryBackoff(delayMs, signal) {
15144
15262
  if (delayMs <= 0 || signal?.aborted) return Promise.resolve();
15145
- return new Promise((resolve5) => {
15263
+ return new Promise((resolve4) => {
15146
15264
  const onAbort = () => {
15147
15265
  clearTimeout(timer);
15148
- resolve5();
15266
+ resolve4();
15149
15267
  };
15150
15268
  const timer = setTimeout(() => {
15151
15269
  signal?.removeEventListener("abort", onAbort);
15152
- resolve5();
15270
+ resolve4();
15153
15271
  }, delayMs);
15154
15272
  signal?.addEventListener("abort", onAbort, { once: true });
15155
15273
  });
@@ -15227,7 +15345,7 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
15227
15345
  if (!approved) return false;
15228
15346
  const commandText = typeof request.command === "string" ? request.command : "";
15229
15347
  if (commandText) {
15230
- const { runApprovedCredentialCommand } = await import("./hostCredentialCreate-TNV4AR2P.js");
15348
+ const { runApprovedCredentialCommand } = await import("./hostCredentialCreate-23TX56G7.js");
15231
15349
  const hostResult = await runApprovedCredentialCommand({
15232
15350
  commandText,
15233
15351
  approvalEventId: request.id,
@@ -15438,6 +15556,8 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
15438
15556
  try {
15439
15557
  for (let wakeAttempt = 0; ; wakeAttempt++) {
15440
15558
  drainInjectedBatches.length = 0;
15559
+ const turnToolImageArtifacts = [];
15560
+ let toolImageArtifactsDeliveredViaCallback = false;
15441
15561
  const { previousContextUsage, nextBaseline, agentOutput } = prepareAttemptRenderAndBaseline();
15442
15562
  ctx.activeTurnAbort = new AbortController();
15443
15563
  ctx.activeTurnEpoch = myEpoch;
@@ -15450,6 +15570,7 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
15450
15570
  ctx.options.agentRunner,
15451
15571
  {
15452
15572
  freshDialog: attemptFreshDialog,
15573
+ internalTurn: isInternalEvent,
15453
15574
  userMessages: req.userMessages,
15454
15575
  ...req.cliBatchId ? { cliBatchId: req.cliBatchId } : {},
15455
15576
  // accountTaskUserSource 已移除(host task 证据链下线,无消费者)。
@@ -15522,6 +15643,13 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
15522
15643
  if (rolledBack) return;
15523
15644
  binding.acceptClaimedBatch(claimed.batchId);
15524
15645
  drainInjectedBatches.push({ batchId, messageIds });
15646
+ if (ctx.history.currentRole === "assistant" && (ctx.history.currentContent.length > 0 || turnToolImageArtifacts.length > 0)) {
15647
+ finalizeCurrentTurn(ctx.history);
15648
+ const splitAssistant = ctx.history.turns[ctx.history.turns.length - 1];
15649
+ if (splitAssistant?.role === "assistant") {
15650
+ await ctx.onAssistantTurnFinalized?.(splitAssistant, turnToolImageArtifacts.splice(0));
15651
+ }
15652
+ }
15525
15653
  ctx.history.followBottom = true;
15526
15654
  for (const user of displayMessages) {
15527
15655
  startTurn(ctx.history, "user");
@@ -15570,6 +15698,10 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
15570
15698
  // 运行位置展示(块 D):宿主装配的渲染回调;adapter 只在
15571
15699
  // owner-required 场景回调一次。
15572
15700
  ...ctx.onToolExecutionLocation ? { onToolExecutionLocation: ctx.onToolExecutionLocation } : {},
15701
+ onToolImageArtifacts: (artifacts) => {
15702
+ toolImageArtifactsDeliveredViaCallback = true;
15703
+ turnToolImageArtifacts.push(...artifacts);
15704
+ },
15573
15705
  onAgentRunStatus: (snapshot) => {
15574
15706
  if (snapshot) {
15575
15707
  ctx.activityIndicator.updateAgentRun(snapshot);
@@ -15640,8 +15772,15 @@ async function runOneAgentTurn(ctx, inputMsg, imageUrls, actionGateHandler, conf
15640
15772
  }
15641
15773
  const wasAborted = ctx.activeTurnAbort.signal.aborted;
15642
15774
  ctx.activeTurnAbort = null;
15775
+ if (!toolImageArtifactsDeliveredViaCallback && runResult.toolImageArtifacts?.length) {
15776
+ turnToolImageArtifacts.push(...runResult.toolImageArtifacts);
15777
+ }
15643
15778
  if (isInteractiveInput(ctx.input)) {
15644
15779
  finalizeCurrentTurn(ctx.history);
15780
+ const finalizedAssistantTurn = ctx.history.turns[ctx.history.turns.length - 1];
15781
+ if (finalizedAssistantTurn?.role === "assistant") {
15782
+ await ctx.onAssistantTurnFinalized?.(finalizedAssistantTurn, turnToolImageArtifacts);
15783
+ }
15645
15784
  ctx.flushPendingRender();
15646
15785
  ctx.renderHistoryToOutput();
15647
15786
  if (ctx.fixedInput.active) ctx.fixedInput.repaint(ctx.buffer, ctx.cursorPos);
@@ -16150,45 +16289,201 @@ function findUrlAtRowColumn(rows, globalRow, screenCol) {
16150
16289
  }
16151
16290
  return null;
16152
16291
  }
16292
+ var MARKDOWN_LINK_SOURCE_REGEX = /\[([^\]]+)\]\(([^)\s]+)\)/g;
16293
+ function resolveOwnerTurnAtRow(history, contentWidth, globalRow) {
16294
+ const { entries, totalLines } = buildTurnOffsets(history, contentWidth);
16295
+ for (let i = 0; i < entries.length; i += 1) {
16296
+ const entry = entries[i];
16297
+ if (globalRow >= entry.startRow && globalRow < entry.startRow + entry.lineCount) {
16298
+ const turn = history.turns[i];
16299
+ return { role: turn.role, content: turn.content };
16300
+ }
16301
+ }
16302
+ if (history.currentRole !== null && history.currentContent) {
16303
+ const prevRole = history.turns.length > 0 ? history.turns[history.turns.length - 1].role : null;
16304
+ const currentStart = totalLines + turnSeparatorRows(prevRole, history.currentRole);
16305
+ if (globalRow >= currentStart) {
16306
+ return { role: history.currentRole, content: history.currentContent };
16307
+ }
16308
+ }
16309
+ return null;
16310
+ }
16311
+ function findMarkdownUrlInTurnRow(history, contentWidth, rows, globalRow, screenCol) {
16312
+ const row = rows[globalRow];
16313
+ if (!row?.sourceMapping || row.sourceMapping.length === 0) return null;
16314
+ const owner = resolveOwnerTurnAtRow(history, contentWidth, globalRow);
16315
+ if (!owner || owner.role === "local") return null;
16316
+ let col = 0;
16317
+ let plainOffset = 0;
16318
+ let clickedPlainOffset = -1;
16319
+ for (const token of tokenizeAnsiLine(row.rendered)) {
16320
+ if (token.kind === "sgr") continue;
16321
+ const startCol = col;
16322
+ col += token.width;
16323
+ if (startCol < row.prefixWidth) continue;
16324
+ if (screenCol >= startCol && screenCol < startCol + token.width) {
16325
+ clickedPlainOffset = plainOffset;
16326
+ break;
16327
+ }
16328
+ plainOffset += token.value.length;
16329
+ }
16330
+ if (clickedPlainOffset < 0 || clickedPlainOffset >= row.sourceMapping.length) return null;
16331
+ const rawOffset = row.sourceMapping[clickedPlainOffset];
16332
+ const normalized = owner.content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
16333
+ const lines = normalized.split("\n");
16334
+ let offset = 0;
16335
+ let fenceMarker = null;
16336
+ let targetLine = null;
16337
+ let targetLineStart = 0;
16338
+ for (const line of lines) {
16339
+ const lineEnd = offset + line.length;
16340
+ const marker = line.match(/^\s*(`{3,}|~{3,})/)?.[1];
16341
+ const wasInFence = fenceMarker !== null;
16342
+ if (marker) {
16343
+ if (fenceMarker === null) fenceMarker = marker;
16344
+ else if (marker[0] === fenceMarker[0] && marker.length >= fenceMarker.length) fenceMarker = null;
16345
+ }
16346
+ if (rawOffset >= offset && rawOffset < lineEnd) {
16347
+ if (owner.role === "assistant" && (wasInFence || marker !== void 0)) return null;
16348
+ targetLine = line;
16349
+ targetLineStart = offset;
16350
+ break;
16351
+ }
16352
+ offset = lineEnd + 1;
16353
+ }
16354
+ if (targetLine === null) return null;
16355
+ const codeSpans = [];
16356
+ if (owner.role === "assistant") {
16357
+ const codeRe = /`[^`]+`/g;
16358
+ let codeMatch;
16359
+ while ((codeMatch = codeRe.exec(targetLine)) !== null) {
16360
+ codeSpans.push([
16361
+ targetLineStart + codeMatch.index,
16362
+ targetLineStart + codeMatch.index + codeMatch[0].length
16363
+ ]);
16364
+ }
16365
+ }
16366
+ MARKDOWN_LINK_SOURCE_REGEX.lastIndex = 0;
16367
+ let match;
16368
+ while ((match = MARKDOWN_LINK_SOURCE_REGEX.exec(targetLine)) !== null) {
16369
+ const absMatchStart = targetLineStart + match.index;
16370
+ const absLabelStart = absMatchStart + 1;
16371
+ const absLabelEnd = absLabelStart + match[1].length;
16372
+ if (codeSpans.some(
16373
+ ([spanStart, spanEnd]) => absMatchStart < spanEnd && absLabelEnd > spanStart
16374
+ )) {
16375
+ continue;
16376
+ }
16377
+ const matchesLabel = rawOffset >= absLabelStart && rawOffset < absLabelEnd || rawOffset === absMatchStart && normalized[rawOffset] === "[";
16378
+ if (!matchesLabel) continue;
16379
+ const url = normalizeHttpUrl(match[2]);
16380
+ if (url !== null) return url;
16381
+ }
16382
+ return null;
16383
+ }
16153
16384
  function openVisibleUrlAtScreen(history, contentWidth, scrollTop, screenRow, screenCol, visibleHeight, openUrl = (url) => openExternalUrl(url)) {
16154
16385
  if (screenRow < 0 || screenCol < 0) return false;
16155
16386
  if (!Number.isFinite(visibleHeight) || visibleHeight <= 0) return false;
16156
16387
  if (screenRow >= visibleHeight) return false;
16157
16388
  const rows = buildHistoryLayoutRows(history, contentWidth);
16158
- const hit = findUrlAtRowColumn(rows, scrollTop + screenRow, screenCol);
16159
- if (!hit) return false;
16160
- openUrl(hit.url);
16389
+ const globalRow = scrollTop + screenRow;
16390
+ const hit = findUrlAtRowColumn(rows, globalRow, screenCol);
16391
+ if (hit) {
16392
+ openUrl(hit.url);
16393
+ return true;
16394
+ }
16395
+ const markdownUrl = findMarkdownUrlInTurnRow(history, contentWidth, rows, globalRow, screenCol);
16396
+ if (markdownUrl === null) return false;
16397
+ openUrl(markdownUrl);
16161
16398
  return true;
16162
16399
  }
16163
16400
 
16164
16401
  // packages/cli/tui/tuiImageActions.ts
16165
- import { stat as stat3 } from "node:fs/promises";
16166
- import { resolve as resolve4 } from "node:path";
16167
- var WINDOWS_VIEW_SCRIPT = "$ErrorActionPreference='Stop'; $info = New-Object System.Diagnostics.ProcessStartInfo; $info.FileName = $env:NOLO_IMAGE_VIEW_PATH; $info.UseShellExecute = $true; [System.Diagnostics.Process]::Start($info) | Out-Null";
16168
- function localImageViewerCommand(platform, path3) {
16169
- if (platform === "win32") return {
16170
- argv: ["powershell.exe", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command", WINDOWS_VIEW_SCRIPT],
16171
- envPatch: { NOLO_IMAGE_VIEW_PATH: path3 }
16172
- };
16173
- const command = platform === "darwin" ? "open" : platform === "linux" ? "xdg-open" : void 0;
16174
- return command ? { argv: [command, path3], envPatch: {} } : void 0;
16175
- }
16176
- async function viewLocalImage(sourcePath, env) {
16177
- if (isRemoteSession(env)) return "\u65E0\u6CD5\u5728\u8FDC\u7A0B\u4F1A\u8BDD\u6253\u5F00\u672C\u673A\u67E5\u770B\u5668\uFF1B\u8BF7\u5728\u6587\u4EF6\u6240\u5728\u673A\u5668\u67E5\u770B\u3002";
16178
- if (!sourcePath || /[\u0000-\u001f\u007f]/.test(sourcePath)) return "\u65E0\u6CD5\u67E5\u770B\uFF1A\u65E0\u6709\u6548\u672C\u673A\u6587\u4EF6\u8DEF\u5F84\u3002";
16179
- const path3 = resolve4(sourcePath);
16402
+ async function copyImagePath(sourcePath, writeClipboard2) {
16403
+ if (!sourcePath || /[\u0000-\u001f\u007f]/.test(sourcePath)) {
16404
+ return { ok: false, message: "\u65E0\u6709\u6548\u8DEF\u5F84\u53EF\u590D\u5236\u3002" };
16405
+ }
16406
+ const safeDisplay = sanitizeImageLabel(sourcePath);
16180
16407
  try {
16181
- if (!(await stat3(path3)).isFile()) return "\u65E0\u6CD5\u67E5\u770B\uFF1A\u8DEF\u5F84\u4E0D\u662F\u6587\u4EF6\u3002";
16182
- const plan = localImageViewerCommand(process.platform, path3);
16183
- if (!plan || !Bun.which(plan.argv[0], { PATH: env.PATH })) return "\u65E0\u6CD5\u67E5\u770B\uFF1A\u6B64\u73AF\u5883\u6CA1\u6709\u53EF\u7528\u7684\u672C\u673A\u56FE\u7247\u67E5\u770B\u5668\u3002";
16184
- if (process.platform === "linux" && !env.DISPLAY && !env.WAYLAND_DISPLAY) return "\u65E0\u6CD5\u67E5\u770B\uFF1A\u6CA1\u6709\u684C\u9762\u663E\u793A\u4F1A\u8BDD\u3002";
16185
- const child = Bun.spawn(plan.argv, { env: { ...env, ...plan.envPatch }, stdin: "ignore", stdout: "ignore", stderr: "pipe" });
16186
- const error = await new Response(child.stderr).text();
16187
- const code = await child.exited;
16188
- return code === 0 ? "\u5DF2\u4EA4\u7ED9\u672C\u673A\u67E5\u770B\u5668\uFF08\u4E0D\u4EE3\u8868\u7A97\u53E3\u5DF2\u663E\u793A\uFF09\u3002" : `\u67E5\u770B\u5668\u542F\u52A8\u5931\u8D25 (${code}): ${sanitizeImageLabel(error).slice(0, 300)}`;
16408
+ await writeClipboard2(sourcePath);
16409
+ return { ok: true, message: `\u5DF2\u590D\u5236\u8DEF\u5F84\uFF1A${safeDisplay}` };
16189
16410
  } catch (error) {
16190
- return `\u65E0\u6CD5\u67E5\u770B: ${sanitizeImageLabel(error instanceof Error ? error.message : String(error))}`;
16411
+ const detail = sanitizeImageLabel(error instanceof Error ? error.message : String(error)).slice(0, 120);
16412
+ return {
16413
+ ok: false,
16414
+ message: `\u65E0\u6CD5\u5199\u5165\u526A\u8D34\u677F\uFF08${detail}\uFF09\uFF0C\u53EF\u76F4\u63A5\u9009\u4E2D\u8DEF\u5F84\u6587\u672C\uFF1A${safeDisplay}`
16415
+ };
16416
+ }
16417
+ }
16418
+
16419
+ // packages/cli/tui/tuiImageExtractor.ts
16420
+ import { hostname } from "node:os";
16421
+ import { isAbsolute as isAbsolute2, relative } from "node:path";
16422
+ var DEFAULT_MAX_TURN_IMAGE_ARTIFACTS = 4;
16423
+ function formatArtifactDisplayPath(rawPath, cwd) {
16424
+ const safe = sanitizeImageLabel(rawPath);
16425
+ if (!cwd) return safe;
16426
+ if (rawPath.startsWith("\\\\") || rawPath.startsWith("//")) return safe;
16427
+ if (isAbsolute2(rawPath) && isAbsolute2(cwd)) {
16428
+ const rel = relative(cwd, rawPath);
16429
+ if (rel && !rel.startsWith("..") && !isAbsolute2(rel)) {
16430
+ return sanitizeImageLabel(rel);
16431
+ }
16432
+ }
16433
+ return safe;
16434
+ }
16435
+ function resolveArtifactHostLabel(options = {}) {
16436
+ const remoteDevice = options.toolExecutionDeviceName ? sanitizeImageLabel(options.toolExecutionDeviceName) : "";
16437
+ if (remoteDevice) return remoteDevice;
16438
+ const host = sanitizeImageLabel(options.localHostname ?? hostname());
16439
+ if (isRemoteSession(options.env ?? {})) {
16440
+ return host && host !== "image" ? `\u8FDC\u7AEF (${host})` : "\u8FDC\u7AEF\u4E3B\u673A";
16441
+ }
16442
+ return host && host !== "image" ? `\u672C\u673A (${host})` : "\u672C\u673A";
16443
+ }
16444
+ function buildTurnImageArtifacts(options) {
16445
+ const maxImages = Math.max(0, options.maxImages ?? DEFAULT_MAX_TURN_IMAGE_ARTIFACTS);
16446
+ if (maxImages === 0 || !options.toolArtifacts?.length) return [];
16447
+ const startIndex = Math.max(1, options.startIndex ?? 1);
16448
+ const hostLabel = sanitizeImageLabel(options.hostLabel);
16449
+ const out = [];
16450
+ const seen = /* @__PURE__ */ new Set();
16451
+ for (const item of options.toolArtifacts) {
16452
+ if (out.length >= maxImages) break;
16453
+ const rawPath = typeof item?.path === "string" ? item.path.trim() : "";
16454
+ if (!rawPath || /[\u0000-\u001f\u007f]/.test(rawPath)) continue;
16455
+ if (/^(?:https?|data|javascript):/i.test(rawPath)) continue;
16456
+ if (seen.has(rawPath)) continue;
16457
+ seen.add(rawPath);
16458
+ out.push({
16459
+ artifactIndex: startIndex + out.length,
16460
+ kind: item.kind === "image" ? "image" : "screenshot",
16461
+ path: rawPath,
16462
+ displayPath: formatArtifactDisplayPath(rawPath, options.cwd),
16463
+ hostLabel,
16464
+ ...typeof item.width === "number" && item.width > 0 ? { width: item.width } : {},
16465
+ ...typeof item.height === "number" && item.height > 0 ? { height: item.height } : {},
16466
+ ...typeof item.bytes === "number" && item.bytes > 0 ? { bytes: item.bytes } : {}
16467
+ });
16468
+ }
16469
+ return out;
16470
+ }
16471
+ function formatImageArtifactLine(artifact) {
16472
+ const prefix = artifact.kind === "image" ? "\u56FE\u7247" : "\u622A\u56FE";
16473
+ const dims = artifact.width && artifact.height ? ` (${artifact.width}\xD7${artifact.height})` : "";
16474
+ return `${prefix} \xB7 ${artifact.displayPath}${dims} \xB7 ${artifact.hostLabel}`;
16475
+ }
16476
+ function formatArtifactChoiceLabel(artifact) {
16477
+ const prefix = artifact.kind === "image" ? "\u56FE\u7247" : "\u622A\u56FE";
16478
+ return `#${artifact.artifactIndex} \xB7 ${prefix} \xB7 ${artifact.displayPath} (${artifact.hostLabel})`;
16479
+ }
16480
+ function collectConversationImageArtifacts(turns) {
16481
+ const out = [];
16482
+ for (const turn of turns) {
16483
+ if (!turn?.imageArtifacts?.length) continue;
16484
+ out.push(...turn.imageArtifacts);
16191
16485
  }
16486
+ return out;
16192
16487
  }
16193
16488
 
16194
16489
  // packages/cli/tui/tuiRender.ts
@@ -17177,7 +17472,7 @@ async function compactDialog(options) {
17177
17472
  fetchImpl,
17178
17473
  agentRef: getActiveDialogAgentId(current) ?? void 0,
17179
17474
  loadAdapter: async () => {
17180
- const { createCliLocalRuntimeAdapter: createCliLocalRuntimeAdapter2 } = await import("./localRuntimeAdapter-AE5LKWC7.js");
17475
+ const { createCliLocalRuntimeAdapter: createCliLocalRuntimeAdapter2 } = await import("./localRuntimeAdapter-MTUWOYPN.js");
17181
17476
  return createCliLocalRuntimeAdapter2({ env: { ...options.env ?? {}, AUTH_TOKEN: options.authToken, NOLO_SERVER: options.serverUrl }, fetchImpl });
17182
17477
  }
17183
17478
  }) : void 0);
@@ -17985,7 +18280,10 @@ async function runSubmittedSlashLine(line, host, actionGateHandler, confirmDestr
17985
18280
  }
17986
18281
  const result = handleTuiInput2(line, host.state, collectConversationTurns(host.history), {
17987
18282
  env: host.taskEnv,
17988
- authEnv: resolveTuiIdentityEnv(host.taskEnv, host.options.env ?? process.env)
18283
+ authEnv: resolveTuiIdentityEnv(host.taskEnv, host.options.env ?? process.env),
18284
+ // 交互模式下非 chat 输出会进 transcript(emitCommandOutput → appendLocalTurn),
18285
+ // /links 的 Ctrl+左键提示才成立;管道/脚本下同一份文本只是 stdout,不能用快捷键承诺。
18286
+ linksTarget: isInteractiveInput(input) ? "history" : "pipe"
17989
18287
  });
17990
18288
  const previousState = host.state;
17991
18289
  const previousAgentKey = host.state.agentKey;
@@ -19106,6 +19404,8 @@ async function runTuiWorkspace(options) {
19106
19404
  const preparedImages = [];
19107
19405
  let imageGraphicsSupported = false;
19108
19406
  let imagePreviewRequested = false;
19407
+ let nextArtifactImageIndex = 1;
19408
+ let activeToolExecutionDeviceName;
19109
19409
  let imageRenderer;
19110
19410
  const renderNamespace = randomInt(1, 65536);
19111
19411
  let handleTranscriptScroll = (action) => {
@@ -19680,6 +19980,24 @@ async function runTuiWorkspace(options) {
19680
19980
  turn.images = preview.images;
19681
19981
  for (const fallback of preview.textFallbacks) turn.content += `
19682
19982
  [\u9644\u4EF6] ${fallback}`;
19983
+ },
19984
+ onAssistantTurnFinalized: (turn, toolArtifacts) => {
19985
+ const hostLabel = resolveArtifactHostLabel({
19986
+ env: effectiveEnv,
19987
+ toolExecutionDeviceName: activeToolExecutionDeviceName
19988
+ });
19989
+ const artifacts = buildTurnImageArtifacts({
19990
+ toolArtifacts,
19991
+ cwd: state.cwd,
19992
+ hostLabel,
19993
+ startIndex: nextArtifactImageIndex
19994
+ });
19995
+ if (artifacts.length === 0) return;
19996
+ nextArtifactImageIndex += artifacts.length;
19997
+ turn.imageArtifacts = turn.imageArtifacts?.length ? [...turn.imageArtifacts, ...artifacts] : artifacts;
19998
+ const lines = artifacts.map((artifact) => formatImageArtifactLine(artifact)).join("\n");
19999
+ turn.content = turn.content ? `${turn.content.replace(/\n+$/, "")}
20000
+ ${lines}` : lines;
19683
20001
  },
19684
20002
  get sessionEnded() {
19685
20003
  return sessionEnded;
@@ -19693,10 +20011,12 @@ async function runTuiWorkspace(options) {
19693
20011
  // unknown 不猜——直接打印 unknown,不静默标 ready。
19694
20012
  onToolExecutionLocation: (location) => {
19695
20013
  if (location.status === "unknown") {
20014
+ activeToolExecutionDeviceName = void 0;
19696
20015
  output.write(`${t("toolLocation.unknown")}
19697
20016
  `);
19698
20017
  return;
19699
20018
  }
20019
+ activeToolExecutionDeviceName = location.deviceName || location.deviceId;
19700
20020
  output.write(
19701
20021
  `${t(
19702
20022
  "toolLocation.line",
@@ -19808,9 +20128,42 @@ async function runTuiWorkspace(options) {
19808
20128
  spawnRunner,
19809
20129
  installAltScreenRestoreHandlers
19810
20130
  };
20131
+ const copyImagePathWithFeedback = async (sourcePath) => {
20132
+ const result = await copyImagePath(sourcePath, writeClipboard2);
20133
+ emitCommandOutput(
20134
+ themeText(
20135
+ `${result.ok ? "\xB7" : "!"} ${result.message}`,
20136
+ result.ok ? "muted" : "warning",
20137
+ resolveCliColorEnabled()
20138
+ )
20139
+ );
20140
+ };
19811
20141
  const manageDraftImages = async () => {
19812
- while (state.attachedImages.length > 0) {
20142
+ while (true) {
19813
20143
  const images = state.attachedImages;
20144
+ const artifacts = collectConversationImageArtifacts(history.turns);
20145
+ if (images.length === 0 && artifacts.length === 0) return;
20146
+ const title = images.length > 0 && artifacts.length === 0 ? "\u56FE\u7247\u9644\u4EF6\uFF08\u5C1A\u672A\u53D1\u9001\uFF09" : "\u56FE\u7247\u7BA1\u7406";
20147
+ const titleLines = [title];
20148
+ if (images.length > 0) {
20149
+ if (artifacts.length > 0) titleLines.push("\u56FE\u7247\u9644\u4EF6\uFF08\u5C1A\u672A\u53D1\u9001\uFF09\uFF1A");
20150
+ titleLines.push(...images.map((image2, index) => `${index + 1} \xB7 ${sanitizeImageLabel(image2.filename)} (${image2.sizeBytes} B)`));
20151
+ }
20152
+ if (artifacts.length > 0) {
20153
+ titleLines.push("\u5BF9\u8BDD\u56FE\u7247\u4EA7\u7269\uFF1A", ...artifacts.map((item) => formatArtifactChoiceLabel(item)));
20154
+ }
20155
+ const items = [
20156
+ { label: "\u8FD4\u56DE\u7F16\u8F91", action: "done" },
20157
+ ...images.flatMap((image2, index) => [
20158
+ ...image2.sourcePath ? [{ label: `\u590D\u5236\u8DEF\u5F84 ${index + 1} \xB7 ${sanitizeImageLabel(image2.filename)}`, action: "copy-draft", index }] : [],
20159
+ { label: `\u79FB\u9664 ${index + 1} \xB7 ${sanitizeImageLabel(image2.filename)}`, action: "remove-draft", index }
20160
+ ]),
20161
+ ...artifacts.map((item) => ({
20162
+ label: `\u590D\u5236\u8DEF\u5F84 ${formatArtifactChoiceLabel(item)}`,
20163
+ action: "copy-artifact",
20164
+ sourcePath: item.path
20165
+ }))
20166
+ ];
19814
20167
  const selected = await dialogHost.run((anchor) => {
19815
20168
  const rawKey = createRawKeyReader(input);
19816
20169
  const readKey = Object.assign(async () => {
@@ -19822,34 +20175,25 @@ async function runTuiWorkspace(options) {
19822
20175
  input,
19823
20176
  output,
19824
20177
  readKey,
19825
- title: "\u56FE\u7247\u9644\u4EF6\uFF08\u5C1A\u672A\u53D1\u9001\uFF09",
19826
- titleLines: ["\u56FE\u7247\u9644\u4EF6\uFF08\u5C1A\u672A\u53D1\u9001\uFF09", ...images.map((image2, index) => `${index + 1} \xB7 ${sanitizeImageLabel(image2.filename)} (${image2.sizeBytes} B)`)],
19827
- footerLines: ["\u79FB\u9664\u4EC5\u53D6\u6D88\u9644\u4EF6\uFF0C\u4E0D\u5220\u9664\u672C\u673A\u6587\u4EF6\u3002Esc \u8FD4\u56DE\u7F16\u8F91\u3002"],
19828
- items: [
19829
- { label: "\u8FD4\u56DE\u7F16\u8F91", action: "done", index: -1 },
19830
- ...images.flatMap((image2, index) => [
19831
- { label: `\u67E5\u770B ${index + 1} \xB7 ${sanitizeImageLabel(image2.filename)}`, action: "view", index },
19832
- { label: `\u79FB\u9664 ${index + 1} \xB7 ${sanitizeImageLabel(image2.filename)}`, action: "remove", index }
19833
- ])
19834
- ]
20178
+ title,
20179
+ titleLines,
20180
+ footerLines: ["\u79FB\u9664\u4EC5\u53D6\u6D88\u5F85\u53D1\u9001\u9644\u4EF6\uFF0C\u4E0D\u5220\u9664\u672C\u673A\u6587\u4EF6\u3002Esc \u8FD4\u56DE\u7F16\u8F91\u3002"],
20181
+ items
19835
20182
  });
19836
20183
  });
19837
20184
  if (selected.kind !== "selected" || selected.item.action === "done") return;
19838
- const image = images[selected.item.index];
20185
+ if (selected.item.action === "copy-artifact") {
20186
+ await copyImagePathWithFeedback(selected.item.sourcePath);
20187
+ return;
20188
+ }
20189
+ const selectedIndex = selected.item.index;
20190
+ const image = images[selectedIndex];
19839
20191
  if (!image) continue;
19840
- if (selected.item.action === "remove") {
19841
- state = { ...state, attachedImages: images.filter((_, index) => index !== selected.item.index) };
20192
+ if (selected.item.action === "remove-draft") {
20193
+ state = { ...state, attachedImages: images.filter((_, index) => index !== selectedIndex) };
19842
20194
  fixedInput.repaint(buffer, cursorPos);
19843
20195
  } else {
19844
- const result = await viewLocalImage(image.sourcePath, effectiveEnv);
19845
- const isOk = result.startsWith("\u5DF2\u4EA4\u7ED9");
19846
- emitCommandOutput(
19847
- themeText(
19848
- `${isOk ? "\xB7" : "!"} ${result}`,
19849
- isOk ? "muted" : "warning",
19850
- resolveCliColorEnabled()
19851
- )
19852
- );
20196
+ await copyImagePathWithFeedback(image.sourcePath);
19853
20197
  }
19854
20198
  }
19855
20199
  };
@@ -19900,8 +20244,24 @@ async function runTuiWorkspace(options) {
19900
20244
  renderHistoryToOutput();
19901
20245
  return false;
19902
20246
  }
20247
+ const directImageMatch = /^\/images\s+(?:copy\s+)?(\d+)$/.exec(line.trim());
20248
+ if (directImageMatch) {
20249
+ const targetIndex = Number(directImageMatch[1]);
20250
+ const target = collectConversationImageArtifacts(history.turns).find(
20251
+ (item) => item.artifactIndex === targetIndex
20252
+ );
20253
+ if (!target) {
20254
+ emitCommandOutput(themeText(`\xB7 \u672A\u627E\u5230\u56FE\u7247\u4EA7\u7269 #${targetIndex}\u3002`, "muted", resolveCliColorEnabled()));
20255
+ } else {
20256
+ await copyImagePathWithFeedback(target.path);
20257
+ }
20258
+ return false;
20259
+ }
19903
20260
  if (line.trim() === "/images") {
19904
- if (state.attachedImages.length === 0) emitCommandOutput(themeText("\xB7 \u65E0\u5F85\u53D1\u9001\u56FE\u7247\u3002/images preview \u6309\u9700\u5207\u6362\u6D88\u606F\u56FE\u7247\u9884\u89C8\uFF08\u9700\u7EC8\u7AEF\u80FD\u529B\u786E\u8BA4\uFF09\u3002", "muted", resolveCliColorEnabled()));
20261
+ const artifacts = collectConversationImageArtifacts(history.turns);
20262
+ if (state.attachedImages.length === 0 && artifacts.length === 0) {
20263
+ emitCommandOutput(themeText("\xB7 \u65E0\u5F85\u53D1\u9001\u56FE\u7247\u3002/images preview \u6309\u9700\u5207\u6362\u6D88\u606F\u56FE\u7247\u9884\u89C8\uFF08\u9700\u7EC8\u7AEF\u80FD\u529B\u786E\u8BA4\uFF09\u3002", "muted", resolveCliColorEnabled()));
20264
+ }
19905
20265
  await manageDraftImages();
19906
20266
  return false;
19907
20267
  }
@@ -19939,6 +20299,7 @@ async function runTuiWorkspace(options) {
19939
20299
  const slashCmd = line.trim().split(/\s+/)[0]?.toLowerCase() ?? "";
19940
20300
  if (slashCmd === "/new" || slashCmd === "/clear") {
19941
20301
  resetInputHistoryNavigation(inputHistory);
20302
+ nextArtifactImageIndex = 1;
19942
20303
  } else if ((slashCmd === "/history" || slashCmd === "/resume") && history.turns.length > 0 && (history.turns.length !== prevTurnSnapshot.length || history.turns.some((turn, i) => turn !== prevTurnSnapshot[i]))) {
19943
20304
  seedInputHistoryFromTurns(inputHistory, history.turns);
19944
20305
  }
@@ -20207,7 +20568,7 @@ async function runTuiWorkspace(options) {
20207
20568
  onApprove: createSnapshotGuardedApproval("local", () => state.permissionGrants, approveLocalConfirms),
20208
20569
  onApproved: async (approvedGate) => {
20209
20570
  if (approvedGate.kind !== "confirm") return null;
20210
- const { executeApprovedCredentialCreate } = await import("./hostCredentialCreate-TNV4AR2P.js");
20571
+ const { executeApprovedCredentialCreate } = await import("./hostCredentialCreate-23TX56G7.js");
20211
20572
  const hostResult = await executeApprovedCredentialCreate({
20212
20573
  gate: approvedGate,
20213
20574
  approvalGateId: approvedGate.id,
@@ -20295,7 +20656,7 @@ ${err.message}` : ""}`
20295
20656
  fixedInput.exitOutputMode(buffer, cursorPos);
20296
20657
  };
20297
20658
  (options.env ?? process.env)[RUN_WAKE_CHANNEL_ENV] = "1";
20298
- const printInternalEventLine = (displayText, lineOptions = {}) => {
20659
+ const printStreamSafeNotice = (displayText, lineOptions = {}) => {
20299
20660
  const noticeLine = lineOptions.dim === false ? displayText : dimCliText(displayText, resolveCliColorEnabled());
20300
20661
  if (!isInteractiveInput(input)) {
20301
20662
  output.write(`${noticeLine}
@@ -20317,7 +20678,7 @@ ${err.message}` : ""}`
20317
20678
  output,
20318
20679
  interactive: true,
20319
20680
  printLine: (line) => {
20320
- printInternalEventLine(line, { dim: false });
20681
+ printStreamSafeNotice(line, { dim: false });
20321
20682
  if (fixedInput.active && !fixedInput.isPaused()) {
20322
20683
  fixedInput.repaint(buffer, cursorPos);
20323
20684
  }
@@ -20362,7 +20723,7 @@ ${err.message}` : ""}`
20362
20723
  const { actionGateHandler, confirmDestructiveAction } = buildInteractiveTurnHandlers();
20363
20724
  return ensureChatQueueBinding(turnCtx, actionGateHandler, confirmDestructiveAction).enqueue(event);
20364
20725
  },
20365
- printLine: printInternalEventLine,
20726
+ printLine: printStreamSafeNotice,
20366
20727
  repaint: () => fixedInput.repaint(buffer, cursorPos),
20367
20728
  runIdle: runIdleTextTurn,
20368
20729
  drainQueue: async () => {
@@ -20602,7 +20963,13 @@ ${err.message}` : ""}`)
20602
20963
  env: effectiveEnv,
20603
20964
  // Identity only: `effectiveEnv` is the startup snapshot, `options.env`
20604
20965
  // is where a `/login` in this session writes its token.
20605
- authEnv: resolveTuiIdentityEnv(effectiveEnv, options.env ?? process.env)
20966
+ authEnv: resolveTuiIdentityEnv(effectiveEnv, options.env ?? process.env),
20967
+ // busy 期间的本地 slash 输出多数直写 output(streaming repaint 拥有
20968
+ // transcript),那些行只是瞬时 notice:既不进历史,也没有 Ctrl+左键与
20969
+ // 内置选区复制。`/links` 是例外——它的面板经 printStreamSafeNotice 进
20970
+ // transcript,所以可以按交互模式如实承诺快捷键;非交互(没有 transcript)
20971
+ // 仍只是一份 stdout 文本,按 pipe 措辞。
20972
+ linksTarget: busySlashCommand === "/links" && isInteractiveInput(input) ? "history" : "pipe"
20606
20973
  });
20607
20974
  if (res.action?.type === "paste-clipboard") {
20608
20975
  await readAndApplyClipboard("slash");
@@ -20691,8 +21058,13 @@ ${err.message}` : ""}`)
20691
21058
  ${hint}` : hint;
20692
21059
  }
20693
21060
  if (msg) {
20694
- output.write(`${msg}
21061
+ if (busySlashCommand === "/links") {
21062
+ printStreamSafeNotice(msg.trimEnd(), { dim: false });
21063
+ if (fixedInput.active) fixedInput.repaint(buffer, cursorPos);
21064
+ } else {
21065
+ output.write(`${msg}
20695
21066
  `);
21067
+ }
20696
21068
  }
20697
21069
  }
20698
21070
  if (busySlashCommand === "/theme") {
@@ -20815,7 +21187,7 @@ ${hint}` : hint;
20815
21187
  screenRow,
20816
21188
  hitContentCol,
20817
21189
  visibleHeight,
20818
- (url) => openExternalUrl(url, {
21190
+ (url) => options.urlOpener ? options.urlOpener(url) : openExternalUrl(url, {
20819
21191
  onError: (message) => reportTuiDiagnostic("tui-link", "warn", "ctrl-click open failed", {
20820
21192
  message
20821
21193
  })
@@ -21017,7 +21389,7 @@ ${hint}` : hint;
21017
21389
  const busySlashCommand = trimmedText.split(/\s+/)[0]?.toLowerCase();
21018
21390
  if (busySlashCommand === "/tools") {
21019
21391
  recordWorkspaceInputHistory(expandedSubmitForHistory);
21020
- printInternalEventLine(history.toolDetails?.join("") || t("noToolDetails"));
21392
+ printStreamSafeNotice(history.toolDetails?.join("") || t("noToolDetails"));
21021
21393
  bumpDraftEpoch();
21022
21394
  buffer = "";
21023
21395
  cursorPos = 0;
@@ -21300,9 +21672,9 @@ ${themeText(`! ${error instanceof Error ? error.message : String(error)}`, "dang
21300
21672
  if (!sawOsc11Reply && isTerminalDevice(input)) requestTerminalBackgroundQuery();
21301
21673
  refreshGitStatus();
21302
21674
  refreshCiStatus();
21303
- await new Promise((resolve5) => {
21304
- resolveDone = resolve5;
21305
- if (done) resolve5();
21675
+ await new Promise((resolve4) => {
21676
+ resolveDone = resolve4;
21677
+ if (done) resolve4();
21306
21678
  });
21307
21679
  } finally {
21308
21680
  finish();