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
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-GAHJLSDO.js";
9
9
  import {
10
10
  getReadableCliDb
11
- } from "./chunk-DLT2DN4M.js";
11
+ } from "./chunk-D25ONVOH.js";
12
12
  import {
13
13
  INSTABOX_RUN_CONFIG_ENV,
14
14
  buildLocalRunEnv,
@@ -33,7 +33,7 @@ import {
33
33
  resolveServerUrl,
34
34
  validateInstaboxWorkspaceSelection,
35
35
  writeUsage
36
- } from "./chunk-TGFFUUVC.js";
36
+ } from "./chunk-SCMYAGQE.js";
37
37
  import {
38
38
  boxGlyphs,
39
39
  displayWidth,
@@ -43,7 +43,7 @@ import {
43
43
  stripAnsi,
44
44
  tokenizeAnsiLine,
45
45
  visibleWidth
46
- } from "./chunk-XGWRH3OF.js";
46
+ } from "./chunk-6TVYUQRM.js";
47
47
  import {
48
48
  clearCredentialAvailability,
49
49
  readEffectiveCredentialEntry
@@ -65,7 +65,7 @@ import {
65
65
  } from "./chunk-QHEN7NZ7.js";
66
66
  import {
67
67
  resolveWorkContextAccess
68
- } from "./chunk-Z6YTCDU4.js";
68
+ } from "./chunk-IIRJ4P4I.js";
69
69
  import {
70
70
  isWorkContextState,
71
71
  readWorkContexts
@@ -86,14 +86,14 @@ import {
86
86
  } from "./chunk-S73EPYNC.js";
87
87
  import {
88
88
  resolveCliLocalRuntimeKeyCapability
89
- } from "./chunk-PUNGLYNR.js";
89
+ } from "./chunk-FTWAOKFU.js";
90
90
  import {
91
91
  extractGoogleValidationLink
92
92
  } from "./chunk-BMQ2MJUK.js";
93
93
  import {
94
94
  parseUiCard,
95
95
  uiCardFallback
96
- } from "./chunk-IOIWS357.js";
96
+ } from "./chunk-LMGFVH65.js";
97
97
  import {
98
98
  isGatewayHttpStatus
99
99
  } from "./chunk-NF64D32W.js";
@@ -104,7 +104,7 @@ import {
104
104
  loadOwnerItemsFromDb,
105
105
  parseUiAskChoiceContent,
106
106
  resolveAgentMemoryPolicy
107
- } from "./chunk-E4BAGLDK.js";
107
+ } from "./chunk-ODBYGVO2.js";
108
108
  import {
109
109
  API_REPORTED_COST_MULTIPLIER,
110
110
  estimateMessagesTokens,
@@ -113,14 +113,14 @@ import {
113
113
  resolveAgentContextWindow,
114
114
  resolveOccupancy,
115
115
  resolveOccupancyWindow
116
- } from "./chunk-PPIQDGJT.js";
116
+ } from "./chunk-YFW4H6DL.js";
117
117
  import {
118
118
  parsePositiveFiniteNumberOrFallback
119
119
  } from "./chunk-Y5GCAMGP.js";
120
120
  import {
121
121
  readDbRecord,
122
122
  resolveAgentRecordFromHybridStore
123
- } from "./chunk-X3XNXLHF.js";
123
+ } from "./chunk-CIUZXD5D.js";
124
124
  import {
125
125
  isTransientFetchError
126
126
  } from "./chunk-DXWGFL2Z.js";
@@ -144,7 +144,7 @@ import {
144
144
  settleRunTerminalAuthoritatively,
145
145
  spawnLocalBackgroundRun,
146
146
  transitionRunToTerminal
147
- } from "./chunk-XKV53E4E.js";
147
+ } from "./chunk-AEZBAFC6.js";
148
148
  import {
149
149
  formatAgentListCard,
150
150
  formatFinishedRunCard,
@@ -166,15 +166,19 @@ import {
166
166
  } from "./chunk-KK3FCYZM.js";
167
167
  import {
168
168
  getDefaultCliLocalRuntimeDb
169
- } from "./chunk-LELADM5Q.js";
169
+ } from "./chunk-BFKJ2RS3.js";
170
170
  import {
171
171
  LOCAL_AGENT_CONFIG_MISSING_CODE,
172
172
  LOCAL_TURN_ABORTED_CODE,
173
+ buildLocalDialogWritePlan,
174
+ dialogOwnerKey,
175
+ dialogTurnUserMessageId,
173
176
  isSubtaskRun,
174
177
  markCliUserBatchPhase,
175
178
  readActionGate,
176
- readAgentsMdLayerFromDisk
177
- } from "./chunk-O72CE7QS.js";
179
+ readAgentsMdLayerFromDisk,
180
+ registerDialogOwner
181
+ } from "./chunk-XNTZD4AE.js";
178
182
  import {
179
183
  resolveAgentRuntimeConfigFromRecord
180
184
  } from "./chunk-4OXPN3WC.js";
@@ -217,6 +221,9 @@ import {
217
221
  normalizeRuntimeToolPolicyOverride,
218
222
  resolveEffectiveRuntimeToolPolicy
219
223
  } from "./chunk-USGHJSGO.js";
224
+ import {
225
+ workspaceChildEnv
226
+ } from "./chunk-CTIEJRTP.js";
220
227
  import {
221
228
  QUOTA_ERROR_PATTERNS,
222
229
  isQuotaExhaustedError
@@ -233,11 +240,16 @@ import {
233
240
  partitionScopedBlocks,
234
241
  renderTurnContextBlocksWithScope
235
242
  } from "./chunk-5HUO7SEX.js";
243
+ import {
244
+ isTombstoneRecord
245
+ } from "./chunk-BV3FLP2L.js";
236
246
  import {
237
247
  parseExternalSkillMarkdown,
238
248
  parseSkillDocProtocol
239
249
  } from "./chunk-AETZ7AD6.js";
240
250
  import {
251
+ buildDialogKey,
252
+ dialogMessageKey,
241
253
  ulid
242
254
  } from "./chunk-OJKUU3LP.js";
243
255
  import {
@@ -281,7 +293,7 @@ import {
281
293
  toolIcon,
282
294
  toolLabel,
283
295
  toolLabelVariants
284
- } from "./chunk-OGZE6BZG.js";
296
+ } from "./chunk-E5RYFR7E.js";
285
297
  import {
286
298
  isAntigravityOAuthAgent
287
299
  } from "./chunk-CTWCZKNS.js";
@@ -1074,42 +1086,72 @@ ${cardText}` : cardText;
1074
1086
  var ENABLE_REMOTE_ATTACHMENT_PART_WRITES = false;
1075
1087
 
1076
1088
  // packages/cli/client/cliTurnUserMessage.ts
1077
- var messageKey = (dialogId, messageId) => `dialog-${dialogId}-msg-${messageId}`;
1078
- var singleCandidate = (input) => {
1079
- const candidates = input.batchMessageIds?.length ? input.batchMessageIds : (input.userMessages ?? []).map((message) => message.cliMessageId).filter((id) => typeof id === "string" && id.length > 0);
1080
- const unique = [...new Set(candidates)];
1081
- return unique.length === 1 ? unique[0] : null;
1082
- };
1083
- var resolvePersistedTurnUserMessageId = async (input) => {
1084
- if (!input.dialogId) return void 0;
1085
- const candidate = singleCandidate(input);
1086
- if (!candidate) return void 0;
1089
+ async function resolvePersistedTurnUserMessageId(input) {
1090
+ const { store, dialogId, userId, userMessages, batchMessageIds } = input;
1091
+ if (userMessages && userMessages.length !== 1) return void 0;
1092
+ if (batchMessageIds && batchMessageIds.length !== 1) return void 0;
1093
+ const candidate = userMessages ? userMessages[0]?.cliMessageId : batchMessageIds?.[0];
1094
+ if (!candidate || batchMessageIds && batchMessageIds[0] !== candidate) return void 0;
1087
1095
  try {
1088
- const record = await input.store.read(messageKey(input.dialogId, candidate), {
1089
- remote: false
1090
- });
1091
- if (!record || record.role !== "user" || record.id !== candidate) return void 0;
1096
+ await resolveWorkContextAccess({ get: (key) => store.read(key, { remote: false }) }, userId, dialogId, candidate);
1092
1097
  return candidate;
1093
1098
  } catch {
1094
1099
  return void 0;
1095
1100
  }
1096
- };
1097
- async function resolveInjectedTurnUserMessageId(input) {
1098
- const messages = input.userMessages;
1099
- if (messages?.length !== 1 || !messages[0]?.cliMessageId) return void 0;
1100
- const id = await resolvePersistedTurnUserMessageId(input);
1101
- if (!id) return void 0;
1102
- try {
1103
- await resolveWorkContextAccess(
1104
- { get: (key) => input.store.read(key, { remote: false }) },
1105
- input.userId,
1106
- input.dialogId,
1107
- id
1108
- );
1109
- return id;
1110
- } catch {
1101
+ }
1102
+ async function persistDirectWorkMemorySource(args) {
1103
+ const { store, userId, dialogId, turnId, message } = args;
1104
+ if (!userId || userId === "server" || !/^[A-Za-z0-9_-]{1,128}$/.test(dialogId)) return void 0;
1105
+ const id = dialogTurnUserMessageId(turnId, 0);
1106
+ if (!id || message.role !== "user" || message.id !== id || typeof message.content !== "string") return void 0;
1107
+ const dialogKey = buildDialogKey(userId, dialogId);
1108
+ const messageKey = dialogMessageKey(dialogId, id);
1109
+ const existingDialog = await store.read(dialogKey, { remote: false });
1110
+ if (existingDialog) {
1111
+ await resolveWorkContextAccess({ get: async () => existingDialog }, userId, dialogId);
1112
+ } else if (!args.freshDialog) {
1111
1113
  return void 0;
1112
1114
  }
1115
+ const existingMessage = await store.read(messageKey, { remote: false });
1116
+ if (!existingMessage) {
1117
+ const { ops } = buildLocalDialogWritePlan({
1118
+ input: { ...args.input, continueDialogId: dialogId, messages: [message], result: { content: "", model: "" } },
1119
+ userId,
1120
+ now: Date.now(),
1121
+ createId: () => dialogId,
1122
+ existingDialog
1123
+ });
1124
+ const userOp = ops.find((op) => op.key === messageKey && op.value.role === "user");
1125
+ const dialogOp = ops.find((op) => op.key === dialogKey);
1126
+ if (!userOp || !dialogOp) return void 0;
1127
+ const { status, finishedAt, ...openDialog } = dialogOp.value;
1128
+ if (!existingDialog) {
1129
+ await registerDialogOwner({
1130
+ store: {
1131
+ get: (key) => store.read(key, { remote: false }),
1132
+ put: (key, value) => store.batch([{ type: "put", key, value }])
1133
+ },
1134
+ dialogId,
1135
+ ownerId: userId,
1136
+ spaceId: args.input.spaceId,
1137
+ source: "cli-work-memory-source"
1138
+ });
1139
+ const owner = await store.read(dialogOwnerKey(dialogId), { remote: false });
1140
+ if (owner?.dialogId !== dialogId || owner.ownerId !== userId) return void 0;
1141
+ const currentDialog = await store.read(dialogKey, { remote: false });
1142
+ if (currentDialog) {
1143
+ await resolveWorkContextAccess({ get: async () => currentDialog }, userId, dialogId);
1144
+ await store.batch([userOp]);
1145
+ } else {
1146
+ await store.batch([{ ...dialogOp, value: openDialog }, userOp]);
1147
+ }
1148
+ } else {
1149
+ await store.batch([userOp]);
1150
+ }
1151
+ }
1152
+ const persisted = await store.read(messageKey, { remote: false });
1153
+ if (!persisted || isTombstoneRecord(persisted) || persisted.content !== message.content) return void 0;
1154
+ return resolvePersistedTurnUserMessageId({ store, userId, dialogId, userMessages: [{ cliMessageId: id }] });
1113
1155
  }
1114
1156
 
1115
1157
  // packages/cli/client/tokenUsage.ts
@@ -8727,12 +8769,15 @@ function plainToolLine(line) {
8727
8769
  return stripAnsi(line);
8728
8770
  }
8729
8771
  var TOOL_TREE_GROUP_LABELS = new Set(
8730
- ["execShell", "readFile", "fetchWebpage", "exa_search"].flatMap((name) => [
8731
- // 新 transcript 用紧凑图标做树头(`📄 (2) · a.ts, b.ts ✓`)。
8732
- toolIcon(name),
8733
- // 历史 transcript 里仍是本地化工具名,改版不能把它们降级成普通 bullet。
8734
- ...toolLabelVariants(name)
8735
- ])
8772
+ ["execShell", "readFile", "fetchWebpage", "exa_search"].flatMap((name) => {
8773
+ const fam = toolFamilyOf(name);
8774
+ return [
8775
+ fam.icon,
8776
+ fam.en,
8777
+ fam.zh,
8778
+ ...toolLabelVariants(name)
8779
+ ];
8780
+ })
8736
8781
  );
8737
8782
  function isKnownToolGroupLabel(label) {
8738
8783
  return TOOL_TREE_GROUP_LABELS.has(label);
@@ -9507,6 +9552,11 @@ function shellWords(text, validationOnly = false) {
9507
9552
  started = true;
9508
9553
  continue;
9509
9554
  }
9555
+ if (ch === "?" && /^https?:\/\//i.test(word)) {
9556
+ word += ch;
9557
+ started = true;
9558
+ continue;
9559
+ }
9510
9560
  if (/[<> &|;(){}*?\[\]#~]/.test(ch) && !/\s/.test(ch)) return null;
9511
9561
  if (/\s/.test(ch)) {
9512
9562
  if (started) words2.push(word);
@@ -9754,6 +9804,9 @@ function firstVerbToken(segment) {
9754
9804
  const [, word, restAfter] = m;
9755
9805
  const base = word.replace(/^.*\//, "");
9756
9806
  if (wrappers.has(base) && restAfter.trim()) {
9807
+ if (base === "command" && /^-(?:v|V)(?:\s|$)/.test(restAfter.trim())) {
9808
+ return { verb: base, rest: restAfter.trim() };
9809
+ }
9757
9810
  rest = restAfter.trim();
9758
9811
  continue;
9759
9812
  }
@@ -9957,6 +10010,179 @@ function parseNolo(rest) {
9957
10010
  if (sub === "ci") return { verb: "\u67E5 CI \u72B6\u6001", readOnly: true };
9958
10011
  return null;
9959
10012
  }
10013
+ function stripTrailingPipe(rest) {
10014
+ let quote = null;
10015
+ for (let i = 0; i < rest.length; i++) {
10016
+ const ch = rest[i];
10017
+ const next = rest[i + 1];
10018
+ if (quote) {
10019
+ if (ch === "\\" && next && quote === '"') {
10020
+ i++;
10021
+ continue;
10022
+ }
10023
+ if (ch === quote) quote = null;
10024
+ continue;
10025
+ }
10026
+ if (ch === '"' || ch === "'") {
10027
+ quote = ch;
10028
+ continue;
10029
+ }
10030
+ if (ch === "\\" && next) {
10031
+ i++;
10032
+ continue;
10033
+ }
10034
+ if (ch === "|" && next !== "|" && rest[i - 1] !== "|") {
10035
+ return rest.slice(0, i).trim();
10036
+ }
10037
+ }
10038
+ return rest.trim();
10039
+ }
10040
+ var CURL_VALUE_FLAGS = /* @__PURE__ */ new Set([
10041
+ "-o",
10042
+ "--output",
10043
+ "-H",
10044
+ "--header",
10045
+ "-d",
10046
+ "--data",
10047
+ "--data-raw",
10048
+ "--data-binary",
10049
+ "--data-urlencode",
10050
+ "--data-ascii",
10051
+ "-F",
10052
+ "--form",
10053
+ "--form-string",
10054
+ "-u",
10055
+ "--user",
10056
+ "-A",
10057
+ "--user-agent",
10058
+ "-e",
10059
+ "--referer",
10060
+ "-b",
10061
+ "--cookie",
10062
+ "-c",
10063
+ "--cookie-jar",
10064
+ "-x",
10065
+ "--proxy",
10066
+ "-U",
10067
+ "--proxy-user",
10068
+ "-X",
10069
+ "--request",
10070
+ "-m",
10071
+ "--max-time",
10072
+ "--connect-timeout",
10073
+ "--retry",
10074
+ "--retry-delay",
10075
+ "--retry-max-time",
10076
+ "-w",
10077
+ "--write-out",
10078
+ "-T",
10079
+ "--upload-file",
10080
+ "-K",
10081
+ "--config",
10082
+ "--resolve",
10083
+ "--cacert",
10084
+ "--capath",
10085
+ "--cert",
10086
+ "--key",
10087
+ "-E",
10088
+ "--interface",
10089
+ "--limit-rate",
10090
+ "-r",
10091
+ "--range",
10092
+ "-Y",
10093
+ "-y",
10094
+ "--oauth2-bearer",
10095
+ "--aws-sigv4",
10096
+ "--connect-to",
10097
+ "--dns-servers"
10098
+ ]);
10099
+ var WGET_VALUE_FLAGS = /* @__PURE__ */ new Set([
10100
+ "-O",
10101
+ "--output-document",
10102
+ "-P",
10103
+ "--directory-prefix",
10104
+ "--header",
10105
+ "--user",
10106
+ "--password",
10107
+ "--http-user",
10108
+ "--http-password",
10109
+ "-U",
10110
+ "--user-agent",
10111
+ "-T",
10112
+ "--timeout",
10113
+ "-t",
10114
+ "--tries",
10115
+ "-a",
10116
+ "--append-output",
10117
+ "-o",
10118
+ "--output-file",
10119
+ "--post-data",
10120
+ "--post-file",
10121
+ "--load-cookies",
10122
+ "--save-cookies",
10123
+ "-e",
10124
+ "--execute",
10125
+ "--referer",
10126
+ "--wait",
10127
+ "--limit-rate",
10128
+ "--ca-certificate",
10129
+ "--certificate"
10130
+ ]);
10131
+ function extractSafeUrlTarget(rawUrl) {
10132
+ const trimmed = rawUrl.trim();
10133
+ if (!/^(?:https?|ftp):\/\//i.test(trimmed)) return null;
10134
+ let parsed;
10135
+ try {
10136
+ parsed = new URL(trimmed);
10137
+ } catch {
10138
+ return null;
10139
+ }
10140
+ if (!["http:", "https:", "ftp:"].includes(parsed.protocol)) return null;
10141
+ const hostname = parsed.hostname;
10142
+ if (!hostname) return null;
10143
+ const pathname = parsed.pathname || "/";
10144
+ if (!pathname.endsWith("/")) {
10145
+ const rawLast = pathname.split("/").filter(Boolean).pop();
10146
+ if (rawLast) {
10147
+ let decoded = rawLast;
10148
+ try {
10149
+ decoded = decodeURIComponent(rawLast);
10150
+ } catch {
10151
+ }
10152
+ const looksLikeSecret = decoded.includes("=") || /^(?:sk-|ghp_|gho_|ghu_|ghs_|github_pat_|AKIA|AIza|xox[baprs]-|eyJ)/i.test(decoded);
10153
+ if (!looksLikeSecret && !/[\s?#\\]/.test(decoded) && decoded.length <= 64 && /^[^/]+\.[A-Za-z0-9]{1,8}$/.test(decoded)) {
10154
+ return { kind: "file", target: clipShortText(decoded, 32) };
10155
+ }
10156
+ }
10157
+ }
10158
+ return { kind: "host", target: clipShortText(hostname, 32) };
10159
+ }
10160
+ function parseCurlOrWget(verb, rest) {
10161
+ const head = stripTrailingPipe(rest);
10162
+ const tokens2 = shellWords(head);
10163
+ if (!tokens2) return null;
10164
+ const valueFlags = verb === "curl" ? CURL_VALUE_FLAGS : WGET_VALUE_FLAGS;
10165
+ const positionals = [];
10166
+ for (let i = 0; i < tokens2.length; i++) {
10167
+ const tok = tokens2[i];
10168
+ if (tok === "--") {
10169
+ positionals.push(...tokens2.slice(i + 1));
10170
+ break;
10171
+ }
10172
+ if (tok.startsWith("-")) {
10173
+ if (!tok.includes("=") && valueFlags.has(tok)) i++;
10174
+ continue;
10175
+ }
10176
+ positionals.push(tok);
10177
+ }
10178
+ for (const pos of positionals) {
10179
+ const extracted = extractSafeUrlTarget(pos);
10180
+ if (extracted) {
10181
+ return extracted.kind === "file" ? { verb: "\u4E0B\u8F7D", target: extracted.target, readOnly: false } : { verb: "\u8BF7\u6C42", target: extracted.target, readOnly: false };
10182
+ }
10183
+ }
10184
+ return { verb: "\u4E0B\u8F7D", readOnly: false };
10185
+ }
9960
10186
  function classifySegment(segment) {
9961
10187
  const { verb, rest } = firstVerbToken(segment);
9962
10188
  if (!verb) return null;
@@ -10065,7 +10291,7 @@ function classifySegment(segment) {
10065
10291
  }
10066
10292
  case "curl":
10067
10293
  case "wget":
10068
- return { verb: "\u4E0B\u8F7D", readOnly: false };
10294
+ return parseCurlOrWget(verb, rest);
10069
10295
  case "bun":
10070
10296
  case "npm":
10071
10297
  case "pnpm":
@@ -10123,22 +10349,104 @@ function classifySegment(segment) {
10123
10349
  case "wc":
10124
10350
  case "sort":
10125
10351
  case "uniq": {
10126
- const tokens2 = shellWords(rest.split(/\s+\|\s+/)[0]);
10127
- let file;
10128
- if (tokens2) {
10129
- for (let i = 0; i < tokens2.length; i++) {
10130
- const tok = tokens2[i];
10131
- if (tok === "-n" || tok === "-c") {
10132
- i++;
10133
- continue;
10134
- }
10135
- if (tok.startsWith("-")) continue;
10136
- file = tok;
10352
+ const tokens2 = shellWords(stripTrailingPipe(rest));
10353
+ if (!tokens2) return null;
10354
+ if (verb === "sort" && tokens2.some((t2) => t2 === "-o" || t2.startsWith("-") && !t2.startsWith("--") && t2.includes("o") || t2 === "--output" || t2.startsWith("--output="))) {
10355
+ return null;
10356
+ }
10357
+ const valueFlagsByCmd = {
10358
+ head: /* @__PURE__ */ new Set(["-n", "-c", "--lines", "--bytes"]),
10359
+ tail: /* @__PURE__ */ new Set(["-n", "-c", "-s", "--lines", "--bytes", "--sleep-interval", "--pid"]),
10360
+ wc: /* @__PURE__ */ new Set(["--files0-from"]),
10361
+ sort: /* @__PURE__ */ new Set(["-t", "-k", "-T", "-S", "--field-separator", "--key", "--temporary-directory", "--buffer-size", "--files0-from"]),
10362
+ uniq: /* @__PURE__ */ new Set(["-f", "-s", "-w", "--skip-fields", "--skip-chars", "--check-chars"])
10363
+ };
10364
+ const valueFlags = valueFlagsByCmd[verb];
10365
+ const positionals = [];
10366
+ for (let i = 0; i < tokens2.length; i++) {
10367
+ const tok = tokens2[i];
10368
+ if (tok === "--") {
10369
+ positionals.push(...tokens2.slice(i + 1));
10137
10370
  break;
10138
10371
  }
10372
+ if (tok.startsWith("-")) {
10373
+ if (!tok.includes("=") && valueFlags.has(tok)) i++;
10374
+ continue;
10375
+ }
10376
+ positionals.push(tok);
10139
10377
  }
10378
+ if (verb === "uniq" && positionals.length >= 2) return null;
10379
+ const file = positionals[0];
10140
10380
  return file ? { verb: "\u67E5\u770B", target: baseName(file), readOnly: true } : { verb: "\u67E5\u770B\u8F93\u51FA", readOnly: true };
10141
10381
  }
10382
+ case "which": {
10383
+ const tokens2 = shellWords(stripTrailingPipe(rest));
10384
+ if (!tokens2) return null;
10385
+ const target = tokens2.find((t2) => !t2.startsWith("-"));
10386
+ return target ? { verb: "\u67E5\u547D\u4EE4", target: clipShortText(target, 24), readOnly: true } : { verb: "\u67E5\u547D\u4EE4", readOnly: true };
10387
+ }
10388
+ case "command": {
10389
+ const tokens2 = shellWords(stripTrailingPipe(rest));
10390
+ if (!tokens2 || tokens2.length < 2) return null;
10391
+ if (tokens2[0] !== "-v" && tokens2[0] !== "-V") return null;
10392
+ const target = tokens2.slice(1).find((t2) => !t2.startsWith("-"));
10393
+ return target ? { verb: "\u67E5\u547D\u4EE4", target: clipShortText(target, 24), readOnly: true } : null;
10394
+ }
10395
+ case "file": {
10396
+ const tokens2 = shellWords(stripTrailingPipe(rest));
10397
+ if (!tokens2) return null;
10398
+ for (const tok of tokens2) {
10399
+ if (tok === "--") break;
10400
+ if (tok === "--compile" || tok.startsWith("-") && !tok.startsWith("--") && tok.includes("C")) {
10401
+ return null;
10402
+ }
10403
+ }
10404
+ let file;
10405
+ for (let i = 0; i < tokens2.length; i++) {
10406
+ const tok = tokens2[i];
10407
+ if (tok === "--") {
10408
+ file = tokens2[i + 1];
10409
+ break;
10410
+ }
10411
+ if (["-m", "-f", "-F", "-e", "--exclude", "--magic-file"].includes(tok)) {
10412
+ i++;
10413
+ continue;
10414
+ }
10415
+ if (tok.startsWith("-")) continue;
10416
+ file = tok;
10417
+ break;
10418
+ }
10419
+ return { verb: "\u67E5\u7C7B\u578B", target: file ? baseName(file) : void 0, readOnly: true };
10420
+ }
10421
+ case "stat": {
10422
+ const tokens2 = shellWords(stripTrailingPipe(rest));
10423
+ if (!tokens2) return null;
10424
+ let file;
10425
+ for (let i = 0; i < tokens2.length; i++) {
10426
+ const tok = tokens2[i];
10427
+ if (["-c", "--format", "--printf"].includes(tok)) {
10428
+ i++;
10429
+ continue;
10430
+ }
10431
+ if (tok.startsWith("-")) continue;
10432
+ file = tok;
10433
+ break;
10434
+ }
10435
+ return { verb: "\u67E5\u6587\u4EF6\u4FE1\u606F", target: file ? baseName(file) : void 0, readOnly: true };
10436
+ }
10437
+ case "readlink":
10438
+ case "realpath": {
10439
+ const tokens2 = shellWords(stripTrailingPipe(rest));
10440
+ if (!tokens2) return null;
10441
+ const file = tokens2.find((t2) => !t2.startsWith("-"));
10442
+ return { verb: "\u89E3\u6790\u8DEF\u5F84", target: file ? baseName(file) : void 0, readOnly: true };
10443
+ }
10444
+ case "pwd":
10445
+ return { verb: "\u67E5\u5F53\u524D\u76EE\u5F55", readOnly: true };
10446
+ case "uname":
10447
+ return { verb: "\u67E5\u7CFB\u7EDF\u4FE1\u606F", readOnly: true };
10448
+ case "whoami":
10449
+ return { verb: "\u67E5\u8EAB\u4EFD", readOnly: true };
10142
10450
  default:
10143
10451
  return null;
10144
10452
  }
@@ -10332,6 +10640,7 @@ var families = {
10332
10640
  readFile: ["read", "\u8BFB\u53D6", ["path"], true],
10333
10641
  read_file: ["read", "\u8BFB\u53D6", ["path"], true],
10334
10642
  readWorkspaceFile: ["read", "\u8BFB\u53D6", ["path"], true],
10643
+ read_image: ["read", "\u770B\u56FE", ["path"], true],
10335
10644
  writeFile: ["write", "\u5199\u5165", ["path"], false],
10336
10645
  editFile: ["edit", "\u4FEE\u6539", ["path"], false],
10337
10646
  globFiles: ["find", "\u67E5\u627E\u6587\u4EF6", ["pattern", "path"], true],
@@ -10395,10 +10704,14 @@ function safeAskText(value, max) {
10395
10704
  const guarded = withholdIfSecretLike(cleaned) || ASK_SECRET_PLACEHOLDER;
10396
10705
  return max === void 0 ? guarded : clipCompactText(guarded, max, "\u2026");
10397
10706
  }
10707
+ var BIDI_CONTROL_REGEX = new RegExp("\\p{Bidi_Control}", "gu");
10708
+ function safeApprovalSingleLineText(value, max) {
10709
+ return safeAskText(value, max).replace(BIDI_CONTROL_REGEX, "");
10710
+ }
10398
10711
  function safeApprovalMultilineText(value) {
10399
10712
  const lines = stripAnsi(String(value ?? "")).replace(/\r\n?|\u2028|\u2029/g, "\n").split("\n");
10400
10713
  return lines.map((line) => {
10401
- const cleaned = line.replace(/\t/g, " ").replace(C0_C1_CONTROL_REGEX, "");
10714
+ const cleaned = line.replace(/\t/g, " ").replace(C0_C1_CONTROL_REGEX, "").replace(BIDI_CONTROL_REGEX, "");
10402
10715
  const redacted = redactSecrets(cleaned);
10403
10716
  return redacted ? withholdIfSecretLike(redacted) || ASK_SECRET_PLACEHOLDER : "";
10404
10717
  }).join("\n");
@@ -10717,10 +11030,11 @@ function formatReadItemPath(rawPath, metadata, customHomedir) {
10717
11030
  }
10718
11031
  function formatSearchItemQuery(query, path2, customHomedir) {
10719
11032
  let text = (query || "").trim();
10720
- if (path2) {
10721
- const formattedPath = formatHomePath(path2, customHomedir);
11033
+ const trimmedPath = (path2 || "").trim();
11034
+ if (trimmedPath && trimmedPath !== "." && trimmedPath !== "./") {
11035
+ const formattedPath = formatHomePath(trimmedPath, customHomedir);
10722
11036
  if (formattedPath) {
10723
- text = text ? `${text} in ${formattedPath}` : formattedPath;
11037
+ text = text ? `${text} \xB7 ${formattedPath}` : formattedPath;
10724
11038
  }
10725
11039
  }
10726
11040
  if (!text) return "search";
@@ -11355,9 +11669,27 @@ function memoryToolGist(toolName, metadata) {
11355
11669
  }
11356
11670
  return "";
11357
11671
  }
11672
+ function formatReadImageSummary(metadata) {
11673
+ const rawPaths = Array.isArray(metadata.paths) ? metadata.paths.filter((p) => typeof p === "string" && p.trim().length > 0) : [];
11674
+ const singlePath = typeof metadata.path === "string" && metadata.path.trim() || (rawPaths.length === 1 ? rawPaths[0].trim() : "");
11675
+ if (singlePath && rawPaths.length <= 1) {
11676
+ return gistClip(redactSecrets(formatReadItemPath(singlePath, metadata)), 52);
11677
+ }
11678
+ if (rawPaths.length > 1) {
11679
+ const firstRaw = rawPaths[0];
11680
+ const first = pathBasenameGist(redactSecrets(firstRaw)) || gistClip(redactSecrets(formatHomePath(firstRaw)), 28) || "image";
11681
+ const text = getCliLocale() === "zh" ? `${first} \u7B49 ${rawPaths.length} \u5F20\u56FE` : `${first} +${rawPaths.length - 1} more`;
11682
+ return gistClip(redactSecrets(text), 52);
11683
+ }
11684
+ return "";
11685
+ }
11358
11686
  function normalToolGistRaw(event) {
11359
11687
  const metadata = event.metadata ?? {};
11360
11688
  const toolName = event.toolName || "";
11689
+ if (toolName === "read_image") {
11690
+ const summary = formatReadImageSummary(metadata);
11691
+ if (summary) return summary;
11692
+ }
11361
11693
  if (toolName === "readFile" || toolName === "writeFile" || toolName === "editFile") {
11362
11694
  const path3 = typeof metadata.path === "string" ? metadata.path : typeof metadata.filePath === "string" ? metadata.filePath : "";
11363
11695
  if (path3) return gistClip(formatReadItemPath(path3, metadata), 52);
@@ -11449,11 +11781,12 @@ function formatNormalToolLine(event, pending, colorEnabled, opts, omitSuccessGly
11449
11781
  const title = gist2 ? `${label} \xB7 ${gist2}` : label;
11450
11782
  return formatToolTraceLine(fitNormalLine(`\u25B8 ${title}`, `\u2717 ${reason}`, totalBudget), colorEnabled, "error");
11451
11783
  }
11452
- const successLabel = omitSuccessGlyph?.(toolName) ? " ".repeat(displayWidth(label)) : label;
11453
11784
  const resultSummary = normalResultSummary(event);
11454
11785
  const gist = [normalToolGist(event), resultSummary].filter(Boolean).join(" \xB7 ");
11455
11786
  const hint = editFileResultHint(event);
11456
11787
  const statsInline = hint?.inline ? ` ${hint.inline}` : "";
11788
+ const canOmitLabel = Boolean(gist || statsInline);
11789
+ const successLabel = canOmitLabel && omitSuccessGlyph?.(toolName) ? " ".repeat(displayWidth(label)) : label;
11457
11790
  const durationInline = formatNormalToolDuration(event.elapsedMs);
11458
11791
  const tail = durationInline ? ` \u2713 ${durationInline}` : " \u2713";
11459
11792
  let fittedGist = gist;
@@ -11555,7 +11888,7 @@ var TUI_TREE_MARKER = "TUI_TREE\n";
11555
11888
  var TUI_TREE_END = "";
11556
11889
  var TUI_TREE_TOOLS = {
11557
11890
  Run: ["execShell", "runCommand", "launchProcess"],
11558
- Read: ["readFile"],
11891
+ Read: ["readFile", "read_image"],
11559
11892
  Search: ["exa_search", "globFiles", "searchFiles", "codeSearch"],
11560
11893
  Fetch: ["fetchWebpage"]
11561
11894
  };
@@ -11571,6 +11904,7 @@ function toolRowDetailLine(line) {
11571
11904
  const glyph = match[1] ?? "";
11572
11905
  const family = toolFamilyOfIcon(glyph);
11573
11906
  if (!family) return line;
11907
+ if (glyph === family.en || glyph === family.zh) return line;
11574
11908
  const familyName = toolFamilyLabel(glyph);
11575
11909
  const glyphIndex = match[0].length - glyph.length;
11576
11910
  return `${line.slice(0, glyphIndex)}${familyName}${line.slice(match[0].length)}`;
@@ -11659,7 +11993,13 @@ function createToolEventFormatter(colorEnabled = resolveCliColorEnabled(), opts
11659
11993
  if (kind === "Run") {
11660
11994
  item = activity.summary ?? (activity.confidence === "raw-fallback" ? clipCompactText(redactSecrets(activity.object ?? ""), 56, "\u2026") : [activity.action, activity.object].filter(Boolean).join(" "));
11661
11995
  }
11662
- if (kind === "Read") item = formatReadItemPath(typeof m.path === "string" ? m.path : typeof m.filePath === "string" ? m.filePath : "file", m);
11996
+ if (kind === "Read") {
11997
+ if (name === "read_image") {
11998
+ item = formatReadImageSummary(m) || toolIcon("read_image");
11999
+ } else {
12000
+ item = formatReadItemPath(typeof m.path === "string" ? m.path : typeof m.filePath === "string" ? m.filePath : "file", m);
12001
+ }
12002
+ }
11663
12003
  if (kind === "Search") item = formatSearchItemQuery(typeof m.query === "string" ? m.query : typeof m.pattern === "string" ? m.pattern : "search", typeof m.path === "string" ? m.path : void 0);
11664
12004
  if (kind === "Fetch") item = formatFetchItemUrl(typeof m.url === "string" ? m.url : "webpage");
11665
12005
  item = safeAskText(item) || toolLabel(name);
@@ -12724,7 +13064,7 @@ function isBalanceExhaustedError(error) {
12724
13064
 
12725
13065
  // packages/cli/client/agentRun.ts
12726
13066
  async function loadRunLocalAgentTurn() {
12727
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-NC6CTZED.js");
13067
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-LVXPQ7QA.js");
12728
13068
  return runLocalAgentTurn;
12729
13069
  }
12730
13070
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -13945,21 +14285,25 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
13945
14285
  `);
13946
14286
  return { exitCode: 1, localError: error };
13947
14287
  }
13948
- try {
13949
- const persistedUserMessageId = await resolvePersistedTurnUserMessageId({
13950
- store: await getOrCreateSharedStore({
13951
- env: options.env,
13952
- cwd: options.localRuntimeCwd,
13953
- fetchImpl: options.fetchImpl
13954
- }),
13955
- dialogId: currentDialogId,
13956
- batchMessageIds: batchIdentity?.messageIds,
13957
- userMessages: options.userMessages
13958
- });
13959
- if (persistedUserMessageId) {
13960
- runtimeContextWithOwnership.userMessageId = persistedUserMessageId;
14288
+ const userId = resolveLocalUserId(options.env);
14289
+ const getTurnStore = () => getOrCreateSharedStore({
14290
+ env: options.env,
14291
+ cwd: options.localRuntimeCwd,
14292
+ fetchImpl: options.fetchImpl
14293
+ });
14294
+ const canUseWorkSource = !options.ephemeral && !options.background && !options.internalTurn && options.env.NOLO_AGENT_RUN_CHILD !== "1";
14295
+ if (canUseWorkSource && options.userMessages?.length === 1) {
14296
+ try {
14297
+ const id = await resolvePersistedTurnUserMessageId({
14298
+ store: await getTurnStore(),
14299
+ userId,
14300
+ dialogId: currentDialogId,
14301
+ batchMessageIds: batchIdentity?.messageIds,
14302
+ userMessages: options.userMessages
14303
+ });
14304
+ if (id) runtimeContextWithOwnership.userMessageId = id;
14305
+ } catch {
13961
14306
  }
13962
- } catch {
13963
14307
  }
13964
14308
  const markBatch = async (phase) => {
13965
14309
  if (!batchIdentity) return;
@@ -14026,6 +14370,7 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
14026
14370
  };
14027
14371
  const expandedMessage = options.pastedTextStore?.items.size ? expandCollapsedPastes(options.message, options.pastedTextStore) : options.message;
14028
14372
  const commandObservations = [];
14373
+ const collectedToolImageArtifacts = [];
14029
14374
  const retainCommandObservations = (result) => {
14030
14375
  recordRunResultHeaderMeta(result, { commandObservations });
14031
14376
  return result;
@@ -14083,16 +14428,28 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
14083
14428
  inheritedFromDialogKey: options.inheritedFromDialogKey,
14084
14429
  parentDialogId: options.parentDialogId,
14085
14430
  runtimeContext: runtimeContextWithOwnership,
14086
- resolveInjectedUserMessageId: async (messages) => resolveInjectedTurnUserMessageId({
14087
- store: await getOrCreateSharedStore({
14088
- env: options.env,
14089
- cwd: options.localRuntimeCwd,
14090
- fetchImpl: options.fetchImpl
14091
- }),
14092
- userId: resolveLocalUserId(options.env),
14431
+ ...canUseWorkSource && !batchIdentity && !options.userMessages?.length ? { prepareDirectWorkMemorySource: async (message) => persistDirectWorkMemorySource({
14432
+ store: await getTurnStore(),
14433
+ userId,
14434
+ dialogId: currentDialogId,
14435
+ turnId,
14436
+ freshDialog,
14437
+ input: {
14438
+ agentKey: options.agentKey,
14439
+ runtimeContext: runtimeContextWithOwnership,
14440
+ spaceId: options.spaceId,
14441
+ category: options.category,
14442
+ inheritedFromDialogKey: options.inheritedFromDialogKey,
14443
+ parentDialogId: options.parentDialogId
14444
+ },
14445
+ message
14446
+ }) } : {},
14447
+ ...!options.ephemeral ? { resolveInjectedUserMessageId: async (messages) => resolvePersistedTurnUserMessageId({
14448
+ store: await getTurnStore(),
14449
+ userId,
14093
14450
  dialogId: currentDialogId,
14094
14451
  userMessages: messages
14095
- }),
14452
+ }) } : {},
14096
14453
  runKind: options.env.NOLO_AGENT_RUN_CHILD === "1" ? "subtask" : "interactive",
14097
14454
  // 展示能力由宿主声明(TUI=narrow),非交互 CLI/后台留空 → unknown;
14098
14455
  // 排版段只在能力已知时由 localLoop 注入,server 线不读该字段。
@@ -14131,6 +14488,13 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
14131
14488
  onToolEvent: (event) => {
14132
14489
  const observation = observeLocalCommandResult(event, options.localRuntimeCwd ?? process.cwd());
14133
14490
  if (observation) commandObservations.push({ ...observation, ...commandVersionBindings.get(event.toolCallId) });
14491
+ if (event.type === "tool-result" && event.imageArtifacts?.length) {
14492
+ if (options.onToolImageArtifacts) {
14493
+ options.onToolImageArtifacts(event.imageArtifacts);
14494
+ } else {
14495
+ collectedToolImageArtifacts.push(...event.imageArtifacts);
14496
+ }
14497
+ }
14134
14498
  turnOutput.handleToolEvent(event);
14135
14499
  },
14136
14500
  ...!options.noStream ? {
@@ -14166,7 +14530,8 @@ async function executeLocalAgentTurnForCliWithAdapter(options, settings, resolve
14166
14530
  ...turnTokens !== void 0 ? { turnTokens } : {},
14167
14531
  ...turnCredits !== void 0 ? { turnCredits } : {},
14168
14532
  ...usageRecords?.length ? { usageRecords } : {},
14169
- ...runContextWindow !== void 0 ? { contextWindow: runContextWindow } : {}
14533
+ ...runContextWindow !== void 0 ? { contextWindow: runContextWindow } : {},
14534
+ ...collectedToolImageArtifacts.length > 0 ? { toolImageArtifacts: collectedToolImageArtifacts } : {}
14170
14535
  };
14171
14536
  const serverMeta = resolveResultServerMeta({
14172
14537
  env: options.env ?? {},
@@ -14709,6 +15074,7 @@ function executeDoDCommand(cmd, cwd, deps = {}) {
14709
15074
  shell: true,
14710
15075
  windowsHide: true,
14711
15076
  cwd: cwd || process.cwd(),
15077
+ env: workspaceChildEnv(deps.env),
14712
15078
  timeout: DOD_COMMAND_TIMEOUT_MS,
14713
15079
  maxBuffer: 10 * 1024 * 1024,
14714
15080
  encoding: "utf8"
@@ -16943,22 +17309,32 @@ async function resolveAgentBoundMachineIdFromRecord(args) {
16943
17309
  return resolveBoundMachineId(record) || void 0;
16944
17310
  }
16945
17311
  async function runAgentRunCommand(args, deps) {
17312
+ if (args.includes("--help") || args.includes("-h")) {
17313
+ writeUsage(deps.output ?? process.stdout, deps.commandPath);
17314
+ return 0;
17315
+ }
16946
17316
  const env = deps.env ?? process.env;
16947
17317
  const runId = env.NOLO_AGENT_RUN_ID;
16948
17318
  const controlDeps = { env, homedir: deps.homedir, fs: deps.fs, now: deps.now };
16949
17319
  const failStartup = async (error) => {
16950
- if (!runId || readRunRecord(runId, controlDeps)?.status !== "running") return;
17320
+ if (!runId) return;
17321
+ const record = readRunRecord(runId, controlDeps);
17322
+ if (record?.status !== "running" || record.pid != null && record.pid !== process.pid) return;
16951
17323
  const result = await settleRunTerminalAuthoritatively(runId, {
16952
17324
  status: "failed",
16953
17325
  exitCode: 1,
16954
17326
  failureReason: error instanceof RuntimeProtocolMismatchError ? "runtime_protocol_mismatch" : error instanceof RuntimeVersionMismatchError ? "runtime_version_mismatch" : "startup_failed",
16955
17327
  note: error ? toErrorMessage(error) : "Child initialization returned without terminal result"
16956
- }, controlDeps, (id, update, d) => transitionRunToTerminal(id, update, d));
17328
+ }, controlDeps, (id, update, d, opts) => transitionRunToTerminal(id, update, d, {
17329
+ ...opts?.expectedPid != null ? { expectedPid: opts.expectedPid } : {}
17330
+ }), { expectedPid: process.pid });
16957
17331
  if (result.kind === "contended") throw new Error(`Startup settlement lock busy: ${runId}`);
16958
17332
  };
16959
17333
  try {
16960
17334
  if (runId) {
16961
- if (!readRunRecord(runId, controlDeps)) throw new Error("[local-writer-resource] missing child binding");
17335
+ const record = readRunRecord(runId, controlDeps);
17336
+ if (record?.pid != null && record.pid !== process.pid) throw new Error(`Run ${runId} belongs to PID ${record.pid}, not ${process.pid}`);
17337
+ if (!record) throw new Error("[local-writer-resource] missing child binding");
16962
17338
  await recordRunStartup(runId, "initializing", controlDeps);
16963
17339
  validateAgentRunProtocol(env.NOLO_AGENT_RUN_PROTOCOL);
16964
17340
  await recordRunStartup(runId, "protocol_validated", controlDeps);
@@ -16977,10 +17353,6 @@ async function runAgentRunCommandImpl(args, deps) {
16977
17353
  write: (chunk) => process.stdout.write(chunk),
16978
17354
  writeErr: (chunk) => process.stderr.write(chunk)
16979
17355
  };
16980
- if (args.includes("--help") || args.includes("-h")) {
16981
- writeUsage(output, deps.commandPath);
16982
- return 0;
16983
- }
16984
17356
  let parsed;
16985
17357
  try {
16986
17358
  parsed = parseAgentRunArgs(args, { commandPath: deps.commandPath });
@@ -17107,7 +17479,8 @@ async function runAgentRunCommandImpl(args, deps) {
17107
17479
  },
17108
17480
  { env, homedir: deps.homedir, fs: deps.fs, now: deps.now, sleep: deps.sleep },
17109
17481
  // Test seam: stubbed transitions keep their single-attempt semantics.
17110
- deps.transitionRunToTerminal
17482
+ deps.transitionRunToTerminal,
17483
+ { expectedPid: process.pid }
17111
17484
  );
17112
17485
  };
17113
17486
  if (armStallWatchdog) {
@@ -17671,7 +18044,8 @@ async function runAgentRunCommandImpl(args, deps) {
17671
18044
  try {
17672
18045
  dodResults = (deps.runDoDCommands ?? runDoDCommands)(
17673
18046
  childRecordForDoD?.dodCommands,
17674
- childRecordForDoD?.cwd
18047
+ childRecordForDoD?.cwd,
18048
+ { env }
17675
18049
  );
17676
18050
  } catch (dodError) {
17677
18051
  console.warn(`[nolo] DoD verification failed to run for ${childRunId}:`, dodError);
@@ -17746,7 +18120,8 @@ async function runAgentRunCommandImpl(args, deps) {
17746
18120
  now: deps.now,
17747
18121
  sleep: deps.sleep
17748
18122
  },
17749
- deps.transitionRunToTerminal
18123
+ deps.transitionRunToTerminal,
18124
+ { expectedPid: process.pid }
17750
18125
  );
17751
18126
  } catch (error) {
17752
18127
  terminalStatus.fail();
@@ -17795,6 +18170,7 @@ export {
17795
18170
  redactSecrets,
17796
18171
  resolveCliColorEnabled,
17797
18172
  dimCliText,
18173
+ resolveCliHyperlinkEnabled,
17798
18174
  THEME_PALETTES,
17799
18175
  getActiveThemeName,
17800
18176
  setActiveThemeName,
@@ -17817,6 +18193,7 @@ export {
17817
18193
  polishBreathInsertsBlankBetween,
17818
18194
  formatAssistantDisplay,
17819
18195
  safeAskText,
18196
+ safeApprovalSingleLineText,
17820
18197
  safeApprovalMultilineText,
17821
18198
  TUI_TREE_MARKER,
17822
18199
  TUI_TREE_TOOLS,