dsh-ide-window 0.3.6 → 0.3.7
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/AGENTS.md +37 -43
- package/CHANGELOG.md +11 -0
- package/client.js +1500 -369
- package/index.js +1 -50
- package/locale/en.json +67 -10
- package/locale/zh.json +67 -10
- package/package.json +1 -1
- package/themes/atom-one-light.css +2 -0
- package/themes/dracula.css +2 -0
- package/themes/github-light.css +2 -0
- package/themes/intellij-light.css +2 -0
- package/themes/material-light.css +2 -0
- package/themes/material-oceanic.css +2 -0
- package/themes/material-palenight.css +2 -0
- package/themes/monokai-pro.css +2 -0
- package/themes/night-owl.css +2 -0
- package/themes/solarized-light.css +2 -0
package/client.js
CHANGED
|
@@ -9,6 +9,65 @@ window.__ModuleLoader__.load({
|
|
|
9
9
|
const { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } = React
|
|
10
10
|
const h = React.createElement
|
|
11
11
|
const IDE_TEXT_EN = {
|
|
12
|
+
"floatStepMore": "{title} and more",
|
|
13
|
+
"floatStepSharedPrefix": "",
|
|
14
|
+
"floatStepComma": ", ",
|
|
15
|
+
"floatStepJoinTwo": "{first} and {second}",
|
|
16
|
+
"floatStepDone.thinking": "finished thinking",
|
|
17
|
+
"floatStepDone.tools": "called tools",
|
|
18
|
+
"floatStepDone.plan": "updated the plan",
|
|
19
|
+
"floatStepDone.questions": "asked you a question",
|
|
20
|
+
"floatStepDone.web": "searched the web",
|
|
21
|
+
"floatStepDone.search": "searched the code",
|
|
22
|
+
"floatStepDone.write": "edited a file",
|
|
23
|
+
"floatStepDone.read": "read a file",
|
|
24
|
+
"floatStepDone.commands": "ran a command",
|
|
25
|
+
"floatMenuChats": "Conversations",
|
|
26
|
+
"floatMenuFiles": "Files and folders",
|
|
27
|
+
"floatMenuSkills": "Skills",
|
|
28
|
+
"floatMenuCommands": "Commands",
|
|
29
|
+
"floatMenuAdd": "Add",
|
|
30
|
+
"floatCmdExportDesc": "Download this conversation as a ZIP",
|
|
31
|
+
"floatCmdExport": "Export log",
|
|
32
|
+
"floatCmdModelDesc": "Pick the model for this conversation",
|
|
33
|
+
"floatCmdModel": "Model",
|
|
34
|
+
"floatCmdPermissionDesc": "Switch the permission preset",
|
|
35
|
+
"floatCmdPermission": "Permission",
|
|
36
|
+
"floatCmdCompactDesc": "Compact the conversation so far",
|
|
37
|
+
"floatCmdCompact": "Compact",
|
|
38
|
+
"floatCmdFeedbackDesc": "Send feedback about this conversation",
|
|
39
|
+
"floatCmdFeedback": "Feedback",
|
|
40
|
+
"floatCmdPlanDesc": "Enter or leave plan mode",
|
|
41
|
+
"floatCmdPlan": "Plan",
|
|
42
|
+
"floatCmdGoalDesc": "Set or review the long-running goal",
|
|
43
|
+
"floatCmdGoal": "Goal",
|
|
44
|
+
"floatCmdFile": "File",
|
|
45
|
+
"floatProgressTool": "Using a tool",
|
|
46
|
+
"floatProgressTask": "Updating tasks",
|
|
47
|
+
"floatProgressAsk": "Asking you",
|
|
48
|
+
"floatProgressWeb": "Searching the web",
|
|
49
|
+
"floatProgressWrite": "Editing a file",
|
|
50
|
+
"floatProgressRead": "Reading a file",
|
|
51
|
+
"floatProgressSearch": "Searching",
|
|
52
|
+
"floatProgressCommand": "Running a command",
|
|
53
|
+
"floatActivityTask": "updated tasks",
|
|
54
|
+
"floatActivityAsk": "asked you a question",
|
|
55
|
+
"floatActivityWeb": "searched the web",
|
|
56
|
+
"floatActivityWrite": "edited files",
|
|
57
|
+
"floatActivityRead": "read files",
|
|
58
|
+
"floatActivitySearch": "searched code",
|
|
59
|
+
"floatActivityCommand": "ran commands",
|
|
60
|
+
"floatRunningTools": "tools used",
|
|
61
|
+
"floatElapsedSec": "{s}s",
|
|
62
|
+
"floatElapsedMin": "{m}m {s}s",
|
|
63
|
+
"floatSuggestFailed": "Suggestions unavailable",
|
|
64
|
+
"floatCommandFailed": "Command failed",
|
|
65
|
+
"floatSuggestEnterDir": "open folder",
|
|
66
|
+
"floatQuestionGo": "Answer in chat",
|
|
67
|
+
"floatQuestionHint": "DSH accepts answers in the conversation",
|
|
68
|
+
"floatQuestionWaiting": "Waiting for your answer in the conversation",
|
|
69
|
+
"floatToggleDisabled": "The assistant card is turned off in settings",
|
|
70
|
+
"shortcutFloatToggle": "Toggle the assistant card",
|
|
12
71
|
"title": "Code Workspace",
|
|
13
72
|
"subtitle": "Workspace",
|
|
14
73
|
"files": "Files",
|
|
@@ -281,13 +340,11 @@ window.__ModuleLoader__.load({
|
|
|
281
340
|
"floatEmpty": "Ask something; the answer lands in this session",
|
|
282
341
|
"floatNoSession": "No session bound yet",
|
|
283
342
|
"floatNoWorkspace": "no workspace",
|
|
284
|
-
"floatPlaceholder": "
|
|
343
|
+
"floatPlaceholder": "Message or create a task, / for commands, @ for files or chats",
|
|
285
344
|
"floatSend": "Send",
|
|
286
345
|
"floatSending": "Sending…",
|
|
287
346
|
"floatFailed": "Send failed",
|
|
288
|
-
"
|
|
289
|
-
"floatAssistant": "Assistant",
|
|
290
|
-
"floatRunning": "Answering…",
|
|
347
|
+
"floatRunning": "Thinking",
|
|
291
348
|
"floatAttach": "Add content",
|
|
292
349
|
"floatAttachReference": "Reference the open file",
|
|
293
350
|
"floatNeedsFile": "Open a file first",
|
|
@@ -316,7 +373,7 @@ window.__ModuleLoader__.load({
|
|
|
316
373
|
"floatImageTooLarge": "Image is larger than 8 MB",
|
|
317
374
|
"floatEffort": "Reasoning effort",
|
|
318
375
|
"floatEffortDefault": "Default",
|
|
319
|
-
"floatCode": "Code",
|
|
376
|
+
"floatCode": "Code block",
|
|
320
377
|
"floatCopy": "Copy",
|
|
321
378
|
"floatCopied": "Copied",
|
|
322
379
|
"floatFiles": "Files",
|
|
@@ -325,6 +382,7 @@ window.__ModuleLoader__.load({
|
|
|
325
382
|
"settingsFloatWidth": "Width",
|
|
326
383
|
"settingsFloatHeight": "Height",
|
|
327
384
|
"floatOpenFailed": "Cannot open in the workspace",
|
|
385
|
+
"floatCopyMessage": "Copy message",
|
|
328
386
|
"floatCopyImage": "Copy image",
|
|
329
387
|
"floatImageCopied": "Image copied",
|
|
330
388
|
"floatCopyImageFailed": "Copying the image failed",
|
|
@@ -333,13 +391,70 @@ window.__ModuleLoader__.load({
|
|
|
333
391
|
"mdSource": "Source",
|
|
334
392
|
"floatPreviewImage": "Click to view the image",
|
|
335
393
|
"floatCloseViewer": "Close",
|
|
336
|
-
"
|
|
337
|
-
"
|
|
338
|
-
"
|
|
339
|
-
"floatChangesAll": "All",
|
|
340
|
-
"floatChangesLess": "Collapse",
|
|
394
|
+
"settingsFloatDetach": "Detach from the workspace",
|
|
395
|
+
"settingsFloatDetachHint": "Keep the card on screen when you switch to another panel or back to the conversation",
|
|
396
|
+
"floatWrap": "Wrap lines",
|
|
341
397
|
}
|
|
342
398
|
const IDE_TEXT_ZH = {
|
|
399
|
+
"floatStepMore": "{title}等",
|
|
400
|
+
"floatStepSharedPrefix": "已",
|
|
401
|
+
"floatStepComma": ",",
|
|
402
|
+
"floatStepJoinTwo": "{first}并{second}",
|
|
403
|
+
"floatStepDone.thinking": "已完成分析",
|
|
404
|
+
"floatStepDone.tools": "已调用工具",
|
|
405
|
+
"floatStepDone.plan": "更新了计划",
|
|
406
|
+
"floatStepDone.questions": "向用户提出了问题",
|
|
407
|
+
"floatStepDone.web": "已搜索网页",
|
|
408
|
+
"floatStepDone.search": "已搜索代码",
|
|
409
|
+
"floatStepDone.write": "修改了文件",
|
|
410
|
+
"floatStepDone.read": "已读取文件",
|
|
411
|
+
"floatStepDone.commands": "执行了命令",
|
|
412
|
+
"floatMenuChats": "对话",
|
|
413
|
+
"floatMenuFiles": "文件与文件夹",
|
|
414
|
+
"floatMenuSkills": "技能",
|
|
415
|
+
"floatMenuCommands": "指令",
|
|
416
|
+
"floatMenuAdd": "添加",
|
|
417
|
+
"floatCmdExportDesc": "将当前会话内容导出为 ZIP",
|
|
418
|
+
"floatCmdExport": "下载日志",
|
|
419
|
+
"floatCmdModelDesc": "选择本会话使用的模型",
|
|
420
|
+
"floatCmdModel": "模型",
|
|
421
|
+
"floatCmdPermissionDesc": "切换权限预设(沙箱模式与审批策略)",
|
|
422
|
+
"floatCmdPermission": "权限",
|
|
423
|
+
"floatCmdCompactDesc": "压缩以上对话内容",
|
|
424
|
+
"floatCmdCompact": "压缩",
|
|
425
|
+
"floatCmdFeedbackDesc": "发送关于当前会话的反馈",
|
|
426
|
+
"floatCmdFeedback": "反馈",
|
|
427
|
+
"floatCmdPlanDesc": "进入或退出计划模式",
|
|
428
|
+
"floatCmdPlan": "计划",
|
|
429
|
+
"floatCmdGoalDesc": "设置或查看长期任务目标",
|
|
430
|
+
"floatCmdGoal": "目标",
|
|
431
|
+
"floatCmdFile": "文件",
|
|
432
|
+
"floatProgressTool": "正在使用工具",
|
|
433
|
+
"floatProgressTask": "正在更新任务",
|
|
434
|
+
"floatProgressAsk": "正在向你提问",
|
|
435
|
+
"floatProgressWeb": "正在联网搜索",
|
|
436
|
+
"floatProgressWrite": "正在修改文件",
|
|
437
|
+
"floatProgressRead": "正在读取文件",
|
|
438
|
+
"floatProgressSearch": "正在搜索",
|
|
439
|
+
"floatProgressCommand": "正在运行命令",
|
|
440
|
+
"floatActivityTask": "已更新任务",
|
|
441
|
+
"floatActivityAsk": "已向你提问",
|
|
442
|
+
"floatActivityWeb": "已联网搜索",
|
|
443
|
+
"floatActivityWrite": "已修改文件",
|
|
444
|
+
"floatActivityRead": "已读取文件",
|
|
445
|
+
"floatActivitySearch": "已搜索代码",
|
|
446
|
+
"floatActivityCommand": "执行了命令",
|
|
447
|
+
"floatRunningTools": "已调用工具",
|
|
448
|
+
"floatElapsedSec": "用时 {s} 秒",
|
|
449
|
+
"floatElapsedMin": "用时 {m} 分 {s} 秒",
|
|
450
|
+
"floatSuggestFailed": "候选加载失败",
|
|
451
|
+
"floatCommandFailed": "指令执行失败",
|
|
452
|
+
"floatSuggestEnterDir": "进入目录",
|
|
453
|
+
"floatQuestionGo": "去对话作答",
|
|
454
|
+
"floatQuestionHint": "DSH 只在对话里受理作答",
|
|
455
|
+
"floatQuestionWaiting": "等待你在对话里回答",
|
|
456
|
+
"floatToggleDisabled": "悬浮框已在设置里关闭",
|
|
457
|
+
"shortcutFloatToggle": "显示 / 收起悬浮框",
|
|
343
458
|
"title": "代码工作区",
|
|
344
459
|
"subtitle": "工作区",
|
|
345
460
|
"files": "文件",
|
|
@@ -612,13 +727,11 @@ window.__ModuleLoader__.load({
|
|
|
612
727
|
"floatEmpty": "问点什么,回答会出现在当前会话里",
|
|
613
728
|
"floatNoSession": "还没有绑定会话",
|
|
614
729
|
"floatNoWorkspace": "未选择工作区",
|
|
615
|
-
"floatPlaceholder": "
|
|
730
|
+
"floatPlaceholder": "发消息或创建任务,/ 调用指令,@ 文件或对话",
|
|
616
731
|
"floatSend": "发送",
|
|
617
732
|
"floatSending": "发送中…",
|
|
618
733
|
"floatFailed": "发送失败",
|
|
619
|
-
"
|
|
620
|
-
"floatAssistant": "助手",
|
|
621
|
-
"floatRunning": "正在回答…",
|
|
734
|
+
"floatRunning": "深度求索中",
|
|
622
735
|
"floatAttach": "添加内容",
|
|
623
736
|
"floatAttachReference": "引用当前文件",
|
|
624
737
|
"floatNeedsFile": "先打开一个文件",
|
|
@@ -647,7 +760,7 @@ window.__ModuleLoader__.load({
|
|
|
647
760
|
"floatImageTooLarge": "图片超过 8 MB",
|
|
648
761
|
"floatEffort": "思考等级",
|
|
649
762
|
"floatEffortDefault": "默认",
|
|
650
|
-
"floatCode": "
|
|
763
|
+
"floatCode": "代码块",
|
|
651
764
|
"floatCopy": "复制",
|
|
652
765
|
"floatCopied": "已复制",
|
|
653
766
|
"floatFiles": "文件",
|
|
@@ -656,6 +769,7 @@ window.__ModuleLoader__.load({
|
|
|
656
769
|
"settingsFloatWidth": "宽度",
|
|
657
770
|
"settingsFloatHeight": "高度",
|
|
658
771
|
"floatOpenFailed": "无法在工作区打开",
|
|
772
|
+
"floatCopyMessage": "复制这条消息",
|
|
659
773
|
"floatCopyImage": "复制图片",
|
|
660
774
|
"floatImageCopied": "图片已复制",
|
|
661
775
|
"floatCopyImageFailed": "复制图片失败",
|
|
@@ -664,11 +778,9 @@ window.__ModuleLoader__.load({
|
|
|
664
778
|
"mdSource": "源码",
|
|
665
779
|
"floatPreviewImage": "点击预览图片",
|
|
666
780
|
"floatCloseViewer": "关闭",
|
|
667
|
-
"
|
|
668
|
-
"
|
|
669
|
-
"
|
|
670
|
-
"floatChangesAll": "全部",
|
|
671
|
-
"floatChangesLess": "收起",
|
|
781
|
+
"settingsFloatDetach": "脱离代码工作区",
|
|
782
|
+
"settingsFloatDetachHint": "开启后悬浮框不再跟着代码工作区出现与消失:切到其他插件视图或回到对话时它依然在",
|
|
783
|
+
"floatWrap": "自动换行",
|
|
672
784
|
}
|
|
673
785
|
|
|
674
786
|
// ---- 00-css.js -----------------------------------------------------------
|
|
@@ -1849,7 +1961,14 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
1849
1961
|
.iw-float, .iw-float *, .iw-float *::before, .iw-float *::after { box-sizing: border-box; }
|
|
1850
1962
|
.iw-float-head { display: flex; align-items: center; gap: 6px; cursor: grab; user-select: none; touch-action: none; }
|
|
1851
1963
|
.iw-float-head:active { cursor: grabbing; }
|
|
1852
|
-
.iw-float-collapsed {
|
|
1964
|
+
.iw-float-collapsed {
|
|
1965
|
+
padding: 4px;
|
|
1966
|
+
border: 0;
|
|
1967
|
+
background: transparent;
|
|
1968
|
+
box-shadow: none;
|
|
1969
|
+
min-height: 0;
|
|
1970
|
+
}
|
|
1971
|
+
.iw-float-collapsed .iw-float-ball-btn { flex: 0 0 auto; }
|
|
1853
1972
|
.iw-float-chip {
|
|
1854
1973
|
max-width: 168px;
|
|
1855
1974
|
overflow: hidden;
|
|
@@ -1861,10 +1980,123 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
1861
1980
|
background: transparent;
|
|
1862
1981
|
color: var(--dsw-alias-label-secondary, inherit);
|
|
1863
1982
|
font: inherit;
|
|
1864
|
-
font-size:
|
|
1983
|
+
font-size: 12px;
|
|
1865
1984
|
cursor: pointer;
|
|
1866
1985
|
}
|
|
1867
1986
|
.iw-float-chip:hover { background: var(--dsw-alias-card-fill-hover, rgba(255, 255, 255, 0.08)); }
|
|
1987
|
+
/* The command and mention lists sit above the composer, the way the
|
|
1988
|
+
conversation's own popup does: one row per candidate, description right. */
|
|
1989
|
+
/* Tool steps and the running line, measured like the conversation's own. */
|
|
1990
|
+
.iw-float-step { display: flex; gap: 6px; padding: 2px 0; }
|
|
1991
|
+
.iw-float-step-icon,
|
|
1992
|
+
.iw-float-thinking-icon {
|
|
1993
|
+
flex: 0 0 auto;
|
|
1994
|
+
display: inline-flex;
|
|
1995
|
+
align-items: center;
|
|
1996
|
+
height: 22px;
|
|
1997
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
1998
|
+
}
|
|
1999
|
+
.iw-float-step-text {
|
|
2000
|
+
font-size: 14px;
|
|
2001
|
+
line-height: 22px;
|
|
2002
|
+
color: var(--dsw-alias-label-secondary, #61666b);
|
|
2003
|
+
overflow: hidden;
|
|
2004
|
+
text-overflow: ellipsis;
|
|
2005
|
+
white-space: nowrap;
|
|
2006
|
+
}
|
|
2007
|
+
.iw-float-step.live .iw-float-step-text { color: var(--dsw-alias-label-primary, #1a1a1a); }
|
|
2008
|
+
.iw-float-thinking { display: flex; gap: 6px; padding: 2px 0; }
|
|
2009
|
+
.iw-float-thinking-text { font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-secondary, #61666b); }
|
|
2010
|
+
|
|
2011
|
+
/* While the Session works, the card says what it is doing and for how long. */
|
|
2012
|
+
.iw-float-running {
|
|
2013
|
+
display: flex;
|
|
2014
|
+
flex-direction: column;
|
|
2015
|
+
gap: 4px;
|
|
2016
|
+
padding: 8px 10px;
|
|
2017
|
+
margin-top: 4px;
|
|
2018
|
+
border-radius: 10px;
|
|
2019
|
+
background: var(--dsw-alias-bg-layer-2, rgba(127, 127, 127, 0.08));
|
|
2020
|
+
}
|
|
2021
|
+
.iw-float-running-head { display: flex; align-items: center; gap: 6px; }
|
|
2022
|
+
.iw-float-running-dot {
|
|
2023
|
+
width: 6px;
|
|
2024
|
+
height: 6px;
|
|
2025
|
+
border-radius: 50%;
|
|
2026
|
+
background: var(--dsw-alias-label-accent, #4d6bfe);
|
|
2027
|
+
animation: iw-float-pulse 1.2s ease-in-out infinite;
|
|
2028
|
+
}
|
|
2029
|
+
@keyframes iw-float-pulse {
|
|
2030
|
+
0%, 100% { opacity: 0.35; }
|
|
2031
|
+
50% { opacity: 1; }
|
|
2032
|
+
}
|
|
2033
|
+
.iw-float-running-text { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary, #61666b); }
|
|
2034
|
+
.iw-float-running-detail {
|
|
2035
|
+
font-size: 12.5px;
|
|
2036
|
+
line-height: 18px;
|
|
2037
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2038
|
+
font-family: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
2039
|
+
overflow: hidden;
|
|
2040
|
+
text-overflow: ellipsis;
|
|
2041
|
+
white-space: nowrap;
|
|
2042
|
+
}
|
|
2043
|
+
.iw-float-running-step { display: flex; align-items: baseline; gap: 6px; }
|
|
2044
|
+
.iw-float-running-step-text {
|
|
2045
|
+
font-size: 13px;
|
|
2046
|
+
line-height: 20px;
|
|
2047
|
+
color: var(--dsw-alias-label-secondary, #61666b);
|
|
2048
|
+
overflow: hidden;
|
|
2049
|
+
text-overflow: ellipsis;
|
|
2050
|
+
white-space: nowrap;
|
|
2051
|
+
}
|
|
2052
|
+
.iw-float-suggest {
|
|
2053
|
+
position: absolute;
|
|
2054
|
+
left: 8px;
|
|
2055
|
+
right: 8px;
|
|
2056
|
+
bottom: calc(100% + 6px);
|
|
2057
|
+
z-index: 20;
|
|
2058
|
+
max-height: 240px;
|
|
2059
|
+
overflow: auto;
|
|
2060
|
+
padding: 4px;
|
|
2061
|
+
border-radius: 12px;
|
|
2062
|
+
border: 0.5px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.12));
|
|
2063
|
+
background: var(--dsw-alias-bg-layer-1, rgba(28, 30, 34, 0.98));
|
|
2064
|
+
box-shadow: var(--dsw-elevation-prominent, 0 10px 24px rgba(0, 0, 0, 0.35));
|
|
2065
|
+
}
|
|
2066
|
+
.iw-float-suggest-item {
|
|
2067
|
+
display: flex;
|
|
2068
|
+
align-items: baseline;
|
|
2069
|
+
gap: 8px;
|
|
2070
|
+
width: 100%;
|
|
2071
|
+
padding: 6px 8px;
|
|
2072
|
+
border: 0;
|
|
2073
|
+
border-radius: 8px;
|
|
2074
|
+
background: transparent;
|
|
2075
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
2076
|
+
font: inherit;
|
|
2077
|
+
font-size: 14px;
|
|
2078
|
+
text-align: left;
|
|
2079
|
+
cursor: pointer;
|
|
2080
|
+
}
|
|
2081
|
+
.iw-float-suggest-item.on { background: var(--dsw-alias-bg-layer-2, rgba(255, 255, 255, 0.08)); }
|
|
2082
|
+
.iw-float-suggest-section {
|
|
2083
|
+
padding: 8px 8px 4px;
|
|
2084
|
+
font-size: 12px;
|
|
2085
|
+
line-height: 18px;
|
|
2086
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2087
|
+
}
|
|
2088
|
+
.iw-float-suggest-alias { flex: 0 0 auto; font-size: 12.5px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2089
|
+
.iw-float-suggest-name { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2090
|
+
.iw-float-suggest-hint { flex: 0 0 auto; font-size: 12px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2091
|
+
.iw-float-suggest-desc {
|
|
2092
|
+
flex: 1 1 auto;
|
|
2093
|
+
overflow: hidden;
|
|
2094
|
+
text-overflow: ellipsis;
|
|
2095
|
+
white-space: nowrap;
|
|
2096
|
+
text-align: right;
|
|
2097
|
+
font-size: 12.5px;
|
|
2098
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2099
|
+
}
|
|
1868
2100
|
.iw-float-menu {
|
|
1869
2101
|
display: flex;
|
|
1870
2102
|
flex-direction: column;
|
|
@@ -1895,22 +2127,29 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
1895
2127
|
}
|
|
1896
2128
|
.iw-float-menu-item:hover { background: var(--dsw-alias-card-fill-hover, rgba(255, 255, 255, 0.08)); }
|
|
1897
2129
|
.iw-float-menu-item.on { color: var(--dsw-alias-state-success-primary, #3fa55a); }
|
|
1898
|
-
.iw-float-menu-group { font-size:
|
|
1899
|
-
.iw-float-menu-empty { padding: 8px 10px; font-size:
|
|
2130
|
+
.iw-float-menu-group { font-size: 12px; color: var(--dsw-alias-label-tertiary, inherit); white-space: nowrap; }
|
|
2131
|
+
.iw-float-menu-empty { padding: 8px 10px; font-size: 14px; color: var(--dsw-alias-label-tertiary, inherit); }
|
|
1900
2132
|
/* Markdown tables: full width, scrolls sideways only when it must. */
|
|
1901
|
-
|
|
1902
|
-
.iw-float-md-
|
|
2133
|
+
/* Same table as the conversation's: hairline rows, no grid, 13px text. */
|
|
2134
|
+
.iw-float-md-tablewrap { overflow-x: auto; margin: 8px 0; }
|
|
2135
|
+
.iw-float-md-table {
|
|
2136
|
+
border-collapse: collapse;
|
|
2137
|
+
width: 100%;
|
|
2138
|
+
max-width: 100%;
|
|
2139
|
+
font-size: 13px;
|
|
2140
|
+
line-height: 22px;
|
|
2141
|
+
}
|
|
1903
2142
|
.iw-float-md-table th,
|
|
1904
2143
|
.iw-float-md-table td {
|
|
1905
|
-
border: 0
|
|
1906
|
-
|
|
2144
|
+
border: 0;
|
|
2145
|
+
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.22));
|
|
2146
|
+
padding: 10px 16px 10px 0;
|
|
1907
2147
|
vertical-align: top;
|
|
1908
2148
|
text-align: left;
|
|
2149
|
+
font-weight: 400;
|
|
1909
2150
|
}
|
|
1910
|
-
.iw-float-md-table th {
|
|
1911
|
-
|
|
1912
|
-
font-weight: 600;
|
|
1913
|
-
}
|
|
2151
|
+
.iw-float-md-table th { font-weight: 500; }
|
|
2152
|
+
.iw-float-md-table tr:last-child td { border-bottom: 0; }
|
|
1914
2153
|
.iw-float-md-left { text-align: left; }
|
|
1915
2154
|
.iw-float-md-center { text-align: center; }
|
|
1916
2155
|
.iw-float-md-right { text-align: right; }
|
|
@@ -1953,7 +2192,7 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
1953
2192
|
background: var(--dsw-alias-blue-tint, rgba(64, 128, 255, 0.18));
|
|
1954
2193
|
border: 0.5px solid var(--dsw-alias-blue-border, rgba(96, 150, 255, 0.55));
|
|
1955
2194
|
color: var(--dsw-alias-label-link, #6ea8ff);
|
|
1956
|
-
font-size:
|
|
2195
|
+
font-size: 12px;
|
|
1957
2196
|
line-height: 17px;
|
|
1958
2197
|
}
|
|
1959
2198
|
.iw-float-chip-ref-text {
|
|
@@ -2103,7 +2342,7 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2103
2342
|
}
|
|
2104
2343
|
.iw-float-group-current > .iw-float-group-head { color: var(--dsw-alias-label-secondary, inherit); }
|
|
2105
2344
|
.iw-float-title {
|
|
2106
|
-
font-size:
|
|
2345
|
+
font-size: 14px;
|
|
2107
2346
|
font-weight: 600;
|
|
2108
2347
|
overflow: hidden;
|
|
2109
2348
|
text-overflow: ellipsis;
|
|
@@ -2128,7 +2367,7 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2128
2367
|
display: flex;
|
|
2129
2368
|
flex: 1 1 auto;
|
|
2130
2369
|
flex-direction: column;
|
|
2131
|
-
gap:
|
|
2370
|
+
gap: 20px;
|
|
2132
2371
|
/* A flex item's automatic minimum is its content, which pushed the composer
|
|
2133
2372
|
below the card's border once the transcript grew. */
|
|
2134
2373
|
min-height: 0;
|
|
@@ -2136,73 +2375,190 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2136
2375
|
padding: 2px 0;
|
|
2137
2376
|
}
|
|
2138
2377
|
.iw-float-empty { font-size: 12px; color: var(--dsw-alias-label-tertiary, inherit); padding: 6px 0; }
|
|
2139
|
-
|
|
2140
|
-
|
|
2378
|
+
/* Transcript rows, shaped like the conversation: the user side is a
|
|
2379
|
+
right-aligned bubble with a clock under it, the assistant side is plain
|
|
2380
|
+
full-width markdown. Measured off DSH: bubble 20px corners, 10px 16px,
|
|
2381
|
+
14px/22px; body 14px/24px with 16px paragraph rhythm. */
|
|
2382
|
+
.iw-float-row { display: flex; flex-direction: column; }
|
|
2383
|
+
.iw-float-assistant {
|
|
2384
|
+
font-size: 14px;
|
|
2385
|
+
line-height: 24px;
|
|
2386
|
+
}
|
|
2387
|
+
.iw-float-user {
|
|
2388
|
+
align-items: flex-end;
|
|
2389
|
+
gap: 6px;
|
|
2390
|
+
font-size: 14px;
|
|
2391
|
+
line-height: 22px;
|
|
2392
|
+
}
|
|
2393
|
+
.iw-float-bubble {
|
|
2394
|
+
max-width: min(477px, 82%);
|
|
2395
|
+
padding: 10px 16px;
|
|
2396
|
+
border-radius: var(--dsw-radius-xl, 20px);
|
|
2397
|
+
background: var(--dsw-specific-bubble, #edf3fe);
|
|
2398
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
2399
|
+
font-size: 14px;
|
|
2400
|
+
line-height: 22px;
|
|
2401
|
+
word-break: break-word;
|
|
2402
|
+
}
|
|
2403
|
+
.iw-float-bubble .iw-float-md { line-height: 22px; }
|
|
2404
|
+
/* An open question is a card, matching the conversation's own: an 11px eyebrow,
|
|
2405
|
+
a 16px question, numbered options, and the way back to the conversation. */
|
|
2406
|
+
.iw-float-ask {
|
|
2407
|
+
align-self: stretch;
|
|
2408
|
+
border-radius: 16px;
|
|
2409
|
+
background: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
2410
|
+
/* The conversation's card has no border: a hairline ring plus two soft
|
|
2411
|
+
shadows is what lifts it off the page. */
|
|
2412
|
+
box-shadow: 0 0 0 0.5px var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.1)), 0 3px 8px rgba(0, 0, 0, 0.03), 0 0 16px rgba(0, 0, 0, 0.02);
|
|
2413
|
+
padding: 14px 16px 12px;
|
|
2414
|
+
display: flex;
|
|
2415
|
+
flex-direction: column;
|
|
2416
|
+
gap: 10px;
|
|
2417
|
+
}
|
|
2418
|
+
.iw-float-ask-head { display: flex; flex-direction: column; gap: 2px; }
|
|
2419
|
+
.iw-float-ask-eyebrow { font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2420
|
+
.iw-float-ask-title { font-size: 16px; line-height: 24px; color: var(--dsw-alias-label-primary, inherit); }
|
|
2421
|
+
.iw-float-ask-options { display: flex; flex-direction: column; gap: 8px; }
|
|
2422
|
+
.iw-float-ask-option {
|
|
2423
|
+
display: flex;
|
|
2424
|
+
align-items: center;
|
|
2425
|
+
gap: 8px;
|
|
2426
|
+
padding: 8px 12px 8px 8px;
|
|
2427
|
+
border-radius: 12px;
|
|
2428
|
+
}
|
|
2429
|
+
.iw-float-ask-index {
|
|
2430
|
+
flex: 0 0 auto;
|
|
2431
|
+
width: 20px;
|
|
2432
|
+
height: 20px;
|
|
2433
|
+
border-radius: 4px;
|
|
2434
|
+
background: var(--dsw-alias-bg-layer-3, rgba(0, 0, 0, 0.06));
|
|
2435
|
+
color: var(--dsw-alias-label-secondary, #61666b);
|
|
2436
|
+
font-size: 12px;
|
|
2437
|
+
line-height: 20px;
|
|
2438
|
+
text-align: center;
|
|
2439
|
+
}
|
|
2440
|
+
.iw-float-ask-label { font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary, inherit); }
|
|
2441
|
+
.iw-float-ask-desc { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2442
|
+
.iw-float-ask-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
2443
|
+
.iw-float-ask-hint { font-size: 12.5px; line-height: 18px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2444
|
+
.iw-float-ask-go { flex: 0 0 auto; }
|
|
2445
|
+
/* The问答 card, borrowed from the conversation: the bubble is the user's own,
|
|
2446
|
+
header and question in the secondary colour, the picked answer in primary. */
|
|
2447
|
+
.iw-float-question { display: flex; flex-direction: column; }
|
|
2448
|
+
.iw-float-q-head { font-size: 12.5px; line-height: 20px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2449
|
+
.iw-float-q-ask { font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-secondary, #61666b); }
|
|
2450
|
+
.iw-float-q-answer { font-size: 14px; line-height: 22px; color: var(--dsw-alias-label-primary, inherit); margin-top: 4px; }
|
|
2451
|
+
.iw-float-q-wait { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-tertiary, #81858c); margin-top: 4px; }
|
|
2452
|
+
.iw-float-meta {
|
|
2453
|
+
display: flex;
|
|
2454
|
+
align-items: center;
|
|
2455
|
+
gap: 6px;
|
|
2456
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2457
|
+
}
|
|
2458
|
+
.iw-float-clock { font-size: 13px; line-height: 20px; }
|
|
2459
|
+
.iw-float-copy {
|
|
2460
|
+
display: inline-flex;
|
|
2461
|
+
align-items: center;
|
|
2462
|
+
justify-content: center;
|
|
2463
|
+
width: 22px;
|
|
2464
|
+
height: 20px;
|
|
2465
|
+
padding: 0;
|
|
2466
|
+
border: 0;
|
|
2467
|
+
border-radius: 6px;
|
|
2468
|
+
background: transparent;
|
|
2469
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2470
|
+
cursor: pointer;
|
|
2471
|
+
}
|
|
2472
|
+
.iw-float-copy:hover { background: var(--dsw-alias-bg-layer-3, rgba(127, 127, 127, 0.12)); }
|
|
2141
2473
|
.iw-float-text {
|
|
2142
|
-
font-size:
|
|
2143
|
-
line-height: 1.
|
|
2474
|
+
font-size: 14px;
|
|
2475
|
+
line-height: 1.6;
|
|
2144
2476
|
white-space: pre-wrap;
|
|
2145
2477
|
word-break: break-word;
|
|
2146
2478
|
}
|
|
2147
|
-
.iw-float-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
background: var(--dsw-alias-card-fill, rgba(255, 255, 255, 0.06));
|
|
2151
|
-
}
|
|
2152
|
-
.iw-float-md { font-size: 12.5px; line-height: 1.55; word-break: break-word; }
|
|
2153
|
-
.iw-float-md-p { margin: 0 0 6px; }
|
|
2479
|
+
.iw-float-md { font-size: 14px; line-height: 24px; word-break: break-word; }
|
|
2480
|
+
.iw-float-md-p { margin: 16px 0; }
|
|
2481
|
+
.iw-float-md-p:first-child { margin-top: 0; }
|
|
2154
2482
|
.iw-float-md-p:last-child { margin-bottom: 0; }
|
|
2155
|
-
.iw-float-md-h { margin:
|
|
2156
|
-
.iw-float-md-
|
|
2157
|
-
.iw-float-md-
|
|
2158
|
-
.iw-float-md-
|
|
2159
|
-
.iw-float-md-
|
|
2160
|
-
.iw-float-md-
|
|
2483
|
+
.iw-float-md-h { margin: 32px 0 16px; font-weight: 600; line-height: 1.3; }
|
|
2484
|
+
.iw-float-md-h4, .iw-float-md-h5, .iw-float-md-h6 { margin: 16px 0; }
|
|
2485
|
+
.iw-float-md-h1 { font-size: 24px; }
|
|
2486
|
+
.iw-float-md-h2 { font-size: 20px; }
|
|
2487
|
+
.iw-float-md-h3 { font-size: 16px; }
|
|
2488
|
+
.iw-float-md-h4 { font-size: 14px; }
|
|
2489
|
+
.iw-float-md-h5, .iw-float-md-h6 { font-size: 14px; }
|
|
2490
|
+
.iw-float-md-list { margin: 16px 0; padding-left: 18px; }
|
|
2491
|
+
.iw-float-md-list li { margin: 0; }
|
|
2492
|
+
.iw-float-md-list li:not(:first-child) { margin-top: 6px; }
|
|
2493
|
+
/* Inline code, measured off the conversation's own rule (not-pre > code):
|
|
2494
|
+
inline-flex keeps the snippet on one line instead of breaking a path
|
|
2495
|
+
mid-word, 0.875em + a 0.5px hairline + 8px corners. */
|
|
2161
2496
|
.iw-float-md-code {
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2497
|
+
display: inline-flex;
|
|
2498
|
+
align-items: center;
|
|
2499
|
+
box-sizing: border-box;
|
|
2500
|
+
padding: 0 5px;
|
|
2501
|
+
border-radius: var(--dsw-radius-sm, 8px);
|
|
2502
|
+
border: 0.5px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.24));
|
|
2503
|
+
background: var(--dsw-alias-markdown-inline-code, color-mix(in srgb, currentColor 7%, transparent));
|
|
2504
|
+
font-family: var(--ds-font-family-code, "SF Mono", ui-monospace, Menlo, monospace);
|
|
2505
|
+
font-size: 0.875em;
|
|
2506
|
+
line-height: inherit;
|
|
2507
|
+
color: inherit;
|
|
2167
2508
|
}
|
|
2509
|
+
/* The conversation keeps the same 0.875em inside tables (11.375px at 13px). */
|
|
2510
|
+
.iw-float-md-table code { font-size: 0.875em; }
|
|
2168
2511
|
.iw-float-md-link { color: var(--dsw-alias-brand-primary, #4b8bf5); text-decoration: none; }
|
|
2169
2512
|
.iw-float-md-link:hover { text-decoration: underline; }
|
|
2513
|
+
/* Shaped like the conversation's block: 16px corners, a 42px header with the
|
|
2514
|
+
block name on the left and wrap/copy on the right, 11px/19px SF Mono body. */
|
|
2170
2515
|
.iw-float-md-codeblock {
|
|
2171
|
-
margin:
|
|
2172
|
-
border:
|
|
2173
|
-
border-radius: 8px;
|
|
2516
|
+
margin: 8px 0;
|
|
2517
|
+
border-radius: 16px;
|
|
2174
2518
|
overflow: hidden;
|
|
2175
|
-
background: var(--dsw-alias-
|
|
2519
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary, #0f1115) 4%, transparent);
|
|
2176
2520
|
}
|
|
2177
2521
|
.iw-float-md-codehead {
|
|
2178
2522
|
display: flex;
|
|
2179
2523
|
align-items: center;
|
|
2180
2524
|
justify-content: space-between;
|
|
2181
|
-
|
|
2182
|
-
|
|
2525
|
+
height: 42px;
|
|
2526
|
+
padding: 0 10px 0 22px;
|
|
2183
2527
|
color: var(--dsw-alias-label-tertiary, inherit);
|
|
2184
|
-
font-size:
|
|
2528
|
+
font-size: 11px;
|
|
2185
2529
|
}
|
|
2186
|
-
.iw-float-md-
|
|
2187
|
-
|
|
2530
|
+
.iw-float-md-codelang { color: var(--dsw-alias-label-tertiary, inherit); }
|
|
2531
|
+
.iw-float-md-codeacts { display: flex; align-items: center; gap: 2px; }
|
|
2532
|
+
.iw-float-md-codeact {
|
|
2533
|
+
display: grid;
|
|
2534
|
+
place-items: center;
|
|
2535
|
+
width: 24px;
|
|
2536
|
+
height: 24px;
|
|
2188
2537
|
padding: 0;
|
|
2538
|
+
border: 0;
|
|
2539
|
+
border-radius: 6px;
|
|
2189
2540
|
background: transparent;
|
|
2190
|
-
color: inherit;
|
|
2191
|
-
font: inherit;
|
|
2541
|
+
color: var(--dsw-alias-label-tertiary, inherit);
|
|
2192
2542
|
cursor: pointer;
|
|
2193
2543
|
}
|
|
2194
|
-
.iw-float-md-
|
|
2544
|
+
.iw-float-md-codeact:hover {
|
|
2545
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
2546
|
+
background: color-mix(in srgb, var(--dsw-alias-label-primary, #0f1115) 8%, transparent);
|
|
2547
|
+
}
|
|
2548
|
+
.iw-float-md-codeact.on { color: var(--dsw-alias-label-primary, inherit); }
|
|
2195
2549
|
.iw-float-md-pre {
|
|
2196
2550
|
margin: 0;
|
|
2197
|
-
padding: 6px
|
|
2551
|
+
padding: 6px 22px 20px;
|
|
2198
2552
|
overflow-x: hidden;
|
|
2199
2553
|
overflow-y: auto;
|
|
2200
|
-
max-height:
|
|
2201
|
-
font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace);
|
|
2202
|
-
font-size:
|
|
2203
|
-
line-height:
|
|
2554
|
+
max-height: 260px;
|
|
2555
|
+
font-family: var(--ds-font-family-code, "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace);
|
|
2556
|
+
font-size: 11px;
|
|
2557
|
+
line-height: 19px;
|
|
2558
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
2204
2559
|
}
|
|
2205
|
-
.iw-float-md-line { white-space: pre
|
|
2560
|
+
.iw-float-md-line { white-space: pre; }
|
|
2561
|
+
.iw-float-md-wrapped .iw-float-md-line { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
|
|
2206
2562
|
/* Long code lines wrap inside the narrow card instead of scrolling sideways. */
|
|
2207
2563
|
.iw-float-md-quote {
|
|
2208
2564
|
margin: 6px 0;
|
|
@@ -2261,39 +2617,108 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2261
2617
|
.iw-float-add { color: var(--dsw-alias-state-success-primary, #3fa55a); }
|
|
2262
2618
|
.iw-float-del { color: var(--dsw-alias-state-danger-primary, #e5534b); }
|
|
2263
2619
|
.iw-float-running { font-size: 11.5px; color: var(--dsw-alias-label-tertiary, inherit); }
|
|
2620
|
+
/* The composer, shaped like DSH's own: one round container holding the field
|
|
2621
|
+
and a control row — attach, permission, model, round send. */
|
|
2264
2622
|
.iw-float-input {
|
|
2623
|
+
/* The suggestion list is absolutely positioned above this box, so the box is
|
|
2624
|
+
its containing block. */
|
|
2625
|
+
position: relative;
|
|
2265
2626
|
display: flex;
|
|
2266
2627
|
flex: 0 0 auto;
|
|
2267
2628
|
flex-direction: column;
|
|
2268
2629
|
gap: 6px;
|
|
2269
|
-
|
|
2270
|
-
|
|
2630
|
+
padding: 10px 10px 8px 14px;
|
|
2631
|
+
border: 0.5px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.22));
|
|
2632
|
+
border-radius: 16px;
|
|
2633
|
+
background: var(--dsw-alias-bg-layer-1, transparent);
|
|
2271
2634
|
}
|
|
2272
2635
|
.iw-float-textarea {
|
|
2273
2636
|
width: 100%;
|
|
2637
|
+
min-height: 44px;
|
|
2638
|
+
max-height: 140px;
|
|
2274
2639
|
resize: none;
|
|
2275
|
-
padding:
|
|
2276
|
-
border:
|
|
2277
|
-
|
|
2278
|
-
background: var(--dsw-alias-bg-layer-2, rgba(255, 255, 255, 0.04));
|
|
2640
|
+
padding: 0;
|
|
2641
|
+
border: 0;
|
|
2642
|
+
background: transparent;
|
|
2279
2643
|
color: var(--dsw-alias-label-primary, inherit);
|
|
2280
2644
|
font: inherit;
|
|
2281
|
-
font-size:
|
|
2282
|
-
line-height:
|
|
2645
|
+
font-size: 14px;
|
|
2646
|
+
line-height: 22px;
|
|
2283
2647
|
}
|
|
2284
|
-
.iw-float-textarea
|
|
2648
|
+
.iw-float-textarea::placeholder { color: var(--dsw-alias-label-tertiary, inherit); }
|
|
2649
|
+
.iw-float-textarea:focus { outline: none; }
|
|
2650
|
+
.iw-float-foot { display: flex; align-items: center; gap: 6px; }
|
|
2651
|
+
.iw-float-plus {
|
|
2652
|
+
display: grid;
|
|
2653
|
+
place-items: center;
|
|
2654
|
+
width: 28px;
|
|
2655
|
+
height: 28px;
|
|
2656
|
+
flex: 0 0 auto;
|
|
2657
|
+
padding: 0;
|
|
2658
|
+
border: 0.5px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.22));
|
|
2659
|
+
border-radius: 50%;
|
|
2660
|
+
background: transparent;
|
|
2661
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
2662
|
+
cursor: pointer;
|
|
2663
|
+
}
|
|
2664
|
+
.iw-float-plus:hover { background: var(--dsw-alias-card-fill-hover, rgba(127, 127, 127, 0.1)); }
|
|
2665
|
+
.iw-float-perm {
|
|
2666
|
+
display: inline-flex;
|
|
2667
|
+
align-items: center;
|
|
2668
|
+
gap: 4px;
|
|
2669
|
+
flex: 0 0 auto;
|
|
2670
|
+
max-width: 46%;
|
|
2671
|
+
padding: 4px 8px;
|
|
2672
|
+
border: 0.5px solid var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.22));
|
|
2673
|
+
border-radius: 999px;
|
|
2674
|
+
background: transparent;
|
|
2675
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
2676
|
+
font: inherit;
|
|
2677
|
+
font-size: 13px;
|
|
2678
|
+
cursor: pointer;
|
|
2679
|
+
}
|
|
2680
|
+
.iw-float-perm:hover { background: var(--dsw-alias-card-fill-hover, rgba(127, 127, 127, 0.1)); }
|
|
2681
|
+
.iw-float-perm-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2682
|
+
.iw-float-foot-chip {
|
|
2683
|
+
display: inline-flex;
|
|
2684
|
+
align-items: center;
|
|
2685
|
+
gap: 2px;
|
|
2686
|
+
flex: 0 1 auto;
|
|
2687
|
+
min-width: 0;
|
|
2688
|
+
padding: 4px 6px;
|
|
2689
|
+
border: 0;
|
|
2690
|
+
border-radius: 8px;
|
|
2691
|
+
background: transparent;
|
|
2692
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
2693
|
+
font: inherit;
|
|
2694
|
+
font-size: 13px;
|
|
2695
|
+
cursor: pointer;
|
|
2696
|
+
}
|
|
2697
|
+
.iw-float-foot-chip:hover { background: var(--dsw-alias-card-fill-hover, rgba(127, 127, 127, 0.1)); }
|
|
2698
|
+
.iw-float-foot-chip-text {
|
|
2699
|
+
overflow: hidden;
|
|
2700
|
+
text-overflow: ellipsis;
|
|
2701
|
+
white-space: nowrap;
|
|
2702
|
+
max-width: 220px;
|
|
2703
|
+
}
|
|
2704
|
+
.iw-float-foot-model { max-width: 46%; }
|
|
2285
2705
|
.iw-float-send {
|
|
2286
|
-
|
|
2287
|
-
|
|
2706
|
+
display: grid;
|
|
2707
|
+
place-items: center;
|
|
2708
|
+
width: 30px;
|
|
2709
|
+
height: 30px;
|
|
2710
|
+
flex: 0 0 auto;
|
|
2711
|
+
margin-left: 2px;
|
|
2712
|
+
padding: 0;
|
|
2288
2713
|
border: 0;
|
|
2289
|
-
border-radius:
|
|
2714
|
+
border-radius: 50%;
|
|
2290
2715
|
background: var(--dsw-alias-bg-accent, #3b6ef0);
|
|
2291
2716
|
color: #fff;
|
|
2292
|
-
font: inherit;
|
|
2293
|
-
font-size: 12px;
|
|
2294
2717
|
cursor: pointer;
|
|
2295
2718
|
}
|
|
2296
|
-
.iw-float-send:
|
|
2719
|
+
.iw-float-send:hover { filter: brightness(1.06); }
|
|
2720
|
+
.iw-float-send:disabled { opacity: 0.8; cursor: default; filter: none; }
|
|
2721
|
+
.iw-float-stop { background: var(--dsw-alias-label-primary, #333); color: var(--dsw-alias-bg-layer-1, #fff); }
|
|
2297
2722
|
/* Resize: four edge strips plus a marked corner. The strips are invisible but
|
|
2298
2723
|
wide enough to hit, and each carries the cursor the edge implies. */
|
|
2299
2724
|
.iw-float-grip { position: absolute; touch-action: none; z-index: 2; }
|
|
@@ -2841,44 +3266,6 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2841
3266
|
font-weight: 400;
|
|
2842
3267
|
}
|
|
2843
3268
|
|
|
2844
|
-
/* The turn's changed files, right under the transcript. */
|
|
2845
|
-
.iw-float-changes {
|
|
2846
|
-
display: flex;
|
|
2847
|
-
flex-direction: column;
|
|
2848
|
-
gap: 2px;
|
|
2849
|
-
padding: 6px 8px;
|
|
2850
|
-
border-radius: 8px;
|
|
2851
|
-
border: 0.5px solid var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.12));
|
|
2852
|
-
background: var(--dsw-alias-card-fill, rgba(255, 255, 255, 0.05));
|
|
2853
|
-
}
|
|
2854
|
-
.iw-float-changes-head {
|
|
2855
|
-
display: flex;
|
|
2856
|
-
align-items: center;
|
|
2857
|
-
gap: 6px;
|
|
2858
|
-
border: 0;
|
|
2859
|
-
background: transparent;
|
|
2860
|
-
color: inherit;
|
|
2861
|
-
font: inherit;
|
|
2862
|
-
font-size: 12px;
|
|
2863
|
-
padding: 0;
|
|
2864
|
-
cursor: pointer;
|
|
2865
|
-
text-align: left;
|
|
2866
|
-
}
|
|
2867
|
-
.iw-float-changes-icon { opacity: 0.6; }
|
|
2868
|
-
.iw-float-changes-title { flex: 1 1 auto; }
|
|
2869
|
-
.iw-float-changes-add { color: var(--dsw-alias-state-success-primary, #3fa55a); font-variant-numeric: tabular-nums; }
|
|
2870
|
-
.iw-float-changes-del { color: var(--dsw-alias-state-danger-primary, #e5534b); font-variant-numeric: tabular-nums; }
|
|
2871
|
-
.iw-float-changes-list { display: flex; flex-direction: column; }
|
|
2872
|
-
.iw-float-changes-more {
|
|
2873
|
-
border: 0;
|
|
2874
|
-
background: transparent;
|
|
2875
|
-
color: var(--dsw-alias-label-link, #6ea8ff);
|
|
2876
|
-
font: inherit;
|
|
2877
|
-
font-size: 11.5px;
|
|
2878
|
-
padding: 2px 0 0;
|
|
2879
|
-
cursor: pointer;
|
|
2880
|
-
text-align: left;
|
|
2881
|
-
}
|
|
2882
3269
|
/* Full-size picture viewer over the card. */
|
|
2883
3270
|
.iw-float-viewer {
|
|
2884
3271
|
position: absolute;
|
|
@@ -2913,7 +3300,7 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2913
3300
|
font-size: 12.5px;
|
|
2914
3301
|
color: var(--dsw-alias-label-secondary, inherit);
|
|
2915
3302
|
}
|
|
2916
|
-
.iw-md-bar
|
|
3303
|
+
.iw-md-bar { justify-content: flex-end; }
|
|
2917
3304
|
.iw-md-body { max-width: 860px; width: 100%; }
|
|
2918
3305
|
.iw-md-body .iw-float-md { font-size: 14px; line-height: 1.7; }
|
|
2919
3306
|
.iw-md-body .iw-float-md-h1 { font-size: 22px; margin: 18px 0 10px; }
|
|
@@ -2922,7 +3309,7 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2922
3309
|
.iw-md-body .iw-float-md-p { margin: 8px 0; }
|
|
2923
3310
|
.iw-md-body .iw-float-md-list { margin: 6px 0; padding-left: 22px; }
|
|
2924
3311
|
.iw-md-body .iw-float-md-table { font-size: 13px; }
|
|
2925
|
-
.iw-md-body .iw-float-md-pre { font-size:
|
|
3312
|
+
.iw-md-body .iw-float-md-pre { font-size: 11px; }
|
|
2926
3313
|
`
|
|
2927
3314
|
|
|
2928
3315
|
/** Render the stylesheet as a React element so unmounting removes it. */
|
|
@@ -2952,6 +3339,23 @@ function ideSvg(size, children, strokeWidth = 1.3) {
|
|
|
2952
3339
|
}, children)
|
|
2953
3340
|
}
|
|
2954
3341
|
|
|
3342
|
+
/** Terminal prompt (`>_`): marks a Tool step in the conversation. */
|
|
3343
|
+
function IdeTerminalIcon({ size = 15 }) {
|
|
3344
|
+
return ideSvg(size, [
|
|
3345
|
+
h('rect', { key: 'r', x: 1.4, y: 2.6, width: 13.2, height: 10.8, rx: 3 }),
|
|
3346
|
+
h('path', { key: 'p', d: 'M4.6 6.4 6.6 8 4.6 9.6' }),
|
|
3347
|
+
h('path', { key: 'u', d: 'M8.4 10h3' }),
|
|
3348
|
+
])
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
/** Sparkle: the conversation's 「深度求索中」 marker. */
|
|
3352
|
+
function IdeSparkleIcon({ size = 15 }) {
|
|
3353
|
+
return ideSvg(size, [
|
|
3354
|
+
h('path', { key: 'a', d: 'M8 2.2l1.15 3.05L12.2 6.4 9.15 7.55 8 10.6 6.85 7.55 3.8 6.4 6.85 5.25z' }),
|
|
3355
|
+
h('path', { key: 'b', d: 'M12.4 10.6l.55 1.45 1.45.55-1.45.55-.55 1.45-.55-1.45-1.45-.55 1.45-.55z' }),
|
|
3356
|
+
])
|
|
3357
|
+
}
|
|
3358
|
+
|
|
2955
3359
|
/** Chevron used by the tree rows. */
|
|
2956
3360
|
function IdeChevron({ open, size = 12 }) {
|
|
2957
3361
|
return ideSvg(size, [
|
|
@@ -3138,6 +3542,35 @@ function IdeEntryIcon({ name, kind = '', size = IDE_ENTRY_ICON_SIZE }) {
|
|
|
3138
3542
|
return h(IdeFileBadgeIcon, { letter: ideFileLetter(name), tint: ideTintOf(ideLangOf(name)), size })
|
|
3139
3543
|
}
|
|
3140
3544
|
|
|
3545
|
+
/** Plus: the composer's attach menu. */
|
|
3546
|
+
function IdePlusIcon({ size = 16 }) {
|
|
3547
|
+
return ideSvg(size, [h('path', { key: 'a', d: 'M8 3.5v9M3.5 8h9' })])
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
/** Chevron: this control opens a menu. */
|
|
3551
|
+
function IdeChevronDownIcon({ size = 12 }) {
|
|
3552
|
+
return ideSvg(size, [h('path', { key: 'a', d: 'M4 6.5 8 10l4-3.5' })])
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
/** Send: an arrow leaving the composer. */
|
|
3556
|
+
function IdeArrowUpIcon({ size = 16 }) {
|
|
3557
|
+
return ideSvg(size, [h('path', { key: 'a', d: 'M8 12.5v-9M4 7.5 8 3.5l4 4' })])
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
/** Stop: the running turn's cancel button. */
|
|
3561
|
+
function IdeStopMarkIcon({ size = 12 }) {
|
|
3562
|
+
return ideSvg(size, [h('rect', { key: 'a', x: 4, y: 4, width: 8, height: 8, rx: 1.6, fill: 'currentColor', stroke: 'none' })])
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
/** Wrap: fold a long line back into the block's width. */
|
|
3566
|
+
function IdeWrapIcon({ size = 15 }) {
|
|
3567
|
+
return ideSvg(size, [
|
|
3568
|
+
h('path', { key: 'a', d: 'M2 4h12M2 8h8.5a2 2 0 0 1 0 4H8' }),
|
|
3569
|
+
h('path', { key: 'b', d: 'M9.5 10.5 7.5 12l2 1.5' }),
|
|
3570
|
+
h('path', { key: 'c', d: 'M2 12h3' }),
|
|
3571
|
+
])
|
|
3572
|
+
}
|
|
3573
|
+
|
|
3141
3574
|
/** Crosshair: reveal the active file in the tree. */
|
|
3142
3575
|
function IdeLocateIcon({ size = 15 }) {
|
|
3143
3576
|
return ideSvg(size, [
|
|
@@ -3379,6 +3812,18 @@ const IDE_SHORTCUTS = [
|
|
|
3379
3812
|
},
|
|
3380
3813
|
action: 'back',
|
|
3381
3814
|
},
|
|
3815
|
+
{
|
|
3816
|
+
id: 'dsh-ide-window.float-toggle',
|
|
3817
|
+
kind: 'key',
|
|
3818
|
+
labelKey: 'shortcutFloatToggle',
|
|
3819
|
+
aliases: ['float', 'assistant', 'card', '悬浮', '悬浮框', '助手', '浮窗'],
|
|
3820
|
+
// 两个运行时都用 ⌥+空格:不占字母键,在输入框里也能用
|
|
3821
|
+
defaults: {
|
|
3822
|
+
desktop: { code: 'Space', modifiers: ['alt'] },
|
|
3823
|
+
web: { code: 'Space', modifiers: ['alt'] },
|
|
3824
|
+
},
|
|
3825
|
+
action: 'float-toggle',
|
|
3826
|
+
},
|
|
3382
3827
|
{
|
|
3383
3828
|
id: 'code-workspace.search-everywhere',
|
|
3384
3829
|
kind: 'sequence',
|
|
@@ -3786,12 +4231,17 @@ function ideWritePrefs(patch) {
|
|
|
3786
4231
|
}
|
|
3787
4232
|
}
|
|
3788
4233
|
|
|
3789
|
-
/**
|
|
3790
|
-
|
|
4234
|
+
/**
|
|
4235
|
+
* The floating card's shipped size, and the bounds the settings page accepts.
|
|
4236
|
+
*
|
|
4237
|
+
* The width matches DSH's own conversation column (744px at the reference
|
|
4238
|
+
* viewport), so the card reads at the same measure as the chat behind it.
|
|
4239
|
+
*/
|
|
4240
|
+
const IDE_FLOAT_DEFAULT_WIDTH = 744
|
|
3791
4241
|
const IDE_FLOAT_DEFAULT_HEIGHT = 560
|
|
3792
4242
|
const IDE_FLOAT_MIN_WIDTH = 280
|
|
3793
4243
|
const IDE_FLOAT_MIN_HEIGHT = 220
|
|
3794
|
-
const IDE_FLOAT_MAX_WIDTH =
|
|
4244
|
+
const IDE_FLOAT_MAX_WIDTH = 1200
|
|
3795
4245
|
const IDE_FLOAT_MAX_HEIGHT = 900
|
|
3796
4246
|
|
|
3797
4247
|
/** The card's default size: the preference, clamped, or the shipped size. */
|
|
@@ -4139,8 +4589,10 @@ function ideCreateStore(refs) {
|
|
|
4139
4589
|
sessionId: null,
|
|
4140
4590
|
// The floating quick-ask card: shown whenever the code workspace owns the
|
|
4141
4591
|
// centre column, collapsed to a ball on request.
|
|
4142
|
-
|
|
4143
|
-
|
|
4592
|
+
// A detached card is on screen from the start, wherever the app opens.
|
|
4593
|
+
floatOpen: prefs.floatDetached === true,
|
|
4594
|
+
// 每次打开 DSH 都从「收起来」开始:卡片在,但只占一个小球。
|
|
4595
|
+
floatCollapsed: true,
|
|
4144
4596
|
// Where the user dragged the card (null = the bottom-right corner).
|
|
4145
4597
|
floatX: null,
|
|
4146
4598
|
floatY: null,
|
|
@@ -4153,6 +4605,8 @@ function ideCreateStore(refs) {
|
|
|
4153
4605
|
// The card's lifetime controls: `floatEnabled` is a preference, `floatClosed`
|
|
4154
4606
|
// lasts until DSH restarts (the user asked for "stay closed until restart").
|
|
4155
4607
|
floatEnabled: prefs.floatEnabled !== false,
|
|
4608
|
+
// Detached cards stay on screen in every panel, not only the workspace.
|
|
4609
|
+
floatDetached: prefs.floatDetached === true,
|
|
4156
4610
|
floatClosed: false,
|
|
4157
4611
|
// One reference waiting to be appended to the card's draft.
|
|
4158
4612
|
floatInsert: null,
|
|
@@ -4647,6 +5101,16 @@ function ideCreateStore(refs) {
|
|
|
4647
5101
|
patch({ floatWidth: nextW, floatHeight: nextH })
|
|
4648
5102
|
}
|
|
4649
5103
|
|
|
5104
|
+
/** Keep the card on screen outside the code workspace (persisted). */
|
|
5105
|
+
function setFloatDetached(floatDetached) {
|
|
5106
|
+
const next = floatDetached === true
|
|
5107
|
+
if (state.floatDetached === next) return
|
|
5108
|
+
ideWritePrefs({ floatDetached: next })
|
|
5109
|
+
patch({ floatDetached: next })
|
|
5110
|
+
// Turning it on while away from the workspace brings it back immediately.
|
|
5111
|
+
if (next) patch({ floatOpen: true, floatClosed: false })
|
|
5112
|
+
}
|
|
5113
|
+
|
|
4650
5114
|
/** Turn the floating card on or off (persisted). */
|
|
4651
5115
|
function setFloatEnabled(floatEnabled) {
|
|
4652
5116
|
const next = floatEnabled === true
|
|
@@ -5344,6 +5808,7 @@ function ideCreateStore(refs) {
|
|
|
5344
5808
|
setFloatSize,
|
|
5345
5809
|
setFloatDefaultSize,
|
|
5346
5810
|
setFloatEnabled,
|
|
5811
|
+
setFloatDetached,
|
|
5347
5812
|
setFloatClosed,
|
|
5348
5813
|
setFloatInsert,
|
|
5349
5814
|
setRoot,
|
|
@@ -7907,7 +8372,7 @@ function IdeCodeView({ tab, tr, store, navigate }) {
|
|
|
7907
8372
|
const isMarkdown = tab.kind !== 'jar' && ideIsMarkdownPath(tab.path)
|
|
7908
8373
|
const markdownBar = isMarkdown && tab.status === 'ready'
|
|
7909
8374
|
? h('div', { key: 'mdbar', className: 'iw-md-bar' }, [
|
|
7910
|
-
|
|
8375
|
+
// 文件名不在这里重复:上面的面包屑已经写着同一个名字
|
|
7911
8376
|
h('button', {
|
|
7912
8377
|
key: 'preview',
|
|
7913
8378
|
type: 'button',
|
|
@@ -8920,6 +9385,17 @@ function IdeWorkspaceSettingsSection(props) {
|
|
|
8920
9385
|
onClick: () => store.setFloatEnabled(state.floatEnabled === false),
|
|
8921
9386
|
}, state.floatEnabled !== false ? tr('settingsOn') : tr('settingsOff')),
|
|
8922
9387
|
]),
|
|
9388
|
+
// A card that lives on its own stays visible in other panels too.
|
|
9389
|
+
h('div', { key: 'floatdetach', className: 'iw-settings-item' }, [
|
|
9390
|
+
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatDetach')),
|
|
9391
|
+
h('button', {
|
|
9392
|
+
key: 'b',
|
|
9393
|
+
type: 'button',
|
|
9394
|
+
className: `iw-gesture-chip${state.floatDetached === true ? ' on' : ''}`,
|
|
9395
|
+
title: tr('settingsFloatDetachHint'),
|
|
9396
|
+
onClick: () => store.setFloatDetached(state.floatDetached !== true),
|
|
9397
|
+
}, state.floatDetached === true ? tr('settingsOn') : tr('settingsOff')),
|
|
9398
|
+
]),
|
|
8923
9399
|
h('div', { key: 'floatsize', className: 'iw-settings-item' }, [
|
|
8924
9400
|
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatSize')),
|
|
8925
9401
|
h('button', {
|
|
@@ -13004,8 +13480,17 @@ async function ideDataWindowOpenMapper(store, tr, root, path, symbol, line) {
|
|
|
13004
13480
|
|
|
13005
13481
|
/** How many messages the card keeps on screen. */
|
|
13006
13482
|
const IDE_FLOAT_MESSAGES = 6
|
|
13483
|
+
/** How long after `compositionend` an Enter still counts as "confirm the IME". */
|
|
13484
|
+
const IDE_FLOAT_IME_SETTLE_MS = 80
|
|
13485
|
+
/** Collapsed card: a 44px ball plus the 4px padding the shell adds. */
|
|
13486
|
+
const IDE_FLOAT_BALL = 52
|
|
13487
|
+
/** Gap between the collapsed ball and the window corner. */
|
|
13488
|
+
const IDE_FLOAT_BALL_INSET = 20
|
|
13007
13489
|
/** Re-ask delays after a turn, while its summary is still being recorded. */
|
|
13008
|
-
|
|
13490
|
+
// A turn's summary is written after the reply lands, and a long turn can take
|
|
13491
|
+
// tens of seconds to get there: keep asking instead of showing an older turn.
|
|
13492
|
+
/** DSH's own body size: the card reads at the same measure as the chat. */
|
|
13493
|
+
const IDE_FLOAT_FONT_SIZE = 14
|
|
13009
13494
|
|
|
13010
13495
|
/** Permission presets the workspace switch offers, in DSH's own order. */
|
|
13011
13496
|
const IDE_FLOAT_PERMISSIONS = [
|
|
@@ -13041,50 +13526,273 @@ function ideFloatPresentedFilesOf(data) {
|
|
|
13041
13526
|
description: typeof file.description === 'string' ? file.description : '',
|
|
13042
13527
|
})
|
|
13043
13528
|
}
|
|
13044
|
-
return rows
|
|
13529
|
+
return rows
|
|
13530
|
+
}
|
|
13531
|
+
|
|
13532
|
+
/**
|
|
13533
|
+
* One log window as the card's transcript.
|
|
13534
|
+
*
|
|
13535
|
+
* Only the two message kinds the user wrote and the model answered become rows:
|
|
13536
|
+
* tool calls, reasoning blocks and injected context are not a conversation. The
|
|
13537
|
+
* newest entries win, because the card is a glance, not the transcript view.
|
|
13538
|
+
*
|
|
13539
|
+
* @param entries - `SessionEventLikeEntry[]` from the retained binding.
|
|
13540
|
+
*/
|
|
13541
|
+
/**
|
|
13542
|
+
* The image parts of one message content array.
|
|
13543
|
+
*
|
|
13544
|
+
* The durable log never keeps raw image bytes: the Host promotes them to an
|
|
13545
|
+
* attachment reference (`{type:'image', attachment:{attachmentId,…}}`), and the
|
|
13546
|
+
* bytes come back through `session.readAttachment(ref)`.
|
|
13547
|
+
*/
|
|
13548
|
+
function ideFloatImagesOf(content) {
|
|
13549
|
+
if (!Array.isArray(content)) return []
|
|
13550
|
+
const images = []
|
|
13551
|
+
for (const part of content) {
|
|
13552
|
+
if (part === null || typeof part !== 'object' || part.type !== 'image') continue
|
|
13553
|
+
const attachment = part.attachment
|
|
13554
|
+
if (attachment === null || typeof attachment !== 'object') continue
|
|
13555
|
+
if (typeof attachment.attachmentId !== 'string' || attachment.attachmentId === '') continue
|
|
13556
|
+
// Keep the reference intact: the wire schema wants the complete reference
|
|
13557
|
+
// (`attachmentId` + `mediaType` + `bytes` + `width` + `height`), not a copy
|
|
13558
|
+
// with the fields the card happens to use.
|
|
13559
|
+
images.push({
|
|
13560
|
+
...attachment,
|
|
13561
|
+
mediaType: typeof attachment.mediaType === 'string' ? attachment.mediaType : 'image/png',
|
|
13562
|
+
})
|
|
13563
|
+
}
|
|
13564
|
+
return images
|
|
13565
|
+
}
|
|
13566
|
+
|
|
13567
|
+
/** `HH:MM` for a user row, the way the conversation stamps its bubble. */
|
|
13568
|
+
function ideFloatClock(time) {
|
|
13569
|
+
if (!Number.isFinite(time) || time <= 0) return ''
|
|
13570
|
+
const date = new Date(time)
|
|
13571
|
+
const hours = String(date.getHours()).padStart(2, '0')
|
|
13572
|
+
const minutes = String(date.getMinutes()).padStart(2, '0')
|
|
13573
|
+
return `${hours}:${minutes}`
|
|
13574
|
+
}
|
|
13575
|
+
|
|
13576
|
+
/**
|
|
13577
|
+
* One transcript row: a right-aligned bubble for the user with a clock and a
|
|
13578
|
+
* copy button underneath, plain full-width markdown for the assistant.
|
|
13579
|
+
*/
|
|
13580
|
+
function ideFloatRow(row, tr, io) {
|
|
13581
|
+
const { setViewing, store, pictures } = io
|
|
13582
|
+
// A Tool batch: 「执行了命令」, or 「正在运行命令 · <描述>」 while it is the open one.
|
|
13583
|
+
if (row.role === 'step') {
|
|
13584
|
+
const live = row.open === true && io.running === true
|
|
13585
|
+
const last = row.names === undefined || row.names.length === 0 ? '' : row.names[row.names.length - 1]
|
|
13586
|
+
const running = last === '' ? '' : `${tr(ideFloatProgressKey(last))}${row.detail === '' ? '' : ` · ${row.detail}`}`
|
|
13587
|
+
const text = live && running !== '' ? running : ideFloatStepTitle(row.kinds ?? [], tr)
|
|
13588
|
+
return h('div', { key: row.key, className: `iw-float-step${live ? ' live' : ''}` }, [
|
|
13589
|
+
h('span', { key: 'i', className: 'iw-float-step-icon' }, h(IdeTerminalIcon, { size: 15 })),
|
|
13590
|
+
h('span', { key: 't', className: 'iw-float-step-text', title: text }, text),
|
|
13591
|
+
])
|
|
13592
|
+
}
|
|
13593
|
+
// Questions cannot be answered here: DSH only accepts the answer in the
|
|
13594
|
+
// Conversation, so the card's button navigates there instead.
|
|
13595
|
+
const goToChat = typeof io.goToChat === 'function' ? io.goToChat : () => {}
|
|
13596
|
+
if (row.role === 'files') {
|
|
13597
|
+
return h('div', { key: row.key, className: 'iw-float-row iw-float-files' }, [
|
|
13598
|
+
h('span', { key: 'who', className: 'iw-float-who' }, tr('floatFiles')),
|
|
13599
|
+
h('div', { key: 'list', className: 'iw-float-filelist' }, (row.files ?? []).map((file) => h('button', {
|
|
13600
|
+
key: file.path,
|
|
13601
|
+
type: 'button',
|
|
13602
|
+
className: 'iw-float-file',
|
|
13603
|
+
title: file.path,
|
|
13604
|
+
onClick: () => {
|
|
13605
|
+
// Same entry point as the conversation's file cards: open the file in
|
|
13606
|
+
// the workspace and switch the panel to it.
|
|
13607
|
+
const opened = typeof openInWorkspace === 'function'
|
|
13608
|
+
? openInWorkspace(file.path) === true
|
|
13609
|
+
: store.openAt(file.path) === true
|
|
13610
|
+
if (opened !== true) store.setNotice(`${tr('floatOpenFailed')}: ${file.path}`)
|
|
13611
|
+
},
|
|
13612
|
+
}, [
|
|
13613
|
+
h('span', { key: 'n', className: 'iw-float-file-name' }, ideBasename(file.path)),
|
|
13614
|
+
file.description === '' ? null : h('span', { key: 'd', className: 'iw-float-file-desc' }, file.description),
|
|
13615
|
+
]))),
|
|
13616
|
+
])
|
|
13617
|
+
}
|
|
13618
|
+
// Shaped like the conversation: the user side is a right-aligned bubble with
|
|
13619
|
+
// a clock and a copy button under it, the assistant side is plain full-width
|
|
13620
|
+
// markdown. No "you"/"assistant" captions.
|
|
13621
|
+
const body = row.text === '' ? null : h(IdeFloatMarkdown, { key: 'text', text: row.text, tr })
|
|
13622
|
+
const pics = row.images === undefined || row.images.length === 0 ? null : h('div', { key: 'pics', className: 'iw-float-pics' }, row.images.map((image, index) => {
|
|
13623
|
+
const url = pictures[image.attachmentId] ?? ''
|
|
13624
|
+
if (url === '') return h('div', { key: `pic${index}`, className: 'iw-float-pic iw-float-pic-wait' })
|
|
13625
|
+
return h('img', {
|
|
13626
|
+
key: `pic${index}`,
|
|
13627
|
+
className: 'iw-float-pic',
|
|
13628
|
+
src: url,
|
|
13629
|
+
alt: image.name ?? '',
|
|
13630
|
+
title: tr('floatPreviewImage'),
|
|
13631
|
+
draggable: false,
|
|
13632
|
+
// Right-clicking here offers the app's own "Copy", which pastes the file
|
|
13633
|
+
// name instead of the picture.
|
|
13634
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
13635
|
+
onClick: () => setViewing({ url, name: image.name ?? '' }),
|
|
13636
|
+
})
|
|
13637
|
+
}))
|
|
13638
|
+
if (row.role === 'question') {
|
|
13639
|
+
const picked = Array.isArray(row.answers) ? row.answers : []
|
|
13640
|
+
// Answered: the compact bubble the conversation leaves behind. Open: the
|
|
13641
|
+
// full card, so the question is readable without leaving the workspace.
|
|
13642
|
+
if (picked.length > 0) {
|
|
13643
|
+
return h('div', { key: row.key, className: 'iw-float-row iw-float-user' }, [
|
|
13644
|
+
h('div', { key: 'bubble', className: 'iw-float-bubble iw-float-question' }, [
|
|
13645
|
+
row.header === '' ? null : h('div', { key: 'h', className: 'iw-float-q-head' }, row.header),
|
|
13646
|
+
h('div', { key: 'q', className: 'iw-float-q-ask' }, row.question),
|
|
13647
|
+
h('div', { key: 'a', className: 'iw-float-q-answer' }, picked.join('、')),
|
|
13648
|
+
]),
|
|
13649
|
+
])
|
|
13650
|
+
}
|
|
13651
|
+
const options = Array.isArray(row.options) ? row.options : []
|
|
13652
|
+
return h('div', { key: row.key, className: 'iw-float-row' }, [
|
|
13653
|
+
h('div', { key: 'card', className: 'iw-float-ask' }, [
|
|
13654
|
+
h('div', { key: 'head', className: 'iw-float-ask-head' }, [
|
|
13655
|
+
row.header === '' ? null : h('div', { key: 'e', className: 'iw-float-ask-eyebrow' }, row.header),
|
|
13656
|
+
h('div', { key: 't', className: 'iw-float-ask-title' }, row.question),
|
|
13657
|
+
]),
|
|
13658
|
+
options.length === 0 ? null : h('div', { key: 'o', className: 'iw-float-ask-options' },
|
|
13659
|
+
options.map((option, index) => h('div', {
|
|
13660
|
+
key: `o${index}`,
|
|
13661
|
+
className: 'iw-float-ask-option',
|
|
13662
|
+
}, [
|
|
13663
|
+
h('span', { key: 'n', className: 'iw-float-ask-index' }, String(index + 1)),
|
|
13664
|
+
h('span', { key: 'l', className: 'iw-float-ask-label' }, option.label),
|
|
13665
|
+
option.description === ''
|
|
13666
|
+
? null
|
|
13667
|
+
: h('span', { key: 'd', className: 'iw-float-ask-desc' }, option.description),
|
|
13668
|
+
]))),
|
|
13669
|
+
h('div', { key: 'foot', className: 'iw-float-ask-foot' }, [
|
|
13670
|
+
h('span', { key: 'hint', className: 'iw-float-ask-hint' }, tr('floatQuestionHint')),
|
|
13671
|
+
h('button', {
|
|
13672
|
+
key: 'go',
|
|
13673
|
+
type: 'button',
|
|
13674
|
+
className: 'iw-btn primary iw-float-ask-go',
|
|
13675
|
+
onClick: () => { goToChat() },
|
|
13676
|
+
}, tr('floatQuestionGo')),
|
|
13677
|
+
]),
|
|
13678
|
+
]),
|
|
13679
|
+
])
|
|
13680
|
+
}
|
|
13681
|
+
if (row.role === 'user') {
|
|
13682
|
+
const clock = ideFloatClock(row.time)
|
|
13683
|
+
return h('div', { key: row.key, className: 'iw-float-row iw-float-user' }, [
|
|
13684
|
+
h('div', { key: 'bubble', className: 'iw-float-bubble' }, [body, pics].filter((part) => part !== null)),
|
|
13685
|
+
h('div', { key: 'meta', className: 'iw-float-meta' }, [
|
|
13686
|
+
clock === '' ? null : h('span', { key: 'clock', className: 'iw-float-clock' }, clock),
|
|
13687
|
+
row.text === '' ? null : h('button', {
|
|
13688
|
+
key: 'copy',
|
|
13689
|
+
type: 'button',
|
|
13690
|
+
className: 'iw-float-copy',
|
|
13691
|
+
title: tr('floatCopyMessage'),
|
|
13692
|
+
onClick: () => { ideCopyWithNotice(store, tr, row.text) },
|
|
13693
|
+
}, h(IdeCopyIcon, { size: 13 })),
|
|
13694
|
+
].filter((part) => part !== null)),
|
|
13695
|
+
])
|
|
13696
|
+
}
|
|
13697
|
+
return h('div', { key: row.key, className: 'iw-float-row iw-float-assistant' }, [body, pics].filter((part) => part !== null))
|
|
13045
13698
|
}
|
|
13046
13699
|
|
|
13047
13700
|
/**
|
|
13048
|
-
*
|
|
13049
|
-
*
|
|
13050
|
-
* Only the two message kinds the user wrote and the model answered become rows:
|
|
13051
|
-
* tool calls, reasoning blocks and injected context are not a conversation. The
|
|
13052
|
-
* newest entries win, because the card is a glance, not the transcript view.
|
|
13053
|
-
*
|
|
13054
|
-
* @param entries - `SessionEventLikeEntry[]` from the retained binding.
|
|
13055
|
-
*/
|
|
13056
|
-
/**
|
|
13057
|
-
* The image parts of one message content array.
|
|
13058
|
-
*
|
|
13059
|
-
* The durable log never keeps raw image bytes: the Host promotes them to an
|
|
13060
|
-
* attachment reference (`{type:'image', attachment:{attachmentId,…}}`), and the
|
|
13061
|
-
* bytes come back through `session.readAttachment(ref)`.
|
|
13701
|
+
* The questions inside an `ask_user_question` call. `arguments` is a JSON string
|
|
13702
|
+
* on the wire; anything unparseable yields no rows rather than a broken card.
|
|
13062
13703
|
*/
|
|
13063
|
-
function
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13704
|
+
function ideFloatQuestionsOf(argumentText) {
|
|
13705
|
+
let parsed
|
|
13706
|
+
try {
|
|
13707
|
+
parsed = typeof argumentText === 'string' ? JSON.parse(argumentText) : argumentText
|
|
13708
|
+
} catch (error) {
|
|
13709
|
+
ideLogRecord('warn', 'float', 'question arguments unreadable', { error: String(error) })
|
|
13710
|
+
return []
|
|
13711
|
+
}
|
|
13712
|
+
const list = Array.isArray(parsed?.questions) ? parsed.questions : []
|
|
13713
|
+
return list.map((entry) => ({
|
|
13714
|
+
id: String(entry?.id ?? ''),
|
|
13715
|
+
header: String(entry?.header ?? ''),
|
|
13716
|
+
question: String(entry?.question ?? ''),
|
|
13717
|
+
multiSelect: entry?.multiSelect === true || entry?.multi_select === true,
|
|
13718
|
+
options: (Array.isArray(entry?.options) ? entry.options : []).map((option) => ({
|
|
13719
|
+
label: String(option?.label ?? ''),
|
|
13720
|
+
description: String(option?.description ?? ''),
|
|
13721
|
+
})).filter((option) => option.label !== ''),
|
|
13722
|
+
})).filter((entry) => entry.question !== '')
|
|
13723
|
+
}
|
|
13724
|
+
|
|
13725
|
+
/** Question id → the labels the user picked, read off the tool results. */
|
|
13726
|
+
function ideFloatAnswers(entries) {
|
|
13727
|
+
const answers = new Map()
|
|
13728
|
+
if (!Array.isArray(entries)) return answers
|
|
13729
|
+
for (const entry of entries) {
|
|
13730
|
+
const event = entry?.event
|
|
13731
|
+
if (event?.type !== 'tool/result') continue
|
|
13732
|
+
const text = ideFloatTextOf(event.data?.message?.content)
|
|
13733
|
+
if (!text.includes('answers')) continue
|
|
13734
|
+
let parsed
|
|
13735
|
+
try {
|
|
13736
|
+
parsed = JSON.parse(text)
|
|
13737
|
+
} catch (error) {
|
|
13738
|
+
continue
|
|
13739
|
+
}
|
|
13740
|
+
for (const answer of Array.isArray(parsed?.answers) ? parsed.answers : []) {
|
|
13741
|
+
const picked = [
|
|
13742
|
+
...(Array.isArray(answer?.selected) ? answer.selected.map(String) : []),
|
|
13743
|
+
...(typeof answer?.custom === 'string' && answer.custom !== '' ? [answer.custom] : []),
|
|
13744
|
+
]
|
|
13745
|
+
if (picked.length > 0) answers.set(String(answer?.id ?? ''), picked)
|
|
13746
|
+
}
|
|
13078
13747
|
}
|
|
13079
|
-
return
|
|
13748
|
+
return answers
|
|
13080
13749
|
}
|
|
13081
13750
|
|
|
13082
13751
|
function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
|
|
13083
13752
|
if (!Array.isArray(entries)) return []
|
|
13753
|
+
const answers = ideFloatAnswers(entries)
|
|
13084
13754
|
const rows = []
|
|
13755
|
+
// Tool calls collapse into one 「执行了命令」 line per batch, in the order they
|
|
13756
|
+
// ran — the same shape the conversation uses. The last batch stays `open`
|
|
13757
|
+
// until the Session stops, so the card can word it as 「正在运行命令」.
|
|
13758
|
+
let batch = { names: [], detail: '', seq: 0, ids: new Set() }
|
|
13759
|
+
const flushBatch = () => {
|
|
13760
|
+
if (batch.names.length === 0) return
|
|
13761
|
+
const kinds = []
|
|
13762
|
+
for (const name of batch.names) {
|
|
13763
|
+
const kind = ideFloatStepKind(name)
|
|
13764
|
+
if (!kinds.includes(kind)) kinds.push(kind)
|
|
13765
|
+
}
|
|
13766
|
+
rows.push({ key: `s${batch.seq}`, role: 'step', text: '', images: [], kinds, names: batch.names, detail: batch.detail, open: true })
|
|
13767
|
+
batch = { names: [], detail: '', seq: 0, ids: new Set() }
|
|
13768
|
+
}
|
|
13085
13769
|
for (const entry of entries) {
|
|
13086
13770
|
const event = entry?.event
|
|
13087
13771
|
if (event === null || typeof event !== 'object') continue
|
|
13772
|
+
if (event.type === 'tool/call') {
|
|
13773
|
+
const name = String(event.data?.name ?? '')
|
|
13774
|
+
// The question card is its own row, so it never joins a Tool batch.
|
|
13775
|
+
if (name !== '' && name !== 'ask_user_question') {
|
|
13776
|
+
// A replayed call can appear twice in the stream; one row per call.
|
|
13777
|
+
const callId = String(event.data?.callId ?? '')
|
|
13778
|
+
if (callId !== '' && batch.ids.has(callId)) continue
|
|
13779
|
+
if (callId !== '') batch.ids.add(callId)
|
|
13780
|
+
if (batch.seq === 0) batch.seq = event.seq
|
|
13781
|
+
batch.names.push(name)
|
|
13782
|
+
const detail = ideFloatCallDetail(name, event.data?.arguments)
|
|
13783
|
+
if (detail !== '') batch.detail = detail
|
|
13784
|
+
continue
|
|
13785
|
+
}
|
|
13786
|
+
}
|
|
13787
|
+
// Only a row that actually renders closes the batch: step boundaries emit
|
|
13788
|
+
// empty assistant messages, and flushing on those would split one batch
|
|
13789
|
+
// into a line per call.
|
|
13790
|
+
const renders = event.type === 'user/message'
|
|
13791
|
+
? true
|
|
13792
|
+
: event.type === 'assistant/message'
|
|
13793
|
+
? event.data?.message?.content?.some?.((part) => part?.type === 'text' ? String(part.text ?? '') !== '' : part?.type === 'image') === true
|
|
13794
|
+
: event.type === 'deliverables/presented' || (event.type === 'tool/call' && event.data?.name === 'ask_user_question')
|
|
13795
|
+
if (renders) flushBatch()
|
|
13088
13796
|
if (event.type === 'user/message') {
|
|
13089
13797
|
// Context injections share the event type; only a human prompt is a row.
|
|
13090
13798
|
if (event.data?.source?.kind !== 'user') continue
|
|
@@ -13092,14 +13800,40 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
|
|
|
13092
13800
|
const text = ideFloatTextOf(content)
|
|
13093
13801
|
// A prompt can be images only, so a row exists when either part exists.
|
|
13094
13802
|
const images = ideFloatImagesOf(content)
|
|
13095
|
-
if (text !== '' || images.length > 0)
|
|
13803
|
+
if (text !== '' || images.length > 0) {
|
|
13804
|
+
rows.push({ key: `u${event.seq}`, role: 'user', text, images, time: Number(event.time ?? 0) })
|
|
13805
|
+
}
|
|
13096
13806
|
continue
|
|
13097
13807
|
}
|
|
13098
13808
|
if (event.type === 'assistant/message') {
|
|
13099
13809
|
const content = event.data?.message?.content
|
|
13100
13810
|
const text = ideFloatTextOf(content)
|
|
13101
13811
|
const images = ideFloatImagesOf(content)
|
|
13102
|
-
if (text !== '' || images.length > 0)
|
|
13812
|
+
if (text !== '' || images.length > 0) {
|
|
13813
|
+
rows.push({ key: `a${event.seq}`, role: 'assistant', text, images, time: Number(event.time ?? 0) })
|
|
13814
|
+
}
|
|
13815
|
+
continue
|
|
13816
|
+
}
|
|
13817
|
+
// The conversation's own question card: `ask_user_question` is a tool call,
|
|
13818
|
+
// and its answer comes back as the tool result with matching ids.
|
|
13819
|
+
if (event.type === 'tool/call' && event.data?.name === 'ask_user_question') {
|
|
13820
|
+
const questions = ideFloatQuestionsOf(event.data?.arguments)
|
|
13821
|
+
questions.forEach((question, index) => {
|
|
13822
|
+
const picked = answers.get(String(question.id)) ?? []
|
|
13823
|
+
rows.push({
|
|
13824
|
+
key: `q${event.seq}:${index}`,
|
|
13825
|
+
role: 'question',
|
|
13826
|
+
text: '',
|
|
13827
|
+
images: [],
|
|
13828
|
+
time: Number(event.time ?? 0),
|
|
13829
|
+
header: question.header,
|
|
13830
|
+
question: question.question,
|
|
13831
|
+
options: question.options,
|
|
13832
|
+
multiSelect: question.multiSelect,
|
|
13833
|
+
answers: picked,
|
|
13834
|
+
pending: picked.length === 0,
|
|
13835
|
+
})
|
|
13836
|
+
})
|
|
13103
13837
|
continue
|
|
13104
13838
|
}
|
|
13105
13839
|
if (event.type === 'deliverables/presented') {
|
|
@@ -13107,6 +13841,8 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
|
|
|
13107
13841
|
if (files.length > 0) rows.push({ key: `p${event.seq}`, role: 'files', text: '', images: [], files })
|
|
13108
13842
|
}
|
|
13109
13843
|
}
|
|
13844
|
+
flushBatch()
|
|
13845
|
+
for (const row of rows) if (row.role === 'step') row.open = row === rows[rows.length - 1]
|
|
13110
13846
|
return rows.slice(-limit)
|
|
13111
13847
|
}
|
|
13112
13848
|
|
|
@@ -13117,27 +13853,215 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
|
|
|
13117
13853
|
* (`read-only` / `workspace-write` / `danger-full-access`). Unknown ids are shown
|
|
13118
13854
|
* verbatim rather than guessed.
|
|
13119
13855
|
*/
|
|
13120
|
-
/**
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13856
|
+
/** How a Tool call reads in the card's progress line. */
|
|
13857
|
+
const IDE_FLOAT_ACTIVITY = [
|
|
13858
|
+
{ pattern: /^(bash|shell|terminal)$/u, key: 'floatActivityCommand', progressKey: 'floatProgressCommand' },
|
|
13859
|
+
{ pattern: /^grep$/u, key: 'floatActivitySearch', progressKey: 'floatProgressSearch' },
|
|
13860
|
+
{ pattern: /^read$/u, key: 'floatActivityRead', progressKey: 'floatProgressRead' },
|
|
13861
|
+
{ pattern: /^(write|edit|patch)$/u, key: 'floatActivityWrite', progressKey: 'floatProgressWrite' },
|
|
13862
|
+
{ pattern: /^(web_search|web_fetch)$/u, key: 'floatActivityWeb', progressKey: 'floatProgressWeb' },
|
|
13863
|
+
{ pattern: /^ask_user_question$/u, key: 'floatActivityAsk', progressKey: 'floatProgressAsk' },
|
|
13864
|
+
{ pattern: /^(todo_write|task|workflow)$/u, key: 'floatActivityTask', progressKey: 'floatProgressTask' },
|
|
13865
|
+
]
|
|
13866
|
+
|
|
13867
|
+
/** The progress wording for a Tool name, falling back to the generic line. */
|
|
13868
|
+
function ideFloatProgressKey(name) {
|
|
13869
|
+
const entry = IDE_FLOAT_ACTIVITY.find((item) => item.pattern.test(String(name ?? '')))
|
|
13870
|
+
return entry === undefined ? 'floatProgressTool' : entry.progressKey
|
|
13871
|
+
}
|
|
13872
|
+
|
|
13873
|
+
/**
|
|
13874
|
+
* What the current turn has done so far: the Tool calls since the newest human
|
|
13875
|
+
* prompt, newest first, plus a one-line detail of the newest one. Pure so the
|
|
13876
|
+
* progress line is testable without a Session.
|
|
13877
|
+
*/
|
|
13878
|
+
function ideFloatActivityOf(entries) {
|
|
13879
|
+
const names = new Set()
|
|
13880
|
+
let detail = ''
|
|
13881
|
+
let current = ''
|
|
13882
|
+
if (!Array.isArray(entries)) return { names: [], detail, current }
|
|
13883
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
13884
|
+
const event = entries[index]?.event
|
|
13885
|
+
if (event?.type === 'user/message' && event.data?.source?.kind === 'user') break
|
|
13886
|
+
if (event?.type !== 'tool/call') continue
|
|
13887
|
+
const name = String(event.data?.name ?? '')
|
|
13888
|
+
if (name === '') continue
|
|
13889
|
+
if (detail === '') {
|
|
13890
|
+
detail = ideFloatCallDetail(name, event.data?.arguments)
|
|
13891
|
+
current = name
|
|
13892
|
+
}
|
|
13893
|
+
names.add(name)
|
|
13894
|
+
}
|
|
13895
|
+
return { names: [...names].reverse(), detail, current }
|
|
13896
|
+
}
|
|
13897
|
+
|
|
13898
|
+
/** The one line under the progress label: what the newest call is doing. */
|
|
13899
|
+
function ideFloatCallDetail(name, argumentText) {
|
|
13900
|
+
let args
|
|
13901
|
+
try {
|
|
13902
|
+
args = typeof argumentText === 'string' ? JSON.parse(argumentText) : argumentText
|
|
13903
|
+
} catch (error) {
|
|
13904
|
+
return ''
|
|
13905
|
+
}
|
|
13906
|
+
const text = (value) => (typeof value === 'string' && value.trim() !== '' ? value.trim().replace(/\s+/gu, ' ') : '')
|
|
13907
|
+
// bash carries a human `description` ("Push to origin main"); the raw command
|
|
13908
|
+
// is the fallback when the model wrote none.
|
|
13909
|
+
if (/^(bash|shell|terminal)$/u.test(name)) return text(args?.description) || text(args?.command)
|
|
13910
|
+
if (/^(read|write|edit|patch)$/u.test(name)) return text(args?.file_path ?? args?.path)
|
|
13911
|
+
if (name === 'grep') return text(args?.pattern ?? args?.query)
|
|
13912
|
+
if (name === 'web_search') return Array.isArray(args?.queries) ? text(args.queries[0]) : ''
|
|
13913
|
+
return ''
|
|
13914
|
+
}
|
|
13915
|
+
|
|
13916
|
+
/** `用时 2 分 26 秒` / `用时 26 秒`, the way the conversation's footer reads. */
|
|
13917
|
+
function ideFloatElapsed(ms, translate) {
|
|
13918
|
+
const tr = typeof translate === 'function' ? translate : (key) => key
|
|
13919
|
+
const seconds = Math.max(0, Math.floor((Number(ms) || 0) / 1000))
|
|
13920
|
+
const minutes = Math.floor(seconds / 60)
|
|
13921
|
+
const rest = seconds % 60
|
|
13922
|
+
return minutes > 0
|
|
13923
|
+
? tr('floatElapsedMin').replace('{m}', String(minutes)).replace('{s}', String(rest))
|
|
13924
|
+
: tr('floatElapsedSec').replace('{s}', String(rest))
|
|
13925
|
+
}
|
|
13926
|
+
|
|
13927
|
+
/**
|
|
13928
|
+
* The `/` or `@` token the caret sits in, or null. A token starts after
|
|
13929
|
+
* whitespace and runs to the caret without spaces, exactly like the command
|
|
13930
|
+
* trigger in the conversation composer.
|
|
13931
|
+
*/
|
|
13932
|
+
function ideFloatTrigger(text, caret) {
|
|
13933
|
+
const head = String(text ?? '').slice(0, Math.max(0, Number(caret) || 0))
|
|
13934
|
+
const match = /(^|\s)([/@][^\s]*)$/u.exec(head)
|
|
13935
|
+
if (match === null) return null
|
|
13936
|
+
const token = match[2]
|
|
13124
13937
|
return {
|
|
13125
|
-
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13938
|
+
sign: token[0],
|
|
13939
|
+
body: token.slice(1),
|
|
13940
|
+
start: head.length - token.length,
|
|
13941
|
+
end: Math.max(0, Number(caret) || 0),
|
|
13129
13942
|
}
|
|
13130
13943
|
}
|
|
13131
13944
|
|
|
13132
|
-
/**
|
|
13133
|
-
function
|
|
13134
|
-
const
|
|
13135
|
-
const
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13945
|
+
/** `@a/b/c` → the directory to list and the prefix to match inside it. */
|
|
13946
|
+
function ideFloatMentionQuery(body) {
|
|
13947
|
+
const text = String(body ?? '')
|
|
13948
|
+
const slash = text.lastIndexOf('/')
|
|
13949
|
+
return slash < 0
|
|
13950
|
+
? { dir: '', query: text }
|
|
13951
|
+
: { dir: text.slice(0, slash), query: text.slice(slash + 1) }
|
|
13952
|
+
}
|
|
13953
|
+
|
|
13954
|
+
/**
|
|
13955
|
+
* One `workspaceFiles.list` entry. The Host answers with `{name, type}` relative
|
|
13956
|
+
* to the directory that was listed, so the caller's directory makes the path.
|
|
13957
|
+
*/
|
|
13958
|
+
function ideFloatEntryOf(raw, dir) {
|
|
13959
|
+
if (raw === null || typeof raw !== 'object') return null
|
|
13960
|
+
const name = String(raw.name ?? raw.path ?? '')
|
|
13961
|
+
if (name === '') return null
|
|
13962
|
+
const kind = String(raw.kind ?? raw.type ?? '')
|
|
13963
|
+
const isDir = raw.isDirectory === true || kind === 'directory' || kind === 'dir' || kind === 'folder'
|
|
13964
|
+
const prefix = String(dir ?? '').replace(/\/+$/, '')
|
|
13965
|
+
const path = prefix === '' ? name : `${prefix}/${name}`
|
|
13966
|
+
return { path, name, isDir }
|
|
13967
|
+
}
|
|
13968
|
+
|
|
13969
|
+
/**
|
|
13970
|
+
* The `/` menu, in the conversation's own order. `action` rows are composer
|
|
13971
|
+
* features (insert an `@`, open the model picker); the rest are Host commands.
|
|
13972
|
+
*/
|
|
13973
|
+
const IDE_FLOAT_SLASH = [
|
|
13974
|
+
{ name: 'file', labelKey: 'floatCmdFile', section: 'add', action: 'mention' },
|
|
13975
|
+
{ name: 'goal', labelKey: 'floatCmdGoal', descKey: 'floatCmdGoalDesc', section: 'add' },
|
|
13976
|
+
{ name: 'plan', labelKey: 'floatCmdPlan', descKey: 'floatCmdPlanDesc', section: 'add' },
|
|
13977
|
+
{ name: 'feedback', labelKey: 'floatCmdFeedback', descKey: 'floatCmdFeedbackDesc', section: 'add' },
|
|
13978
|
+
{ name: 'compact', labelKey: 'floatCmdCompact', descKey: 'floatCmdCompactDesc', section: 'command' },
|
|
13979
|
+
{ name: 'permission', labelKey: 'floatCmdPermission', descKey: 'floatCmdPermissionDesc', section: 'command' },
|
|
13980
|
+
{ name: 'model', labelKey: 'floatCmdModel', descKey: 'floatCmdModelDesc', section: 'command', action: 'model' },
|
|
13981
|
+
{ name: 'export', labelKey: 'floatCmdExport', descKey: 'floatCmdExportDesc', section: 'command' },
|
|
13982
|
+
]
|
|
13983
|
+
|
|
13984
|
+
/**
|
|
13985
|
+
* The `/` menu rows: the fixed builtins (localized the way the conversation
|
|
13986
|
+
* shows them), then anything else the Host registered, then the Skills. Pure so
|
|
13987
|
+
* ordering and filtering are testable.
|
|
13988
|
+
*/
|
|
13989
|
+
function ideFloatSlashItems(catalog, skills, query, translate) {
|
|
13990
|
+
const tr = typeof translate === 'function' ? translate : (key) => key
|
|
13991
|
+
const needle = String(query ?? '').toLowerCase()
|
|
13992
|
+
const names = new Set((Array.isArray(catalog) ? catalog : []).map((raw) => String(raw?.name ?? '')))
|
|
13993
|
+
const items = []
|
|
13994
|
+
for (const entry of IDE_FLOAT_SLASH) {
|
|
13995
|
+
if (entry.action === undefined && !names.has(entry.name)) continue
|
|
13996
|
+
const label = tr(entry.labelKey)
|
|
13997
|
+
const description = entry.descKey === undefined ? '' : tr(entry.descKey)
|
|
13998
|
+
if (needle !== '' && !`${entry.name} ${label}`.toLowerCase().includes(needle)) continue
|
|
13999
|
+
items.push({
|
|
14000
|
+
kind: entry.action === undefined ? 'command' : entry.action,
|
|
14001
|
+
id: entry.name,
|
|
14002
|
+
label,
|
|
14003
|
+
alias: entry.name,
|
|
14004
|
+
description,
|
|
14005
|
+
section: entry.section,
|
|
14006
|
+
})
|
|
13139
14007
|
}
|
|
13140
|
-
|
|
14008
|
+
const builtin = new Set(IDE_FLOAT_SLASH.map((entry) => entry.name))
|
|
14009
|
+
for (const raw of Array.isArray(catalog) ? catalog : []) {
|
|
14010
|
+
const name = String(raw?.name ?? '')
|
|
14011
|
+
if (name === '' || builtin.has(name)) continue
|
|
14012
|
+
if (needle !== '' && !name.toLowerCase().includes(needle)) continue
|
|
14013
|
+
items.push({ kind: 'command', id: name, label: name, alias: '', description: String(raw?.description ?? ''), section: 'command' })
|
|
14014
|
+
}
|
|
14015
|
+
for (const raw of Array.isArray(skills) ? skills : []) {
|
|
14016
|
+
const name = String(raw?.name ?? '')
|
|
14017
|
+
if (name === '' || (needle !== '' && !name.toLowerCase().includes(needle))) continue
|
|
14018
|
+
items.push({ kind: 'skill', id: name, label: name, alias: '', description: String(raw?.description ?? ''), section: 'skill' })
|
|
14019
|
+
}
|
|
14020
|
+
return items
|
|
14021
|
+
}
|
|
14022
|
+
|
|
14023
|
+
/** The section title key for a row's section, or '' when it has none. */
|
|
14024
|
+
function ideFloatSectionKey(section) {
|
|
14025
|
+
if (section === 'add') return 'floatMenuAdd'
|
|
14026
|
+
if (section === 'command') return 'floatMenuCommands'
|
|
14027
|
+
if (section === 'skill') return 'floatMenuSkills'
|
|
14028
|
+
if (section === 'file') return 'floatMenuFiles'
|
|
14029
|
+
if (section === 'chat') return 'floatMenuChats'
|
|
14030
|
+
return ''
|
|
14031
|
+
}
|
|
14032
|
+
|
|
14033
|
+
/** Which step kind a Tool belongs to; drives the 「执行了命令」 wording. */
|
|
14034
|
+
function ideFloatStepKind(name) {
|
|
14035
|
+
const tool = String(name ?? '')
|
|
14036
|
+
if (/^(bash|shell|terminal)$/u.test(tool)) return 'commands'
|
|
14037
|
+
if (tool === 'read') return 'read'
|
|
14038
|
+
if (/^(write|edit|patch)$/u.test(tool)) return 'write'
|
|
14039
|
+
if (tool === 'grep') return 'search'
|
|
14040
|
+
if (/^(web_search|web_fetch)$/u.test(tool)) return 'web'
|
|
14041
|
+
if (tool === 'ask_user_question') return 'questions'
|
|
14042
|
+
if (/^(todo_write|task|workflow)$/u.test(tool)) return 'plan'
|
|
14043
|
+
return 'tools'
|
|
14044
|
+
}
|
|
14045
|
+
|
|
14046
|
+
/**
|
|
14047
|
+
* One finished tool batch, worded the way the conversation words it:
|
|
14048
|
+
* 「执行了命令」 / 「执行了命令并搜索了代码」 / 「执行了命令,搜索了代码等」.
|
|
14049
|
+
* Labels come from this plugin's locale because the Host's catalogue only
|
|
14050
|
+
* carries names and descriptions.
|
|
14051
|
+
*/
|
|
14052
|
+
function ideFloatStepTitle(kinds, translate) {
|
|
14053
|
+
const tr = typeof translate === 'function' ? translate : (key) => key
|
|
14054
|
+
const list = Array.isArray(kinds) ? kinds : []
|
|
14055
|
+
const labels = list.slice(0, 3).map((kind) => tr(`floatStepDone.${kind}`))
|
|
14056
|
+
const first = labels[0]
|
|
14057
|
+
if (first === undefined) return tr('floatStepDone.tools')
|
|
14058
|
+
const shared = tr('floatStepSharedPrefix')
|
|
14059
|
+
const strip = (label) => (shared !== '' && label.startsWith(shared) ? label.slice(shared.length) : label)
|
|
14060
|
+
const second = labels[1]
|
|
14061
|
+
if (second === undefined) return first
|
|
14062
|
+
if (labels.length === 2) return tr('floatStepJoinTwo').replace('{first}', first).replace('{second}', strip(second))
|
|
14063
|
+
const title = [first, ...labels.slice(1).map(strip)].join(tr('floatStepComma'))
|
|
14064
|
+
return list.length > 3 ? tr('floatStepMore').replace('{title}', title) : title
|
|
13141
14065
|
}
|
|
13142
14066
|
|
|
13143
14067
|
function ideFloatPermissionLabel(preset, translate) {
|
|
@@ -13604,9 +14528,15 @@ function ideFloatMarkdownBlocks(text) {
|
|
|
13604
14528
|
return blocks
|
|
13605
14529
|
}
|
|
13606
14530
|
|
|
13607
|
-
/**
|
|
14531
|
+
/**
|
|
14532
|
+
* One fenced code block, shaped like the conversation's: a quiet header with the
|
|
14533
|
+
* block name on the left and the wrap/copy controls on the right.
|
|
14534
|
+
*/
|
|
13608
14535
|
function IdeFloatCodeBlock({ code, lang, tr }) {
|
|
13609
14536
|
const [copied, setCopied] = useState(false)
|
|
14537
|
+
// Long lines are readable in a narrow card only when they wrap, so that is
|
|
14538
|
+
// the default and the header offers the switch.
|
|
14539
|
+
const [wrap, setWrap] = useState(true)
|
|
13610
14540
|
const language = ideLangOf(`x.${String(lang ?? '').trim()}`) || ''
|
|
13611
14541
|
const lines = useMemo(() => String(code ?? '').split('\n'), [code])
|
|
13612
14542
|
const copy = () => {
|
|
@@ -13616,10 +14546,32 @@ function IdeFloatCodeBlock({ code, lang, tr }) {
|
|
|
13616
14546
|
}
|
|
13617
14547
|
return h('div', { className: 'iw-float-md-codeblock' }, [
|
|
13618
14548
|
h('div', { key: 'head', className: 'iw-float-md-codehead' }, [
|
|
13619
|
-
|
|
13620
|
-
h('
|
|
14549
|
+
// An unlabelled or plain-text fence is just "代码块", as DSH calls it.
|
|
14550
|
+
h('span', {
|
|
14551
|
+
key: 'lang',
|
|
14552
|
+
className: 'iw-float-md-codelang',
|
|
14553
|
+
}, language === '' || language === 'txt' ? tr('floatCode') : ideLangLabel(language) || tr('floatCode')),
|
|
14554
|
+
h('span', { key: 'acts', className: 'iw-float-md-codeacts' }, [
|
|
14555
|
+
h('button', {
|
|
14556
|
+
key: 'wrap',
|
|
14557
|
+
type: 'button',
|
|
14558
|
+
className: `iw-float-md-codeact${wrap ? ' on' : ''}`,
|
|
14559
|
+
title: tr('floatWrap'),
|
|
14560
|
+
onClick: () => setWrap(!wrap),
|
|
14561
|
+
}, h(IdeWrapIcon, { size: 14 })),
|
|
14562
|
+
h('button', {
|
|
14563
|
+
key: 'copy',
|
|
14564
|
+
type: 'button',
|
|
14565
|
+
className: 'iw-float-md-codeact',
|
|
14566
|
+
title: copied ? tr('floatCopied') : tr('floatCopy'),
|
|
14567
|
+
onClick: copy,
|
|
14568
|
+
}, h(IdeCopyIcon, { size: 14 })),
|
|
14569
|
+
]),
|
|
13621
14570
|
]),
|
|
13622
|
-
h('pre', {
|
|
14571
|
+
h('pre', {
|
|
14572
|
+
key: 'pre',
|
|
14573
|
+
className: `iw-float-md-pre${wrap ? ' iw-float-md-wrapped' : ''}`,
|
|
14574
|
+
}, lines.map((line, lineIndex) => h('div', {
|
|
13623
14575
|
key: lineIndex,
|
|
13624
14576
|
className: 'iw-float-md-line',
|
|
13625
14577
|
}, ideTokenize(line, language).map((run, runIndex) => (run.cls === ''
|
|
@@ -13674,7 +14626,7 @@ function IdeFloatMarkdown({ text, tr }) {
|
|
|
13674
14626
|
* @param props.sessions - the Client `sessions` service (retention + prompt).
|
|
13675
14627
|
* @param props.modelDirectories - the model directory service the composer uses.
|
|
13676
14628
|
*/
|
|
13677
|
-
function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSession, startSession, useWorkspaces, openInWorkspace }) {
|
|
14629
|
+
function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSession, startSession, useWorkspaces, openInWorkspace, goToChat, commandList, workspaceList, skillList }) {
|
|
13678
14630
|
const tr = typeof translate === 'function' ? translate : (key) => key
|
|
13679
14631
|
const state = useSyncExternalStore(store.subscribe, store.getState, store.getState)
|
|
13680
14632
|
const [binding, setBinding] = useState(null)
|
|
@@ -13694,15 +14646,26 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
13694
14646
|
const [preset, setPreset] = useState('')
|
|
13695
14647
|
const [effort, setEffort] = useState(null)
|
|
13696
14648
|
// Attachment bytes are fetched on demand: the log only carries references.
|
|
14649
|
+
// The `/` and `@` menus: the same Host catalog and the same directory listing
|
|
14650
|
+
// the conversation's composer offers, so the two never disagree.
|
|
14651
|
+
const [suggest, setSuggest] = useState(null)
|
|
14652
|
+
const rawEntries = useRef([])
|
|
14653
|
+
const suggestSeq = useRef(0)
|
|
14654
|
+
const commandCache = useRef(null)
|
|
14655
|
+
const skillCache = useRef(null)
|
|
14656
|
+
const directoryCache = useRef(new Map())
|
|
13697
14657
|
const [pictures, setPictures] = useState({})
|
|
13698
|
-
// The
|
|
13699
|
-
const [changes, setChanges] = useState(null)
|
|
13700
|
-
const [changeOpen, setChangeOpen] = useState(false)
|
|
14658
|
+
// The picture the user is looking at.
|
|
13701
14659
|
const [viewing, setViewing] = useState(null)
|
|
13702
14660
|
const picturesRef = useRef({})
|
|
13703
14661
|
picturesRef.current = pictures
|
|
13704
14662
|
const [projectedPreset, setProjectedPreset] = useState('')
|
|
13705
14663
|
const cardRef = useRef(null)
|
|
14664
|
+
// An Enter that confirms an IME candidate must only commit the text, never
|
|
14665
|
+
// send: the conversation's composer behaves the same way. Some IMEs fire
|
|
14666
|
+
// `compositionend` just before that keydown, so the timestamp covers them.
|
|
14667
|
+
const composingRef = useRef(false)
|
|
14668
|
+
const composedAtRef = useRef(0)
|
|
13706
14669
|
const dragRef = useRef(null)
|
|
13707
14670
|
const menuRef = useRef(null)
|
|
13708
14671
|
|
|
@@ -13749,55 +14712,6 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
13749
14712
|
return () => { alive = false }
|
|
13750
14713
|
}, [binding, entries])
|
|
13751
14714
|
|
|
13752
|
-
// The changed-files card of the latest turn.
|
|
13753
|
-
//
|
|
13754
|
-
// The Host announces `workspace/changes` on the session log, but that event
|
|
13755
|
-
// never reaches a plugin (the retained window keeps messages), and the Host's
|
|
13756
|
-
// own summary route sits behind its authenticated fence. So the plugin's host
|
|
13757
|
-
// answers instead, and the answer only exists while the turn's summary lives
|
|
13758
|
-
// in memory — exactly like the conversation's card.
|
|
13759
|
-
useEffect(() => {
|
|
13760
|
-
// `sessionId` is declared below; read it from the snapshot so the effect
|
|
13761
|
-
// can stay next to the other data effects without a temporal-dead-zone crash.
|
|
13762
|
-
const owner = state.sessionId ?? ''
|
|
13763
|
-
if (binding === null || owner === '') {
|
|
13764
|
-
setChanges(null)
|
|
13765
|
-
return undefined
|
|
13766
|
-
}
|
|
13767
|
-
let alive = true
|
|
13768
|
-
let timer
|
|
13769
|
-
const ask = (attempt) => {
|
|
13770
|
-
fetch(`/dsh-ide/changes?session=${encodeURIComponent(owner)}`, {
|
|
13771
|
-
method: 'POST',
|
|
13772
|
-
headers: { 'content-type': 'application/json' },
|
|
13773
|
-
body: JSON.stringify({ session: owner }),
|
|
13774
|
-
})
|
|
13775
|
-
.then((response) => (response.ok ? response.json() : null))
|
|
13776
|
-
.then((answer) => {
|
|
13777
|
-
if (alive !== true || answer === null || answer.ok !== true) return
|
|
13778
|
-
const files = ideFloatChangedFiles(answer.value)
|
|
13779
|
-
if (files.length > 0) {
|
|
13780
|
-
setChanges({ files, added: files.reduce((sum, row) => sum + row.added, 0), deleted: files.reduce((sum, row) => sum + row.deleted, 0) })
|
|
13781
|
-
return
|
|
13782
|
-
}
|
|
13783
|
-
// The Host records the announcement after the reply lands, so the
|
|
13784
|
-
// first ask of a fresh turn can arrive early; a couple of retries
|
|
13785
|
-
// cover it without polling.
|
|
13786
|
-
if (attempt >= IDE_FLOAT_CHANGES_RETRIES.length) {
|
|
13787
|
-
setChanges(null)
|
|
13788
|
-
return
|
|
13789
|
-
}
|
|
13790
|
-
timer = globalThis.setTimeout(() => ask(attempt + 1), IDE_FLOAT_CHANGES_RETRIES[attempt])
|
|
13791
|
-
})
|
|
13792
|
-
.catch(() => {})
|
|
13793
|
-
}
|
|
13794
|
-
ask(0)
|
|
13795
|
-
return () => {
|
|
13796
|
-
alive = false
|
|
13797
|
-
globalThis.clearTimeout(timer)
|
|
13798
|
-
}
|
|
13799
|
-
}, [binding, state.sessionId, entries.length])
|
|
13800
|
-
|
|
13801
14715
|
// Coming back into view (conversation → code workspace) shows the newest line
|
|
13802
14716
|
// again, even if the user had scrolled up before leaving.
|
|
13803
14717
|
useEffect(() => {
|
|
@@ -13857,7 +14771,10 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
13857
14771
|
}
|
|
13858
14772
|
const source = binding.eventSource
|
|
13859
14773
|
const read = () => {
|
|
13860
|
-
|
|
14774
|
+
const raw = source.getSnapshot()?.entries
|
|
14775
|
+
// The transcript drops Tool calls; the progress line needs them.
|
|
14776
|
+
rawEntries.current = Array.isArray(raw) ? raw : []
|
|
14777
|
+
setEntries(ideFloatTranscript(raw))
|
|
13861
14778
|
}
|
|
13862
14779
|
read()
|
|
13863
14780
|
return source.subscribe(read)
|
|
@@ -13947,6 +14864,130 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
13947
14864
|
|
|
13948
14865
|
const permission = projectedPreset !== '' ? projectedPreset : (preset !== '' ? preset : ideFloatPermissionOf(entries))
|
|
13949
14866
|
|
|
14867
|
+
// `/` and `@` suggestions, recomputed whenever the draft changes. The lists
|
|
14868
|
+
// come from the Host (`commands.list` / `workspaceFiles.list`), which is the
|
|
14869
|
+
// same pair the conversation composer reads.
|
|
14870
|
+
useEffect(() => {
|
|
14871
|
+
if (binding === null || sessionId === '') { setSuggest(null); return }
|
|
14872
|
+
const token = ideFloatTrigger(draft, draft.length)
|
|
14873
|
+
if (token === null) { setSuggest(null); return }
|
|
14874
|
+
const seq = suggestSeq.current + 1
|
|
14875
|
+
suggestSeq.current = seq
|
|
14876
|
+
const fresh = () => suggestSeq.current === seq
|
|
14877
|
+
if (token.sign === '/') {
|
|
14878
|
+
const run = async () => {
|
|
14879
|
+
let catalog = commandCache.current
|
|
14880
|
+
if (catalog === null) {
|
|
14881
|
+
const result = typeof commandList === 'function' ? await commandList(sessionId) : { value: [] }
|
|
14882
|
+
if (!fresh()) return
|
|
14883
|
+
if (result?.error !== undefined) {
|
|
14884
|
+
store.setNotice(`${tr('floatSuggestFailed')}: ${String(result.error)}`)
|
|
14885
|
+
setSuggest(null)
|
|
14886
|
+
return
|
|
14887
|
+
}
|
|
14888
|
+
catalog = Array.isArray(result?.value) ? result.value : []
|
|
14889
|
+
commandCache.current = catalog
|
|
14890
|
+
}
|
|
14891
|
+
let skills = skillCache.current
|
|
14892
|
+
if (skills === null) {
|
|
14893
|
+
const result = typeof skillList === 'function' ? await skillList(sessionId) : { value: [] }
|
|
14894
|
+
if (!fresh()) return
|
|
14895
|
+
skills = result?.error === undefined && Array.isArray(result?.value) ? result.value : []
|
|
14896
|
+
skillCache.current = skills
|
|
14897
|
+
}
|
|
14898
|
+
if (!fresh()) return
|
|
14899
|
+
const items = ideFloatSlashItems(catalog, skills, token.body, tr)
|
|
14900
|
+
setSuggest({ sign: '/', token, items, index: 0, dir: '' })
|
|
14901
|
+
}
|
|
14902
|
+
void run()
|
|
14903
|
+
return
|
|
14904
|
+
}
|
|
14905
|
+
const { dir, query } = ideFloatMentionQuery(token.body)
|
|
14906
|
+
const run = async () => {
|
|
14907
|
+
let entries = directoryCache.current.get(dir)
|
|
14908
|
+
if (entries === undefined) {
|
|
14909
|
+
// Paths are relative to the Session's workspace root, and `.` is that
|
|
14910
|
+
// root: an empty string is refused with "path is required".
|
|
14911
|
+
const result = typeof workspaceList === 'function'
|
|
14912
|
+
? await workspaceList(sessionId, dir === '' ? '.' : dir)
|
|
14913
|
+
: { value: [] }
|
|
14914
|
+
if (!fresh()) return
|
|
14915
|
+
if (result?.error !== undefined) {
|
|
14916
|
+
store.setNotice(`${tr('floatSuggestFailed')}: ${String(result.error)}`)
|
|
14917
|
+
setSuggest(null)
|
|
14918
|
+
return
|
|
14919
|
+
}
|
|
14920
|
+
entries = (Array.isArray(result?.value) ? result.value : [])
|
|
14921
|
+
.map((raw) => ideFloatEntryOf(raw, dir))
|
|
14922
|
+
.filter((entry) => entry !== null)
|
|
14923
|
+
directoryCache.current.set(dir, entries)
|
|
14924
|
+
}
|
|
14925
|
+
if (!fresh()) return
|
|
14926
|
+
const needle = query.toLowerCase()
|
|
14927
|
+
const files = entries
|
|
14928
|
+
.filter((entry) => needle === '' || entry.name.toLowerCase().includes(needle))
|
|
14929
|
+
.sort((left, right) => (left.isDir === right.isDir ? left.name.localeCompare(right.name) : left.isDir ? -1 : 1))
|
|
14930
|
+
.slice(0, 40)
|
|
14931
|
+
.map((entry) => ({ kind: entry.isDir ? 'dir' : 'file', id: entry.path, label: entry.name, alias: '', description: '', section: 'file' }))
|
|
14932
|
+
// The conversation's `@` list also offers other conversations.
|
|
14933
|
+
const chats = sessionRows
|
|
14934
|
+
.filter((row) => row.sessionId !== sessionId)
|
|
14935
|
+
.filter((row) => needle === '' || String(row.title ?? '').toLowerCase().includes(needle))
|
|
14936
|
+
.slice(0, 8)
|
|
14937
|
+
.map((row) => ({ kind: 'session', id: row.sessionId, label: row.title, alias: '', description: '', section: 'chat' }))
|
|
14938
|
+
setSuggest({ sign: '@', token, items: [...files, ...chats], index: 0, dir })
|
|
14939
|
+
}
|
|
14940
|
+
void run()
|
|
14941
|
+
}, [draft, binding, sessionId, commandList, workspaceList, skillList, sessionRows])
|
|
14942
|
+
|
|
14943
|
+
// Pick one suggestion: a command runs through the Session's own command line,
|
|
14944
|
+
// a file becomes a reference chip — both exactly what the conversation does.
|
|
14945
|
+
const pickSuggest = (item) => {
|
|
14946
|
+
if (item === undefined) return
|
|
14947
|
+
const token = ideFloatTrigger(draft, draft.length)
|
|
14948
|
+
const cut = token === null ? draft : `${draft.slice(0, token.start)}${draft.slice(token.end)}`
|
|
14949
|
+
setDraft(cut)
|
|
14950
|
+
setSuggest(null)
|
|
14951
|
+
if (item.kind === 'mention') {
|
|
14952
|
+
// The conversation's 「文件」 row opens the `@` list rather than sending.
|
|
14953
|
+
setDraft(`${cut}@`)
|
|
14954
|
+
return
|
|
14955
|
+
}
|
|
14956
|
+
if (item.kind === 'model') {
|
|
14957
|
+
setMenu('model')
|
|
14958
|
+
return
|
|
14959
|
+
}
|
|
14960
|
+
if (item.kind === 'dir') {
|
|
14961
|
+
// Drill in: keep the trigger, append the directory and a slash.
|
|
14962
|
+
setDraft(`${cut}@${item.id}/`)
|
|
14963
|
+
return
|
|
14964
|
+
}
|
|
14965
|
+
if (item.kind === 'file') {
|
|
14966
|
+
const ref = `@${item.id}`
|
|
14967
|
+
setRefs((current) => (current.includes(ref) ? current : [...current, ref]))
|
|
14968
|
+
return
|
|
14969
|
+
}
|
|
14970
|
+
if (item.kind === 'session') {
|
|
14971
|
+
// A conversation reference is a navigation, not text: switch this card to
|
|
14972
|
+
// that Session the same way the header switcher does.
|
|
14973
|
+
if (typeof openSession === 'function') openSession(item.id)
|
|
14974
|
+
return
|
|
14975
|
+
}
|
|
14976
|
+
if (item.kind === 'skill') {
|
|
14977
|
+
// A Skill is invoked by name in the prompt; leave the caret after it.
|
|
14978
|
+
setDraft(`${cut}/${item.id} `)
|
|
14979
|
+
return
|
|
14980
|
+
}
|
|
14981
|
+
const command = binding?.session?.command
|
|
14982
|
+
if (typeof command !== 'function') return
|
|
14983
|
+
Promise.resolve(command(`/${item.id}`)).then((result) => {
|
|
14984
|
+
const failed = result?.ok === false || result?.value?.matched === false
|
|
14985
|
+
if (failed) store.setNotice(`${tr('floatCommandFailed')}: ${item.id}`)
|
|
14986
|
+
}).catch((error) => {
|
|
14987
|
+
store.setNotice(`${tr('floatCommandFailed')}: ${error?.message ?? error}`)
|
|
14988
|
+
})
|
|
14989
|
+
}
|
|
14990
|
+
|
|
13950
14991
|
// Opening the switcher lands on the current workspace's group: the list can
|
|
13951
14992
|
// be long, and the conversations a person wants are the ones next to them.
|
|
13952
14993
|
useEffect(() => {
|
|
@@ -13988,16 +15029,46 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
13988
15029
|
return () => document.removeEventListener('pointerdown', onDown, true)
|
|
13989
15030
|
}, [menu])
|
|
13990
15031
|
|
|
15032
|
+
const running = binding !== null && binding.session.getSnapshot()?.running === true
|
|
15033
|
+
// The elapsed clock only runs while the Session is working; a fresh turn
|
|
15034
|
+
// starts it again, so `用时` always means this turn.
|
|
15035
|
+
const [, setClockTick] = useState(0)
|
|
15036
|
+
useEffect(() => {
|
|
15037
|
+
if (running !== true) return undefined
|
|
15038
|
+
// Bumping a counter is what re-renders once a second; setting the same
|
|
15039
|
+
// timestamp again would be a no-op React bails out of.
|
|
15040
|
+
const timer = globalThis.setInterval(() => setClockTick((tick) => tick + 1), 1000)
|
|
15041
|
+
return () => globalThis.clearInterval(timer)
|
|
15042
|
+
}, [running])
|
|
15043
|
+
// The timer counts this turn, so it starts at the prompt — not at the moment
|
|
15044
|
+
// the card happened to notice the Session became busy.
|
|
15045
|
+
const turnStart = (() => {
|
|
15046
|
+
const raw = rawEntries.current
|
|
15047
|
+
for (let index = raw.length - 1; index >= 0; index -= 1) {
|
|
15048
|
+
const event = raw[index]?.event
|
|
15049
|
+
if (event?.type === 'user/message' && event.data?.source?.kind === 'user') return Number(event.time ?? 0)
|
|
15050
|
+
}
|
|
15051
|
+
return 0
|
|
15052
|
+
})()
|
|
15053
|
+
|
|
13991
15054
|
if (!open) return null
|
|
13992
15055
|
|
|
13993
|
-
const running = binding !== null && binding.session.getSnapshot()?.running === true
|
|
13994
15056
|
// The header names the conversation, not the folder: that is what the menu
|
|
13995
15057
|
// switches. The workspace stays available in the tooltip and the empty state.
|
|
13996
15058
|
const currentRow = sessionRows.find((row) => row.sessionId === sessionId)
|
|
13997
15059
|
const sessionGroups = ideFloatSessionGroups(sessionRows, state.rootPath ?? '')
|
|
15060
|
+
const workspace = ideBasename(state.rootPath ?? '') || tr('floatNoWorkspace')
|
|
13998
15061
|
const sessionTitle = currentRow?.title
|
|
13999
15062
|
?? (workspace === '' || workspace === tr('floatNoWorkspace') ? tr('floatNoSession') : workspace)
|
|
14000
|
-
|
|
15063
|
+
// Maximising the window moves both card and ball: nothing else re-renders
|
|
15064
|
+
// this component on resize, so the coordinates would stay at the old size.
|
|
15065
|
+
const [, setViewportTick] = useState(0)
|
|
15066
|
+
useEffect(() => {
|
|
15067
|
+
const onResize = () => setViewportTick((tick) => tick + 1)
|
|
15068
|
+
globalThis.addEventListener('resize', onResize)
|
|
15069
|
+
return () => globalThis.removeEventListener('resize', onResize)
|
|
15070
|
+
}, [])
|
|
15071
|
+
|
|
14001
15072
|
const viewportWidth = typeof window === 'undefined' ? 0 : window.innerWidth
|
|
14002
15073
|
const viewportHeight = typeof window === 'undefined' ? 0 : window.innerHeight
|
|
14003
15074
|
const size = ideFloatSize(state, viewportWidth, viewportHeight)
|
|
@@ -14260,36 +15331,44 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14260
15331
|
const options = ideFloatModelOptions(models)
|
|
14261
15332
|
// The workspace palette drives the card: same attribute, same tokens, same
|
|
14262
15333
|
// type scale as the panel behind it.
|
|
14263
|
-
|
|
15334
|
+
// The card reads like DSH's own chat: the host's 14px body size and the
|
|
15335
|
+
// host font. The workspace's tree size and palette only apply while the card
|
|
15336
|
+
// sits inside the workspace.
|
|
15337
|
+
const detached = state.floatDetached === true
|
|
15338
|
+
const font = `${IDE_FLOAT_FONT_SIZE}px`
|
|
14264
15339
|
|
|
14265
15340
|
// The stylesheet stays a sibling of the card: a `<style>` inside it would put
|
|
14266
15341
|
// its text into the card's own text content.
|
|
14267
15342
|
const styled = (node) => h(React.Fragment, null, [h(IdeStyles, { key: 'style' }), node])
|
|
14268
15343
|
|
|
14269
|
-
const shell = (children, extra) => styled(h('div', {
|
|
15344
|
+
const shell = (children, extra, box) => styled(h('div', {
|
|
14270
15345
|
key: 'card',
|
|
14271
15346
|
ref: cardRef,
|
|
14272
15347
|
className: extra === undefined ? 'iw-float' : `iw-float ${extra}`,
|
|
14273
|
-
'data-dsh-theme': state.theme === '' ? undefined : state.theme,
|
|
15348
|
+
'data-dsh-theme': detached || state.theme === '' ? undefined : state.theme,
|
|
14274
15349
|
style: {
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
15350
|
+
// A box without coordinates is pinned to the bottom-right corner.
|
|
15351
|
+
left: box === undefined ? `${point.left}px` : 'auto',
|
|
15352
|
+
top: box === undefined ? `${point.top}px` : 'auto',
|
|
15353
|
+
right: box === undefined ? 'auto' : `${IDE_FLOAT_BALL_INSET}px`,
|
|
15354
|
+
bottom: box === undefined ? 'auto' : `${IDE_FLOAT_BALL_INSET}px`,
|
|
15355
|
+
width: `${box?.width ?? size.width}px`,
|
|
15356
|
+
height: `${box?.height ?? size.height}px`,
|
|
15357
|
+
fontSize: font,
|
|
14282
15358
|
},
|
|
14283
15359
|
}, children))
|
|
14284
15360
|
|
|
14285
15361
|
if (collapsed) {
|
|
15362
|
+
// The ball is anchored to the window's bottom-right corner by CSS, so a
|
|
15363
|
+
// window resize can never leave it stranded mid-screen.
|
|
14286
15364
|
return shell([h('button', {
|
|
14287
15365
|
key: 'b',
|
|
14288
15366
|
type: 'button',
|
|
14289
15367
|
className: 'iw-float-ball-btn',
|
|
14290
15368
|
onClick: () => store.setFloatCollapsed(false),
|
|
15369
|
+
title: tr('floatExpand'),
|
|
14291
15370
|
'aria-label': tr('floatExpand'),
|
|
14292
|
-
}, 'AI')], 'iw-float-collapsed')
|
|
15371
|
+
}, 'AI')], 'iw-float-collapsed', { width: IDE_FLOAT_BALL, height: IDE_FLOAT_BALL })
|
|
14293
15372
|
}
|
|
14294
15373
|
|
|
14295
15374
|
return shell([
|
|
@@ -14320,20 +15399,6 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14320
15399
|
if (typeof startSession === 'function') startSession()
|
|
14321
15400
|
},
|
|
14322
15401
|
}, '+'),
|
|
14323
|
-
h('button', {
|
|
14324
|
-
key: 'model',
|
|
14325
|
-
type: 'button',
|
|
14326
|
-
className: 'iw-float-chip',
|
|
14327
|
-
title: tr('floatModelHint'),
|
|
14328
|
-
onClick: () => setMenu(menu === 'model' ? '' : 'model'),
|
|
14329
|
-
}, modelLabel),
|
|
14330
|
-
efforts.length === 0 ? null : h('button', {
|
|
14331
|
-
key: 'effort',
|
|
14332
|
-
type: 'button',
|
|
14333
|
-
className: 'iw-float-chip iw-float-effort',
|
|
14334
|
-
title: `${tr('floatEffort')}: ${effortLabel}`,
|
|
14335
|
-
onClick: () => setMenu(menu === 'effort' ? '' : 'effort'),
|
|
14336
|
-
}, effortLabel),
|
|
14337
15402
|
h('div', { key: 'actions', className: 'iw-float-actions' }, [
|
|
14338
15403
|
h('button', {
|
|
14339
15404
|
key: 'shrink',
|
|
@@ -14418,91 +15483,21 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14418
15483
|
}, entries.length === 0
|
|
14419
15484
|
? h('div', { key: 'empty', className: 'iw-float-empty' }, sessionId === '' ? tr('floatNoSession') : tr('floatEmpty'))
|
|
14420
15485
|
: entries.map((row) => {
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
title: file.path,
|
|
14429
|
-
onClick: () => {
|
|
14430
|
-
// Same entry point as the conversation's file cards: open the
|
|
14431
|
-
// file in the workspace and switch the panel to it.
|
|
14432
|
-
const opened = typeof openInWorkspace === 'function'
|
|
14433
|
-
? openInWorkspace(file.path) === true
|
|
14434
|
-
: store.openAt(file.path) === true
|
|
14435
|
-
if (opened !== true) store.setNotice(`${tr('floatOpenFailed')}: ${file.path}`)
|
|
14436
|
-
},
|
|
14437
|
-
}, [
|
|
14438
|
-
h('span', { key: 'n', className: 'iw-float-file-name' }, ideBasename(file.path)),
|
|
14439
|
-
file.description === '' ? null : h('span', { key: 'd', className: 'iw-float-file-desc' }, file.description),
|
|
14440
|
-
]))),
|
|
14441
|
-
])
|
|
15486
|
+
// One malformed event must not take the whole card down: a throw inside
|
|
15487
|
+
// this map unmounts the overlay, and the user just sees the card vanish.
|
|
15488
|
+
try {
|
|
15489
|
+
return ideFloatRow(row, tr, { setViewing, store, pictures, goToChat, running })
|
|
15490
|
+
} catch (error) {
|
|
15491
|
+
ideLogRecord('warn', 'float', 'row render failed', { key: row.key, error: String(error) })
|
|
15492
|
+
return h('div', { key: row.key, className: 'iw-float-row iw-float-assistant' }, String(row.text ?? ''))
|
|
14442
15493
|
}
|
|
14443
|
-
return h('div', { key: row.key, className: `iw-float-row iw-float-${row.role}` }, [
|
|
14444
|
-
h('span', { key: 'who', className: 'iw-float-who' }, row.role === 'user' ? tr('floatYou') : tr('floatAssistant')),
|
|
14445
|
-
// Both sides are markdown: a prompt can carry tables and lists too, and
|
|
14446
|
-
// rendering it as raw text was exactly what users complained about.
|
|
14447
|
-
row.text === '' ? null : h(IdeFloatMarkdown, { key: 'text', text: row.text, tr }),
|
|
14448
|
-
row.images === undefined || row.images.length === 0 ? null : h('div', { key: 'pics', className: 'iw-float-pics' }, row.images.map((image, index) => {
|
|
14449
|
-
const url = pictures[image.attachmentId] ?? ''
|
|
14450
|
-
if (url === '') return h('div', { key: `pic${index}`, className: 'iw-float-pic iw-float-pic-wait' })
|
|
14451
|
-
return h('img', {
|
|
14452
|
-
key: `pic${index}`,
|
|
14453
|
-
className: 'iw-float-pic',
|
|
14454
|
-
src: url,
|
|
14455
|
-
alt: image.name ?? '',
|
|
14456
|
-
title: tr('floatPreviewImage'),
|
|
14457
|
-
draggable: false,
|
|
14458
|
-
// Right-clicking here offers the app's own "Copy", which pastes the
|
|
14459
|
-
// file name instead of the picture.
|
|
14460
|
-
onContextMenu: (event) => event.preventDefault(),
|
|
14461
|
-
onClick: () => setViewing({ url, name: image.name ?? '' }),
|
|
14462
|
-
})
|
|
14463
|
-
})),
|
|
14464
|
-
])
|
|
14465
15494
|
})),
|
|
14466
|
-
running
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
key: '
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
onClick: () => setChangeOpen(!changeOpen),
|
|
14473
|
-
}, [
|
|
14474
|
-
h('span', { key: 'icon', className: 'iw-float-changes-icon', 'aria-hidden': 'true' }, '⌗'),
|
|
14475
|
-
h('span', { key: 'title', className: 'iw-float-changes-title' }, `${tr('floatChangesTitle')} ${changes.files.length} ${tr('floatChangesUnit')}`),
|
|
14476
|
-
h('span', { key: 'added', className: 'iw-float-changes-add' }, `+${changes.added}`),
|
|
14477
|
-
h('span', { key: 'deleted', className: 'iw-float-changes-del' }, `-${changes.deleted}`),
|
|
14478
|
-
]),
|
|
14479
|
-
h('div', { key: 'list', className: 'iw-float-changes-list' }, (changeOpen ? changes.files : changes.files.slice(0, 3)).map((file) => h('button', {
|
|
14480
|
-
key: file.path,
|
|
14481
|
-
type: 'button',
|
|
14482
|
-
className: 'iw-float-file',
|
|
14483
|
-
title: file.path,
|
|
14484
|
-
onClick: () => {
|
|
14485
|
-
const opened = typeof openInWorkspace === 'function'
|
|
14486
|
-
? openInWorkspace(file.path) === true
|
|
14487
|
-
: store.openAt(file.path) === true
|
|
14488
|
-
if (opened !== true) store.setNotice(`${tr('floatOpenFailed')}: ${file.path}`)
|
|
14489
|
-
},
|
|
14490
|
-
}, [
|
|
14491
|
-
h('span', { key: 'n', className: 'iw-float-file-name' }, ideBasename(file.path)),
|
|
14492
|
-
file.binary
|
|
14493
|
-
? h('span', { key: 'd', className: 'iw-float-file-desc' }, tr('floatChangesBinary'))
|
|
14494
|
-
: h('span', { key: 'd', className: 'iw-float-file-desc' }, [
|
|
14495
|
-
h('span', { key: 'a', className: 'iw-float-add' }, `+${file.added}`),
|
|
14496
|
-
h('span', { key: 'r', className: 'iw-float-del' }, `-${file.deleted}`),
|
|
14497
|
-
]),
|
|
14498
|
-
]))),
|
|
14499
|
-
changes.files.length <= 3 ? null : h('button', {
|
|
14500
|
-
key: 'more',
|
|
14501
|
-
type: 'button',
|
|
14502
|
-
className: 'iw-float-changes-more',
|
|
14503
|
-
onClick: () => setChangeOpen(!changeOpen),
|
|
14504
|
-
}, changeOpen ? tr('floatChangesLess') : `${tr('floatChangesAll')} ${changes.files.length}`),
|
|
14505
|
-
]),
|
|
15495
|
+
running
|
|
15496
|
+
? h('div', { key: 'think', className: 'iw-float-thinking' }, [
|
|
15497
|
+
h('span', { key: 'i', className: 'iw-float-thinking-icon' }, h(IdeSparkleIcon, { size: 15 })),
|
|
15498
|
+
h('span', { key: 't', className: 'iw-float-thinking-text' }, `${tr('floatRunning')},${ideFloatElapsed(turnStart === 0 ? 0 : Date.now() - turnStart, tr)} ···`),
|
|
15499
|
+
])
|
|
15500
|
+
: null,
|
|
14506
15501
|
viewing === null ? null : h('div', { key: 'viewer', className: 'iw-float-viewer' }, [
|
|
14507
15502
|
h('img', {
|
|
14508
15503
|
key: 'img',
|
|
@@ -14580,6 +15575,31 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14580
15575
|
onClick: () => { void choosePermission(entry.id) },
|
|
14581
15576
|
}, tr(entry.labelKey))))
|
|
14582
15577
|
: null,
|
|
15578
|
+
suggest === null || suggest.items.length === 0
|
|
15579
|
+
? null
|
|
15580
|
+
: h('div', { key: 'suggest', className: 'iw-float-suggest', role: 'listbox' },
|
|
15581
|
+
suggest.items.map((item, index) => {
|
|
15582
|
+
const previous = index === 0 ? '' : (suggest.items[index - 1]?.section ?? '')
|
|
15583
|
+
const titleKey = item.section !== previous ? ideFloatSectionKey(item.section) : ''
|
|
15584
|
+
return h(React.Fragment, { key: `${item.kind}:${item.id}` }, [
|
|
15585
|
+
titleKey === ''
|
|
15586
|
+
? null
|
|
15587
|
+
: h('div', { key: 'section', className: 'iw-float-suggest-section', role: 'presentation' }, tr(titleKey)),
|
|
15588
|
+
h('button', {
|
|
15589
|
+
key: 'row',
|
|
15590
|
+
type: 'button',
|
|
15591
|
+
role: 'option',
|
|
15592
|
+
'aria-selected': index === suggest.index,
|
|
15593
|
+
className: `iw-float-suggest-item${index === suggest.index ? ' on' : ''}`,
|
|
15594
|
+
onMouseDown: (event) => { event.preventDefault(); pickSuggest(item) },
|
|
15595
|
+
}, [
|
|
15596
|
+
h('span', { key: 'n', className: 'iw-float-suggest-name' }, item.label),
|
|
15597
|
+
item.alias === '' ? null : h('span', { key: 'a', className: 'iw-float-suggest-alias' }, item.alias),
|
|
15598
|
+
item.kind === 'dir' ? h('span', { key: 'd', className: 'iw-float-suggest-hint' }, tr('floatSuggestEnterDir')) : null,
|
|
15599
|
+
item.description === '' ? null : h('span', { key: 'desc', className: 'iw-float-suggest-desc' }, item.description),
|
|
15600
|
+
]),
|
|
15601
|
+
])
|
|
15602
|
+
})),
|
|
14583
15603
|
h('textarea', {
|
|
14584
15604
|
key: 't',
|
|
14585
15605
|
className: 'iw-float-textarea',
|
|
@@ -14589,45 +15609,99 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14589
15609
|
disabled: binding === null,
|
|
14590
15610
|
onChange: (event) => setDraft(event.target.value),
|
|
14591
15611
|
onPaste,
|
|
15612
|
+
onCompositionStart: () => { composingRef.current = true },
|
|
15613
|
+
onCompositionEnd: () => {
|
|
15614
|
+
composingRef.current = false
|
|
15615
|
+
composedAtRef.current = Date.now()
|
|
15616
|
+
},
|
|
14592
15617
|
onKeyDown: (event) => {
|
|
14593
|
-
if (
|
|
14594
|
-
|
|
14595
|
-
|
|
15618
|
+
if (suggest !== null && suggest.items.length > 0) {
|
|
15619
|
+
const count = suggest.items.length
|
|
15620
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
15621
|
+
event.preventDefault()
|
|
15622
|
+
const step = event.key === 'ArrowDown' ? 1 : -1
|
|
15623
|
+
setSuggest({ ...suggest, index: (suggest.index + step + count) % count })
|
|
15624
|
+
return
|
|
15625
|
+
}
|
|
15626
|
+
if (event.key === 'Escape') {
|
|
15627
|
+
event.preventDefault()
|
|
15628
|
+
setSuggest(null)
|
|
15629
|
+
return
|
|
15630
|
+
}
|
|
15631
|
+
if ((event.key === 'Enter' && event.shiftKey !== true) || event.key === 'Tab') {
|
|
15632
|
+
// Mid-composition the IME owns the key; the menu must not eat it.
|
|
15633
|
+
if (composingRef.current === true || event.nativeEvent?.isComposing === true || event.keyCode === 229) return
|
|
15634
|
+
event.preventDefault()
|
|
15635
|
+
pickSuggest(suggest.items[suggest.index])
|
|
15636
|
+
return
|
|
15637
|
+
}
|
|
14596
15638
|
}
|
|
15639
|
+
if (event.key !== 'Enter' || event.shiftKey === true) return
|
|
15640
|
+
// Mid-composition (or the keydown that ends one) belongs to the IME.
|
|
15641
|
+
if (composingRef.current === true) return
|
|
15642
|
+
if (event.nativeEvent?.isComposing === true || event.keyCode === 229) return
|
|
15643
|
+
if (Date.now() - composedAtRef.current < IDE_FLOAT_IME_SETTLE_MS) return
|
|
15644
|
+
event.preventDefault()
|
|
15645
|
+
void submit()
|
|
14597
15646
|
},
|
|
14598
15647
|
}),
|
|
14599
15648
|
h('div', { key: 'foot', className: 'iw-float-foot' }, [
|
|
14600
15649
|
h('button', {
|
|
14601
15650
|
key: 'plus',
|
|
14602
15651
|
type: 'button',
|
|
14603
|
-
className: 'iw-float-
|
|
15652
|
+
className: 'iw-float-plus',
|
|
14604
15653
|
title: tr('floatAttach'),
|
|
14605
15654
|
'aria-label': tr('floatAttach'),
|
|
14606
15655
|
onClick: () => setMenu(menu === 'attach' ? '' : 'attach'),
|
|
14607
|
-
},
|
|
15656
|
+
}, h(IdePlusIcon, { size: 14 })),
|
|
14608
15657
|
h('button', {
|
|
14609
15658
|
key: 'perm',
|
|
14610
15659
|
type: 'button',
|
|
14611
|
-
className: 'iw-float-
|
|
15660
|
+
className: 'iw-float-perm',
|
|
14612
15661
|
title: `${tr('floatPermission')}: ${ideFloatPermissionLabel(permission, tr)}`,
|
|
14613
15662
|
onClick: () => setMenu(menu === 'perm' ? '' : 'perm'),
|
|
14614
|
-
},
|
|
15663
|
+
}, [
|
|
15664
|
+
h(IdeLockIcon, { key: 'i', size: 13 }),
|
|
15665
|
+
h('span', { key: 't', className: 'iw-float-perm-text' }, ideFloatPermissionLabel(permission, tr)),
|
|
15666
|
+
h(IdeChevronDownIcon, { key: 'c', size: 12 }),
|
|
15667
|
+
]),
|
|
14615
15668
|
h('span', { key: 'gap', className: 'iw-float-gap' }),
|
|
15669
|
+
efforts.length === 0 ? null : h('button', {
|
|
15670
|
+
key: 'effort',
|
|
15671
|
+
type: 'button',
|
|
15672
|
+
className: 'iw-float-foot-chip',
|
|
15673
|
+
title: `${tr('floatEffort')}: ${effortLabel}`,
|
|
15674
|
+
onClick: () => setMenu(menu === 'effort' ? '' : 'effort'),
|
|
15675
|
+
}, effortLabel),
|
|
15676
|
+
h('button', {
|
|
15677
|
+
key: 'model',
|
|
15678
|
+
type: 'button',
|
|
15679
|
+
className: 'iw-float-foot-chip iw-float-foot-model',
|
|
15680
|
+
title: tr('floatModelHint'),
|
|
15681
|
+
onClick: () => setMenu(menu === 'model' ? '' : 'model'),
|
|
15682
|
+
}, [
|
|
15683
|
+
h('span', { key: 't', className: 'iw-float-foot-chip-text' }, modelLabel),
|
|
15684
|
+
h(IdeChevronDownIcon, { key: 'c', size: 12 }),
|
|
15685
|
+
]),
|
|
14616
15686
|
running
|
|
14617
15687
|
? h('button', {
|
|
14618
15688
|
key: 'stop',
|
|
14619
15689
|
type: 'button',
|
|
14620
15690
|
className: 'iw-float-send iw-float-stop',
|
|
15691
|
+
title: tr('floatStop'),
|
|
15692
|
+
'aria-label': tr('floatStop'),
|
|
14621
15693
|
onClick: () => { void stop() },
|
|
14622
|
-
},
|
|
15694
|
+
}, h(IdeStopMarkIcon, { size: 12 }))
|
|
14623
15695
|
: h('button', {
|
|
14624
15696
|
key: 'send',
|
|
14625
15697
|
type: 'button',
|
|
14626
15698
|
className: 'iw-float-send',
|
|
15699
|
+
title: tr('floatSend'),
|
|
15700
|
+
'aria-label': tr('floatSend'),
|
|
14627
15701
|
// A prompt may be images (or references) only.
|
|
14628
15702
|
disabled: binding === null || sending || (draft.trim() === '' && refs.length === 0 && images.length === 0),
|
|
14629
15703
|
onClick: () => { void submit() },
|
|
14630
|
-
},
|
|
15704
|
+
}, h(IdeArrowUpIcon, { size: 16 })),
|
|
14631
15705
|
]),
|
|
14632
15706
|
]),
|
|
14633
15707
|
h('div', { key: 'grip-n', className: 'iw-float-grip iw-float-grip-n', onPointerDown: onGripDown('n') }),
|
|
@@ -15225,9 +16299,10 @@ function apply(ctx) {
|
|
|
15225
16299
|
try {
|
|
15226
16300
|
layout.selectPanel(panelId)
|
|
15227
16301
|
lastSelect = 'ok'
|
|
15228
|
-
// The
|
|
15229
|
-
//
|
|
15230
|
-
store.
|
|
16302
|
+
// The whole workspace panel takes the centre column. A card the user
|
|
16303
|
+
// detached keeps showing in every other panel too.
|
|
16304
|
+
const detached = store.getState().floatDetached === true
|
|
16305
|
+
store.setFloatOpen(panelId === IDE_PANEL_ID || detached)
|
|
15231
16306
|
} catch (error) {
|
|
15232
16307
|
// The main seat registers after this row on a cold load; the button then
|
|
15233
16308
|
// simply does nothing rather than throwing into the click handler.
|
|
@@ -15520,8 +16595,9 @@ function apply(ctx) {
|
|
|
15520
16595
|
return () => {
|
|
15521
16596
|
if (!immersive) return
|
|
15522
16597
|
immersive = false
|
|
15523
|
-
// Back to the conversation: the
|
|
15524
|
-
|
|
16598
|
+
// Back to the conversation: the card leaves with the workspace unless the
|
|
16599
|
+
// user asked it to live on its own.
|
|
16600
|
+
if (store.getState().floatDetached !== true) store.setFloatOpen(false)
|
|
15525
16601
|
restoreSidebar()
|
|
15526
16602
|
}
|
|
15527
16603
|
}
|
|
@@ -15732,6 +16808,7 @@ function apply(ctx) {
|
|
|
15732
16808
|
if (editable && !withModifier && command.action !== 'back') return
|
|
15733
16809
|
event.preventDefault()
|
|
15734
16810
|
if (command.action === 'toggle') openPanel()
|
|
16811
|
+
else if (command.action === 'float-toggle') toggleFloat()
|
|
15735
16812
|
else if (command.action === 'back') selectPanel(null)
|
|
15736
16813
|
else if (command.action === 'screenshot') void startScreenshot()
|
|
15737
16814
|
else if (command.action === 'copy-reference') void copyReferenceShortcut()
|
|
@@ -15741,6 +16818,25 @@ function apply(ctx) {
|
|
|
15741
16818
|
}, true)
|
|
15742
16819
|
}
|
|
15743
16820
|
|
|
16821
|
+
/**
|
|
16822
|
+
* ⌥+空格:叫出/收起悬浮助手卡。卡片被设置关掉时说一声,而不是假装切了。
|
|
16823
|
+
*/
|
|
16824
|
+
function toggleFloat() {
|
|
16825
|
+
const look = store.getState()
|
|
16826
|
+
if (look.floatEnabled !== true) {
|
|
16827
|
+
store.setNotice(translate('floatToggleDisabled'))
|
|
16828
|
+
return
|
|
16829
|
+
}
|
|
16830
|
+
const visible = look.floatOpen === true && look.floatClosed !== true
|
|
16831
|
+
if (!visible) {
|
|
16832
|
+
store.setFloatOpen(true)
|
|
16833
|
+
store.setFloatCollapsed(false)
|
|
16834
|
+
return
|
|
16835
|
+
}
|
|
16836
|
+
// Expanded → 收成小球;小球 → 展开。一次按键只走一步。
|
|
16837
|
+
store.setFloatCollapsed(look.floatCollapsed !== true)
|
|
16838
|
+
}
|
|
16839
|
+
|
|
15744
16840
|
/**
|
|
15745
16841
|
* The code workspace's own settings page.
|
|
15746
16842
|
*
|
|
@@ -15811,6 +16907,41 @@ function apply(ctx) {
|
|
|
15811
16907
|
sessions: ctx.get('sessions'),
|
|
15812
16908
|
modelDirectories: ctx.get('modelDirectories'),
|
|
15813
16909
|
translate,
|
|
16910
|
+
// The float's `/` and `@` menus read the same catalog and the same file
|
|
16911
|
+
// listing the conversation's own composer does: one source of truth.
|
|
16912
|
+
commandList: async (sessionId) => {
|
|
16913
|
+
try {
|
|
16914
|
+
const result = await ctx.remote.commands.list(sessionId)
|
|
16915
|
+
if (result?.ok === false) return { error: result.error?.message ?? result.error?.code ?? 'failed' }
|
|
16916
|
+
return { value: Array.isArray(result?.value) ? result.value : [] }
|
|
16917
|
+
} catch (error) {
|
|
16918
|
+
return { error: String(error?.message ?? error) }
|
|
16919
|
+
}
|
|
16920
|
+
},
|
|
16921
|
+
skillList: async (sessionId) => {
|
|
16922
|
+
try {
|
|
16923
|
+
// The Host takes a request object here, not a bare id.
|
|
16924
|
+
const result = await ctx.remote.skills.list({ sessionId })
|
|
16925
|
+
if (result?.ok === false) return { error: result.error?.message ?? result.error?.code ?? 'failed' }
|
|
16926
|
+
const value = result?.value
|
|
16927
|
+
return { value: Array.isArray(value) ? value : (Array.isArray(value?.skills) ? value.skills : []) }
|
|
16928
|
+
} catch (error) {
|
|
16929
|
+
return { error: String(error?.message ?? error) }
|
|
16930
|
+
}
|
|
16931
|
+
},
|
|
16932
|
+
workspaceList: async (sessionId, path) => {
|
|
16933
|
+
try {
|
|
16934
|
+
const result = await ctx.remote.workspaceFiles.list(sessionId, path)
|
|
16935
|
+
if (result?.ok === false) return { error: result.error?.message ?? result.error?.code ?? 'failed' }
|
|
16936
|
+
const entries = result?.value?.entries
|
|
16937
|
+
return { value: Array.isArray(entries) ? entries : [] }
|
|
16938
|
+
} catch (error) {
|
|
16939
|
+
return { error: String(error?.message ?? error) }
|
|
16940
|
+
}
|
|
16941
|
+
},
|
|
16942
|
+
// An open question can only be answered in the Conversation; the card's
|
|
16943
|
+
// button sends the user there instead of faking an answer.
|
|
16944
|
+
goToChat: () => backToChat(),
|
|
15814
16945
|
// The card's file chips open files exactly like the conversation's file
|
|
15815
16946
|
// cards do: one workspace tab, one panel selection, no preview pane.
|
|
15816
16947
|
openInWorkspace: (path) => {
|
|
@@ -15945,6 +17076,6 @@ function apply(ctx) {
|
|
|
15945
17076
|
// 'shortcuts' is read directly at apply time (the plugin contributes two
|
|
15946
17077
|
// rebindable commands), and the client runtime refuses any service that is
|
|
15947
17078
|
// not declared here: cannot get property "shortcuts" without inject.
|
|
15948
|
-
return { inject: ['slots', 'locale', 'shortcuts', 'sessions'], apply }
|
|
17079
|
+
return { inject: ['slots', 'locale', 'shortcuts', 'sessions', 'remote', 'remote.commands', 'remote.workspaceFiles', 'remote.skills'], apply }
|
|
15949
17080
|
},
|
|
15950
17081
|
})
|