dsh-ide-window 0.3.9 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -18,6 +18,8 @@ window.__ModuleLoader__.load({
18
18
  "floatStepDone.tools": "called tools",
19
19
  "floatStepDone.plan": "updated the plan",
20
20
  "floatStepDone.questions": "asked you a question",
21
+ "floatLiveThinking": "Thinking",
22
+ "floatLiveWriting": "Writing",
21
23
  "floatStepDone.web": "searched the web",
22
24
  "floatStepDone.search": "searched the code",
23
25
  "floatStepDone.write": "edited a file",
@@ -346,6 +348,48 @@ window.__ModuleLoader__.load({
346
348
  "floatSending": "Sending…",
347
349
  "floatFailed": "Send failed",
348
350
  "floatRunning": "Thinking",
351
+ "floatQueueUnit": "queued messages",
352
+ "floatQueueSending": "Sending…",
353
+ "floatQueueEdit": "Edit queued message",
354
+ "floatQueueSave": "Save",
355
+ "floatQueueCancel": "Cancel editing",
356
+ "floatQueueRemove": "Remove queued message",
357
+ "floatQueueSteer": "Steer into the running turn",
358
+ "floatQueueSteerUnavailable": "Steering works only while the turn is running",
359
+ "floatQueueEditFailed": "Edit failed: this message may have already started sending",
360
+ "floatQueueRemoveFailed": "Remove failed: this message may have already started sending",
361
+ "floatQueueSteerFailed": "Steering failed; try again",
362
+ "floatThink": "Thinking",
363
+ "floatContext": "Context",
364
+ "floatEvent": "Event",
365
+ "floatCtxAgentInstructions": "Agent instructions",
366
+ "floatCtxTime": "Time context",
367
+ "floatCtxRuntime": "Runtime context",
368
+ "floatCtxSkills": "Skill catalog",
369
+ "floatCtxCompact": "Compaction checkpoint",
370
+ "floatCtxJobs": "Job status",
371
+ "floatCtxApproval": "Approval reply",
372
+ "floatNoticeTurnAborted": "Turn aborted",
373
+ "floatNoticeAttempt": "Attempt failed",
374
+ "floatNoticeRetry": "Model retry",
375
+ "floatNoticeApproval": "Approval requested",
376
+ "floatNoticeApprovalResult": "Approval result",
377
+ "floatNoticeApprovalPolicy": "Approval policy",
378
+ "floatNoticeWorkspace": "Workspace changed",
379
+ "floatNoticeJob": "Background job",
380
+ "floatNoticeJobDone": "Job finished",
381
+ "floatNoticeCompaction": "Compaction",
382
+ "floatNoticeCompactionSummary": "Compaction summary",
383
+ "floatNoticePrune": "Context pruned",
384
+ "floatNoticeTodo": "Todos updated",
385
+ "floatNoticeModel": "Model changed",
386
+ "floatNoticePermission": "Permission",
387
+ "floatNoticeSandbox": "Sandbox",
388
+ "floatNoticeTools": "Tool registry",
389
+ "floatNoticeSystem": "System prompt",
390
+ "floatNoticeRequest": "Request context",
391
+ "floatNoticeTitle": "Session title",
392
+ "floatNoticeTitleRequest": "Title request",
349
393
  "floatAttach": "Add content",
350
394
  "floatAttachReference": "Reference the open file",
351
395
  "floatNeedsFile": "Open a file first",
@@ -394,7 +438,10 @@ window.__ModuleLoader__.load({
394
438
  "floatCloseViewer": "Close",
395
439
  "settingsFloatDetach": "Detach from the workspace",
396
440
  "settingsFloatDetachHint": "Keep the card on screen when you switch to another panel or back to the conversation",
441
+ "settingsFloatEvents": "Show full detail",
442
+ "settingsFloatEventsHint": "List reasoning, context, Tool arguments and system events; off shows only the latest status line",
397
443
  "floatWrap": "Wrap lines",
444
+ "floatLiveAnalyze": "Analyzing the request",
398
445
  }
399
446
  const IDE_TEXT_ZH = {
400
447
  "floatCommandNoEditor": "对话框还没就绪,稍后再试",
@@ -406,6 +453,8 @@ window.__ModuleLoader__.load({
406
453
  "floatStepDone.tools": "已调用工具",
407
454
  "floatStepDone.plan": "更新了计划",
408
455
  "floatStepDone.questions": "向用户提出了问题",
456
+ "floatLiveThinking": "思考中",
457
+ "floatLiveWriting": "正在输出",
409
458
  "floatStepDone.web": "已搜索网页",
410
459
  "floatStepDone.search": "已搜索代码",
411
460
  "floatStepDone.write": "修改了文件",
@@ -734,6 +783,48 @@ window.__ModuleLoader__.load({
734
783
  "floatSending": "发送中…",
735
784
  "floatFailed": "发送失败",
736
785
  "floatRunning": "深度求索中",
786
+ "floatQueueUnit": "条排队消息",
787
+ "floatQueueSending": "发送中…",
788
+ "floatQueueEdit": "编辑排队消息",
789
+ "floatQueueSave": "保存",
790
+ "floatQueueCancel": "取消编辑",
791
+ "floatQueueRemove": "删除排队消息",
792
+ "floatQueueSteer": "插话发送",
793
+ "floatQueueSteerUnavailable": "仅运行中可插话发送",
794
+ "floatQueueEditFailed": "编辑失败:这条消息可能已经开始发送",
795
+ "floatQueueRemoveFailed": "删除失败:这条消息可能已经开始发送",
796
+ "floatQueueSteerFailed": "插话发送失败,请重试",
797
+ "floatThink": "思考",
798
+ "floatContext": "上下文注入",
799
+ "floatEvent": "事件",
800
+ "floatCtxAgentInstructions": "项目说明",
801
+ "floatCtxTime": "时间上下文",
802
+ "floatCtxRuntime": "运行时上下文",
803
+ "floatCtxSkills": "技能目录",
804
+ "floatCtxCompact": "压缩检查点",
805
+ "floatCtxJobs": "作业状态",
806
+ "floatCtxApproval": "审批回复",
807
+ "floatNoticeTurnAborted": "回合中断",
808
+ "floatNoticeAttempt": "模型尝试失败",
809
+ "floatNoticeRetry": "模型重试",
810
+ "floatNoticeApproval": "审批请求",
811
+ "floatNoticeApprovalResult": "审批结果",
812
+ "floatNoticeApprovalPolicy": "审批策略",
813
+ "floatNoticeWorkspace": "文件变更",
814
+ "floatNoticeJob": "后台作业",
815
+ "floatNoticeJobDone": "后台作业结束",
816
+ "floatNoticeCompaction": "上下文压缩",
817
+ "floatNoticeCompactionSummary": "压缩摘要",
818
+ "floatNoticePrune": "上下文裁剪",
819
+ "floatNoticeTodo": "待办更新",
820
+ "floatNoticeModel": "模型切换",
821
+ "floatNoticePermission": "权限模式",
822
+ "floatNoticeSandbox": "沙箱模式",
823
+ "floatNoticeTools": "工具增删",
824
+ "floatNoticeSystem": "系统提示词",
825
+ "floatNoticeRequest": "请求上下文",
826
+ "floatNoticeTitle": "会话标题",
827
+ "floatNoticeTitleRequest": "标题请求",
737
828
  "floatAttach": "添加内容",
738
829
  "floatAttachReference": "引用当前文件",
739
830
  "floatNeedsFile": "先打开一个文件",
@@ -782,7 +873,10 @@ window.__ModuleLoader__.load({
782
873
  "floatCloseViewer": "关闭",
783
874
  "settingsFloatDetach": "脱离代码工作区",
784
875
  "settingsFloatDetachHint": "开启后悬浮框不再跟着代码工作区出现与消失:切到其他插件视图或回到对话时它依然在",
876
+ "settingsFloatEvents": "显示详细过程",
877
+ "settingsFloatEventsHint": "把思考、上下文注入、工具参数与系统事件全部列出来;关闭时只显示最新一条状态",
785
878
  "floatWrap": "自动换行",
879
+ "floatLiveAnalyze": "正在分析请求",
786
880
  }
787
881
 
788
882
  // ---- 00-css.js -----------------------------------------------------------
@@ -2007,9 +2101,171 @@ html.iw-select-code .iw-code .iw-vision {
2007
2101
  white-space: nowrap;
2008
2102
  }
2009
2103
  .iw-float-step.live .iw-float-step-text { color: var(--dsw-alias-label-primary, #1a1a1a); }
2104
+ /* The live Tool line is pinned under the scroll box, not part of the
2105
+ transcript: it truncates instead of widening the card. */
2106
+ .iw-float-live .iw-float-step-text { min-width: 0; }
2107
+
2108
+ /* Folded rows: reasoning, context injections, finished Tool batches and every
2109
+ other log event — one line each, opened on demand. Without this the card
2110
+ showed the tool's name and nothing else. */
2111
+ .iw-float-fold { display: flex; flex-direction: column; }
2112
+ .iw-float-fold-head {
2113
+ display: flex;
2114
+ align-items: center;
2115
+ gap: 6px;
2116
+ width: 100%;
2117
+ padding: 2px 0;
2118
+ border: none;
2119
+ background: transparent;
2120
+ color: var(--dsw-alias-label-secondary, #61666b);
2121
+ font: inherit;
2122
+ font-size: 14px;
2123
+ line-height: 22px;
2124
+ text-align: left;
2125
+ cursor: pointer;
2126
+ }
2127
+ .iw-float-fold-head:hover { color: var(--dsw-alias-label-primary, #1a1a1a); }
2128
+ .iw-float-fold-icon,
2129
+ .iw-float-fold-chevron {
2130
+ flex: 0 0 auto;
2131
+ display: inline-flex;
2132
+ align-items: center;
2133
+ color: var(--dsw-alias-label-tertiary, #81858c);
2134
+ }
2135
+ .iw-float-fold-label { flex: 0 0 auto; }
2136
+ .iw-float-fold-reasoning .iw-float-fold-label { color: var(--dsw-alias-label-tertiary, #81858c); }
2137
+ .iw-float-fold-preview {
2138
+ flex: 1 1 auto;
2139
+ min-width: 0;
2140
+ overflow: hidden;
2141
+ text-overflow: ellipsis;
2142
+ white-space: nowrap;
2143
+ color: var(--dsw-alias-label-tertiary, #81858c);
2144
+ }
2145
+ .iw-float-fold-chevron { transition: transform 120ms ease; }
2146
+ .iw-float-fold.open .iw-float-fold-chevron { transform: rotate(180deg); }
2147
+ .iw-float-fold-body { margin: 2px 0 6px 21px; }
2148
+ .iw-float-fold-pre {
2149
+ margin: 0;
2150
+ padding: 8px 10px;
2151
+ border-radius: 8px;
2152
+ background: var(--dsw-alias-bg-layer-2, rgba(127, 127, 127, 0.08));
2153
+ color: var(--dsw-alias-label-secondary, #61666b);
2154
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
2155
+ font-size: 11.5px;
2156
+ line-height: 19px;
2157
+ white-space: pre-wrap;
2158
+ word-break: break-word;
2159
+ max-height: 240px;
2160
+ overflow: auto;
2161
+ }
2010
2162
  .iw-float-thinking { display: flex; gap: 6px; padding: 2px 0; }
2011
2163
  .iw-float-thinking-text { font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-secondary, #61666b); }
2012
2164
 
2165
+ /* The queue strip: messages waiting for the next turn, above the composer the
2166
+ way the conversation docks its own. */
2167
+ .iw-float-queue {
2168
+ flex: 0 0 auto;
2169
+ margin: 0 12px 8px;
2170
+ border: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.1));
2171
+ border-radius: 10px;
2172
+ background: var(--dsw-alias-bg-layer-1, #fff);
2173
+ overflow: hidden;
2174
+ }
2175
+ .iw-float-queue-head {
2176
+ display: flex;
2177
+ align-items: center;
2178
+ gap: 6px;
2179
+ width: 100%;
2180
+ padding: 7px 10px;
2181
+ border: none;
2182
+ background: transparent;
2183
+ color: var(--dsw-alias-label-secondary, #61666b);
2184
+ font: inherit;
2185
+ font-size: 13px;
2186
+ text-align: left;
2187
+ cursor: pointer;
2188
+ }
2189
+ .iw-float-queue-head:hover { background: var(--dsw-alias-card-fill-hover, rgba(127, 127, 127, 0.08)); }
2190
+ .iw-float-queue-icon,
2191
+ .iw-float-queue-chevron { display: inline-flex; align-items: center; flex: 0 0 auto; color: var(--dsw-alias-label-tertiary, #81858c); }
2192
+ .iw-float-queue-chevron { margin-left: 2px; transition: transform 120ms ease; }
2193
+ .iw-float-queue-chevron.on { transform: rotate(180deg); }
2194
+ .iw-float-queue-count { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2195
+ .iw-float-queue-list { display: flex; flex-direction: column; max-height: 120px; overflow-y: auto; }
2196
+ .iw-float-queue-row {
2197
+ display: flex;
2198
+ align-items: center;
2199
+ gap: 6px;
2200
+ min-height: 32px;
2201
+ padding: 4px 10px;
2202
+ border-top: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.1));
2203
+ }
2204
+ .iw-float-queue-row.sending { opacity: 0.7; }
2205
+ .iw-float-queue-text {
2206
+ flex: 1 1 auto;
2207
+ min-width: 0;
2208
+ overflow: hidden;
2209
+ text-overflow: ellipsis;
2210
+ white-space: nowrap;
2211
+ font-size: 13px;
2212
+ line-height: 20px;
2213
+ color: var(--dsw-alias-label-primary, #1a1a1a);
2214
+ }
2215
+ .iw-float-queue-sending { flex: 0 0 auto; font-size: 12px; color: var(--dsw-alias-label-tertiary, #81858c); }
2216
+ /* A queued message can be a picture or a file, not just text: show it. */
2217
+ .iw-float-queue-media { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
2218
+ .iw-float-queue-thumb {
2219
+ display: block;
2220
+ width: 26px;
2221
+ height: 26px;
2222
+ border-radius: 6px;
2223
+ object-fit: cover;
2224
+ cursor: zoom-in;
2225
+ }
2226
+ .iw-float-queue-thumb-wait { background: var(--dsw-alias-bg-layer-3, rgba(127, 127, 127, 0.16)); }
2227
+ .iw-float-queue-file {
2228
+ display: inline-flex;
2229
+ align-items: center;
2230
+ gap: 4px;
2231
+ max-width: 150px;
2232
+ color: var(--dsw-alias-label-secondary, #61666b);
2233
+ font-size: 12px;
2234
+ }
2235
+ .iw-float-queue-file-icon { display: inline-flex; align-items: center; flex: 0 0 auto; }
2236
+ .iw-float-queue-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2237
+ .iw-float-queue-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
2238
+ .iw-float-queue-action {
2239
+ display: inline-flex;
2240
+ align-items: center;
2241
+ justify-content: center;
2242
+ width: 22px;
2243
+ height: 22px;
2244
+ padding: 0;
2245
+ border: none;
2246
+ border-radius: 6px;
2247
+ background: transparent;
2248
+ color: var(--dsw-alias-label-tertiary, #81858c);
2249
+ cursor: pointer;
2250
+ }
2251
+ .iw-float-queue-action:hover:not(:disabled) {
2252
+ background: var(--dsw-alias-card-fill-hover, rgba(127, 127, 127, 0.08));
2253
+ color: var(--dsw-alias-label-primary, #1a1a1a);
2254
+ }
2255
+ .iw-float-queue-action:disabled { opacity: 0.4; cursor: default; }
2256
+ .iw-float-queue-input {
2257
+ flex: 1 1 auto;
2258
+ min-width: 0;
2259
+ padding: 3px 8px;
2260
+ border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.16));
2261
+ border-radius: 6px;
2262
+ background: var(--dsw-alias-bg-layer-2, rgba(127, 127, 127, 0.06));
2263
+ color: var(--dsw-alias-label-primary, #1a1a1a);
2264
+ font: inherit;
2265
+ font-size: 13px;
2266
+ }
2267
+ .iw-float-queue-input:focus { outline: none; border-color: var(--dsw-alias-label-accent, #4d6bfe); }
2268
+
2013
2269
  /* While the Session works, the card says what it is doing and for how long. */
2014
2270
  .iw-float-running {
2015
2271
  display: flex;
@@ -2468,6 +2724,17 @@ html.iw-select-code .iw-code .iw-vision {
2468
2724
  word-break: break-word;
2469
2725
  }
2470
2726
  .iw-float-bubble .iw-float-md { line-height: 22px; }
2727
+ /* The message you typed keeps its own line breaks (markdown collapsed single
2728
+ newlines); the answer itself is never clipped — only the activity line above
2729
+ the composer is a summarised one-liner. */
2730
+ .iw-float-pre {
2731
+ display: -webkit-box;
2732
+ -webkit-box-orient: vertical;
2733
+ -webkit-line-clamp: 4;
2734
+ overflow: hidden;
2735
+ white-space: pre-wrap;
2736
+ overflow-wrap: anywhere;
2737
+ }
2471
2738
  /* An open question is a card, matching the conversation's own: an 11px eyebrow,
2472
2739
  a 16px question, numbered options, and the way back to the conversation. */
2473
2740
  .iw-float-ask {
@@ -3667,6 +3934,59 @@ function IdeStopMarkIcon({ size = 12 }) {
3667
3934
  return ideSvg(size, [h('rect', { key: 'a', x: 4, y: 4, width: 8, height: 8, rx: 1.6, fill: 'currentColor', stroke: 'none' })])
3668
3935
  }
3669
3936
 
3937
+ /** Thinking: a speech bubble with a murmur of dots. */
3938
+ function IdeThinkIcon({ size = 14 }) {
3939
+ return ideSvg(size, [
3940
+ h('path', { key: 'a', d: 'M3 3.8h10v6.2H7.6L4.8 12.6V10H3z' }),
3941
+ h('path', { key: 'b', d: 'M6.1 6.9h.01M8 6.9h.01M9.9 6.9h.01' }),
3942
+ ])
3943
+ }
3944
+
3945
+ /** Context injection: a square bracket pair, the "this was supplied" mark. */
3946
+ function IdeContextIcon({ size = 14 }) {
3947
+ return ideSvg(size, [
3948
+ h('path', { key: 'a', d: 'M6 3.6H4.2v8.8H6' }),
3949
+ h('path', { key: 'b', d: 'M10 3.6h1.8v8.8H10' }),
3950
+ ])
3951
+ }
3952
+
3953
+ /** Any other log event: a small flag. */
3954
+ function IdeNoticeIcon({ size = 14 }) {
3955
+ return ideSvg(size, [
3956
+ h('path', { key: 'a', d: 'M4.6 2.8v10.4' }),
3957
+ h('path', { key: 'b', d: 'M4.6 3.8h7.2L10 6.4l1.8 2.6H4.6z' }),
3958
+ ])
3959
+ }
3960
+
3961
+ /** Queue: messages stacked up for the next turn. */
3962
+ function IdeQueueIcon({ size = 14 }) {
3963
+ return ideSvg(size, [
3964
+ h('path', { key: 'a', d: 'M3 4.4h10M3 8h10M3 11.6h6' }),
3965
+ ])
3966
+ }
3967
+
3968
+ /** Pencil: edit a queued message in place. */
3969
+ function IdePencilIcon({ size = 14 }) {
3970
+ return ideSvg(size, [
3971
+ h('path', { key: 'a', d: 'M10.9 2.9 13.1 5.1 6.1 12.1 3.2 12.9l.8-2.9z' }),
3972
+ h('path', { key: 'b', d: 'M9.6 4.2 11.8 6.4' }),
3973
+ ])
3974
+ }
3975
+
3976
+ /** Trash: remove a queued message. */
3977
+ function IdeTrashIcon({ size = 14 }) {
3978
+ return ideSvg(size, [
3979
+ h('path', { key: 'a', d: 'M3.2 4.6h9.6' }),
3980
+ h('path', { key: 'b', d: 'M6.2 4.6V3.2h3.6v1.4' }),
3981
+ h('path', { key: 'c', d: 'M4.8 4.6 5.4 12.8h5.2l.6-8.2' }),
3982
+ ])
3983
+ }
3984
+
3985
+ /** Check: keep the edited queued message. */
3986
+ function IdeCheckIcon({ size = 14 }) {
3987
+ return ideSvg(size, [h('path', { key: 'a', d: 'M3.4 8.5 6.6 11.7 12.6 4.9' })])
3988
+ }
3989
+
3670
3990
  /** Wrap: fold a long line back into the block's width. */
3671
3991
  function IdeWrapIcon({ size = 15 }) {
3672
3992
  return ideSvg(size, [
@@ -4710,6 +5030,8 @@ function ideCreateStore(refs) {
4710
5030
  // The card's lifetime controls: `floatEnabled` is a preference, `floatClosed`
4711
5031
  // lasts until DSH restarts (the user asked for "stay closed until restart").
4712
5032
  floatEnabled: prefs.floatEnabled !== false,
5033
+ // System events are noise for most reads; the switch in Settings turns them on.
5034
+ floatEvents: prefs.floatEvents === true,
4713
5035
  // Detached cards stay on screen in every panel, not only the workspace.
4714
5036
  floatDetached: prefs.floatDetached === true,
4715
5037
  floatClosed: false,
@@ -5217,6 +5539,13 @@ function ideCreateStore(refs) {
5217
5539
  }
5218
5540
 
5219
5541
  /** Turn the floating card on or off (persisted). */
5542
+ function setFloatEvents(floatEvents) {
5543
+ const next = floatEvents === true
5544
+ if (state.floatEvents === next) return
5545
+ ideWritePrefs({ floatEvents: next })
5546
+ patch({ floatEvents: next })
5547
+ }
5548
+
5220
5549
  function setFloatEnabled(floatEnabled) {
5221
5550
  const next = floatEnabled === true
5222
5551
  if (state.floatEnabled === next) return
@@ -5913,6 +6242,7 @@ function ideCreateStore(refs) {
5913
6242
  setFloatSize,
5914
6243
  setFloatDefaultSize,
5915
6244
  setFloatEnabled,
6245
+ setFloatEvents,
5916
6246
  setFloatDetached,
5917
6247
  setFloatClosed,
5918
6248
  setFloatInsert,
@@ -9501,6 +9831,19 @@ function IdeWorkspaceSettingsSection(props) {
9501
9831
  onClick: () => store.setFloatDetached(state.floatDetached !== true),
9502
9832
  }, state.floatDetached === true ? tr('settingsOn') : tr('settingsOff')),
9503
9833
  ]),
9834
+ // Everything the Session logs besides messages: jobs, compaction, retries,
9835
+ // approvals, model and permission switches. Off by default — it is a log,
9836
+ // and a long turn produces hundreds of rows.
9837
+ h('div', { key: 'floatevents', className: 'iw-settings-item' }, [
9838
+ h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatEvents')),
9839
+ h('button', {
9840
+ key: 'b',
9841
+ type: 'button',
9842
+ className: `iw-gesture-chip${state.floatEvents === true ? ' on' : ''}`,
9843
+ title: tr('settingsFloatEventsHint'),
9844
+ onClick: () => store.setFloatEvents(state.floatEvents !== true),
9845
+ }, state.floatEvents === true ? tr('settingsOn') : tr('settingsOff')),
9846
+ ]),
9504
9847
  h('div', { key: 'floatsize', className: 'iw-settings-item' }, [
9505
9848
  h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatSize')),
9506
9849
  h('button', {
@@ -13584,7 +13927,12 @@ async function ideDataWindowOpenMapper(store, tr, root, path, symbol, line) {
13584
13927
  */
13585
13928
 
13586
13929
  /** How many messages the card keeps on screen. */
13587
- const IDE_FLOAT_MESSAGES = 6
13930
+ // How many event rows the card keeps. This used to be 6, which silently cut
13931
+ // everything but the last few rows off a long turn; the card scrolls, so the
13932
+ // whole tail of the log is worth keeping.
13933
+ const IDE_FLOAT_MESSAGES = 200
13934
+ /** Longest text a folded row shows once opened; longer payloads are clipped. */
13935
+ const IDE_FLOAT_DETAIL_MAX = 6000
13588
13936
  /** How long after `compositionend` an Enter still counts as "confirm the IME". */
13589
13937
  const IDE_FLOAT_IME_SETTLE_MS = 80
13590
13938
  /** Collapsed card: a 44px ball plus the 4px padding the shell adds. */
@@ -13682,18 +14030,100 @@ function ideFloatClock(time) {
13682
14030
  * One transcript row: a right-aligned bubble for the user with a clock and a
13683
14031
  * copy button underneath, plain full-width markdown for the assistant.
13684
14032
  */
14033
+ /**
14034
+ * One folded row: a single line that opens into the payload behind it.
14035
+ *
14036
+ * Reasoning, context injections and Tool output are long — a single reasoning
14037
+ * block can be thousands of words — so every row keeps its own open state and
14038
+ * paints the body only when asked. Row keys are stable, so that state survives
14039
+ * the re-renders a running turn causes.
14040
+ */
14041
+ function IdeFloatFold({ tone, icon, label, preview, detail }) {
14042
+ const [open, setOpen] = useState(false)
14043
+ return h('div', { className: `iw-float-fold iw-float-fold-${tone}${open ? ' open' : ''}` }, [
14044
+ h('button', {
14045
+ key: 'head',
14046
+ type: 'button',
14047
+ className: 'iw-float-fold-head',
14048
+ 'aria-expanded': open,
14049
+ title: label,
14050
+ onClick: () => setOpen(!open),
14051
+ }, [
14052
+ h('span', { key: 'i', className: 'iw-float-fold-icon' }, icon),
14053
+ h('span', { key: 'l', className: 'iw-float-fold-label' }, label),
14054
+ preview === '' ? null : h('span', { key: 'p', className: 'iw-float-fold-preview' }, preview),
14055
+ h('span', { key: 'c', className: 'iw-float-fold-chevron' }, h(IdeChevronDownIcon, { size: 12 })),
14056
+ ]),
14057
+ open === true ? h('div', { key: 'body', className: 'iw-float-fold-body' }, h('pre', { key: 'pre', className: 'iw-float-fold-pre' }, detail)) : null,
14058
+ ])
14059
+ }
14060
+
14061
+ /** How a finished Tool batch reads once opened: the call, its arguments, its output. */
14062
+ function ideFloatCallsDetail(calls) {
14063
+ return (Array.isArray(calls) ? calls : []).map((call) => {
14064
+ const head = call.isError === true ? `${call.name} ✕ ${call.reason}`.trim() : String(call.name ?? '')
14065
+ return [
14066
+ `▸ ${head}`,
14067
+ String(call.argumentsText ?? ''),
14068
+ call.resultText === '' || call.resultText === undefined ? '' : `↳ ${call.resultText}`,
14069
+ ].filter((part) => part !== '').join('\n')
14070
+ }).join('\n\n')
14071
+ }
14072
+
13685
14073
  function ideFloatRow(row, tr, io) {
13686
14074
  const { setViewing, store, pictures } = io
13687
- // A Tool batch: 「执行了命令」, or 「正在运行命令 · <描述>」 while it is the open one.
14075
+ // Compact (the default) is about WHICH rows show, not about cutting the text:
14076
+ // the answer keeps its full markdown. Your own message is the exception — it
14077
+ // renders as plain pre-wrapped text, because the markdown renderer collapses
14078
+ // single newlines and a two-line message arrived as one.
14079
+ const compact = io.detail !== true
14080
+ // A finished Tool batch: 「执行了命令」 (or the finished wording) that opens
14081
+ // into every call of the batch with its arguments and output.
13688
14082
  if (row.role === 'step') {
13689
- const live = row.open === true && io.running === true
13690
- const last = row.names === undefined || row.names.length === 0 ? '' : row.names[row.names.length - 1]
13691
- const running = last === '' ? '' : `${tr(ideFloatProgressKey(last))}${row.detail === '' ? '' : ` · ${row.detail}`}`
13692
- const text = live && running !== '' ? running : ideFloatStepTitle(row.kinds ?? [], tr)
13693
- return h('div', { key: row.key, className: `iw-float-step${live ? ' live' : ''}` }, [
13694
- h('span', { key: 'i', className: 'iw-float-step-icon' }, h(IdeTerminalIcon, { size: 15 })),
13695
- h('span', { key: 't', className: 'iw-float-step-text', title: text }, text),
13696
- ])
14083
+ return h(IdeFloatFold, {
14084
+ key: row.key,
14085
+ tone: 'step',
14086
+ icon: h(IdeTerminalIcon, { size: 15 }),
14087
+ label: ideFloatStepTitle(row.kinds ?? [], tr),
14088
+ preview: row.detail === undefined || row.detail === '' ? '' : row.detail,
14089
+ detail: ideFloatCallsDetail(row.calls),
14090
+ })
14091
+ }
14092
+ // The model's own reasoning, folded: one line, the full text on demand.
14093
+ if (row.role === 'reasoning') {
14094
+ return h(IdeFloatFold, {
14095
+ key: row.key,
14096
+ tone: 'reasoning',
14097
+ icon: h(IdeThinkIcon, { size: 14 }),
14098
+ label: tr('floatThink'),
14099
+ preview: ideFloatPreview(row.text),
14100
+ detail: ideFloatDetail(row.text),
14101
+ })
14102
+ }
14103
+ // Everything the agent was told that a human did not type: AGENTS.md, time,
14104
+ // runtime context, skill catalog, compaction checkpoints, job status.
14105
+ if (row.role === 'context') {
14106
+ const labelKey = IDE_FLOAT_CONTEXT_LABELS[row.kind]
14107
+ return h(IdeFloatFold, {
14108
+ key: row.key,
14109
+ tone: 'context',
14110
+ icon: h(IdeContextIcon, { size: 14 }),
14111
+ label: `${tr('floatContext')} · ${labelKey === undefined ? row.kind : tr(labelKey)}`,
14112
+ preview: ideFloatPreview(row.text),
14113
+ detail: ideFloatDetail(row.text),
14114
+ })
14115
+ }
14116
+ // Every other event: approvals, background jobs, compaction, retries, todo
14117
+ // lists, model and permission changes, tool registry edits, unknown types.
14118
+ if (row.role === 'notice') {
14119
+ return h(IdeFloatFold, {
14120
+ key: row.key,
14121
+ tone: 'notice',
14122
+ icon: h(IdeNoticeIcon, { size: 14 }),
14123
+ label: row.labelKey === undefined || row.labelKey === '' ? row.kind : tr(row.labelKey),
14124
+ preview: ideFloatPreview(row.text),
14125
+ detail: row.text === '' ? row.kind : ideFloatDetail(`[${row.kind}]\n${row.text}`),
14126
+ })
13697
14127
  }
13698
14128
  // Questions cannot be answered here: DSH only accepts the answer in the
13699
14129
  // Conversation, so the card's button navigates there instead.
@@ -13785,8 +14215,11 @@ function ideFloatRow(row, tr, io) {
13785
14215
  }
13786
14216
  if (row.role === 'user') {
13787
14217
  const clock = ideFloatClock(row.time)
14218
+ const said = compact && row.text !== ''
14219
+ ? h('div', { key: 'text', className: 'iw-float-pre', title: row.text }, row.text)
14220
+ : body
13788
14221
  return h('div', { key: row.key, className: 'iw-float-row iw-float-user' }, [
13789
- h('div', { key: 'bubble', className: 'iw-float-bubble' }, [body, pics].filter((part) => part !== null)),
14222
+ h('div', { key: 'bubble', className: 'iw-float-bubble' }, [said, pics].filter((part) => part !== null)),
13790
14223
  h('div', { key: 'meta', className: 'iw-float-meta' }, [
13791
14224
  clock === '' ? null : h('span', { key: 'clock', className: 'iw-float-clock' }, clock),
13792
14225
  row.text === '' ? null : h('button', {
@@ -13799,6 +14232,9 @@ function ideFloatRow(row, tr, io) {
13799
14232
  ].filter((part) => part !== null)),
13800
14233
  ])
13801
14234
  }
14235
+ // The answer is the point: it renders whole, exactly as the conversation
14236
+ // shows it. Only the activity line above the composer is a summary — that is
14237
+ // the one that gets an ellipsis.
13802
14238
  return h('div', { key: row.key, className: 'iw-float-row iw-float-assistant' }, [body, pics].filter((part) => part !== null))
13803
14239
  }
13804
14240
 
@@ -13853,25 +14289,196 @@ function ideFloatAnswers(entries) {
13853
14289
  return answers
13854
14290
  }
13855
14291
 
14292
+ /** Where a `user/message` that no human typed came from, as a label key. */
14293
+ const IDE_FLOAT_CONTEXT_LABELS = {
14294
+ 'agent-instructions': 'floatCtxAgentInstructions',
14295
+ 'time-context': 'floatCtxTime',
14296
+ 'runtime-context': 'floatCtxRuntime',
14297
+ 'skill-catalog': 'floatCtxSkills',
14298
+ 'compact-checkpoint': 'floatCtxCompact',
14299
+ 'tool-jobs': 'floatCtxJobs',
14300
+ 'user-approval': 'floatCtxApproval',
14301
+ }
14302
+
14303
+ /**
14304
+ * Events that carry no user-visible content: turn/step bookkeeping, the
14305
+ * log-only request header, the seed marker, a retry that already prints its
14306
+ * cause, and an inbox splice the queue strip already shows. Painting them would
14307
+ * add ~14 000 empty rows to a long session.
14308
+ */
14309
+ const IDE_FLOAT_SILENT_EVENTS = new Set([
14310
+ 'turn/start', 'step/start', 'step/end', 'request/header',
14311
+ 'session/end-seed', 'llm/retry-started', 'agent/inbox/spliced',
14312
+ // The session-log upload ack: one per flush, no human-readable content.
14313
+ 'session-log-deepseek/delivery-accepted',
14314
+ ])
14315
+
14316
+ /** One line of an event for the collapsed row: whitespace folded, tail clipped. */
14317
+ function ideFloatPreview(text, max = 160) {
14318
+ const flat = String(text ?? '').replace(/\s+/gu, ' ').trim()
14319
+ return flat.length > max ? `${flat.slice(0, max)}…` : flat
14320
+ }
14321
+
14322
+ /** The body of an opened row: line breaks kept, runaway payloads clipped. */
14323
+ function ideFloatDetail(text, max = IDE_FLOAT_DETAIL_MAX) {
14324
+ const body = String(text ?? '').trim()
14325
+ if (body.length <= max) return body
14326
+ return `${body.slice(0, max)}\n…(共 ${body.length} 字,已截断)`
14327
+ }
14328
+
14329
+ /** `tool/call.arguments` is the model's raw JSON string; pretty-print when it parses. */
14330
+ function ideFloatArgumentsText(raw) {
14331
+ try {
14332
+ return JSON.stringify(JSON.parse(String(raw ?? '')), null, 2)
14333
+ } catch (error) {
14334
+ return String(raw ?? '')
14335
+ }
14336
+ }
14337
+
14338
+ /** `callId` → the settled Tool result, so a batch can carry what it produced. */
14339
+ function ideFloatToolResults(entries) {
14340
+ const results = new Map()
14341
+ if (!Array.isArray(entries)) return results
14342
+ for (const entry of entries) {
14343
+ const event = entry?.event
14344
+ if (event?.type !== 'tool/result') continue
14345
+ const callId = String(event.data?.message?.toolCallId ?? '')
14346
+ if (callId === '') continue
14347
+ results.set(callId, {
14348
+ text: ideFloatTextOf(event.data?.message?.content),
14349
+ isError: event.data?.message?.isError === true,
14350
+ reason: String(event.data?.error?.reason ?? event.data?.error?.code ?? ''),
14351
+ })
14352
+ }
14353
+ return results
14354
+ }
14355
+
14356
+ /** The last failure inside an `assistant/attempt` stream, as readable text. */
14357
+ function ideFloatAttemptFailure(stream) {
14358
+ const records = Array.isArray(stream) ? stream : []
14359
+ for (let index = records.length - 1; index >= 0; index -= 1) {
14360
+ const chunk = records[index]?.chunk
14361
+ if (chunk?.type !== 'finish') continue
14362
+ const failure = chunk.reason?.failure
14363
+ if (failure === undefined || failure === null) return String(chunk.reason?.kind ?? '')
14364
+ return `${failure.code ?? ''} ${failure.message ?? ''}`.trim()
14365
+ }
14366
+ return ''
14367
+ }
14368
+
14369
+ /** A todo list as plain lines, marked by state. */
14370
+ function ideFloatTodoText(todos) {
14371
+ return (Array.isArray(todos) ? todos : [])
14372
+ .map((todo) => {
14373
+ const mark = todo?.status === 'completed' ? '✓' : todo?.status === 'in_progress' ? '▸' : '·'
14374
+ return `${mark} ${String(todo?.content ?? '')}`
14375
+ })
14376
+ .join('\n')
14377
+ }
14378
+
14379
+ /**
14380
+ * Everything else that lands in the log, as `{ labelKey, text }`; null means the
14381
+ * event says nothing a person can read (a completed turn end).
14382
+ */
14383
+ function ideFloatNotice(event) {
14384
+ const data = event?.data ?? {}
14385
+ switch (event?.type) {
14386
+ case 'turn/end':
14387
+ if (data.reason?.kind === 'completed') return null
14388
+ return { labelKey: 'floatNoticeTurnAborted', text: ideFloatDetail(JSON.stringify(data.reason ?? {}, null, 2)) }
14389
+ case 'assistant/attempt':
14390
+ return { labelKey: 'floatNoticeAttempt', text: ideFloatDetail(ideFloatAttemptFailure(data.stream)) }
14391
+ case 'llm/retry':
14392
+ return {
14393
+ labelKey: 'floatNoticeRetry',
14394
+ text: ideFloatDetail(`第 ${data.retry ?? '?'} / ${data.maxRetries ?? '?'} 次\n${data.failure?.code ?? ''} ${data.failure?.message ?? ''}`.trim()),
14395
+ }
14396
+ case 'approval/asked':
14397
+ return { labelKey: 'floatNoticeApproval', text: ideFloatDetail(`${data.toolName ?? ''}\n${data.reason ?? ''}`.trim()) }
14398
+ case 'approval/decided':
14399
+ return { labelKey: 'floatNoticeApprovalResult', text: String(data.outcome ?? '') }
14400
+ case 'approval/policy':
14401
+ return { labelKey: 'floatNoticeApprovalPolicy', text: String(data.policy ?? '') }
14402
+ case 'workspace/changes':
14403
+ return { labelKey: 'floatNoticeWorkspace', text: Number.isFinite(data.turn) ? `回合 ${data.turn}` : '' }
14404
+ case 'job/registered':
14405
+ return { labelKey: 'floatNoticeJob', text: ideFloatDetail(`${data.kind ?? ''} · ${data.label ?? ''}`) }
14406
+ case 'job/settled':
14407
+ return { labelKey: 'floatNoticeJobDone', text: ideFloatDetail(`${data.kind ?? ''} · ${data.label ?? ''}`) }
14408
+ case 'compaction/start':
14409
+ return { labelKey: 'floatNoticeCompaction', text: '开始' }
14410
+ case 'compaction/end':
14411
+ return { labelKey: 'floatNoticeCompaction', text: '结束' }
14412
+ case 'compaction/summary':
14413
+ return { labelKey: 'floatNoticeCompactionSummary', text: ideFloatDetail(ideFloatTextOf(data.summary)) }
14414
+ case 'compaction/prune':
14415
+ return { labelKey: 'floatNoticePrune', text: `${Number(data.shadowedTokenCount ?? 0)} tokens` }
14416
+ case 'todo/write':
14417
+ return { labelKey: 'floatNoticeTodo', text: ideFloatDetail(ideFloatTodoText(data.todos)) }
14418
+ case 'model/selection':
14419
+ return { labelKey: 'floatNoticeModel', text: `${data.provider ?? ''} / ${data.model ?? ''}` }
14420
+ case 'permission/preset':
14421
+ return { labelKey: 'floatNoticePermission', text: String(data.preset ?? '') }
14422
+ case 'sandbox/mode':
14423
+ return { labelKey: 'floatNoticeSandbox', text: String(data.mode ?? '') }
14424
+ case 'request/context':
14425
+ return {
14426
+ labelKey: 'floatNoticeRequest',
14427
+ text: `${data.provider ?? ''} / ${data.model ?? ''}\ncontextWindow: ${data.contextWindow ?? ''}\nsystemPromptUpdate: ${data.systemPromptUpdate ?? ''}`,
14428
+ }
14429
+ case 'session/title':
14430
+ return { labelKey: 'floatNoticeTitle', text: `${data.title ?? ''}\n(${data.source?.kind ?? ''})` }
14431
+ case 'session/title-llm-request':
14432
+ return {
14433
+ labelKey: 'floatNoticeTitleRequest',
14434
+ text: `${data.titleProvider ?? ''}\n${data.route?.provider ?? ''} / ${data.route?.model ?? ''}`,
14435
+ }
14436
+ case 'system/message':
14437
+ return { labelKey: 'floatNoticeSystem', text: ideFloatDetail(ideFloatTextOf(data.message?.content)) }
14438
+ case 'developer/message': {
14439
+ const blocks = Array.isArray(data.message?.content) ? data.message.content : []
14440
+ const lines = blocks.map((block) => {
14441
+ const sign = block?.type === 'tool-addition' ? '+' : block?.type === 'tool-removal' ? '-' : '·'
14442
+ return `${sign} ${String(block?.toolName ?? block?.type ?? '')}`
14443
+ })
14444
+ return { labelKey: 'floatNoticeTools', text: ideFloatDetail(lines.join('\n')) }
14445
+ }
14446
+ default:
14447
+ return { labelKey: 'floatEvent', text: ideFloatDetail(JSON.stringify(data, null, 2)) }
14448
+ }
14449
+ }
14450
+
13856
14451
  function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13857
14452
  if (!Array.isArray(entries)) return []
13858
14453
  const answers = ideFloatAnswers(entries)
14454
+ const results = ideFloatToolResults(entries)
13859
14455
  const rows = []
13860
- // Tool calls collapse into one 「执行了命令」 line per batch, in the order they
13861
- // ran — the same shape the conversation uses. The last batch stays `open`
13862
- // until the Session stops, so the card can word it as 「正在运行命令」.
13863
- let batch = { names: [], detail: '', seq: 0, ids: new Set() }
14456
+ // Tool calls collapse into one line per batch, in the order they ran. The last
14457
+ // batch stays `open` until the Session stops, so the card can word it as
14458
+ // 「正在运行命令」 and pin it under the clock.
14459
+ let batch = { calls: [], seq: 0, ids: new Set() }
13864
14460
  const flushBatch = () => {
13865
- if (batch.names.length === 0) return
14461
+ if (batch.calls.length === 0) return
14462
+ const names = batch.calls.map((call) => call.name)
13866
14463
  const kinds = []
13867
- for (const name of batch.names) {
14464
+ for (const name of names) {
13868
14465
  const kind = ideFloatStepKind(name)
13869
14466
  if (!kinds.includes(kind)) kinds.push(kind)
13870
14467
  }
13871
- rows.push({ key: `s${batch.seq}`, role: 'step', text: '', images: [], kinds, names: batch.names, detail: batch.detail, open: true })
13872
- batch = { names: [], detail: '', seq: 0, ids: new Set() }
14468
+ const detail = batch.calls[batch.calls.length - 1]?.summary ?? ''
14469
+ // A call with no `tool/result` yet means this batch is still executing; the
14470
+ // live line keys off that instead of off "the newest event is tool/call",
14471
+ // because a run emits job/registered, workspace notices and more meanwhile.
14472
+ const pending = batch.calls.some((call) => call.callId === '' || results.get(call.callId) === undefined)
14473
+ rows.push({ key: `s${batch.seq}`, role: 'step', kinds, names, calls: batch.calls, detail, open: true, pending, seq: batch.seq })
14474
+ batch = { calls: [], seq: 0, ids: new Set() }
13873
14475
  }
13874
14476
  for (const entry of entries) {
14477
+ // A transient entry is one streamed delta of the message being written, not
14478
+ // an event: painting them produced dozens of identical 「事件 {attemptId…}」
14479
+ // rows during a single answer. The settled `assistant/message` carries the
14480
+ // whole text, and the live tail is painted in the card's footer instead.
14481
+ if (entry?.type === 'transient') continue
13875
14482
  const event = entry?.event
13876
14483
  if (event === null || typeof event !== 'object') continue
13877
14484
  if (event.type === 'tool/call') {
@@ -13883,9 +14490,16 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13883
14490
  if (callId !== '' && batch.ids.has(callId)) continue
13884
14491
  if (callId !== '') batch.ids.add(callId)
13885
14492
  if (batch.seq === 0) batch.seq = event.seq
13886
- batch.names.push(name)
13887
- const detail = ideFloatCallDetail(name, event.data?.arguments)
13888
- if (detail !== '') batch.detail = detail
14493
+ const settled = results.get(callId)
14494
+ batch.calls.push({
14495
+ callId,
14496
+ name,
14497
+ argumentsText: ideFloatArgumentsText(event.data?.arguments),
14498
+ summary: ideFloatCallDetail(name, event.data?.arguments),
14499
+ resultText: settled?.text ?? '',
14500
+ isError: settled?.isError ?? false,
14501
+ reason: settled?.reason ?? '',
14502
+ })
13889
14503
  continue
13890
14504
  }
13891
14505
  }
@@ -13895,18 +14509,26 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13895
14509
  const renders = event.type === 'user/message'
13896
14510
  ? true
13897
14511
  : event.type === 'assistant/message'
13898
- ? event.data?.message?.content?.some?.((part) => part?.type === 'text' ? String(part.text ?? '') !== '' : part?.type === 'image') === true
14512
+ ? event.data?.message?.content?.some?.((part) => part?.type === 'text' ? String(part.text ?? '') !== ''
14513
+ : part?.type === 'image' || part?.type === 'reasoning') === true
13899
14514
  : event.type === 'deliverables/presented' || (event.type === 'tool/call' && event.data?.name === 'ask_user_question')
13900
14515
  if (renders) flushBatch()
13901
14516
  if (event.type === 'user/message') {
13902
- // Context injections share the event type; only a human prompt is a row.
13903
- if (event.data?.source?.kind !== 'user') continue
14517
+ const source = String(event.data?.source?.kind ?? 'user')
13904
14518
  const content = event.data?.content
13905
14519
  const text = ideFloatTextOf(content)
14520
+ if (source !== 'user') {
14521
+ // A synthetic context injection: the card shows it instead of dropping
14522
+ // it, because "the agent was told something" is part of the record.
14523
+ if (text !== '') {
14524
+ rows.push({ key: `c${event.seq}`, role: 'context', kind: source, text, time: Number(event.time ?? 0), seq: event.seq })
14525
+ }
14526
+ continue
14527
+ }
13906
14528
  // A prompt can be images only, so a row exists when either part exists.
13907
14529
  const images = ideFloatImagesOf(content)
13908
14530
  if (text !== '' || images.length > 0) {
13909
- rows.push({ key: `u${event.seq}`, role: 'user', text, images, time: Number(event.time ?? 0) })
14531
+ rows.push({ key: `u${event.seq}`, role: 'user', text, images, time: Number(event.time ?? 0), seq: event.seq })
13910
14532
  }
13911
14533
  continue
13912
14534
  }
@@ -13914,8 +14536,16 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13914
14536
  const content = event.data?.message?.content
13915
14537
  const text = ideFloatTextOf(content)
13916
14538
  const images = ideFloatImagesOf(content)
14539
+ const reasoning = (Array.isArray(content) ? content : [])
14540
+ .filter((part) => part?.type === 'reasoning')
14541
+ .map((part) => String(part.text ?? '').trim())
14542
+ .filter((part) => part !== '')
14543
+ .join('\n\n')
14544
+ if (reasoning !== '') {
14545
+ rows.push({ key: `r${event.seq}`, role: 'reasoning', text: reasoning, time: Number(event.time ?? 0), seq: event.seq })
14546
+ }
13917
14547
  if (text !== '' || images.length > 0) {
13918
- rows.push({ key: `a${event.seq}`, role: 'assistant', text, images, time: Number(event.time ?? 0) })
14548
+ rows.push({ key: `a${event.seq}`, role: 'assistant', text, images, time: Number(event.time ?? 0), seq: event.seq })
13919
14549
  }
13920
14550
  continue
13921
14551
  }
@@ -13931,6 +14561,7 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13931
14561
  text: '',
13932
14562
  images: [],
13933
14563
  time: Number(event.time ?? 0),
14564
+ seq: event.seq,
13934
14565
  header: question.header,
13935
14566
  question: question.question,
13936
14567
  options: question.options,
@@ -13943,7 +14574,23 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13943
14574
  }
13944
14575
  if (event.type === 'deliverables/presented') {
13945
14576
  const files = ideFloatPresentedFilesOf(event.data)
13946
- if (files.length > 0) rows.push({ key: `p${event.seq}`, role: 'files', text: '', images: [], files })
14577
+ if (files.length > 0) rows.push({ key: `p${event.seq}`, role: 'files', text: '', images: [], files, seq: event.seq })
14578
+ continue
14579
+ }
14580
+ // Tool calls that joined no batch (no name) and every result are not rows.
14581
+ if (event.type === 'tool/result' || event.type === 'tool/call') continue
14582
+ if (IDE_FLOAT_SILENT_EVENTS.has(String(event.type))) continue
14583
+ const notice = ideFloatNotice(event)
14584
+ if (notice !== null) {
14585
+ rows.push({
14586
+ key: `n${event.seq}`,
14587
+ role: 'notice',
14588
+ labelKey: notice.labelKey,
14589
+ text: notice.text,
14590
+ kind: String(event.type),
14591
+ time: Number(event.time ?? 0),
14592
+ seq: event.seq,
14593
+ })
13947
14594
  }
13948
14595
  }
13949
14596
  flushBatch()
@@ -13951,6 +14598,223 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
13951
14598
  return rows.slice(-limit)
13952
14599
  }
13953
14600
 
14601
+ /**
14602
+ * What the transcript paints while a turn runs: everything except the batch that
14603
+ * is executing right now.
14604
+ *
14605
+ * That batch is the live status line pinned under the clock (`ideFloatLiveStep`),
14606
+ * so painting it in the transcript too would show it twice — once where it
14607
+ * scrolls away, once where it stays. Finished batches stay in the transcript,
14608
+ * folded, because they are part of the record.
14609
+ */
14610
+ function ideFloatVisibleRows(rows, running, detail) {
14611
+ if (!Array.isArray(rows)) return []
14612
+ if (detail !== true) {
14613
+ // The card is a status board, not a reader. It keeps the newest thing you
14614
+ // said, the newest line the agent produced, and whatever is waiting for
14615
+ // you — one screenful. Everything else is the conversation's job.
14616
+ const keep = []
14617
+ const lastWhere = (predicate) => {
14618
+ for (let index = rows.length - 1; index >= 0; index -= 1) {
14619
+ if (predicate(rows[index]) === true) {
14620
+ keep.push(index)
14621
+ return
14622
+ }
14623
+ }
14624
+ }
14625
+ lastWhere((row) => row?.role === 'user')
14626
+ lastWhere((row) => row?.role === 'assistant')
14627
+ lastWhere((row) => row?.role === 'files')
14628
+ rows.forEach((row, index) => {
14629
+ if (row?.role === 'question' && !(Array.isArray(row.answers) && row.answers.length > 0)) keep.push(index)
14630
+ })
14631
+ return [...new Set(keep)].sort((left, right) => left - right).map((index) => rows[index])
14632
+ }
14633
+ // Detail mode: the whole record. The batch that is still running is pinned
14634
+ // under the clock, so it leaves the transcript to avoid showing it twice.
14635
+ const kept = rows
14636
+ if (running !== true) return kept
14637
+ let liveIndex = -1
14638
+ for (let index = kept.length - 1; index >= 0; index -= 1) {
14639
+ if (kept[index]?.role === 'step' && kept[index].open === true) {
14640
+ liveIndex = index
14641
+ break
14642
+ }
14643
+ }
14644
+ return liveIndex < 0 ? kept : kept.filter((row, index) => index !== liveIndex)
14645
+ }
14646
+
14647
+ /**
14648
+ * The message being written right now: the tail of the newest streamed delta.
14649
+ *
14650
+ * Only ever one line — the card is not a transcript of chunks. `index` is the
14651
+ * entry position, so the caller can tell whether the stream is newer than the
14652
+ * newest Tool batch and paint exactly one live line.
14653
+ */
14654
+ function ideFloatLiveStream(entries) {
14655
+ if (!Array.isArray(entries) || entries.length === 0) return null
14656
+ const chunkOf = (entry) => (entry?.type === 'transient' ? entry.event?.data?.chunk : undefined)
14657
+ const head = chunkOf(entries[entries.length - 1])
14658
+ // The newest entry has to be a delta: a settled message ends the stream, and
14659
+ // painting the deltas before it would show text the transcript already has.
14660
+ if (head?.type !== 'text-delta' && head?.type !== 'reasoning-delta') return null
14661
+ const kind = head.type === 'reasoning-delta' ? 'reasoning' : 'text'
14662
+ const attempt = String(entries[entries.length - 1]?.event?.data?.attemptId ?? '')
14663
+ const parts = []
14664
+ // The newest position is what "newer than the Tool batch" compares to; the
14665
+ // loop only walks back to collect the text of this attempt.
14666
+ const index = entries.length - 1
14667
+ for (let position = entries.length - 1; position >= 0; position -= 1) {
14668
+ const entry = entries[position]
14669
+ if (entry?.type !== 'transient') break
14670
+ const data = entry.event?.data
14671
+ const chunk = data?.chunk
14672
+ if (chunk?.type !== head.type) break
14673
+ if (String(data?.attemptId ?? '') !== attempt) break
14674
+ parts.unshift(String(chunk.text ?? ''))
14675
+ }
14676
+ return { index, kind, text: parts.join('') }
14677
+ }
14678
+
14679
+
14680
+ /**
14681
+ * The one live line: what the card says right now.
14682
+ *
14683
+ * Priority is "newest wins": a streamed delta beats everything (the model is
14684
+ * writing), a Tool call or its result means a batch is executing, and a settled
14685
+ * message means there is nothing live to report — the old batch line used to
14686
+ * linger here through an entire new turn.
14687
+ */
14688
+ function ideFloatLiveActivity(rows, raw) {
14689
+ const stream = ideFloatLiveStream(raw)
14690
+ if (stream !== null) return { kind: stream.kind, text: stream.text }
14691
+ // The newest batch that still waits for a result is what is running now. A
14692
+ // settled batch stays silent: the answer already says what happened.
14693
+ for (let index = rows.length - 1; index >= 0; index -= 1) {
14694
+ const row = rows[index]
14695
+ if (row?.role !== 'step') continue
14696
+ return row.pending === true ? { kind: 'tool', step: row } : null
14697
+ }
14698
+ return null
14699
+ }
14700
+
14701
+ /**
14702
+ * The message that is being written right now, as a transcript row. The
14703
+ * conversation prints streamed text straight into the message instead of
14704
+ * showing a 「正在输出」 step, so the body grows here too — the pinned status line
14705
+ * stays for Tool work and the analysis phase only.
14706
+ */
14707
+ function ideFloatStreamRow(stream) {
14708
+ if (stream === null || stream === undefined) return null
14709
+ if (stream.kind !== 'text') return null
14710
+ const text = String(stream.text ?? '')
14711
+ if (text === '') return null
14712
+ return { key: 'stream', role: 'assistant', text, streaming: true }
14713
+ }
14714
+
14715
+ /**
14716
+ * The one-line tail under a live status, or '' when that status has no text of
14717
+ * its own. `analyze` and `tool` carry no text at all — reading `live.text`
14718
+ * there crashed the whole overlay slot, so every kind stays on this path.
14719
+ */
14720
+ function ideFloatLiveTail(live) {
14721
+ if (live === null || live === undefined) return ''
14722
+ if (live.kind === 'analyze' || live.kind === 'tool') return ''
14723
+ return ideFloatPreview(String(live.text ?? '').slice(-220), 140)
14724
+ }
14725
+
14726
+ /** The newest Tool batch, or null when the log carries none. */
14727
+ function ideFloatLiveStep(rows) {
14728
+ if (!Array.isArray(rows)) return null
14729
+ for (let index = rows.length - 1; index >= 0; index -= 1) {
14730
+ if (rows[index]?.role === 'step') return rows[index]
14731
+ }
14732
+ return null
14733
+ }
14734
+
14735
+ /**
14736
+ * How a live Tool batch reads in the pinned status line: 「正在运行命令 · <描述>」
14737
+ * while the batch is open, the finished wording otherwise.
14738
+ */
14739
+ function ideFloatLiveText(row, tr) {
14740
+ const translate = typeof tr === 'function' ? tr : (key) => key
14741
+ const names = Array.isArray(row?.names) ? row.names : []
14742
+ const last = names.length === 0 ? '' : names[names.length - 1]
14743
+ const detail = String(row?.detail ?? '')
14744
+ // The tool's own name when it has no readable argument (browser_evaluate,
14745
+ // todo_write, …): 「正在使用工具 · browser_evaluate」 says what the conversation
14746
+ // says, and a bare 「正在使用工具」 does not.
14747
+ const suffix = detail !== '' ? detail : last
14748
+ const progress = last === '' ? '' : `${translate(ideFloatProgressKey(last))}${suffix === '' ? '' : ` · ${suffix}`}`
14749
+ return progress !== '' ? progress : ideFloatStepTitle(Array.isArray(row?.kinds) ? row.kinds : [], translate)
14750
+ }
14751
+
14752
+ /**
14753
+ * The messages waiting for the next turn.
14754
+ *
14755
+ * `inbox` is the Host projection the conversation's own queue strip reads
14756
+ * (`next-turn`), so the card and that strip can never disagree. `pending` adds a
14757
+ * submission this Client just sent that the Host has not admitted yet: without
14758
+ * it the message would blink out between sending and being queued.
14759
+ */
14760
+ /** Attachments of one queued item, the two shapes the wire actually uses. */
14761
+ function ideFloatQueueAttachments(content) {
14762
+ const items = []
14763
+ for (const block of Array.isArray(content) ? content : []) {
14764
+ if (block?.type === 'image' && block.attachment !== undefined) {
14765
+ items.push({ kind: 'image', id: String(block.attachment.attachmentId ?? ''), ref: block.attachment })
14766
+ }
14767
+ if (block?.type === 'file' && block.attachment !== undefined) {
14768
+ items.push({ kind: 'file', id: String(block.attachment.attachmentId ?? ''), name: String(block.attachment.name ?? '') })
14769
+ }
14770
+ }
14771
+ return items.filter((item) => item.kind === 'file' || item.id !== '')
14772
+ }
14773
+
14774
+ /** Attachments of a submission this Client just queued (it carries a preview URL). */
14775
+ function ideFloatPendingAttachments(attachments) {
14776
+ const items = []
14777
+ for (const entry of Array.isArray(attachments) ? attachments : []) {
14778
+ if (entry?.type === 'image') {
14779
+ items.push({ kind: 'image', id: '', preview: String(entry.value?.previewUrl ?? ''), name: String(entry.value?.name ?? '') })
14780
+ }
14781
+ if (entry?.type === 'file') {
14782
+ items.push({ kind: 'file', id: '', name: String(entry.value?.name ?? '') })
14783
+ }
14784
+ }
14785
+ return items
14786
+ }
14787
+
14788
+ function ideFloatQueueRows(inbox, pending) {
14789
+ const rows = []
14790
+ const list = Array.isArray(inbox?.['next-turn']) ? inbox['next-turn'] : []
14791
+ const admitted = new Set()
14792
+ for (const row of list) {
14793
+ if (row?.source?.kind !== 'user') continue
14794
+ const text = (Array.isArray(row.content) ? row.content : [])
14795
+ .filter((block) => block?.type === 'text')
14796
+ .map((block) => String(block.text ?? ''))
14797
+ .join('')
14798
+ .trim()
14799
+ const attachments = ideFloatQueueAttachments(row.content)
14800
+ // An image-only message is still a message: dropping it would make the
14801
+ // queue lie about what is waiting.
14802
+ if (text === '' && attachments.length === 0) continue
14803
+ if (typeof row?.source?.rpcId === 'string') admitted.add(row.source.rpcId)
14804
+ rows.push({ id: String(row.id ?? ''), text, attachments, sending: false })
14805
+ }
14806
+ for (const item of Array.isArray(pending) ? pending : []) {
14807
+ if (item?.placement !== 'queued') continue
14808
+ const requestId = String(item.requestId ?? '')
14809
+ if (requestId !== '' && admitted.has(requestId)) continue
14810
+ const text = String(item.text ?? '').trim()
14811
+ const attachments = ideFloatPendingAttachments(item.attachments)
14812
+ if (text === '' && attachments.length === 0) continue
14813
+ rows.push({ id: requestId, text, attachments, sending: true })
14814
+ }
14815
+ return rows
14816
+ }
14817
+
13954
14818
  /**
13955
14819
  * The label of a permission preset id.
13956
14820
  *
@@ -15362,6 +16226,83 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15362
16226
  return () => globalThis.removeEventListener('resize', onResize)
15363
16227
  }, [])
15364
16228
 
16229
+ // The queue: `inbox.next-turn` is the Host's own list, the same projection the
16230
+ // conversation's queue strip reads, and the Session snapshot adds a message
16231
+ // this card just sent. Both are observed, so a row never appears late.
16232
+ const [sessionSnap, setSessionSnap] = useState(null)
16233
+ const [inbox, setInbox] = useState(null)
16234
+ const [queueOpen, setQueueOpen] = useState(false)
16235
+ const [queueEdit, setQueueEdit] = useState(null)
16236
+ const [queueBusy, setQueueBusy] = useState('')
16237
+ useEffect(() => {
16238
+ if (binding === null || binding.session === undefined || binding.session === null) {
16239
+ setSessionSnap(null)
16240
+ return undefined
16241
+ }
16242
+ const read = () => setSessionSnap(binding.session.getSnapshot())
16243
+ read()
16244
+ return typeof binding.session.subscribe === 'function' ? binding.session.subscribe(read) : undefined
16245
+ }, [binding])
16246
+ useEffect(() => {
16247
+ if (binding === null) {
16248
+ setInbox(null)
16249
+ return undefined
16250
+ }
16251
+ const projections = binding.session?.projections
16252
+ if (projections === undefined || projections === null) return undefined
16253
+ const read = () => setInbox(typeof projections.get === 'function' ? (projections.get('inbox') ?? null) : null)
16254
+ read()
16255
+ const face = typeof projections.faceOf === 'function' ? projections.faceOf('inbox') : undefined
16256
+ const off = typeof face?.subscribe === 'function' ? face.subscribe(read) : projections.subscribeAny?.(read)
16257
+ return () => {
16258
+ if (typeof off === 'function') off()
16259
+ }
16260
+ }, [binding])
16261
+
16262
+ // Queued rows are needed before the guard: the thumbnail effect below loads
16263
+ // their images, and hooks may not sit under the early return.
16264
+ const queueRows = ideFloatQueueRows(inbox, sessionSnap?.pendingSubmissions)
16265
+ const queueImageKey = queueRows
16266
+ .flatMap((row) => (row.attachments ?? []).filter((item) => item.kind === 'image' && item.preview === undefined).map((item) => item.id))
16267
+ .join(',')
16268
+
16269
+ // A queued picture has no URL of its own: resolve it through the Session the
16270
+ // same way message attachments are resolved, into the shared picture map.
16271
+ useEffect(() => {
16272
+ if (binding === null || binding.session === undefined || binding.session === null) return undefined
16273
+ if (queueImageKey === '') return undefined
16274
+ const wanted = []
16275
+ for (const row of queueRows) {
16276
+ for (const item of row.attachments ?? []) {
16277
+ if (item.kind !== 'image' || item.ref === undefined || item.id === '') continue
16278
+ if (picturesRef.current[item.id] !== undefined) continue
16279
+ if (wanted.some((ref) => ref.attachmentId === item.id)) continue
16280
+ wanted.push(item.ref)
16281
+ }
16282
+ }
16283
+ if (wanted.length === 0) return undefined
16284
+ let alive = true
16285
+ for (const ref of wanted) {
16286
+ binding.session.readAttachment(ref).then((result) => {
16287
+ if (alive !== true || result?.ok !== true) return
16288
+ const data = result.value?.data
16289
+ if (data === undefined) return
16290
+ const mediaType = result.value?.attachment?.mediaType ?? ref.mediaType
16291
+ const bytes = new Uint8Array(data)
16292
+ let url = ''
16293
+ if (typeof URL?.createObjectURL === 'function') {
16294
+ url = URL.createObjectURL(new Blob([bytes], { type: mediaType }))
16295
+ } else {
16296
+ let binary = ''
16297
+ for (const byte of bytes) binary += String.fromCharCode(byte)
16298
+ url = `data:${mediaType};base64,${btoa(binary)}`
16299
+ }
16300
+ setPictures((current) => (current[ref.attachmentId] !== undefined ? current : { ...current, [ref.attachmentId]: url }))
16301
+ }).catch(() => {})
16302
+ }
16303
+ return () => { alive = false }
16304
+ }, [binding, queueImageKey])
16305
+
15365
16306
  if (!open) return null
15366
16307
 
15367
16308
  // The header names the conversation, not the folder: that is what the menu
@@ -15377,6 +16318,190 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15377
16318
  const size = ideFloatSize(state, viewportWidth, viewportHeight)
15378
16319
  const point = ideFloatPoint(state, viewportWidth, viewportHeight, size.width, collapsed ? 52 : size.height)
15379
16320
 
16321
+ // The transcript holds the conversation; the Tool log is live status pinned to
16322
+ // the card's footer, so it never scrolls away with the history.
16323
+ const visibleEntries = ideFloatVisibleRows(entries, running, state.floatEvents === true)
16324
+
16325
+ // The live line reads the RAW entries: `entries` is already folded into rows,
16326
+ // and the streamed deltas live only in the window (they are not rows).
16327
+ // Running with no stream and no Tool in flight means the request is being
16328
+ // analysed — the same phase the conversation labels 「正在分析请求」. Without it
16329
+ // the card sat silent for tens of seconds before the first token.
16330
+ const liveStream = running === true ? ideFloatLiveStream(rawEntries.current) : null
16331
+ // Streamed text goes into the body like the conversation; the pinned line is
16332
+ // only for Tool work and the analysis phase.
16333
+ const streamRow = ideFloatStreamRow(liveStream)
16334
+ const activity = running === true ? ideFloatLiveActivity(entries, rawEntries.current) : null
16335
+ const live = running !== true || streamRow !== null
16336
+ ? null
16337
+ : activity !== null && activity.kind === 'text'
16338
+ ? null
16339
+ : (activity ?? { kind: 'analyze' })
16340
+ const liveTail = ideFloatLiveTail(live)
16341
+ const queueRunning = sessionSnap?.running === true
16342
+
16343
+ /**
16344
+ * One queue action: the Host answers with a result rather than a throw, and a
16345
+ * row that started sending meanwhile must say so instead of failing silently.
16346
+ */
16347
+ const applyQueue = async (id, action, failureKey) => {
16348
+ if (binding === null || id === '') return
16349
+ setQueueBusy(id)
16350
+ if (typeof binding.session.updateQueue !== 'function') return
16351
+ try {
16352
+ const result = await binding.session.updateQueue(id, action)
16353
+ if (result?.ok === false) {
16354
+ store.setNotice(`${tr(failureKey)}: ${result.error?.message ?? result.error?.code ?? 'unknown'}`)
16355
+ return
16356
+ }
16357
+ if (action.kind === 'edit') setQueueEdit(null)
16358
+ } catch (error) {
16359
+ store.setNotice(`${tr(failureKey)}: ${error?.message ?? String(error)}`)
16360
+ } finally {
16361
+ setQueueBusy('')
16362
+ }
16363
+ }
16364
+
16365
+ /**
16366
+ * The queue strip, shaped like the conversation's: one row shows itself, many
16367
+ * collapse under a count header, and every row can be edited, dropped or
16368
+ * steered into the running turn. It sits above the composer, where the
16369
+ * conversation puts its own.
16370
+ */
16371
+ const renderQueue = () => {
16372
+ if (queueRows.length === 0) return null
16373
+ const single = queueRows.length === 1
16374
+ const listVisible = single || queueOpen
16375
+ const saveEdit = (row) => {
16376
+ const text = queueEdit === null ? '' : queueEdit.text.trim()
16377
+ if (text === '') return
16378
+ void applyQueue(row.id, { kind: 'edit', content: [{ type: 'text', text }] }, 'floatQueueEditFailed')
16379
+ }
16380
+ const head = single
16381
+ ? null
16382
+ : h('button', {
16383
+ key: 'head',
16384
+ type: 'button',
16385
+ className: 'iw-float-queue-head',
16386
+ 'aria-expanded': listVisible,
16387
+ onClick: () => setQueueOpen(!queueOpen),
16388
+ }, [
16389
+ h('span', { key: 'i', className: 'iw-float-queue-icon' }, h(IdeQueueIcon, { size: 14 })),
16390
+ h('span', { key: 'n', className: 'iw-float-queue-count' }, `${queueRows.length} ${tr('floatQueueUnit')}`),
16391
+ h('span', { key: 'c', className: `iw-float-queue-chevron${listVisible ? ' on' : ''}` }, h(IdeChevronDownIcon, { size: 12 })),
16392
+ ])
16393
+ return h('div', { key: 'queue', className: 'iw-float-queue' }, [
16394
+ head,
16395
+ listVisible
16396
+ ? h('div', { key: 'list', className: 'iw-float-queue-list' }, queueRows.map((row) => {
16397
+ const busy = queueBusy === row.id
16398
+ if (queueEdit !== null && queueEdit.id === row.id) {
16399
+ return h('div', { key: row.id, className: 'iw-float-queue-row' }, [
16400
+ h('input', {
16401
+ key: 'e',
16402
+ className: 'iw-float-queue-input',
16403
+ value: queueEdit.text,
16404
+ autoFocus: true,
16405
+ 'aria-label': tr('floatQueueEdit'),
16406
+ onChange: (event) => setQueueEdit({ id: row.id, text: event.target.value }),
16407
+ onKeyDown: (event) => {
16408
+ if (event.key === 'Enter') {
16409
+ event.preventDefault()
16410
+ saveEdit(row)
16411
+ }
16412
+ if (event.key === 'Escape') {
16413
+ event.preventDefault()
16414
+ setQueueEdit(null)
16415
+ }
16416
+ },
16417
+ }),
16418
+ h('button', {
16419
+ key: 's',
16420
+ type: 'button',
16421
+ className: 'iw-float-queue-action',
16422
+ title: tr('floatQueueSave'),
16423
+ 'aria-label': tr('floatQueueSave'),
16424
+ disabled: busy === true || queueEdit.text.trim() === '',
16425
+ onClick: () => saveEdit(row),
16426
+ }, h(IdeCheckIcon, { size: 14 })),
16427
+ h('button', {
16428
+ key: 'c',
16429
+ type: 'button',
16430
+ className: 'iw-float-queue-action',
16431
+ title: tr('floatQueueCancel'),
16432
+ 'aria-label': tr('floatQueueCancel'),
16433
+ disabled: busy === true,
16434
+ onClick: () => setQueueEdit(null),
16435
+ }, h(IdeCloseIcon, { size: 12 })),
16436
+ ])
16437
+ }
16438
+ return h('div', { key: row.id, className: `iw-float-queue-row${row.sending ? ' sending' : ''}` }, [
16439
+ single
16440
+ ? h('span', { key: 'q', className: 'iw-float-queue-icon' }, h(IdeQueueIcon, { size: 14 }))
16441
+ : null,
16442
+ (row.attachments ?? []).length === 0
16443
+ ? null
16444
+ : h('span', { key: 'media', className: 'iw-float-queue-media' }, (row.attachments ?? []).map((item, index) => {
16445
+ if (item.kind === 'file') {
16446
+ return h('span', { key: `f${index}`, className: 'iw-float-queue-file', title: item.name }, [
16447
+ h('span', { key: 'i', className: 'iw-float-queue-file-icon' }, h(IdeFileIcon, { lang: '', size: 14 })),
16448
+ h('span', { key: 'n', className: 'iw-float-queue-file-name' }, item.name),
16449
+ ])
16450
+ }
16451
+ // The preview of a just-queued item is a URL already; one that
16452
+ // came back from the Host has to be read through the Session.
16453
+ const url = item.preview !== undefined && item.preview !== '' ? item.preview : (pictures[item.id] ?? '')
16454
+ return url === ''
16455
+ ? h('span', { key: `i${index}`, className: 'iw-float-queue-thumb iw-float-queue-thumb-wait' })
16456
+ : h('img', {
16457
+ key: `i${index}`,
16458
+ className: 'iw-float-queue-thumb',
16459
+ src: url,
16460
+ alt: item.name ?? '',
16461
+ draggable: false,
16462
+ onClick: () => setViewing({ url, name: item.name ?? '' }),
16463
+ })
16464
+ })),
16465
+ row.text === ''
16466
+ ? null
16467
+ : h('span', { key: 't', className: 'iw-float-queue-text', title: row.text }, row.text),
16468
+ row.sending
16469
+ ? h('span', { key: 'st', className: 'iw-float-queue-sending' }, tr('floatQueueSending'))
16470
+ : h('div', { key: 'a', className: 'iw-float-queue-actions' }, [
16471
+ h('button', {
16472
+ key: 'edit',
16473
+ type: 'button',
16474
+ className: 'iw-float-queue-action',
16475
+ title: tr('floatQueueEdit'),
16476
+ 'aria-label': tr('floatQueueEdit'),
16477
+ disabled: busy === true,
16478
+ onClick: () => setQueueEdit({ id: row.id, text: row.text }),
16479
+ }, h(IdePencilIcon, { size: 14 })),
16480
+ h('button', {
16481
+ key: 'remove',
16482
+ type: 'button',
16483
+ className: 'iw-float-queue-action',
16484
+ title: tr('floatQueueRemove'),
16485
+ 'aria-label': tr('floatQueueRemove'),
16486
+ disabled: busy === true,
16487
+ onClick: () => { void applyQueue(row.id, { kind: 'remove' }, 'floatQueueRemoveFailed') },
16488
+ }, h(IdeTrashIcon, { size: 14 })),
16489
+ h('button', {
16490
+ key: 'steer',
16491
+ type: 'button',
16492
+ className: 'iw-float-queue-action',
16493
+ title: queueRunning ? tr('floatQueueSteer') : tr('floatQueueSteerUnavailable'),
16494
+ 'aria-label': tr('floatQueueSteer'),
16495
+ disabled: busy === true || queueRunning !== true,
16496
+ onClick: () => { void applyQueue(row.id, { kind: 'steer' }, 'floatQueueSteerFailed') },
16497
+ }, h(IdeArrowUpIcon, { size: 14 })),
16498
+ ]),
16499
+ ])
16500
+ }))
16501
+ : null,
16502
+ ])
16503
+ }
16504
+
15380
16505
  // Drag the header and resize the card from its corner grip.
15381
16506
  //
15382
16507
  // Both listen on the WINDOW for the duration of the gesture: a fast drag
@@ -15734,18 +16859,33 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15734
16859
  const element = event.currentTarget
15735
16860
  stickRef.current = element.scrollTop + element.clientHeight >= element.scrollHeight - 40
15736
16861
  },
15737
- }, entries.length === 0
16862
+ }, visibleEntries.length === 0 && running !== true
15738
16863
  ? h('div', { key: 'empty', className: 'iw-float-empty' }, sessionId === '' ? tr('floatNoSession') : tr('floatEmpty'))
15739
- : entries.map((row) => {
16864
+ : visibleEntries.map((row) => {
15740
16865
  // One malformed event must not take the whole card down: a throw inside
15741
16866
  // this map unmounts the overlay, and the user just sees the card vanish.
15742
16867
  try {
15743
- return ideFloatRow(row, tr, { setViewing, store, pictures, goToChat, running })
16868
+ return ideFloatRow(row, tr, { setViewing, store, pictures, goToChat, running, detail: state.floatEvents === true })
15744
16869
  } catch (error) {
15745
16870
  ideLogRecord('warn', 'float', 'row render failed', { key: row.key, error: String(error) })
15746
16871
  return h('div', { key: row.key, className: 'iw-float-row iw-float-assistant' }, String(row.text ?? ''))
15747
16872
  }
15748
16873
  })),
16874
+ // The in-flight message renders in the transcript, exactly like the one the
16875
+ // conversation is printing — no separate 「正在输出」 step.
16876
+ streamRow === null
16877
+ ? null
16878
+ : h('div', { key: 'stream', className: 'iw-float-row iw-float-assistant iw-float-streaming' }, [h(IdeFloatMarkdown, { key: 'md', text: streamRow.text, tr })]),
16879
+ live === null
16880
+ ? null
16881
+ : h('div', { key: 'live', className: 'iw-float-step live iw-float-live' }, [
16882
+ h('span', { key: 'i', className: 'iw-float-step-icon' }, live.kind === 'tool' ? h(IdeTerminalIcon, { size: 15 }) : (live.kind === 'reasoning' ? h(IdeThinkIcon, { size: 15 }) : h(IdeSparkleIcon, { size: 15 }))),
16883
+ live.kind === 'tool'
16884
+ ? h('span', { key: 't', className: 'iw-float-step-text', title: ideFloatLiveText(live.step, tr) }, ideFloatLiveText(live.step, tr))
16885
+ : live.kind === 'analyze'
16886
+ ? h('span', { key: 't', className: 'iw-float-step-text' }, tr('floatLiveAnalyze'))
16887
+ : h('span', { key: 't', className: 'iw-float-step-text', title: liveTail }, `${live.kind === 'reasoning' ? tr('floatLiveThinking') : tr('floatLiveWriting')} · ${liveTail}`),
16888
+ ]),
15749
16889
  running
15750
16890
  ? h('div', { key: 'think', className: 'iw-float-thinking' }, [
15751
16891
  h('span', { key: 'i', className: 'iw-float-thinking-icon' }, h(IdeSparkleIcon, { size: 15 })),
@@ -15777,6 +16917,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
15777
16917
  }, tr('floatCloseViewer')),
15778
16918
  ]),
15779
16919
  ]),
16920
+ renderQueue(),
15780
16921
  h('div', { key: 'input', className: 'iw-float-input', ref: inputRef }, [
15781
16922
  refs.length === 0 && images.length === 0 ? null : h('div', { key: 'chips', className: 'iw-float-chips' }, [
15782
16923
  ...refs.map((ref, index) => h('span', { key: `ref:${ref}`, className: 'iw-float-chip-ref' }, [