dsh-edge 0.2.0 → 0.3.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.
@@ -11,6 +11,16 @@ window.__ModuleLoader__.load({
11
11
  //#region lib/types/client/presentation.js
12
12
  /** Machine value of the preset that requires an explicit GUI risk gate. */
13
13
  const FULL_ACCESS_PRESET = "danger-full-access";
14
+ const PRESET_LABEL_KEYS = new Map([
15
+ ["read-only", "preset.readOnly"],
16
+ ["workspace-write", "preset.workspaceWrite"],
17
+ [FULL_ACCESS_PRESET, "preset.fullAccess"]
18
+ ]);
19
+ const DEFAULT_PRESET_LABELS = {
20
+ "preset.readOnly": "Read Only",
21
+ "preset.workspaceWrite": "Workspace Write",
22
+ "preset.fullAccess": "Full access"
23
+ };
14
24
  /**
15
25
  * Convert conventional kebab-case preset names into user-facing title case.
16
26
  * @param name - host-supplied preset label or key.
@@ -24,10 +34,13 @@ window.__ModuleLoader__.load({
24
34
  * Render a permission preset under its product label.
25
35
  * @param value - preset machine value.
26
36
  * @param name - host-supplied preset name.
27
- * @returns the Full access product label or the conventional display name.
37
+ * @param t - optional locale dictionary lookup for built-in product labels.
38
+ * @returns the built-in product label or the conventional display name.
28
39
  */
29
- function displayPermissionPreset(value, name) {
30
- return value === "danger-full-access" ? "Full access" : displayPresetName(name);
40
+ function displayPermissionPreset(value, name, t) {
41
+ const key = PRESET_LABEL_KEYS.get(value);
42
+ if (key !== void 0 && (name === value || name === DEFAULT_PRESET_LABELS[key])) return t?.(key) ?? DEFAULT_PRESET_LABELS[key];
43
+ return displayPresetName(name);
31
44
  }
32
45
  //#endregion
33
46
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-permission-presets/src/client/PermissionRow.module.css.mjs
@@ -77,7 +90,8 @@ window.__ModuleLoader__.load({
77
90
  if (state.status === "unavailable") return null;
78
91
  const selected = state.options.find((option) => option.id === state.currentValue);
79
92
  const busy = state.status === "loading" || state.status === "saving" || confirmingFullAccess;
80
- const label = selected?.label ?? (busy ? t("loading") : t("unavailable"));
93
+ const optionLabel = (option) => displayPermissionPreset(option.id, option.label, t);
94
+ const label = selected !== void 0 ? optionLabel(selected) : busy ? t("loading") : t("unavailable");
81
95
  const description = state.error ?? t("description");
82
96
  return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
83
97
  className: PermissionRow_module_css_default.row,
@@ -98,7 +112,7 @@ window.__ModuleLoader__.load({
98
112
  },
99
113
  items: state.options.map((option) => ({
100
114
  id: option.id,
101
- label: option.label
115
+ label: optionLabel(option)
102
116
  })),
103
117
  selectedId: state.currentValue,
104
118
  onSelect: (id) => {
@@ -155,11 +169,14 @@ window.__ModuleLoader__.load({
155
169
  "description": "选择新会话的默认权限模式",
156
170
  "loading": "加载中",
157
171
  "unavailable": "不可用",
158
- "confirm.title": "确认启用 Full access?",
159
- "confirm.description": "启用 Full access 后,新会话将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任后续任务时使用。",
172
+ "preset.readOnly": "仅可查看",
173
+ "preset.workspaceWrite": "可写入工作区",
174
+ "preset.fullAccess": "完全权限",
175
+ "confirm.title": "确认启用完全权限?",
176
+ "confirm.description": "启用完全权限后,新会话将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任后续任务时使用。",
160
177
  "confirm.acknowledge": "我已了解风险,并愿意继续",
161
178
  "confirm.cancel": "取消",
162
- "confirm.enable": "启用 Full access"
179
+ "confirm.enable": "启用完全权限"
163
180
  };
164
181
  /** English dictionary, checked complete against the zh key set. */
165
182
  const en = {
@@ -167,6 +184,9 @@ window.__ModuleLoader__.load({
167
184
  "description": "Choose the default permission mode for new sessions",
168
185
  "loading": "Loading",
169
186
  "unavailable": "Unavailable",
187
+ "preset.readOnly": "Read Only",
188
+ "preset.workspaceWrite": "Workspace Write",
189
+ "preset.fullAccess": "Full access",
170
190
  "confirm.title": "Enable Full access?",
171
191
  "confirm.description": "Full access lets new sessions reduce confirmation steps and perform more actions directly, including sensitive operations, file changes, or external commands. Only use it when you trust subsequent tasks.",
172
192
  "confirm.acknowledge": "I understand the risks and want to continue",
@@ -175,14 +195,20 @@ window.__ModuleLoader__.load({
175
195
  };
176
196
  /** Simplified Chinese dictionary for the current-session popup gate. */
177
197
  const accessZh = {
178
- "confirm.title": "确认启用 Full access?",
179
- "confirm.description": "启用 Full access 后,agent 将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任当前任务时使用。",
198
+ "preset.readOnly": "仅可查看",
199
+ "preset.workspaceWrite": "可写入工作区",
200
+ "preset.fullAccess": "完全权限",
201
+ "confirm.title": "确认启用完全权限?",
202
+ "confirm.description": "启用完全权限后,智能体将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任当前任务时使用。",
180
203
  "confirm.acknowledge": "我已了解风险,并愿意继续",
181
204
  "confirm.cancel": "取消",
182
- "confirm.enable": "启用 Full access"
205
+ "confirm.enable": "启用完全权限"
183
206
  };
184
207
  /** English dictionary for the current-session popup gate. */
185
208
  const accessEn = {
209
+ "preset.readOnly": "Read Only",
210
+ "preset.workspaceWrite": "Workspace Write",
211
+ "preset.fullAccess": "Full access",
186
212
  "confirm.title": "Enable Full access?",
187
213
  "confirm.description": "Full access reduces confirmation steps and lets the agent perform more actions directly, including sensitive operations, file changes, or external commands. Only use it when you trust the current task.",
188
214
  "confirm.acknowledge": "I understand the risks and want to continue",
@@ -270,7 +296,8 @@ window.__ModuleLoader__.load({
270
296
  this.derive();
271
297
  }
272
298
  /**
273
- * Persist one preset as the default for subsequently created sessions.
299
+ * Persist one preset as the default for fresh sessions and eligible
300
+ * confirmed blank reuse.
274
301
  * A selection made while one is already saving is ignored — the row's
275
302
  * control is disabled during the save, so this only drops programmatic
276
303
  * double-submits rather than user intent.
@@ -382,7 +409,7 @@ window.__ModuleLoader__.load({
382
409
  function optionsOf(value, t) {
383
410
  return value.options.filter((option) => option.value !== "custom").map((option) => ({
384
411
  id: option.value,
385
- label: displayPermissionPreset(option.value, option.name),
412
+ label: displayPermissionPreset(option.value, option.name, t),
386
413
  ...option.description !== void 0 ? { detail: option.description } : {},
387
414
  ...option.value === value.currentValue ? { active: true } : {},
388
415
  ...option.value === "danger-full-access" ? { confirmation: {
@@ -404,12 +431,18 @@ window.__ModuleLoader__.load({
404
431
  const sessions = ctx.sessions;
405
432
  ctx.effect(() => {
406
433
  const disposers = [ctx.locale.register(ACCESS_NS, "zh", {
434
+ "preset.readOnly": accessZh["preset.readOnly"],
435
+ "preset.workspaceWrite": accessZh["preset.workspaceWrite"],
436
+ "preset.fullAccess": accessZh["preset.fullAccess"],
407
437
  "confirm.title": accessZh["confirm.title"],
408
438
  "confirm.description": accessZh["confirm.description"],
409
439
  "confirm.acknowledge": accessZh["confirm.acknowledge"],
410
440
  "confirm.cancel": accessZh["confirm.cancel"],
411
441
  "confirm.enable": accessZh["confirm.enable"]
412
442
  }), ctx.locale.register(ACCESS_NS, "en", {
443
+ "preset.readOnly": accessEn["preset.readOnly"],
444
+ "preset.workspaceWrite": accessEn["preset.workspaceWrite"],
445
+ "preset.fullAccess": accessEn["preset.fullAccess"],
413
446
  "confirm.title": accessEn["confirm.title"],
414
447
  "confirm.description": accessEn["confirm.description"],
415
448
  "confirm.acknowledge": accessEn["confirm.acknowledge"],
@@ -175,7 +175,7 @@ window.__ModuleLoader__.load({
175
175
  children: "DSH Local Build"
176
176
  }), (0, react_jsx_runtime.jsx)("span", {
177
177
  className: SidebarRoot_module_css_default.buildRevision,
178
- children: "fcbad14"
178
+ children: "9a439af"
179
179
  })] }) })
180
180
  })]
181
181
  })