dsh-edge 0.18.0 → 0.19.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +8 -8
  3. package/README.zh.md +8 -8
  4. package/THIRD_PARTY_NOTICES.md +2011 -449
  5. package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
  6. package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
  7. package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
  8. package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
  9. package/dist/assets/index-Cq6ljTv2.css +1 -0
  10. package/dist/assets/index-Dy0OhsZ5.js +127 -0
  11. package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
  12. package/dist/assets/langs/bat-BkioyH1T.js +2 -0
  13. package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
  14. package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
  15. package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
  16. package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
  17. package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
  18. package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
  19. package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
  20. package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
  21. package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
  22. package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
  23. package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
  24. package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
  25. package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
  26. package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
  27. package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
  28. package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
  29. package/dist/assets/langs/html-fwsONPVS.js +2 -0
  30. package/dist/assets/langs/http-DcV90OkR.js +2 -0
  31. package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
  32. package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
  33. package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
  34. package/dist/assets/langs/log-2UxHyX5q.js +2 -0
  35. package/dist/assets/langs/make-CHLpvVh8.js +2 -0
  36. package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
  37. package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
  38. package/dist/assets/langs/php-LEPfNACG.js +2 -0
  39. package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
  40. package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
  41. package/dist/assets/langs/r-Dspwwk_N.js +2 -0
  42. package/dist/assets/langs/rst-BbocfKWr.js +2 -0
  43. package/dist/assets/langs/ruby-R292Iif0.js +2 -0
  44. package/dist/assets/langs/scala-C151Ov-r.js +2 -0
  45. package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
  46. package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
  47. package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
  48. package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
  49. package/dist/assets/langs/vue-Dq2x6432.js +2 -0
  50. package/dist/favicon-dark.svg +3 -0
  51. package/dist/favicon.svg +0 -5
  52. package/dist/index.html +5 -4
  53. package/dist/manifest.webmanifest +3 -4
  54. package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
  55. package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
  56. package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
  57. package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
  58. package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
  59. package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
  60. package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
  61. package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
  62. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
  63. package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
  64. package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
  65. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
  66. package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
  67. package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
  68. package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
  69. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
  70. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
  71. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
  72. package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
  73. package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
  74. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
  75. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
  76. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
  77. package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
  78. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
  79. package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
  80. package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
  81. package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
  82. package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
  83. package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
  84. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
  85. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
  86. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
  87. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
  88. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
  89. package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
  90. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
  91. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
  92. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
  93. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
  94. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
  95. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
  96. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
  97. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
  98. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
  99. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
  100. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
  101. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
  102. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
  103. package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
  104. package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
  105. package/package.json +96 -86
  106. package/scripts/cli.mjs +16 -4
  107. package/scripts/install.d.mts +12 -2
  108. package/scripts/install.mjs +36 -9
  109. package/scripts/legal-files.mjs +15 -0
  110. package/worker/direct/index.js +2564 -1822
  111. package/worker/isolated/index.js +2144 -1402
  112. package/dist/assets/index-BKQ_L1z6.js +0 -117
  113. package/dist/assets/index-DPX2bQLO.css +0 -1
  114. package/dist/assets/langs/html-CfGypltT.js +0 -2
  115. package/dist/assets/langs/php-DJl5gRdb.js +0 -2
  116. package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
  117. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
  118. package/dist/plugins/@deepseek-ai/dsh-client-ui-schedule/client.js +0 -307
@@ -8,7 +8,220 @@ window.__ModuleLoader__.load({
8
8
  let react = require("react");
9
9
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
10
10
  let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
11
- //#region ../../preset/agent-presets/src/display.ts
11
+ //#region ../../util/values/src/index.ts
12
+ /**
13
+ * Weak-key lookup with a strongly retained iterable set of associated values.
14
+ *
15
+ * Each value must belong to only one key. The container performs no automatic
16
+ * cleanup; owners delete associations or clear the container at lifecycle end.
17
+ */
18
+ var WeakMapWithValues = class {
19
+ keys = /* @__PURE__ */ new WeakMap();
20
+ valueSet = /* @__PURE__ */ new Set();
21
+ /** Live strongly retained values in insertion order. */
22
+ values = this.valueSet;
23
+ /**
24
+ * Read the value associated with a key.
25
+ * @param key - weakly held lookup key.
26
+ * @returns the associated value, or absence.
27
+ */
28
+ get(key) {
29
+ return this.keys.get(key);
30
+ }
31
+ /**
32
+ * Test whether a key has an association.
33
+ * @param key - weakly held lookup key.
34
+ * @returns whether the key is present.
35
+ */
36
+ has(key) {
37
+ return this.keys.has(key);
38
+ }
39
+ /**
40
+ * Associate one key with one caller-unique value.
41
+ * @param key - weakly held lookup key.
42
+ * @param value - strongly retained value that belongs to no other key.
43
+ * @returns this container.
44
+ */
45
+ set(key, value) {
46
+ if (this.keys.has(key)) {
47
+ const previous = this.keys.get(key);
48
+ if (previous === value) return this;
49
+ this.valueSet.delete(previous);
50
+ }
51
+ this.keys.set(key, value);
52
+ this.valueSet.add(value);
53
+ return this;
54
+ }
55
+ /**
56
+ * Remove one association and its strongly retained value.
57
+ * @param key - weakly held lookup key.
58
+ * @returns whether an association was removed.
59
+ */
60
+ delete(key) {
61
+ if (!this.keys.has(key)) return false;
62
+ const value = this.keys.get(key);
63
+ const deleted = this.keys.delete(key);
64
+ this.valueSet.delete(value);
65
+ return deleted;
66
+ }
67
+ /** Remove every association and strongly retained value. */
68
+ clear() {
69
+ this.keys = /* @__PURE__ */ new WeakMap();
70
+ this.valueSet.clear();
71
+ }
72
+ };
73
+ //#endregion
74
+ //#region lib/types/client/guide-locales.js
75
+ /** Curated help for shipped presets, kept separate from their short picker copy. */
76
+ const guideEn = {
77
+ modeExplanation: "Mode details",
78
+ howToUse: "How to use",
79
+ guideSections: "Guide sections",
80
+ guideExampleTask: "Example task",
81
+ guideCopy: "Copy",
82
+ guideCopied: "Copied",
83
+ guideFootnotes: "Footnotes",
84
+ guideStandardIntro: "Choose Standard mode when starting a new task. Describe what you want to accomplish, point to the relevant files, and explain how to check the result.",
85
+ guideStandardExplanation: [
86
+ "### How it works",
87
+ "The agent calls tools directly to read and edit files, search, and run terminal commands. It includes Skills, planning, goals, subagents, workflows, and context compaction.",
88
+ "### When to choose it",
89
+ "Start here for everyday coding, file work, and research. Standard mode can also write scripts and process files in batches. PTC changes how tool calls are organized; it is not required for batch tasks."
90
+ ].join("\n\n"),
91
+ guideStandardUsage: [
92
+ "### Fix a bug",
93
+ "> Find out why submitting the search form twice makes the results disappear. Fix it and run the relevant tests. Explain the cause and what changed.",
94
+ "Expected output: a code change, the relevant test results, and an explanation of the cause.",
95
+ "### Organize project notes",
96
+ "> Read the Markdown notes in this project. Summarize the agreed decisions and open questions, with links to the source files.",
97
+ "Expected output: a summary with references that you can check against the original notes."
98
+ ].join("\n\n"),
99
+ guidePtcIntro: "Choose PTC mode when starting a new task. Specify the input files, processing rules, and output format. The agent writes the code.",
100
+ guidePtcExplanation: [
101
+ "### How tools are called",
102
+ "PTC means Programmatic Tool Calling. In this built-in preset, the agent uses run_code to write a TypeScript program that calls tools through a generated SDK. The program can use loops, conditions, error handling, and concurrent calls where appropriate.",
103
+ "### What reaches the model",
104
+ "Tool results first reach the program, which can filter and combine them. The model receives what the program prints or returns; image results are attached separately. Nested tool calls are still recorded and remain subject to tool permissions.",
105
+ "### Compared with Standard mode",
106
+ "Both modes can handle coding and batch tasks. Standard mode exposes individual tools directly; PTC organizes tool calls in code. The current PTC preset leaves the workflow tool disabled. Speed and token use depend on the task and how the program handles its results."
107
+ ].join("\n\n"),
108
+ guidePtcUsage: [
109
+ "### Check a set of configuration files",
110
+ "> Check all JSON files in configs/. List missing required fields and invalid values against schema.json. Save a CSV with one row per issue. Include unreadable files in the report and keep checking the rest. Leave the original files unchanged.",
111
+ "Expected output: an issue summary and a CSV report. The program can repeat the same checks, handle individual failures, and collect the results.",
112
+ "### Summarize error logs",
113
+ "> Analyze the log files in logs/. Group errors by service and error type. Show the ten most frequent groups and one example from each. Save the full counts to a CSV.",
114
+ "Expected output: the top error groups and a complete count table. Intermediate data can be aggregated in the program before the summary reaches the model."
115
+ ].join("\n\n"),
116
+ guideMinimalIntro: "Choose Minimal mode for a new task. For a comparison, hold the model, permissions, input, and starting workspace state constant across runs.",
117
+ guideMinimalExplanation: [
118
+ "### What is included",
119
+ "One persistent shell tool and a fixed system prompt. The built-in preset does not load Skills, planning, context compaction, or the standard runtime context.",
120
+ "### When to choose it",
121
+ "Use it as a baseline for experiments and comparisons. It can still read files and execute scripts through shell commands, but offers fewer built-in ways to manage a long task. Fewer tools does not necessarily make it easier for a beginner."
122
+ ].join("\n\n"),
123
+ guideMinimalUsage: [
124
+ "### Compare performance on a small bug fix",
125
+ "> Run the tests for this project, find the cause of the failure, and make the smallest fix. Run the relevant tests again and report the result.",
126
+ "Run the same task separately in Standard and Minimal modes from the same starting state. Compare task completion, tool calls, and the resulting changes. Minimal mode performs the work through terminal commands."
127
+ ].join("\n\n"),
128
+ guideCordisIntro: "Choose Creator mode for a new task. Describe the capability you want, where it should appear, and how you will verify it.",
129
+ guideCordisExplanation: [
130
+ "### What you can create",
131
+ "Creator mode includes the standard task tools plus runtime inspection, persistent plugin management, and guidance for authoring Cordis plugins and agent presets. It can create a plugin that adds a capability or UI, or a preset that combines tools and prompts for a particular job.",
132
+ "### Plugins and modes",
133
+ "A plugin adds capabilities to DSH, such as a tool, a service connection, or a UI entry. A mode is an agent preset that selects tools and defines how the agent works in a task. A plugin can be included in a custom preset.",
134
+ "### How the result takes effect",
135
+ "Ask the agent to install and verify the result, not just generate source code. A plugin may load immediately or require a restart, depending on what it changes. A newly created preset is selected when starting a new task."
136
+ ].join("\n\n"),
137
+ guideCordisUsage: [
138
+ "### Add a UI",
139
+ "> Create a DSH plugin that adds a project notes entry to the sidebar. Let me browse the Markdown files in this workspace and preview a selected note. Install it and verify that the page opens.",
140
+ "Expected output: an installed plugin with a working entry and preview page, plus any remaining activation steps.",
141
+ "### Add a tool",
142
+ "> Create a plugin with a tool that reads this project’s test report and summarizes the failed tests. Register it and verify it with a sample report.",
143
+ "Expected output: a plugin with a callable tool and a verified sample call.",
144
+ "### Create my own mode",
145
+ "> Create a “Code review” mode based on Standard mode. Have it prioritize potential bugs and test gaps, cite file paths and lines, and ask before modifying files. Save it as a selectable preset.",
146
+ "Expected output: a custom preset for new tasks. These review instructions guide the agent; permission settings determine which actions it can execute."
147
+ ].join("\n\n")
148
+ };
149
+ /** Simplified Chinese help. Examples describe suggested tasks, not recorded runs. */
150
+ const guideZh = {
151
+ modeExplanation: "模式说明",
152
+ howToUse: "如何使用",
153
+ guideSections: "帮助内容",
154
+ guideExampleTask: "示例任务",
155
+ guideCopy: "复制",
156
+ guideCopied: "已复制",
157
+ guideFootnotes: "脚注",
158
+ guideStandardIntro: "新建任务时选择「标准模式」,说明要完成什么、相关文件在哪里,以及怎样判断任务完成。",
159
+ guideStandardExplanation: [
160
+ "### 工作方式",
161
+ "Agent 直接调用工具来读写文件、检索资料和执行终端命令。包含 Skills、计划、目标、子 Agent、工作流和上下文压缩等能力。",
162
+ "### 什么时候选",
163
+ "日常编程、文件处理和资料整理可以从这里开始。标准模式也能编写脚本、批量处理文件;PTC 改变的是工具调用方式,批量任务并不必须使用 PTC。"
164
+ ].join("\n\n"),
165
+ guideStandardUsage: [
166
+ "### 修复一个问题",
167
+ "> 搜索表单连续提交两次后,结果会消失。请定位原因、修复问题并运行相关测试,最后说明原因和修改内容。",
168
+ "预期产出:代码修改、相关测试结果,以及问题原因说明。",
169
+ "### 整理项目资料",
170
+ "> 阅读项目中的 Markdown 记录,整理已经达成的结论和仍待确认的问题,并附上对应文件链接。",
171
+ "预期产出:一份带来源引用的总结,方便回到原文核对。"
172
+ ].join("\n\n"),
173
+ guidePtcIntro: "新建任务时选择「PTC 模式」,说明输入文件、处理规则和输出格式。代码由 Agent 编写。",
174
+ guidePtcExplanation: [
175
+ "### 怎样调用工具",
176
+ "PTC 是 Programmatic Tool Calling,即通过程序调用工具。当前内置预设让 Agent 通过 run_code 编写 TypeScript 程序,使用生成的工具 SDK 发起调用。程序可以组织循环、条件判断、错误处理,以及适合并发执行的调用。",
177
+ "### 哪些结果交给模型",
178
+ "工具返回的数据先交给程序,经过筛选、计算或合并,再通过输出或返回值交给模型;图片结果会另行附加。程序中的工具调用仍会被记录,也仍受工具权限约束。",
179
+ "### 与标准模式的区别",
180
+ "两种模式都能编程、批量处理文件。标准模式直接向模型提供各个工具;PTC 让模型用代码组织工具调用。当前 PTC 预设未启用 workflow 工具。速度和 token 用量取决于具体任务与结果处理方式。"
181
+ ].join("\n\n"),
182
+ guidePtcUsage: [
183
+ "### 批量检查配置文件",
184
+ "> 检查 configs/ 下所有 JSON 文件,按照 schema.json 找出缺失字段和不合法的值。每个问题写成 CSV 中的一行;读取失败的文件也记入报告,继续检查其余文件。保留原文件。",
185
+ "预期产出:问题汇总和一份 CSV 报告。程序可以对多份文件执行相同检查,处理单个文件的失败,再汇总结果。",
186
+ "### 汇总错误日志",
187
+ "> 分析 logs/ 下的日志,按服务和错误类型统计次数,列出出现最多的十类错误,每类保留一条示例。完整统计另存为 CSV。",
188
+ "预期产出:高频错误摘要和完整统计表。中间数据可以先在程序中聚合,再把汇总交给模型。"
189
+ ].join("\n\n"),
190
+ guideMinimalIntro: "新建任务时选择「极简模式」。做对照测试时,保持模型、权限、任务输入和工作区起始状态一致。",
191
+ guideMinimalExplanation: [
192
+ "### 保留哪些能力",
193
+ "仅提供一个持久 Shell 工具,并使用固定系统提示词。内置预设不加载 Skills、计划、上下文压缩,也不注入标准运行时上下文。",
194
+ "### 什么时候选",
195
+ "适合作为实验和对照测试的基线。Agent 仍能通过终端命令读写文件、运行脚本,但缺少管理长任务的内置辅助能力。工具少,不代表对新手更容易。"
196
+ ].join("\n\n"),
197
+ guideMinimalUsage: [
198
+ "### 对比基础修复表现",
199
+ "> 运行这个项目的测试,找出失败原因,做最小修复,再运行相关测试并报告结果。",
200
+ "分别用标准模式和极简模式,从相同的工作区状态执行这条任务,对比完成情况、工具调用和最终修改。极简模式会通过终端命令完成这些操作。"
201
+ ].join("\n\n"),
202
+ guideCordisIntro: "新建任务时选择「创造模式」,说明希望增加什么能力、从哪里使用,以及怎样验证效果。",
203
+ guideCordisExplanation: [
204
+ "### 可以创造什么",
205
+ "创造模式具备标准任务工具,并增加运行时检查、持久化插件管理,以及 Cordis 插件和 Agent 预设的开发指引。可以编写插件来添加功能或界面,也可以组合工具和提示词,创建适合特定任务的模式。",
206
+ "### 插件与模式的关系",
207
+ "插件为 DSH 增加能力,例如工具、服务连接或界面入口。模式是一份 Agent 预设,用来选择任务可用的工具,并约定 Agent 的工作方式。自定义模式中也可以使用自己开发的插件。",
208
+ "### 怎样让成果生效",
209
+ "可以要求 Agent 完成安装并验证实际效果。插件可能即时加载,也可能需要重启,取决于修改内容;新建的模式在创建新任务时选择。"
210
+ ].join("\n\n"),
211
+ guideCordisUsage: [
212
+ "### 添加一个界面",
213
+ "> 帮我写一个 DSH 插件,在侧栏增加「项目笔记」入口,列出当前工作区的 Markdown 文件,点击后能预览内容。完成安装并验证页面能打开。",
214
+ "预期产出:带侧栏入口和预览页的插件,以及仍需完成的生效步骤。",
215
+ "### 添加一个工具",
216
+ "> 写一个插件,提供读取项目测试报告、汇总失败用例的工具。注册工具,并用一份示例报告验证调用结果。",
217
+ "预期产出:可调用的新工具,以及一次示例调用的验证结果。",
218
+ "### 创建自己的模式",
219
+ "> 基于标准模式创建「代码审查」模式,优先检查潜在错误和测试缺口,指出文件与行号,修改文件前先询问我。保存成可选择的预设。",
220
+ "预期产出:可在新任务中选择的自定义模式。审查要求用于指导 Agent,实际可执行的操作仍由权限设置决定。"
221
+ ].join("\n\n")
222
+ };
223
+ //#endregion
224
+ //#region ../../preset/agent-preset-registry/src/display.ts
12
225
  const BUILT_IN_PRESET_KEYS = {
13
226
  standard: {
14
227
  name: "presetStandardName",
@@ -28,13 +241,22 @@ window.__ModuleLoader__.load({
28
241
  }
29
242
  };
30
243
  /**
244
+ * Whether a roster row is one of the shipped presets whose copy the dictionaries carry.
245
+ * A shipped preset publishes no `name`; a declaration that names itself owns its copy.
246
+ * @param preset - roster row.
247
+ * @returns true for a shipped preset id without a published name.
248
+ */
249
+ function isBuiltInPreset(preset) {
250
+ return preset.name === void 0 && BUILT_IN_PRESET_KEYS[preset.id] !== void 0;
251
+ }
252
+ /**
31
253
  * Resolve preset display copy without making user-authored metadata translatable.
32
254
  * @param preset - roster row whose copy is being rendered.
33
255
  * @param t - active locale lookup covering {@link BuiltInPresetCopyKey}.
34
- * @returns localized copy for a known shipped preset, otherwise file metadata.
256
+ * @returns localized copy for a known shipped preset, otherwise declaration metadata.
35
257
  */
36
258
  function presetDisplayText(preset, t) {
37
- const keys = preset.trust === "system" ? BUILT_IN_PRESET_KEYS[preset.id] : void 0;
259
+ const keys = isBuiltInPreset(preset) ? BUILT_IN_PRESET_KEYS[preset.id] : void 0;
38
260
  if (keys !== void 0) return {
39
261
  name: t(keys.name),
40
262
  description: t(keys.description)
@@ -49,121 +271,69 @@ window.__ModuleLoader__.load({
49
271
  /** Locale bundles for the agent-preset hero chip, header label, and management section. */
50
272
  /** English copy. */
51
273
  const en = {
52
- error: "Could not load agent presets.",
53
- userTrust: "Custom",
54
- seatHint: "Agent preset for the session you are about to start",
55
- headerHint: "The agent preset this session runs, fixed when it started",
274
+ ...guideEn,
275
+ builtInGroup: "Built-in",
276
+ customGroup: "Custom",
277
+ sectionIntro: "Choose the agent’s tools and how it works. Use Standard mode for everyday tasks, or Creator mode to add capabilities to DSH.",
278
+ seatHint: "Choose the agent preset for your new task",
279
+ headerHint: "The agent preset chosen when this task started",
56
280
  nav: "Agent presets",
57
- sectionIntro: "A preset is the plugin composition one session's agent runs — its tools, prompt, and capabilities. Duplicate an existing one and make it yours, or let the agent draft one for you in Creator mode.",
58
- builtIn: "Built-in",
59
- setDefault: "Set as default",
60
- view: "View",
281
+ setDefault: "Set as new task default",
282
+ view: "View configuration",
61
283
  presetStandardName: "Standard mode",
62
- presetStandardDescription: "Full coding agent with file editing, shell, file and web search, skills, planning, goals, subagents, and workflows.",
284
+ presetStandardDescription: "Work with code, files, and information. Suitable for most tasks, with search, editing, terminal commands, and other tools available as needed.",
63
285
  presetPtcName: "PTC mode",
64
- presetPtcDescription: "Full coding agent without the workflow tool; other tools are exposed through the PTC mode SDK so the model can combine multi-step operations in one TypeScript program.",
286
+ presetPtcDescription: "Includes all Standard mode capabilities. Better suited to tasks that call tools in batches and then filter, organize, deduplicate, count, or summarize the results.",
65
287
  presetMinimalName: "Minimal mode",
66
- presetMinimalDescription: "Single-tool coding agent with a persistent shell.",
288
+ presetMinimalDescription: "The agent works using only a terminal tool. Useful for testing and comparing its basic performance.",
67
289
  presetCordisName: "Creator mode",
68
- presetCordisDescription: "Built for creating custom agent presets, with all Standard mode capabilities plus runtime inspection, plugin experiments, and preset-authoring guidance.",
69
- duplicate: "Duplicate",
70
- duplicateUnavailable: "This deployment has no writable preset directory",
71
- delete: "Delete",
72
- presetId: "Identifier",
73
- presetIdPlaceholder: "my-agent",
74
- displayName: "Name",
75
- displayNamePlaceholder: "Shown in the picker; defaults to the identifier",
76
- inUse: "In use",
77
- builtInGroup: "Built-in",
78
- customGroup: "Custom",
290
+ presetCordisDescription: "Customize DSH through conversation. Let the agent write plugins that add features or UI, or combine tools and prompts to create your own mode.",
291
+ inUse: "New task default",
79
292
  noDescription: "No description.",
80
293
  brokenBadge: "Failed to load",
81
- brokenNoCopy: "A preset that failed to load cannot be duplicated",
82
294
  switchRefused: "Could not switch to {name}: {reason}",
83
- copyOf: "Copied from",
84
- composition: "Composition (agent.cordis.yml)",
85
- cancel: "Cancel",
86
295
  close: "Close",
87
- retry: "Retry",
88
- copyTitle: "Duplicate preset",
89
- copyIntro: "The whole preset is copied on this machine. The identifier becomes its directory name and cannot be changed later; everything else is edited in the preset's own files.",
90
- create: "Create",
91
- creating: "Creating…",
92
- creatorDraft: "Draft a custom preset with Creator mode",
93
- openLocation: "Open folder",
94
- showLocation: "Show location",
95
- revealedPathLabel: "Preset files:",
96
- idRequired: "Give the preset an identifier.",
97
- idInvalid: "Use lowercase letters, digits, and hyphens, starting with a letter or digit.",
98
- idTaken: "A preset with this identifier already exists.",
99
- deleteTitle: "Delete this preset?",
100
- deleteDescription: "The preset directory is deleted. Sessions already running on it keep working; new sessions cannot select it.",
101
- deleteConfirm: "Delete",
102
- deleting: "Deleting…"
296
+ creatorDraft: "Let the agent help me create a preset",
297
+ enableDevToolsToSetDefault: "Turn on Coding Tools in General settings to choose a default",
298
+ enableDevToolsToCreate: "Turn on Coding Tools in General settings to start Creator mode"
103
299
  };
104
300
  /** Simplified Chinese copy. */
105
301
  const zh = {
106
- error: "无法加载 Agent 预设。",
107
- userTrust: "自定义",
108
- seatHint: "即将开始的这个会话所用的 Agent 预设",
109
- headerHint: "本会话运行的 Agent 预设,开始时即固定",
302
+ ...guideZh,
303
+ builtInGroup: "内置",
304
+ customGroup: "自定义",
305
+ sectionIntro: "选择 Agent 的工具和工作方式。日常任务用「标准模式」,扩展 DSH 的能力用「创造模式」。",
306
+ seatHint: "选择新任务使用的 Agent 预设",
307
+ headerHint: "本任务的 Agent 预设,在任务开始时确定",
110
308
  nav: "Agent 预设",
111
- sectionIntro: "预设即一个会话的 Agent 所运行的插件组装 —— 它的工具、提示词与能力。复制一份既有预设改成自己的,或用「创造模式」让 Agent 帮你创建。",
112
- builtIn: "内置",
113
- setDefault: "设为默认",
114
- view: "查看",
309
+ setDefault: "设为新任务默认",
310
+ view: "查看配置",
115
311
  presetStandardName: "标准模式",
116
- presetStandardDescription: "功能完整的编码 Agent,支持文件编辑、Shell、文件与网页检索、Skills、计划、目标、子代理和工作流。",
312
+ presetStandardDescription: "处理代码、文件和资料,适合大多数任务。Agent 会按需使用检索、编辑和终端等工具。",
117
313
  presetPtcName: "PTC 模式",
118
- presetPtcDescription: "功能完整的编码 Agent,但默认不提供 workflow 工具;其他工具通过 PTC 模式 SDK 呈现,让模型用一个 TypeScript 程序组合多步操作。",
314
+ presetPtcDescription: "包含标准模式的所有能力,更适合批量调用工具,并对结果进行筛选、整理、去重、统计或汇总的任务。",
119
315
  presetMinimalName: "极简模式",
120
- presetMinimalDescription: "仅提供持久 shell 的单工具编码 Agent。",
316
+ presetMinimalDescription: "Agent 仅使用终端工具完成任务,适合测试和对比其基础表现。",
121
317
  presetCordisName: "创造模式",
122
- presetCordisDescription: "用于创建自定义 Agent preset:具备标准模式的全部能力,并提供运行时检查、插件实验和 preset 创作指导。",
123
- duplicate: "复制",
124
- duplicateUnavailable: "此部署未配置可写的预设目录",
125
- delete: "删除",
126
- presetId: "标识符",
127
- presetIdPlaceholder: "my-agent",
128
- displayName: "名称",
129
- displayNamePlaceholder: "选择器中显示的名字,缺省用标识符",
130
- inUse: "当前使用",
131
- builtInGroup: "内置",
132
- customGroup: "自定义",
318
+ presetCordisDescription: "用对话定制 DSH:让 Agent 编写插件,添加新功能或界面;也能组合工具和提示词,创建自己的模式。",
319
+ inUse: "新任务默认",
133
320
  noDescription: "暂无描述。",
134
321
  brokenBadge: "加载失败",
135
- brokenNoCopy: "预设加载失败,不能复制",
136
322
  switchRefused: "无法切换到「{name}」:{reason}",
137
- copyOf: "复制自",
138
- composition: "组装(agent.cordis.yml)",
139
- cancel: "取消",
140
323
  close: "关闭",
141
- retry: "重试",
142
- copyTitle: "复制预设",
143
- copyIntro: "整个预设会在本机复制一份。标识符将成为目录名,事后无法更改;其余内容之后直接在预设自己的文件里编辑。",
144
- create: "创建",
145
- creating: "正在创建…",
146
- creatorDraft: "用「创造模式」创作自定义预设",
147
- openLocation: "打开目录",
148
- showLocation: "查看路径",
149
- revealedPathLabel: "预设文件:",
150
- idRequired: "请填写标识符。",
151
- idInvalid: "只能使用小写字母、数字与连字符,且以字母或数字开头。",
152
- idTaken: "该标识符已被占用。",
153
- deleteTitle: "删除该预设?",
154
- deleteDescription: "预设目录将被删除。已在其上运行的会话不受影响;新会话将无法再选择它。",
155
- deleteConfirm: "删除",
156
- deleting: "正在删除…"
324
+ creatorDraft: "让 Agent 帮我创建预设模式",
325
+ enableDevToolsToSetDefault: "请先在通用设置中开启代码工作工具,再设置默认值",
326
+ enableDevToolsToCreate: "请先在通用设置中开启代码工作工具,再启动创造模式"
157
327
  };
158
328
  //#endregion
159
329
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-agent-preset/src/client/AgentPresetLabel.module.css.mjs
160
- const css$2 = ".SVAs4q_label{background:var(--dsw-alias-fill-tsp-secondary);max-width:180px;height:22px;color:var(--dsw-alias-label-secondary);white-space:nowrap;text-overflow:ellipsis;border-radius:6px;align-items:center;gap:4px;padding:0 2px 0 0;font-size:12px;line-height:22px;display:inline-flex;overflow:hidden}.SVAs4q_icon{opacity:.7;flex:none}";
161
- const tagId$2 = "@deepseek-ai/dsh-client-ui-agent-preset/AgentPresetLabel.module.css";
162
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
330
+ const css$3 = ".SVAs4q_label{border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-fill-tsp-secondary);max-width:180px;height:22px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;align-items:center;gap:4px;padding:0 2px 0 0;font-size:12px;line-height:22px;display:inline-flex;overflow:hidden}.SVAs4q_icon{opacity:.7;flex:none}@container (width<=540px){.SVAs4q_label{display:none}}";
331
+ const tagId$3 = "@deepseek-ai/dsh-client-ui-agent-preset/AgentPresetLabel.module.css";
332
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
163
333
  const tag = document.createElement("style");
164
334
  tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-agent-preset";
165
- tag.dataset.pluginCss = tagId$2;
166
- tag.textContent = css$2;
335
+ tag.dataset.pluginCss = tagId$3;
336
+ tag.textContent = css$3;
167
337
  document.head.appendChild(tag);
168
338
  }
169
339
  var AgentPresetLabel_module_css_default = {
@@ -201,7 +371,7 @@ window.__ModuleLoader__.load({
201
371
  return (0, react_jsx_runtime.jsxs)("span", {
202
372
  className: AgentPresetLabel_module_css_default.label,
203
373
  title: text?.description ?? t("headerHint"),
204
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, {
374
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutlineRegular, {
205
375
  size: 14,
206
376
  className: AgentPresetLabel_module_css_default.icon
207
377
  }), text?.name ?? preset]
@@ -209,13 +379,13 @@ window.__ModuleLoader__.load({
209
379
  }
210
380
  //#endregion
211
381
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css.mjs
212
- const css$1 = ".cubgiG_menuAnchor{min-width:54px;max-width:100%}.cubgiG_seat{min-width:0;max-width:min(100%,240px);min-height:28px;color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;background:0 0;border:none;border-radius:16px;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.cubgiG_seat:not(:disabled):hover,.cubgiG_seat[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.cubgiG_seat:disabled{cursor:default;color:var(--dsw-alias-label-quaternary)}.cubgiG_seatIcon{color:var(--dsw-alias-label-primary);flex:none}.cubgiG_seatLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.cubgiG_introIcon{animation:.15s cubic-bezier(.16,1,.3,1) both cubgiG_seat-icon-in}@keyframes cubgiG_seat-icon-in{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.cubgiG_introText{white-space:pre;display:inline-block}.cubgiG_introChar{white-space:pre;opacity:0;animation:.4s ease-out forwards cubgiG_seat-char-in;display:inline-block}@keyframes cubgiG_seat-char-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){.cubgiG_introIcon,.cubgiG_introChar{opacity:1;animation:none}}.cubgiG_chevron{color:var(--dsw-alias-label-caption);flex:none}.cubgiG_item{flex-direction:column;gap:2px;max-width:280px;display:flex}.cubgiG_itemName{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}.cubgiG_itemDesc{color:var(--dsw-alias-label-caption);white-space:normal;font-size:12px;line-height:16px}";
213
- const tagId$1 = "@deepseek-ai/dsh-client-ui-agent-preset/AgentPresetSeat.module.css";
214
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
382
+ const css$2 = ".cubgiG_menuAnchor{min-width:54px;max-width:100%}.cubgiG_seat{border-radius:var(--dsw-radius-sm);min-width:0;max-width:min(100%,240px);min-height:28px;color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.cubgiG_seat:not(:disabled):hover,.cubgiG_seat[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.cubgiG_seat:disabled{cursor:default;color:var(--dsw-alias-label-quaternary)}.cubgiG_seatIcon{color:var(--dsw-alias-label-primary);flex:none}.cubgiG_seatLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.cubgiG_introIcon{animation:.15s cubic-bezier(.16,1,.3,1) both cubgiG_seat-icon-in}@keyframes cubgiG_seat-icon-in{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.cubgiG_introText{white-space:pre;display:inline-block}.cubgiG_introChar{white-space:pre;opacity:0;animation:.4s ease-out forwards cubgiG_seat-char-in;display:inline-block}@keyframes cubgiG_seat-char-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){.cubgiG_introIcon,.cubgiG_introChar{opacity:1;animation:none}}.cubgiG_chevron{color:var(--dsw-alias-label-caption);flex:none}.cubgiG_item{flex-direction:column;gap:2px;max-width:280px;display:flex}.cubgiG_itemName{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}.cubgiG_itemDesc{color:var(--dsw-alias-label-caption);white-space:normal;font-size:12px;line-height:16px}";
383
+ const tagId$2 = "@deepseek-ai/dsh-client-ui-agent-preset/AgentPresetSeat.module.css";
384
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
215
385
  const tag = document.createElement("style");
216
386
  tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-agent-preset";
217
- tag.dataset.pluginCss = tagId$1;
218
- tag.textContent = css$1;
387
+ tag.dataset.pluginCss = tagId$2;
388
+ tag.textContent = css$2;
219
389
  document.head.appendChild(tag);
220
390
  }
221
391
  var AgentPresetSeat_module_css_default = {
@@ -252,16 +422,7 @@ window.__ModuleLoader__.load({
252
422
  const INTRO_CHAR_STAGGER_MS = 40;
253
423
  const INTRO_TEXT_REVEAL_MS = 200;
254
424
  const INTRO_CHAR_FADE_MS = 400;
255
- /**
256
- * How long a refused switch holds before fading.
257
- *
258
- * Longer than the primitive's default because this banner is the only place
259
- * the refusal appears. The chip's label has already snapped back to the
260
- * preset the session still runs, and a preset the host refuses to MOUNT is
261
- * one discovery reported healthy — its row on the settings page carries no
262
- * reason to go back and read, because there was nothing to see until the
263
- * rows actually ran.
264
- */
425
+ /** Duration of a selection-refusal banner, including a revision becoming unavailable during a pick. */
265
426
  const REFUSAL_HOLD_MS = 8e3;
266
427
  /**
267
428
  * Per-character start offset for the introduce reveal.
@@ -275,16 +436,26 @@ window.__ModuleLoader__.load({
275
436
  /**
276
437
  * Render the new-session agent-preset chip.
277
438
  * @param props - composed slot props.
278
- * @returns the chip, or null when the deployment composes no presets.
439
+ * @returns The chip, or null outside the main view, with Developer tools off,
440
+ * or before the roster provides a preset choice.
279
441
  */
280
- function AgentPresetSeat({ load, select, introduced, useAgentPresetSeat, t }) {
442
+ function AgentPresetSeat({ sessionId, useSessionRetainInfo, load, select, introduced, useAgentPresetSeat, useDeveloperTools, t }) {
443
+ const developerTools = useDeveloperTools((value) => value);
281
444
  const state = useAgentPresetSeat((snapshot) => snapshot);
445
+ const main = useSessionRetainInfo((info) => sessionId === void 0 || (info?.retainedBy.mainView ?? 0) > 0);
282
446
  const [open, setOpen] = (0, react.useState)(false);
283
447
  const toastSeq = (0, react.useRef)(0);
284
448
  const [toast, setToast] = (0, react.useState)(null);
449
+ const pickerVisible = (0, react.useRef)(developerTools);
450
+ pickerVisible.current = developerTools;
285
451
  (0, react.useEffect)(() => {
286
452
  load();
287
453
  }, [load]);
454
+ (0, react.useEffect)(() => {
455
+ if (developerTools) return;
456
+ setOpen(false);
457
+ setToast(null);
458
+ }, [developerTools]);
288
459
  const chosen = state.options.find((option) => option.id === state.current);
289
460
  const label = (chosen === void 0 ? void 0 : presetDisplayText(chosen, t))?.name ?? state.current;
290
461
  const ready = state.options.length > 0 && state.current !== "";
@@ -310,7 +481,7 @@ window.__ModuleLoader__.load({
310
481
  label,
311
482
  introduced
312
483
  ]);
313
- if (!ready) return null;
484
+ if (!main || !developerTools || !ready) return null;
314
485
  const characters = Array.from(label);
315
486
  const stagger = introStaggerMs(characters.length);
316
487
  const shownLabel = introducing ? (0, react_jsx_runtime.jsx)("span", {
@@ -349,7 +520,7 @@ window.__ModuleLoader__.load({
349
520
  /* v8 ignore next */
350
521
  const name = picked === void 0 ? id : presetDisplayText(picked, t).name;
351
522
  select(id).then((refusal) => {
352
- if (refusal === void 0) return;
523
+ if (refusal === void 0 || !pickerVisible.current) return;
353
524
  toastSeq.current += 1;
354
525
  setToast({
355
526
  seq: toastSeq.current,
@@ -374,17 +545,17 @@ window.__ModuleLoader__.load({
374
545
  setOpen((value) => !value);
375
546
  },
376
547
  children: [
377
- (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, { className: introducing ? `${AgentPresetSeat_module_css_default.seatIcon} ${AgentPresetSeat_module_css_default.introIcon}` : AgentPresetSeat_module_css_default.seatIcon }),
548
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutlineRegular, { className: introducing ? `${AgentPresetSeat_module_css_default.seatIcon} ${AgentPresetSeat_module_css_default.introIcon}` : AgentPresetSeat_module_css_default.seatIcon }),
378
549
  (0, react_jsx_runtime.jsx)("span", {
379
550
  className: AgentPresetSeat_module_css_default.seatLabel,
380
551
  children: shownLabel
381
552
  }),
382
- (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: AgentPresetSeat_module_css_default.chevron })
553
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: AgentPresetSeat_module_css_default.chevron })
383
554
  ]
384
555
  })
385
556
  }), toast !== null && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
386
557
  text: toast.text,
387
- icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutline16, {}),
558
+ icon: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}),
388
559
  holdMs: REFUSAL_HOLD_MS,
389
560
  anchor: document.querySelector("[data-composer-card]"),
390
561
  onDone: () => {
@@ -393,16 +564,508 @@ window.__ModuleLoader__.load({
393
564
  }, toast.seq)] });
394
565
  }
395
566
  //#endregion
567
+ //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-agent-preset/src/client/PresetGuideDialog.module.css.mjs
568
+ const css$1 = ".LSQftG_guideDialog{box-sizing:border-box;gap:0;width:min(640px,100%);height:min(600px,100%);max-height:100%;padding:0}.LSQftG_guideLayout{flex-direction:column;height:100%;min-height:0;display:flex}.LSQftG_guideHeader{flex:none;padding:24px 24px 20px 28px}.LSQftG_guideTitleRow{justify-content:space-between;align-items:center;gap:16px;display:flex}.LSQftG_guideTitle{margin:0;font-size:20px;font-weight:600;line-height:28px}.LSQftG_guideIntro{color:var(--dsw-alias-label-secondary);margin:8px 0 0;font-size:14px;line-height:22px}.LSQftG_guideClose{border-radius:var(--dsw-radius-md);width:32px;height:32px;min-height:32px;color:var(--dsw-alias-label-tertiary);padding:0}.LSQftG_guideTabs{flex:none;margin:0 28px 22px}.LSQftG_guidePanel{--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);overscroll-behavior:contain;scrollbar-gutter:stable;min-height:0;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;flex:1;padding:0 24px 24px 28px;font-size:16px;overflow-y:auto}.LSQftG_guidePanel:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.LSQftG_guidePanel h3{margin:28px 0 10px;font-size:16px;font-weight:600;line-height:24px}.LSQftG_guidePanel h3:first-child{margin-top:0}.LSQftG_guidePanel p{color:var(--dsw-alias-label-primary);margin:0 0 16px;font-size:16px;line-height:1.625}.LSQftG_guidePanel blockquote{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);border:0;margin:10px 0 14px;padding:14px 16px}.LSQftG_guidePanel blockquote p{color:var(--dsw-alias-label-primary);margin:0}.LSQftG_guidePanel[data-guide-page=usage] p{color:var(--dsw-alias-label-secondary);margin-bottom:12px;font-size:14px;line-height:22px}.LSQftG_guidePanel[data-guide-page=usage] h3{margin:0}.LSQftG_guideExample+.LSQftG_guideExample{margin-top:28px}.LSQftG_guideExampleHeader{flex-wrap:wrap;align-items:center;gap:8px 10px;margin-bottom:8px;display:flex}.LSQftG_guideExampleTag{flex-shrink:0;gap:4px}.LSQftG_guidePanel[data-guide-page=usage] blockquote{margin:8px 0;padding:12px 16px}.LSQftG_guidePanel[data-guide-page=usage] blockquote p{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;line-height:26px}";
569
+ const tagId$1 = "@deepseek-ai/dsh-client-ui-agent-preset/PresetGuideDialog.module.css";
570
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
571
+ const tag = document.createElement("style");
572
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-agent-preset";
573
+ tag.dataset.pluginCss = tagId$1;
574
+ tag.textContent = css$1;
575
+ document.head.appendChild(tag);
576
+ }
577
+ var PresetGuideDialog_module_css_default = {
578
+ "guideClose": "LSQftG_guideClose",
579
+ "guideDialog": "LSQftG_guideDialog",
580
+ "guideExample": "LSQftG_guideExample",
581
+ "guideExampleHeader": "LSQftG_guideExampleHeader",
582
+ "guideExampleTag": "LSQftG_guideExampleTag",
583
+ "guideHeader": "LSQftG_guideHeader",
584
+ "guideIntro": "LSQftG_guideIntro",
585
+ "guideLayout": "LSQftG_guideLayout",
586
+ "guidePanel": "LSQftG_guidePanel",
587
+ "guideTabs": "LSQftG_guideTabs",
588
+ "guideTitle": "LSQftG_guideTitle",
589
+ "guideTitleRow": "LSQftG_guideTitleRow"
590
+ };
591
+ //#endregion
592
+ //#region lib/types/client/PresetGuideDialog.js
593
+ /** Read-only help stays local to Settings and never changes the selected preset. */
594
+ const guides = new Map([
595
+ ["standard", {
596
+ name: "presetStandardName",
597
+ intro: "guideStandardIntro",
598
+ explanation: "guideStandardExplanation",
599
+ usage: "guideStandardUsage"
600
+ }],
601
+ ["ptc", {
602
+ name: "presetPtcName",
603
+ intro: "guidePtcIntro",
604
+ explanation: "guidePtcExplanation",
605
+ usage: "guidePtcUsage"
606
+ }],
607
+ ["minimal", {
608
+ name: "presetMinimalName",
609
+ intro: "guideMinimalIntro",
610
+ explanation: "guideMinimalExplanation",
611
+ usage: "guideMinimalUsage"
612
+ }],
613
+ ["cordis", {
614
+ name: "presetCordisName",
615
+ intro: "guideCordisIntro",
616
+ explanation: "guideCordisExplanation",
617
+ usage: "guideCordisUsage"
618
+ }]
619
+ ]);
620
+ /**
621
+ * Look up help only for known, shipped presets.
622
+ * @param id - preset identifier from the roster.
623
+ * @param trust - roster source; custom presets own their capability claims.
624
+ * @returns the shipped guide, or undefined for unknown and custom presets.
625
+ */
626
+ function presetGuide(id, trust) {
627
+ return trust === "system" ? guides.get(id) : void 0;
628
+ }
629
+ /** Keep keyboard focus inside a preset reader while Tab moves through its controls.
630
+ * @param event Keyboard event from the active reader.
631
+ */
632
+ function trapPresetReaderTab(event) {
633
+ if (event.key !== "Tab") return;
634
+ const targets = Array.from(event.currentTarget.querySelectorAll("button:not([disabled]):not([tabindex=\"-1\"]), [tabindex=\"0\"]")).filter((element) => !element.closest("[hidden]"));
635
+ const first = targets[0];
636
+ const last = targets[targets.length - 1];
637
+ if (event.shiftKey && document.activeElement === first) {
638
+ event.preventDefault();
639
+ last?.focus();
640
+ } else if (!event.shiftKey && document.activeElement === last) {
641
+ event.preventDefault();
642
+ first?.focus();
643
+ }
644
+ }
645
+ /** Curated usage dictionaries contain only level-three example sections. */
646
+ function GuideUsage({ text, t }) {
647
+ const labels = {
648
+ code: {
649
+ copyLabel: t("guideCopy"),
650
+ copiedLabel: t("guideCopied"),
651
+ toolbarLabels: {
652
+ codeLabel: t("codeBlock.title"),
653
+ wrapLabel: t("codeBlock.wrap"),
654
+ unwrapLabel: t("codeBlock.unwrap")
655
+ }
656
+ },
657
+ footnotes: t("guideFootnotes")
658
+ };
659
+ return text.split(/(?=^### )/m).map((section) => {
660
+ const headingEnd = section.indexOf("\n");
661
+ const title = section.slice(4, headingEnd);
662
+ return (0, react_jsx_runtime.jsxs)("section", {
663
+ className: PresetGuideDialog_module_css_default.guideExample,
664
+ children: [(0, react_jsx_runtime.jsxs)("div", {
665
+ className: PresetGuideDialog_module_css_default.guideExampleHeader,
666
+ children: [(0, react_jsx_runtime.jsx)("h3", { children: title }), (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
667
+ tone: "neutral",
668
+ className: PresetGuideDialog_module_css_default.guideExampleTag,
669
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconListPenOutlineRegular, { size: 12 }), t("guideExampleTask")]
670
+ })]
671
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
672
+ text: section.slice(headingEnd + 1),
673
+ labels
674
+ })]
675
+ }, title);
676
+ });
677
+ }
678
+ /**
679
+ * Open read-only help without changing the selected preset.
680
+ * @param props - localized guide, initial page, and close callback.
681
+ * @returns the modal reader with independent scroll positions for each page.
682
+ */
683
+ function PresetGuideDialog({ guide, initialPage, t, onClose }) {
684
+ const [page, setPage] = (0, react.useState)(initialPage);
685
+ const guideId = (0, react.useId)();
686
+ const content = (0, react.useRef)(null);
687
+ (0, react.useLayoutEffect)(() => {
688
+ content.current?.querySelector("[role=\"tab\"][aria-selected=\"true\"]")?.focus();
689
+ }, []);
690
+ const onKeyDown = (event) => {
691
+ if (event.key === "Escape") {
692
+ event.preventDefault();
693
+ event.stopPropagation();
694
+ onClose();
695
+ } else trapPresetReaderTab(event);
696
+ };
697
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
698
+ open: true,
699
+ headless: true,
700
+ onClose,
701
+ title: t(guide.name),
702
+ className: PresetGuideDialog_module_css_default.guideDialog,
703
+ children: (0, react_jsx_runtime.jsxs)("div", {
704
+ ref: content,
705
+ className: PresetGuideDialog_module_css_default.guideLayout,
706
+ role: "presentation",
707
+ onKeyDownCapture: onKeyDown,
708
+ children: [
709
+ (0, react_jsx_runtime.jsxs)("div", {
710
+ className: PresetGuideDialog_module_css_default.guideHeader,
711
+ children: [(0, react_jsx_runtime.jsxs)("div", {
712
+ className: PresetGuideDialog_module_css_default.guideTitleRow,
713
+ children: [(0, react_jsx_runtime.jsx)("h2", {
714
+ className: PresetGuideDialog_module_css_default.guideTitle,
715
+ children: t(guide.name)
716
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
717
+ variant: "ghost",
718
+ className: PresetGuideDialog_module_css_default.guideClose,
719
+ "aria-label": t("close"),
720
+ onClick: onClose,
721
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 18 })
722
+ })]
723
+ }), (0, react_jsx_runtime.jsx)("p", {
724
+ className: PresetGuideDialog_module_css_default.guideIntro,
725
+ children: t(guide.intro)
726
+ })]
727
+ }),
728
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SegmentedTabs, {
729
+ className: PresetGuideDialog_module_css_default.guideTabs,
730
+ label: t("guideSections"),
731
+ value: page,
732
+ onChange: setPage,
733
+ items: [{
734
+ value: "explanation",
735
+ label: t("modeExplanation"),
736
+ id: `${guideId}-explanation-tab`,
737
+ panelId: `${guideId}-explanation-panel`
738
+ }, {
739
+ value: "usage",
740
+ label: t("howToUse"),
741
+ id: `${guideId}-usage-tab`,
742
+ panelId: `${guideId}-usage-panel`
743
+ }]
744
+ }),
745
+ ["explanation", "usage"].map((section) => (0, react_jsx_runtime.jsx)("div", {
746
+ id: `${guideId}-${section}-panel`,
747
+ role: "tabpanel",
748
+ "aria-labelledby": `${guideId}-${section}-tab`,
749
+ className: PresetGuideDialog_module_css_default.guidePanel,
750
+ "data-guide-page": section,
751
+ hidden: page !== section,
752
+ tabIndex: 0,
753
+ children: section === "usage" ? (0, react_jsx_runtime.jsx)(GuideUsage, {
754
+ text: t(guide.usage),
755
+ t
756
+ }) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
757
+ text: t(guide.explanation),
758
+ labels: {
759
+ code: {
760
+ copyLabel: t("guideCopy"),
761
+ copiedLabel: t("guideCopied"),
762
+ toolbarLabels: {
763
+ codeLabel: t("codeBlock.title"),
764
+ wrapLabel: t("codeBlock.wrap"),
765
+ unwrapLabel: t("codeBlock.unwrap")
766
+ }
767
+ },
768
+ footnotes: t("guideFootnotes")
769
+ }
770
+ })
771
+ }, section))
772
+ ]
773
+ })
774
+ });
775
+ }
776
+ //#endregion
777
+ //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-agent-preset/src/client/AgentPresetSection.module.css.mjs
778
+ const css = ".rtSEdW_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}.rtSEdW_title{margin:0;font-size:18px;font-weight:600}.rtSEdW_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px}.rtSEdW_group{flex-direction:column;gap:10px;display:flex}.rtSEdW_group+.rtSEdW_group{margin-top:20px}.rtSEdW_groupHead{letter-spacing:.06em;text-transform:uppercase;color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;font-weight:600}.rtSEdW_cards{grid-template-columns:repeat(auto-fill,minmax(268px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rtSEdW_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;transition:border-color .16s,background .16s;display:flex}.rtSEdW_card:hover:not(.rtSEdW_cardActive):not(.rtSEdW_cardSelectionDisabled){background:var(--dsw-alias-interactive-bg-hover)}.rtSEdW_cardActive{background:var(--dsw-alias-bg-module-platform);border-color:var(--dsw-static-neutral-bluish-400)}.rtSEdW_cardSelectionDisabled{background:var(--dsw-alias-bg-module-platform)}.rtSEdW_cardSelectionDisabled .rtSEdW_cardMain{opacity:.48}.rtSEdW_cardBroken,.rtSEdW_cardBroken:hover{border-color:var(--dsw-alias-state-error-primary)}.rtSEdW_brokenBadge{corner-shape:round;white-space:nowrap;background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-bg-layer-3);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.rtSEdW_brokenTip{z-index:1;border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-label-primary);width:max-content;max-width:100%;color:var(--dsw-alias-bg-layer-3);text-align:left;white-space:pre-line;overflow-wrap:anywhere;opacity:0;pointer-events:none;padding:6px 8px;font-size:11px;font-weight:400;line-height:1.5;transition:opacity .12s;position:absolute;top:calc(100% + 6px);left:0}.rtSEdW_brokenBadge:hover .rtSEdW_brokenTip,.rtSEdW_cardMain:focus-visible .rtSEdW_brokenTip{opacity:1}.rtSEdW_cardMain[aria-disabled=true]{cursor:default}.rtSEdW_cardBrokenReason{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.rtSEdW_cardMain{appearance:none;font:inherit;color:inherit;text-align:left;cursor:pointer;border-radius:var(--dsw-radius-xl) var(--dsw-radius-xl) 0 0;background:0 0;border:0;flex-direction:column;flex:1;gap:12px;padding:14px 16px 12px;display:flex}.rtSEdW_cardMain:disabled{cursor:default}.rtSEdW_cardMain:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.rtSEdW_cardHead{align-items:flex-start;gap:12px;display:flex;position:relative}.rtSEdW_cardIdentity{flex:1;align-items:center;gap:6px;min-width:0;display:flex}.rtSEdW_cardName{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:15px;font-weight:600;line-height:1.4;overflow:hidden}.rtSEdW_cardDesc{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:4;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-block:auto;font-size:13px;line-height:1.55;display:-webkit-box;overflow:hidden}.rtSEdW_cardId{max-width:35%;font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex-shrink:0;font-size:11px;line-height:21px;overflow:hidden}.rtSEdW_cardFoot{border-top:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:2px;padding:6px 10px;display:flex}.rtSEdW_cardHelp{align-items:center;gap:4px;margin-right:auto;display:flex}.rtSEdW_helpButton{min-height:28px;color:var(--dsw-alias-label-tertiary);padding:5px 6px;font-size:12px;font-weight:400}.rtSEdW_helpButton:hover,.rtSEdW_helpButton:focus-visible{color:var(--dsw-alias-label-primary)}.rtSEdW_iconButton{appearance:none;border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;align-items:center;padding:6px;display:inline-flex;position:relative}.rtSEdW_iconButton:hover{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.rtSEdW_iconButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-1px}.rtSEdW_iconButton:after{content:attr(data-tip);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);white-space:nowrap;opacity:0;pointer-events:none;padding:3px 8px;font-size:11px;line-height:17px;transition:opacity .12s;position:absolute;bottom:calc(100% + 6px);left:50%;transform:translate(-50%)}.rtSEdW_iconButton:hover:after,.rtSEdW_iconButton:focus-visible:after{opacity:1}.rtSEdW_dialog{width:min(720px,100%)}.rtSEdW_viewerCode{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-2);max-height:min(60vh,560px);color:var(--dsw-alias-label-secondary);font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);white-space:pre;tab-size:2;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);margin:0;padding:12px;font-size:12.5px;line-height:1.5;overflow:auto}.rtSEdW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rtSEdW_creatorButton{box-sizing:border-box;border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);height:44px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;justify-content:center;align-self:stretch;align-items:center;gap:6px;font-size:14px;line-height:22px;display:flex}.rtSEdW_creatorButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.rtSEdW_creatorButton:disabled{opacity:.4;cursor:default}";
779
+ const tagId = "@deepseek-ai/dsh-client-ui-agent-preset/AgentPresetSection.module.css";
780
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
781
+ const tag = document.createElement("style");
782
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-agent-preset";
783
+ tag.dataset.pluginCss = tagId;
784
+ tag.textContent = css;
785
+ document.head.appendChild(tag);
786
+ }
787
+ var AgentPresetSection_module_css_default = {
788
+ "brokenBadge": "rtSEdW_brokenBadge",
789
+ "brokenTip": "rtSEdW_brokenTip",
790
+ "card": "rtSEdW_card",
791
+ "cardActive": "rtSEdW_cardActive",
792
+ "cardBroken": "rtSEdW_cardBroken",
793
+ "cardBrokenReason": "rtSEdW_cardBrokenReason",
794
+ "cardDesc": "rtSEdW_cardDesc",
795
+ "cardFoot": "rtSEdW_cardFoot",
796
+ "cardHead": "rtSEdW_cardHead",
797
+ "cardHelp": "rtSEdW_cardHelp",
798
+ "cardId": "rtSEdW_cardId",
799
+ "cardIdentity": "rtSEdW_cardIdentity",
800
+ "cardMain": "rtSEdW_cardMain",
801
+ "cardName": "rtSEdW_cardName",
802
+ "cardSelectionDisabled": "rtSEdW_cardSelectionDisabled",
803
+ "cards": "rtSEdW_cards",
804
+ "creatorButton": "rtSEdW_creatorButton",
805
+ "dialog": "rtSEdW_dialog",
806
+ "error": "rtSEdW_error",
807
+ "group": "rtSEdW_group",
808
+ "groupHead": "rtSEdW_groupHead",
809
+ "helpButton": "rtSEdW_helpButton",
810
+ "iconButton": "rtSEdW_iconButton",
811
+ "intro": "rtSEdW_intro",
812
+ "section": "rtSEdW_section",
813
+ "title": "rtSEdW_title",
814
+ "viewerCode": "rtSEdW_viewerCode"
815
+ };
816
+ //#endregion
817
+ //#region lib/types/client/AgentPresetSection.js
818
+ function CardDescription({ text }) {
819
+ const ref = (0, react.useRef)(null);
820
+ const [truncated, setTruncated] = (0, react.useState)(false);
821
+ (0, react.useLayoutEffect)(() => {
822
+ const el = ref.current;
823
+ /* v8 ignore next -- the ref is attached before layout effects run. */
824
+ if (el === null) return;
825
+ const measure = () => {
826
+ setTruncated(el.scrollHeight > el.clientHeight);
827
+ };
828
+ measure();
829
+ if (typeof ResizeObserver === "undefined") return;
830
+ const observer = new ResizeObserver(measure);
831
+ observer.observe(el);
832
+ return () => {
833
+ observer.disconnect();
834
+ };
835
+ }, [text]);
836
+ return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
837
+ label: text,
838
+ side: "bottom",
839
+ delayMs: 400,
840
+ disabled: !truncated,
841
+ maxWidth: 360,
842
+ children: (0, react_jsx_runtime.jsx)("span", {
843
+ ref,
844
+ className: AgentPresetSection_module_css_default.cardDesc,
845
+ title: "",
846
+ children: text
847
+ })
848
+ });
849
+ }
850
+ /** Render the roster with its default, mode help, composition viewer, and the guidance to Creator mode.
851
+ * @param props Settings actions, snapshot hooks and localized text.
852
+ * @returns The preset settings section.
853
+ */
854
+ function AgentPresetSection({ useAgentPresetSection, load, view, closeView, makeDefault, startCreatorDraft, close: closeSettings, useDeveloperTools, t }) {
855
+ const state = useAgentPresetSection((value) => value);
856
+ const developerTools = useDeveloperTools((enabled) => enabled);
857
+ const [guide, setGuide] = (0, react.useState)(null);
858
+ const viewTrigger = (0, react.useRef)(null);
859
+ const closeViewOnUnmount = (0, react.useRef)(closeView);
860
+ (0, react.useEffect)(() => {
861
+ load();
862
+ }, [load]);
863
+ (0, react.useLayoutEffect)(() => {
864
+ closeViewOnUnmount.current = closeView;
865
+ }, [closeView]);
866
+ (0, react.useEffect)(() => () => {
867
+ closeViewOnUnmount.current();
868
+ }, []);
869
+ const closeViewer = () => {
870
+ closeView();
871
+ viewTrigger.current?.focus();
872
+ };
873
+ const viewed = state.view;
874
+ const viewedRow = viewed === null ? void 0 : state.rows.find((row) => row.id === viewed.id);
875
+ const viewedTitle = viewed === null ? "" : viewedRow === void 0 ? viewed.title : presetDisplayText(viewedRow, t).name;
876
+ const creator = startCreatorDraft !== void 0 && state.rows.some((row) => row.id === "cordis") ? startCreatorDraft : void 0;
877
+ const creatorButton = creator === void 0 ? null : (0, react_jsx_runtime.jsxs)("button", {
878
+ type: "button",
879
+ className: AgentPresetSection_module_css_default.creatorButton,
880
+ disabled: !developerTools || state.saving,
881
+ title: developerTools ? void 0 : t("enableDevToolsToCreate"),
882
+ onClick: () => {
883
+ creator();
884
+ closeSettings();
885
+ },
886
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 14 }), t("creatorDraft")]
887
+ });
888
+ return (0, react_jsx_runtime.jsxs)("section", {
889
+ className: AgentPresetSection_module_css_default.section,
890
+ children: [
891
+ (0, react_jsx_runtime.jsx)("h2", {
892
+ className: AgentPresetSection_module_css_default.title,
893
+ children: t("nav")
894
+ }),
895
+ (0, react_jsx_runtime.jsx)("p", {
896
+ className: AgentPresetSection_module_css_default.intro,
897
+ children: t("sectionIntro")
898
+ }),
899
+ state.error === null ? null : (0, react_jsx_runtime.jsx)("p", {
900
+ className: AgentPresetSection_module_css_default.error,
901
+ role: "alert",
902
+ children: state.error
903
+ }),
904
+ [true, false].map((builtIn) => {
905
+ const rows = state.rows.filter((row) => isBuiltInPreset(row) === builtIn);
906
+ const entry = builtIn ? null : creatorButton;
907
+ if (rows.length === 0 && entry === null) return null;
908
+ return (0, react_jsx_runtime.jsxs)("section", {
909
+ className: AgentPresetSection_module_css_default.group,
910
+ children: [
911
+ (0, react_jsx_runtime.jsx)("h3", {
912
+ className: AgentPresetSection_module_css_default.groupHead,
913
+ children: t(builtIn ? "builtInGroup" : "customGroup")
914
+ }),
915
+ rows.length === 0 ? null : (0, react_jsx_runtime.jsx)("ul", {
916
+ className: AgentPresetSection_module_css_default.cards,
917
+ children: rows.map((row) => {
918
+ const display = presetDisplayText(row, t);
919
+ const help = presetGuide(row.id, builtIn ? "system" : "user");
920
+ const selectionAction = row.broken !== void 0 ? t("brokenBadge") : row.isDefault ? t("inUse") : t(developerTools ? "setDefault" : "enableDevToolsToSetDefault");
921
+ return (0, react_jsx_runtime.jsxs)("li", {
922
+ "data-agent-preset-id": row.id,
923
+ className: [
924
+ AgentPresetSection_module_css_default.card,
925
+ row.broken === void 0 ? void 0 : AgentPresetSection_module_css_default.cardBroken,
926
+ row.isDefault ? AgentPresetSection_module_css_default.cardActive : void 0,
927
+ !developerTools && row.broken === void 0 && !row.isDefault ? AgentPresetSection_module_css_default.cardSelectionDisabled : void 0
928
+ ].filter(Boolean).join(" "),
929
+ children: [(0, react_jsx_runtime.jsxs)("button", {
930
+ type: "button",
931
+ className: AgentPresetSection_module_css_default.cardMain,
932
+ "aria-pressed": row.isDefault,
933
+ disabled: row.isDefault || row.broken === void 0 && (!developerTools || state.saving),
934
+ "aria-disabled": row.broken !== void 0,
935
+ "aria-label": `${selectionAction}: ${display.name}`,
936
+ title: selectionAction,
937
+ onClick: () => {
938
+ if (row.broken === void 0) makeDefault(row.id);
939
+ },
940
+ children: [
941
+ (0, react_jsx_runtime.jsxs)("span", {
942
+ className: AgentPresetSection_module_css_default.cardHead,
943
+ children: [(0, react_jsx_runtime.jsxs)("span", {
944
+ className: AgentPresetSection_module_css_default.cardIdentity,
945
+ children: [
946
+ (0, react_jsx_runtime.jsx)("span", {
947
+ className: AgentPresetSection_module_css_default.cardName,
948
+ title: display.name,
949
+ children: display.name
950
+ }),
951
+ row.broken === void 0 ? null : (0, react_jsx_runtime.jsxs)("span", {
952
+ className: AgentPresetSection_module_css_default.brokenBadge,
953
+ children: [t("brokenBadge"), (0, react_jsx_runtime.jsx)("span", {
954
+ className: AgentPresetSection_module_css_default.brokenTip,
955
+ "aria-hidden": "true",
956
+ children: row.broken
957
+ })]
958
+ }),
959
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
960
+ tone: row.isDefault ? "solid" : "outline",
961
+ children: row.isDefault ? t("inUse") : t(builtIn ? "builtInGroup" : "customGroup")
962
+ })
963
+ ]
964
+ }), (0, react_jsx_runtime.jsx)("code", {
965
+ className: AgentPresetSection_module_css_default.cardId,
966
+ title: row.id,
967
+ children: row.id
968
+ })]
969
+ }),
970
+ (0, react_jsx_runtime.jsx)(CardDescription, { text: display.description ?? t("noDescription") }),
971
+ row.broken === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
972
+ className: AgentPresetSection_module_css_default.cardBrokenReason,
973
+ role: "alert",
974
+ children: row.broken
975
+ })
976
+ ]
977
+ }), (0, react_jsx_runtime.jsxs)("div", {
978
+ className: AgentPresetSection_module_css_default.cardFoot,
979
+ children: [help === void 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
980
+ className: AgentPresetSection_module_css_default.cardHelp,
981
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
982
+ variant: "ghost",
983
+ className: AgentPresetSection_module_css_default.helpButton,
984
+ "aria-label": `${t("modeExplanation")}: ${display.name}`,
985
+ onClick: () => {
986
+ setGuide({
987
+ content: help,
988
+ page: "explanation"
989
+ });
990
+ },
991
+ children: t("modeExplanation")
992
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
993
+ variant: "ghost",
994
+ className: AgentPresetSection_module_css_default.helpButton,
995
+ "aria-label": `${t("howToUse")}: ${display.name}`,
996
+ onClick: () => {
997
+ setGuide({
998
+ content: help,
999
+ page: "usage"
1000
+ });
1001
+ },
1002
+ children: t("howToUse")
1003
+ })]
1004
+ }), (0, react_jsx_runtime.jsx)("button", {
1005
+ type: "button",
1006
+ className: AgentPresetSection_module_css_default.iconButton,
1007
+ "data-tip": t("view"),
1008
+ "aria-label": `${t("view")}: ${display.name}`,
1009
+ onClick: (event) => {
1010
+ viewTrigger.current = event.currentTarget;
1011
+ view(row.id);
1012
+ },
1013
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutlineRegular, {})
1014
+ })]
1015
+ })]
1016
+ }, row.id);
1017
+ })
1018
+ }),
1019
+ entry
1020
+ ]
1021
+ }, String(builtIn));
1022
+ }),
1023
+ guide === null ? null : (0, react_jsx_runtime.jsx)(PresetGuideDialog, {
1024
+ guide: guide.content,
1025
+ initialPage: guide.page,
1026
+ t,
1027
+ onClose: () => {
1028
+ setGuide(null);
1029
+ }
1030
+ }),
1031
+ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
1032
+ open: viewed !== null,
1033
+ onClose: closeViewer,
1034
+ closeLabel: t("close"),
1035
+ onKeyDownCapture: (event) => {
1036
+ if (event.key === "Escape") {
1037
+ event.preventDefault();
1038
+ event.stopPropagation();
1039
+ closeViewer();
1040
+ } else trapPresetReaderTab(event);
1041
+ },
1042
+ title: viewed === null ? "" : `${t("view")} · ${viewedTitle}`,
1043
+ className: AgentPresetSection_module_css_default.dialog,
1044
+ footer: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1045
+ variant: "outline",
1046
+ autoFocus: true,
1047
+ onClick: closeViewer,
1048
+ children: t("close")
1049
+ }),
1050
+ children: viewed === null ? null : (0, react_jsx_runtime.jsx)("pre", {
1051
+ className: AgentPresetSection_module_css_default.viewerCode,
1052
+ children: viewed.content
1053
+ })
1054
+ })
1055
+ ]
1056
+ });
1057
+ }
1058
+ //#endregion
396
1059
  //#region lib/types/client/settings-store.js
397
1060
  /**
398
1061
  * Agent-preset roster store shared by the display surfaces.
399
1062
  *
400
1063
  * Options come from one `agentPresets.list` call. Writes target the settings
401
- * namespace's `default` field, which is what the host resolves at creation;
402
- * the management section is the surface that writes it.
1064
+ * namespace fields the host resolves at creation; the management section is
1065
+ * the surface that writes them.
403
1066
  */
404
1067
  /** The agent-preset settings namespace on the host wire. */
405
- const AGENT_PRESET_SETTINGS_NS = "agent-presets";
1068
+ const AGENT_PRESET_SETTINGS_NS = "agent-preset-registry";
406
1069
  /**
407
1070
  * Persist one preset as the default for sessions created later.
408
1071
  *
@@ -414,13 +1077,10 @@ window.__ModuleLoader__.load({
414
1077
  * @returns the failure message, or undefined once the write landed.
415
1078
  */
416
1079
  async function writeDefaultPreset(ctx, id) {
417
- const response = await ctx.remote.settings.update(AGENT_PRESET_SETTINGS_NS, { default: id }, void 0);
1080
+ const response = await ctx.remote.settings.update(AGENT_PRESET_SETTINGS_NS, { selectedDefault: id }, void 0);
418
1081
  return response.ok ? void 0 : response.error.message;
419
1082
  }
420
- const EMPTY_ROSTER = {
421
- presets: [],
422
- authorable: false
423
- };
1083
+ const EMPTY_ROSTER = { presets: [] };
424
1084
  /**
425
1085
  * Read the roster, turning a refusal into the message every surface shows.
426
1086
  * @param ctx - the browser plugin context carrying the Remote namespaces.
@@ -486,7 +1146,6 @@ window.__ModuleLoader__.load({
486
1146
  function presetOptions(presets) {
487
1147
  return presets.filter((preset) => preset.broken === void 0).map((preset) => ({
488
1148
  id: preset.id,
489
- trust: preset.trust,
490
1149
  ...preset.name === void 0 ? {} : { name: preset.name },
491
1150
  ...preset.description === void 0 ? {} : { description: preset.description }
492
1151
  }));
@@ -538,729 +1197,48 @@ window.__ModuleLoader__.load({
538
1197
  }
539
1198
  };
540
1199
  //#endregion
541
- //#region lib/types/client/section-store.js
1200
+ //#region lib/types/client/seat-store.js
542
1201
  /**
543
- * Agent-preset management controller: the roster as a list, a copy dialog as
544
- * the only way a preset is created, and a read-only viewer over the shipped
545
- * compositions.
1202
+ * Hero-chip controller: which preset the NEXT session gets.
546
1203
  *
547
- * The browser edits no composition text. A new preset is a host-side copy of
548
- * an existing one (`{ from, id, name? }` is all that crosses the wire), and
549
- * everything after creation happens in the preset's own files — which is why
550
- * the page's other job is getting the user TO those files: open the directory
551
- * where the host has a desktop, show its path where it does not.
1204
+ * The new-session screen has no session, so a pick is staged rather than
1205
+ * applied. It reaches a session when one becomes current and is still blank —
1206
+ * whether the workspace connect created it or reused an existing blank one,
1207
+ * which is why staging cannot simply ride along on `sessions.create`.
552
1208
  *
553
- * The host stays the single fact source. Every mutation writes through the
554
- * wire and the page re-reads the roster afterwards, because a copy changes
555
- * more than the row it targeted.
1209
+ * The stage is forgotten once applied. The next new session starts from the
1210
+ * Host-effective default again.
556
1211
  */
557
- /** Ids a preset directory may be named, mirroring the host's own rule. */
558
- const PRESET_ID = /^[a-z0-9][a-z0-9-]*$/;
559
1212
  const INITIAL$1 = {
560
- status: "idle",
1213
+ options: [],
1214
+ current: "",
561
1215
  error: null,
562
- authorable: false,
563
- hasDocument: false,
564
- rows: [],
565
- copy: null,
566
- view: null,
567
- pendingDelete: null,
568
- deleting: false,
569
- revealedPaths: {}
1216
+ busy: false,
1217
+ introduce: false
570
1218
  };
571
- /**
572
- * Why this copy cannot be submitted yet, as a locale key, or undefined when
573
- * it can. Client-side only: the host re-checks the id and its answer is what
574
- * the dialog reports on failure.
575
- * @param draft - the open copy dialog.
576
- * @param rows - the roster, for the collision check.
577
- * @returns the blocking reason's locale key, or undefined when submittable.
578
- */
579
- function draftBlocker(draft, rows) {
580
- if (draft.id === "") return "idRequired";
581
- if (!PRESET_ID.test(draft.id)) return "idInvalid";
582
- if (rows.some((row) => row.id === draft.id)) return "idTaken";
583
- }
584
- /** Reads the roster and drives the copy dialog, viewer, and location reveals. */
585
- var AgentPresetSectionController = class {
1219
+ /** Stages the next session's preset and applies it when one appears. */
1220
+ var AgentPresetSeatController = class {
586
1221
  ctx;
587
- rosterChanged;
588
- /** Page snapshot the renderer subscribes to. */
1222
+ currentSession;
1223
+ staged;
1224
+ /** Chip snapshot the renderer subscribes to. */
589
1225
  store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(INITIAL$1);
590
- constructor(ctx, rosterChanged = () => {}) {
591
- this.ctx = ctx;
592
- this.rosterChanged = rosterChanged;
593
- }
594
- set(patch) {
595
- this.store.set({
596
- ...this.store.getSnapshot(),
597
- ...patch
598
- });
599
- }
600
- patchCopy(patch) {
601
- const { copy } = this.store.getSnapshot();
602
- if (copy === null) return;
603
- this.set({ copy: {
604
- ...copy,
605
- ...patch
606
- } });
607
- }
608
- /**
609
- * Load the roster. An empty roster means the deployment composes no
610
- * presets, which is a valid deployment rather than a failure — the section
611
- * reports `unavailable` and renders nothing.
612
- * @returns once the snapshot reflects the host.
613
- */
614
- async load() {
615
- const opener = this.ctx.remote.settings.canOpenAgentPresetDirectory();
616
- const roster = await beginRosterRead(this.ctx, this.store);
617
- const described = await opener;
618
- if (roster === void 0) return;
619
- const { presets, authorable } = roster;
620
- const hasDocument = described.ok && described.value;
621
- if (presets.length === 0) {
622
- this.set({
623
- status: "unavailable",
624
- rows: [],
625
- authorable,
626
- hasDocument,
627
- copy: null,
628
- view: null
629
- });
630
- return;
631
- }
632
- const revealed = this.store.getSnapshot().revealedPaths;
633
- const kept = Object.fromEntries(Object.entries(revealed).filter(([id]) => presets.some((preset) => preset.id === id)));
634
- this.set({
635
- status: "ready",
636
- error: null,
637
- authorable,
638
- hasDocument,
639
- rows: presets.map((preset) => ({ ...preset })),
640
- revealedPaths: kept
641
- });
642
- }
643
- /**
644
- * Open one shipped preset's composition in the read-only viewer.
645
- * @param id - the preset to view.
646
- * @returns once the composition loaded or the failure is on the page.
647
- */
648
- async view(id) {
649
- this.set({ error: null });
650
- const result = await this.ctx.remote.agentPresets.read(id);
651
- if (!result.ok) {
652
- this.set({ error: result.error.message });
653
- return;
654
- }
655
- const { name, content } = result.value;
656
- this.set({ view: {
657
- id,
658
- title: name ?? id,
659
- content
660
- } });
661
- }
662
- /** Close the read-only viewer. */
663
- closeView() {
664
- this.set({ view: null });
665
- }
666
- /**
667
- * Open the copy dialog over one preset.
668
- * @param from - the preset the copy will start from.
669
- */
670
- beginCopy(from) {
671
- const row = this.store.getSnapshot().rows.find((candidate) => candidate.id === from);
672
- this.set({
673
- error: null,
674
- copy: {
675
- from,
676
- fromTitle: row?.name ?? from,
677
- id: "",
678
- name: "",
679
- saving: false,
680
- error: null
681
- }
682
- });
683
- }
684
- /** Close the copy dialog, discarding whatever was typed. */
685
- cancelCopy() {
686
- this.set({ copy: null });
687
- }
688
- /**
689
- * Name the preset the copy creates.
690
- * @param id - the id typed into the dialog.
691
- */
692
- setCopyId(id) {
693
- this.patchCopy({
694
- id,
695
- error: null
696
- });
697
- }
698
- /**
699
- * Name the copy's display name.
700
- * @param name - the display name typed into the dialog.
701
- */
702
- setCopyName(name) {
703
- this.patchCopy({
704
- name,
705
- error: null
706
- });
707
- }
708
- /**
709
- * Submit the copy, re-read the roster, then take the user to the new
710
- * preset's files — the directory opens where the host has a desktop, and
711
- * its path appears on the new row where it does not.
712
- * @returns once the copy settled and the page reflects it.
713
- */
714
- async confirmCopy() {
715
- const draft = this.store.getSnapshot().copy;
716
- if (draft === null || draft.saving) return;
717
- if (draftBlocker(draft, this.store.getSnapshot().rows) !== void 0) return;
718
- this.patchCopy({
719
- saving: true,
720
- error: null
721
- });
722
- const name = draft.name.trim();
723
- const result = await this.ctx.remote.agentPresets.copy(draft.from, draft.id, name === "" ? void 0 : name);
724
- if (!result.ok) {
725
- this.patchCopy({
726
- saving: false,
727
- error: result.error.message
728
- });
729
- return;
730
- }
731
- this.set({ copy: null });
732
- await this.load();
733
- this.rosterChanged();
734
- await this.openLocation(draft.id);
735
- }
736
- /**
737
- * Open one preset's directory on the host desktop, or reveal its path on
738
- * the row where the deployment has no opener to hand it to.
739
- * @param id - the preset whose files the user wants.
740
- * @returns once the host answered and the page reflects it.
741
- */
742
- async openLocation(id) {
743
- const result = await this.ctx.remote.settings.openAgentPresetDirectory(id);
744
- if (!result.ok) {
745
- this.set({ error: result.error.message });
746
- return;
747
- }
748
- if (result.value.opened) return;
749
- const { path } = result.value;
750
- this.set({ revealedPaths: {
751
- ...this.store.getSnapshot().revealedPaths,
752
- [id]: path
753
- } });
754
- }
755
- /**
756
- * Ask for confirmation before deleting one preset.
757
- * @param id - the preset to delete, or null to dismiss the confirmation.
758
- */
759
- confirmDelete(id) {
760
- if (this.store.getSnapshot().deleting) return;
761
- this.set({ pendingDelete: id });
762
- }
763
- /**
764
- * Delete the preset awaiting confirmation, then re-read the roster.
765
- *
766
- * A session already composed from it keeps running: its composition was
767
- * mounted at creation and nothing re-reads the file.
768
- * @returns once the delete settled and the page reflects it.
769
- */
770
- async remove() {
771
- const { pendingDelete, deleting } = this.store.getSnapshot();
772
- if (pendingDelete === null || deleting) return;
773
- this.set({
774
- deleting: true,
775
- error: null
776
- });
777
- const result = await this.ctx.remote.agentPresets.deletePreset(pendingDelete);
778
- if (!result.ok) {
779
- this.set({
780
- deleting: false,
781
- pendingDelete: null,
782
- error: result.error.message
783
- });
784
- return;
785
- }
786
- this.set({
787
- deleting: false,
788
- pendingDelete: null
789
- });
790
- await this.load();
791
- this.rosterChanged();
792
- }
793
1226
  /**
794
- * Make one preset the default for sessions created later. Running sessions
795
- * keep the composition they began with, so this never disturbs work.
796
- * @param id - the preset to make default.
797
- * @returns once the write settled and the roster was re-read.
798
- */
799
- async makeDefault(id) {
800
- const failure = await writeDefaultPreset(this.ctx, id);
801
- if (failure !== void 0) {
802
- this.set({ error: failure });
803
- return;
804
- }
805
- await this.load();
806
- }
807
- };
808
- //#endregion
809
- //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-agent-preset/src/client/AgentPresetSection.module.css.mjs
810
- const css = ".rtSEdW_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}.rtSEdW_title{margin:0;font-size:18px;font-weight:600}.rtSEdW_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px}.rtSEdW_group{flex-direction:column;gap:10px;display:flex}.rtSEdW_group+.rtSEdW_group{margin-top:20px}.rtSEdW_groupHead{letter-spacing:.06em;text-transform:uppercase;color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;font-weight:600}.rtSEdW_cards{grid-template-columns:repeat(auto-fill,minmax(268px,1fr));grid-auto-rows:1fr;gap:12px;margin:0;padding:0;list-style:none;display:grid}.rtSEdW_card{border:.5px solid var(--dsw-alias-border-l4);background:0 0;border-radius:20px;flex-direction:column;transition:border-color .16s,background .16s;display:flex}.rtSEdW_card:hover:not(.rtSEdW_cardActive){background:var(--dsw-alias-interactive-bg-hover)}.rtSEdW_cardActive{background:var(--dsw-alias-bg-module-platform);border-color:var(--dsw-static-neutral-bluish-400)}.rtSEdW_cardBroken,.rtSEdW_cardBroken:hover{border-color:var(--dsw-alias-state-error-primary)}.rtSEdW_brokenBadge{corner-shape:round;white-space:nowrap;background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-bg-layer-3);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.rtSEdW_brokenTip{z-index:1;background:var(--dsw-alias-label-primary);width:max-content;max-width:100%;color:var(--dsw-alias-bg-layer-3);text-align:left;white-space:pre-line;overflow-wrap:anywhere;opacity:0;pointer-events:none;border-radius:6px;padding:6px 8px;font-size:11px;font-weight:400;line-height:1.5;transition:opacity .12s;position:absolute;top:calc(100% + 6px);left:0}.rtSEdW_brokenBadge:hover .rtSEdW_brokenTip,.rtSEdW_cardMain:focus-visible .rtSEdW_brokenTip{opacity:1}.rtSEdW_cardMain[aria-disabled=true]{cursor:default}.rtSEdW_cardBrokenReason{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.rtSEdW_cardMain{appearance:none;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px 12px 0 0;flex-direction:column;flex:1;gap:8px;padding:14px 16px 12px;display:flex}.rtSEdW_cardMain:disabled{cursor:default}.rtSEdW_cardMain:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.rtSEdW_cardHead{align-items:center;gap:8px;display:flex;position:relative}.rtSEdW_cardName{font-size:15px;font-weight:600;line-height:1.4}.rtSEdW_inUse{margin-left:auto}.rtSEdW_cardDesc{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:4;overflow-wrap:anywhere;-webkit-box-orient:vertical;min-height:42px;font-size:13px;line-height:1.55;display:-webkit-box;overflow:hidden}.rtSEdW_cardId{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-tertiary);margin-top:auto;font-size:11px}.rtSEdW_cardFoot{border-top:.5px solid var(--dsw-alias-border-l2);justify-content:flex-end;gap:2px;padding:6px 10px;display:flex}.rtSEdW_iconButton{appearance:none;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:7px;align-items:center;padding:6px;display:inline-flex;position:relative}.rtSEdW_iconButton:disabled{opacity:.4;cursor:default}.rtSEdW_iconButton:hover:not(:disabled){background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}.rtSEdW_iconButton:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}.rtSEdW_iconButton:after{content:attr(data-tip);background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);white-space:nowrap;opacity:0;pointer-events:none;border-radius:6px;padding:3px 8px;font-size:11px;line-height:17px;transition:opacity .12s;position:absolute;bottom:calc(100% + 6px);left:50%;transform:translate(-50%)}.rtSEdW_iconButton:hover:after,.rtSEdW_iconButton:focus-visible:after{opacity:1}.rtSEdW_iconDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.rtSEdW_revealedPath{color:var(--dsw-alias-label-tertiary);align-items:baseline;gap:6px;margin:0;padding:6px 16px 10px;font-size:11px;display:flex}.rtSEdW_revealedPath code{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-secondary);user-select:all;overflow-wrap:anywhere}.rtSEdW_revealedPathLabel{white-space:nowrap}.rtSEdW_secondaryButton{color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:7px;padding:5px 8px;font-size:12.5px}.rtSEdW_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-bg-layer-1)}.rtSEdW_secondaryButton:disabled{opacity:.5;cursor:default}.rtSEdW_field{flex-direction:column;gap:6px;display:flex}.rtSEdW_fieldLabel{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500}.rtSEdW_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:10px;padding:9px 12px;font-size:13px}.rtSEdW_input:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.rtSEdW_input::placeholder{color:var(--dsw-alias-label-dimmed)}.rtSEdW_dialog{width:min(560px,100%)}.rtSEdW_dialogFields{flex-direction:column;gap:12px;display:flex}.rtSEdW_viewerCode{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-2);max-height:min(52vh,480px);color:var(--dsw-alias-label-secondary);font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);white-space:pre;tab-size:2;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:10px;margin:0;padding:12px;font-size:12.5px;line-height:1.5;overflow:auto}.rtSEdW_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rtSEdW_deleteDialog{width:min(480px,100%)}.rtSEdW_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}.rtSEdW_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.rtSEdW_creatorButton{box-sizing:border-box;border:1px dashed var(--dsw-alias-border-l3);height:44px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border-radius:20px;justify-content:center;align-self:stretch;align-items:center;gap:6px;font-size:14px;line-height:22px;display:flex}.rtSEdW_creatorButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.rtSEdW_creatorButton:disabled{opacity:.4;cursor:default}";
811
- const tagId = "@deepseek-ai/dsh-client-ui-agent-preset/AgentPresetSection.module.css";
812
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
813
- const tag = document.createElement("style");
814
- tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-agent-preset";
815
- tag.dataset.pluginCss = tagId;
816
- tag.textContent = css;
817
- document.head.appendChild(tag);
818
- }
819
- var AgentPresetSection_module_css_default = {
820
- "brokenBadge": "rtSEdW_brokenBadge",
821
- "brokenTip": "rtSEdW_brokenTip",
822
- "card": "rtSEdW_card",
823
- "cardActive": "rtSEdW_cardActive",
824
- "cardBroken": "rtSEdW_cardBroken",
825
- "cardBrokenReason": "rtSEdW_cardBrokenReason",
826
- "cardDesc": "rtSEdW_cardDesc",
827
- "cardFoot": "rtSEdW_cardFoot",
828
- "cardHead": "rtSEdW_cardHead",
829
- "cardId": "rtSEdW_cardId",
830
- "cardMain": "rtSEdW_cardMain",
831
- "cardName": "rtSEdW_cardName",
832
- "cards": "rtSEdW_cards",
833
- "creatorButton": "rtSEdW_creatorButton",
834
- "deleteConfirm": "rtSEdW_deleteConfirm",
835
- "deleteDialog": "rtSEdW_deleteDialog",
836
- "dialog": "rtSEdW_dialog",
837
- "dialogFields": "rtSEdW_dialogFields",
838
- "error": "rtSEdW_error",
839
- "field": "rtSEdW_field",
840
- "fieldLabel": "rtSEdW_fieldLabel",
841
- "group": "rtSEdW_group",
842
- "groupHead": "rtSEdW_groupHead",
843
- "iconButton": "rtSEdW_iconButton",
844
- "iconDanger": "rtSEdW_iconDanger",
845
- "inUse": "rtSEdW_inUse",
846
- "input": "rtSEdW_input",
847
- "intro": "rtSEdW_intro",
848
- "revealedPath": "rtSEdW_revealedPath",
849
- "revealedPathLabel": "rtSEdW_revealedPathLabel",
850
- "secondaryButton": "rtSEdW_secondaryButton",
851
- "section": "rtSEdW_section",
852
- "title": "rtSEdW_title",
853
- "viewerCode": "rtSEdW_viewerCode"
854
- };
855
- //#endregion
856
- //#region lib/types/client/AgentPresetSection.js
857
- /**
858
- * Agent-presets settings section: the roster as cards, a copy dialog as the
859
- * only way a preset is created, and a read-only viewer over the shipped
860
- * compositions.
861
- *
862
- * The browser edits no composition text — a shipped preset opens read-only to
863
- * be READ (it is the known-good composition a copy starts from), and a custom
864
- * preset is edited in its own files, which is what the location action leads
865
- * to. Deleting a preset leaves running sessions alone: a composition is
866
- * mounted once at session creation and nothing re-reads the file.
867
- */
868
- function CopyDialog({ state, t, actions }) {
869
- const draft = state.copy;
870
- const blocker = draft === null ? void 0 : draftBlocker(draft, state.rows);
871
- const message = draft === null ? null : draft.error ?? (blocker === void 0 ? null : t(blocker));
872
- const source = draft === null ? void 0 : state.rows.find((row) => row.id === draft.from);
873
- const sourceTitle = source === void 0 ? draft?.fromTitle : presetDisplayText(source, t).name;
874
- return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
875
- open: draft !== null,
876
- onClose: () => {
877
- actions.cancelCopy();
878
- },
879
- title: draft === null ? t("copyTitle") : `${t("copyTitle")} · ${t("copyOf")} ${sourceTitle}`,
880
- closeLabel: t("close"),
881
- description: t("copyIntro"),
882
- className: AgentPresetSection_module_css_default.dialog,
883
- footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
884
- variant: "outline",
885
- disabled: draft?.saving === true,
886
- onClick: () => {
887
- actions.cancelCopy();
888
- },
889
- children: t("cancel")
890
- }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
891
- disabled: draft === null || draft.saving || blocker !== void 0,
892
- onClick: () => {
893
- actions.confirmCopy();
894
- },
895
- children: draft?.saving === true ? t("creating") : t("create")
896
- })] }),
897
- children: draft === null ? null : (0, react_jsx_runtime.jsxs)("div", {
898
- className: AgentPresetSection_module_css_default.dialogFields,
899
- children: [
900
- (0, react_jsx_runtime.jsxs)("label", {
901
- className: AgentPresetSection_module_css_default.field,
902
- children: [(0, react_jsx_runtime.jsx)("span", {
903
- className: AgentPresetSection_module_css_default.fieldLabel,
904
- children: t("presetId")
905
- }), (0, react_jsx_runtime.jsx)("input", {
906
- className: AgentPresetSection_module_css_default.input,
907
- value: draft.id,
908
- autoFocus: true,
909
- spellCheck: false,
910
- placeholder: t("presetIdPlaceholder"),
911
- onChange: (event) => {
912
- actions.setCopyId(event.target.value);
913
- }
914
- })]
915
- }),
916
- (0, react_jsx_runtime.jsxs)("label", {
917
- className: AgentPresetSection_module_css_default.field,
918
- children: [(0, react_jsx_runtime.jsx)("span", {
919
- className: AgentPresetSection_module_css_default.fieldLabel,
920
- children: t("displayName")
921
- }), (0, react_jsx_runtime.jsx)("input", {
922
- className: AgentPresetSection_module_css_default.input,
923
- value: draft.name,
924
- spellCheck: false,
925
- placeholder: t("displayNamePlaceholder"),
926
- onChange: (event) => {
927
- actions.setCopyName(event.target.value);
928
- }
929
- })]
930
- }),
931
- message === null ? null : (0, react_jsx_runtime.jsx)("p", {
932
- className: AgentPresetSection_module_css_default.error,
933
- role: "alert",
934
- children: message
935
- })
936
- ]
937
- })
938
- });
939
- }
940
- /**
941
- * Render one card's description, clamped by CSS and offered in full on hover.
942
- * The tooltip is attached only while the text is actually cut off, so a short
943
- * description does not answer a hover with a bubble repeating the card.
944
- * @param props.text - the description as rendered, already localized.
945
- * @returns the description element, tooltip-anchored while it overflows.
946
- */
947
- function CardDescription({ text }) {
948
- const ref = (0, react.useRef)(null);
949
- const [truncated, setTruncated] = (0, react.useState)(false);
950
- (0, react.useLayoutEffect)(() => {
951
- const el = ref.current;
952
- /* v8 ignore next -- the ref is attached before layout effects run. */
953
- if (el === null) return;
954
- const measure = () => {
955
- setTruncated(el.scrollHeight > el.clientHeight);
956
- };
957
- measure();
958
- if (typeof ResizeObserver === "undefined") return;
959
- const observer = new ResizeObserver(measure);
960
- observer.observe(el);
961
- return () => {
962
- observer.disconnect();
963
- };
964
- }, [text]);
965
- return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
966
- label: text,
967
- side: "bottom",
968
- delayMs: 400,
969
- disabled: !truncated,
970
- maxWidth: 360,
971
- children: (0, react_jsx_runtime.jsx)("span", {
972
- ref,
973
- className: AgentPresetSection_module_css_default.cardDesc,
974
- title: "",
975
- children: text
976
- })
977
- });
978
- }
979
- /**
980
- * Render the Agent presets section content column.
981
- * @param props - composed slot props.
982
- * @returns the section, or null when the deployment composes no presets.
983
- */
984
- function AgentPresetSection(props) {
985
- const { useAgentPresetSection, t, load } = props;
986
- const state = useAgentPresetSection((snapshot) => snapshot);
987
- const viewedId = state.view?.id;
988
- const viewedRow = viewedId === void 0 ? void 0 : state.rows.find((row) => row.id === viewedId);
989
- const viewedTitle = state.view === null ? "" : viewedRow === void 0 ? state.view.title : presetDisplayText(viewedRow, t).name;
990
- (0, react.useEffect)(() => {
991
- load();
992
- }, [load]);
993
- if (state.status === "unavailable") return null;
994
- if (state.status === "error") {
995
- /* v8 ignore next -- an error status always carries text; the fallback satisfies the nullable type */
996
- const detail = state.error ?? "";
997
- return (0, react_jsx_runtime.jsxs)("div", {
998
- className: AgentPresetSection_module_css_default.section,
999
- children: [(0, react_jsx_runtime.jsx)("p", {
1000
- className: AgentPresetSection_module_css_default.error,
1001
- role: "alert",
1002
- children: `${t("error")} ${detail}`
1003
- }), (0, react_jsx_runtime.jsx)("button", {
1004
- type: "button",
1005
- className: AgentPresetSection_module_css_default.secondaryButton,
1006
- onClick: () => {
1007
- load();
1008
- },
1009
- children: t("retry")
1010
- })]
1011
- });
1012
- }
1013
- const creatorButton = props.startCreatorDraft !== void 0 && state.rows.some((row) => row.id === "cordis") ? (0, react_jsx_runtime.jsxs)("button", {
1014
- type: "button",
1015
- className: AgentPresetSection_module_css_default.creatorButton,
1016
- disabled: !state.authorable,
1017
- title: state.authorable ? void 0 : t("duplicateUnavailable"),
1018
- onClick: () => {
1019
- props.startCreatorDraft?.();
1020
- props.close();
1021
- },
1022
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 14 }), t("creatorDraft")]
1023
- }) : null;
1024
- return (0, react_jsx_runtime.jsxs)("div", {
1025
- className: AgentPresetSection_module_css_default.section,
1026
- children: [
1027
- (0, react_jsx_runtime.jsx)("h2", {
1028
- className: AgentPresetSection_module_css_default.title,
1029
- children: t("nav")
1030
- }),
1031
- (0, react_jsx_runtime.jsx)("p", {
1032
- className: AgentPresetSection_module_css_default.intro,
1033
- children: t("sectionIntro")
1034
- }),
1035
- state.error === null ? null : (0, react_jsx_runtime.jsx)("p", {
1036
- className: AgentPresetSection_module_css_default.error,
1037
- role: "alert",
1038
- children: state.error
1039
- }),
1040
- [["system", t("builtInGroup")], ["user", t("customGroup")]].map(([trust, heading]) => {
1041
- const group = state.rows.filter((row) => row.trust === trust).map((row) => ({
1042
- row,
1043
- text: presetDisplayText(row, t)
1044
- }));
1045
- const tail = trust === "user" ? creatorButton : null;
1046
- if (group.length === 0 && tail === null) return null;
1047
- return (0, react_jsx_runtime.jsxs)("section", {
1048
- className: AgentPresetSection_module_css_default.group,
1049
- children: [
1050
- (0, react_jsx_runtime.jsx)("h3", {
1051
- className: AgentPresetSection_module_css_default.groupHead,
1052
- children: heading
1053
- }),
1054
- group.length === 0 ? null : (0, react_jsx_runtime.jsx)("ul", {
1055
- className: AgentPresetSection_module_css_default.cards,
1056
- children: group.map(({ row, text }) => (0, react_jsx_runtime.jsxs)("li", {
1057
- className: row.broken !== void 0 ? `${AgentPresetSection_module_css_default.card} ${AgentPresetSection_module_css_default.cardBroken}` : row.isDefault ? `${AgentPresetSection_module_css_default.card} ${AgentPresetSection_module_css_default.cardActive}` : AgentPresetSection_module_css_default.card,
1058
- children: [
1059
- (0, react_jsx_runtime.jsxs)("button", {
1060
- type: "button",
1061
- className: AgentPresetSection_module_css_default.cardMain,
1062
- "aria-pressed": row.isDefault,
1063
- disabled: row.isDefault,
1064
- "aria-disabled": row.broken !== void 0,
1065
- "aria-label": `${row.broken !== void 0 ? t("brokenBadge") : row.isDefault ? t("inUse") : t("setDefault")}: ${text.name}`,
1066
- title: row.broken !== void 0 ? t("brokenBadge") : row.isDefault ? t("inUse") : t("setDefault"),
1067
- onClick: () => {
1068
- if (row.broken !== void 0) return;
1069
- props.makeDefault(row.id);
1070
- },
1071
- children: [
1072
- (0, react_jsx_runtime.jsxs)("span", {
1073
- className: AgentPresetSection_module_css_default.cardHead,
1074
- children: [
1075
- (0, react_jsx_runtime.jsx)("span", {
1076
- className: AgentPresetSection_module_css_default.cardName,
1077
- children: text.name
1078
- }),
1079
- row.broken !== void 0 ? (0, react_jsx_runtime.jsxs)("span", {
1080
- className: AgentPresetSection_module_css_default.brokenBadge,
1081
- children: [t("brokenBadge"), (0, react_jsx_runtime.jsx)("span", {
1082
- className: AgentPresetSection_module_css_default.brokenTip,
1083
- "aria-hidden": "true",
1084
- children: row.broken
1085
- })]
1086
- }) : null,
1087
- (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: row.trust === "user" ? t("userTrust") : t("builtIn") }),
1088
- row.isDefault ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
1089
- tone: "solid",
1090
- className: AgentPresetSection_module_css_default.inUse,
1091
- children: t("inUse")
1092
- }) : null
1093
- ]
1094
- }),
1095
- (0, react_jsx_runtime.jsx)(CardDescription, { text: text.description ?? t("noDescription") }),
1096
- row.broken === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
1097
- className: AgentPresetSection_module_css_default.cardBrokenReason,
1098
- role: "alert",
1099
- children: row.broken
1100
- }),
1101
- (0, react_jsx_runtime.jsx)("code", {
1102
- className: AgentPresetSection_module_css_default.cardId,
1103
- children: row.id
1104
- })
1105
- ]
1106
- }),
1107
- (0, react_jsx_runtime.jsxs)("div", {
1108
- className: AgentPresetSection_module_css_default.cardFoot,
1109
- children: [
1110
- row.trust === "system" ? row.broken === void 0 ? (0, react_jsx_runtime.jsx)("button", {
1111
- type: "button",
1112
- className: AgentPresetSection_module_css_default.iconButton,
1113
- "data-tip": t("view"),
1114
- "aria-label": `${t("view")}: ${text.name}`,
1115
- onClick: () => {
1116
- props.view(row.id);
1117
- },
1118
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBrowseOutline16, {})
1119
- }) : null : (0, react_jsx_runtime.jsx)("button", {
1120
- type: "button",
1121
- className: AgentPresetSection_module_css_default.iconButton,
1122
- "data-tip": state.hasDocument ? t("openLocation") : t("showLocation"),
1123
- "aria-label": `${state.hasDocument ? t("openLocation") : t("showLocation")}: ${text.name}`,
1124
- onClick: () => {
1125
- props.openLocation(row.id);
1126
- },
1127
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderOpenOutline16, {})
1128
- }),
1129
- (0, react_jsx_runtime.jsx)("button", {
1130
- type: "button",
1131
- className: AgentPresetSection_module_css_default.iconButton,
1132
- disabled: !state.authorable || row.broken !== void 0,
1133
- "data-tip": row.broken !== void 0 ? t("brokenNoCopy") : state.authorable ? t("duplicate") : t("duplicateUnavailable"),
1134
- "aria-label": `${t("duplicate")}: ${text.name}`,
1135
- onClick: () => {
1136
- props.beginCopy(row.id);
1137
- },
1138
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCopyOutline16, {})
1139
- }),
1140
- row.trust === "user" ? (0, react_jsx_runtime.jsx)("button", {
1141
- type: "button",
1142
- className: `${AgentPresetSection_module_css_default.iconButton} ${AgentPresetSection_module_css_default.iconDanger}`,
1143
- "data-tip": t("delete"),
1144
- "aria-label": `${t("delete")}: ${text.name}`,
1145
- onClick: () => {
1146
- props.confirmDelete(row.id);
1147
- },
1148
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16, {})
1149
- }) : null
1150
- ]
1151
- }),
1152
- state.revealedPaths[row.id] === void 0 ? null : (0, react_jsx_runtime.jsxs)("p", {
1153
- className: AgentPresetSection_module_css_default.revealedPath,
1154
- children: [(0, react_jsx_runtime.jsx)("span", {
1155
- className: AgentPresetSection_module_css_default.revealedPathLabel,
1156
- children: t("revealedPathLabel")
1157
- }), (0, react_jsx_runtime.jsx)("code", { children: state.revealedPaths[row.id] })]
1158
- })
1159
- ]
1160
- }, row.id))
1161
- }),
1162
- tail
1163
- ]
1164
- }, trust);
1165
- }),
1166
- (0, react_jsx_runtime.jsx)(CopyDialog, {
1167
- state,
1168
- t,
1169
- actions: {
1170
- cancelCopy: props.cancelCopy,
1171
- confirmCopy: props.confirmCopy,
1172
- setCopyId: props.setCopyId,
1173
- setCopyName: props.setCopyName
1174
- }
1175
- }),
1176
- (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
1177
- open: state.view !== null,
1178
- onClose: () => {
1179
- props.closeView();
1180
- },
1181
- title: state.view === null ? "" : `${t("view")} · ${viewedTitle}`,
1182
- closeLabel: t("close"),
1183
- description: t("composition"),
1184
- className: AgentPresetSection_module_css_default.dialog,
1185
- footer: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1186
- variant: "outline",
1187
- autoFocus: true,
1188
- onClick: () => {
1189
- props.closeView();
1190
- },
1191
- children: t("close")
1192
- }),
1193
- children: state.view === null ? null : (0, react_jsx_runtime.jsx)("pre", {
1194
- className: AgentPresetSection_module_css_default.viewerCode,
1195
- children: state.view.content
1196
- })
1197
- }),
1198
- (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
1199
- open: state.pendingDelete !== null,
1200
- onClose: () => {
1201
- props.confirmDelete(null);
1202
- },
1203
- title: t("deleteTitle"),
1204
- closeLabel: t("close"),
1205
- description: t("deleteDescription"),
1206
- className: AgentPresetSection_module_css_default.deleteDialog,
1207
- footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1208
- variant: "outline",
1209
- autoFocus: true,
1210
- disabled: state.deleting,
1211
- onClick: () => {
1212
- props.confirmDelete(null);
1213
- },
1214
- children: t("cancel")
1215
- }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1216
- variant: "outline",
1217
- className: AgentPresetSection_module_css_default.deleteConfirm,
1218
- disabled: state.deleting,
1219
- onClick: () => {
1220
- props.remove();
1221
- },
1222
- children: state.deleting ? t("deleting") : t("deleteConfirm")
1223
- })] })
1224
- })
1225
- ]
1226
- });
1227
- }
1228
- //#endregion
1229
- //#region lib/types/client/seat-store.js
1230
- /**
1231
- * Hero-chip controller: which preset the NEXT session gets.
1232
- *
1233
- * The new-session screen has no session, so a pick is staged rather than
1234
- * applied. It reaches a session when one becomes current and is still blank —
1235
- * whether the workspace connect created it or reused an existing blank one,
1236
- * which is why staging cannot simply ride along on `sessions.create`.
1237
- *
1238
- * The stage is forgotten once applied: the next new session starts from the
1239
- * deployment default again, matching the workspace picker beside it.
1240
- */
1241
- const INITIAL = {
1242
- options: [],
1243
- current: "",
1244
- error: null,
1245
- busy: false,
1246
- introduce: false
1247
- };
1248
- /** Stages the next session's preset and applies it when one appears. */
1249
- var AgentPresetSeatController = class {
1250
- ctx;
1251
- currentSession;
1252
- /** Chip snapshot the renderer subscribes to. */
1253
- store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(INITIAL);
1254
- /**
1255
- * The deployment default, so a consumed stage can fall back to it without
1227
+ * The Host-effective default, so a consumed stage can fall back to it without
1256
1228
  * re-reading the roster.
1257
1229
  */
1258
1230
  fallback = "";
1259
- /** Set while a pick is waiting for a session; cleared once applied. */
1260
- staged;
1261
- constructor(ctx, currentSession) {
1231
+ /** Only the newest roster read may publish after overlapping refreshes. */
1232
+ loadGeneration = 0;
1233
+ /** Completion of the active Host selection; Settings choices wait before staging. */
1234
+ pendingSelection;
1235
+ constructor(ctx, currentSession, staged = {
1236
+ id: void 0,
1237
+ introduce: false
1238
+ }) {
1262
1239
  this.ctx = ctx;
1263
1240
  this.currentSession = currentSession;
1241
+ this.staged = staged;
1264
1242
  }
1265
1243
  set(patch) {
1266
1244
  this.store.set({
@@ -1268,24 +1246,37 @@ window.__ModuleLoader__.load({
1268
1246
  ...patch
1269
1247
  });
1270
1248
  }
1249
+ clearStage() {
1250
+ this.staged.id = void 0;
1251
+ this.staged.introduce = false;
1252
+ }
1253
+ /** Developer tools are the single gate over preset selection. */
1254
+ selectionAvailable() {
1255
+ return this.ctx.configForms.developerTools.enabled.getSnapshot();
1256
+ }
1271
1257
  /**
1272
- * Read the roster and open the chip on the deployment default.
1258
+ * Read the roster and open the chip on the Host-effective default.
1273
1259
  * @returns once the snapshot reflects the host.
1274
1260
  */
1275
1261
  async load() {
1262
+ const generation = ++this.loadGeneration;
1276
1263
  const roster = await readRoster(this.ctx);
1264
+ if (generation !== this.loadGeneration) return;
1277
1265
  if (!roster.ok) {
1278
1266
  this.set({ error: roster.error });
1279
1267
  return;
1280
1268
  }
1281
1269
  const { presets } = roster.value;
1270
+ if (!this.selectionAvailable()) this.clearStage();
1282
1271
  this.fallback = presets.find((preset) => preset.isDefault)?.id ?? presets[0]?.id ?? "";
1283
1272
  const session = this.currentSession();
1284
1273
  this.set({
1285
1274
  options: presetOptions(presets),
1286
- current: this.staged ?? (session === void 0 ? this.fallback : presetOf(session) ?? ""),
1287
- error: null
1275
+ current: this.staged.id ?? (session === void 0 ? this.fallback : presetOf(session) ?? ""),
1276
+ error: null,
1277
+ introduce: this.staged.introduce
1288
1278
  });
1279
+ await this.apply();
1289
1280
  }
1290
1281
  /**
1291
1282
  * Stage one preset for the next session, applying it immediately when a
@@ -1302,8 +1293,7 @@ window.__ModuleLoader__.load({
1302
1293
  async select(id) {
1303
1294
  if (this.store.getSnapshot().busy) return void 0;
1304
1295
  this.stage(id);
1305
- await this.apply();
1306
- return this.store.getSnapshot().error ?? void 0;
1296
+ return await this.apply();
1307
1297
  }
1308
1298
  /**
1309
1299
  * Stage a pick WITHOUT the immediate apply, for a flow that starts the
@@ -1317,16 +1307,40 @@ window.__ModuleLoader__.load({
1317
1307
  * chip should announce itself on the session it lands on.
1318
1308
  */
1319
1309
  stage(id, introduce = false) {
1320
- this.staged = id;
1310
+ this.staged.id = id;
1311
+ this.staged.introduce = introduce;
1321
1312
  this.set({
1322
1313
  current: id,
1323
1314
  error: null,
1324
1315
  introduce
1325
1316
  });
1326
1317
  }
1318
+ /**
1319
+ * Capture the exact blank Session a Settings action may bring along.
1320
+ * @returns its id, or undefined outside a blank Session.
1321
+ */
1322
+ blankSessionId() {
1323
+ const session = this.currentSession();
1324
+ return session?.blank === true ? session.id : void 0;
1325
+ }
1326
+ /**
1327
+ * Apply a Settings choice only if its captured Session is still current and
1328
+ * blank after any pending selection settles. The selection uses the existing stage/apply path.
1329
+ * @param expectedSessionId - blank Session captured before the Settings write.
1330
+ * @param id - the effective default that the write persisted.
1331
+ * @returns the Host refusal text, or undefined when applied or no longer relevant.
1332
+ */
1333
+ async syncBlankSession(expectedSessionId, id) {
1334
+ while (this.pendingSelection !== void 0) await this.pendingSelection;
1335
+ const session = this.currentSession();
1336
+ if (session === void 0 || !session.blank || session.id !== expectedSessionId) return void 0;
1337
+ this.stage(id);
1338
+ return await this.apply();
1339
+ }
1327
1340
  /** Acknowledge the introduction cue once the chip has played it. */
1328
1341
  introduced() {
1329
1342
  if (!this.store.getSnapshot().introduce) return;
1343
+ this.staged.introduce = false;
1330
1344
  this.set({ introduce: false });
1331
1345
  }
1332
1346
  /**
@@ -1334,40 +1348,54 @@ window.__ModuleLoader__.load({
1334
1348
  *
1335
1349
  * Called both by `select()` and by whoever observes the current session
1336
1350
  * changing, because the session may appear either before or after the pick.
1337
- * @returns once the switch settled, or immediately when there is nothing to do.
1351
+ * List updates do not repeat a selection while its response is pending.
1352
+ * @returns this attempt's Host refusal, or undefined when successful or no switch starts.
1338
1353
  */
1339
1354
  async apply() {
1340
- const staged = this.staged;
1355
+ if (this.store.getSnapshot().busy) return;
1356
+ const available = this.selectionAvailable();
1357
+ if (!available) this.clearStage();
1358
+ const staged = this.staged.id;
1341
1359
  const session = this.currentSession();
1342
1360
  if (staged === void 0) {
1343
1361
  const current = session === void 0 ? this.fallback : presetOf(session) ?? "";
1344
- if (current !== this.store.getSnapshot().current) this.set({ current });
1362
+ const shown = this.store.getSnapshot();
1363
+ if (!available && shown.introduce) this.set({
1364
+ current,
1365
+ introduce: false
1366
+ });
1367
+ else if (current !== shown.current) this.set({ current });
1345
1368
  return;
1346
1369
  }
1347
1370
  if (session === void 0) return;
1348
1371
  if (!session.blank || presetOf(session) === staged) {
1349
- this.staged = void 0;
1372
+ this.clearStage();
1350
1373
  return;
1351
1374
  }
1352
- this.set({
1353
- busy: true,
1354
- error: null
1355
- });
1356
- const result = await this.ctx.remote.agentPresets.select(session.id, staged);
1357
- this.staged = void 0;
1358
- if (!result.ok) {
1359
- const { error } = result;
1375
+ const completion = Promise.withResolvers();
1376
+ this.pendingSelection = completion.promise;
1377
+ this.clearStage();
1378
+ try {
1360
1379
  this.set({
1361
- busy: false,
1362
- error: "reason" in error.details && typeof error.details.reason === "string" ? error.details.reason : error.message,
1363
- current: presetOf(session) ?? ""
1380
+ busy: true,
1381
+ error: null
1364
1382
  });
1365
- return;
1383
+ const result = await this.ctx.remote.agentPresets.select(session.id, staged);
1384
+ if (!result.ok) {
1385
+ const { error } = result;
1386
+ const refusal = "reason" in error.details && typeof error.details.reason === "string" ? error.details.reason : error.message;
1387
+ this.set({
1388
+ error: refusal,
1389
+ current: this.staged.id ?? presetOf(session) ?? ""
1390
+ });
1391
+ return refusal;
1392
+ }
1393
+ this.set({ current: this.staged.id ?? result.value });
1394
+ } finally {
1395
+ this.pendingSelection = void 0;
1396
+ this.set({ busy: false });
1397
+ completion.resolve(void 0);
1366
1398
  }
1367
- this.set({
1368
- busy: false,
1369
- current: result.value
1370
- });
1371
1399
  }
1372
1400
  };
1373
1401
  function presetOf(session) {
@@ -1375,12 +1403,122 @@ window.__ModuleLoader__.load({
1375
1403
  return typeof value === "string" ? value : void 0;
1376
1404
  }
1377
1405
  //#endregion
1406
+ //#region lib/types/client/section-store.js
1407
+ const INITIAL = {
1408
+ status: "idle",
1409
+ error: null,
1410
+ saving: false,
1411
+ rows: [],
1412
+ view: null
1413
+ };
1414
+ const message = (error) => error instanceof Error ? error.message : String(error);
1415
+ /** Loads the roster, writes the default, and reads one composition at a time. */
1416
+ var AgentPresetSectionController = class {
1417
+ ctx;
1418
+ /** Observable roster, selection and viewer state. */
1419
+ store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)(INITIAL);
1420
+ loading;
1421
+ viewRequest = 0;
1422
+ constructor(ctx) {
1423
+ this.ctx = ctx;
1424
+ }
1425
+ set(patch) {
1426
+ this.store.set({
1427
+ ...this.store.getSnapshot(),
1428
+ ...patch
1429
+ });
1430
+ }
1431
+ /** Refresh the roster; concurrent calls share one read.
1432
+ * @returns Once the roster read settles.
1433
+ */
1434
+ load() {
1435
+ return this.loading ??= this.readRoster().finally(() => {
1436
+ this.loading = void 0;
1437
+ });
1438
+ }
1439
+ async readRoster() {
1440
+ try {
1441
+ const result = await this.ctx.remote.agentPresets.list();
1442
+ if (!result.ok) throw new Error(result.error.message);
1443
+ this.set({
1444
+ status: "ready",
1445
+ error: null,
1446
+ rows: result.value.presets
1447
+ });
1448
+ } catch (error) {
1449
+ this.set({
1450
+ status: "error",
1451
+ error: message(error)
1452
+ });
1453
+ }
1454
+ }
1455
+ /** Open one preset's declared composition in the viewer.
1456
+ * @param id Preset to read.
1457
+ * @returns Once the read settles; a current failure lands in `error`, while a read superseded by close or another read is ignored.
1458
+ */
1459
+ async view(id) {
1460
+ const request = ++this.viewRequest;
1461
+ this.set({
1462
+ error: null,
1463
+ view: null
1464
+ });
1465
+ try {
1466
+ const result = await this.ctx.remote.agentPresets.read(id);
1467
+ if (request !== this.viewRequest) return;
1468
+ if (!result.ok) throw new Error(result.error.message);
1469
+ const { name, content } = result.value;
1470
+ this.set({ view: {
1471
+ id,
1472
+ title: name ?? id,
1473
+ content
1474
+ } });
1475
+ } catch (error) {
1476
+ if (request === this.viewRequest) this.set({ error: message(error) });
1477
+ }
1478
+ }
1479
+ /** Close the viewer. */
1480
+ closeView() {
1481
+ this.viewRequest++;
1482
+ this.set({ view: null });
1483
+ }
1484
+ /** Set the default and synchronize the current blank task when supplied.
1485
+ * @param id Selected default.
1486
+ * @param sync Blank-session synchronization callback.
1487
+ * @returns Once saved and refreshed.
1488
+ */
1489
+ async makeDefault(id, sync) {
1490
+ await this.save(() => writeDefaultPreset(this.ctx, id), sync);
1491
+ }
1492
+ async save(write, sync) {
1493
+ if (this.store.getSnapshot().saving) return;
1494
+ this.set({
1495
+ saving: true,
1496
+ error: null
1497
+ });
1498
+ try {
1499
+ const error = await write();
1500
+ await this.load();
1501
+ if (error !== void 0) throw new Error(error);
1502
+ const selected = this.store.getSnapshot().rows.find((row) => row.isDefault);
1503
+ if (selected !== void 0) {
1504
+ const error = await sync?.(selected.id);
1505
+ if (error !== void 0) throw new Error(error);
1506
+ }
1507
+ } catch (error) {
1508
+ this.set({ error: message(error) });
1509
+ } finally {
1510
+ this.set({ saving: false });
1511
+ }
1512
+ }
1513
+ };
1514
+ //#endregion
1378
1515
  //#region lib/types/client/index.js
1379
1516
  /**
1380
1517
  * Agent-preset surface plugin, browser half — three surfaces over one roster:
1381
1518
  * a chip on the new-session screen for the session about to start, a
1382
- * read-only label in the session header, and a settings section that manages
1383
- * the roster (copy, delete, default, and the way into a preset's own files).
1519
+ * read-only label in the session header, and a settings section that lists
1520
+ * the roster (selection, the new-task default, a read-only view of each
1521
+ * declared composition, and the way into Creator mode).
1384
1522
  *
1385
1523
  * A running session keeps the composition it began with (the host refuses to
1386
1524
  * adopt an existing session under a different preset). That is what splits
@@ -1388,14 +1526,20 @@ window.__ModuleLoader__.load({
1388
1526
  * header only reports what a session already runs. The default preset is
1389
1527
  * edited where the roster is visible — the settings section's "make default"
1390
1528
  * — so General settings carries no duplicate control for the same field.
1529
+ *
1530
+ * Developer tools (General settings) are the single gate over selection: with
1531
+ * them off the chip disappears and the card actions are disabled, while the
1532
+ * saved default keeps composing new sessions.
1391
1533
  */
1392
1534
  /** Required services (cordis fiber inject). */
1393
1535
  const inject = [
1394
1536
  "slots",
1537
+ "sessions",
1395
1538
  "locale",
1396
1539
  "remote",
1397
1540
  "remote.agentPresets",
1398
- "remote.settings"
1541
+ "remote.settings",
1542
+ "configForms"
1399
1543
  ];
1400
1544
  /**
1401
1545
  * Mount the roster surfaces: hero chip, session-header label, settings section.
@@ -1403,11 +1547,55 @@ window.__ModuleLoader__.load({
1403
1547
  */
1404
1548
  function apply(ctx) {
1405
1549
  const controller = new AgentPresetSettingsController(ctx);
1406
- const rosterReaders = /* @__PURE__ */ new Set();
1407
- const section = new AgentPresetSectionController(ctx, () => {
1408
- controller.load();
1409
- for (const read of rosterReaders) read();
1410
- });
1550
+ const staged = {
1551
+ id: void 0,
1552
+ introduce: false
1553
+ };
1554
+ const seats = new WeakMapWithValues();
1555
+ const boundSeatDisposers = /* @__PURE__ */ new Set();
1556
+ ctx.effect(() => async () => {
1557
+ await Promise.all([...boundSeatDisposers].map((dispose) => dispose()));
1558
+ }, "ui-agent-preset: bound selections");
1559
+ const unboundSeat = new AgentPresetSeatController(ctx, () => void 0, staged);
1560
+ const seatFor = (binding) => {
1561
+ const existing = seats.get(binding);
1562
+ if (existing !== void 0) return existing;
1563
+ const seat = new AgentPresetSeatController(ctx, () => {
1564
+ if (ctx.sessions.binding(binding.sessionId) !== binding) return void 0;
1565
+ const summary = ctx.sessions.list.getSnapshot().byId[binding.sessionId];
1566
+ return summary !== void 0 && (ctx.sessions.retainInfo(binding.sessionId).getSnapshot().retainedBy.mainView ?? 0) > 0 ? summary : void 0;
1567
+ }, staged);
1568
+ seats.set(binding, seat);
1569
+ const dispose = binding.ctx.effect(() => {
1570
+ const stop = ctx.sessions.list.subscribe(() => {
1571
+ seat.apply();
1572
+ });
1573
+ return () => {
1574
+ stop();
1575
+ seats.delete(binding);
1576
+ boundSeatDisposers.delete(dispose);
1577
+ };
1578
+ }, "ui-agent-preset: Provider binding");
1579
+ boundSeatDisposers.add(dispose);
1580
+ return seat;
1581
+ };
1582
+ const section = new AgentPresetSectionController(ctx);
1583
+ const developerTools = ctx.configForms.developerTools.enabled;
1584
+ ctx.effect(() => developerTools.subscribe(() => {
1585
+ if (developerTools.getSnapshot()) return;
1586
+ staged.id = void 0;
1587
+ staged.introduce = false;
1588
+ unboundSeat.apply();
1589
+ for (const seat of seats.values) seat.apply();
1590
+ }), "ui-agent-preset: Developer tools gate");
1591
+ const mainBlankSeat = () => {
1592
+ const summary = Object.values(ctx.sessions.list.getSnapshot().byId).find((session) => {
1593
+ /* v8 ignore next -- retained source counts omit zero-valued entries. */
1594
+ return session.blank && (session.retainedBy.mainView ?? 0) > 0;
1595
+ });
1596
+ const binding = summary === void 0 ? void 0 : ctx.sessions.binding(summary.id);
1597
+ return binding === void 0 ? void 0 : seatFor(binding);
1598
+ };
1411
1599
  ctx.effect(() => ctx.locale.register("settings.agentPreset", {
1412
1600
  zh,
1413
1601
  en
@@ -1416,9 +1604,11 @@ window.__ModuleLoader__.load({
1416
1604
  const refresh = () => {
1417
1605
  controller.load();
1418
1606
  if (section.store.getSnapshot().status !== "idle") section.load();
1607
+ unboundSeat.load();
1608
+ for (const seat of seats.values) seat.load();
1419
1609
  };
1420
1610
  const disposers = [ctx.remote.$on("settings/document-updated", (ns) => {
1421
- if (ns !== "agent-presets") return;
1611
+ if (ns !== "agent-preset-registry") return;
1422
1612
  refresh();
1423
1613
  }), ctx.on("connection/reset", () => {
1424
1614
  refresh();
@@ -1434,37 +1624,31 @@ window.__ModuleLoader__.load({
1434
1624
  "sessions",
1435
1625
  "uiWorkspace"
1436
1626
  ], (scope) => {
1437
- const seat = new AgentPresetSeatController(scope, () => {
1438
- const state = scope.sessions.list.getSnapshot();
1439
- return state.current === void 0 ? void 0 : state.byId[state.current];
1440
- });
1441
- const seatInjected = () => ({
1442
- hooks: { agentPresetSeat: seat.store },
1443
- load: () => seat.load(),
1444
- select: (id) => seat.select(id),
1445
- introduced: () => {
1446
- seat.introduced();
1447
- }
1448
- });
1627
+ const seatInjected = (sessionId) => {
1628
+ const binding = sessionId === void 0 ? void 0 : ctx.sessions.binding(sessionId);
1629
+ const seat = binding === void 0 ? unboundSeat : seatFor(binding);
1630
+ return {
1631
+ hooks: {
1632
+ agentPresetSeat: seat.store,
1633
+ developerTools: ctx.configForms.developerTools.enabled
1634
+ },
1635
+ load: () => seat.load(),
1636
+ select: (id) => seat.select(id),
1637
+ introduced: () => {
1638
+ seat.introduced();
1639
+ }
1640
+ };
1641
+ };
1449
1642
  const labelInjected = () => ({
1450
1643
  hooks: { agentPresets: controller.store },
1451
1644
  load: () => controller.load()
1452
1645
  });
1453
1646
  scope.effect(() => {
1454
- const stop = scope.sessions.list.subscribe(() => {
1455
- seat.apply();
1456
- });
1457
- const settingsMoved = scope.remote.$on("settings/document-updated", (ns) => {
1458
- if (ns !== "agent-presets") return;
1459
- seat.load();
1460
- });
1461
- const readRoster = () => {
1462
- seat.load();
1463
- };
1464
- rosterReaders.add(readRoster);
1465
1647
  creatorDraft = () => {
1648
+ const seat = mainBlankSeat() ?? unboundSeat;
1466
1649
  seat.stage("cordis", true);
1467
1650
  scope.uiWorkspace.startSession();
1651
+ seat.apply();
1468
1652
  };
1469
1653
  const chip = scope.slots.register({
1470
1654
  name: "conversation.hero.agentPreset",
@@ -1479,42 +1663,35 @@ window.__ModuleLoader__.load({
1479
1663
  inject: labelInjected
1480
1664
  }, AgentPresetLabel);
1481
1665
  return () => {
1482
- stop();
1483
- settingsMoved();
1484
- rosterReaders.delete(readRoster);
1485
1666
  creatorDraft = void 0;
1486
1667
  chip();
1487
1668
  label();
1488
1669
  };
1489
1670
  }, "ui-agent-preset: new-session chip and header label");
1490
1671
  });
1672
+ /** Capture the exact blank Session one Settings action may update. */
1673
+ const captureBlankSessionSync = () => {
1674
+ const summary = Object.values(ctx.sessions.list.getSnapshot().byId).find((session) => session.blank && (session.retainedBy.mainView ?? 0) > 0);
1675
+ const binding = summary === void 0 ? void 0 : ctx.sessions.binding(summary.id);
1676
+ const seat = binding === void 0 ? void 0 : seatFor(binding);
1677
+ const sessionId = seat?.blankSessionId();
1678
+ return async (id) => {
1679
+ if (seat === void 0 || sessionId === void 0 || binding === void 0 || seats.get(binding) !== seat) return void 0;
1680
+ return await seat.syncBlankSession(sessionId, id);
1681
+ };
1682
+ };
1491
1683
  const sectionInjected = () => ({
1492
- hooks: { agentPresetSection: section.store },
1684
+ hooks: {
1685
+ agentPresetSection: section.store,
1686
+ developerTools: ctx.configForms.developerTools.enabled
1687
+ },
1493
1688
  load: () => section.load(),
1494
1689
  view: (id) => section.view(id),
1495
1690
  closeView: () => {
1496
1691
  section.closeView();
1497
1692
  },
1498
- beginCopy: (from) => {
1499
- section.beginCopy(from);
1500
- },
1501
- cancelCopy: () => {
1502
- section.cancelCopy();
1503
- },
1504
- setCopyId: (id) => {
1505
- section.setCopyId(id);
1506
- },
1507
- setCopyName: (name) => {
1508
- section.setCopyName(name);
1509
- },
1510
- confirmCopy: () => section.confirmCopy(),
1511
- openLocation: (id) => section.openLocation(id),
1512
1693
  ...creatorDraft === void 0 ? {} : { startCreatorDraft: creatorDraft },
1513
- confirmDelete: (id) => {
1514
- section.confirmDelete(id);
1515
- },
1516
- remove: () => section.remove(),
1517
- makeDefault: (id) => section.makeDefault(id)
1694
+ makeDefault: (id) => section.makeDefault(id, captureBlankSessionSync())
1518
1695
  });
1519
1696
  ctx.slots.inject("settings.section", () => ctx.slots.register({
1520
1697
  name: "settings.section",
@@ -1528,7 +1705,6 @@ window.__ModuleLoader__.load({
1528
1705
  //#endregion
1529
1706
  exports.AGENT_PRESET_SETTINGS_NS = AGENT_PRESET_SETTINGS_NS;
1530
1707
  exports.apply = apply;
1531
- exports.draftBlocker = draftBlocker;
1532
1708
  exports.inject = inject;
1533
1709
  exports.writeDefaultPreset = writeDefaultPreset;
1534
1710
  return module.exports;