@prettier-ai/dsh-client-ui-permission-presets 0.1.2-alpha.1 → 0.1.2-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.
- package/README.i18n.yaml +2 -2
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +96 -62
- package/lib/types/client/locales.d.ts +12 -0
- package/lib/types/client/presentation.d.ts +5 -2
- package/lib/types/client/settings-store.d.ts +6 -4
- package/package.json +17 -27
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/ui-permission-presets/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 6a82ebe45edb7e6055bf4c69a2e90bf21255696c
|
|
6
|
+
README.zh.md: bd5588b13cc55d856163ff3eadf04f8059b2f7a9
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
This package provides permission preset surfaces for two lifetimes in the Web GUI: a General-settings row chooses the default for later sessions without switching the current session. A picker on the host `/permission` command switches the current session through one flat preset list with the active value marked.
|
|
12
|
+
This package provides permission preset surfaces for two lifetimes in the Web GUI: a General-settings row chooses the default for later sessions without switching the current session. A picker on the host `/permission` command switches the current session through one flat preset list with the active value marked. Canonical built-in names render as locale-owned product labels, explicit host labels remain unchanged, and unknown kebab-case names render in title case. Choosing full access requires an explicit risk acknowledgement before either surface writes it. Both surfaces read one host-computed projection and write through one path, so the pushed projection frame is the single confirmation both follow.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -29,11 +29,11 @@ Mount this plugin alongside the settings and commands packages; the permission r
|
|
|
29
29
|
|
|
30
30
|
### The picker
|
|
31
31
|
|
|
32
|
-
A pick submits the `/permission <preset>` command line. The argued path (`/permission <preset>` typed directly) still switches directly; the decoration replaces only the bare invocation.
|
|
32
|
+
A pick submits the `/permission <preset>` command line. The argued path (`/permission <preset>` typed directly) still switches directly; the decoration replaces only the bare invocation. The built-in labels are `Read Only`, `Workspace Write`, and `Full access` in English and `仅可查看`, `可写入工作区`, and `完全权限` in Chinese; `custom` is display state, never a target.
|
|
33
33
|
|
|
34
34
|
### The Settings row
|
|
35
35
|
|
|
36
|
-
The row derives its options from the host's dynamic `defaultPreset` enum and writes one settings mutation. The value applies only when a later session is created; changing it never switches or rewrites the current session.
|
|
36
|
+
The row derives its options from the host's dynamic `defaultPreset` enum, uses the same localized labels as the current-session picker, and writes one settings mutation. The value applies only when a later session is created; changing it never switches or rewrites the current session.
|
|
37
37
|
|
|
38
38
|
-----
|
|
39
39
|
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
本包为 Web GUI 中两种生命周期提供权限预设表面:通用设置中的一行选择之后创建会话所用的默认值,但不会切换当前会话。挂在宿主 `/permission` 命令上的选择器通过一张扁平预设列表切换当前会话,并标记 active
|
|
12
|
+
本包为 Web GUI 中两种生命周期提供权限预设表面:通用设置中的一行选择之后创建会话所用的默认值,但不会切换当前会话。挂在宿主 `/permission` 命令上的选择器通过一张扁平预设列表切换当前会话,并标记 active 值。规范内置名称渲染为 locale 所有的产品标签,显式 host 标签保持原样,未知 kebab-case 名称渲染为 Title Case。选择完全权限时,该行或选择器写入前必须先显式确认风险。两个表面读取同一份宿主计算的投影、经同一条路径写入,因此推送的投影帧是两者共同跟随的唯一确认。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -29,11 +29,11 @@ kind: "package-reference"
|
|
|
29
29
|
|
|
30
30
|
### 选择器
|
|
31
31
|
|
|
32
|
-
选中即提交 `/permission <preset>` 命令行。带参路径(直接键入 `/permission <preset
|
|
32
|
+
选中即提交 `/permission <preset>` 命令行。带参路径(直接键入 `/permission <preset>`)仍直接切换;装饰只替换裸调用。内置标签在英文界面中是 `Read Only`、`Workspace Write` 和 `Full access`,在中文界面中是「仅可查看」「可写入工作区」和「完全权限」;`custom` 只是显示状态,绝非目标。
|
|
33
33
|
|
|
34
34
|
### 设置行
|
|
35
35
|
|
|
36
|
-
该行从宿主动态的 `defaultPreset` enum
|
|
36
|
+
该行从宿主动态的 `defaultPreset` enum 推导选项,使用与当前会话选择器相同的本地化标签,并写入一条设置变更操作。该值只在之后创建会话时生效;改变它绝不会切换或改写当前会话。
|
|
37
37
|
|
|
38
38
|
-----
|
|
39
39
|
|
package/lib/client.js
CHANGED
|
@@ -8,9 +8,74 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let _prettier_ai_dsh_client_ui_primitives = require("@prettier-ai/dsh-client-ui-primitives");
|
|
10
10
|
let _prettier_ai_dsh_client_store = require("@prettier-ai/dsh-client-store");
|
|
11
|
+
//#region lib/types/client/locales.js
|
|
12
|
+
/** `settings.permission` namespace dictionaries (the Permission row's copy). */
|
|
13
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
14
|
+
const zh = {
|
|
15
|
+
"title": "权限",
|
|
16
|
+
"description": "选择新会话的默认权限模式",
|
|
17
|
+
"loading": "加载中",
|
|
18
|
+
"unavailable": "不可用",
|
|
19
|
+
"preset.readOnly": "仅可查看",
|
|
20
|
+
"preset.workspaceWrite": "可写入工作区",
|
|
21
|
+
"preset.fullAccess": "完全权限",
|
|
22
|
+
"confirm.title": "确认启用完全权限?",
|
|
23
|
+
"confirm.description": "启用完全权限后,新会话将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任后续任务时使用。",
|
|
24
|
+
"confirm.acknowledge": "我已了解风险,并愿意继续",
|
|
25
|
+
"confirm.cancel": "取消",
|
|
26
|
+
"confirm.enable": "启用完全权限"
|
|
27
|
+
};
|
|
28
|
+
/** English dictionary, checked complete against the zh key set. */
|
|
29
|
+
const en = {
|
|
30
|
+
"title": "Permission",
|
|
31
|
+
"description": "Choose the default permission mode for new sessions",
|
|
32
|
+
"loading": "Loading",
|
|
33
|
+
"unavailable": "Unavailable",
|
|
34
|
+
"preset.readOnly": "Read Only",
|
|
35
|
+
"preset.workspaceWrite": "Workspace Write",
|
|
36
|
+
"preset.fullAccess": "Full access",
|
|
37
|
+
"confirm.title": "Enable Full access?",
|
|
38
|
+
"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.",
|
|
39
|
+
"confirm.acknowledge": "I understand the risks and want to continue",
|
|
40
|
+
"confirm.cancel": "Cancel",
|
|
41
|
+
"confirm.enable": "Enable Full access"
|
|
42
|
+
};
|
|
43
|
+
/** Simplified Chinese dictionary for the current-session popup gate. */
|
|
44
|
+
const accessZh = {
|
|
45
|
+
"preset.readOnly": "仅可查看",
|
|
46
|
+
"preset.workspaceWrite": "可写入工作区",
|
|
47
|
+
"preset.fullAccess": "完全权限",
|
|
48
|
+
"confirm.title": "确认启用完全权限?",
|
|
49
|
+
"confirm.description": "启用完全权限后,智能体将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任当前任务时使用。",
|
|
50
|
+
"confirm.acknowledge": "我已了解风险,并愿意继续",
|
|
51
|
+
"confirm.cancel": "取消",
|
|
52
|
+
"confirm.enable": "启用完全权限"
|
|
53
|
+
};
|
|
54
|
+
/** English dictionary for the current-session popup gate. */
|
|
55
|
+
const accessEn = {
|
|
56
|
+
"preset.readOnly": "Read Only",
|
|
57
|
+
"preset.workspaceWrite": "Workspace Write",
|
|
58
|
+
"preset.fullAccess": "Full access",
|
|
59
|
+
"confirm.title": "Enable Full access?",
|
|
60
|
+
"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.",
|
|
61
|
+
"confirm.acknowledge": "I understand the risks and want to continue",
|
|
62
|
+
"confirm.cancel": "Cancel",
|
|
63
|
+
"confirm.enable": "Enable Full access"
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
11
66
|
//#region lib/types/client/presentation.js
|
|
12
67
|
/** Machine value of the preset that requires an explicit GUI risk gate. */
|
|
13
68
|
const FULL_ACCESS_PRESET = "danger-full-access";
|
|
69
|
+
const PRESET_LABEL_KEYS = new Map([
|
|
70
|
+
["read-only", "preset.readOnly"],
|
|
71
|
+
["workspace-write", "preset.workspaceWrite"],
|
|
72
|
+
[FULL_ACCESS_PRESET, "preset.fullAccess"]
|
|
73
|
+
]);
|
|
74
|
+
const DEFAULT_PRESET_LABELS = {
|
|
75
|
+
"preset.readOnly": en["preset.readOnly"],
|
|
76
|
+
"preset.workspaceWrite": en["preset.workspaceWrite"],
|
|
77
|
+
"preset.fullAccess": en["preset.fullAccess"]
|
|
78
|
+
};
|
|
14
79
|
/**
|
|
15
80
|
* Convert conventional kebab-case preset names into user-facing title case.
|
|
16
81
|
* @param name - host-supplied preset label or key.
|
|
@@ -24,10 +89,13 @@ window.__ModuleLoader__.load({
|
|
|
24
89
|
* Render a permission preset under its product label.
|
|
25
90
|
* @param value - preset machine value.
|
|
26
91
|
* @param name - host-supplied preset name.
|
|
27
|
-
* @
|
|
92
|
+
* @param t - optional locale dictionary lookup for built-in product labels.
|
|
93
|
+
* @returns the built-in product label or the conventional display name.
|
|
28
94
|
*/
|
|
29
|
-
function displayPermissionPreset(value, name) {
|
|
30
|
-
|
|
95
|
+
function displayPermissionPreset(value, name, t) {
|
|
96
|
+
const key = PRESET_LABEL_KEYS.get(value);
|
|
97
|
+
if (key !== void 0 && (name === value || name === DEFAULT_PRESET_LABELS[key])) return t?.(key) ?? DEFAULT_PRESET_LABELS[key];
|
|
98
|
+
return displayPresetName(name);
|
|
31
99
|
}
|
|
32
100
|
//#endregion
|
|
33
101
|
//#region \0dsh-css:/home/runner/work/dsh-publisher/dsh-publisher/upstream/packages/client/ui-permission-presets/src/client/PermissionRow.module.css.mjs
|
|
@@ -77,7 +145,8 @@ window.__ModuleLoader__.load({
|
|
|
77
145
|
if (state.status === "unavailable") return null;
|
|
78
146
|
const selected = state.options.find((option) => option.id === state.currentValue);
|
|
79
147
|
const busy = state.status === "loading" || state.status === "saving" || confirmingFullAccess;
|
|
80
|
-
const
|
|
148
|
+
const optionLabel = (option) => displayPermissionPreset(option.id, option.label, t);
|
|
149
|
+
const label = selected !== void 0 ? optionLabel(selected) : busy ? t("loading") : t("unavailable");
|
|
81
150
|
const description = state.error ?? t("description");
|
|
82
151
|
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
83
152
|
className: PermissionRow_module_css_default.row,
|
|
@@ -98,7 +167,7 @@ window.__ModuleLoader__.load({
|
|
|
98
167
|
},
|
|
99
168
|
items: state.options.map((option) => ({
|
|
100
169
|
id: option.id,
|
|
101
|
-
label: option
|
|
170
|
+
label: optionLabel(option)
|
|
102
171
|
})),
|
|
103
172
|
selectedId: state.currentValue,
|
|
104
173
|
onSelect: (id) => {
|
|
@@ -148,49 +217,6 @@ window.__ModuleLoader__.load({
|
|
|
148
217
|
})] });
|
|
149
218
|
}
|
|
150
219
|
//#endregion
|
|
151
|
-
//#region lib/types/client/locales.js
|
|
152
|
-
/** `settings.permission` namespace dictionaries (the Permission row's copy). */
|
|
153
|
-
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
154
|
-
const zh = {
|
|
155
|
-
"title": "权限",
|
|
156
|
-
"description": "选择新会话的默认权限模式",
|
|
157
|
-
"loading": "加载中",
|
|
158
|
-
"unavailable": "不可用",
|
|
159
|
-
"confirm.title": "确认启用 Full access?",
|
|
160
|
-
"confirm.description": "启用 Full access 后,新会话将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任后续任务时使用。",
|
|
161
|
-
"confirm.acknowledge": "我已了解风险,并愿意继续",
|
|
162
|
-
"confirm.cancel": "取消",
|
|
163
|
-
"confirm.enable": "启用 Full access"
|
|
164
|
-
};
|
|
165
|
-
/** English dictionary, checked complete against the zh key set. */
|
|
166
|
-
const en = {
|
|
167
|
-
"title": "Permission",
|
|
168
|
-
"description": "Choose the default permission mode for new sessions",
|
|
169
|
-
"loading": "Loading",
|
|
170
|
-
"unavailable": "Unavailable",
|
|
171
|
-
"confirm.title": "Enable Full access?",
|
|
172
|
-
"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.",
|
|
173
|
-
"confirm.acknowledge": "I understand the risks and want to continue",
|
|
174
|
-
"confirm.cancel": "Cancel",
|
|
175
|
-
"confirm.enable": "Enable Full access"
|
|
176
|
-
};
|
|
177
|
-
/** Simplified Chinese dictionary for the current-session popup gate. */
|
|
178
|
-
const accessZh = {
|
|
179
|
-
"confirm.title": "确认启用 Full access?",
|
|
180
|
-
"confirm.description": "启用 Full access 后,agent 将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任当前任务时使用。",
|
|
181
|
-
"confirm.acknowledge": "我已了解风险,并愿意继续",
|
|
182
|
-
"confirm.cancel": "取消",
|
|
183
|
-
"confirm.enable": "启用 Full access"
|
|
184
|
-
};
|
|
185
|
-
/** English dictionary for the current-session popup gate. */
|
|
186
|
-
const accessEn = {
|
|
187
|
-
"confirm.title": "Enable Full access?",
|
|
188
|
-
"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.",
|
|
189
|
-
"confirm.acknowledge": "I understand the risks and want to continue",
|
|
190
|
-
"confirm.cancel": "Cancel",
|
|
191
|
-
"confirm.enable": "Enable Full access"
|
|
192
|
-
};
|
|
193
|
-
//#endregion
|
|
194
220
|
//#region lib/types/client/settings-store.js
|
|
195
221
|
/**
|
|
196
222
|
* Permission default-settings controller. The permission descriptor comes
|
|
@@ -230,7 +256,7 @@ window.__ModuleLoader__.load({
|
|
|
230
256
|
/** Controller deriving the row from the shared mirror and writing the default through it. */
|
|
231
257
|
var PermissionPresetSettingsController = class {
|
|
232
258
|
describeFace;
|
|
233
|
-
|
|
259
|
+
ctx;
|
|
234
260
|
schema;
|
|
235
261
|
/** Row snapshot consumed through a bound selector hook. */
|
|
236
262
|
store = (0, _prettier_ai_dsh_client_store.createSnapshotStore)({
|
|
@@ -246,12 +272,13 @@ window.__ModuleLoader__.load({
|
|
|
246
272
|
disposed = false;
|
|
247
273
|
/**
|
|
248
274
|
* @param describeFace - the shared mirror's read/fold face (descriptor and schema source).
|
|
249
|
-
* @param
|
|
275
|
+
* @param ctx - the row plugin's context, whose `remote.settings` namespace
|
|
276
|
+
* carries the `defaultPreset` write.
|
|
250
277
|
* @param schema - settings-owned schema operations.
|
|
251
278
|
*/
|
|
252
|
-
constructor(describeFace,
|
|
279
|
+
constructor(describeFace, ctx, schema) {
|
|
253
280
|
this.describeFace = describeFace;
|
|
254
|
-
this.
|
|
281
|
+
this.ctx = ctx;
|
|
255
282
|
this.schema = schema;
|
|
256
283
|
}
|
|
257
284
|
/**
|
|
@@ -287,21 +314,22 @@ window.__ModuleLoader__.load({
|
|
|
287
314
|
draft.status = "saving";
|
|
288
315
|
draft.error = null;
|
|
289
316
|
});
|
|
317
|
+
let response;
|
|
290
318
|
try {
|
|
291
|
-
|
|
319
|
+
response = await this.ctx.remote.settings.mutate(PERMISSION_SETTINGS_NS, [{
|
|
292
320
|
op: "set",
|
|
293
321
|
path: ["defaultPreset"],
|
|
294
322
|
value: preset
|
|
295
323
|
}], view.revision);
|
|
296
|
-
|
|
297
|
-
this.saving = false;
|
|
298
|
-
if (this.disposed) return;
|
|
299
|
-
this.describeFace.acceptView(response.value);
|
|
300
|
-
} catch (error) {
|
|
324
|
+
} finally {
|
|
301
325
|
this.saving = false;
|
|
302
|
-
if (this.disposed) return;
|
|
303
|
-
this.fail(error);
|
|
304
326
|
}
|
|
327
|
+
if (this.disposed) return;
|
|
328
|
+
if (!response.ok) {
|
|
329
|
+
this.fail(response.error);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
this.describeFace.acceptView(response.value);
|
|
305
333
|
}
|
|
306
334
|
/** Stop following the mirror; later publishes leave the snapshot alone. */
|
|
307
335
|
dispose() {
|
|
@@ -379,7 +407,7 @@ window.__ModuleLoader__.load({
|
|
|
379
407
|
function optionsOf(value, t) {
|
|
380
408
|
return value.options.filter((option) => option.value !== "custom").map((option) => ({
|
|
381
409
|
id: option.value,
|
|
382
|
-
label: displayPermissionPreset(option.value, option.name),
|
|
410
|
+
label: displayPermissionPreset(option.value, option.name, t),
|
|
383
411
|
...option.description !== void 0 ? { detail: option.description } : {},
|
|
384
412
|
...option.value === value.currentValue ? { active: true } : {},
|
|
385
413
|
...option.value === "danger-full-access" ? { confirmation: {
|
|
@@ -401,12 +429,18 @@ window.__ModuleLoader__.load({
|
|
|
401
429
|
const sessions = ctx.sessions;
|
|
402
430
|
ctx.effect(() => {
|
|
403
431
|
const disposers = [ctx.locale.register(ACCESS_NS, "zh", {
|
|
432
|
+
"preset.readOnly": accessZh["preset.readOnly"],
|
|
433
|
+
"preset.workspaceWrite": accessZh["preset.workspaceWrite"],
|
|
434
|
+
"preset.fullAccess": accessZh["preset.fullAccess"],
|
|
404
435
|
"confirm.title": accessZh["confirm.title"],
|
|
405
436
|
"confirm.description": accessZh["confirm.description"],
|
|
406
437
|
"confirm.acknowledge": accessZh["confirm.acknowledge"],
|
|
407
438
|
"confirm.cancel": accessZh["confirm.cancel"],
|
|
408
439
|
"confirm.enable": accessZh["confirm.enable"]
|
|
409
440
|
}), ctx.locale.register(ACCESS_NS, "en", {
|
|
441
|
+
"preset.readOnly": accessEn["preset.readOnly"],
|
|
442
|
+
"preset.workspaceWrite": accessEn["preset.workspaceWrite"],
|
|
443
|
+
"preset.fullAccess": accessEn["preset.fullAccess"],
|
|
410
444
|
"confirm.title": accessEn["confirm.title"],
|
|
411
445
|
"confirm.description": accessEn["confirm.description"],
|
|
412
446
|
"confirm.acknowledge": accessEn["confirm.acknowledge"],
|
|
@@ -423,7 +457,7 @@ window.__ModuleLoader__.load({
|
|
|
423
457
|
zh,
|
|
424
458
|
en
|
|
425
459
|
}), "ui-permission: settings row dictionaries");
|
|
426
|
-
const controller = new PermissionPresetSettingsController(ctx.settingsScope.describe(),
|
|
460
|
+
const controller = new PermissionPresetSettingsController(ctx.settingsScope.describe(), ctx, ctx.settingsSchema);
|
|
427
461
|
const load = () => controller.load();
|
|
428
462
|
const select = (preset) => controller.select(preset);
|
|
429
463
|
const injected = () => ({
|
|
@@ -5,6 +5,9 @@ export declare const zh: {
|
|
|
5
5
|
description: string;
|
|
6
6
|
loading: string;
|
|
7
7
|
unavailable: string;
|
|
8
|
+
'preset.readOnly': string;
|
|
9
|
+
'preset.workspaceWrite': string;
|
|
10
|
+
'preset.fullAccess': string;
|
|
8
11
|
'confirm.title': string;
|
|
9
12
|
'confirm.description': string;
|
|
10
13
|
'confirm.acknowledge': string;
|
|
@@ -19,6 +22,9 @@ export declare const en: {
|
|
|
19
22
|
description: string;
|
|
20
23
|
loading: string;
|
|
21
24
|
unavailable: string;
|
|
25
|
+
'preset.readOnly': string;
|
|
26
|
+
'preset.workspaceWrite': string;
|
|
27
|
+
'preset.fullAccess': string;
|
|
22
28
|
'confirm.title': string;
|
|
23
29
|
'confirm.description': string;
|
|
24
30
|
'confirm.acknowledge': string;
|
|
@@ -27,6 +33,9 @@ export declare const en: {
|
|
|
27
33
|
};
|
|
28
34
|
/** Simplified Chinese dictionary for the current-session popup gate. */
|
|
29
35
|
export declare const accessZh: {
|
|
36
|
+
'preset.readOnly': string;
|
|
37
|
+
'preset.workspaceWrite': string;
|
|
38
|
+
'preset.fullAccess': string;
|
|
30
39
|
'confirm.title': string;
|
|
31
40
|
'confirm.description': string;
|
|
32
41
|
'confirm.acknowledge': string;
|
|
@@ -37,6 +46,9 @@ export declare const accessZh: {
|
|
|
37
46
|
export type PermissionAccessKey = keyof typeof accessZh;
|
|
38
47
|
/** English dictionary for the current-session popup gate. */
|
|
39
48
|
export declare const accessEn: {
|
|
49
|
+
'preset.readOnly': string;
|
|
50
|
+
'preset.workspaceWrite': string;
|
|
51
|
+
'preset.fullAccess': string;
|
|
40
52
|
'confirm.title': string;
|
|
41
53
|
'confirm.description': string;
|
|
42
54
|
'confirm.acknowledge': string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Machine value of the preset that requires an explicit GUI risk gate. */
|
|
2
2
|
export declare const FULL_ACCESS_PRESET = "danger-full-access";
|
|
3
|
+
/** Locale dictionary key for a built-in permission preset label. */
|
|
4
|
+
export type PermissionPresetLabelKey = 'preset.readOnly' | 'preset.workspaceWrite' | 'preset.fullAccess';
|
|
3
5
|
/**
|
|
4
6
|
* Convert conventional kebab-case preset names into user-facing title case.
|
|
5
7
|
* @param name - host-supplied preset label or key.
|
|
@@ -10,7 +12,8 @@ export declare function displayPresetName(name: string): string;
|
|
|
10
12
|
* Render a permission preset under its product label.
|
|
11
13
|
* @param value - preset machine value.
|
|
12
14
|
* @param name - host-supplied preset name.
|
|
13
|
-
* @
|
|
15
|
+
* @param t - optional locale dictionary lookup for built-in product labels.
|
|
16
|
+
* @returns the built-in product label or the conventional display name.
|
|
14
17
|
*/
|
|
15
|
-
export declare function displayPermissionPreset(value: string, name: string): string;
|
|
18
|
+
export declare function displayPermissionPreset(value: string, name: string, t?: (key: PermissionPresetLabelKey) => string): string;
|
|
16
19
|
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* only `defaultPreset`, carry the descriptor revision, and fold their answer
|
|
6
6
|
* back into the mirror.
|
|
7
7
|
*/
|
|
8
|
+
import type { Context as ClientContext } from '@prettier-ai/cordis';
|
|
8
9
|
import type { SettingsNamespaceView } from '@prettier-ai/dsh-api-remotes/client';
|
|
9
10
|
import { type SnapshotStore } from '@prettier-ai/dsh-client-store';
|
|
10
|
-
import type { SettingsDescribeFace, SettingsSchemaService
|
|
11
|
+
import type { SettingsDescribeFace, SettingsSchemaService } from '@prettier-ai/dsh-client-ui-settings/client';
|
|
11
12
|
/** Permission's settings namespace on the host wire. */
|
|
12
13
|
export declare const PERMISSION_SETTINGS_NS = "permission";
|
|
13
14
|
/** One selectable new-session default. */
|
|
@@ -39,7 +40,7 @@ export declare function permissionDefaultOf(view: SettingsNamespaceView, schema:
|
|
|
39
40
|
/** Controller deriving the row from the shared mirror and writing the default through it. */
|
|
40
41
|
export declare class PermissionPresetSettingsController {
|
|
41
42
|
private readonly describeFace;
|
|
42
|
-
private readonly
|
|
43
|
+
private readonly ctx;
|
|
43
44
|
private readonly schema;
|
|
44
45
|
/** Row snapshot consumed through a bound selector hook. */
|
|
45
46
|
readonly store: SnapshotStore<PermissionSettingsState>;
|
|
@@ -48,10 +49,11 @@ export declare class PermissionPresetSettingsController {
|
|
|
48
49
|
private disposed;
|
|
49
50
|
/**
|
|
50
51
|
* @param describeFace - the shared mirror's read/fold face (descriptor and schema source).
|
|
51
|
-
* @param
|
|
52
|
+
* @param ctx - the row plugin's context, whose `remote.settings` namespace
|
|
53
|
+
* carries the `defaultPreset` write.
|
|
52
54
|
* @param schema - settings-owned schema operations.
|
|
53
55
|
*/
|
|
54
|
-
constructor(describeFace: SettingsDescribeFace,
|
|
56
|
+
constructor(describeFace: SettingsDescribeFace, ctx: ClientContext, schema: SettingsSchemaService);
|
|
55
57
|
/**
|
|
56
58
|
* Begin following the mirror (idempotent) and reflect its current answer.
|
|
57
59
|
* @returns settlement once the snapshot reflects the mirror.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prettier-ai/dsh-client-ui-permission-presets",
|
|
3
3
|
"description": "Permission surfaces: a new-session default in General settings and a current-session /permission popup over the permissions projection",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -43,36 +43,26 @@
|
|
|
43
43
|
},
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@prettier-ai/
|
|
47
|
-
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
48
|
-
"@prettier-ai/dsh-client-ui-commands": "^0.1.2-alpha.1",
|
|
49
|
-
"@prettier-ai/cordis": "^4.0.1",
|
|
50
|
-
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.1",
|
|
51
|
-
"@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.1",
|
|
52
|
-
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
|
|
53
|
-
"@prettier-ai/dsh-permission-presets": "^0.1.2-alpha.1",
|
|
54
|
-
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
|
|
55
|
-
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
|
|
56
|
-
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1"
|
|
46
|
+
"@prettier-ai/cordis": "^4.0.2"
|
|
57
47
|
},
|
|
58
48
|
"devDependencies": {
|
|
59
49
|
"@types/react": "~18.3.1",
|
|
60
50
|
"react": "^18.2.0",
|
|
61
|
-
"@prettier-ai/
|
|
62
|
-
"@prettier-ai/
|
|
63
|
-
"@prettier-ai/dsh-
|
|
64
|
-
"@prettier-ai/dsh-
|
|
65
|
-
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.
|
|
66
|
-
"@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.
|
|
67
|
-
"@prettier-ai/dsh-client-ui-
|
|
68
|
-
"@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.
|
|
69
|
-
"@prettier-ai/dsh-client-ui-
|
|
70
|
-
"@prettier-ai/dsh-client-ui-
|
|
71
|
-
"@prettier-ai/dsh-
|
|
72
|
-
"@prettier-ai/dsh-
|
|
73
|
-
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.
|
|
74
|
-
"@prettier-ai/dsh-
|
|
75
|
-
"@prettier-ai/dsh-client-ui-
|
|
51
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.2",
|
|
52
|
+
"@prettier-ai/cordis": "^4.0.2",
|
|
53
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.2",
|
|
54
|
+
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.2",
|
|
55
|
+
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.2",
|
|
56
|
+
"@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.2",
|
|
57
|
+
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.2",
|
|
58
|
+
"@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.2",
|
|
59
|
+
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.2",
|
|
60
|
+
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.2",
|
|
61
|
+
"@prettier-ai/dsh-permission-presets": "^0.1.2-alpha.2",
|
|
62
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.2",
|
|
63
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.2",
|
|
64
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.2",
|
|
65
|
+
"@prettier-ai/dsh-client-ui-commands": "^0.1.2-alpha.2"
|
|
76
66
|
},
|
|
77
67
|
"files": [
|
|
78
68
|
"lib/index.js",
|